| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888 |
- <!DOCTYPE html><html data-revision="$Revision: 8753 $" lang=en-GB-x-hixie><title>HTML Standard</title><script>
- var loadTimer = new Date();
- var current_revision = "r" + document.documentElement.getAttribute('data-revision').substr(11);
- current_revision = current_revision.substr(0, current_revision.length - 2);
- var last_known_revision = current_revision;
- function F( /* varargs... */) {
- var fragment = document.createDocumentFragment();
- for (var index = 0; index < arguments.length; index += 1) {
- if (arguments[index] instanceof Array) {
- fragment.appendChild(F.apply(this, arguments[index]));
- } else if (typeof arguments[index] == 'string') {
- fragment.appendChild(document.createTextNode(arguments[index]));
- } else {
- fragment.appendChild(arguments[index]);
- }
- }
- return fragment;
- }
- function E(name, /* optional */ attributes /*, varargs... */) {
- var element = document.createElement(name);
- var index = 1;
- if ((arguments.length > 1) && (typeof attributes != 'string') &&
- (!(attributes instanceof Node)) && (!(attributes instanceof Array))) {
- for (var attName in attributes) {
- if (typeof attributes[attName] == 'boolean') {
- if (attributes[attName])
- element.setAttribute(attName, '');
- } else if (typeof attributes[attName] == 'function') {
- element[attName] = attributes[attName];
- } else {
- element.setAttribute(attName, attributes[attName]);
- }
- }
- index = 2;
- }
- for (; index < arguments.length; index += 1) {
- if (arguments[index] instanceof Array) {
- element.appendChild(F.apply(this, arguments[index]));
- } else if (typeof arguments[index] == 'string') {
- element.appendChild(document.createTextNode(arguments[index]));
- } else {
- element.appendChild(arguments[index]);
- }
- }
- return element;
- }
- function getCookie(name) {
- var params = location.search.substr(1).split("&");
- for (var index = 0; index < params.length; index++) {
- if (params[index] == name)
- return "1";
- var data = params[index].split("=");
- if (data[0] == name)
- return unescape(data[1]);
- }
- var cookies = document.cookie.split("; ");
- for (var index = 0; index < cookies.length; index++) {
- var data = cookies[index].split("=");
- if (data[0] == name)
- return unescape(data[1]);
- }
- return null;
- }
- var currentAlert;
- var currentAlertTimeout;
- function showAlert(s, href) {
- if (!currentAlert) {
- currentAlert = document.createElement('div');
- currentAlert.id = 'alert';
- var x = document.createElement('button');
- x.textContent = '\u2573';
- x.onclick = closeAlert2;
- currentAlert.appendChild(x);
- currentAlert.appendChild(document.createElement('span'));
- currentAlert.onmousemove = function () {
- clearTimeout(currentAlertTimeout);
- currentAlert.className = '';
- currentAlertTimeout = setTimeout(closeAlert, 10000);
- }
- document.body.appendChild(currentAlert);
- } else {
- clearTimeout(currentAlertTimeout);
- currentAlert.className = '';
- }
- currentAlert.lastChild.textContent = '';
- currentAlert.lastChild.appendChild(F(s));
- if (href) {
- var link = document.createElement('a');
- link.href = href;
- link.textContent = href;
- currentAlert.lastChild.appendChild(F(' ', link));
- }
- currentAlertTimeout = setTimeout(closeAlert, 10000);
- }
- function closeAlert() {
- clearTimeout(currentAlertTimeout);
- if (currentAlert) {
- currentAlert.className = 'closed';
- currentAlertTimeout = setTimeout(closeAlert2, 3000);
- }
- }
- function closeAlert2() {
- clearTimeout(currentAlertTimeout);
- if (currentAlert) {
- currentAlert.parentNode.removeChild(currentAlert);
- currentAlert = null;
- }
- }
- window.addEventListener('keydown', function (event) {
- if (event.keyCode == 27) {
- if (currentAlert)
- closeAlert2();
- } else {
- closeAlert();
- }
- }, false);
- window.addEventListener('scroll', function (event) {
- closeAlert();
- }, false);
- function load(script) {
- var e = document.createElement('script');
- e.setAttribute('src', '//www.whatwg.org/specs/web-apps/current-work/' + script);
- document.body.appendChild(e);
- }
- var startedInit = 0;
- function init() {
- startedInit = 1;
- if (location.search == '?slow-browser')
- return;
- load('reviewer.js');
- if (document.documentElement.className == "big" || document.documentElement.className == "big split index")
- load('toc.js');
- load('updater.js');
- load('dfn.js');
- load('status.js');
- if (getCookie('profile') == '1')
- document.getElementsByTagName('h2')[0].textContent += '; load: ' + (new Date() - loadTimer) + 'ms';
- }
- if (document.documentElement.className == "")
- setTimeout(function () {
- if (!startedInit)
- showAlert("Too slow? Try reading the multipage copy of the spec instead:", "http://whatwg.org/html");
- }, 6000);
- window.addEventListener('keypress', function (event) {
- if ((event.which == 114) && (event.metaKey)) {
- if (!confirm('Are you sure you want to reload this page?'))
- event.preventDefault();
- }
- }, false);
- </script><link rel=stylesheet href=//www.whatwg.org/style/specification><link rel=icon href=//www.whatwg.org/images/icon><style>
- .proposal { border: blue solid; padding: 1em; }
- .bad, .bad *:not(.X\58X) { color: gray; border-color: gray; background: transparent; }
- #updatesStatus { display: none; z-index: 10; }
- #updatesStatus.relevant { display: block; position: fixed; right: 1em; top: 1em; padding: 0.5em; font: bold small sans-serif; min-width: 25em; width: 30%; max-width: 40em; height: auto; border: ridge 4px gray; background: #EEEEEE; color: black; }
- div.head .logo { width: 11em; margin-bottom: 20em; }
- #configUI { position: absolute; z-index: 20; top: auto; right: 0; width: 11em; padding: 0 0.5em 0 0.5em; font-size: small; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em 0 0 1em; -moz-border-radius: 1em 0 0 1em; }
- #configUI p { margin: 0.75em 0; padding: 0.3em; }
- #configUI p label { display: block; }
- #configUI #updateUI, #configUI .loginUI { text-align: center; }
- #configUI input[type=button] { display: block; margin: auto; }
- #configUI :link, #configUI :visited { color: white; }
- #configUI :link:hover, #configUI :visited:hover { background: transparent; }
- #alert { position: fixed; top: 20%; left: 20%; right: 20%; font-size: 2em; padding: 0.5em; z-index: 40; background: gray; background: rgba(32,32,32,0.9); color: white; border-radius: 1em; -moz-border-radius: 1em; -webkit-transition: opacity 1s linear; }
- #alert.closed { opacity: 0; }
- #alert button { position: absolute; top: -1em; right: 2em; border-radius: 1em 1em 0 0; border: none; line-height: 0.9; color: white; background: rgb(64,64,64); font-size: 0.6em; font-weight: 900; cursor: pointer; }
- #alert :link, #alert :visited { color: white; }
- #alert :link:hover, #alert :visited:hover { background: transparent; }
- @media print { #configUI { display: none; } }
- .rfc2119 { font-variant: small-caps; text-shadow: 0 0 0.5em yellow; position: static; }
- .rfc2119::after { position: absolute; left: 0; width: 25px; text-align: center; color: yellow; text-shadow: 0.075em 0.075em 0.2em black; }
- .rfc2119.m\ust::after { content: '\2605'; }
- .rfc2119.s\hould::after { content: '\2606'; }
- [hidden] { display: none; }
- .fingerprint { float: right; }
- .applies .yes { background: yellow; }
- </style><style>
- .applies thead th > * { display: block; }
- .applies thead code { display: block; }
- .applies td { text-align: center; }
- .matrix, .matrix td { border: hidden; text-align: right; }
- .matrix { margin-left: 2em; }
- .vertical-summary-table tr > th[rowspan="2"]:first-child + th,
- .vertical-summary-table tr > td[rowspan="2"]:first-child + td { border-bottom: hidden; }
- .dice-example { border-collapse: collapse; border-style: hidden solid solid hidden; border-width: thin; margin-left: 3em; }
- .dice-example caption { width: 30em; font-size: smaller; font-style: italic; padding: 0.75em 0; text-align: left; }
- .dice-example td, .dice-example th { border: solid thin; width: 1.35em; height: 1.05em; text-align: center; padding: 0; }
- td.eg { border-width: thin; text-align: center; }
- #table-example-1 { border: solid thin; border-collapse: collapse; margin-left: 3em; }
- #table-example-1 caption { padding-bottom: 0.5em; }
- #table-example-1 thead, #table-example-1 tbody { border: none; }
- #table-example-1 th, #table-example-1 td { border: solid thin; }
- #table-example-1 th { font-weight: normal; }
- #table-example-1 td { border-style: none solid; vertical-align: top; }
- #table-example-1 th { padding: 0.5em; vertical-align: middle; text-align: center; }
- #table-example-1 tbody tr:first-child td { padding-top: 0.5em; }
- #table-example-1 tbody tr:last-child td { padding-bottom: 1.5em; }
- #table-example-1 tbody td:first-child { padding-left: 2.5em; padding-right: 0; width: 9em; }
- #table-example-1 tbody td:first-child::after { content: leader(". "); }
- #table-example-1 tbody td { padding-left: 2em; padding-right: 2em; }
- #table-example-1 tbody td:first-child + td { width: 10em; }
- #table-example-1 tbody td:first-child + td ~ td { width: 2.5em; }
- #table-example-1 tbody td:first-child + td + td + td ~ td { width: 1.25em; }
- .apple-table-examples { border: none; border-collapse: separate; border-spacing: 1.5em 0em; width: 40em; margin-left: 3em; }
- .apple-table-examples * { font-family: "Times", serif; }
- .apple-table-examples td, .apple-table-examples th { border: none; white-space: nowrap; padding-top: 0; padding-bottom: 0; }
- .apple-table-examples tbody th:first-child { border-left: none; width: 100%; }
- .apple-table-examples thead th:first-child ~ th { font-size: smaller; font-weight: bolder; border-bottom: solid 2px; text-align: center; }
- .apple-table-examples tbody th::after, .apple-table-examples tfoot th::after { content: leader(". ") }
- .apple-table-examples tbody th, .apple-table-examples tfoot th { font: inherit; text-align: left; }
- .apple-table-examples td { text-align: right; vertical-align: top; }
- .apple-table-examples.e1 tbody tr:last-child td { border-bottom: solid 1px; }
- .apple-table-examples.e1 tbody + tbody tr:last-child td { border-bottom: double 3px; }
- .apple-table-examples.e2 th[scope=row] { padding-left: 1em; }
- .apple-table-examples sup { line-height: 0; }
- .three-column-nowrap tr > td:first-child,
- .three-column-nowrap tr > td:first-child + td,
- .three-column-nowrap tr > td:first-child + td + td { white-space: nowrap; }
- .details-example img { vertical-align: top; }
- #base64-table {
- white-space: nowrap;
- font-size: 0.6em;
- column-width: 6em;
- column-count: 5;
- column-gap: 1em;
- -moz-column-width: 6em;
- -moz-column-count: 5;
- -moz-column-gap: 1em;
- -webkit-column-width: 6em;
- -webkit-column-count: 5;
- -webkit-column-gap: 1em;
- }
- #base64-table thead { display: none; }
- #base64-table * { border: none; }
- #base64-table tbody td:first-child:after { content: ':'; }
- #base64-table tbody td:last-child { text-align: right; }
- #named-character-references-table {
- white-space: nowrap;
- font-size: 0.6em;
- column-width: 30em;
- column-gap: 1em;
- -moz-column-width: 30em;
- -moz-column-gap: 1em;
- -webkit-column-width: 30em;
- -webkit-column-gap: 1em;
- }
- #named-character-references-table > table > tbody > tr > td:first-child + td,
- #named-character-references-table > table > tbody > tr > td:last-child { text-align: center; }
- #named-character-references-table > table > tbody > tr > td:last-child:hover > span { position: absolute; top: auto; left: auto; margin-left: 0.5em; line-height: 1.2; font-size: 5em; border: outset; padding: 0.25em 0.5em; background: white; width: 1.25em; height: auto; text-align: center; }
- #named-character-references-table > table > tbody > tr#entity-CounterClockwiseContourIntegral > td:first-child { font-size: 0.5em; }
- .glyph.control { color: red; }
- </style><style>
- #table-example-1 * { font-family: "Essays1743", serif; line-height: 1.01em; }
- @font-face {
- font-family: 'Essays1743';
- src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743.ttf');
- }
- @font-face {
- font-family: 'Essays1743';
- font-weight: bold;
- src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Bold.ttf');
- }
- @font-face {
- font-family: 'Essays1743';
- font-style: italic;
- src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-Italic.ttf');
- }
- @font-face {
- font-family: 'Essays1743';
- font-style: italic;
- font-weight: bold;
- src: url('//www.whatwg.org/specs/web-apps/current-work/fonts/Essays1743-BoldItalic.ttf');
- }
- </style><link rel=stylesheet href=status.css><body onload=init()>
- <header id=head class="head with-buttons">
- <p><a href=//www.whatwg.org/ class=logo><img src=/images/logo width=101 alt=WHATWG height=101></a></p>
- <hgroup><h1 class=allcaps>HTML</h1><h2 id=living-standard-—-last-updated-[date:-01-jan-1901] class="no-num no-toc">Living Standard — Last Updated <span class=pubdate>5 September 2014</span></h2></hgroup>
-
- <nav>
- <div>
- <a href=//whatwg.org/html><span><strong>Multipage Version</strong> <code>whatwg.org/html</code></span></a>
- <a href=//whatwg.org/c><span><strong>One-Page Version</strong> <code>whatwg.org/c</code></span></a>
- <a href=//whatwg.org/pdf><span><strong>PDF Version</strong> <code>whatwg.org/pdf</code></span></a>
- <a href=http://developers.whatwg.org/><span><strong>Developer Version</strong> <code>developers.whatwg.org</code></span></a>
- </div>
- <div>
- <a href=//whatwg.org/faq class=misc><span><strong>FAQ</strong> <code>whatwg.org/faq</code></span></a>
- <a href=http://validator.whatwg.org/ class=misc><span><strong>Validators</strong> <code>validator.whatwg.org</code></span></a>
- </div>
- <div>
- <a href=//www.whatwg.org/mailing-list class=comms><span><strong>Join our Mailing List</strong> <code>whatwg@whatwg.org</code></span></a>
- <a href=http://wiki.whatwg.org/wiki/IRC class=comms><span><strong>Join us on IRC</strong> <code>#whatwg on Freenode</code></span></a>
- <a href=http://forums.whatwg.org/ class=comms><span><strong>Join our Forums</strong> <code>forums.whatwg.org</code></span></a>
- </div>
- <div>
-
- <a href=http://html5.org/tools/web-apps-tracker class=changes><span><strong>Change Log</strong> <code>html5.org's tracker</code></span></a>
- <a href=http://twitter.com/WHATWG class=changes><span><strong>Twitter Updates</strong> <code>@WHATWG</code></span></a>
- </div>
- <div>
- <a href="https://www.w3.org/Bugs/Public/buglist.cgi?bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&component=HTML&product=WHATWG" class=feedback><span><strong>View Open Bugs</strong> <code>filed in Bugzilla</code></span></a>
- <a href=//www.whatwg.org/newbug class=feedback><span><strong>File a Bug</strong> <code>whatwg.org/newbug</code></span></a>
- <a href=http://ian.hixie.ch/+ class=feedback><span><strong>E-mail the Editor</strong> <code>ian@hixie.ch</code></span></a>
- </div>
- </nav>
- </header>
- <hr>
- <div id=configUI></div>
- <h2 id=contents class="no-num no-toc">Table of contents</h2>
- <ol class=toc><li><a href=#introduction>1 Introduction</a><ol><li><a href=#abstract>1.1 Where does this specification fit?</a><li><a href=#is-this-html5?>1.2 Is this HTML5?</a><li><a href=#background>1.3 Background</a><li><a href=#audience>1.4 Audience</a><li><a href=#scope>1.5 Scope</a><li><a href=#history-2>1.6 History</a><li><a href=#design-notes>1.7 Design notes</a><ol><li><a href=#serialisability-of-script-execution>1.7.1 Serialisability of script execution</a><li><a href=#compliance-with-other-specifications>1.7.2 Compliance with other specifications</a><li><a href=#extensibility>1.7.3 Extensibility</a></ol><li><a href=#html-vs-xhtml>1.8 HTML vs XHTML</a><li><a href=#structure-of-this-specification>1.9 Structure of this specification</a><ol><li><a href=#how-to-read-this-specification>1.9.1 How to read this specification</a><li><a href=#typographic-conventions>1.9.2 Typographic conventions</a></ol><li><a href=#fingerprint>1.10 Privacy concerns</a><ol><li><a href=#fingerprint-postMessage>1.10.1 Cross-site communication</a></ol><li><a href=#a-quick-introduction-to-html>1.11 A quick introduction to HTML</a><ol><li><a href=#writing-secure-applications-with-html>1.11.1 Writing secure applications with HTML</a><li><a href=#common-pitfalls-to-avoid-when-using-the-scripting-apis>1.11.2 Common pitfalls to avoid when using the scripting APIs</a><li><a href=#how-to-catch-mistakes-when-writing-html:-validators-and-conformance-checkers>1.11.3 How to catch mistakes when writing HTML: validators and conformance checkers</a></ol><li><a href=#conformance-requirements-for-authors>1.12 Conformance requirements for authors</a><ol><li><a href=#presentational-markup>1.12.1 Presentational markup</a><li><a href=#syntax-errors>1.12.2 Syntax errors</a><li><a href=#restrictions-on-content-models-and-on-attribute-values>1.12.3 Restrictions on content models and on attribute values</a></ol><li><a href=#suggested-reading>1.13 Suggested reading</a></ol><li><a href=#infrastructure>2 Common infrastructure</a><ol><li><a href=#terminology>2.1 Terminology</a><ol><li><a href=#resources>2.1.1 Resources</a><li><a href=#xml>2.1.2 XML</a><li><a href=#dom-trees>2.1.3 DOM trees</a><li><a href=#scripting-2>2.1.4 Scripting</a><li><a href=#plugins>2.1.5 Plugins</a><li><a href=#encoding-terminology>2.1.6 Character encodings</a></ol><li><a href=#conformance-requirements>2.2 Conformance requirements</a><ol><li><a href=#conformance-classes>2.2.1 Conformance classes</a><li><a href=#dependencies>2.2.2 Dependencies</a><li><a href=#extensibility-2>2.2.3 Extensibility</a><li><a href=#interactions-with-xpath-and-xslt>2.2.4 Interactions with XPath and XSLT</a></ol><li><a href=#case-sensitivity-and-string-comparison>2.3 Case-sensitivity and string comparison</a><li><a href=#common-microsyntaxes>2.4 Common microsyntaxes</a><ol><li><a href=#common-parser-idioms>2.4.1 Common parser idioms</a><li><a href=#boolean-attributes>2.4.2 Boolean attributes</a><li><a href=#keywords-and-enumerated-attributes>2.4.3 Keywords and enumerated attributes</a><li><a href=#numbers>2.4.4 Numbers</a><ol><li><a href=#signed-integers>2.4.4.1 Signed integers</a><li><a href=#non-negative-integers>2.4.4.2 Non-negative integers</a><li><a href=#floating-point-numbers>2.4.4.3 Floating-point numbers</a><li><a href=#percentages-and-dimensions>2.4.4.4 Percentages and lengths</a><li><a href=#lists-of-integers>2.4.4.5 Lists of integers</a><li><a href=#lists-of-dimensions>2.4.4.6 Lists of dimensions</a></ol><li><a href=#dates-and-times>2.4.5 Dates and times</a><ol><li><a href=#months>2.4.5.1 Months</a><li><a href=#dates>2.4.5.2 Dates</a><li><a href=#yearless-dates>2.4.5.3 Yearless dates</a><li><a href=#times>2.4.5.4 Times</a><li><a href=#local-dates-and-times>2.4.5.5 Local dates and times</a><li><a href=#time-zones>2.4.5.6 Time zones</a><li><a href=#global-dates-and-times>2.4.5.7 Global dates and times</a><li><a href=#weeks>2.4.5.8 Weeks</a><li><a href=#durations>2.4.5.9 Durations</a><li><a href=#vaguer-moments-in-time>2.4.5.10 Vaguer moments in time</a></ol><li><a href=#colours>2.4.6 Colours</a><li><a href=#space-separated-tokens>2.4.7 Space-separated tokens</a><li><a href=#comma-separated-tokens>2.4.8 Comma-separated tokens</a><li><a href=#syntax-references>2.4.9 References</a><li><a href=#mq>2.4.10 Media queries</a></ol><li><a href=#urls>2.5 URLs</a><ol><li><a href=#terminology-2>2.5.1 Terminology</a><li><a href=#resolving-urls>2.5.2 Resolving URLs</a><li><a href=#dynamic-changes-to-base-urls>2.5.3 Dynamic changes to base URLs</a></ol><li><a href=#fetching-resources>2.6 Fetching resources</a><ol><li><a href=#terminology-3>2.6.1 Terminology</a><li><a href=#processing-model>2.6.2 Processing model</a><li><a href=#encrypted-http-and-related-security-concerns>2.6.3 Encrypted HTTP and related security concerns</a><li><a href=#content-type-sniffing>2.6.4 Determining the type of a resource</a><li><a href=#extracting-character-encodings-from-meta-elements>2.6.5 Extracting character encodings from <code>meta</code> elements</a><li><a href=#cors-settings-attributes>2.6.6 CORS settings attributes</a><li><a href=#cors-enabled-fetch>2.6.7 CORS-enabled fetch</a></ol><li><a href=#common-dom-interfaces>2.7 Common DOM interfaces</a><ol><li><a href=#reflecting-content-attributes-in-idl-attributes>2.7.1 Reflecting content attributes in IDL attributes</a><li><a href=#collections-2>2.7.2 Collections</a><ol><li><a href=#htmlallcollection>2.7.2.1 HTMLAllCollection</a><li><a href=#htmlformcontrolscollection>2.7.2.2 HTMLFormControlsCollection</a><li><a href=#htmloptionscollection>2.7.2.3 HTMLOptionsCollection</a><li><a href=#htmlpropertiescollection>2.7.2.4 HTMLPropertiesCollection</a></ol><li><a href=#domstringmap>2.7.3 DOMStringMap</a><li><a href=#domelementmap>2.7.4 DOMElementMap</a><li><a href=#transferable-objects>2.7.5 Transferable objects</a><li><a href=#safe-passing-of-structured-data>2.7.6 Safe passing of structured data</a><li><a href=#callbacks>2.7.7 Callbacks</a><li><a href=#garbage-collection>2.7.8 Garbage collection</a></ol><li><a href=#namespaces>2.8 Namespaces</a></ol><li><a href=#dom>3 Semantics, structure, and APIs of HTML documents</a><ol><li><a href=#documents>3.1 Documents</a><ol><li><a href=#the-document-object>3.1.1 The <code>Document</code> object</a><li><a href=#resource-metadata-management>3.1.2 Resource metadata management</a><li><a href=#dom-tree-accessors>3.1.3 DOM tree accessors</a><li><a href=#loading-xml-documents>3.1.4 Loading XML documents</a></ol><li><a href=#elements>3.2 Elements</a><ol><li><a href=#semantics-2>3.2.1 Semantics</a><li><a href=#elements-in-the-dom>3.2.2 Elements in the DOM</a><li><a href=#element-definitions>3.2.3 Element definitions</a><ol><li><a href=#attributes>3.2.3.1 Attributes</a></ol><li><a href=#content-models>3.2.4 Content models</a><ol><li><a href=#the-nothing-content-model>3.2.4.1 The "nothing" content model</a><li><a href=#kinds-of-content>3.2.4.2 Kinds of content</a><ol><li><a href=#metadata-content>3.2.4.2.1 Metadata content</a><li><a href=#flow-content>3.2.4.2.2 Flow content</a><li><a href=#sectioning-content>3.2.4.2.3 Sectioning content</a><li><a href=#heading-content>3.2.4.2.4 Heading content</a><li><a href=#phrasing-content>3.2.4.2.5 Phrasing content</a><li><a href=#embedded-content-2>3.2.4.2.6 Embedded content</a><li><a href=#interactive-content>3.2.4.2.7 Interactive content</a><li><a href=#palpable-content>3.2.4.2.8 Palpable content</a><li><a href=#script-supporting-elements>3.2.4.2.9 Script-supporting elements</a></ol><li><a href=#transparent-content-models>3.2.4.3 Transparent content models</a><li><a href=#paragraphs>3.2.4.4 Paragraphs</a></ol><li><a href=#global-attributes>3.2.5 Global attributes</a><ol><li><a href=#the-id-attribute>3.2.5.1 The <code>id</code> attribute</a><li><a href=#the-title-attribute>3.2.5.2 The <code>title</code> attribute</a><li><a href=#the-lang-and-xml:lang-attributes>3.2.5.3 The <code>lang</code> and <code>xml:lang</code> attributes</a><li><a href=#the-translate-attribute>3.2.5.4 The <code>translate</code> attribute</a><li><a href=#the-xml:base-attribute-(xml-only)>3.2.5.5 The <code>xml:base</code> attribute (XML only)</a><li><a href=#the-dir-attribute>3.2.5.6 The <code>dir</code> attribute</a><li><a href=#classes>3.2.5.7 The <code>class</code> attribute</a><li><a href=#the-style-attribute>3.2.5.8 The <code>style</code> attribute</a><li><a href=#embedding-custom-non-visible-data-with-the-data-*-attributes>3.2.5.9 Embedding custom non-visible data with the <code>data-*</code> attributes</a></ol><li><a href=#requirements-relating-to-the-bidirectional-algorithm>3.2.6 Requirements relating to the bidirectional algorithm</a><ol><li><a href=#authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters>3.2.6.1 Authoring conformance criteria for bidirectional-algorithm formatting characters</a><li><a href=#user-agent-conformance-criteria>3.2.6.2 User agent conformance criteria</a></ol><li><a href=#wai-aria>3.2.7 WAI-ARIA</a></ol></ol><li><a href=#semantics>4 The elements of HTML</a><ol><li><a href=#the-root-element>4.1 The root element</a><ol><li><a href=#the-html-element>4.1.1 The <code>html</code> element</a></ol><li><a href=#document-metadata>4.2 Document metadata</a><ol><li><a href=#the-head-element>4.2.1 The <code>head</code> element</a><li><a href=#the-title-element>4.2.2 The <code>title</code> element</a><li><a href=#the-base-element>4.2.3 The <code>base</code> element</a><li><a href=#the-link-element>4.2.4 The <code>link</code> element</a><li><a href=#the-meta-element>4.2.5 The <code>meta</code> element</a><ol><li><a href=#standard-metadata-names>4.2.5.1 Standard metadata names</a><li><a href=#other-metadata-names>4.2.5.2 Other metadata names</a><li><a href=#pragma-directives>4.2.5.3 Pragma directives</a><li><a href=#other-pragma-directives>4.2.5.4 Other pragma directives</a><li><a href=#charset>4.2.5.5 Specifying the document's character encoding</a></ol><li><a href=#the-style-element>4.2.6 The <code>style</code> element</a><li><a href=#interactions-of-styling-and-scripting>4.2.7 Interactions of styling and scripting</a></ol><li><a href=#sections>4.3 Sections</a><ol><li><a href=#the-body-element>4.3.1 The <code>body</code> element</a><li><a href=#the-article-element>4.3.2 The <code>article</code> element</a><li><a href=#the-section-element>4.3.3 The <code>section</code> element</a><li><a href=#the-nav-element>4.3.4 The <code>nav</code> element</a><li><a href=#the-aside-element>4.3.5 The <code>aside</code> element</a><li><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>4.3.6 The <code>h1</code>, <code>h2</code>, <code>h3</code>, <code>h4</code>, <code>h5</code>, and
- <code>h6</code> elements</a><li><a href=#the-hgroup-element>4.3.7 The <code>hgroup</code> element</a><li><a href=#the-header-element>4.3.8 The <code>header</code> element</a><li><a href=#the-footer-element>4.3.9 The <code>footer</code> element</a><li><a href=#the-address-element>4.3.10 The <code>address</code> element</a><li><a href=#headings-and-sections>4.3.11 Headings and sections</a><ol><li><a href=#outlines>4.3.11.1 Creating an outline</a><li><a href=#sample-outlines>4.3.11.2 Sample outlines</a><li><a href=#exposing-outlines-to-users>4.3.11.3 Exposing outlines to users</a></ol><li><a href=#usage-summary-2>4.3.12 Usage summary</a><ol><li><a href=#article-or-section>4.3.12.1 Article or section?</a></ol></ol><li><a href=#grouping-content>4.4 Grouping content</a><ol><li><a href=#the-p-element>4.4.1 The <code>p</code> element</a><li><a href=#the-hr-element>4.4.2 The <code>hr</code> element</a><li><a href=#the-pre-element>4.4.3 The <code>pre</code> element</a><li><a href=#the-blockquote-element>4.4.4 The <code>blockquote</code> element</a><li><a href=#the-ol-element>4.4.5 The <code>ol</code> element</a><li><a href=#the-ul-element>4.4.6 The <code>ul</code> element</a><li><a href=#the-li-element>4.4.7 The <code>li</code> element</a><li><a href=#the-dl-element>4.4.8 The <code>dl</code> element</a><li><a href=#the-dt-element>4.4.9 The <code>dt</code> element</a><li><a href=#the-dd-element>4.4.10 The <code>dd</code> element</a><li><a href=#the-figure-element>4.4.11 The <code>figure</code> element</a><li><a href=#the-figcaption-element>4.4.12 The <code>figcaption</code> element</a><li><a href=#the-main-element>4.4.13 The <code>main</code> element</a><li><a href=#the-div-element>4.4.14 The <code>div</code> element</a></ol><li><a href=#text-level-semantics>4.5 Text-level semantics</a><ol><li><a href=#the-a-element>4.5.1 The <code>a</code> element</a><li><a href=#the-em-element>4.5.2 The <code>em</code> element</a><li><a href=#the-strong-element>4.5.3 The <code>strong</code> element</a><li><a href=#the-small-element>4.5.4 The <code>small</code> element</a><li><a href=#the-s-element>4.5.5 The <code>s</code> element</a><li><a href=#the-cite-element>4.5.6 The <code>cite</code> element</a><li><a href=#the-q-element>4.5.7 The <code>q</code> element</a><li><a href=#the-dfn-element>4.5.8 The <code>dfn</code> element</a><li><a href=#the-abbr-element>4.5.9 The <code>abbr</code> element</a><li><a href=#the-ruby-element>4.5.10 The <code>ruby</code> element</a><li><a href=#the-rt-element>4.5.11 The <code>rt</code> element</a><li><a href=#the-rp-element>4.5.12 The <code>rp</code> element</a><li><a href=#the-data-element>4.5.13 The <code>data</code> element</a><li><a href=#the-time-element>4.5.14 The <code>time</code> element</a><li><a href=#the-code-element>4.5.15 The <code>code</code> element</a><li><a href=#the-var-element>4.5.16 The <code>var</code> element</a><li><a href=#the-samp-element>4.5.17 The <code>samp</code> element</a><li><a href=#the-kbd-element>4.5.18 The <code>kbd</code> element</a><li><a href=#the-sub-and-sup-elements>4.5.19 The <code>sub</code> and <code>sup</code> elements</a><li><a href=#the-i-element>4.5.20 The <code>i</code> element</a><li><a href=#the-b-element>4.5.21 The <code>b</code> element</a><li><a href=#the-u-element>4.5.22 The <code>u</code> element</a><li><a href=#the-mark-element>4.5.23 The <code>mark</code> element</a><li><a href=#the-bdi-element>4.5.24 The <code>bdi</code> element</a><li><a href=#the-bdo-element>4.5.25 The <code>bdo</code> element</a><li><a href=#the-span-element>4.5.26 The <code>span</code> element</a><li><a href=#the-br-element>4.5.27 The <code>br</code> element</a><li><a href=#the-wbr-element>4.5.28 The <code>wbr</code> element</a><li><a href=#usage-summary>4.5.29 Usage summary</a></ol><li><a href=#links>4.6 Links</a><ol><li><a href=#introduction-2>4.6.1 Introduction</a><li><a href=#links-created-by-a-and-area-elements>4.6.2 Links created by <code>a</code> and <code>area</code> elements</a><li><a href=#following-hyperlinks>4.6.3 Following hyperlinks</a><li><a href=#downloading-resources>4.6.4 Downloading resources</a><ol><li><a href=#hyperlink-auditing>4.6.4.1 Hyperlink auditing</a></ol><li><a href=#linkTypes>4.6.5 Link types</a><ol><li><a href=#rel-alternate>4.6.5.1 Link type "<code>alternate</code>"</a><li><a href=#link-type-author>4.6.5.2 Link type "<code>author</code>"</a><li><a href=#link-type-bookmark>4.6.5.3 Link type "<code>bookmark</code>"</a><li><a href=#link-type-external>4.6.5.4 Link type "<code>external</code>"</a><li><a href=#link-type-help>4.6.5.5 Link type "<code>help</code>"</a><li><a href=#rel-icon>4.6.5.6 Link type "<code>icon</code>"</a><li><a href=#link-type-license>4.6.5.7 Link type "<code>license</code>"</a><li><a href=#link-type-nofollow>4.6.5.8 Link type "<code>nofollow</code>"</a><li><a href=#link-type-noreferrer>4.6.5.9 Link type "<code>noreferrer</code>"</a><li><a href=#link-type-pingback>4.6.5.10 Link type "<code>pingback</code>"</a><li><a href=#link-type-prefetch>4.6.5.11 Link type "<code>prefetch</code>"</a><li><a href=#link-type-search>4.6.5.12 Link type "<code>search</code>"</a><li><a href=#link-type-sidebar>4.6.5.13 Link type "<code>sidebar</code>"</a><li><a href=#link-type-stylesheet>4.6.5.14 Link type "<code>stylesheet</code>"</a><li><a href=#link-type-tag>4.6.5.15 Link type "<code>tag</code>"</a><li><a href=#sequential-link-types>4.6.5.16 Sequential link types</a><ol><li><a href=#link-type-next>4.6.5.16.1 Link type "<code>next</code>"</a><li><a href=#link-type-prev>4.6.5.16.2 Link type "<code>prev</code>"</a></ol><li><a href=#other-link-types>4.6.5.17 Other link types</a></ol></ol><li><a href=#edits>4.7 Edits</a><ol><li><a href=#the-ins-element>4.7.1 The <code>ins</code> element</a><li><a href=#the-del-element>4.7.2 The <code>del</code> element</a><li><a href=#attributes-common-to-ins-and-del-elements>4.7.3 Attributes common to <code>ins</code> and <code>del</code> elements</a><li><a href=#edits-and-paragraphs>4.7.4 Edits and paragraphs</a><li><a href=#edits-and-lists>4.7.5 Edits and lists</a><li><a href=#edits-and-tables>4.7.6 Edits and tables</a></ol><li><a href=#embedded-content>4.8 Embedded content</a><ol><li><a href=#introduction-3>4.8.1 Introduction</a><ol><li><a href=#adaptive-images>4.8.1.1 Adaptive images</a></ol><li><a href=#dependencies-2>4.8.2 Dependencies</a><li><a href=#the-picture-element>4.8.3 The <code>picture</code> element</a><li><a href=#the-source-element-when-used-with-the-picture-element>4.8.4 The <code>source</code> element when used with the <code>picture</code> element</a><li><a href=#the-img-element>4.8.5 The <code>img</code> element</a><ol><li><a href=#alt>4.8.5.1 Requirements for providing text to act as an alternative for images</a><ol><li><a href=#general-guidelines>4.8.5.1.1 General guidelines</a><li><a href=#a-link-or-button-containing-nothing-but-the-image>4.8.5.1.2 A link or button containing nothing but the image</a><li><a href=#a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations>4.8.5.1.3 A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</a><li><a href=#a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos>4.8.5.1.4 A short phrase or label with an alternative graphical representation: icons, logos</a><li><a href=#text-that-has-been-rendered-to-a-graphic-for-typographical-effect>4.8.5.1.5 Text that has been rendered to a graphic for typographical effect</a><li><a href=#a-graphical-representation-of-some-of-the-surrounding-text>4.8.5.1.6 A graphical representation of some of the surrounding text</a><li><a href="#a-purely-decorative-image-that-doesn't-add-any-information">4.8.5.1.7 A purely decorative image that doesn't add any information</a><li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-no-links>4.8.5.1.8 A group of images that form a single larger picture with no links</a><li><a href=#a-group-of-images-that-form-a-single-larger-picture-with-links>4.8.5.1.9 A group of images that form a single larger picture with links</a><li><a href=#a-key-part-of-the-content>4.8.5.1.10 A key part of the content</a><li><a href=#an-image-not-intended-for-the-user>4.8.5.1.11 An image not intended for the user</a><li><a href=#an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images>4.8.5.1.12 An image in an e-mail or private document intended for a specific person who is known to be able to view images</a><li><a href=#guidance-for-markup-generators>4.8.5.1.13 Guidance for markup generators</a><li><a href=#guidance-for-conformance-checkers>4.8.5.1.14 Guidance for conformance checkers</a></ol></ol><li><a href=#the-iframe-element>4.8.6 The <code>iframe</code> element</a><li><a href=#the-embed-element>4.8.7 The <code>embed</code> element</a><li><a href=#the-object-element>4.8.8 The <code>object</code> element</a><li><a href=#the-param-element>4.8.9 The <code>param</code> element</a><li><a href=#the-video-element>4.8.10 The <code>video</code> element</a><li><a href=#the-audio-element>4.8.11 The <code>audio</code> element</a><li><a href=#the-source-element>4.8.12 The <code>source</code> element</a><li><a href=#the-track-element>4.8.13 The <code>track</code> element</a><li><a href=#media-elements>4.8.14 Media elements</a><ol><li><a href=#error-codes>4.8.14.1 Error codes</a><li><a href=#location-of-the-media-resource>4.8.14.2 Location of the media resource</a><li><a href=#mime-types>4.8.14.3 MIME types</a><li><a href=#network-states>4.8.14.4 Network states</a><li><a href=#loading-the-media-resource>4.8.14.5 Loading the media resource</a><li><a href=#offsets-into-the-media-resource>4.8.14.6 Offsets into the media resource</a><li><a href=#ready-states>4.8.14.7 Ready states</a><li><a href=#playing-the-media-resource>4.8.14.8 Playing the media resource</a><li><a href=#seeking>4.8.14.9 Seeking</a><li><a href=#media-resources-with-multiple-media-tracks>4.8.14.10 Media resources with multiple media tracks</a><ol><li><a href=#audiotracklist-and-videotracklist-objects>4.8.14.10.1 <code>AudioTrackList</code> and <code>VideoTrackList</code> objects</a><li><a href=#selecting-specific-audio-and-video-tracks-declaratively>4.8.14.10.2 Selecting specific audio and video tracks declaratively</a></ol><li><a href=#synchronising-multiple-media-elements>4.8.14.11 Synchronising multiple media elements</a><ol><li><a href=#introduction-4>4.8.14.11.1 Introduction</a><li><a href=#media-controllers>4.8.14.11.2 Media controllers</a><li><a href=#assigning-a-media-controller-declaratively>4.8.14.11.3 Assigning a media controller declaratively</a></ol><li><a href=#timed-text-tracks>4.8.14.12 Timed text tracks</a><ol><li><a href=#text-track-model>4.8.14.12.1 Text track model</a><li><a href=#sourcing-in-band-text-tracks>4.8.14.12.2 Sourcing in-band text tracks</a><li><a href=#sourcing-out-of-band-text-tracks>4.8.14.12.3 Sourcing out-of-band text tracks</a><li><a href=#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues>4.8.14.12.4 Guidelines for exposing cues in various formats as text track cues</a><li><a href=#text-track-api>4.8.14.12.5 Text track API</a><li><a href=#text-tracks-describing-chapters>4.8.14.12.6 Text tracks describing chapters</a><li><a href=#cue-events>4.8.14.12.7 Event handlers for objects of the text track APIs</a><li><a href=#best-practices-for-metadata-text-tracks>4.8.14.12.8 Best practices for metadata text tracks</a></ol><li><a href=#user-interface>4.8.14.13 User interface</a><li><a href=#time-ranges>4.8.14.14 Time ranges</a><li><a href=#the-trackevent-interface>4.8.14.15 The <code>TrackEvent</code> interface</a><li><a href=#mediaevents>4.8.14.16 Event summary</a><li><a href=#security-and-privacy-considerations>4.8.14.17 Security and privacy considerations</a><li><a href=#best-practices-for-authors-using-media-elements>4.8.14.18 Best practices for authors using media elements</a><li><a href=#best-practices-for-implementors-of-media-elements>4.8.14.19 Best practices for implementors of media elements</a></ol><li><a href=#the-map-element>4.8.15 The <code>map</code> element</a><li><a href=#the-area-element>4.8.16 The <code>area</code> element</a><li><a href=#image-maps>4.8.17 Image maps</a><ol><li><a href=#authoring>4.8.17.1 Authoring</a><li><a href=#processing-model-2>4.8.17.2 Processing model</a></ol><li><a href=#mathml>4.8.18 MathML</a><li><a href=#svg>4.8.19 SVG</a><li><a href=#dimension-attributes>4.8.20 Dimension attributes</a></ol><li><a href=#tables>4.9 Tabular data</a><ol><li><a href=#the-table-element>4.9.1 The <code>table</code> element</a><ol><li><a href=#table-descriptions-techniques>4.9.1.1 Techniques for describing tables</a><li><a href=#table-layout-techniques>4.9.1.2 Techniques for table design</a></ol><li><a href=#the-caption-element>4.9.2 The <code>caption</code> element</a><li><a href=#the-colgroup-element>4.9.3 The <code>colgroup</code> element</a><li><a href=#the-col-element>4.9.4 The <code>col</code> element</a><li><a href=#the-tbody-element>4.9.5 The <code>tbody</code> element</a><li><a href=#the-thead-element>4.9.6 The <code>thead</code> element</a><li><a href=#the-tfoot-element>4.9.7 The <code>tfoot</code> element</a><li><a href=#the-tr-element>4.9.8 The <code>tr</code> element</a><li><a href=#the-td-element>4.9.9 The <code>td</code> element</a><li><a href=#the-th-element>4.9.10 The <code>th</code> element</a><li><a href=#attributes-common-to-td-and-th-elements>4.9.11 Attributes common to <code>td</code> and <code>th</code> elements</a><li><a href=#processing-model-3>4.9.12 Processing model</a><ol><li><a href=#forming-a-table>4.9.12.1 Forming a table</a><li><a href=#header-and-data-cell-semantics>4.9.12.2 Forming relationships between data cells and header cells</a></ol><li><a href=#table-sorting-model>4.9.13 Table sorting model</a><li><a href=#table-examples>4.9.14 Examples</a></ol><li><a href=#forms>4.10 Forms</a><ol><li><a href=#introduction-5>4.10.1 Introduction</a><ol><li><a href="#writing-a-form's-user-interface">4.10.1.1 Writing a form's user interface</a><li><a href=#implementing-the-server-side-processing-for-a-form>4.10.1.2 Implementing the server-side processing for a form</a><li><a href=#configuring-a-form-to-communicate-with-a-server>4.10.1.3 Configuring a form to communicate with a server</a><li><a href=#client-side-form-validation>4.10.1.4 Client-side form validation</a><li><a href=#enabling-client-side-automatic-filling-of-form-controls>4.10.1.5 Enabling client-side automatic filling of form controls</a><li><a href=#improving-the-user-experience-on-mobile-devices>4.10.1.6 Improving the user experience on mobile devices</a><li><a href=#the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality>4.10.1.7 The difference between the field type, the autofill field name, and the input modality</a><li><a href=#input-author-notes>4.10.1.8 Date, time, and number formats</a></ol><li><a href=#categories>4.10.2 Categories</a><li><a href=#the-form-element>4.10.3 The <code>form</code> element</a><li><a href=#the-label-element>4.10.4 The <code>label</code> element</a><li><a href=#the-input-element>4.10.5 The <code>input</code> element</a><ol><li><a href=#states-of-the-type-attribute>4.10.5.1 States of the <code>type</code> attribute</a><ol><li><a href="#hidden-state-(type=hidden)">4.10.5.1.1 Hidden state (<code>type=hidden</code>)</a><li><a href="#text-(type=text)-state-and-search-state-(type=search)">4.10.5.1.2 Text (<code>type=text</code>) state and Search state (<code>type=search</code>)</a><li><a href="#telephone-state-(type=tel)">4.10.5.1.3 Telephone state (<code>type=tel</code>)</a><li><a href="#url-state-(type=url)">4.10.5.1.4 URL state (<code>type=url</code>)</a><li><a href="#e-mail-state-(type=email)">4.10.5.1.5 E-mail state (<code>type=email</code>)</a><li><a href="#password-state-(type=password)">4.10.5.1.6 Password state (<code>type=password</code>)</a><li><a href="#date-and-time-state-(type=datetime)">4.10.5.1.7 Date and Time state (<code>type=datetime</code>)</a><li><a href="#date-state-(type=date)">4.10.5.1.8 Date state (<code>type=date</code>)</a><li><a href="#month-state-(type=month)">4.10.5.1.9 Month state (<code>type=month</code>)</a><li><a href="#week-state-(type=week)">4.10.5.1.10 Week state (<code>type=week</code>)</a><li><a href="#time-state-(type=time)">4.10.5.1.11 Time state (<code>type=time</code>)</a><li><a href="#local-date-and-time-state-(type=datetime-local)">4.10.5.1.12 Local Date and Time state (<code>type=datetime-local</code>)</a><li><a href="#number-state-(type=number)">4.10.5.1.13 Number state (<code>type=number</code>)</a><li><a href="#range-state-(type=range)">4.10.5.1.14 Range state (<code>type=range</code>)</a><li><a href="#colour-state-(type=color)">4.10.5.1.15 Colour state (<code>type=color</code>)</a><li><a href="#checkbox-state-(type=checkbox)">4.10.5.1.16 Checkbox state (<code>type=checkbox</code>)</a><li><a href="#radio-button-state-(type=radio)">4.10.5.1.17 Radio Button state (<code>type=radio</code>)</a><li><a href="#file-upload-state-(type=file)">4.10.5.1.18 File Upload state (<code>type=file</code>)</a><li><a href="#submit-button-state-(type=submit)">4.10.5.1.19 Submit Button state (<code>type=submit</code>)</a><li><a href="#image-button-state-(type=image)">4.10.5.1.20 Image Button state (<code>type=image</code>)</a><li><a href="#reset-button-state-(type=reset)">4.10.5.1.21 Reset Button state (<code>type=reset</code>)</a><li><a href="#button-state-(type=button)">4.10.5.1.22 Button state (<code>type=button</code>)</a></ol><li><a href=#input-impl-notes>4.10.5.2 Implemention notes regarding localization of form controls</a><li><a href=#common-input-element-attributes>4.10.5.3 Common <code>input</code> element attributes</a><ol><li><a href=#the-maxlength-and-minlength-attributes>4.10.5.3.1 The <code>maxlength</code> and <code>minlength</code> attributes</a><li><a href=#the-size-attribute>4.10.5.3.2 The <code>size</code> attribute</a><li><a href=#the-readonly-attribute>4.10.5.3.3 The <code>readonly</code> attribute</a><li><a href=#the-required-attribute>4.10.5.3.4 The <code>required</code> attribute</a><li><a href=#the-multiple-attribute>4.10.5.3.5 The <code>multiple</code> attribute</a><li><a href=#the-pattern-attribute>4.10.5.3.6 The <code>pattern</code> attribute</a><li><a href=#the-min-and-max-attributes>4.10.5.3.7 The <code>min</code> and <code>max</code> attributes</a><li><a href=#the-step-attribute>4.10.5.3.8 The <code>step</code> attribute</a><li><a href=#the-list-attribute>4.10.5.3.9 The <code>list</code> attribute</a><li><a href=#the-placeholder-attribute>4.10.5.3.10 The <code>placeholder</code> attribute</a></ol><li><a href=#common-input-element-apis>4.10.5.4 Common <code>input</code> element APIs</a><li><a href=#common-input-element-events>4.10.5.5 Common event behaviors</a></ol><li><a href=#the-button-element>4.10.6 The <code>button</code> element</a><li><a href=#the-select-element>4.10.7 The <code>select</code> element</a><li><a href=#the-datalist-element>4.10.8 The <code>datalist</code> element</a><li><a href=#the-optgroup-element>4.10.9 The <code>optgroup</code> element</a><li><a href=#the-option-element>4.10.10 The <code>option</code> element</a><li><a href=#the-textarea-element>4.10.11 The <code>textarea</code> element</a><li><a href=#the-keygen-element>4.10.12 The <code>keygen</code> element</a><li><a href=#the-output-element>4.10.13 The <code>output</code> element</a><li><a href=#the-progress-element>4.10.14 The <code>progress</code> element</a><li><a href=#the-meter-element>4.10.15 The <code>meter</code> element</a><li><a href=#the-fieldset-element>4.10.16 The <code>fieldset</code> element</a><li><a href=#the-legend-element>4.10.17 The <code>legend</code> element</a><li><a href=#form-control-infrastructure>4.10.18 Form control infrastructure</a><ol><li><a href="#a-form-control's-value">4.10.18.1 A form control's value</a><li><a href=#mutability>4.10.18.2 Mutability</a><li><a href=#association-of-controls-and-forms>4.10.18.3 Association of controls and forms</a></ol><li><a href=#attributes-common-to-form-controls>4.10.19 Attributes common to form controls</a><ol><li><a href=#naming-form-controls:-the-name-attribute>4.10.19.1 Naming form controls: the <code>name</code> attribute</a><li><a href=#submitting-element-directionality:-the-dirname-attribute>4.10.19.2 Submitting element directionality: the <code>dirname</code> attribute</a><li><a href=#limiting-user-input-length:-the-maxlength-attribute>4.10.19.3 Limiting user input length: the <code>maxlength</code> attribute</a><li><a href=#setting-minimum-input-length-requirements:-the-minlength-attribute>4.10.19.4 Setting minimum input length requirements: the <code>minlength</code> attribute</a><li><a href=#enabling-and-disabling-form-controls:-the-disabled-attribute>4.10.19.5 Enabling and disabling form controls: the <code>disabled</code> attribute</a><li><a href=#form-submission>4.10.19.6 Form submission</a><ol><li><a href=#autofocusing-a-form-control:-the-autofocus-attribute>4.10.19.6.1 Autofocusing a form control: the <code>autofocus</code> attribute</a></ol><li><a href=#input-modalities:-the-inputmode-attribute>4.10.19.7 Input modalities: the <code>inputmode</code> attribute</a><li><a href=#autofill>4.10.19.8 Autofill</a><ol><li><a href=#autofilling-form-controls:-the-autocomplete-attribute>4.10.19.8.1 Autofilling form controls: the <code>autocomplete</code> attribute</a><li><a href=#processing-model-4>4.10.19.8.2 Processing model</a><li><a href=#user-interface-for-bulk-autofill>4.10.19.8.3 User interface for bulk autofill</a><li><a href=#the-autocompleteerrorevent-interface>4.10.19.8.4 The <code>AutocompleteErrorEvent</code> interface</a></ol></ol><li><a href=#textFieldSelection>4.10.20 APIs for the text field selections</a><li><a href=#constraints>4.10.21 Constraints</a><ol><li><a href=#definitions>4.10.21.1 Definitions</a><li><a href=#constraint-validation>4.10.21.2 Constraint validation</a><li><a href=#the-constraint-validation-api>4.10.21.3 The constraint validation API</a><li><a href=#security-forms>4.10.21.4 Security</a></ol><li><a href=#form-submission-2>4.10.22 Form submission</a><ol><li><a href=#introduction-6>4.10.22.1 Introduction</a><li><a href=#implicit-submission>4.10.22.2 Implicit submission</a><li><a href=#form-submission-algorithm>4.10.22.3 Form submission algorithm</a><li><a href=#constructing-form-data-set>4.10.22.4 Constructing the form data set</a><li><a href=#selecting-a-form-submission-encoding>4.10.22.5 Selecting a form submission encoding</a><li><a href=#url-encoded-form-data>4.10.22.6 URL-encoded form data</a><li><a href=#multipart-form-data>4.10.22.7 Multipart form data</a><li><a href=#plain-text-form-data>4.10.22.8 Plain text form data</a></ol><li><a href=#resetting-a-form>4.10.23 Resetting a form</a></ol><li><a href=#interactive-elements>4.11 Interactive elements</a><ol><li><a href=#the-details-element>4.11.1 The <code>details</code> element</a><li><a href=#the-summary-element>4.11.2 The <code>summary</code> element</a><li><a href=#the-menu-element>4.11.3 The <code>menu</code> element</a><li><a href=#the-menuitem-element>4.11.4 The <code>menuitem</code> element</a><li><a href=#context-menus>4.11.5 Context menus</a><ol><li><a href=#declaring-a-context-menu>4.11.5.1 Declaring a context menu</a><li><a href=#processing-model-5>4.11.5.2 Processing model</a><li><a href=#the-relatedevent-interfaces>4.11.5.3 The <code>RelatedEvent</code> interfaces</a></ol><li><a href=#commands>4.11.6 Commands</a><ol><li><a href=#facets-2>4.11.6.1 Facets</a><li><a href=#using-the-a-element-to-define-a-command>4.11.6.2 Using the <code>a</code> element to define a command</a><li><a href=#using-the-button-element-to-define-a-command>4.11.6.3 Using the <code>button</code> element to define a command</a><li><a href=#using-the-input-element-to-define-a-command>4.11.6.4 Using the <code>input</code> element to define a command</a><li><a href=#using-the-option-element-to-define-a-command>4.11.6.5 Using the <code>option</code> element to define a command</a><li><a href=#using-the-menuitem-element-to-define-a-command>4.11.6.6 Using the <code>menuitem</code> element to define a
- command</a><li><a href=#using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly>4.11.6.7 Using the <code>command</code> attribute on <code>menuitem</code> elements to define
- a command indirectly</a><li><a href=#using-the-accesskey-attribute-on-a-label-element-to-define-a-command>4.11.6.8 Using the <code>accesskey</code> attribute
- on a <code>label</code> element to define a command</a><li><a href=#using-the-accesskey-attribute-on-a-legend-element-to-define-a-command>4.11.6.9 Using the <code>accesskey</code> attribute
- on a <code>legend</code> element to define a command</a><li><a href=#using-the-accesskey-attribute-to-define-a-command-on-other-elements>4.11.6.10 Using the <code>accesskey</code>
- attribute to define a command on other elements</a></ol><li><a href=#the-dialog-element>4.11.7 The <code>dialog</code> element</a><ol><li><a href=#anchor-points>4.11.7.1 Anchor points</a></ol></ol><li><a href=#scripting-3>4.12 Scripting</a><ol><li><a href=#the-script-element>4.12.1 The <code>script</code> element</a><ol><li><a href=#scriptingLanguages>4.12.1.1 Scripting languages</a><li><a href=#restrictions-for-contents-of-script-elements>4.12.1.2 Restrictions for contents of <code>script</code> elements</a><li><a href=#inline-documentation-for-external-scripts>4.12.1.3 Inline documentation for external scripts</a><li><a href=#scriptTagXSLT>4.12.1.4 Interaction of <code>script</code> elements and XSLT</a></ol><li><a href=#the-noscript-element>4.12.2 The <code>noscript</code> element</a><li><a href=#the-template-element>4.12.3 The <code>template</code> element</a><ol><li><a href=#template-XSLT-XPath>4.12.3.1 Interaction of <code>template</code> elements with XSLT and XPath</a></ol><li><a href=#the-canvas-element>4.12.4 The <code>canvas</code> element</a><ol><li><a href=#proxying-canvases-to-workers>4.12.4.1 Proxying canvases to workers</a><li><a href=#2dcontext>4.12.4.2 The 2D rendering context</a><ol><li><a href=#implementation-notes>4.12.4.2.1 Implementation notes</a><li><a href=#the-canvas-state>4.12.4.2.2 The canvas state</a><li><a href=#drawingstyle-objects>4.12.4.2.3 <code>DrawingStyle</code> objects</a><li><a href=#line-styles>4.12.4.2.4 Line styles</a><li><a href=#text-styles>4.12.4.2.5 Text styles</a><li><a href=#building-paths>4.12.4.2.6 Building paths</a><li><a href=#path2d-objects>4.12.4.2.7 <code>Path2D</code> objects</a><li><a href=#transformations>4.12.4.2.8 Transformations</a><li><a href=#image-sources-for-2d-rendering-contexts>4.12.4.2.9 Image sources for 2D rendering contexts</a><li><a href=#fill-and-stroke-styles>4.12.4.2.10 Fill and stroke styles</a><li><a href=#drawing-rectangles-to-the-bitmap>4.12.4.2.11 Drawing rectangles to the bitmap</a><li><a href=#drawing-text-to-the-bitmap>4.12.4.2.12 Drawing text to the bitmap</a><li><a href=#drawing-paths-to-the-canvas>4.12.4.2.13 Drawing paths to the canvas</a><li><a href=#drawing-images>4.12.4.2.14 Drawing images</a><li><a href=#hit-regions>4.12.4.2.15 Hit regions</a><li><a href=#pixel-manipulation>4.12.4.2.16 Pixel manipulation</a><li><a href=#compositing>4.12.4.2.17 Compositing</a><li><a href=#image-smoothing>4.12.4.2.18 Image smoothing</a><li><a href=#shadows>4.12.4.2.19 Shadows</a><li><a href=#drawing-model>4.12.4.2.20 Drawing model</a><li><a href=#best-practices>4.12.4.2.21 Best practices</a><li><a href=#examples>4.12.4.2.22 Examples</a></ol><li><a href=#colour-spaces-and-colour-correction>4.12.4.3 Colour spaces and colour correction</a><li><a href=#serialising-bitmaps-to-a-file>4.12.4.4 Serialising bitmaps to a file</a><li><a href=#security-with-canvas-elements>4.12.4.5 Security with <code>canvas</code> elements</a></ol></ol><li><a href=#common-idioms>4.13 Common idioms without dedicated elements</a><ol><li><a href=#the-main-part-of-the-content>4.13.1 The main part of the content</a><li><a href=#rel-up>4.13.2 Bread crumb navigation</a><li><a href=#tag-clouds>4.13.3 Tag clouds</a><li><a href=#conversations>4.13.4 Conversations</a><li><a href=#footnotes>4.13.5 Footnotes</a></ol><li><a href=#disabled-elements>4.14 Disabled elements</a><li><a href=#selectors>4.15 Matching HTML elements using selectors</a><ol><li><a href=#case-sensitivity>4.15.1 Case-sensitivity</a><li><a href=#pseudo-classes>4.15.2 Pseudo-classes</a></ol></ol><li><a href=#microdata>5 Microdata</a><ol><li><a href=#introduction-7>5.1 Introduction</a><ol><li><a href=#overview>5.1.1 Overview</a><li><a href=#the-basic-syntax>5.1.2 The basic syntax</a><li><a href=#typed-items>5.1.3 Typed items</a><li><a href=#global-identifiers-for-items>5.1.4 Global identifiers for items</a><li><a href=#selecting-names-when-defining-vocabularies>5.1.5 Selecting names when defining vocabularies</a><li><a href=#using-the-microdata-dom-api>5.1.6 Using the microdata DOM API</a></ol><li><a href=#encoding-microdata>5.2 Encoding microdata</a><ol><li><a href=#the-microdata-model>5.2.1 The microdata model</a><li><a href=#items>5.2.2 Items</a><li><a href=#names:-the-itemprop-attribute>5.2.3 Names: the <code>itemprop</code> attribute</a><li><a href=#values>5.2.4 Values</a><li><a href=#associating-names-with-items>5.2.5 Associating names with items</a><li><a href=#microdata-and-other-namespaces>5.2.6 Microdata and other namespaces</a></ol><li><a href=#microdata-dom-api>5.3 Microdata DOM API</a><li><a href=#mdvocabs>5.4 Sample microdata vocabularies</a><ol><li><a href=#vcard>5.4.1 vCard</a><ol><li><a href=#conversion-to-vcard>5.4.1.1 Conversion to vCard</a><li><a href=#examples-2>5.4.1.2 Examples</a></ol><li><a href=#vevent>5.4.2 vEvent</a><ol><li><a href=#conversion-to-icalendar>5.4.2.1 Conversion to iCalendar</a><li><a href=#examples-3>5.4.2.2 Examples</a></ol><li><a href=#licensing-works>5.4.3 Licensing works</a><ol><li><a href=#examples-4>5.4.3.1 Examples</a></ol></ol><li><a href=#converting-html-to-other-formats>5.5 Converting HTML to other formats</a><ol><li><a href=#json>5.5.1 JSON</a></ol></ol><li><a href=#editing>6 User interaction</a><ol><li><a href=#the-hidden-attribute>6.1 The <code>hidden</code> attribute</a><li><a href=#inert-subtrees>6.2 Inert subtrees</a><li><a href=#activation>6.3 Activation</a><li><a href=#focus>6.4 Focus</a><ol><li><a href=#introduction-8>6.4.1 Introduction</a><li><a href=#data-model>6.4.2 Data model</a><li><a href=#the-tabindex-attribute>6.4.3 The <code>tabindex</code> attribute</a><li><a href=#processing-model-6>6.4.4 Processing model</a><li><a href=#sequential-focus-navigation>6.4.5 Sequential focus navigation</a><li><a href=#focus-management-apis>6.4.6 Focus management APIs</a></ol><li><a href=#assigning-keyboard-shortcuts>6.5 Assigning keyboard shortcuts</a><ol><li><a href=#introduction-9>6.5.1 Introduction</a><li><a href=#the-accesskey-attribute>6.5.2 The <code>accesskey</code> attribute</a><li><a href=#processing-model-7>6.5.3 Processing model</a></ol><li><a href=#editing-2>6.6 Editing</a><ol><li><a href=#contenteditable>6.6.1 Making document regions editable: The <code>contenteditable</code> content attribute</a><li><a href=#making-entire-documents-editable:-the-designmode-idl-attribute>6.6.2 Making entire documents editable: The <code>designMode</code> IDL attribute</a><li><a href=#best-practices-for-in-page-editors>6.6.3 Best practices for in-page editors</a><li><a href=#editing-apis>6.6.4 Editing APIs</a><li><a href=#spelling-and-grammar-checking>6.6.5 Spelling and grammar checking</a></ol><li><a href=#dnd>6.7 Drag and drop</a><ol><li><a href=#introduction-10>6.7.1 Introduction</a><li><a href=#the-drag-data-store>6.7.2 The drag data store</a><li><a href=#the-datatransfer-interface>6.7.3 The <code>DataTransfer</code> interface</a><ol><li><a href=#the-datatransferitemlist-interface>6.7.3.1 The <code>DataTransferItemList</code> interface</a><li><a href=#the-datatransferitem-interface>6.7.3.2 The <code>DataTransferItem</code> interface</a></ol><li><a href=#the-dragevent-interface>6.7.4 The <code>DragEvent</code> interface</a><li><a href=#drag-and-drop-processing-model>6.7.5 Drag-and-drop processing model</a><li><a href=#dndevents>6.7.6 Events summary</a><li><a href=#the-draggable-attribute>6.7.7 The <code>draggable</code> attribute</a><li><a href=#the-dropzone-attribute>6.7.8 The <code>dropzone</code> attribute</a><li><a href=#security-risks-in-the-drag-and-drop-model>6.7.9 Security risks in the drag-and-drop model</a></ol></ol><li><a href=#browsers>7 Loading Web pages</a><ol><li><a href=#windows>7.1 Browsing contexts</a><ol><li><a href=#nested-browsing-contexts>7.1.1 Nested browsing contexts</a><ol><li><a href=#navigating-nested-browsing-contexts-in-the-dom>7.1.1.1 Navigating nested browsing contexts in the DOM</a></ol><li><a href=#auxiliary-browsing-contexts>7.1.2 Auxiliary browsing contexts</a><ol><li><a href=#navigating-auxiliary-browsing-contexts-in-the-dom>7.1.2.1 Navigating auxiliary browsing contexts in the DOM</a></ol><li><a href=#secondary-browsing-contexts>7.1.3 Secondary browsing contexts</a><li><a href=#security-nav>7.1.4 Security</a><li><a href=#groupings-of-browsing-contexts>7.1.5 Groupings of browsing contexts</a><li><a href=#browsing-context-names>7.1.6 Browsing context names</a></ol><li><a href=#the-window-object>7.2 The <code>Window</code> object</a><ol><li><a href=#security-window>7.2.1 Security</a><li><a href=#apis-for-creating-and-navigating-browsing-contexts-by-name>7.2.2 APIs for creating and navigating browsing contexts by name</a><li><a href=#accessing-other-browsing-contexts>7.2.3 Accessing other browsing contexts</a><li><a href=#named-access-on-the-window-object>7.2.4 Named access on the <code>Window</code> object</a><li><a href=#garbage-collection-and-browsing-contexts>7.2.5 Garbage collection and browsing contexts</a><li><a href=#closing-browsing-contexts>7.2.6 Closing browsing contexts</a><li><a href=#browser-interface-elements>7.2.7 Browser interface elements</a><li><a href=#the-windowproxy-object>7.2.8 The <code>WindowProxy</code> object</a></ol><li><a href=#origin>7.3 Origin</a><ol><li><a href=#relaxing-the-same-origin-restriction>7.3.1 Relaxing the same-origin restriction</a></ol><li><a href=#sandboxing>7.4 Sandboxing</a><li><a href=#history>7.5 Session history and navigation</a><ol><li><a href=#the-session-history-of-browsing-contexts>7.5.1 The session history of browsing contexts</a><li><a href=#the-history-interface>7.5.2 The <code>History</code> interface</a><li><a href=#the-location-interface>7.5.3 The <code>Location</code> interface</a><ol><li><a href=#security-location>7.5.3.1 Security</a></ol><li><a href=#history-notes>7.5.4 Implementation notes for session history</a></ol><li><a href=#browsing-the-web>7.6 Browsing the Web</a><ol><li><a href=#navigating-across-documents>7.6.1 Navigating across documents</a><li><a href=#read-html>7.6.2 Page load processing model for HTML files</a><li><a href=#read-xml>7.6.3 Page load processing model for XML files</a><li><a href=#read-text>7.6.4 Page load processing model for text files</a><li><a href=#read-multipart-x-mixed-replace>7.6.5 Page load processing model for <code>multipart/x-mixed-replace</code> resources</a><li><a href=#read-media>7.6.6 Page load processing model for media</a><li><a href=#read-plugin>7.6.7 Page load processing model for content that uses plugins</a><li><a href=#read-ua-inline>7.6.8 Page load processing model for inline
- content that doesn't have a DOM</a><li><a href=#scroll-to-fragid>7.6.9 Navigating to a fragment identifier</a><li><a href=#history-traversal>7.6.10 History traversal</a><ol><li><a href=#the-popstateevent-interface>7.6.10.1 The <code>PopStateEvent</code> interface</a><li><a href=#the-hashchangeevent-interface>7.6.10.2 The <code>HashChangeEvent</code> interface</a><li><a href=#the-pagetransitionevent-interface>7.6.10.3 The <code>PageTransitionEvent</code> interface</a></ol><li><a href=#unloading-documents>7.6.11 Unloading documents</a><ol><li><a href=#the-beforeunloadevent-interface>7.6.11.1 The <code>BeforeUnloadEvent</code> interface</a></ol><li><a href=#aborting-a-document-load>7.6.12 Aborting a document load</a></ol><li><a href=#offline>7.7 Offline Web applications</a><ol><li><a href=#introduction-11>7.7.1 Introduction</a><ol><li><a href=#supporting-offline-caching-for-legacy-applications>7.7.1.1 Supporting offline caching for legacy applications</a><li><a href=#appcacheevents>7.7.1.2 Event summary</a></ol><li><a href=#appcache>7.7.2 Application caches</a><li><a href=#manifests>7.7.3 The cache manifest syntax</a><ol><li><a href=#some-sample-manifests>7.7.3.1 Some sample manifests</a><li><a href=#writing-cache-manifests>7.7.3.2 Writing cache manifests</a><li><a href=#parsing-cache-manifests>7.7.3.3 Parsing cache manifests</a></ol><li><a href=#downloading-or-updating-an-application-cache>7.7.4 Downloading or updating an application cache</a><li><a href=#the-application-cache-selection-algorithm>7.7.5 The application cache selection algorithm</a><li><a href=#changesToNetworkingModel>7.7.6 Changes to the networking model</a><li><a href=#expiring-application-caches>7.7.7 Expiring application caches</a><li><a href=#disk-space>7.7.8 Disk space</a><li><a href=#security-concerns-with-offline-applications-caches>7.7.9 Security concerns with offline applications caches</a><li><a href=#application-cache-api>7.7.10 Application cache API</a><li><a href=#browser-state>7.7.11 Browser state</a></ol></ol><li><a href=#webappapis>8 Web application APIs</a><ol><li><a href=#scripting>8.1 Scripting</a><ol><li><a href=#introduction-12>8.1.1 Introduction</a><li><a href=#enabling-and-disabling-scripting>8.1.2 Enabling and disabling scripting</a><li><a href=#processing-model-8>8.1.3 Processing model</a><ol><li><a href=#definitions-2>8.1.3.1 Definitions</a><li><a href=#script-settings-for-browsing-contexts>8.1.3.2 Script settings for browsing contexts</a><li><a href=#calling-scripts>8.1.3.3 Calling scripts</a><li><a href=#creating-scripts>8.1.3.4 Creating scripts</a><li><a href=#killing-scripts>8.1.3.5 Killing scripts</a><li><a href=#runtime-script-errors>8.1.3.6 Runtime script errors</a><ol><li><a href=#runtime-script-errors-in-documents>8.1.3.6.1 Runtime script errors in documents</a><li><a href=#the-errorevent-interface>8.1.3.6.2 The <code>ErrorEvent</code> interface</a></ol></ol><li><a href=#event-loops>8.1.4 Event loops</a><ol><li><a href=#definitions-3>8.1.4.1 Definitions</a><li><a href=#processing-model-9>8.1.4.2 Processing model</a><li><a href=#generic-task-sources>8.1.4.3 Generic task sources</a></ol><li><a href=#events>8.1.5 Events</a><ol><li><a href=#event-handler-attributes>8.1.5.1 Event handlers</a><li><a href=#event-handlers-on-elements,-document-objects,-and-window-objects>8.1.5.2 Event handlers on elements, <code>Document</code> objects, and <code>Window</code> objects</a><ol><li><a href=#idl-definitions>8.1.5.2.1 IDL definitions</a></ol><li><a href=#event-firing>8.1.5.3 Event firing</a><li><a href=#events-and-the-window-object>8.1.5.4 Events and the <code>Window</code> object</a></ol></ol><li><a href=#atob>8.2 Base64 utility methods</a><li><a href=#dynamic-markup-insertion>8.3 Dynamic markup insertion</a><ol><li><a href=#opening-the-input-stream>8.3.1 Opening the input stream</a><li><a href=#closing-the-input-stream>8.3.2 Closing the input stream</a><li><a href=#document.write()>8.3.3 <code>document.write()</code></a><li><a href=#document.writeln()>8.3.4 <code>document.writeln()</code></a></ol><li><a href=#timers>8.4 Timers</a><li><a href=#user-prompts>8.5 User prompts</a><ol><li><a href=#simple-dialogs>8.5.1 Simple dialogs</a><li><a href=#printing>8.5.2 Printing</a><li><a href=#dialogs-implemented-using-separate-documents>8.5.3 Dialogs implemented using separate documents</a></ol><li><a href=#system-state-and-capabilities>8.6 System state and capabilities</a><ol><li><a href=#the-navigator-object>8.6.1 The <code>Navigator</code> object</a><ol><li><a href=#client-identification>8.6.1.1 Client identification</a><li><a href=#language-preferences>8.6.1.2 Language preferences</a><li><a href=#custom-handlers>8.6.1.3 Custom scheme and content handlers</a><ol><li><a href=#security-and-privacy>8.6.1.3.1 Security and privacy</a><li><a href=#sample-handler-impl>8.6.1.3.2 Sample user interface</a></ol><li><a href=#manually-releasing-the-storage-mutex>8.6.1.4 Manually releasing the storage mutex</a><li><a href=#plugins-2>8.6.1.5 Plugins</a></ol><li><a href=#the-external-interface>8.6.2 The <code>External</code> interface</a></ol><li><a href=#images>8.7 Images</a></ol><li><a href=#comms>9 Communication</a><ol><li><a href=#the-messageevent-interfaces>9.1 The <code>MessageEvent</code> interfaces</a><li><a href=#server-sent-events>9.2 Server-sent events</a><ol><li><a href=#server-sent-events-intro>9.2.1 Introduction</a><li><a href=#the-eventsource-interface>9.2.2 The <code>EventSource</code> interface</a><li><a href=#processing-model-10>9.2.3 Processing model</a><li><a href=#parsing-an-event-stream>9.2.4 Parsing an event stream</a><li><a href=#event-stream-interpretation>9.2.5 Interpreting an event stream</a><li><a href=#authoring-notes>9.2.6 Authoring notes</a><li><a href=#eventsource-push>9.2.7 Connectionless push and other features</a><li><a href=#garbage-collection-2>9.2.8 Garbage collection</a><li><a href=#implementation-advice>9.2.9 Implementation advice</a><li><a href=#iana-considerations>9.2.10 IANA considerations</a><ol><li><a href=#text/event-stream>9.2.10.1 <code>text/event-stream</code></a><li><a href=#last-event-id>9.2.10.2 <code>Last-Event-ID</code></a></ol></ol><li><a href=#network>9.3 Web sockets</a><ol><li><a href=#network-intro>9.3.1 Introduction</a><li><a href=#the-websocket-interface>9.3.2 The <code>WebSocket</code> interface</a><li><a href=#feedback-from-the-protocol>9.3.3 Feedback from the protocol</a><li><a href=#ping-and-pong-frames>9.3.4 Ping and Pong frames</a><li><a href=#parsing-websocket-urls>9.3.5 Parsing WebSocket URLs</a><li><a href=#the-closeevent-interfaces>9.3.6 The <code>CloseEvent</code> interfaces</a><li><a href=#garbage-collection-3>9.3.7 Garbage collection</a></ol><li><a href=#web-messaging>9.4 Cross-document messaging</a><ol><li><a href=#introduction-13>9.4.1 Introduction</a><li><a href=#security-postmsg>9.4.2 Security</a><ol><li><a href=#authors>9.4.2.1 Authors</a><li><a href=#user-agents>9.4.2.2 User agents</a></ol><li><a href=#posting-messages>9.4.3 Posting messages</a></ol><li><a href=#channel-messaging>9.5 Channel messaging</a><ol><li><a href=#introduction-14>9.5.1 Introduction</a><ol><li><a href=#examples-5>9.5.1.1 Examples</a><li><a href=#ports-as-the-basis-of-an-object-capability-model-on-the-web>9.5.1.2 Ports as the basis of an object-capability model on the Web</a><li><a href=#ports-as-the-basis-of-abstracting-out-service-implementations>9.5.1.3 Ports as the basis of abstracting out service implementations</a></ol><li><a href=#message-channels>9.5.2 Message channels</a><li><a href=#message-ports>9.5.3 Message ports</a><li><a href=#broadcasting-to-many-ports>9.5.4 Broadcasting to many ports</a><li><a href=#ports-and-garbage-collection>9.5.5 Ports and garbage collection</a></ol><li><a href=#broadcasting-to-other-browsing-contexts>9.6 Broadcasting to other browsing contexts</a></ol><li><a href=#workers>10 Web workers</a><ol><li><a href=#introduction-15>10.1 Introduction</a><ol><li><a href=#scope-2>10.1.1 Scope</a><li><a href=#examples-6>10.1.2 Examples</a><ol><li><a href=#a-background-number-crunching-worker>10.1.2.1 A background number-crunching worker</a><li><a href=#worker-used-for-background-i/o>10.1.2.2 Worker used for background I/O</a><li><a href=#shared-workers-introduction>10.1.2.3 Shared workers introduction</a><li><a href=#shared-state-using-a-shared-worker>10.1.2.4 Shared state using a shared worker</a><li><a href=#delegation>10.1.2.5 Delegation</a></ol><li><a href=#tutorials>10.1.3 Tutorials</a><ol><li><a href=#creating-a-dedicated-worker>10.1.3.1 Creating a dedicated worker</a><li><a href=#communicating-with-a-dedicated-worker>10.1.3.2 Communicating with a dedicated worker</a><li><a href=#shared-workers>10.1.3.3 Shared workers</a></ol></ol><li><a href=#infrastructure-2>10.2 Infrastructure</a><ol><li><a href=#the-global-scope>10.2.1 The global scope</a><ol><li><a href=#the-workerglobalscope-common-interface>10.2.1.1 The <code>WorkerGlobalScope</code> common interface</a><li><a href=#dedicated-workers-and-the-dedicatedworkerglobalscope-interface>10.2.1.2 Dedicated workers and the <code>DedicatedWorkerGlobalScope</code> interface</a><li><a href=#shared-workers-and-the-sharedworkerglobalscope-interface>10.2.1.3 Shared workers and the <code>SharedWorkerGlobalScope</code> interface</a></ol><li><a href=#worker-event-loop>10.2.2 The event loop</a><li><a href="#the-worker's-lifetime">10.2.3 The worker's lifetime</a><li><a href=#processing-model-11>10.2.4 Processing model</a><li><a href=#runtime-script-errors-2>10.2.5 Runtime script errors</a><li><a href=#creating-workers>10.2.6 Creating workers</a><ol><li><a href=#the-abstractworker-abstract-interface>10.2.6.1 The <code>AbstractWorker</code> abstract interface</a><li><a href=#script-settings-for-workers>10.2.6.2 Script settings for workers</a><li><a href=#dedicated-workers-and-the-worker-interface>10.2.6.3 Dedicated workers and the <code>Worker</code> interface</a><li><a href=#shared-workers-and-the-sharedworker-interface>10.2.6.4 Shared workers and the <code>SharedWorker</code> interface</a></ol></ol><li><a href=#apis-available-to-workers>10.3 APIs available to workers</a><ol><li><a href=#importing-scripts-and-libraries>10.3.1 Importing scripts and libraries</a><li><a href=#the-workernavigator-object>10.3.2 The <code>WorkerNavigator</code> object</a><li><a href=#worker-locations>10.3.3 Worker locations</a></ol></ol><li><a href=#webstorage>11 Web storage</a><ol><li><a href=#introduction-16>11.1 Introduction</a><li><a href=#storage>11.2 The API</a><ol><li><a href=#the-storage-interface>11.2.1 The <code>Storage</code> interface</a><li><a href=#the-sessionstorage-attribute>11.2.2 The <code>sessionStorage</code> attribute</a><li><a href=#the-localstorage-attribute>11.2.3 The <code>localStorage</code> attribute</a><li><a href=#the-storage-event>11.2.4 The <code>storage</code> event</a><ol><li><a href=#the-storageevent-interface>11.2.4.1 The <code>StorageEvent</code> interface</a></ol><li><a href=#threads>11.2.5 Threads</a></ol><li><a href=#disk-space-2>11.3 Disk space</a><li><a href=#privacy>11.4 Privacy</a><ol><li><a href=#user-tracking>11.4.1 User tracking</a><li><a href=#sensitivity-of-data>11.4.2 Sensitivity of data</a></ol><li><a href=#security-storage>11.5 Security</a><ol><li><a href=#dns-spoofing-attacks>11.5.1 DNS spoofing attacks</a><li><a href=#cross-directory-attacks>11.5.2 Cross-directory attacks</a><li><a href=#implementation-risks>11.5.3 Implementation risks</a></ol></ol><li><a href=#syntax>12 The HTML syntax</a><ol><li><a href=#writing>12.1 Writing HTML documents</a><ol><li><a href=#the-doctype>12.1.1 The DOCTYPE</a><li><a href=#elements-2>12.1.2 Elements</a><ol><li><a href=#start-tags>12.1.2.1 Start tags</a><li><a href=#end-tags>12.1.2.2 End tags</a><li><a href=#attributes-2>12.1.2.3 Attributes</a><li><a href=#optional-tags>12.1.2.4 Optional tags</a><li><a href=#element-restrictions>12.1.2.5 Restrictions on content models</a><li><a href=#cdata-rcdata-restrictions>12.1.2.6 Restrictions on the contents of raw text and escapable raw text elements</a></ol><li><a href=#text-2>12.1.3 Text</a><ol><li><a href=#newlines>12.1.3.1 Newlines</a></ol><li><a href=#character-references>12.1.4 Character references</a><li><a href=#cdata-sections>12.1.5 CDATA sections</a><li><a href=#comments>12.1.6 Comments</a></ol><li><a href=#parsing>12.2 Parsing HTML documents</a><ol><li><a href=#overview-of-the-parsing-model>12.2.1 Overview of the parsing model</a><li><a href=#the-input-byte-stream>12.2.2 The input byte stream</a><ol><li><a href=#parsing-with-a-known-character-encoding>12.2.2.1 Parsing with a known character encoding</a><li><a href=#determining-the-character-encoding>12.2.2.2 Determining the character encoding</a><li><a href=#character-encodings>12.2.2.3 Character encodings</a><li><a href=#changing-the-encoding-while-parsing>12.2.2.4 Changing the encoding while parsing</a><li><a href=#preprocessing-the-input-stream>12.2.2.5 Preprocessing the input stream</a></ol><li><a href=#parse-state>12.2.3 Parse state</a><ol><li><a href=#the-insertion-mode>12.2.3.1 The insertion mode</a><li><a href=#the-stack-of-open-elements>12.2.3.2 The stack of open elements</a><li><a href=#the-list-of-active-formatting-elements>12.2.3.3 The list of active formatting elements</a><li><a href=#the-element-pointers>12.2.3.4 The element pointers</a><li><a href=#other-parsing-state-flags>12.2.3.5 Other parsing state flags</a></ol><li><a href=#tokenization>12.2.4 Tokenization</a><ol><li><a href=#data-state>12.2.4.1 Data state</a><li><a href=#character-reference-in-data-state>12.2.4.2 Character reference in data state</a><li><a href=#rcdata-state>12.2.4.3 RCDATA state</a><li><a href=#character-reference-in-rcdata-state>12.2.4.4 Character reference in RCDATA state</a><li><a href=#rawtext-state>12.2.4.5 RAWTEXT state</a><li><a href=#script-data-state>12.2.4.6 Script data state</a><li><a href=#plaintext-state>12.2.4.7 PLAINTEXT state</a><li><a href=#tag-open-state>12.2.4.8 Tag open state</a><li><a href=#end-tag-open-state>12.2.4.9 End tag open state</a><li><a href=#tag-name-state>12.2.4.10 Tag name state</a><li><a href=#rcdata-less-than-sign-state>12.2.4.11 RCDATA less-than sign state</a><li><a href=#rcdata-end-tag-open-state>12.2.4.12 RCDATA end tag open state</a><li><a href=#rcdata-end-tag-name-state>12.2.4.13 RCDATA end tag name state</a><li><a href=#rawtext-less-than-sign-state>12.2.4.14 RAWTEXT less-than sign state</a><li><a href=#rawtext-end-tag-open-state>12.2.4.15 RAWTEXT end tag open state</a><li><a href=#rawtext-end-tag-name-state>12.2.4.16 RAWTEXT end tag name state</a><li><a href=#script-data-less-than-sign-state>12.2.4.17 Script data less-than sign state</a><li><a href=#script-data-end-tag-open-state>12.2.4.18 Script data end tag open state</a><li><a href=#script-data-end-tag-name-state>12.2.4.19 Script data end tag name state</a><li><a href=#script-data-escape-start-state>12.2.4.20 Script data escape start state</a><li><a href=#script-data-escape-start-dash-state>12.2.4.21 Script data escape start dash state</a><li><a href=#script-data-escaped-state>12.2.4.22 Script data escaped state</a><li><a href=#script-data-escaped-dash-state>12.2.4.23 Script data escaped dash state</a><li><a href=#script-data-escaped-dash-dash-state>12.2.4.24 Script data escaped dash dash state</a><li><a href=#script-data-escaped-less-than-sign-state>12.2.4.25 Script data escaped less-than sign state</a><li><a href=#script-data-escaped-end-tag-open-state>12.2.4.26 Script data escaped end tag open state</a><li><a href=#script-data-escaped-end-tag-name-state>12.2.4.27 Script data escaped end tag name state</a><li><a href=#script-data-double-escape-start-state>12.2.4.28 Script data double escape start state</a><li><a href=#script-data-double-escaped-state>12.2.4.29 Script data double escaped state</a><li><a href=#script-data-double-escaped-dash-state>12.2.4.30 Script data double escaped dash state</a><li><a href=#script-data-double-escaped-dash-dash-state>12.2.4.31 Script data double escaped dash dash state</a><li><a href=#script-data-double-escaped-less-than-sign-state>12.2.4.32 Script data double escaped less-than sign state</a><li><a href=#script-data-double-escape-end-state>12.2.4.33 Script data double escape end state</a><li><a href=#before-attribute-name-state>12.2.4.34 Before attribute name state</a><li><a href=#attribute-name-state>12.2.4.35 Attribute name state</a><li><a href=#after-attribute-name-state>12.2.4.36 After attribute name state</a><li><a href=#before-attribute-value-state>12.2.4.37 Before attribute value state</a><li><a href=#attribute-value-(double-quoted)-state>12.2.4.38 Attribute value (double-quoted) state</a><li><a href=#attribute-value-(single-quoted)-state>12.2.4.39 Attribute value (single-quoted) state</a><li><a href=#attribute-value-(unquoted)-state>12.2.4.40 Attribute value (unquoted) state</a><li><a href=#character-reference-in-attribute-value-state>12.2.4.41 Character reference in attribute value state</a><li><a href=#after-attribute-value-(quoted)-state>12.2.4.42 After attribute value (quoted) state</a><li><a href=#self-closing-start-tag-state>12.2.4.43 Self-closing start tag state</a><li><a href=#bogus-comment-state>12.2.4.44 Bogus comment state</a><li><a href=#markup-declaration-open-state>12.2.4.45 Markup declaration open state</a><li><a href=#comment-start-state>12.2.4.46 Comment start state</a><li><a href=#comment-start-dash-state>12.2.4.47 Comment start dash state</a><li><a href=#comment-state>12.2.4.48 Comment state</a><li><a href=#comment-end-dash-state>12.2.4.49 Comment end dash state</a><li><a href=#comment-end-state>12.2.4.50 Comment end state</a><li><a href=#comment-end-bang-state>12.2.4.51 Comment end bang state</a><li><a href=#doctype-state>12.2.4.52 DOCTYPE state</a><li><a href=#before-doctype-name-state>12.2.4.53 Before DOCTYPE name state</a><li><a href=#doctype-name-state>12.2.4.54 DOCTYPE name state</a><li><a href=#after-doctype-name-state>12.2.4.55 After DOCTYPE name state</a><li><a href=#after-doctype-public-keyword-state>12.2.4.56 After DOCTYPE public keyword state</a><li><a href=#before-doctype-public-identifier-state>12.2.4.57 Before DOCTYPE public identifier state</a><li><a href=#doctype-public-identifier-(double-quoted)-state>12.2.4.58 DOCTYPE public identifier (double-quoted) state</a><li><a href=#doctype-public-identifier-(single-quoted)-state>12.2.4.59 DOCTYPE public identifier (single-quoted) state</a><li><a href=#after-doctype-public-identifier-state>12.2.4.60 After DOCTYPE public identifier state</a><li><a href=#between-doctype-public-and-system-identifiers-state>12.2.4.61 Between DOCTYPE public and system identifiers state</a><li><a href=#after-doctype-system-keyword-state>12.2.4.62 After DOCTYPE system keyword state</a><li><a href=#before-doctype-system-identifier-state>12.2.4.63 Before DOCTYPE system identifier state</a><li><a href=#doctype-system-identifier-(double-quoted)-state>12.2.4.64 DOCTYPE system identifier (double-quoted) state</a><li><a href=#doctype-system-identifier-(single-quoted)-state>12.2.4.65 DOCTYPE system identifier (single-quoted) state</a><li><a href=#after-doctype-system-identifier-state>12.2.4.66 After DOCTYPE system identifier state</a><li><a href=#bogus-doctype-state>12.2.4.67 Bogus DOCTYPE state</a><li><a href=#cdata-section-state>12.2.4.68 CDATA section state</a><li><a href=#tokenizing-character-references>12.2.4.69 Tokenizing character references</a></ol><li><a href=#tree-construction>12.2.5 Tree construction</a><ol><li><a href=#creating-and-inserting-nodes>12.2.5.1 Creating and inserting nodes</a><li><a href=#parsing-elements-that-contain-only-text>12.2.5.2 Parsing elements that contain only text</a><li><a href=#closing-elements-that-have-implied-end-tags>12.2.5.3 Closing elements that have implied end tags</a><li><a href=#parsing-main-inhtml>12.2.5.4 The rules for parsing tokens in HTML content</a><ol><li><a href=#the-initial-insertion-mode>12.2.5.4.1 The "initial" insertion mode</a><li><a href=#the-before-html-insertion-mode>12.2.5.4.2 The "before html" insertion mode</a><li><a href=#the-before-head-insertion-mode>12.2.5.4.3 The "before head" insertion mode</a><li><a href=#parsing-main-inhead>12.2.5.4.4 The "in head" insertion mode</a><li><a href=#parsing-main-inheadnoscript>12.2.5.4.5 The "in head noscript" insertion mode</a><li><a href=#the-after-head-insertion-mode>12.2.5.4.6 The "after head" insertion mode</a><li><a href=#parsing-main-inbody>12.2.5.4.7 The "in body" insertion mode</a><li><a href=#parsing-main-incdata>12.2.5.4.8 The "text" insertion mode</a><li><a href=#parsing-main-intable>12.2.5.4.9 The "in table" insertion mode</a><li><a href=#parsing-main-intabletext>12.2.5.4.10 The "in table text" insertion mode</a><li><a href=#parsing-main-incaption>12.2.5.4.11 The "in caption" insertion mode</a><li><a href=#parsing-main-incolgroup>12.2.5.4.12 The "in column group" insertion mode</a><li><a href=#parsing-main-intbody>12.2.5.4.13 The "in table body" insertion mode</a><li><a href=#parsing-main-intr>12.2.5.4.14 The "in row" insertion mode</a><li><a href=#parsing-main-intd>12.2.5.4.15 The "in cell" insertion mode</a><li><a href=#parsing-main-inselect>12.2.5.4.16 The "in select" insertion mode</a><li><a href=#parsing-main-inselectintable>12.2.5.4.17 The "in select in table" insertion mode</a><li><a href=#parsing-main-intemplate>12.2.5.4.18 The "in template" insertion mode</a><li><a href=#parsing-main-afterbody>12.2.5.4.19 The "after body" insertion mode</a><li><a href=#parsing-main-inframeset>12.2.5.4.20 The "in frameset" insertion mode</a><li><a href=#parsing-main-afterframeset>12.2.5.4.21 The "after frameset" insertion mode</a><li><a href=#the-after-after-body-insertion-mode>12.2.5.4.22 The "after after body" insertion mode</a><li><a href=#the-after-after-frameset-insertion-mode>12.2.5.4.23 The "after after frameset" insertion mode</a></ol><li><a href=#parsing-main-inforeign>12.2.5.5 The rules for parsing tokens in foreign content</a></ol><li><a href=#the-end>12.2.6 The end</a><li><a href=#coercing-an-html-dom-into-an-infoset>12.2.7 Coercing an HTML DOM into an infoset</a><li><a href=#an-introduction-to-error-handling-and-strange-cases-in-the-parser>12.2.8 An introduction to error handling and strange cases in the parser</a><ol><li><a href=#misnested-tags:-b-i-/b-/i>12.2.8.1 Misnested tags: <b><i></b></i></a><li><a href=#misnested-tags:-b-p-/b-/p>12.2.8.2 Misnested tags: <b><p></b></p></a><li><a href=#unexpected-markup-in-tables>12.2.8.3 Unexpected markup in tables</a><li><a href=#scripts-that-modify-the-page-as-it-is-being-parsed>12.2.8.4 Scripts that modify the page as it is being parsed</a><li><a href=#the-execution-of-scripts-that-are-moving-across-multiple-documents>12.2.8.5 The execution of scripts that are moving across multiple documents</a><li><a href=#unclosed-formatting-elements>12.2.8.6 Unclosed formatting elements</a></ol></ol><li><a href=#serialising-html-fragments>12.3 Serialising HTML fragments</a><li><a href=#parsing-html-fragments>12.4 Parsing HTML fragments</a><li><a href=#named-character-references>12.5 Named character references</a></ol><li><a href=#the-xhtml-syntax>13 The XHTML syntax</a><ol><li><a href=#writing-xhtml-documents>13.1 Writing XHTML documents</a><li><a href=#parsing-xhtml-documents>13.2 Parsing XHTML documents</a><li><a href=#serialising-xhtml-fragments>13.3 Serialising XHTML fragments</a><li><a href=#parsing-xhtml-fragments>13.4 Parsing XHTML fragments</a></ol><li><a href=#rendering>14 Rendering</a><ol><li><a href=#introduction-17>14.1 Introduction</a><li><a href=#the-css-user-agent-style-sheet-and-presentational-hints>14.2 The CSS user agent style sheet and presentational hints</a><li><a href=#non-replaced-elements>14.3 Non-replaced elements</a><ol><li><a href=#hidden-elements>14.3.1 Hidden elements</a><li><a href=#the-page>14.3.2 The page</a><li><a href=#flow-content-3>14.3.3 Flow content</a><li><a href=#phrasing-content-3>14.3.4 Phrasing content</a><li><a href=#bidi-rendering>14.3.5 Bidirectional text</a><li><a href=#quotes>14.3.6 Quotes</a><li><a href=#sections-and-headings>14.3.7 Sections and headings</a><li><a href=#lists>14.3.8 Lists</a><li><a href=#tables-2>14.3.9 Tables</a><li><a href=#margin-collapsing-quirks>14.3.10 Margin collapsing quirks</a><li><a href=#form-controls>14.3.11 Form controls</a><li><a href=#the-hr-element-2>14.3.12 The <code>hr</code> element</a><li><a href=#the-fieldset-and-legend-elements>14.3.13 The <code>fieldset</code> and <code>legend</code> elements</a></ol><li><a href=#replaced-elements>14.4 Replaced elements</a><ol><li><a href=#embedded-content-rendering-rules>14.4.1 Embedded content</a><li><a href=#images-2>14.4.2 Images</a><li><a href=#attributes-for-embedded-content-and-images>14.4.3 Attributes for embedded content and images</a><li><a href=#image-maps-2>14.4.4 Image maps</a></ol><li><a href=#bindings>14.5 Bindings</a><ol><li><a href=#introduction-18>14.5.1 Introduction</a><li><a href=#the-button-element-2>14.5.2 The <code>button</code> element</a><li><a href=#the-details-element-2>14.5.3 The <code>details</code> element</a><li><a href=#the-input-element-as-a-text-entry-widget>14.5.4 The <code>input</code> element as a text entry widget</a><li><a href=#the-input-element-as-domain-specific-widgets>14.5.5 The <code>input</code> element as domain-specific widgets</a><li><a href=#the-input-element-as-a-range-control>14.5.6 The <code>input</code> element as a range control</a><li><a href=#the-input-element-as-a-colour-well>14.5.7 The <code>input</code> element as a colour well</a><li><a href=#the-input-element-as-a-checkbox-and-radio-button-widgets>14.5.8 The <code>input</code> element as a checkbox and radio button widgets</a><li><a href=#the-input-element-as-a-file-upload-control>14.5.9 The <code>input</code> element as a file upload control</a><li><a href=#the-input-element-as-a-button>14.5.10 The <code>input</code> element as a button</a><li><a href=#the-marquee-element>14.5.11 The <code>marquee</code> element</a><li><a href=#the-meter-element-2>14.5.12 The <code>meter</code> element</a><li><a href=#the-progress-element-2>14.5.13 The <code>progress</code> element</a><li><a href=#the-select-element-2>14.5.14 The <code>select</code> element</a><li><a href=#the-textarea-element-2>14.5.15 The <code>textarea</code> element</a><li><a href=#the-keygen-element-2>14.5.16 The <code>keygen</code> element</a></ol><li><a href=#frames-and-framesets>14.6 Frames and framesets</a><li><a href=#interactive-media>14.7 Interactive media</a><ol><li><a href=#links,-forms,-and-navigation>14.7.1 Links, forms, and navigation</a><li><a href=#the-title-attribute-2>14.7.2 The <code>title</code> attribute</a><li><a href=#editing-hosts>14.7.3 Editing hosts</a><li><a href=#text-rendered-in-native-user-interfaces>14.7.4 Text rendered in native user interfaces</a></ol><li><a href=#print-media>14.8 Print media</a><li><a href=#unstyled-xml-documents>14.9 Unstyled XML documents</a></ol><li><a href=#obsolete>15 Obsolete features</a><ol><li><a href=#obsolete-but-conforming-features>15.1 Obsolete but conforming features</a><ol><li><a href=#warnings-for-obsolete-but-conforming-features>15.1.1 Warnings for obsolete but conforming features</a></ol><li><a href=#non-conforming-features>15.2 Non-conforming features</a><li><a href=#requirements-for-implementations>15.3 Requirements for implementations</a><ol><li><a href=#the-applet-element>15.3.1 The <code>applet</code> element</a><li><a href=#the-marquee-element-2>15.3.2 The <code>marquee</code> element</a><li><a href=#frames>15.3.3 Frames</a><li><a href=#other-elements,-attributes-and-apis>15.3.4 Other elements, attributes and APIs</a></ol></ol><li><a href=#iana>16 IANA considerations</a><ol><li><a href=#text/html>16.1 <code>text/html</code></a><li><a href=#multipart/x-mixed-replace>16.2 <code>multipart/x-mixed-replace</code></a><li><a href=#application/xhtml+xml>16.3 <code>application/xhtml+xml</code></a><li><a href=#application/x-www-form-urlencoded>16.4 <code>application/x-www-form-urlencoded</code></a><li><a href=#text/cache-manifest>16.5 <code>text/cache-manifest</code></a><li><a href=#text/ping>16.6 <code>text/ping</code></a><li><a href=#application/microdata+json>16.7 <code>application/microdata+json</code></a><li><a href=#ping-from>16.8 <code>Ping-From</code></a><li><a href=#ping-to>16.9 <code>Ping-To</code></a><li><a href=#web+-scheme-prefix>16.10 <code>web+</code> scheme prefix</a></ol><li><a href=#index>Index</a><ol><li><a href=#elements-3>Elements</a><li><a href=#element-content-categories>Element content categories</a><li><a href=#attributes-3>Attributes</a><li><a href=#element-interfaces>Element Interfaces</a><li><a href=#all-interfaces>All Interfaces</a><li><a href=#events-2>Events</a><li><a href=#mime-types-2>MIME Types</a></ol><li><a href=#references>References</a><li><a href=#acknowledgements>Acknowledgements</a></ol>
-
- <h2 id=introduction>1 Introduction</h2>
-
- <h3 id=abstract>1.1 Where does this specification fit?</h3>
- <p>This specification defines a big part of the Web platform, in lots of detail. Its place in the
- Web platform specification stack relative to other specifications can be best summed up as
- follows:</p>
- <p><img src=http://images.whatwg.org/abstract.png width=398 alt="It consists of everything else, above such core technologies as HTTP, URI/IRIs, DOM, XML, Unicode, and ECMAScript; below presentation-layer technologies like CSS and the NPAPI; and to the side of technologies like Geolocation, SVG, MathML, and XHR." height=359></p>
-
- <h3 id=is-this-html5?>1.2 Is this HTML5?</h3>
- <p><i>This section is non-normative.</i></p>
- <p>In short: Yes.</p>
- <p>In more length: The term "HTML5" is widely used as a buzzword to refer to modern Web
- technologies, many of which (though by no means all) are developed at the WHATWG. This document is
- one such; others are available from <a href=http://www.whatwg.org/specs/>the WHATWG
- specification index</a>.</p>
- <p class=note>Although we have asked them to stop doing so, the W3C also republishes some parts
- of this specification as separate documents. There are numerous differences between this
- specification and the W3C forks; some minor, some major. Unfortunately these are not currently
- accurately documented anywhere, so there is no way to know which are intentional and which are
- not.</p>
- <h3 id=background>1.3 Background</h3>
- <p><i>This section is non-normative.</i></p>
- <p>HTML is the World Wide Web's core markup language. Originally, HTML was primarily designed as a
- language for semantically describing scientific documents. Its general design, however, has
- enabled it to be adapted, over the subsequent years, to describe a number of other types of
- documents and even applications.</p>
- <h3 id=audience>1.4 Audience</h3>
- <p><i>This section is non-normative.</i></p>
- <p>This specification is intended for authors of documents and scripts that use the features
- defined in this specification, implementors of tools that operate on pages that
- use the features defined in this specification, and individuals wishing to establish the
- correctness of documents or implementations with respect to the requirements of this
- specification.</p>
- <p>This document is probably not suited to readers who do not already have at least a passing
- familiarity with Web technologies, as in places it sacrifices clarity for precision, and brevity
- for completeness. More approachable tutorials and authoring guides can provide a gentler
- introduction to the topic.</p>
- <p>In particular, familiarity with the basics of DOM is necessary for a complete understanding of
- some of the more technical parts of this specification. An understanding of Web IDL, HTTP, XML,
- Unicode, character encodings, JavaScript, and CSS will also be helpful in places but is not
- essential.</p>
- <h3 id=scope>1.5 Scope</h3>
- <p><i>This section is non-normative.</i></p>
- <p>This specification is limited to providing a semantic-level markup language and associated
- semantic-level scripting APIs for authoring accessible pages on the Web ranging from static
- documents to dynamic applications.</p>
- <p>The scope of this specification does not include providing mechanisms for media-specific
- customization of presentation (although default rendering rules for Web browsers are included at
- the end of this specification, and several mechanisms for hooking into CSS are provided as part of
- the language).</p>
- <p>The scope of this specification is not to describe an entire operating system. In particular,
- hardware configuration software, image manipulation tools, and applications that users would be
- expected to use with high-end workstations on a daily basis are out of scope. In terms of
- applications, this specification is targeted specifically at applications that would be expected
- to be used by users on an occasional basis, or regularly but from disparate locations, with low
- CPU requirements. Examples of such applications include online purchasing systems, searching
- systems, games (especially multiplayer online games), public telephone books or address books,
- communications software (e-mail clients, instant messaging clients, discussion software), document
- editing software, etc.</p>
- <h3 id=history-2>1.6 History</h3>
- <p><i>This section is non-normative.</i></p>
- <p>For its first five years (1990-1995), HTML went through a number of revisions and experienced a
- number of extensions, primarily hosted first at CERN, and then at the IETF.</p>
- <p>With the creation of the W3C, HTML's development changed venue again. A first abortive attempt
- at extending HTML in 1995 known as HTML 3.0 then made way to a more pragmatic approach known as
- HTML 3.2, which was completed in 1997. HTML4 quickly followed later that same year.</p>
- <p>The following year, the W3C membership decided to stop evolving HTML and instead begin work on
- an XML-based equivalent, called XHTML. This
- effort started with a reformulation of HTML4 in XML, known as XHTML 1.0, which added no new
- features except the new serialisation, and which was completed in 2000. After XHTML 1.0, the W3C's
- focus turned to making it easier for other working groups to extend XHTML, under the banner of
- XHTML Modularization. In parallel with this, the W3C also worked on a new language that was not
- compatible with the earlier HTML and XHTML languages, calling it XHTML2.</p>
- <p>Around the time that HTML's evolution was stopped in 1998, parts of the API for HTML developed
- by browser vendors were specified and published under the name DOM Level 1 (in 1998) and DOM Level
- 2 Core and DOM Level 2 HTML (starting in 2000 and culminating in 2003). These efforts then petered
- out, with some DOM Level 3 specifications published in 2004 but the working group being closed
- before all the Level 3 drafts were completed.</p>
- <p>In 2003, the publication of XForms, a technology which was positioned as the next generation of
- Web forms, sparked a renewed interest in evolving HTML itself, rather than finding replacements
- for it. This interest was borne from the realization that XML's deployment as a Web technology was
- limited to entirely new technologies (like RSS and later Atom), rather than as a replacement for
- existing deployed technologies (like HTML).</p>
- <p>A proof of concept to show that it was possible to extend HTML4's forms to provide many of the
- features that XForms 1.0 introduced, without requiring browsers to implement rendering engines
- that were incompatible with existing HTML Web pages, was the first result of this renewed
- interest. At this early stage, while the draft was already publicly available, and input was
- already being solicited from all sources, the specification was only under Opera Software's
- copyright.</p>
- <p>The idea that HTML's evolution should be reopened was tested at a W3C workshop in 2004, where
- some of the principles that underlie the HTML5 work (described below), as well as the
- aforementioned early draft proposal covering just forms-related features, were presented to the
- W3C jointly by Mozilla and Opera. The proposal was rejected on the grounds that the proposal
- conflicted with the previously chosen direction for the Web's evolution; the W3C staff and
- membership voted to continue developing XML-based replacements instead.</p>
- <p>Shortly thereafter, Apple, Mozilla, and Opera jointly announced their intent to continue
- working on the effort under the umbrella of a new venue called the WHATWG. A public mailing list
- was created, and the draft was moved to the WHATWG site. The copyright was subsequently amended to
- be jointly owned by all three vendors, and to allow reuse of the specification.</p>
- <p>The WHATWG was based on several core principles, in particular that technologies need to be
- backwards compatible, that specifications and implementations need to match even if this means
- changing the specification rather than the implementations, and that specifications need to be
- detailed enough that implementations can achieve complete interoperability without
- reverse-engineering each other.</p>
- <p>The latter requirement in particular required that the scope of the HTML5 specification include
- what had previously been specified in three separate documents: HTML4, XHTML1, and DOM2 HTML. It
- also meant including significantly more detail than had previously been considered the norm.</p>
- <p>In 2006, the W3C indicated an interest to participate in the development of HTML5 after all,
- and in 2007 formed a working group chartered to work with the WHATWG on the development of the
- HTML5 specification. Apple, Mozilla, and Opera allowed the W3C to publish the specification under
- the W3C copyright, while keeping a version with the less restrictive license on the WHATWG
- site.</p>
- <p>For a number of years, both groups then worked together. In 2011, however, the groups came to
- the conclusion that they had different goals: the W3C wanted to publish a "finished" version of
- "HTML5", while the WHATWG wanted to continue working on a Living Standard for HTML, continuously
- maintaining the specification rather than freezing it in a state with known problems, and adding
- new features as needed to evolve the platform.</p>
- <p>Since then, the WHATWG has been working on this specification (amongst others), and the W3C has
- been copying fixes made by the WHATWG into their fork of the document, as well as making other
- changes, some intentional and some not, with no documentation listing or explaining the
- differences.</p>
- <h3 id=design-notes>1.7 Design notes</h3>
- <p><i>This section is non-normative.</i></p>
- <p>It must be admitted that many aspects of HTML appear at first glance to be nonsensical and
- inconsistent.</p>
- <p>HTML, its supporting DOM APIs, as well as many of its supporting technologies, have been
- developed over a period of several decades by a wide array of people with different priorities
- who, in many cases, did not know of each other's existence.</p>
- <p>Features have thus arisen from many sources, and have not always been designed in especially
- consistent ways. Furthermore, because of the unique characteristics of the Web, implementation
- bugs have often become de-facto, and now de-jure, standards, as content is often unintentionally
- written in ways that rely on them before they can be fixed.</p>
- <p>Despite all this, efforts have been made to adhere to certain design goals. These are described
- in the next few subsections.</p>
-
- <h4 id=serialisability-of-script-execution>1.7.1 Serialisability of script execution</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To avoid exposing Web authors to the complexities of multithreading, the HTML and DOM APIs are
- designed such that no script can ever detect the simultaneous execution of other scripts. Even
- with <a href=#worker id=serialisability-of-script-execution:worker>workers</a>, the intent is that the behavior of implementations can
- be thought of as completely serialising the execution of all scripts in all <a href=#browsing-context id=serialisability-of-script-execution:browsing-context>browsing contexts</a>.</p>
- <p class=note>The <code id=serialisability-of-script-execution:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method, in
- this model, is equivalent to allowing other scripts to run while the calling script is
- blocked.</p>
-
- <h4 id=compliance-with-other-specifications>1.7.2 Compliance with other specifications</h4>
- <p><i>This section is non-normative.</i></p>
- <p>This specification interacts with and relies on a wide variety of other specifications. In
- certain circumstances, unfortunately, conflicting needs have led to this specification violating
- the requirements of these other specifications. Whenever this has occurred, the transgressions
- have each been noted as a "<dfn id=willful-violation>willful violation</dfn>", and the reason for the violation has
- been noted.</p>
- <h4 id=extensibility>1.7.3 Extensibility</h4>
- <p><i>This section is non-normative.</i></p>
- <p>HTML has a wide array of extensibility mechanisms that can be used for adding semantics in a
- safe manner:</p>
- <ul><li><p>Authors can use the <code id=extensibility:classes><a href=#classes>class</a></code> attribute to extend elements,
- effectively creating their own elements, while using the most applicable existing "real" HTML
- element, so that browsers and other tools that don't know of the extension can still support it
- somewhat well. This is the tack used by microformats, for example.<li><p>Authors can include data for inline client-side scripts or server-side site-wide scripts
- to process using the <code id=extensibility:attr-data-*><a href=#attr-data-*>data-*=""</a></code> attributes. These are guaranteed
- to never be touched by browsers, and allow scripts to include data on HTML elements that scripts
- can then look for and process.<li><p>Authors can use the <code id=extensibility:the-meta-element><a href=#the-meta-element><meta name="" content=""></a></code> mechanism to
- include page-wide metadata by registering <a href=#concept-meta-extensions id=extensibility:concept-meta-extensions>extensions to
- the predefined set of metadata names</a>.<li><p>Authors can use the <code id=extensibility:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel=""</a></code> mechanism to annotate
- links with specific meanings by registering <a href=#concept-rel-extensions id=extensibility:concept-rel-extensions>extensions to
- the predefined set of link types</a>. This is also used by microformats.<li><p>Authors can embed raw data using the <code id=extensibility:the-script-element><a href=#the-script-element><script type=""></a></code>
- mechanism with a custom type, for further handling by inline or server-side scripts.<li><p>Authors can create <a href=#plugin id=extensibility:plugin>plugins</a> and invoke them using the
- <code id=extensibility:the-embed-element><a href=#the-embed-element>embed</a></code> element. This is how Flash works.<li><p>Authors can extend APIs using the JavaScript prototyping mechanism. This is widely used by
- script libraries, for instance.<li><p>Authors can use the microdata feature (the <code id=extensibility:attr-itemscope><a href=#attr-itemscope>itemscope=""</a></code> and <code id=extensibility:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop=""</a></code>
- attributes) to embed nested name-value pairs of data to be shared with other applications and
- sites.</ul>
- <h3 id=html-vs-xhtml>1.8 HTML vs XHTML</h3>
- <p><i>This section is non-normative.</i></p>
- <p>This specification defines an abstract language for describing documents and applications, and
- some APIs for interacting with in-memory representations of resources that use this language.</p>
- <p>The in-memory representation is known as "DOM HTML", or "the DOM" for short.</p>
- <p>There are various concrete syntaxes that can be used to transmit resources that use this
- abstract language, two of which are defined in this specification.</p>
- <p>The first such concrete syntax is the HTML syntax. This is the format suggested for most
- authors. It is compatible with most legacy Web browsers. If a document is transmitted with the
- <code id=html-vs-xhtml:text/html><a href=#text/html>text/html</a></code> <a href=#mime-type id=html-vs-xhtml:mime-type>MIME type</a>, then it will be processed as an HTML document by
- Web browsers. This specification defines the latest HTML syntax, known simply as "HTML".</p>
- <p>The second concrete syntax is the XHTML syntax, which is an application of XML. When a document
- is transmitted with an <a href=#xml-mime-type id=html-vs-xhtml:xml-mime-type>XML MIME type</a>, such as <code id=html-vs-xhtml:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code>,
- then it is treated as an XML document by Web browsers, to be parsed by an XML processor. Authors
- are reminded that the processing for XML and HTML differs; in particular, even minor syntax errors
- will prevent a document labeled as XML from being rendered fully, whereas they would be ignored in
- the HTML syntax. This specification defines the latest XHTML syntax, known simply as "XHTML".</p>
- <p>The DOM, the HTML syntax, and the XHTML syntax cannot all represent the same content. For
- example, namespaces cannot be represented using the HTML syntax, but they are supported in the DOM
- and in the XHTML syntax. Similarly, documents that use the <code id=html-vs-xhtml:the-noscript-element><a href=#the-noscript-element>noscript</a></code> feature can be
- represented using the HTML syntax, but cannot be represented with the DOM or in the XHTML syntax.
- Comments that contain the string "<code>--></code>" can only be represented in the
- DOM, not in the HTML and XHTML syntaxes.</p>
- <h3 id=structure-of-this-specification>1.9 Structure of this specification</h3>
- <p><i>This section is non-normative.</i></p>
- <p>This specification is divided into the following major sections:</p>
- <dl><dt><a href=#introduction>Introduction</a><dd>Non-normative materials providing a context for the HTML standard.<dt><a href=#infrastructure>Common infrastructure</a><dd>The conformance classes, algorithms, definitions, and the common underpinnings of the rest of
- the specification.<dt><a href=#dom>Semantics, structure, and APIs of HTML documents</a><dd>Documents are built from elements. These elements form a tree using the DOM. This section
- defines the features of this DOM, as well as introducing the features common to all elements, and
- the concepts used in defining elements.<dt><a href=#semantics>The elements of HTML</a><dd>Each element has a predefined meaning, which is explained in this section. Rules for authors
- on how to use the element, along with user agent requirements for how to
- handle each element, are also given. This includes large signature features of HTML such
- as video playback and subtitles, form controls and form submission, and a 2D graphics API known
- as the HTML canvas.<dt><a href=#microdata>Microdata</a><dd>This specification introduces a mechanism for adding machine-readable annotations to
- documents, so that tools can extract trees of name-value pairs from the document. This section
- describes this mechanism and some algorithms that can be used to convert HTML
- documents into other formats. This section also defines some sample Microdata vocabularies
- for contact information, calendar events, and licensing works.<dt><a href=#editing>User interaction</a><dd>HTML documents can provide a number of mechanisms for users to interact with and modify
- content, which are described in this section, such as how focus works, and drag-and-drop.<dt><a href=#browsers>Loading Web pages</a><dd>HTML documents do not exist in a vacuum — this section defines many of the features
- that affect environments that deal with multiple pages, such as Web browsers and offline
- caching of Web applications.<dt><a href=#webappapis>Web application APIs</a><dd>This section introduces basic features for scripting of applications in HTML.<dt><a href=#workers>Web workers</a><dd>This section defines an API for background threads in JavaScript.<dt><a href=#comms>The communication APIs</a><dd>This section describes some mechanisms that applications written in HTML can use to
- communicate with other applications from different domains running on the same client. It also
- introduces a server-push event stream mechanism known as Server Sent Events or
- <code id=structure-of-this-specification:eventsource><a href=#eventsource>EventSource</a></code>, and a two-way full-duplex socket protocol for scripts known as Web
- Sockets.
- <dt><a href=#webstorage>Web storage</a><dd>This section defines a client-side storage mechanism based on name-value pairs.<dt><a href=#syntax>The HTML syntax</a><dt><a href=#xhtml>The XHTML syntax</a><dd>All of these features would be for naught if they couldn't be represented in a serialised
- form and sent to other people, and so these sections define the syntaxes of HTML and XHTML, along with rules for how to parse content using those syntaxes.<dt><a href=#rendering>Rendering</a><dd>This section defines the default rendering rules for Web browsers.</dl>
- <p>There are also some appendices, listing <a href=#obsolete>obsolete features</a> and <a href=#iana>IANA considerations</a>, and several indices.</p>
-
- <h4 id=how-to-read-this-specification>1.9.1 How to read this specification</h4>
- <p>This specification should be read like all other specifications. First, it should be read
- cover-to-cover, multiple times. Then, it should be read backwards at least once. Then it should be
- read by picking random sections from the contents list and following all the cross-references.</p>
- <p>As described in the conformance requirements section below, this specification describes
- conformance criteria for a variety of conformance classes. In particular, there are conformance
- requirements that apply to <em>producers</em>, for example authors and the documents they create,
- and there are conformance requirements that apply to <em>consumers</em>, for example Web browsers.
- They can be distinguished by what they are requiring: a requirement on a producer states what is
- allowed, while a requirement on a consumer states how software is to act.</p>
- <div class=example>
- <p>For example, "the <code>foo</code> attribute's value must be a <a href=#valid-integer id=how-to-read-this-specification:valid-integer>valid
- integer</a>" is a requirement on producers, as it lays out the allowed values; in contrast,
- the requirement "the <code>foo</code> attribute's value must be parsed using the
- <a href=#rules-for-parsing-integers id=how-to-read-this-specification:rules-for-parsing-integers>rules for parsing integers</a>" is a requirement on consumers, as it describes how to
- process the content.</p>
- </div>
- <p><strong>Requirements on producers have no bearing whatsoever on consumers.</strong></p>
- <div class=example>
- <p>Continuing the above example, a requirement stating that a particular attribute's value is
- constrained to being a <a href=#valid-integer id=how-to-read-this-specification:valid-integer-2>valid integer</a> emphatically does <em>not</em> imply anything
- about the requirements on consumers. It might be that the consumers are in fact required to treat
- the attribute as an opaque string, completely unaffected by whether the value conforms to the
- requirements or not. It might be (as in the previous example) that the consumers are required to
- parse the value using specific rules that define how invalid (non-numeric in this case) values
- are to be processed.</p>
- </div>
-
- <h4 id=typographic-conventions>1.9.2 Typographic conventions</h4>
- <p>This is a definition, requirement, or explanation.</p>
- <p class=note>This is a note.</p>
- <p class=example>This is an example.</p>
- <p class=XXX>This is an open issue.</p>
- <p class=warning>This is a warning.</p>
- <pre class="idl extract">interface <dfn>Example</dfn> {
- // this is an IDL definition
- };</pre>
- <dl class=domintro><dt><var>variable</var> = <var>object</var> . <code id=typographic-conventions:x-that><a href=#x-that>method</a></code>( [ <var>optionalArgument</var> ] )<dd>
- <p>This is a note to authors describing the usage of an interface.</p>
- </dl>
- <pre class=css>/* this is a CSS fragment */</pre>
- <p>The defining instance of a term is marked up like <dfn id=x-this>this</dfn>. Uses of that
- term are marked up like <a href=#x-this id=typographic-conventions:x-this>this</a> or like <i id=typographic-conventions:x-this-2><a href=#x-this>this</a></i>.</p>
- <p>The defining instance of an element, attribute, or API is marked up like <dfn id=x-that><code>this</code></dfn>. References to that element, attribute, or API are marked up
- like <code id=typographic-conventions:x-that-2><a href=#x-that>this</a></code>.</p>
- <p>Other code fragments are marked up <code>like this</code>.</p>
- <p>Variables are marked up like <var>this</var>.</p>
- <p>In an algorithm, steps in <a href=#synchronous-section id=typographic-conventions:synchronous-section>synchronous
- sections</a> are marked with ⌛.</p>
- <p>In some cases, requirements are given in the form of lists with conditions and corresponding
- requirements. In such cases, the requirements that apply to a condition are always the first set
- of requirements that follow the condition, even in the case of there being multiple sets of
- conditions for those requirements. Such cases are presented as follows:</p>
- <dl class=switch><dt>This is a condition
- <dt>This is another condition
- <dd>This is the requirement that applies to the conditions above.
- <dt>This is a third condition
- <dd>This is the requirement that applies to the third condition.
- </dl>
- <h3 id=fingerprint>1.10 Privacy concerns</h3>
- <p><i>This section is non-normative.</i></p>
- <p>Some features of HTML trade user convenience for a measure of user privacy.</p>
- <p>In general, due to the Internet's architecture, a user can be distinguished from another by the
- user's IP address. IP addresses do not perfectly match to a user; as a user moves from device to
- device, or from network to network, their IP address will change; similarly, NAT routing, proxy
- servers, and shared computers enable packets that appear to all come from a single IP address to
- actually map to multiple users. Technologies such as onion routing can be used to further
- anonymise requests so that requests from a single user at one node on the Internet appear to come
- from many disparate parts of the network.</p>
- <p>However, the IP address used for a user's requests is not the only mechanism by which a user's
- requests could be related to each other. Cookies, for example, are designed specifically to enable
- this, and are the basis of most of the Web's session features that enable you to log into a site
- with which you have an account.</p>
- <p>There are other mechanisms that are more subtle. Certain characteristics of a user's system can
- be used to distinguish groups of users from each other; by collecting enough such information, an
- individual user's browser's "digital fingerprint" can be computed, which can be as good, if not
- better, as an IP address in ascertaining which requests are from the same user.</p>
- <p>Grouping requests in this manner, especially across multiple sites, can be used for both benign
- (and even arguably positive) purposes, as well as for malevolent purposes. An example of a
- reasonably benign purpose would be determining whether a particular person seems to prefer sites
- with dog illustrations as opposed to sites with cat illustrations (based on how often they visit
- the sites in question) and then automatically using the preferred illustrations on subsequent
- visits to participating sites. Malevolent purposes, however, could include governments combining
- information such as the person's home address (determined from the addresses they use when getting
- driving directions on one site) with their apparent political affiliations (determined by
- examining the forum sites that they participate in) to determine whether the person should be
- prevented from voting in an election.</p>
- <p>Since the malevolent purposes can be remarkably evil, user agent implementors are encouraged to
- consider how to provide their users with tools to minimise leaking information that could be used
- to fingerprint a user.</p>
- <p>Unfortunately, as the first paragraph in this section implies, sometimes there is great benefit
- to be derived from exposing the very information that can also be used for fingerprinting
- purposes, so it's not as easy as simply blocking all possible leaks. For instance, the ability to
- log into a site to post under a specific identity requires that the user's requests be
- identifiable as all being from the same user, more or less by definition. More subtly, though,
- information such as how wide text is, which is necessary for many effects that involve drawing
- text onto a canvas (e.g. any effect that involves drawing a border around the text) also leaks
- information that can be used to group a user's requests. (In this case, by potentially exposing,
- via a brute force search, which fonts a user has installed, information which can vary
- considerably from user to user.)</p>
- <p>Features in this specification which can be <dfn id=fingerprinting-vector>used to
- fingerprint the user</dfn> are marked as this paragraph is.
- <a href=#fingerprinting-vector id=fingerprint:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>Other features in the platform can be used for the same purpose, though, including, though not
- limited to:</p>
- <ul><li>The exact list of which features a user agents supports.<li>The maximum allowed stack depth for recursion in script.<li>Features that describe the user's environment, like Media Queries and the <code id=fingerprint:screen><a href=#screen>Screen</a></code>
- object. <a href=#refsMQ>[MQ]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a><li>The user's time zone.</ul>
- <h4 id=fingerprint-postMessage>1.10.1 Cross-site communication</h4>
- <p>The <code id=fingerprint-postMessage:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> API provides a mechanism by
- which two sites can communicate directly. At first glance, this might appear to open a new way by
- which the problems described above can occur. However, in practice, multiple mechanisms exist by
- which two sites can communicate that predate this API: a site embedding another can send data via
- an <code id=fingerprint-postMessage:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element's dimensions; a site can use a cross-site image request with a
- unique identifier known to the server to initiate a server-side data exchange; or indeed the
- fingerprinting techniques described above can be used by two sites to uniquely identify a visitor
- such that information can then be exchanged on the server side.</p>
- <p>Fundamentally, users that do not trust a site to treat their information with respect have to
- avoid visiting that site at all.</p>
-
- <h3 id=a-quick-introduction-to-html>1.11 A quick introduction to HTML</h3>
- <p><i>This section is non-normative.</i></p>
- <p>A basic HTML document looks like this:</p>
- <pre id=intro-early-example><!DOCTYPE html>
- <html>
- <head>
- <title>Sample page</title>
- </head>
- <body>
- <h1>Sample page</h1>
- <p>This is a <a href="demo.html">simple</a> sample.</p>
- <!-- this is a comment -->
- </body>
- </html></pre>
- <p>HTML documents consist of a tree of elements and text. Each element is denoted in the source by
- a <a href=#syntax-start-tag id=a-quick-introduction-to-html:syntax-start-tag>start tag</a>, such as "<code><body></code>", and
- an <a href=#syntax-end-tag id=a-quick-introduction-to-html:syntax-end-tag>end tag</a>, such as "<code></body></code>".
- (Certain start tags and end tags can in certain cases be <a href=#syntax-tag-omission id=a-quick-introduction-to-html:syntax-tag-omission>omitted</a> and are implied by other tags.)</p>
- <p>Tags have to be nested such that elements are all completely within each other, without
- overlapping:</p>
- <pre class=bad><p>This is <em>very <strong>wrong</em>!</strong></p></pre>
- <pre><p>This <em>is <strong>correct</strong>.</em></p></pre>
- <p>This specification defines a set of elements that can be used in HTML, along with rules about
- the ways in which the elements can be nested.</p>
- <p>Elements can have attributes, which control how the elements work. In the example below, there
- is a <a href=#hyperlink id=a-quick-introduction-to-html:hyperlink>hyperlink</a>, formed using the <code id=a-quick-introduction-to-html:the-a-element><a href=#the-a-element>a</a></code> element and its <code id=a-quick-introduction-to-html:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute:</p>
- <pre><a href="demo.html">simple</a></pre>
- <p><a href=#syntax-attributes id=a-quick-introduction-to-html:syntax-attributes>Attributes</a> are placed inside the start tag, and consist
- of a <a href=#syntax-attribute-name id=a-quick-introduction-to-html:syntax-attribute-name>name</a> and a <a href=#syntax-attribute-value id=a-quick-introduction-to-html:syntax-attribute-value>value</a>, separated by an "<code>=</code>" character.
- The attribute value can remain <a href=#unquoted>unquoted</a> if it doesn't contain <a href=#space-character id=a-quick-introduction-to-html:space-character>space characters</a> or any of <code>"</code> <code>'</code> <code>`</code> <code>=</code> <code><</code> or
- <code>></code>. Otherwise, it has to be quoted using either single or double quotes.
- The value, along with the "<code>=</code>" character, can be omitted altogether if the
- value is the empty string.</p>
- <pre><!-- empty attributes -->
- <input name=address disabled>
- <input name=address disabled="">
- <!-- attributes with a value -->
- <input name=address maxlength=200>
- <input name=address maxlength='200'>
- <input name=address maxlength="200"></pre>
- <p>HTML user agents (e.g. Web browsers) then <i>parse</i> this markup, turning it into a DOM
- (Document Object Model) tree. A DOM tree is an in-memory representation of a document.</p>
- <p>DOM trees contain several kinds of nodes, in particular a <code id=a-quick-introduction-to-html:documenttype><a href=#documenttype>DocumentType</a></code> node,
- <code id=a-quick-introduction-to-html:element><a href=#element>Element</a></code> nodes, <code id=a-quick-introduction-to-html:text><a href=#text>Text</a></code> nodes, <code id=a-quick-introduction-to-html:comment-2><a href=#comment-2>Comment</a></code> nodes, and in some cases
- <code id=a-quick-introduction-to-html:processinginstruction><a href=#processinginstruction>ProcessingInstruction</a></code> nodes.</p>
- <p>The <a href=#intro-early-example>markup snippet at the top of this section</a> would be
- turned into the following DOM tree:</p>
- <ul class=domTree><li class=t10>DOCTYPE: <code>html</code><li class=t1><code id=a-quick-introduction-to-html:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=a-quick-introduction-to-html:the-head-element><a href=#the-head-element>head</a></code><ul><li class=t3><code id=a-quick-introduction-to-html:text-2><a href=#text>#text</a></code>: <span>⏎␣␣</span><li class=t1><code id=a-quick-introduction-to-html:the-title-element><a href=#the-title-element>title</a></code><ul><li class=t3><code id=a-quick-introduction-to-html:text-3><a href=#text>#text</a></code>: <span>Sample page</span></ul><li class=t3><code id=a-quick-introduction-to-html:text-4><a href=#text>#text</a></code>: <span>⏎␣</span></ul><li class=t3><code id=a-quick-introduction-to-html:text-5><a href=#text>#text</a></code>: <span>⏎␣</span><li class=t1><code id=a-quick-introduction-to-html:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t3><code id=a-quick-introduction-to-html:text-6><a href=#text>#text</a></code>: <span>⏎␣␣</span><li class=t1><code id=a-quick-introduction-to-html:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><ul><li class=t3><code id=a-quick-introduction-to-html:text-7><a href=#text>#text</a></code>: <span>Sample page</span></ul><li class=t3><code id=a-quick-introduction-to-html:text-8><a href=#text>#text</a></code>: <span>⏎␣␣</span><li class=t1><code id=a-quick-introduction-to-html:the-p-element><a href=#the-p-element>p</a></code><ul><li class=t3><code id=a-quick-introduction-to-html:text-9><a href=#text>#text</a></code>: <span>This is a </span><li class=t1><code id=a-quick-introduction-to-html:the-a-element-2><a href=#the-a-element>a</a></code> <span class=t2><code id=a-quick-introduction-to-html:attr-hyperlink-href-2 class="attribute name"><a href=#attr-hyperlink-href>href</a></code>="<code class="attribute value">demo.html</code>"</span><ul><li class=t3><code id=a-quick-introduction-to-html:text-10><a href=#text>#text</a></code>: <span>simple</span></ul><li class=t3><code id=a-quick-introduction-to-html:text-11><a href=#text>#text</a></code>: <span> sample.</span></ul><li class=t3><code id=a-quick-introduction-to-html:text-12><a href=#text>#text</a></code>: <span>⏎␣␣</span><li class=t8><code id=a-quick-introduction-to-html:comment-2-2><a href=#comment-2>#comment</a></code>: <span> this is a comment </span><li class=t3><code id=a-quick-introduction-to-html:text-13><a href=#text>#text</a></code>: <span>⏎␣⏎</span></ul></ul></ul>
- <p>The <a href=#root-element id=a-quick-introduction-to-html:root-element>root element</a> of this tree is the <code id=a-quick-introduction-to-html:the-html-element-2><a href=#the-html-element>html</a></code> element, which is the
- element always found at the root of HTML documents. It contains two elements, <code id=a-quick-introduction-to-html:the-head-element-2><a href=#the-head-element>head</a></code>
- and <code id=a-quick-introduction-to-html:the-body-element-2><a href=#the-body-element>body</a></code>, as well as a <code id=a-quick-introduction-to-html:text-14><a href=#text>Text</a></code> node between them.</p>
- <p>There are many more <code id=a-quick-introduction-to-html:text-15><a href=#text>Text</a></code> nodes in the DOM tree than one would initially expect,
- because the source contains a number of spaces (represented here by "␣") and line breaks
- ("⏎") that all end up as <code id=a-quick-introduction-to-html:text-16><a href=#text>Text</a></code> nodes in the DOM. However, for historical
- reasons not all of the spaces and line breaks in the original markup appear in the DOM. In
- particular, all the whitespace before <code id=a-quick-introduction-to-html:the-head-element-3><a href=#the-head-element>head</a></code> start tag ends up being dropped silently,
- and all the whitespace after the <code id=a-quick-introduction-to-html:the-body-element-3><a href=#the-body-element>body</a></code> end tag ends up placed at the end of the
- <code id=a-quick-introduction-to-html:the-body-element-4><a href=#the-body-element>body</a></code>.</p>
- <p>The <code id=a-quick-introduction-to-html:the-head-element-4><a href=#the-head-element>head</a></code> element contains a <code id=a-quick-introduction-to-html:the-title-element-2><a href=#the-title-element>title</a></code> element, which itself contains a
- <code id=a-quick-introduction-to-html:text-17><a href=#text>Text</a></code> node with the text "Sample page". Similarly, the <code id=a-quick-introduction-to-html:the-body-element-5><a href=#the-body-element>body</a></code> element
- contains an <code id=a-quick-introduction-to-html:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, a <code id=a-quick-introduction-to-html:the-p-element-2><a href=#the-p-element>p</a></code> element, and a comment.</p>
- <hr>
- <p>This DOM tree can be manipulated from scripts in the page. Scripts (typically in JavaScript)
- are small programs that can be embedded using the <code id=a-quick-introduction-to-html:the-script-element><a href=#the-script-element>script</a></code> element or using <a href=#event-handler-content-attributes id=a-quick-introduction-to-html:event-handler-content-attributes>event
- handler content attributes</a>. For example, here is a form with a script that sets the value
- of the form's <code id=a-quick-introduction-to-html:the-output-element><a href=#the-output-element>output</a></code> element to say "Hello World":</p>
- <pre><<a href=#the-form-element id=a-quick-introduction-to-html:the-form-element>form</a> <a href=#attr-form-name id=a-quick-introduction-to-html:attr-form-name>name</a>="main">
- Result: <<a href=#the-output-element id=a-quick-introduction-to-html:the-output-element-2>output</a> <a href=#attr-fe-name id=a-quick-introduction-to-html:attr-fe-name>name</a>="result"></output>
- <<a href=#the-script-element id=a-quick-introduction-to-html:the-script-element-2>script</a>>
- <a href=#document id=a-quick-introduction-to-html:document>document</a>.<a href=#dom-document-forms id=a-quick-introduction-to-html:dom-document-forms>forms</a>.main.<a href=#dom-form-elements id=a-quick-introduction-to-html:dom-form-elements>elements</a>.result.<a href=#dom-output-value id=a-quick-introduction-to-html:dom-output-value>value</a> = 'Hello World';
- </script>
- </form></pre>
- <p>Each element in the DOM tree is represented by an object, and these objects have APIs so that
- they can be manipulated. For instance, a link (e.g. the <code id=a-quick-introduction-to-html:the-a-element-3><a href=#the-a-element>a</a></code> element in the tree above)
- can have its "<code id=a-quick-introduction-to-html:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code>" attribute changed in several
- ways:</p>
- <pre>var a = <a href=#document id=a-quick-introduction-to-html:document-2>document</a>.<a href=#dom-document-links id=a-quick-introduction-to-html:dom-document-links>links</a>[0]; // obtain the first link in the document
- a.<a href=#dom-url-href id=a-quick-introduction-to-html:dom-url-href>href</a> = 'sample.html'; // change the destination URL of the link
- a.<a href=#dom-url-protocol id=a-quick-introduction-to-html:dom-url-protocol>protocol</a> = 'https'; // change just the scheme part of the URL
- a.setAttribute('href', 'http://example.com/'); // change the content attribute directly</pre>
- <p>Since DOM trees are used as the way to represent HTML documents when they are processed and
- presented by implementations (especially interactive implementations like Web browsers), this
- specification is mostly phrased in terms of DOM trees, instead of the markup described above.</p>
- <hr>
- <p>HTML documents represent a media-independent description of interactive content. HTML documents
- might be rendered to a screen, or through a speech synthesiser, or on a braille display. To
- influence exactly how such rendering takes place, authors can use a styling language such as
- CSS.</p>
- <p>In the following example, the page has been made yellow-on-blue using CSS.</p>
- <pre><!DOCTYPE html>
- <html>
- <head>
- <title>Sample styled page</title>
- <style>
- body { background: navy; color: yellow; }
- </style>
- </head>
- <body>
- <h1>Sample styled page</h1>
- <p>This page is just a demo.</p>
- </body>
- </html></pre>
- <p>For more details on how to use HTML, authors are encouraged to consult tutorials and guides.
- Some of the examples included in this specification might also be of use, but the novice author is
- cautioned that this specification, by necessity, defines the language with a level of detail that
- might be difficult to understand at first.</p>
- <h4 id=writing-secure-applications-with-html>1.11.1 Writing secure applications with HTML</h4>
- <p><i>This section is non-normative.</i></p>
- <p>When HTML is used to create interactive sites, care needs to be taken to avoid introducing
- vulnerabilities through which attackers can compromise the integrity of the site itself or of the
- site's users.</p>
- <p>A comprehensive study of this matter is beyond the scope of this document, and authors are
- strongly encouraged to study the matter in more detail. However, this section attempts to provide
- a quick introduction to some common pitfalls in HTML application development.</p>
- <p>The security model of the Web is based on the concept of "origins", and correspondingly many of
- the potential attacks on the Web involve cross-origin actions. <a href=#refsORIGIN>[ORIGIN]</a></p>
- <dl><dt>Not validating user input<dt>Cross-site scripting (XSS)<dt>SQL injection<dd>
- <p>When accepting untrusted input, e.g. user-generated content such as text comments, values in
- URL parameters, messages from third-party sites, etc, it is imperative that the data be
- validated before use, and properly escaped when displayed. Failing to do this can allow a
- hostile user to perform a variety of attacks, ranging from the potentially benign, such as
- providing bogus user information like a negative age, to the serious, such as running scripts
- every time a user looks at a page that includes the information, potentially propagating the
- attack in the process, to the catastrophic, such as deleting all data in the server.</p>
- <p>When writing filters to validate user input, it is imperative that filters always be
- whitelist-based, allowing known-safe constructs and disallowing all other input. Blacklist-based
- filters that disallow known-bad inputs and allow everything else are not secure, as not
- everything that is bad is yet known (for example, because it might be invented in the
- future).</p>
- <div class=example>
- <p>For example, suppose a page looked at its URL's query string to determine what to display,
- and the site then redirected the user to that page to display a message, as in:</p>
- <pre><ul>
- <li><a href="message.cgi?say=Hello">Say Hello</a>
- <li><a href="message.cgi?say=Welcome">Say Welcome</a>
- <li><a href="message.cgi?say=Kittens">Say Kittens</a>
- </ul></pre>
- <p>If the message was just displayed to the user without escaping, a hostile attacker could
- then craft a URL that contained a script element:</p>
- <pre>http://example.com/message.cgi?say=%3Cscript%3Ealert%28%27Oh%20no%21%27%29%3C/script%3E</pre>
- <p>If the attacker then convinced a victim user to visit this page, a script of the attacker's
- choosing would run on the page. Such a script could do any number of hostile actions, limited
- only by what the site offers: if the site is an e-commerce shop, for instance, such a script
- could cause the user to unknowingly make arbitrarily many unwanted purchases.</p>
- <p>This is called a cross-site scripting attack.</p>
- </div>
- <p>There are many constructs that can be used to try to trick a site into executing code. Here
- are some that authors are encouraged to consider when writing whitelist filters:</p>
- <ul><li>When allowing harmless-seeming elements like <code id=writing-secure-applications-with-html:the-img-element><a href=#the-img-element>img</a></code>, it is important to whitelist
- any provided attributes as well. If one allowed all attributes then an attacker could, for
- instance, use the <code id=writing-secure-applications-with-html:handler-onload><a href=#handler-onload>onload</a></code> attribute to run arbitrary
- script.<li>When allowing URLs to be provided (e.g. for links), the scheme of each URL also needs to be
- explicitly whitelisted, as there are many schemes that can be abused. The most prominent
- example is "<code id=writing-secure-applications-with-html:javascript-protocol><a href=#javascript-protocol>javascript:</a></code>", but user agents can
- implement (and indeed, have historically implemented) others.<li>Allowing a <code id=writing-secure-applications-with-html:the-base-element><a href=#the-base-element>base</a></code> element to be inserted means any <code id=writing-secure-applications-with-html:the-script-element><a href=#the-script-element>script</a></code> elements
- in the page with relative links can be hijacked, and similarly that any form submissions can
- get redirected to a hostile site.</ul>
- <dt>Cross-site request forgery (CSRF)<dd>
- <p>If a site allows a user to make form submissions with user-specific side-effects, for example
- posting messages on a forum under the user's name, making purchases, or applying for a passport,
- it is important to verify that the request was made by the user intentionally, rather than by
- another site tricking the user into making the request unknowingly.</p>
- <p>This problem exists because HTML forms can be submitted to other origins.</p>
- <p>Sites can prevent such attacks by populating forms with user-specific hidden tokens, or by
- checking <code id=writing-secure-applications-with-html:http-origin><a href=#http-origin>Origin</a></code> headers on all requests.</p>
- <dt>Clickjacking<dd>
- <p>A page that provides users with an interface to perform actions that the user might not wish
- to perform needs to be designed so as to avoid the possibility that users can be tricked into
- activating the interface.</p>
- <p>One way that a user could be so tricked is if a hostile site places the victim site in a
- small <code id=writing-secure-applications-with-html:the-iframe-element><a href=#the-iframe-element>iframe</a></code> and then convinces the user to click, for instance by having the user
- play a reaction game. Once the user is playing the game, the hostile site can quickly position
- the iframe under the mouse cursor just as the user is about to click, thus tricking the user
- into clicking the victim site's interface.</p>
- <p>To avoid this, sites that do not expect to be used in frames are encouraged to only enable
- their interface if they detect that they are not in a frame (e.g. by comparing the <code id=writing-secure-applications-with-html:dom-window><a href=#dom-window>window</a></code> object to the value of the <code id=writing-secure-applications-with-html:dom-top><a href=#dom-top>top</a></code>
- attribute).</p>
- </dl>
- <h4 id=common-pitfalls-to-avoid-when-using-the-scripting-apis>1.11.2 Common pitfalls to avoid when using the scripting APIs</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Scripts in HTML have "run-to-completion" semantics, meaning that the browser will generally run
- the script uninterrupted before doing anything else, such as firing further events or continuing
- to parse the document.</p>
- <p>On the other hand, parsing of HTML files happens asynchronously and incrementally, meaning that
- the parser can pause at any point to let scripts run. This is generally a good thing, but it does
- mean that authors need to be careful to avoid hooking event handlers after the events could have
- possibly fired.</p>
- <p>There are two techniques for doing this reliably: use <a href=#event-handler-content-attributes id=common-pitfalls-to-avoid-when-using-the-scripting-apis:event-handler-content-attributes>event handler content
- attributes</a>, or create the element and add the event handlers in the same script. The latter
- is safe because, as mentioned earlier, scripts are run to completion before further events can
- fire.</p>
- <div class=example>
- <p>One way this could manifest itself is with <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:the-img-element><a href=#the-img-element>img</a></code> elements and the <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:event-load><a href=#event-load>load</a></code> event. The event could fire as soon as the element has been
- parsed, especially if the image has already been cached (which is common).</p>
- <p>Here, the author uses the <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:handler-onload><a href=#handler-onload>onload</a></code> handler on an
- <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:the-img-element-2><a href=#the-img-element>img</a></code> element to catch the <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:event-load-2><a href=#event-load>load</a></code> event:</p>
- <pre><img src="games.png" alt="Games" onload="gamesLogoHasLoaded(event)"></pre>
- <p>If the element is being added by script, then so long as the event handlers are added in the
- same script, the event will still not be missed:</p>
- <pre><script>
- var img = new Image();
- img.src = 'games.png';
- img.alt = 'Games';
- img.onload = gamesLogoHasLoaded;
- // img.addEventListener('load', gamesLogoHasLoaded, false); // would work also
- </script></pre>
- <p>However, if the author first created the <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:the-img-element-3><a href=#the-img-element>img</a></code> element and then in a separate
- script added the event listeners, there's a chance that the <code id=common-pitfalls-to-avoid-when-using-the-scripting-apis:event-load-3><a href=#event-load>load</a></code>
- event would be fired in between, leading it to be missed:</p>
- <pre class=bad><!-- Do not use this style, it has a race condition! -->
- <img id="games" src="games.png" alt="Games">
- <!-- the 'load' event might fire here while the parser is taking a
- break, in which case you will not see it! -->
- <script>
- var img = document.getElementById('games');
- img.onload = gamesLogoHasLoaded; // might never fire!
- </script></pre>
- </div>
- <h4 id=how-to-catch-mistakes-when-writing-html:-validators-and-conformance-checkers>1.11.3 How to catch mistakes when writing HTML: validators and conformance checkers</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Authors are encouraged to make use of conformance checkers (also known as <i>validators</i>) to
- catch common mistakes. The WHATWG maintains a list of such tools at: <a href=http://validator.whatwg.org/>http://validator.whatwg.org/</a></p>
- <h3 id=conformance-requirements-for-authors>1.12 Conformance requirements for authors</h3>
- <p><i>This section is non-normative.</i></p>
- <p>Unlike previous versions of the HTML specification, this specification defines in some detail
- the required processing for invalid documents as well as valid documents.</p>
- <p>However, even though the processing of invalid content is in most cases well-defined,
- conformance requirements for documents are still important: in practice, interoperability (the
- situation in which all implementations process particular content in a reliable and identical or
- equivalent way) is not the only goal of document conformance requirements. This section details
- some of the more common reasons for still distinguishing between a conforming document and one
- with errors.</p>
- <h4 id=presentational-markup>1.12.1 Presentational markup</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The majority of presentational features from previous versions of HTML are no longer allowed.
- Presentational markup in general has been found to have a number of problems:</p>
- <dl><dt>The use of presentational elements leads to poorer accessibility<dd>
- <p>While it is possible to use presentational markup in a way that provides users of assistive
- technologies (ATs) with an acceptable experience (e.g. using ARIA), doing so is significantly
- more difficult than doing so when using semantically-appropriate markup. Furthermore, even using
- such techniques doesn't help make pages accessible for non-AT non-graphical users, such as users
- of text-mode browsers.</p>
- <p>Using media-independent markup, on the other hand, provides an easy way for documents to be
- authored in such a way that they work for more users (e.g. text browsers).</p>
- <dt>Higher cost of maintenance<dd>
- <p>It is significantly easier to maintain a site written in such a way that the markup is
- style-independent. For example, changing the colour of a site that uses <code><font color=""></code> throughout requires changes across the entire site,
- whereas a similar change to a site based on CSS can be done by changing a single file.</p>
- <dt>Larger document sizes<dd>
- <p>Presentational markup tends to be much more redundant, and thus results in larger document
- sizes.</p>
- </dl>
- <p>For those reasons, presentational markup has been removed from HTML in this version. This
- change should not come as a surprise; HTML4 deprecated presentational markup many years ago and
- provided a mode (HTML4 Transitional) to help authors move away from presentational markup; later,
- XHTML 1.1 went further and obsoleted those features altogether.</p>
- <p>The only remaining presentational markup features in HTML are the <code id=presentational-markup:the-style-attribute><a href=#the-style-attribute>style</a></code> attribute and the <code id=presentational-markup:the-style-element><a href=#the-style-element>style</a></code> element. Use of the <code id=presentational-markup:the-style-attribute-2><a href=#the-style-attribute>style</a></code> attribute is somewhat discouraged in production environments, but
- it can be useful for rapid prototyping (where its rules can be directly moved into a separate
- style sheet later) and for providing specific styles in unusual cases where a separate style sheet
- would be inconvenient. Similarly, the <code id=presentational-markup:the-style-element-2><a href=#the-style-element>style</a></code> element can be useful in syndication or
- for page-specific styles, but in general an external style sheet is likely to be more convenient
- when the styles apply to multiple pages.</p>
- <p>It is also worth noting that some elements that were previously presentational have been
- redefined in this specification to be media-independent: <code id=presentational-markup:the-b-element><a href=#the-b-element>b</a></code>, <code id=presentational-markup:the-i-element><a href=#the-i-element>i</a></code>,
- <code id=presentational-markup:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=presentational-markup:the-s-element><a href=#the-s-element>s</a></code>, <code id=presentational-markup:the-small-element><a href=#the-small-element>small</a></code>, and <code id=presentational-markup:the-u-element><a href=#the-u-element>u</a></code>.</p>
- <h4 id=syntax-errors>1.12.2 Syntax errors</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The syntax of HTML is constrained to avoid a wide variety of problems.</p>
- <dl><dt>Unintuitive error-handling behavior<dd>
- <p>Certain invalid syntax constructs, when parsed, result in DOM trees that are highly
- unintuitive.</p>
- <div class=example>
- <p>For example, the following markup fragment results in a DOM with an <code id=syntax-errors:the-hr-element><a href=#the-hr-element>hr</a></code> element
- that is an <em>earlier</em> sibling of the corresponding <code id=syntax-errors:the-table-element><a href=#the-table-element>table</a></code> element:</p>
- <pre class=bad><table><hr>...</pre>
- </div>
- <dt>Errors with optional error recovery<dd>
- <p>To allow user agents to be used in controlled environments without having to implement the
- more bizarre and convoluted error handling rules, user agents are permitted to fail whenever
- encountering a <a href=#parse-error id=syntax-errors:parse-error>parse error</a>.</p>
- <dt>Errors where the error-handling behavior is not compatible with streaming user agents<dd>
- <p>Some error-handling behavior, such as the behavior for the <code><table><hr>...</code> example mentioned above, are incompatible with streaming
- user agents (user agents that process HTML files in one pass, without storing state). To avoid
- interoperability problems with such user agents, any syntax resulting in such behavior is
- considered invalid.</p>
- <dt>Errors that can result in infoset coercion<dd>
- <p>When a user agent based on XML is connected to an HTML parser, it is possible that certain
- invariants that XML enforces, such as comments never containing two consecutive hyphens, will be
- violated by an HTML file. Handling this can require that the parser coerce the HTML DOM into an
- XML-compatible infoset. Most syntax constructs that require such handling are considered
- invalid.</p>
- <dt>Errors that result in disproportionally poor performance<dd>
- <p>Certain syntax constructs can result in disproportionally poor performance. To discourage the
- use of such constructs, they are typically made non-conforming.</p>
- <div class=example>
- <p>For example, the following markup results in poor performance, since all the unclosed
- <code id=syntax-errors:the-i-element><a href=#the-i-element>i</a></code> elements have to be reconstructed in each paragraph, resulting in progressively
- more elements in each paragraph:</p>
- <pre class=bad><p><i>He dreamt.
- <p><i>He dreamt that he ate breakfast.
- <p><i>Then lunch.
- <p><i>And finally dinner.</pre>
- <p>The resulting DOM for this fragment would be:</p>
- <ul class=domTree><li class=t1><code id=syntax-errors:the-p-element><a href=#the-p-element>p</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-2><a href=#the-i-element>i</a></code><ul><li class=t3><code id=syntax-errors:text><a href=#text>#text</a></code>: <span>He dreamt.</span></ul></ul><li class=t1><code id=syntax-errors:the-p-element-2><a href=#the-p-element>p</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-3><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-4><a href=#the-i-element>i</a></code><ul><li class=t3><code id=syntax-errors:text-2><a href=#text>#text</a></code>: <span>He dreamt that he ate breakfast.</span></ul></ul></ul><li class=t1><code id=syntax-errors:the-p-element-3><a href=#the-p-element>p</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-5><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-6><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-7><a href=#the-i-element>i</a></code><ul><li class=t3><code id=syntax-errors:text-3><a href=#text>#text</a></code>: <span>Then lunch.</span></ul></ul></ul></ul><li class=t1><code id=syntax-errors:the-p-element-4><a href=#the-p-element>p</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-8><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-9><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-10><a href=#the-i-element>i</a></code><ul><li class=t1><code id=syntax-errors:the-i-element-11><a href=#the-i-element>i</a></code><ul><li class=t3><code id=syntax-errors:text-4><a href=#text>#text</a></code>: <span>And finally dinner.</span></ul></ul></ul></ul></ul></ul>
- </div>
- <dt>Errors involving fragile syntax constructs<dd>
- <p>There are syntax constructs that, for historical reasons, are relatively fragile. To help
- reduce the number of users who accidentally run into such problems, they are made
- non-conforming.</p>
- <div class=example>
- <p>For example, the parsing of certain named character references in attributes happens even
- with the closing semicolon being omitted. It is safe to include an ampersand followed by
- letters that do not form a named character reference, but if the letters are changed to a
- string that <em>does</em> form a named character reference, they will be interpreted as that
- character instead.</p>
- <p>In this fragment, the attribute's value is "<code>?bill&ted</code>":</p>
- <pre class=bad><a href="?bill&ted">Bill and Ted</a></pre>
- <p>In the following fragment, however, the attribute's value is actually "<code>?art©</code>", <em>not</em> the intended "<code>?art&copy</code>",
- because even without the final semicolon, "<code>&copy</code>" is handled the same
- as "<code>&copy;</code>" and thus gets interpreted as "<code>©</code>":</p>
- <pre class=bad><a href="?art&copy">Art and Copy</a></pre>
- <p>To avoid this problem, all named character references are required to end with a semicolon,
- and uses of named character references without a semicolon are flagged as errors.</p>
- <p>Thus, the correct way to express the above cases is as
- follows:</p>
- <pre><a href="?bill&ted">Bill and Ted</a> <!-- &ted is ok, since it's not a named character reference --></pre>
- <pre><a href="?art&amp;copy">Art and Copy</a> <!-- the & has to be escaped, since &copy <em>is</em> a named character reference --></pre>
- </div>
- <dt>Errors involving known interoperability problems in legacy user agents<dd>
- <p>Certain syntax constructs are known to cause especially subtle or serious problems in legacy
- user agents, and are therefore marked as non-conforming to help authors avoid them.</p>
- <div class=example>
- <p>For example, this is why the U+0060 GRAVE ACCENT character (`) is not allowed in unquoted
- attributes. In certain legacy user agents, it is sometimes treated as a
- quote character.</p>
- </div>
- <div class=example>
- <p>Another example of this is the DOCTYPE, which is required to trigger <a href=#no-quirks-mode id=syntax-errors:no-quirks-mode>no-quirks
- mode</a>, because the behavior of legacy user agents in <a href=#quirks-mode id=syntax-errors:quirks-mode>quirks mode</a> is often
- largely undocumented.</p>
- </div>
- <dt>Errors that risk exposing authors to security attacks<dd>
- <p>Certain restrictions exist purely to avoid known security problems.</p>
- <div class=example>
- <p>For example, the restriction on using UTF-7 exists purely to avoid authors falling prey to a
- known cross-site-scripting attack using UTF-7. <a href=#refsUTF7>[UTF7]</a></p>
- </div>
- <dt>Cases where the author's intent is unclear<dd>
- <p>Markup where the author's intent is very unclear is often made non-conforming. Correcting
- these errors early makes later maintenance easier.</p>
- <div class=example>
- <p>For example, it is unclear whether the author intended the following to be an
- <code id=syntax-errors:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> heading or an <code id=syntax-errors:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> heading:</p>
- <pre class=bad><h1>Contact details</h2></pre>
- </div>
- <dt>Cases that are likely to be typos<dd>
- <p>When a user makes a simple typo, it is helpful if the error can be caught early, as this can
- save the author a lot of debugging time. This specification therefore usually considers it an
- error to use element names, attribute names, and so forth, that do not match the names defined
- in this specification.</p>
- <div class=example>
- <p>For example, if the author typed <code><capton></code> instead of <code><caption></code>, this would be flagged as an error and the author could correct
- the typo immediately.</p>
- </div>
- <dt>Errors that could interfere with new syntax in the future<dd>
- <p>In order to allow the language syntax to be extended in the future, certain otherwise
- harmless features are disallowed.</p>
- <div class=example>
- <p>For example, "attributes" in end tags are ignored currently, but they are invalid, in case a
- future change to the language makes use of that syntax feature without conflicting with
- already-deployed (and valid!) content.</p>
- </div>
- </dl>
- <p>Some authors find it helpful to be in the practice of always quoting all attributes and always
- including all optional tags, preferring the consistency derived from such custom over the minor
- benefits of terseness afforded by making use of the flexibility of the HTML syntax. To aid such
- authors, conformance checkers can provide modes of operation wherein such conventions are
- enforced.</p>
- <h4 id=restrictions-on-content-models-and-on-attribute-values>1.12.3 Restrictions on content models and on attribute values</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Beyond the syntax of the language, this specification also places restrictions on how elements
- and attributes can be specified. These restrictions are present for similar reasons:</p>
- <dl><dt>Errors involving content with dubious semantics<dd>
- <p>To avoid misuse of elements with defined meanings, content models are defined that restrict
- how elements can be nested when such nestings would be of dubious value.</p>
- <p class=example>For example, this specification disallows nesting a <code id=restrictions-on-content-models-and-on-attribute-values:the-section-element><a href=#the-section-element>section</a></code>
- element inside a <code id=restrictions-on-content-models-and-on-attribute-values:the-kbd-element><a href=#the-kbd-element>kbd</a></code> element, since it is highly unlikely for an author to indicate
- that an entire section should be keyed in.</p>
- <dt>Errors that involve a conflict in expressed semantics<dd>
- <p>Similarly, to draw the author's attention to mistakes in the use of elements, clear
- contradictions in the semantics expressed are also considered conformance errors.</p>
- <div class=example>
- <p>In the fragments below, for example, the semantics are nonsensical: a separator cannot
- simultaneously be a cell, nor can a radio button be a progress bar.</p>
- <pre class=bad><hr role="cell"></pre>
- <pre class=bad><input type=radio role=progressbar></pre>
- </div>
- <p class=example>Another example is the restrictions on the content models of the
- <code id=restrictions-on-content-models-and-on-attribute-values:the-ul-element><a href=#the-ul-element>ul</a></code> element, which only allows <code id=restrictions-on-content-models-and-on-attribute-values:the-li-element><a href=#the-li-element>li</a></code> element children. Lists by definition
- consist just of zero or more list items, so if a <code id=restrictions-on-content-models-and-on-attribute-values:the-ul-element-2><a href=#the-ul-element>ul</a></code> element contains something
- other than an <code id=restrictions-on-content-models-and-on-attribute-values:the-li-element-2><a href=#the-li-element>li</a></code> element, it's not clear what was meant.</p>
- <dt>Cases where the default styles are likely to lead to confusion<dd>
- <p>Certain elements have default styles or behaviors that make certain combinations likely to
- lead to confusion. Where these have equivalent alternatives without this problem, the confusing
- combinations are disallowed.</p>
- <p class=example>For example, <code id=restrictions-on-content-models-and-on-attribute-values:the-div-element><a href=#the-div-element>div</a></code> elements are rendered as block boxes, and
- <code id=restrictions-on-content-models-and-on-attribute-values:the-span-element><a href=#the-span-element>span</a></code> elements as inline boxes. Putting a block box in an inline box is
- unnecessarily confusing; since either nesting just <code id=restrictions-on-content-models-and-on-attribute-values:the-div-element-2><a href=#the-div-element>div</a></code> elements, or nesting just
- <code id=restrictions-on-content-models-and-on-attribute-values:the-span-element-2><a href=#the-span-element>span</a></code> elements, or nesting <code id=restrictions-on-content-models-and-on-attribute-values:the-span-element-3><a href=#the-span-element>span</a></code> elements inside <code id=restrictions-on-content-models-and-on-attribute-values:the-div-element-3><a href=#the-div-element>div</a></code>
- elements all serve the same purpose as nesting a <code id=restrictions-on-content-models-and-on-attribute-values:the-div-element-4><a href=#the-div-element>div</a></code> element in a <code id=restrictions-on-content-models-and-on-attribute-values:the-span-element-4><a href=#the-span-element>span</a></code>
- element, but only the latter involves a block box in an inline box, the latter combination is
- disallowed.</p>
- <p class=example>Another example would be the way <a href=#interactive-content-2 id=restrictions-on-content-models-and-on-attribute-values:interactive-content-2>interactive content</a> cannot be
- nested. For example, a <code id=restrictions-on-content-models-and-on-attribute-values:the-button-element><a href=#the-button-element>button</a></code> element cannot contain a <code id=restrictions-on-content-models-and-on-attribute-values:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
- element. This is because the default behavior of such nesting interactive elements would be
- highly confusing to users. Instead of nesting these elements, they can be placed side by
- side.</p>
- <dt>Errors that indicate a likely misunderstanding of the specification<dd>
- <p>Sometimes, something is disallowed because allowing it would likely cause author
- confusion.</p>
- <p class=example>For example, setting the <code id=restrictions-on-content-models-and-on-attribute-values:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>
- attribute to the value "<code>false</code>" is disallowed, because despite the
- appearance of meaning that the element is enabled, it in fact means that the element is
- <em>disabled</em> (what matters for implementations is the presence of the attribute, not its
- value).</p>
- <dt>Errors involving limits that have been imposed merely to simplify the language<dd>
- <p>Some conformance errors simplify the language that authors need to learn.</p>
- <p class=example>For example, the <code id=restrictions-on-content-models-and-on-attribute-values:the-area-element><a href=#the-area-element>area</a></code> element's <code id=restrictions-on-content-models-and-on-attribute-values:attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute, despite accepting both <code id=restrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circ><a href=#attr-area-shape-keyword-circ>circ</a></code> and <code id=restrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code> values in practice as synonyms, disallows
- the use of the <code id=restrictions-on-content-models-and-on-attribute-values:attr-area-shape-keyword-circ-2><a href=#attr-area-shape-keyword-circ>circ</a></code> value, so as to simplify
- tutorials and other learning aids. There would be no benefit to allowing both, but it would
- cause extra confusion when teaching the language.</p>
- <dt>Errors that involve peculiarities of the parser<dd>
- <p>Certain elements are parsed in somewhat eccentric ways (typically for historical reasons),
- and their content model restrictions are intended to avoid exposing the author to these
- issues.</p>
- <div class=example>
- <p>For example, a <code id=restrictions-on-content-models-and-on-attribute-values:the-form-element><a href=#the-form-element>form</a></code> element isn't allowed inside <a href=#phrasing-content-2 id=restrictions-on-content-models-and-on-attribute-values:phrasing-content-2>phrasing content</a>,
- because when parsed as HTML, a <code id=restrictions-on-content-models-and-on-attribute-values:the-form-element-2><a href=#the-form-element>form</a></code> element's start tag will imply a
- <code id=restrictions-on-content-models-and-on-attribute-values:the-p-element><a href=#the-p-element>p</a></code> element's end tag. Thus, the following markup results in two <a href=#paragraph id=restrictions-on-content-models-and-on-attribute-values:paragraph>paragraphs</a>, not one:</p>
- <pre><p>Welcome. <form><label>Name:</label> <input></form></pre>
- <p>It is parsed exactly like the following:</p>
- <pre><p>Welcome. </p><form><label>Name:</label> <input></form></pre>
- </div>
- <dt>Errors that would likely result in scripts failing in hard-to-debug ways<dd>
- <p>Some errors are intended to help prevent script problems that would be hard to debug.</p>
- <p class=example>This is why, for instance, it is non-conforming to have two <code id=restrictions-on-content-models-and-on-attribute-values:the-id-attribute><a href=#the-id-attribute>id</a></code> attributes with the same value. Duplicate IDs lead to the wrong
- element being selected, with sometimes disastrous effects whose cause is hard to determine.</p>
- <dt>Errors that waste authoring time<dd>
- <p>Some constructs are disallowed because historically they have been the cause of a lot of
- wasted authoring time, and by encouraging authors to avoid making them, authors can save time in
- future efforts.</p>
- <p class=example>For example, a <code id=restrictions-on-content-models-and-on-attribute-values:the-script-element><a href=#the-script-element>script</a></code> element's <code id=restrictions-on-content-models-and-on-attribute-values:attr-script-src><a href=#attr-script-src>src</a></code> attribute causes the element's contents to be ignored.
- However, this isn't obvious, especially if the element's contents appear to be executable script
- — which can lead to authors spending a lot of time trying to debug the inline script
- without realizing that it is not executing. To reduce this problem, this specification makes it
- non-conforming to have executable script in a <code id=restrictions-on-content-models-and-on-attribute-values:the-script-element-2><a href=#the-script-element>script</a></code> element when the <code id=restrictions-on-content-models-and-on-attribute-values:attr-script-src-2><a href=#attr-script-src>src</a></code> attribute is present. This means that authors who are
- validating their documents are less likely to waste time with this kind of mistake.</p>
- <dt>Errors that involve areas that affect authors migrating to and from XHTML<dd>
- <p>Some authors like to write files that can be interpreted as both XML and HTML with similar
- results. Though this practice is discouraged in general due to the myriad of subtle
- complications involved (especially when involving scripting, styling, or any kind of automated
- serialisation), this specification has a few restrictions intended to at least somewhat mitigate
- the difficulties. This makes it easier for authors to use this as a transitionary step when
- migrating between HTML and XHTML.</p>
- <p class=example>For example, there are somewhat complicated rules surrounding the <code id=restrictions-on-content-models-and-on-attribute-values:attr-lang><a href=#attr-lang>lang</a></code> and <code id=restrictions-on-content-models-and-on-attribute-values:attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes
- intended to keep the two synchronized.</p>
- <p class=example>Another example would be the restrictions on the values of <code>xmlns</code> attributes in the HTML serialisation, which are intended to ensure that
- elements in conforming documents end up in the same namespaces whether processed as HTML or
- XML.</p>
- <dt>Errors that involve areas reserved for future expansion<dd>
- <p>As with the restrictions on the syntax intended to allow for new syntax in future revisions
- of the language, some restrictions on the content models of elements and values of attributes
- are intended to allow for future expansion of the HTML vocabulary.</p>
- <p class=example>For example, limiting the values of the <code id=restrictions-on-content-models-and-on-attribute-values:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute that start with an U+005F LOW LINE
- character (_) to only specific predefined values allows new predefined values to be introduced
- at a future time without conflicting with author-defined values.</p>
- <dt>Errors that indicate a mis-use of other specifications<dd>
- <p>Certain restrictions are intended to support the restrictions made by other
- specifications.</p>
- <p class=example>For example, requiring that attributes that take media query lists use only
- <em>valid</em> media query lists reinforces the importance of following the conformance rules of
- that specification.</p>
- </dl>
- <h3 id=suggested-reading>1.13 Suggested reading</h3>
- <p><i>This section is non-normative.</i></p>
- <p>The following documents might be of interest to readers of this specification.</p>
- <dl><dt><cite>Character Model for the World Wide Web 1.0: Fundamentals</cite> <a href=#refsCHARMOD>[CHARMOD]</a><dd><blockquote><p>This Architectural Specification provides authors of specifications, software
- developers, and content developers with a common reference for interoperable text manipulation on
- the World Wide Web, building on the Universal Character Set, defined jointly by the Unicode
- Standard and ISO/IEC 10646. Topics addressed include use of the terms 'character', 'encoding' and
- 'string', a reference processing model, choice and identification of character encodings,
- character escaping, and string indexing.</blockquote><dt><cite>Unicode Security Considerations</cite> <a href=#refsUTR36>[UTR36]</a><dd><blockquote><p>Because Unicode contains such a large number of characters and incorporates
- the varied writing systems of the world, incorrect usage can expose programs or systems to
- possible security attacks. This is especially important as more and more products are
- internationalized. This document describes some of the security considerations that programmers,
- system analysts, standards developers, and users should take into account, and provides specific
- recommendations to reduce the risk of problems.</blockquote><dt><cite>Web Content Accessibility Guidelines (WCAG) 2.0</cite> <a href=#refsWCAG>[WCAG]</a><dd><blockquote><p>Web Content Accessibility Guidelines (WCAG) 2.0 covers a wide range of
- recommendations for making Web content more accessible. Following these guidelines will make
- content accessible to a wider range of people with disabilities, including blindness and low
- vision, deafness and hearing loss, learning disabilities, cognitive limitations, limited
- movement, speech disabilities, photosensitivity and combinations of these. Following these
- guidelines will also often make your Web content more usable to users in
- general.</blockquote><dt><cite>Authoring Tool Accessibility Guidelines (ATAG) 2.0</cite> <a href=#refsATAG>[ATAG]</a><dd><blockquote><p>This specification provides guidelines for designing Web content
- authoring tools that are more accessible for people with disabilities. An authoring tool that
- conforms to these guidelines will promote accessibility by providing an accessible user interface
- to authors with disabilities as well as by enabling, supporting, and promoting the production of
- accessible Web content by all authors.</blockquote><dt><cite>User Agent Accessibility Guidelines (UAAG) 2.0</cite> <a href=#refsUAAG>[UAAG]</a><dd><blockquote><p>This document provides guidelines for designing user agents that
- lower barriers to Web accessibility for people with disabilities. User agents include browsers
- and other types of software that retrieve and render Web content. A user agent that conforms to
- these guidelines will promote accessibility through its own user interface and through other
- internal facilities, including its ability to communicate with other technologies (especially
- assistive technologies). Furthermore, all users, not just users with disabilities, should find
- conforming user agents to be more usable.</blockquote></dl>
- <h2 id=infrastructure>2 Common infrastructure</h2>
- <h3 id=terminology>2.1 Terminology</h3>
- <p>This specification refers to both HTML and XML attributes and IDL attributes, often in the same
- context. When it is not clear which is being referred to, they are referred to as <dfn>content attributes</dfn> for HTML and XML attributes, and <dfn>IDL
- attributes</dfn> for those defined on IDL interfaces. Similarly, the term "properties" is used for
- both JavaScript object properties and CSS properties. When these are ambiguous they are qualified
- as <dfn>object properties</dfn> and <dfn>CSS properties</dfn> respectively.</p>
- <p>Generally, when the specification states that a feature applies to <a href=#syntax id=terminology:syntax>the HTML syntax</a>
- or <a href=#the-xhtml-syntax id=terminology:the-xhtml-syntax>the XHTML syntax</a>, it also includes the other. When a feature specifically only
- applies to one of the two languages, it is called out by explicitly stating that it does not apply
- to the other format, as in "for HTML, ... (this does not apply to XHTML)".</p>
- <p>This specification uses the term <dfn>document</dfn> to refer to any use of HTML,
- ranging from short static documents to long essays or reports with rich multimedia, as well as to
- fully-fledged interactive applications. The term is used to refer both to <code id=terminology:document><a href=#document>Document</a></code>
- objects and their descendant DOM trees, and to serialised byte streams using the <a href=#syntax id=terminology:syntax-2>HTML syntax</a> or <a href=#the-xhtml-syntax id=terminology:the-xhtml-syntax-2>XHTML syntax</a>, depending
- on context.</p>
- <p>In the context of the DOM structures, the terms <a href=#html-documents id=terminology:html-documents>HTML
- document</a> and <a href=#xml-documents id=terminology:xml-documents>XML document</a> are used as defined in the DOM
- specification, and refer specifically to two different modes that <code id=terminology:document-2><a href=#document>Document</a></code> objects
- can find themselves in. <a href=#refsDOM>[DOM]</a> (Such uses are always hyperlinked to their
- definition.)</p>
- <p>In the context of byte streams, the term HTML document refers to resources labeled as
- <code id=terminology:text/html><a href=#text/html>text/html</a></code>, and the term XML document refers to resources labeled with an <a href=#xml-mime-type id=terminology:xml-mime-type>XML
- MIME type</a>.</p>
- <p>The term <dfn id=xhtml-document>XHTML document</dfn> is used to refer to both <code id=terminology:document-3><a href=#document>Document</a></code>s in the <a href=#xml-documents id=terminology:xml-documents-2>XML document</a> mode that contains element nodes in the <a href=#html-namespace-2 id=terminology:html-namespace-2>HTML
- namespace</a>, and byte streams labeled with an <a href=#xml-mime-type id=terminology:xml-mime-type-2>XML MIME type</a> that contain
- elements from the <a href=#html-namespace-2 id=terminology:html-namespace-2-2>HTML namespace</a>, depending on context.</p>
- <hr>
- <p>For simplicity, terms such as <dfn>shown</dfn>, <dfn>displayed</dfn>, and
- <dfn>visible</dfn> might sometimes be used when referring to the way a document is
- rendered to the user. These terms are not meant to imply a visual medium; they must be considered
- to apply to other media in equivalent ways.</p>
-
- <p>When an algorithm B says to return to another algorithm A, it implies that A called B. Upon
- returning to A, the implementation must continue from where it left off in calling B.</p>
-
-
- <p>The term "transparent black" refers to the colour with red, green, blue, and alpha channels all
- set to zero.</p>
- <h4 id=resources>2.1.1 Resources</h4>
- <p>The specification uses the term <dfn>supported</dfn> when referring to whether a user
- agent has an implementation capable of decoding the semantics of an external resource. A format or
- type is said to be <i>supported</i> if the implementation can process an external resource of that
- format or type without critical aspects of the resource being ignored. Whether a specific resource
- is <i>supported</i> can depend on what features of the resource's format are in use.</p>
- <p class=example>For example, a PNG image would be considered to be in a supported format if its
- pixel data could be decoded and rendered, even if, unbeknownst to the implementation, the image
- also contained animation data.</p>
- <p class=example>An MPEG-4 video file would not be considered to be in a supported format if the
- compression format used was not supported, even if the implementation could determine the
- dimensions of the movie from the file's metadata.</p>
- <p>What some specifications, in particular the HTTP specification, refer to as a
- <i>representation</i> is referred to in this specification as a <dfn>resource</dfn>.
- <a href=#refsHTTP>[HTTP]</a></p>
- <p>The term <dfn id=mime-type>MIME type</dfn> is used to refer to what is sometimes called an <i>Internet media
- type</i> in protocol literature. The term <i>media type</i> in this specification is used to refer
- to the type of media intended for presentation, as used by the CSS specifications. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsMQ>[MQ]</a></p>
- <p>A string is a <dfn id=valid-mime-type>valid MIME type</dfn> if it matches the <code>media-type</code> rule defined in <a href=http://tools.ietf.org/html/rfc7231#section-3.1.1.1>section 3.1.1.1 "Media Type" of RFC
- 7231</a>. In particular, a <a href=#valid-mime-type id=resources:valid-mime-type>valid MIME type</a> may include MIME type parameters. <a href=#refsHTTP>[HTTP]</a></p>
- <p>A string is a <dfn id=valid-mime-type-with-no-parameters>valid MIME type with no parameters</dfn> if it matches the <code>media-type</code> rule defined in <a href=http://tools.ietf.org/html/rfc7231#section-3.1.1.1>section 3.1.1.1 "Media Type" of RFC
- 7231</a>, but does not contain any U+003B SEMICOLON characters (;). In other words, if it consists
- only of a type and subtype, with no MIME Type parameters. <a href=#refsHTTP>[HTTP]</a></p>
- <p>The term <dfn id=html-mime-type>HTML MIME type</dfn> is used to refer to the <a href=#mime-type id=resources:mime-type>MIME type</a>
- <code id=resources:text/html><a href=#text/html>text/html</a></code>.</p>
- <p>A resource's <dfn id=critical-subresources>critical subresources</dfn> are those that the resource needs to have
- available to be correctly processed. Which resources are considered critical or not is defined by
- the specification that defines the resource's format.</p>
- <h4 id=xml>2.1.2 XML</h4>
- <p id=html-namespace>To ease migration from HTML to XHTML, UAs conforming to this specification
- will place elements in HTML in the <code id=xml:html-namespace-2><a href=#html-namespace-2>http://www.w3.org/1999/xhtml</a></code> namespace, at least for the purposes of the DOM and
- CSS. The term "<dfn id=html-elements>HTML elements</dfn>", when used in this specification, refers to any element
- in that namespace, and thus refers to both HTML and XHTML elements.</p>
- <p>Except where otherwise stated, all elements defined or mentioned in this specification are in
- the <a href=#html-namespace-2 id=xml:html-namespace-2-2>HTML namespace</a> ("<code>http://www.w3.org/1999/xhtml</code>"), and all
- attributes defined or mentioned in this specification have no namespace.</p>
- <p>The term <dfn id=element-type>element type</dfn> is used to refer to the set of elements that have a given
- local name and namespace. For example, <code id=xml:the-button-element><a href=#the-button-element>button</a></code> elements are elements with the element
- type <code id=xml:the-button-element-2><a href=#the-button-element>button</a></code>, meaning they have the local name "<code>button</code>" and
- (implicitly as defined above) the <a href=#html-namespace-2 id=xml:html-namespace-2-3>HTML namespace</a>.</p>
- <p>Attribute names are said to be <dfn id=xml-compatible>XML-compatible</dfn> if they match the <a href=http://www.w3.org/TR/xml/#NT-Name><code>Name</code></a> production defined in XML
- and they contain no U+003A COLON characters (:). <a href=#refsXML>[XML]</a></p>
- <p>The term <dfn id=xml-mime-type>XML MIME type</dfn> is used to refer to the <a href=#mime-type id=xml:mime-type>MIME
- types</a> <code id=xml:text/xml><a href=#text/xml>text/xml</a></code>, <code id=xml:application/xml><a href=#application/xml>application/xml</a></code>, and any <a href=#mime-type id=xml:mime-type-2>MIME type</a>
- whose subtype ends with the four characters "<code>+xml</code>". <a href=#refsRFC3023>[RFC3023]</a></p>
- <h4 id=dom-trees>2.1.3 DOM trees</h4>
- <p>The <dfn id=root-element-of-a-document-object>root element of a <code>Document</code> object</dfn> is that <code id=dom-trees:document><a href=#document>Document</a></code>'s
- first element child, if any. If it does not have one then the <code id=dom-trees:document-2><a href=#document>Document</a></code> has no root
- element.</p>
- <p>The term <dfn id=root-element>root element</dfn>, when not referring to a <code id=dom-trees:document-3><a href=#document>Document</a></code> object's root
- element, means the furthest ancestor element node of whatever node is being discussed, or the node
- itself if it has no ancestors. When the node is a part of the document, then the node's <a href=#root-element id=dom-trees:root-element>root
- element</a> is indeed the document's root element; however, if the node is not currently part
- of the document tree, the root element will be an orphaned node.</p>
- <p>When an element's <a href=#root-element id=dom-trees:root-element-2>root element</a> is the <a href=#root-element-of-a-document-object id=dom-trees:root-element-of-a-document-object>root element of a
- <code>Document</code> object</a>, it is said to be <dfn id=in-a-document>in a <code>Document</code></dfn>. An
- element is said to have been <dfn id=insert-an-element-into-a-document>inserted into a
- document</dfn> when its <a href=#root-element id=dom-trees:root-element-3>root element</a> changes and is now the document's <a href=#root-element id=dom-trees:root-element-4>root
- element</a>. Analogously, an element is said to have been <dfn id=remove-an-element-from-a-document>removed from a document</dfn> when its <a href=#root-element id=dom-trees:root-element-5>root element</a> changes from being the
- document's <a href=#root-element id=dom-trees:root-element-6>root element</a> to being another element.</p>
- <p>A node's <dfn id=home-subtree>home subtree</dfn> is the subtree rooted at that node's <a href=#root-element id=dom-trees:root-element-7>root
- element</a>. When a node is <a href=#in-a-document id=dom-trees:in-a-document>in a <code>Document</code></a>, its <a href=#home-subtree id=dom-trees:home-subtree>home
- subtree</a> is that <code id=dom-trees:document-4><a href=#document>Document</a></code>'s tree.</p>
- <p>The term <dfn id=tree-order>tree order</dfn> means a pre-order, depth-first traversal of DOM nodes involved
- (through the <code id=dom-trees:dom-node-parentnode><a href=#dom-node-parentnode>parentNode</a></code>/<code id=dom-trees:dom-node-childnodes><a href=#dom-node-childnodes>childNodes</a></code> relationship).</p>
- <p>When it is stated that some element or attribute is <dfn id=ignore>ignored</dfn>, or
- treated as some other value, or handled as if it was something else, this refers only to the
- processing of the node after it is in the DOM. A user agent must not mutate the
- DOM in such situations.</p>
- <p>A content attribute is said to <dfn>change</dfn> value only if its new value is
- different than its previous value; setting an attribute to a value it already has does not change
- it.</p>
- <p>The term <dfn>empty</dfn>, when used of an attribute value, <code id=dom-trees:text><a href=#text>Text</a></code> node, or
- string, means that the length of the text is zero (i.e. not even containing spaces or <a href=#control-characters id=dom-trees:control-characters>control
- characters</a>).</p>
- <h4 id=scripting-2>2.1.4 Scripting</h4>
- <p>The construction "a <code>Foo</code> object", where <code>Foo</code> is
- actually an interface, is sometimes used instead of the more accurate "an object implementing the
- interface <code>Foo</code>".</p>
- <p>An IDL attribute is said to be <dfn>getting</dfn> when its value is being retrieved
- (e.g. by author script), and is said to be <dfn>setting</dfn> when a new value is
- assigned to it.</p>
- <p>If a DOM object is said to be <dfn id=live>live</dfn>, then the attributes and methods on that object
- must operate on the actual underlying data, not a snapshot of the
- data.</p>
- <p>In the contexts of events, the terms <i>fire</i> and <i>dispatch</i> are used as defined in the
- DOM specification: <dfn id=concept-event-fire>firing</dfn> an event means to create and <a href=#concept-event-dispatch id=scripting-2:concept-event-dispatch>dispatch</a> it, and <dfn id=concept-event-dispatch>dispatching</dfn> an event means to follow the steps that propagate
- the event through the tree. The term <dfn id=concept-events-trusted>trusted event</dfn> is
- used to refer to events whose <code id=scripting-2:dom-event-istrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute is
- initialised to true. <a href=#refsDOM>[DOM]</a></p>
- <h4 id=plugins>2.1.5 Plugins</h4>
- <p>The term <dfn id=plugin>plugin</dfn> refers to a user-agent defined set of content handlers used by the
- user agent that can take part in the user agent's rendering of a <code id=plugins:document><a href=#document>Document</a></code> object, but
- that neither act as <a href=#child-browsing-context id=plugins:child-browsing-context>child browsing contexts</a> of the
- <code id=plugins:document-2><a href=#document>Document</a></code> nor introduce any <code id=plugins:node><a href=#node>Node</a></code> objects to the <code id=plugins:document-3><a href=#document>Document</a></code>'s
- DOM.</p>
- <p>Typically such content handlers are provided by third parties, though a user agent can also
- designate built-in content handlers as plugins.</p>
-
- <p>A user agent must not consider the types <code id=plugins:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code> and
- <code id=plugins:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code> as having a registered <a href=#plugin id=plugins:plugin>plugin</a>.</p>
-
- <p class=example>One example of a plugin would be a PDF viewer that is instantiated in a
- <a href=#browsing-context id=plugins:browsing-context>browsing context</a> when the user navigates to a PDF file. This would count as a plugin
- regardless of whether the party that implemented the PDF viewer component was the same as that
- which implemented the user agent itself. However, a PDF viewer application that launches separate
- from the user agent (as opposed to using the same interface) is not a plugin by this
- definition.</p>
- <p class=note>This specification does not define a mechanism for interacting with plugins, as it
- is expected to be user-agent- and platform-specific. Some UAs might opt to support a plugin
- mechanism such as the Netscape Plugin API; others might use remote content converters or have
- built-in support for certain types. Indeed, this specification doesn't require user agents to
- support plugins at all. <a href=#refsNPAPI>[NPAPI]</a></p>
- <p>A plugin can be <dfn id=concept-plugin-secure>secured</dfn> if it honors the semantics of
- the <code id=plugins:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>
- <p class=example>For example, a secured plugin would prevent its contents from creating pop-up
- windows when the plugin is instantiated inside a sandboxed <code id=plugins:the-iframe-element><a href=#the-iframe-element>iframe</a></code>.</p>
-
- <p class=warning>Browsers should take extreme care when interacting with external content
- intended for <a href=#plugin id=plugins:plugin-2>plugins</a>. When third-party software is run with the same
- privileges as the user agent itself, vulnerabilities in the third-party software become as
- dangerous as those in the user agent.</p>
- <p>Since different users having differents sets of <a href=#plugin id=plugins:plugin-3>plugins</a> provides a
- fingerprinting vector that increases the chances of users being uniquely identified, user agents
- are encouraged to support the exact same set of <a href=#plugin id=plugins:plugin-4>plugins</a> for each
- user.
- <a href=#fingerprinting-vector id=plugins:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
-
- <h4 id=encoding-terminology>2.1.6 Character encodings</h4>
- <p>A <dfn id=encoding>character encoding</dfn>, or just <i>encoding</i> where that is not
- ambiguous, is a defined way to convert between byte streams and Unicode strings, as defined in the
- WHATWG Encoding standard. An <a href=#encoding id=encoding-terminology:encoding>encoding</a> has an <dfn id=encoding-name>encoding name</dfn> and one or more
- <dfn id=encoding-label>encoding labels</dfn>, referred to as the encoding's <i>name</i> and
- <i>labels</i> in the Encoding standard. <a href=#refsENCODING>[ENCODING]</a></p>
- <p>An <dfn id=ascii-compatible-character-encoding>ASCII-compatible character encoding</dfn> is a single-byte or variable-length
- <a href=#encoding id=encoding-terminology:encoding-2>encoding</a> in which the bytes 0x09, 0x0A, 0x0C, 0x0D, 0x20 - 0x22, 0x26, 0x27, 0x2C -
- 0x3F, 0x41 - 0x5A, and 0x61 - 0x7A, ignoring bytes that are the second and later bytes of multibyte
- sequences, all correspond to single-byte sequences that map to the same Unicode characters as
- those bytes in Windows-1252. <a href=#refsENCODING>[ENCODING]</a></p>
- <p class=note>This includes such encodings as Shift_JIS, HZ-GB-2312, and variants of ISO-2022,
- even though it is possible in these encodings for bytes like 0x70 to be part of longer sequences
- that are unrelated to their interpretation as ASCII. It excludes UTF-16 variants, as well as
- obsolete legacy encodings such as UTF-7, GSM03.38, and EBCDIC variants.</p>
-
- <p>The term <dfn id=a-utf-16-encoding>a UTF-16 encoding</dfn> refers to any variant of UTF-16: UTF-16LE or UTF-16BE,
- regardless of the presence or absence of a BOM. <a href=#refsENCODING>[ENCODING]</a></p>
- <p>The term <dfn id=code-unit>code unit</dfn> is used as defined in the Web IDL specification: a 16 bit
- unsigned integer, the smallest atomic component of a <code id=encoding-terminology:idl-domstring><a href=#idl-domstring>DOMString</a></code>. (This is a narrower definition than the one used in
- Unicode, and is not the same as a <i>code point</i>.) <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p>The term <dfn id=unicode-code-point>Unicode code point</dfn> means a <i>Unicode scalar value</i> where possible, and
- an isolated surrogate code point when not. When a conformance requirement is defined in terms of
- characters or Unicode code points, a pair of <a href=#code-unit id=encoding-terminology:code-unit>code units</a> consisting
- of a high surrogate followed by a low surrogate must be treated as the single code point
- represented by the surrogate pair, but isolated surrogates must each be treated as the single code
- point with the value of the surrogate. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p>In this specification, the term <dfn id=character>character</dfn>, when not qualified as <em>Unicode</em>
- character, is synonymous with the term <a href=#unicode-code-point id=encoding-terminology:unicode-code-point>Unicode code point</a>.</p>
- <p>The term <dfn id=unicode-character>Unicode character</dfn> is used to mean a <i>Unicode scalar value</i> (i.e. any
- Unicode code point that is not a surrogate code point). <a href=#refsUNICODE>[UNICODE]</a></p>
- <p>The <dfn id=code-unit-length>code-unit length</dfn> of a string is the number of <a href=#code-unit id=encoding-terminology:code-unit-2>code
- units</a> in that string.</p>
- <p class=note>This complexity results from the historical decision to define the DOM API in
- terms of 16 bit (UTF-16) <a href=#code-unit id=encoding-terminology:code-unit-3>code units</a>, rather than in terms of <a href=#unicode-character id=encoding-terminology:unicode-character>Unicode characters</a>.</p>
-
- <h3 id=conformance-requirements>2.2 Conformance requirements</h3>
- <p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
- explicitly marked non-normative. Everything else in this specification is normative.</p>
- <p>The key words "MUST", "MUST NOT", "SHOULD",
- "SHOULD NOT", "MAY", and "OPTIONAL" in the normative
- parts of this document are to be interpreted as described in RFC2119. The key word "OPTIONALLY" in
- the normative parts of this document is to be interpreted with the same normative meaning as "MAY"
- and "OPTIONAL". For readability, these words do not appear in all uppercase letters in this
- specification. <a href=#refsRFC2119>[RFC2119]</a></p>
- <p>Requirements phrased in the imperative as part of algorithms (such as "strip any leading space
- characters" or "return false and abort these steps") are to be interpreted with the meaning of the
- key word ("must", "should", "may", etc) used in introducing the algorithm.</p>
- <div class=example>
- <p>For example, were the spec to say:</p>
- <pre>To eat an orange, the user must:
- 1. Peel the orange.
- 2. Separate each slice of the orange.
- 3. Eat the orange slices.</pre>
- <p>...it would be equivalent to the following:</p>
- <pre>To eat an orange:
- 1. The user must peel the orange.
- 2. The user must separate each slice of the orange.
- 3. The user must eat the orange slices.</pre>
- <p>Here the key word is "must".</p>
- <p>The former (imperative) style is generally preferred in this specification for stylistic
- reasons.</p>
- </div>
- <p>Conformance requirements phrased as algorithms or specific steps may be implemented in any
- manner, so long as the end result is equivalent. (In particular, the algorithms defined in this
- specification are intended to be easy to follow, and not intended to be performant.)</p>
-
-
- <h4 id=conformance-classes>2.2.1 Conformance classes</h4>
- <p>This specification describes the conformance criteria for user agents
- (relevant to implementors) and documents (relevant to authors and
- authoring tool implementors).</p>
- <p><dfn id=conforming-documents>Conforming documents</dfn> are those that comply with all the conformance criteria for
- documents. For readability, some of these conformance requirements are phrased as conformance
- requirements on authors; such requirements are implicitly requirements on documents: by
- definition, all documents are assumed to have had an author. (In some cases, that author may
- itself be a user agent — such user agents are subject to additional rules, as explained
- below.)</p>
- <p class=example>For example, if a requirement states that "authors must not use the <code>foobar</code> element", it would imply that documents are not allowed to contain
- elements named <code>foobar</code>.</p>
- <p class="note impl">There is no implied relationship between document conformance requirements
- and implementation conformance requirements. User agents are not free to handle non-conformant
- documents as they please; the processing model described in this specification applies to
- implementations regardless of the conformity of the input documents.</p>
- <p>User agents fall into several (overlapping) categories with different conformance
- requirements.</p>
- <dl><dt id=interactive>Web browsers and other interactive user agents<dd>
- <p>Web browsers that support <a href=#the-xhtml-syntax id=conformance-classes:the-xhtml-syntax>the XHTML syntax</a> must process elements and attributes
- from the <a href=#html-namespace-2 id=conformance-classes:html-namespace-2>HTML namespace</a> found in XML documents as described in this specification,
- so that users can interact with them, unless the semantics of those elements have been
- overridden by other specifications.</p>
- <p class=example>A conforming XHTML processor would, upon finding an XHTML <code id=conformance-classes:the-script-element><a href=#the-script-element>script</a></code>
- element in an XML document, execute the script contained in that element. However, if the
- element is found within a transformation expressed in XSLT (assuming the user agent also
- supports XSLT), then the processor would instead treat the <code id=conformance-classes:the-script-element-2><a href=#the-script-element>script</a></code> element as an
- opaque element that forms part of the transform.</p>
- <p>Web browsers that support <a href=#syntax id=conformance-classes:syntax>the HTML syntax</a> must process documents labeled with an
- <a href=#html-mime-type id=conformance-classes:html-mime-type>HTML MIME type</a> as described in this specification, so that users can interact with
- them.</p>
- <p>User agents that support scripting must also be conforming implementations of the IDL
- fragments in this specification, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p class=note>Unless explicitly stated, specifications that override the semantics of HTML
- elements do not override the requirements on DOM objects representing those elements. For
- example, the <code id=conformance-classes:the-script-element-3><a href=#the-script-element>script</a></code> element in the example above would still implement the
- <code id=conformance-classes:htmlscriptelement><a href=#htmlscriptelement>HTMLScriptElement</a></code> interface.</p>
- <dt id=non-interactive>Non-interactive presentation user agents<dd>
- <p>User agents that process HTML and XHTML documents purely to render non-interactive versions
- of them must comply to the same conformance criteria as Web browsers, except that they are
- exempt from requirements regarding user interaction.</p>
- <p class=note>Typical examples of non-interactive presentation user agents are printers
- (static UAs) and overhead displays (dynamic UAs). It is expected that most static
- non-interactive presentation user agents will also opt to <a href=#non-scripted>lack scripting
- support</a>.</p>
- <p class=example>A non-interactive but dynamic presentation UA would still execute scripts,
- allowing forms to be dynamically submitted, and so forth. However, since the concept of "focus"
- is irrelevant when the user cannot interact with the document, the UA would not need to support
- any of the focus-related DOM APIs.</p>
- <dt id=renderingUA>Visual user agents that support the suggested default rendering<dd>
- <p>User agents, whether interactive or not, may be designated (possibly as a user option) as
- supporting the suggested default rendering defined by this specification.</p>
- <p>This is not required. In particular, even user agents that do implement the suggested default
- rendering are encouraged to offer settings that override this default to improve the experience
- for the user, e.g. changing the colour contrast, using different focus styles, or otherwise
- making the experience more accessible and usable to the user.</p>
- <p>User agents that are designated as supporting the suggested default rendering must, while so
- designated, implement the rules in <a href=#rendering>the rendering section</a> that that
- section defines as the behavior that user agents are <em>expected</em> to implement.</p>
- <dt id=non-scripted>User agents with no scripting support<dd>
- <p>Implementations that do not support scripting (or which have their scripting features
- disabled entirely) are exempt from supporting the events and DOM interfaces mentioned in this
- specification. For the parts of this specification that are defined in terms of an events model
- or in terms of the DOM, such user agents must still act as if events and the DOM were
- supported.</p>
- <p class=note>Scripting can form an integral part of an application. Web browsers that do not
- support scripting, or that have scripting disabled, might be unable to fully convey the author's
- intent.</p>
- <dt>Conformance checkers<dd id=conformance-checkers>
- <p>Conformance checkers must verify that a document conforms to the applicable conformance
- criteria described in this specification. Automated conformance checkers are exempt from
- detecting errors that require interpretation of the author's intent (for example, while a
- document is non-conforming if the content of a <code id=conformance-classes:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code> element is not a quote,
- conformance checkers running without the input of human judgement do not have to check that
- <code id=conformance-classes:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code> elements only contain quoted material).</p>
- <p>Conformance checkers must check that the input document conforms when parsed without a
- <a href=#browsing-context id=conformance-classes:browsing-context>browsing context</a> (meaning that no scripts are run, and that the parser's
- <a href=#scripting-flag id=conformance-classes:scripting-flag>scripting flag</a> is disabled), and should also check that the input document conforms
- when parsed with a <a href=#browsing-context id=conformance-classes:browsing-context-2>browsing context</a> in which scripts execute, and that the scripts
- never cause non-conforming states to occur other than transiently during script execution
- itself. (This is only a "SHOULD" and not a "MUST" requirement because it has been proven to be
- impossible. <a href=#refsCOMPUTABLE>[COMPUTABLE]</a>)</p>
- <p>The term "HTML validator" can be used to refer to a conformance checker that itself conforms
- to the applicable requirements of this specification.</p>
- <div class=note>
- <p>XML DTDs cannot express all the conformance requirements of this specification. Therefore, a
- validating XML processor and a DTD cannot constitute a conformance checker. Also, since neither
- of the two authoring formats defined in this specification are applications of SGML, a
- validating SGML system cannot constitute a conformance checker either.</p>
- <p>To put it another way, there are three types of conformance criteria:</p>
- <ol><li>Criteria that can be expressed in a DTD.<li>Criteria that cannot be expressed by a DTD, but can still be checked by a machine.<li>Criteria that can only be checked by a human.</ol>
- <p>A conformance checker must check for the first two. A simple DTD-based validator only checks
- for the first class of errors and is therefore not a conforming conformance checker according
- to this specification.</p>
- </div>
- <dt>Data mining tools<dd id=data-mining>
- <p>Applications and tools that process HTML and XHTML documents for reasons other than to either
- render the documents or check them for conformance should act in accordance with the semantics
- of the documents that they process.</p>
- <p class=example>A tool that generates <a href=#outline id=conformance-classes:outline>document outlines</a> but
- increases the nesting level for each paragraph and does not increase the nesting level for each
- section would not be conforming.</p>
- <dt id=editors>Authoring tools and markup generators<dd>
- <p>Authoring tools and markup generators must generate <a href=#conforming-documents id=conformance-classes:conforming-documents>conforming documents</a>.
- Conformance criteria that apply to authors also apply to authoring tools, where appropriate.</p>
- <p>Authoring tools are exempt from the strict requirements of using elements only for their
- specified purpose, but only to the extent that authoring tools are not yet able to determine
- author intent. However, authoring tools must not automatically misuse elements or encourage
- their users to do so.</p>
- <p class=example>For example, it is not conforming to use an <code id=conformance-classes:the-address-element><a href=#the-address-element>address</a></code> element for
- arbitrary contact information; that element can only be used for marking up contact information
- for the author of the document or section. However, since an authoring tool is likely unable to
- determine the difference, an authoring tool is exempt from that requirement. This does not mean,
- though, that authoring tools can use <code id=conformance-classes:the-address-element-2><a href=#the-address-element>address</a></code> elements for any block of italics text
- (for instance); it just means that the authoring tool doesn't have to verify that when the user
- uses a tool for inserting contact information for a section, that the user really is doing that
- and not inserting something else instead.</p>
- <p class=note>In terms of conformance checking, an editor has to output documents that conform
- to the same extent that a conformance checker will verify.</p>
- <p>When an authoring tool is used to edit a non-conforming document, it may preserve the
- conformance errors in sections of the document that were not edited during the editing session
- (i.e. an editing tool is allowed to round-trip erroneous content). However, an authoring tool
- must not claim that the output is conformant if errors have been so preserved.</p>
- <p>Authoring tools are expected to come in two broad varieties: tools that work from structure
- or semantic data, and tools that work on a What-You-See-Is-What-You-Get media-specific editing
- basis (WYSIWYG).</p>
- <p>The former is the preferred mechanism for tools that author HTML, since the structure in the
- source information can be used to make informed choices regarding which HTML elements and
- attributes are most appropriate.</p>
- <p>However, WYSIWYG tools are legitimate. WYSIWYG tools should use elements they know are
- appropriate, and should not use elements that they do not know to be appropriate. This might in
- certain extreme cases mean limiting the use of flow elements to just a few elements, like
- <code id=conformance-classes:the-div-element><a href=#the-div-element>div</a></code>, <code id=conformance-classes:the-b-element><a href=#the-b-element>b</a></code>, <code id=conformance-classes:the-i-element><a href=#the-i-element>i</a></code>, and <code id=conformance-classes:the-span-element><a href=#the-span-element>span</a></code> and making liberal use
- of the <code id=conformance-classes:the-style-attribute><a href=#the-style-attribute>style</a></code> attribute.</p>
- <p>All authoring tools, whether WYSIWYG or not, should make a best effort attempt at enabling
- users to create well-structured, semantically rich, media-independent content.</p>
- </dl>
- <p id=hardwareLimitations>User agents may impose implementation-specific limits on otherwise
- unconstrained inputs, e.g. to prevent denial of service attacks, to guard against running out of
- memory, or to work around platform-specific limitations.
- <a href=#fingerprinting-vector id=conformance-classes:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>For compatibility with existing content and prior specifications, this specification describes
- two authoring formats: one based on XML (referred to as <a href=#the-xhtml-syntax id=conformance-classes:the-xhtml-syntax-2>the XHTML syntax</a>), and one
- using a <a href=#writing>custom format</a> inspired by SGML (referred to as <a href=#syntax id=conformance-classes:syntax-2>the HTML
- syntax</a>). Implementations must support at least one of these two formats, although
- supporting both is encouraged.</p>
- <p>Some conformance requirements are phrased as requirements on elements, attributes, methods or
- objects. Such requirements fall into two categories: those describing content model restrictions,
- and those describing implementation behavior. Those in the former category are requirements on
- documents and authoring tools. Those in the second category are requirements on user agents.
- Similarly, some conformance requirements are phrased as requirements on authors; such requirements
- are to be interpreted as conformance requirements on the documents that authors produce. (In other
- words, this specification does not distinguish between conformance criteria on authors and
- conformance criteria on documents.)</p>
-
- <h4 id=dependencies>2.2.2 Dependencies</h4>
- <p>This specification relies on several other underlying specifications.</p>
- <dl><dt>Unicode and Encoding<dd>
- <p>The Unicode character set is used to represent textual data, and the WHATWG Encoding standard
- defines requirements around <a href=#encoding id=dependencies:encoding>character encodings</a>. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p class=note>This specification <a href=#encoding-terminology>introduces terminology</a>
- based on the terms defined in those specifications, as described earlier.</p>
- <p>The following terms are used as defined in the WHATWG Encoding standard: <a href=#refsENCODING>[ENCODING]</a></p>
- <ul class=brief><li><dfn id=getting-an-encoding><a href=http://encoding.spec.whatwg.org/#concept-encoding-get>Getting an encoding</a></dfn>
- <li>The <dfn id=encoder>encoder</dfn> and <dfn id=decoder>decoder</dfn> algorithms for various encodings, including
- the <dfn id=utf-8-encoder>UTF-8 encoder</dfn> and <dfn id=utf-8-decoder>UTF-8 decoder</dfn>
- <li>The generic <dfn id=decode>decode</dfn> algorithm which takes a byte stream and an encoding and
- returns a character stream
- <li>The <dfn id=utf-8-decode>UTF-8 decode</dfn> algorithm which takes a byte stream and returns a character
- stream, additionally stripping one leading UTF-8 Byte Order Mark (BOM), if any
- </ul>
- <p class=note>The <a href=#utf-8-decoder id=dependencies:utf-8-decoder>UTF-8 decoder</a> is distinct from the <i id=dependencies:utf-8-decode><a href=#utf-8-decode>UTF-8 decode algorithm</a></i>. The latter first strips a Byte Order Mark (BOM), if any, and
- then invokes the former.</p>
- <p>For readability, character encodings are sometimes referenced in this specification with a
- case that differs from the canonical case given in the WHATWG Encoding standard. (For example,
- "UTF-16LE" instead of "utf-16le".)</p>
- <dt>XML and related specifications<dd>
- <p>Implementations that support <a href=#the-xhtml-syntax id=dependencies:the-xhtml-syntax>the XHTML syntax</a> must support some version of XML,
- as well as its corresponding namespaces specification, because that syntax uses an XML
- serialisation with namespaces. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
- <p>The attribute with the tag name <dfn id=attr-xml-space><code>xml:space</code></dfn> in
- the <a href=#xml-namespace id=dependencies:xml-namespace>XML namespace</a> is defined by the XML specification. <a href=#refsXML>[XML]</a></p>
- <p>This specification also references the <dfn id=xml-stylesheet><a href=http://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction><code><?xml-stylesheet?></code></a></dfn>
- processing instruction, defined in the <cite>Associating Style Sheets with XML documents</cite>
- specification. <a href=#refsXMLSSPI>[XMLSSPI]</a></p>
- <p>This specification also non-normatively mentions the <dfn id=xsltprocessor><code>XSLTProcessor</code></dfn>
- interface and its <dfn id=dom-xsltprocessor-transformtofragment><code>transformToFragment()</code></dfn> and <dfn id=dom-xsltprocessor-transformtodocument><code>transformToDocument()</code></dfn> methods.</p>
-
- <dt>URLs<dd>
- <p>The following terms are defined in the WHATWG URL standard: <a href=#refsURL>[URL]</a></p>
- <ul class=brief><li><dfn id=url>URL</dfn>
- <li><dfn id=absolute-url>Absolute URL</dfn>
- <li><dfn id=relative-url>Relative URL</dfn>
- <li><dfn id=concept-url-scheme-relative>Relative schemes</dfn>
- <li>The <dfn id=url-parser>URL parser</dfn>
- <li><dfn id=parsed-url>Parsed URL</dfn>
- <li>The <dfn id=concept-url-scheme>scheme</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url>parsed URL</a>
- <li>The <dfn id=concept-url-scheme-data>scheme data</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-2>parsed URL</a>
- <li>The <dfn id=concept-url-username>username</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-3>parsed URL</a>
- <li>The <dfn id=concept-url-password>password</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-4>parsed URL</a>
- <li>The <dfn id=concept-url-host>host</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-5>parsed URL</a>
- <li>The <dfn id=concept-url-port>port</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-6>parsed URL</a>
- <li>The <dfn id=concept-url-path>path</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-7>parsed URL</a>
- <li>The <dfn id=concept-url-query>query</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-8>parsed URL</a>
- <li>The <dfn id=concept-url-fragment>fragment</dfn> component of a <a href=#parsed-url id=dependencies:parsed-url-9>parsed URL</a>
- <li><dfn id=concept-url-parse-error>Parse errors</dfn> from the <a href=#url-parser id=dependencies:url-parser>URL parser</a>
- <li>The <dfn id=concept-url-serialiser>URL serialiser</dfn>
- <li><dfn id=default-encode-set>Default encode set</dfn>
- <li><dfn id=percent-encode>Percent encode</dfn>
- <li><dfn id=utf-8-percent-encode>UTF-8 percent encode</dfn>
- <li><dfn id=percent-decode>Percent decode</dfn>
- <li><dfn id=decoder-error>Decoder error</dfn>
- <li>The <dfn id=domain-to-ascii>domain to ASCII</dfn> algorithm<li>The <dfn id=domain-to-unicode>domain to Unicode</dfn> algorithm<li><dfn id=urlutils><code>URLUtils</code></dfn> interface
- <li><dfn id=urlutilsreadonly><code>URLUtilsReadOnly</code></dfn> interface
- <li><dfn id=dom-url-href><code>href</code></dfn> IDL attribute
- <li><dfn id=dom-url-protocol><code>protocol</code></dfn> IDL attribute
- <li>The <dfn id=concept-uu-get-the-base>get the base</dfn> hook for <code id=dependencies:urlutils><a href=#urlutils>URLUtils</a></code>
- <li>The <dfn id=concept-uu-update>update steps</dfn> hook for <code id=dependencies:urlutils-2><a href=#urlutils>URLUtils</a></code>
- <li>The <dfn id=concept-uu-set-the-input>set the input</dfn> algorithm for <code id=dependencies:urlutils-3><a href=#urlutils>URLUtils</a></code>
- <li>The <dfn id=concept-uu-query-encoding>query encoding</dfn> of an <code id=dependencies:urlutils-4><a href=#urlutils>URLUtils</a></code> object
- <li>The <dfn id=concept-uu-input>input</dfn> of an <code id=dependencies:urlutils-5><a href=#urlutils>URLUtils</a></code> object
- <li>The <dfn id=concept-uu-url>url</dfn> of an <code id=dependencies:urlutils-6><a href=#urlutils>URLUtils</a></code> object
- </ul>
- <p>A number of schemes and protocols are referenced by this specification also:</p>
- <ul class=brief><li>The <dfn id=about-protocol><a href=http://tools.ietf.org/html/rfc6694#section-2><code>about:</code></a></dfn> scheme <a href=#refsABOUT>[ABOUT]</a>
- <li>The <dfn id=blob-protocol><a href=http://dev.w3.org/2006/webapi/FileAPI/#DefinitionOfScheme><code>blob:</code></a></dfn> scheme <a href=#refsFILEAPI>[FILEAPI]</a>
- <li>The <dfn id=data-protocol><a href=http://tools.ietf.org/html/rfc2397#section-2><code>data:</code></a></dfn> scheme <a href=#refsRFC2397>[RFC2397]</a>
- <li>The <dfn id=http-protocol><a href=http://tools.ietf.org/html/rfc7230#section-2.7.1><code>http:</code></a></dfn> scheme <a href=#refsHTTP>[HTTP]</a>
- <li>The <dfn id=https-protocol><a href=http://tools.ietf.org/html/rfc7230#section-2.7.2><code>https:</code></a></dfn> scheme <a href=#refsHTTP>[HTTP]</a>
- <li>The <dfn id=mailto-protocol><a href=http://tools.ietf.org/html/rfc6068#section-2><code>mailto:</code></a></dfn> scheme <a href=#refsMAILTO>[MAILTO]</a>
- <li>The <dfn id=sms-protocol><a href=http://tools.ietf.org/html/rfc5724#section-2><code>sms:</code></a></dfn> scheme <a href=#refsSMS>[SMS]</a>
- <li>The <dfn id=urn-protocol><a href=http://tools.ietf.org/html/rfc2141#section-2><code>urn:</code></a></dfn> scheme <a href=#refsURN>[URN]</a>
- </ul>
- <dt>HTTP and related specifications<dd>
- <p>The following terms are defined in the HTTP specifications: <a href=#refsHTTP>[HTTP]</a></p>
- <ul class=brief><li><dfn id=http-accept><code>Accept</code></dfn> header
- <li><dfn id=http-accept-language><code>Accept-Language</code></dfn> header
- <li><dfn id=http-cache-control><code>Cache-Control</code></dfn> header
- <li><dfn id=http-content-disposition><code>Content-Disposition</code></dfn> header
- <li><dfn id=http-content-language><code>Content-Language</code></dfn> header
- <li><dfn id=http-content-length><code>Content-Length</code></dfn> header
- <li><dfn id=http-host><code>Host</code></dfn> header
- <li><dfn id=http-last-modified><code>Last-Modified</code></dfn> header
- <li><dfn id=http-referer><code>Referer</code></dfn> header
- </ul>
- <p>The following term is defined in the Web Origin specification: <a href=#refsORIGIN>[ORIGIN]</a></p>
- <ul class=brief><li><dfn id=http-origin><code>Origin</code></dfn> header
- </ul>
- <p>The following terms are defined in the Cookie specification: <a href=#refsCOOKIES>[COOKIES]</a></p>
- <ul class=brief><li><dfn id=cookie-string>cookie-string</dfn>
- <li><dfn id=receives-a-set-cookie-string>receives a set-cookie-string</dfn>
- <li><dfn id=http-cookie><code>Cookie</code></dfn> header
- </ul>
- <p>The following term is defined in the Web Linking specification: <a href=#refsWEBLINK>[WEBLINK]</a></p>
- <ul class=brief><li><dfn id=http-link><code>Link</code></dfn> header
- </ul>
- <dt>Fetch<dd>
- <p>The following terms are defined in the WHATWG Fetch specification: <a href=#refsFETCH>[FETCH]</a></p>
- <ul class=brief><li><dfn id=cross-origin-request>cross-origin request</dfn>
- <li><dfn id=cross-origin-request-status>cross-origin request status</dfn>
- <li><dfn id=custom-request-headers>custom request headers</dfn>
- <li><dfn id=simple-cross-origin-request>simple cross-origin request</dfn>
- <li><dfn id=redirect-steps>redirect steps</dfn>
- <li><dfn id=omit-credentials-flag>omit credentials flag</dfn>
- <li><dfn id=resource-sharing-check>resource sharing check</dfn>
- </ul>
- <p class=critical>This specification does not yet use the "fetch" algorithm from the WHATWG
- Fetch specification. It will be updated to do so in due course. Some of the terms mentioned
- above are obsolete; this will be fixed when the spec is updated to use the new algorithm.</p>
- <dt>Web IDL<dd>
- <p>The IDL fragments in this specification must be interpreted as required for conforming IDL
- fragments, as described in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p>The following terms are defined in the Web IDL specification:</p>
- <ul class=brief><li><dfn id=supported-property-indices>Supported property indices</dfn>
- <li><dfn id=determine-the-value-of-an-indexed-property>Determine the value of an indexed property</dfn>
- <li><dfn id=support-named-properties>Support named properties</dfn>
- <li><dfn id=supported-property-names>Supported property names</dfn>
- <li><dfn id=unenumerable>Unenumerable</dfn>
- <li><dfn id=determine-the-value-of-a-named-property>Determine the value of a named property</dfn>
- <li><dfn id=platform-array-objects>Platform array objects</dfn>
- <li><dfn id=dfn-read-only-array>Read only</dfn> (when applied to arrays)
- <li><dfn id=dfn-callback-this-value>Callback this value</dfn>
- <li><dfn id=convert-a-domstring-to-a-sequence-of-unicode-characters>Convert a <code>DOMString</code> to a sequence of Unicode characters</dfn>
- </ul>
- <p>The Web IDL specification also defines the following types that are used in Web IDL fragments
- in this specification:</p>
- <ul class=brief><li><dfn id=idl-array><code>Array</code></dfn>
- <li><dfn id=idl-boolean><code>boolean</code></dfn>
- <li><dfn id=idl-boolean-wrapper><code>Boolean</code></dfn>
- <li><dfn id=idl-date><code>Date</code></dfn>
- <li><dfn id=idl-domstring><code>DOMString</code></dfn>
- <li><dfn id=idl-double><code>double</code></dfn>
- <li><dfn id=idl-error><code>Error</code></dfn>
- <li><dfn id=idl-function><code>Function</code></dfn>
- <li><dfn id=idl-long><code>long</code></dfn>
- <li><dfn id=idl-map><code>Map</code></dfn>
- <li><dfn id=idl-number-wrapper><code>Number</code></dfn>
- <li><dfn id=idl-object><code>Object</code></dfn>
- <li><dfn id=idl-regexp><code>RegExp</code></dfn>
- <li><dfn id=idl-set><code>Set</code></dfn>
- <li><dfn id=idl-string-wrapper><code>String</code></dfn>
- <li><dfn id=idl-unrestricted-double><code>unrestricted double</code></dfn>
- <li><dfn id=idl-unsigned-long><code>unsigned long</code></dfn>
- </ul>
- <p>When this specification requires a user agent to <dfn id=create-a-date-object>create a <code>Date</code> object</dfn> representing a particular time (which could be the
- special value Not-a-Number), the milliseconds component of that time, if any, must be truncated
- to an integer, and the time value of the newly created <code id=dependencies:idl-date><a href=#idl-date>Date</a></code>
- object must represent the resulting truncated time.</p>
- <p class=example>For instance, given the time 23045 millionths of a second after 01:00 UTC on
- January 1st 2000, i.e. the time 2000-01-01T00:00:00.023045Z, then the <code id=dependencies:idl-date-2><a href=#idl-date>Date</a></code> object created representing that time would represent the same
- time as that created representing the time 2000-01-01T00:00:00.023Z, 45 millionths earlier. If
- the given time is NaN, then the result is a <code id=dependencies:idl-date-3><a href=#idl-date>Date</a></code> object that
- represents a time value NaN (indicating that the object does not represent a specific instant of
- time).</p>
- <dt>JavaScript<dd>
- <p>Some parts of the language described by this specification only support JavaScript as the
- underlying scripting language. <a href=#refsECMA262>[ECMA262]</a></p>
- <p class=note>The term "JavaScript" is used to refer to ECMA262, rather than the official term
- ECMAScript, since the term JavaScript is more widely known. Similarly, the <a href=#mime-type id=dependencies:mime-type>MIME
- type</a> used to refer to JavaScript in this specification is <code>text/javascript</code>, since that is the most commonly used type, <a href=#willful-violation id=dependencies:willful-violation>despite it being an officially obsoleted type</a> according to RFC
- 4329. <a href=#refsRFC4329>[RFC4329]</a></p>
- <p>The term <dfn id=javascript-global-environment>JavaScript global environment</dfn> refers to the <i>global
- environment</i> concept defined in the ECMAScript specification.</p>
- <p>The ECMAScript <dfn id=js-syntaxerror><code>SyntaxError</code></dfn> and <dfn id=typeerror><code>TypeError</code></dfn> exceptions are also defined in the ECMAScript
- specification. <a href=#refsECMA262>[ECMA262]</a></p>
- <p>The <dfn id=arraybuffer>ArrayBuffer</dfn> and related object types and underlying concepts from the
- ECMAScript Specification are used for several features in this specification. <a href=#refsECMA262>[ECMA262]</a></p>
- <p>The following helper IDL is used for referring to <code id=dependencies:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code>-related types:</p>
- <pre class=idl>typedef (<dfn id=int8array>Int8Array</dfn> or <dfn id=uint8array>Uint8Array</dfn> or <dfn id=uint8clampedarray>Uint8ClampedArray</dfn> or
- <dfn id=int16array>Int16Array</dfn> or <dfn id=uint16array>Uint16Array</dfn> or
- <dfn id=int32array>Int32Array</dfn> or <dfn id=uint32array>Uint32Array</dfn> or
- <dfn id=float32array>Float32Array</dfn> or <dfn id=float64array>Float64Array</dfn> or
- <dfn id=dataview>DataView</dfn>) <dfn id=arraybufferview>ArrayBufferView</dfn>;</pre>
- <p class=note>In particular, the <code id=dependencies:uint8clampedarray><a href=#uint8clampedarray>Uint8ClampedArray</a></code> type is used by some <a href=#imagedata id=dependencies:imagedata>2D canvas APIs</a>, and the <a href=#network><code>WebSocket</code>
- API</a> uses <code id=dependencies:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> objects for handling binary frames.</p>
- <dt>DOM<dd>
- <p>The Document Object Model (DOM) is a representation — a model — of a document and
- its content. The DOM is not just an API; the conformance criteria of HTML implementations are
- defined, in this specification, in terms of operations on the DOM. <a href=#refsDOM>[DOM]</a></p>
- <p>Implementations must support DOM and the events defined in DOM Events, because this
- specification is defined in terms of the DOM, and some of the features are defined as extensions
- to the DOM interfaces. <a href=#refsDOM>[DOM]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>In particular, the following features are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>
- <ul class=brief><li><dfn id=attr><code>Attr</code></dfn> interface<li><dfn id=comment-2><code>Comment</code></dfn> interface<li><dfn id=domimplementation><code>DOMImplementation</code></dfn> interface<li><dfn id=dom-document><code>Document</code></dfn> interface<li><dfn id=xmldocument><code>XMLDocument</code></dfn> interface<li><dfn id=documentfragment><code>DocumentFragment</code></dfn> interface<li><dfn id=documenttype><code>DocumentType</code></dfn> interface<li><dfn id=domexception><code>DOMException</code></dfn> interface<li><dfn id=childnode><code>ChildNode</code></dfn> interface<li><dfn id=element><code>Element</code></dfn> interface<li><dfn id=node><code>Node</code></dfn> interface<li><dfn id=nodelist><code>NodeList</code></dfn> interface<li><dfn id=processinginstruction><code>ProcessingInstruction</code></dfn> interface<li><dfn id=text><code>Text</code></dfn> interface<li><dfn id=node-document><a href=http://dom.spec.whatwg.org/#concept-node-document>node document</a></dfn> concept<li><dfn id=htmlcollection><code>HTMLCollection</code></dfn> interface<li><dfn id=dom-htmlcollection-length><code>HTMLCollection.length</code></dfn> attribute<li><dfn id=dom-htmlcollection-item><code>HTMLCollection.item()</code></dfn> method<li><dfn id=dom-htmlcollection-nameditem><code>HTMLCollection.namedItem()</code></dfn> method<li>The terms <dfn id=collections>collections</dfn> and <dfn id=represented-by-the-collection>represented by the collection</dfn><li><dfn id=domtokenlist><code>DOMTokenList</code></dfn> interface<li><dfn id=domsettabletokenlist><code>DOMSettableTokenList</code></dfn> interface<li><dfn id=dom-domsettabletokenlist-value><code>DOMSettableTokenList.value</code></dfn> attribute<li><dfn id=dom-domimplementation-createdocument><code>createDocument()</code></dfn> method<li><dfn id=dom-domimplementation-createhtmldocument><code>createHTMLDocument()</code></dfn> method<li><dfn id=dom-document-createelement><code>createElement()</code></dfn> method<li><dfn id=dom-document-createelementns><code>createElementNS()</code></dfn> method<li><dfn id=dom-document-getelementbyid><code>getElementById()</code></dfn> method<li><dfn id=dom-document-getelementsbyclassname><code>getElementsByClassName()</code></dfn> method<li><dfn id=dom-node-insertbefore><code>insertBefore()</code></dfn> method<li><dfn id=dom-node-childnodes><code>childNodes</code></dfn> attribute<li><dfn id=dom-node-localname><code>localName</code></dfn> attribute<li><dfn id=dom-node-parentnode><code>parentNode</code></dfn> attribute<li><dfn id=dom-node-namespaceuri><code>namespaceURI</code></dfn> attribute<li><dfn id=dom-element-tagname><code>tagName</code></dfn> attribute<li><dfn id=dom-element-id><code>id</code></dfn> attribute<li><dfn id=textcontent><code>textContent</code></dfn> attribute<li>The <dfn id=concept-node-insert>insert</dfn>, <dfn id=concept-node-append>append</dfn>, <dfn id=concept-node-remove>remove</dfn>, <dfn id=concept-node-replace>replace</dfn>, and <dfn id=concept-node-adopt>adopt</dfn> algorithms for nodes<li>The <dfn id=nodes-are-inserted>nodes are inserted</dfn> and <dfn id=nodes-are-removed>nodes are removed</dfn> concepts<li>An element's <dfn id=concept-node-adopt-ext>adopting steps</dfn><li>The <dfn id=attribute-list>attribute list</dfn> concept.<li>The <dfn id=concept-cd-data>data</dfn> of a text node.<li><dfn id=event><code>Event</code></dfn> interface<li><dfn id=eventtarget><code>EventTarget</code></dfn> interface<li><dfn id=eventinit><code>EventInit</code></dfn> dictionary type<li><dfn id=dom-event-target><code>target</code></dfn> attribute<li><dfn id=dom-event-currenttarget><code>currentTarget</code></dfn> attribute<li><dfn id=dom-event-istrusted><code>isTrusted</code></dfn> attribute<li><dfn id=dom-event-initevent><code>initEvent()</code></dfn> method<li><dfn id=dom-eventtarget-addeventlistener><code>addEventListener()</code></dfn> method<li>The <dfn id=concept-event-type>type</dfn> of an event<li>The concept of an <dfn id=concept-event-listener>event listener</dfn> and the <a href=#concept-event-listener id=dependencies:concept-event-listener>event listeners</a> associated with an <code id=dependencies:eventtarget><a href=#eventtarget>EventTarget</a></code><li>The concept of a <dfn id=concept-event-target-override>target override</dfn><li>The concept of a regular <dfn id=event-parent>event parent</dfn> and a <dfn id=cross-boundary-event-parent>cross-boundary event parent</dfn><li>The <dfn id="document's-character-encoding">encoding</dfn> (herein the <i>character encoding</i>) and <dfn id=concept-document-content-type>content type</dfn> of a <code id=dependencies:document><a href=#document>Document</a></code><li>The distinction between <dfn id=xml-documents>XML documents</dfn> and <dfn id=html-documents>HTML documents</dfn><li>The terms <dfn id=quirks-mode>quirks mode</dfn>, <dfn id=limited-quirks-mode>limited-quirks mode</dfn>, and <dfn id=no-quirks-mode>no-quirks mode</dfn><li>The algorithm to <dfn id=concept-node-clone>clone</dfn> a <code id=dependencies:node><a href=#node>Node</a></code>, and the concept of <dfn id=concept-node-clone-ext>cloning steps</dfn> used by that algorithm<li>The concept of <dfn id=base-url-change-steps>base URL change steps</dfn> and the definition of what happens when an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn><li>The concept of an element's <dfn id=concept-id>unique identifier (ID)</dfn><li>The concept of a DOM <dfn id=concept-range>range</dfn>, and the terms <dfn id=concept-range-start>start</dfn>, <dfn id=concept-range-end>end</dfn>, and <dfn id=concept-range-bp>boundary point</dfn> as applied to ranges.<li><dfn id=mutationobserver><code>MutationObserver</code></dfn> interface<li><dfn id=promise>Promise</dfn> interface<li>The <dfn id=concept-resolver>resolver</dfn> concept<li>The <dfn id=concept-resolver-fulfill>fulfill</dfn> and <dfn id=concept-resolver-reject>reject</dfn> algorithms</ul>
- <p>The term <dfn id=throw>throw</dfn> in this specification is used as defined in the DOM specification.
- The following <code id=dependencies:domexception><a href=#domexception>DOMException</a></code> types are defined in the DOM specification: <a href=#refsDOM>[DOM]</a></p>
- <ol class=brief><li value=1><dfn id=indexsizeerror><code>IndexSizeError</code></dfn><li value=3><dfn id=hierarchyrequesterror><code>HierarchyRequestError</code></dfn><li value=4><dfn id=wrongdocumenterror><code>WrongDocumentError</code></dfn><li value=5><dfn id=invalidcharactererror><code>InvalidCharacterError</code></dfn><li value=7><dfn id=nomodificationallowederror><code>NoModificationAllowedError</code></dfn><li value=8><dfn id=notfounderror><code>NotFoundError</code></dfn><li value=9><dfn id=notsupportederror><code>NotSupportedError</code></dfn><li value=11><dfn id=invalidstateerror><code>InvalidStateError</code></dfn><li value=12><dfn id=syntaxerror><code>SyntaxError</code></dfn><li value=13><dfn id=invalidmodificationerror><code>InvalidModificationError</code></dfn><li value=14><dfn id=namespaceerror><code>NamespaceError</code></dfn><li value=15><dfn id=invalidaccesserror><code>InvalidAccessError</code></dfn><li value=18><dfn id=securityerror><code>SecurityError</code></dfn><li value=19><dfn id=networkerror><code>NetworkError</code></dfn><li value=20><dfn id=aborterror><code>AbortError</code></dfn><li value=21><dfn id=urlmismatcherror><code>URLMismatchError</code></dfn><li value=22><dfn id=quotaexceedederror><code>QuotaExceededError</code></dfn><li value=23><dfn id=timeouterror><code>TimeoutError</code></dfn><li value=24><dfn id=invalidnodetypeerror><code>InvalidNodeTypeError</code></dfn><li value=25><dfn id=datacloneerror><code>DataCloneError</code></dfn></ol>
- <p class=example>For example, to <i>throw a <code id=dependencies:timeouterror><a href=#timeouterror>TimeoutError</a></code> exception</i>, a user
- agent would construct a <code id=dependencies:domexception-2><a href=#domexception>DOMException</a></code> object whose type was the string "<code>TimeoutError</code>" (and whose code was the number 23, for legacy reasons) and
- actually throw that object as an exception.</p>
- <p>The following features are defined in the DOM Events specification: <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <ul class=brief><li><dfn id=mouseevent><code>MouseEvent</code></dfn> interface<li>The <code id=dependencies:mouseevent><a href=#mouseevent>MouseEvent</a></code> interface's <dfn id=dom-mouseevent-relatedtarget><code>relatedTarget</code></dfn> attribute<li><dfn id=mouseeventinit><code>MouseEventInit</code></dfn> dictionary type<li>The <dfn id=focusevent><code>FocusEvent</code></dfn> interface<li>The <code id=dependencies:focusevent><a href=#focusevent>FocusEvent</a></code> interface's <dfn id=dom-focusevent-relatedtarget><code>relatedTarget</code></dfn> attribute<li>The <dfn id=uievent><a href=https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent><code>UIEvent</code></a></dfn> interface<li>The <code id=dependencies:uievent><a data-x-internal=uievent href=https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent>UIEvent</a></code> interface's <dfn id=dom-uievent-view><code>view</code></dfn> attribute<li>The <code id=dependencies:uievent-2><a data-x-internal=uievent href=https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#interface-UIEvent>UIEvent</a></code> interface's <dfn id=dom-uievent-detail><code>detail</code></dfn> attribute<li><dfn id=event-click><code>click</code></dfn> event<li><dfn id=event-dblclick><code>dblclick</code></dfn> event<li><dfn id=event-mousedown><code>mousedown</code></dfn> event<li><dfn id=event-mouseenter><code>mouseenter</code></dfn> event<li><dfn id=event-mouseleave><code>mouseleave</code></dfn> event<li><dfn id=event-mousemove><code>mousemove</code></dfn> event<li><dfn id=event-mouseout><code>mouseout</code></dfn> event<li><dfn id=event-mouseover><code>mouseover</code></dfn> event<li><dfn id=event-mouseup><code>mouseup</code></dfn> event<li><dfn id=event-mousewheel><code>mousewheel</code></dfn> event<li><dfn id=event-keydown><code>keydown</code></dfn> event<li><dfn id=event-keyup><code>keyup</code></dfn> event<li><dfn id=event-keypress><code>keypress</code></dfn> event</ul>
- <p>The following features are defined in the Touch Events specification: <a href=#refsTOUCH>[TOUCH]</a></p>
- <ul class=brief><li><dfn id=touch><code>Touch</code></dfn> interface<li><dfn id=touch-point>Touch point</dfn> concept</ul>
- <p>This specification sometimes uses the term <dfn>name</dfn> to refer to the event's
- <a href=#concept-event-type id=dependencies:concept-event-type>type</a>; as in, "an event named <code>click</code>" or "if the event name is <code>keypress</code>". The terms
- "name" and "type" for events are synonymous.</p>
- <p>The following features are defined in the <cite lang=en-US>DOM Parsing and
- Serialization</cite> specification: <a href=#refsDOMPARSING>[DOMPARSING]</a></p>
- <ul class=brief><li><dfn id=domparser><a href=http://domparsing.spec.whatwg.org/#the-domparser-interface><code>DOMParser</code></a></dfn><li><dfn id=dom-innerhtml><code>innerHTML</code></dfn><li><dfn id=dom-outerhtml><code>outerHTML</code></dfn></ul>
- <p>The <dfn id=selection><code>Selection</code></dfn> interface is defined in the <cite>HTML Editing
- APIs</cite> specification. <a href=#refsEDITING>[EDITING]</a></p>
- <p class=note>User agents are encouraged to implement the features described in the <cite>HTML
- Editing APIs</cite>
- specification. <a href=#refsEDITING>[EDITING]</a> </p>
- <p>The following parts of the Fullscreen specification are referenced from this specification,
- in part to define the rendering of <code id=dependencies:the-dialog-element><a href=#the-dialog-element>dialog</a></code> elements, and also to define how the
- Fullscreen API interacts with the sandboxing features in HTML: <a href=#refsFULLSCREEN>[FULLSCREEN]</a></p>
- <ul class=brief><li>The <dfn id=top-layer>top layer</dfn> concept<li><dfn id=dom-element-requestfullscreen><code>requestFullscreen()</code></dfn>
- <li>The <dfn id=fullscreen-enabled-flag>fullscreen enabled flag</dfn><li>The <dfn id=fully-exit-fullscreen>fully exit fullscreen</dfn> algorithm</ul>
- <dt>File API<dd>
- <p>This specification uses the following features defined in the File API specification: <a href=#refsFILEAPI>[FILEAPI]</a></p>
- <ul class=brief><li><dfn id=blob><code>Blob</code></dfn> interface<li><dfn id=file><code>File</code></dfn> interface<li><dfn id=filelist><code>FileList</code></dfn> interface<li><dfn id=dom-blob-close><code>Blob.close()</code></dfn><li><dfn id=dom-blob-type><code>Blob.type</code></dfn><li>The concept of <dfn id=file-error-read>read errors</dfn></ul>
- <dt>Media Providers<dd>
- <p>This specification references the following interfaces:</p>
- <ul class=brief><li><dfn id=mediastream><code>MediaStream</code></dfn> <a href=#refsMEDIASTREAM>[MEDIASTREAM]</a><li><dfn id=mediasource><code>MediaSource</code></dfn> <a href=#refsMEDIASOURCE>[MEDIASOURCE]</a></ul>
- <dt>XMLHttpRequest<dd>
- <p>This specification references the XMLHttpRequest specification to describe how the two
- specifications interact and to use its <code id=dependencies:progressevent><a href=#progressevent>ProgressEvent</a></code> features. The following
- features and terms are defined in the XMLHttpRequest specification: <a href=#refsXHR>[XHR]</a></p>
- <ul class=brief><li><dfn id=xmlhttprequest><code>XMLHttpRequest</code></dfn> interface
- <li><dfn id=dom-xmlhttprequest-responsexml><code>XMLHttpRequest.responseXML</code></dfn> attribute
- <li><dfn id=progressevent><code>ProgressEvent</code></dfn> interface
- <li><dfn id=dom-progressevent-lengthcomputable><code>ProgressEvent.lengthComputable</code></dfn> attribute
- <li><dfn id=dom-progressevent-loaded><code>ProgressEvent.loaded</code></dfn> attribute
- <li><dfn id=dom-progressevent-total><code>ProgressEvent.total</code></dfn> attribute
- <li><dfn id=fire-a-progress-event>Fire a progress event named <var>e</var></dfn>
- </ul>
- <dt>Media Queries<dd>
- <p>Implementations must support the Media Queries language. <a href=#refsMQ>[MQ]</a></p>
- <dt>CSS modules<dd>
- <p>While support for CSS as a whole is not required of implementations of this specification
- (though it is encouraged, at least for Web browsers), some features are defined in terms of
- specific CSS requirements.</p>
- <p>In particular, some features require that a string be <dfn id=parsed-as-a-css-color-value>parsed as a CSS <color>
- value</dfn>. When parsing a CSS value, user agents are required by the CSS specifications to
- apply some error handling rules. These apply to this specification also. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> <a href=#refsCSS>[CSS]</a></p>
- <p class=example>For example, user agents are required to close all open constructs upon
- finding the end of a style sheet unexpectedly. Thus, when parsing the string "<code>rgb(0,0,0</code>" (with a missing close-parenthesis) for a colour value, the close
- parenthesis is implied by this error handling rule, and a value is obtained (the colour 'black').
- However, the similar construct "<code>rgb(0,0,</code>" (with both a missing parenthesis
- and a missing "blue" value) cannot be parsed, as closing the open construct does not result in a
- viable value.</p>
- <p>The term <dfn id=css-element-reference-identifier>CSS element reference identifier</dfn> is used as defined in the <cite>CSS
- Image Values and Replaced Content</cite> specification to define the API that declares
- identifiers for use with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>Similarly, the term <dfn id=provides-a-paint-source>provides a paint source</dfn> is used as defined in the <cite>CSS
- Image Values and Replaced Content</cite> specification to define the interaction of certain HTML
- elements with the CSS 'element()' function. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>The term <dfn id=default-object-size>default object size</dfn> is also defined in the <cite>CSS Image Values and
- Replaced Content</cite> specification. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>Implementations that support scripting must support the CSS Object Model. The following
- features and terms are defined in the CSSOM specifications: <a href=#refsCSSOM>[CSSOM]</a> <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a>
- <ul class=brief><li><dfn id=screen><code>Screen</code></dfn> interface<li><dfn id=linkstyle><code>LinkStyle</code></dfn> interface<li><dfn id=cssstyledeclaration><code>CSSStyleDeclaration</code></dfn> interface<li><dfn id=dom-cssstyledeclaration-csstext><code>cssText</code></dfn> attribute of <code id=dependencies:cssstyledeclaration><a href=#cssstyledeclaration>CSSStyleDeclaration</a></code><li><dfn id=stylesheet><code>StyleSheet</code></dfn> interface<li>The terms <dfn id=create-a-css-style-sheet>create a CSS style sheet</dfn>, <dfn id=remove-a-css-style-sheet>remove a CSS style sheet</dfn>, and <dfn id=associated-css-style-sheet>associated CSS style sheet</dfn><li><dfn id=css-style-sheet>CSS style sheets</dfn> and their properties:
- <dfn id=concept-css-style-sheet-type>type</dfn>,
- <dfn id=concept-css-style-sheet-location>location</dfn>,
- <dfn id=concept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet</dfn>,
- <dfn id=concept-css-style-sheet-owner-node>owner node</dfn>,
- <dfn id=concept-css-style-sheet-owner-css-rule>owner CSS rule</dfn>,
- <dfn id=concept-css-style-sheet-media>media</dfn>,
- <dfn id=concept-css-style-sheet-title>title</dfn>,
- <dfn id=concept-css-style-sheet-alternate-flag>alternate flag</dfn>,
- <dfn id=concept-css-style-sheet-disabeld-flag>disabled flag</dfn>,
- <dfn id=concept-css-style-sheet-css-rules>CSS rules</dfn>,
- <dfn id=concept-css-style-sheet-origin-clean-flag>origin-clean flag</dfn>
- <li><dfn id=alternative-style-sheet-sets>Alternative style sheet sets</dfn> and the <dfn id=preferred-style-sheet-set>preferred style sheet set</dfn><li><dfn id=serialising-a-css-value>Serialising a CSS value</dfn><li><dfn id=scroll-an-element-into-view>Scroll an element into view</dfn><li><dfn id=scroll-to-the-beginning-of-the-document>Scroll to the beginning of the document</dfn><li>The <dfn id=event-resize><code>resize</code></dfn> event<li>The <dfn id=event-scroll><code>scroll</code></dfn> event<li><dfn id=dom-open-features><a href=http://dev.w3.org/csswg/cssom-view/#the-features-argument-to-the-open()-method>The <var>features</var> argument of <code>window.open</code></a></dfn>
- </ul>
- <p>The term <dfn id=environment-encoding>environment encoding</dfn> is defined in the <cite>CSS Syntax</cite>
- specifications. <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a></p>
- <p>The term <dfn id=css-styling-attribute>CSS styling attribute</dfn> is defined in the <cite>CSS Style Attributes</cite>
- specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>
- <p>The <code id=dependencies:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's use of fonts depends on the features
- described in the CSS <cite>Fonts</cite> and <cite>Font Loading</cite> specifications, including
- in particular <dfn id=fontface><code>FontFace</code></dfn> objects and the <dfn id=font-source><a href=http://dev.w3.org/csswg/css-font-loading/#font-source>font source</a></dfn> concept.
- <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
- <dt>SVG<dd>
- <p>The following interface is defined in the SVG specification: <a href=#refsSVG>[SVG]</a></p>
- <ul class=brief><li><dfn id=svgmatrix><code>SVGMatrix</code></dfn> interface
- </ul>
-
- <dt>WebGL<dd>
- <p>The following interface is defined in the WebGL specification: <a href=#refsWEBGL>[WEBGL]</a></p>
- <ul class=brief><li><dfn id=webglrenderingcontext><code>WebGLRenderingContext</code></dfn> interface
- </ul>
- <dt>WebVTT<dd>
- <p>Implementations may support WebVTT as a text track format for subtitles, captions, chapter
- titles, metadata, etc, for media resources. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>The following terms, used in this specification, are defined in the WebVTT specification:</p>
- <ul class=brief><li><dfn id=webvtt-file>WebVTT file</dfn>
- <li><dfn id=webvtt-file-using-cue-text>WebVTT file using cue text</dfn>
- <li><dfn id=webvtt-file-using-chapter-title-text>WebVTT file using chapter title text</dfn>
- <li><dfn id=webvtt-file-using-only-nested-cues>WebVTT file using only nested cues</dfn>
- <li><dfn id=webvtt-parser>WebVTT parser</dfn>
- <li>The <dfn id=rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</dfn>
- <li>The <dfn id=rules-for-interpreting-webvtt-cue-text>rules for interpreting WebVTT cue text</dfn>
- <li>The WebVTT <dfn id=text-track-cue-writing-direction>text track cue writing direction</dfn>
- <li><dfn id=vttcue><code>VTTCue</code></dfn> interface
- </ul>
- <dt>The WebSocket protocol<dd>
- <p>The following terms are defined in the WebSocket protocol specification: <a href=#refsWSP>[WSP]</a></p>
- <ul class=brief><li><dfn id=concept-websocket-establish>establish a WebSocket connection</dfn>
- <li><dfn id=concept-websocket-established>the WebSocket connection is established</dfn>
- <li><dfn id=concept-websocket-validate>validate the server's response</dfn>
- <li><dfn id=concept-websockets-active-extensions>extensions in use</dfn>
- <li><dfn id=concept-websocket-subprotocol>subprotocol in use</dfn>
- <li><dfn id=concept-websocket-cookie-headers>headers to send appropriate cookies</dfn>
- <li><dfn id=concept-websocket-handshake-cookies>cookies set during the server's opening handshake</dfn>
- <li><dfn id=concept-websocket-message-received>a WebSocket message has been received</dfn>
- <li><dfn id=concept-websocket-send>send a WebSocket Message</dfn>
- <li><dfn id=concept-websocket-fail>fail the WebSocket connection</dfn>
- <li><dfn id=concept-websocket-close>close the WebSocket connection</dfn>
- <li><dfn id=concept-websocket-start-closing-handshake>start the WebSocket closing handshake</dfn>
- <li><dfn id=concept-websocket-closing-handshake>the WebSocket closing handshake is started</dfn>
- <li><dfn id=concept-websocket-closed>the WebSocket connection is closed</dfn> (possibly <i>cleanly</i>)
- <li><dfn id=concept-websocket-close-code>the WebSocket connection close code</dfn>
- <li><dfn id=concept-websocket-close-reason>the WebSocket connection close reason</dfn>
- <li><dfn id=http-sec-websocket-protocol><code>Sec-WebSocket-Protocol</code></dfn> field
- </ul>
- <dt>ARIA<dd>
- <p>The terms <dfn id=strong-native-semantics><a href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header>strong
- native semantics</a></dfn> is used as defined in the ARIA specification. The term <dfn id=default-implicit-aria-semantics><a href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics>default implicit
- ARIA semantics</a></dfn> has the same meaning as the term <i>implicit WAI-ARIA semantics</i> as used
- in the ARIA specification. <a href=#refsARIA>[ARIA]</a></p>
- <p>The <dfn id=attr-aria-role><code>role</code></dfn> attribute is defined in the ARIA
- specification, as are the following roles: <a href=#refsARIA>[ARIA]</a></p>
- <ul class=brief><li><dfn id=attr-aria-role-alert><a href=http://www.w3.org/TR/wai-aria/roles#alert><code>alert</code></a></dfn><li><dfn id=attr-aria-role-alertdialog><a href=http://www.w3.org/TR/wai-aria/roles#alertdialog><code>alertdialog</code></a></dfn><li><dfn id=attr-aria-role-application><a href=http://www.w3.org/TR/wai-aria/roles#application><code>application</code></a></dfn><li><dfn id=attr-aria-role-article><a href=http://www.w3.org/TR/wai-aria/roles#article><code>article</code></a></dfn><li><dfn id=attr-aria-role-banner><a href=http://www.w3.org/TR/wai-aria/roles#banner><code>banner</code></a></dfn><li><dfn id=attr-aria-role-button><a href=http://www.w3.org/TR/wai-aria/roles#button><code>button</code></a></dfn><li><dfn id=attr-aria-role-checkbox><a href=http://www.w3.org/TR/wai-aria/roles#checkbox><code>checkbox</code></a></dfn><li><dfn id=attr-aria-role-columnheader><a href=http://www.w3.org/TR/wai-aria/roles#columnheader><code>columnheader</code></a></dfn><li><dfn id=attr-aria-role-combobox><a href=http://www.w3.org/TR/wai-aria/roles#combobox><code>combobox</code></a></dfn><li><dfn id=attr-aria-role-complementary><a href=http://www.w3.org/TR/wai-aria/roles#complementary><code>complementary</code></a></dfn><li><dfn id=attr-aria-role-contentinfo><a href=http://www.w3.org/TR/wai-aria/roles#contentinfo><code>contentinfo</code></a></dfn><li><dfn id=attr-aria-role-dialog><a href=http://www.w3.org/TR/wai-aria/roles#dialog><code>dialog</code></a></dfn><li><dfn id=attr-aria-role-directory><a href=http://www.w3.org/TR/wai-aria/roles#directory><code>directory</code></a></dfn><li><dfn id=attr-aria-role-document><a href=http://www.w3.org/TR/wai-aria/roles#document><code>document</code></a></dfn><li><dfn id=attr-aria-role-grid><a href=http://www.w3.org/TR/wai-aria/roles#grid><code>grid</code></a></dfn><li><dfn id=attr-aria-role-gridcell><a href=http://www.w3.org/TR/wai-aria/roles#gridcell><code>gridcell</code></a></dfn><li><dfn id=attr-aria-role-group><a href=http://www.w3.org/TR/wai-aria/roles#group><code>group</code></a></dfn><li><dfn id=attr-aria-role-heading><a href=http://www.w3.org/TR/wai-aria/roles#heading><code>heading</code></a></dfn><li><dfn id=attr-aria-role-img><a href=http://www.w3.org/TR/wai-aria/roles#img><code>img</code></a></dfn><li><dfn id=attr-aria-role-link><a href=http://www.w3.org/TR/wai-aria/roles#link><code>link</code></a></dfn><li><dfn id=attr-aria-role-list><a href=http://www.w3.org/TR/wai-aria/roles#list><code>list</code></a></dfn><li><dfn id=attr-aria-role-listbox><a href=http://www.w3.org/TR/wai-aria/roles#listbox><code>listbox</code></a></dfn><li><dfn id=attr-aria-role-listitem><a href=http://www.w3.org/TR/wai-aria/roles#listitem><code>listitem</code></a></dfn><li><dfn id=attr-aria-role-log><a href=http://www.w3.org/TR/wai-aria/roles#log><code>log</code></a></dfn><li><dfn id=attr-aria-role-main><a href=http://www.w3.org/TR/wai-aria/roles#main><code>main</code></a></dfn><li><dfn id=attr-aria-role-marquee><a href=http://www.w3.org/TR/wai-aria/roles#marquee><code>marquee</code></a></dfn><li><dfn id=attr-aria-role-menu><a href=http://www.w3.org/TR/wai-aria/roles#menu><code>menu</code></a></dfn><li><dfn id=attr-aria-role-menubar><a href=http://www.w3.org/TR/wai-aria/roles#menubar><code>menubar</code></a></dfn><li><dfn id=attr-aria-role-menuitem><a href=http://www.w3.org/TR/wai-aria/roles#menuitem><code>menuitem</code></a></dfn><li><dfn id=attr-aria-role-menuitemcheckbox><a href=http://www.w3.org/TR/wai-aria/roles#menuitemcheckbox><code>menuitemcheckbox</code></a></dfn><li><dfn id=attr-aria-role-menuitemradio><a href=http://www.w3.org/TR/wai-aria/roles#menuitemradio><code>menuitemradio</code></a></dfn><li><dfn id=attr-aria-role-navigation><a href=http://www.w3.org/TR/wai-aria/roles#navigation><code>navigation</code></a></dfn><li><dfn id=attr-aria-role-note><a href=http://www.w3.org/TR/wai-aria/roles#note><code>note</code></a></dfn><li><dfn id=attr-aria-role-option><a href=http://www.w3.org/TR/wai-aria/roles#option><code>option</code></a></dfn><li><dfn id=attr-aria-role-presentation><a href=http://www.w3.org/TR/wai-aria/roles#presentation><code>presentation</code></a></dfn><li><dfn id=attr-aria-role-progressbar><a href=http://www.w3.org/TR/wai-aria/roles#progressbar><code>progressbar</code></a></dfn><li><dfn id=attr-aria-role-radio><a href=http://www.w3.org/TR/wai-aria/roles#radio><code>radio</code></a></dfn><li><dfn id=attr-aria-role-region><a href=http://www.w3.org/TR/wai-aria/roles#region><code>region</code></a></dfn><li><dfn id=attr-aria-role-row><a href=http://www.w3.org/TR/wai-aria/roles#row><code>row</code></a></dfn><li><dfn id=attr-aria-role-rowgroup><a href=http://www.w3.org/TR/wai-aria/roles#rowgroup><code>rowgroup</code></a></dfn><li><dfn id=attr-aria-role-rowheader><a href=http://www.w3.org/TR/wai-aria/roles#rowheader><code>rowheader</code></a></dfn><li><dfn id=attr-aria-role-search><a href=http://www.w3.org/TR/wai-aria/roles#search><code>search</code></a></dfn><li><dfn id=attr-aria-role-separator><a href=http://www.w3.org/TR/wai-aria/roles#separator><code>separator</code></a></dfn><li><dfn id=attr-aria-role-slider><a href=http://www.w3.org/TR/wai-aria/roles#slider><code>slider</code></a></dfn><li><dfn id=attr-aria-role-spinbutton><a href=http://www.w3.org/TR/wai-aria/roles#spinbutton><code>spinbutton</code></a></dfn><li><dfn id=attr-aria-role-status><a href=http://www.w3.org/TR/wai-aria/roles#status><code>status</code></a></dfn><li><dfn id=attr-aria-role-tab><a href=http://www.w3.org/TR/wai-aria/roles#tab><code>tab</code></a></dfn><li><dfn id=attr-aria-role-tablist><a href=http://www.w3.org/TR/wai-aria/roles#tablist><code>tablist</code></a></dfn><li><dfn id=attr-aria-role-textbox><a href=http://www.w3.org/TR/wai-aria/roles#textbox><code>textbox</code></a></dfn><li><dfn id=attr-aria-role-toolbar><a href=http://www.w3.org/TR/wai-aria/roles#toolbar><code>toolbar</code></a></dfn><li><dfn id=attr-aria-role-tree><a href=http://www.w3.org/TR/wai-aria/roles#tree><code>tree</code></a></dfn><li><dfn id=attr-aria-role-treeitem><a href=http://www.w3.org/TR/wai-aria/roles#treeitem><code>treeitem</code></a></dfn></ul>
- <p>In addition, the following <dfn id=attr-aria-*><code>aria-*</code></dfn> content
- attributes are defined in the ARIA specification: <a href=#refsARIA>[ARIA]</a></p>
- <ul class=brief><li><dfn id=attr-aria-checked><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked><code>aria-checked</code></a></dfn><li><dfn id=attr-aria-describedby><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-describedby><code>aria-describedby</code></a></dfn><li><dfn id=attr-aria-disabled><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-disabled><code>aria-disabled</code></a></dfn><li><dfn id=attr-aria-expanded><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded><code>aria-expanded</code></a></dfn><li><dfn id=attr-aria-hidden><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden><code>aria-hidden</code></a></dfn><li><dfn id=attr-aria-invalid><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid><code>aria-invalid</code></a></dfn><li><dfn id=attr-aria-label><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-label><code>aria-label</code></a></dfn><li><dfn id=attr-aria-level><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level><code>aria-level</code></a></dfn><li><dfn id=attr-aria-multiline><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiline><code>aria-multiline</code></a></dfn><li><dfn id=attr-aria-multiselectable><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable><code>aria-multiselectable</code></a></dfn><li><dfn id=attr-aria-owns><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns><code>aria-owns</code></a></dfn><li><dfn id=attr-aria-readonly><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly><code>aria-readonly</code></a></dfn><li><dfn id=attr-aria-required><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-required><code>aria-required</code></a></dfn><li><dfn id=attr-aria-selected><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected><code>aria-selected</code></a></dfn><li><dfn id=attr-aria-sort><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort><code>aria-sort</code></a></dfn><li><dfn id=attr-aria-valuemax><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax><code>aria-valuemax</code></a></dfn><li><dfn id=attr-aria-valuemin><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin><code>aria-valuemin</code></a></dfn><li><dfn id=attr-aria-valuenow><a href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow><code>aria-valuenow</code></a></dfn></ul>
- </dl>
- <p>This specification does not <em>require</em> support of any particular network protocol, style
- sheet language, scripting language, or any of the DOM specifications beyond those required in the
- list above. However, the language described by this specification is biased towards CSS as the
- styling language, JavaScript as the scripting language, and HTTP as the network protocol, and
- several features assume that those languages and protocols are in use.</p>
- <p>A user agent that implements the HTTP protocol must implement the Web Origin Concept
- specification and the HTTP State Management Mechanism specification (Cookies) as well. <a href=#refsHTTP>[HTTP]</a> <a href=#refsORIGIN>[ORIGIN]</a> <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p class=note>This specification might have certain additional requirements on character
- encodings, image formats, audio formats, and video formats in the respective sections.</p>
- <h4 id=extensibility-2>2.2.3 Extensibility</h4>
- <p>Vendor-specific proprietary user agent extensions to this specification are strongly
- discouraged. Documents must not use such extensions, as doing so reduces interoperability and
- fragments the user base, allowing only users of specific user agents to access the content in
- question.</p>
-
- <p>If such extensions are nonetheless needed, e.g. for experimental purposes, then vendors are
- strongly urged to use one of the following extension mechanisms:</p>
- <ul><li><p>For markup-level features that can be limited to the XML serialisation and need not be
- supported in the HTML serialisation, vendors should use the namespace mechanism to define custom
- namespaces in which the non-standard elements and attributes are supported.</p>
- <li>
- <p>For markup-level features that are intended for use with <a href=#syntax id=extensibility-2:syntax>the HTML syntax</a>,
- extensions should be limited to new attributes of the form "<code>x-<var>vendor</var>-<var>feature</var></code>", where <var>vendor</var> is a short
- string that identifies the vendor responsible for the extension, and <var>feature</var> is the
- name of the feature. New element names should not be created. Using attributes for such
- extensions exclusively allows extensions from multiple vendors to co-exist on the same element,
- which would not be possible with elements. Using the "<code>x-<var>vendor</var>-<var>feature</var></code>" form allows extensions to be made
- without risk of conflicting with future additions to the specification.</p>
- <div class=example>
- <p>For instance, a browser named "FerretBrowser" could use "ferret" as a vendor prefix, while a
- browser named "Mellblom Browser" could use "mb". If both of these browsers invented extensions
- that turned elements into scratch-and-sniff areas, an author experimenting with these features
- could write:</p>
- <pre><p>This smells of lemons!
- <span x-ferret-smellovision x-ferret-smellcode="LEM01"
- x-mb-outputsmell x-mb-smell="lemon juice"></span></p></pre>
- </div>
- </ul>
- <p>Attribute names beginning with the two characters "<code>x-</code>" are reserved for
- user agent use and are guaranteed to never be formally added to the HTML language. For
- flexibility, attributes names containing underscores (the U+005F LOW LINE character) are also
- reserved for experimental purposes and are guaranteed to never be formally added to the HTML
- language.</p>
- <p class=note>Pages that use such attributes are by definition non-conforming.</p>
- <p>For DOM extensions, e.g. new methods and IDL attributes, the new members should be prefixed by
- vendor-specific strings to prevent clashes with future versions of this specification.</p>
- <p>For events, experimental event types should be prefixed with vendor-specific strings.</p>
- <div class=example>
- <p>For example, if a user agent called "Pleasold" were to add an event to indicate when
- the user is going up in an elevator, it could use the prefix "<code>pleasold</code>" and
- thus name the event "<code>pleasoldgoingup</code>", possibly with an event handler
- attribute named "<code>onpleasoldgoingup</code>".</p>
- </div>
- <p>All extensions must be defined so that the use of extensions neither contradicts nor causes the
- non-conformance of functionality defined in the specification.</p>
- <div class=example>
- <p>For example, while strongly discouraged from doing so, an implementation "Foo Browser" could
- add a new IDL attribute "<code>fooTypeTime</code>" to a control's DOM interface that
- returned the time it took the user to select the current value of a control (say). On the other
- hand, defining a new control that appears in a form's <code id=extensibility-2:dom-form-elements><a href=#dom-form-elements>elements</a></code> array would be in violation of the above requirement,
- as it would violate the definition of <code id=extensibility-2:dom-form-elements-2><a href=#dom-form-elements>elements</a></code> given in
- this specification.</p>
- </div>
- <p>When adding new <a href=#reflect id=extensibility-2:reflect>reflecting</a> IDL attributes corresponding to
- content attributes of the form "<code>x-<var>vendor</var>-<var>feature</var></code>",
- the IDL attribute should be named "<code><var>vendor</var><var>Feature</var></code>"
- (i.e. the "<code>x</code>" is dropped from the IDL attribute's name).</p>
-
- <hr>
- <p>When vendor-neutral extensions to this specification are needed, either this specification can
- be updated accordingly, or an extension specification can be written that overrides the
- requirements in this specification. When someone applying this specification to their activities
- decides that they will recognise the requirements of such an extension specification, it becomes
- an <dfn id=other-applicable-specifications>applicable specification</dfn> for the purposes of
- conformance requirements in this specification.</p>
- <p class=note>Someone could write a specification that defines any arbitrary byte stream as
- conforming, and then claim that their random junk is conforming. However, that does not mean that
- their random junk actually is conforming for everyone's purposes: if someone else decides that
- that specification does not apply to their work, then they can quite legitimately say that the
- aforementioned random junk is just that, junk, and not conforming at all. As far as conformance
- goes, what matters in a particular community is what that community <em>agrees</em> is
- applicable.</p>
-
- <hr>
- <p>User agents must treat elements and attributes that they do not understand as semantically
- neutral; leaving them in the DOM (for DOM processors), and styling them according to CSS (for CSS
- processors), but not inferring any meaning from them.</p>
- <p>When support for a feature is disabled (e.g. as an emergency measure to mitigate a security
- problem, or to aid in development, or for performance reasons), user agents must act as if they
- had no support for the feature whatsoever, and as if the feature was not mentioned in this
- specification. For example, if a particular feature is accessed via an attribute in a Web IDL
- interface, the attribute itself would be omitted from the objects that implement that interface
- — leaving the attribute on the object but making it return null or throw an exception is
- insufficient.</p>
-
-
- <h4 id=interactions-with-xpath-and-xslt>2.2.4 Interactions with XPath and XSLT</h4>
- <p id=xpath-1.0-processors>Implementations of XPath 1.0 that operate on <a href=#html-documents id=interactions-with-xpath-and-xslt:html-documents>HTML
- documents</a> parsed or created in the manners described in this specification (e.g. as part of
- the <code>document.evaluate()</code> API) must act as if the following edit was applied
- to the XPath 1.0 specification.</p>
- <p>First, remove this paragraph:</p>
- <blockquote cite=http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests>
- <p>A <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> in the node test is expanded
- into an <a href=http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name>expanded-name</a>
- using the namespace declarations from the expression context. This is the same way expansion is
- done for element type names in start and end-tags except that the default namespace declared with
- <code>xmlns</code> is not used: if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> does not have a prefix, then the
- namespace URI is null (this is the same way attribute names are expanded). It is an error if the
- <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> has a prefix for which there is
- no namespace declaration in the expression context.</p>
- </blockquote>
- <p>Then, insert in its place the following:</p>
- <blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">
- <p>A QName in the node test is expanded into an expanded-name using the namespace declarations
- from the expression context. If the QName has a prefix, then there must be a namespace declaration for this prefix in
- the expression context, and the corresponding namespace URI is the one that is
- associated with this prefix. It is an error if the QName has a prefix for which there is no
- namespace declaration in the expression context. </p>
- <p>If the QName has no prefix and the principal node type of the axis is element, then the
- default element namespace is used. Otherwise if the QName has no prefix, the namespace URI is
- null. The default element namespace is a member of the context for the XPath expression. The
- value of the default element namespace when executing an XPath expression through the DOM3 XPath
- API is determined in the following way:</p>
- <ol><li>If the context node is from an HTML DOM, the default element namespace is
- "http://www.w3.org/1999/xhtml".<li>Otherwise, the default element namespace URI is null.</ol>
- <p class=note>This is equivalent to adding the default element namespace feature of XPath 2.0
- to XPath 1.0, and using the HTML namespace as the default element namespace for HTML documents.
- It is motivated by the desire to have implementations be compatible with legacy HTML content
- while still supporting the changes that this specification introduces to HTML regarding the
- namespace used for HTML elements, and by the desire to use XPath 1.0 rather than XPath 2.0.</p>
- </blockquote>
- <p class=note>This change is a <a href=#willful-violation id=interactions-with-xpath-and-xslt:willful-violation>willful violation</a> of the XPath 1.0 specification,
- motivated by desire to have implementations be compatible with legacy content while still
- supporting the changes that this specification introduces to HTML regarding which namespace is
- used for HTML elements. <a href=#refsXPATH10>[XPATH10]</a></p>
- <hr>
- <p id=dom-based-xslt-1.0-processors>XSLT 1.0 processors outputting to a DOM when the output
- method is "html" (either explicitly or via the defaulting rule in XSLT 1.0) are affected as
- follows:</p>
- <p>If the transformation program outputs an element in no namespace, the processor must, prior to
- constructing the corresponding DOM element node, change the namespace of the element to the
- <a href=#html-namespace-2 id=interactions-with-xpath-and-xslt:html-namespace-2>HTML namespace</a>, <a href=#converted-to-ascii-lowercase id=interactions-with-xpath-and-xslt:converted-to-ascii-lowercase>ASCII-lowercase</a> the
- element's local name, and <a href=#converted-to-ascii-lowercase id=interactions-with-xpath-and-xslt:converted-to-ascii-lowercase-2>ASCII-lowercase</a> the
- names of any non-namespaced attributes on the element.</p>
- <p class=note>This requirement is a <a href=#willful-violation id=interactions-with-xpath-and-xslt:willful-violation-2>willful violation</a> of the XSLT 1.0
- specification, required because this specification changes the namespaces and case-sensitivity
- rules of HTML in a manner that would otherwise be incompatible with DOM-based XSLT
- transformations. (Processors that serialise the output are unaffected.) <a href=#refsXSLT10>[XSLT10]</a></p>
- <hr>
- <p>This specification does not specify precisely how XSLT processing interacts with the <a href=#html-parser id=interactions-with-xpath-and-xslt:html-parser>HTML
- parser</a> infrastructure (for example, whether an XSLT processor acts as if it puts any
- elements into a <a href=#stack-of-open-elements id=interactions-with-xpath-and-xslt:stack-of-open-elements>stack of open elements</a>). However, XSLT processors must <a href=#stop-parsing id=interactions-with-xpath-and-xslt:stop-parsing>stop
- parsing</a> if they successfully complete, and must set the <a href=#current-document-readiness id=interactions-with-xpath-and-xslt:current-document-readiness>current document
- readiness</a> first to "<code>interactive</code>" and then to "<code>complete</code>" if they are aborted.</p>
- <hr>
- <p>This specification does not specify how XSLT interacts with the <a href=#navigate id=interactions-with-xpath-and-xslt:navigate>navigation</a> algorithm, how it fits in with the <a href=#event-loop id=interactions-with-xpath-and-xslt:event-loop>event loop</a>, nor
- how error pages are to be handled (e.g. whether XSLT errors are to replace an incremental XSLT
- output, or are rendered inline, etc).</p>
- <p class=note>There are also additional non-normative comments regarding the interaction of XSLT
- and HTML <a href=#scriptTagXSLT>in the <code>script</code> element section</a>, and of
- XSLT, XPath, and HTML <a href=#template-XSLT-XPath>in the <code>template</code> element
- section</a>.</p>
-
- <h3 id=case-sensitivity-and-string-comparison>2.3 Case-sensitivity and string comparison</h3>
- <p>Comparing two strings in a <dfn id=case-sensitive>case-sensitive</dfn> manner means comparing them exactly, code
- point for code point.</p>
- <p>Comparing two strings in an <dfn id=ascii-case-insensitive>ASCII case-insensitive</dfn> manner means comparing them
- exactly, code point for code point, except that the characters in the range U+0041 to U+005A (i.e.
- LATIN CAPITAL LETTER A to LATIN CAPITAL LETTER Z) and the corresponding characters in the range
- U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL LETTER Z) are considered to also
- match.</p>
- <p>Comparing two strings in a <dfn id=compatibility-caseless>compatibility caseless</dfn> manner means using the Unicode
- <i>compatibility caseless match</i> operation to compare the two strings, with no
- language-specific tailoirings. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p>Except where otherwise stated, string comparisons must be performed in a
- <a href=#case-sensitive id=case-sensitivity-and-string-comparison:case-sensitive>case-sensitive</a> manner.</p>
-
- <p><dfn id=converted-to-ascii-uppercase>Converting a string to ASCII uppercase</dfn> means
- replacing all characters in the range U+0061 to U+007A (i.e. LATIN SMALL LETTER A to LATIN SMALL
- LETTER Z) with the corresponding characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL
- LETTER A to LATIN CAPITAL LETTER Z).</p>
- <p><dfn id=converted-to-ascii-lowercase>Converting a string to ASCII lowercase</dfn> means
- replacing all characters in the range U+0041 to U+005A (i.e. LATIN CAPITAL LETTER A to LATIN
- CAPITAL LETTER Z) with the corresponding characters in the range U+0061 to U+007A (i.e. LATIN
- SMALL LETTER A to LATIN SMALL LETTER Z).</p>
-
- <p>A string <var>pattern</var> is a <dfn id=prefix-match>prefix match</dfn> for a string <var>s</var> when
- <var>pattern</var> is not longer than <var>s</var> and truncating <var>s</var> to
- <var>pattern</var>'s length leaves the two strings as matches of each other.</p>
- <h3 id=common-microsyntaxes>2.4 Common microsyntaxes</h3>
- <p>There are various places in HTML that accept particular data types, such as dates or numbers.
- This section describes what the conformance criteria for content in those formats is, and how to
- parse them.</p>
-
- <p class=note>Implementors are strongly urged to carefully examine any third-party libraries
- they might consider using to implement the parsing of syntaxes described below. For example, date
- libraries are likely to implement error handling behavior that differs from what is required in
- this specification, since error-handling behavior is often not defined in specifications that
- describe date syntaxes similar to those used in this specification, and thus implementations tend
- to vary greatly in how they handle errors.</p>
-
-
- <h4 id=common-parser-idioms>2.4.1 Common parser idioms</h4>
-
- <p>The <dfn id=space-character>space characters</dfn>, for the purposes of this
- specification, are U+0020 SPACE, U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), and U+000D CARRIAGE RETURN (CR).</p>
- <p>The <dfn id=white_space>White_Space characters</dfn> are those that have the Unicode
- property "White_Space" in the Unicode <code>PropList.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p class=note>This should not be confused with the "White_Space" value (abbreviated "WS") of the
- "Bidi_Class" property in the <code>Unicode.txt</code> data file.</p>
- <p>The <dfn id=control-characters>control characters</dfn> are those whose Unicode "General_Category" property has the
- value "Cc" in the Unicode <code>UnicodeData.txt</code> data file. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p>The <dfn id=uppercase-ascii-letters>uppercase ASCII letters</dfn> are the characters in the range U+0041 LATIN CAPITAL
- LETTER A to U+005A LATIN CAPITAL LETTER Z.</p>
- <p>The <dfn id=lowercase-ascii-letters>lowercase ASCII letters</dfn> are the characters in the range U+0061 LATIN SMALL
- LETTER A to U+007A LATIN SMALL LETTER Z.</p>
- <p>The <dfn id=ascii-digits>ASCII digits</dfn> are the characters in the range U+0030 DIGIT ZERO (0) to U+0039
- DIGIT NINE (9).</p>
- <p>The <dfn id=alphanumeric-ascii-characters>alphanumeric ASCII characters</dfn> are those that are either <a href=#uppercase-ascii-letters id=common-parser-idioms:uppercase-ascii-letters>uppercase ASCII
- letters</a>, <a href=#lowercase-ascii-letters id=common-parser-idioms:lowercase-ascii-letters>lowercase ASCII letters</a>, or <a href=#ascii-digits id=common-parser-idioms:ascii-digits>ASCII digits</a>.</p>
- <p>The <dfn id=ascii-hex-digits>ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
- U+0039 DIGIT NINE (9), U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F, and U+0061
- LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F.</p>
- <p>The <dfn id=uppercase-ascii-hex-digits>uppercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO (0) to
- U+0039 DIGIT NINE (9) and U+0041 LATIN CAPITAL LETTER A to U+0046 LATIN CAPITAL LETTER F only.</p>
- <p>The <dfn id=lowercase-ascii-hex-digits>lowercase ASCII hex digits</dfn> are the characters in the ranges U+0030 DIGIT ZERO
- (0) to U+0039 DIGIT NINE (9) and U+0061 LATIN SMALL LETTER A to U+0066 LATIN SMALL LETTER F
- only.</p>
-
- <p>Some of the micro-parsers described below follow the pattern of having an <var>input</var>
- variable that holds the string being parsed, and having a <var>position</var> variable pointing at
- the next character to parse in <var>input</var>.</p>
- <p>For parsers based on this pattern, a step that requires the user agent to <dfn id=collect-a-sequence-of-characters>collect a
- sequence of characters</dfn> means that the following algorithm must be run, with
- <var>characters</var> being the set of characters that can be collected:</p>
- <ol><li><p>Let <var>input</var> and <var>position</var> be the same variables as
- those of the same name in the algorithm that invoked these steps.<li><p>Let <var>result</var> be the empty string.<li><p>While <var>position</var> doesn't point past the end of <var>input</var> and the character
- at <var>position</var> is one of the <var>characters</var>, append that character to the end of
- <var>result</var> and advance <var>position</var> to the next character in
- <var>input</var>.<li><p>Return <var>result</var>.</ol>
- <p>The step <dfn id=skip-whitespace>skip whitespace</dfn> means that the user agent must <a href=#collect-a-sequence-of-characters id=common-parser-idioms:collect-a-sequence-of-characters>collect a sequence of
- characters</a> that are <a href=#space-character id=common-parser-idioms:space-character>space characters</a>. The collected
- characters are not used. </p>
- <p>When a user agent is to <dfn id=strip-line-breaks>strip line breaks</dfn> from a string, the user agent must remove
- any U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters from that string.</p>
- <p>When a user agent is to <dfn id=strip-leading-and-trailing-whitespace>strip leading and trailing whitespace</dfn> from a string, the
- user agent must remove all <a href=#space-character id=common-parser-idioms:space-character-2>space characters</a> that are at the
- start or end of the string.</p>
- <p>When a user agent is to <dfn id=strip-and-collapse-whitespace>strip and collapse whitespace</dfn> in a string, it must replace
- any sequence of one or more consecutive <a href=#space-character id=common-parser-idioms:space-character-3>space characters</a> in
- that string with a single U+0020 SPACE character, and then <a href=#strip-leading-and-trailing-whitespace id=common-parser-idioms:strip-leading-and-trailing-whitespace>strip leading and trailing
- whitespace</a> from that string.</p>
- <p>When a user agent has to <dfn id=strictly-split-a-string>strictly split a string</dfn> on a particular delimiter character
- <var>delimiter</var>, it must use the following algorithm:</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Let <var>tokens</var> be an ordered list of tokens, initially empty.<li><p>While <var>position</var> is not past the end of <var>input</var>:</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=common-parser-idioms:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are not the <var>delimiter</var>
- character.<li><p>Append the string collected in the previous step to <var>tokens</var>.<li><p>Advance <var>position</var> to the next character in <var>input</var>.</ol>
- <li><p>Return <var>tokens</var>.</ol>
- <p class=note>For the special cases of splitting a string <a href=#split-a-string-on-spaces id=common-parser-idioms:split-a-string-on-spaces>on spaces</a> and <a href=#split-a-string-on-commas id=common-parser-idioms:split-a-string-on-commas>on commas</a>, this
- algorithm does not apply (those algorithms also perform <a href=#strip-leading-and-trailing-whitespace id=common-parser-idioms:strip-leading-and-trailing-whitespace-2>whitespace trimming</a>).</p>
-
- <h4 id=boolean-attributes>2.4.2 Boolean attributes</h4>
- <p>A number of attributes are <dfn id=boolean-attribute>boolean attributes</dfn>. The
- presence of a boolean attribute on an element represents the true value, and the absence of the
- attribute represents the false value.</p>
- <p>If the attribute is present, its value must either be the empty string or a value that is an
- <a href=#ascii-case-insensitive id=boolean-attributes:ascii-case-insensitive>ASCII case-insensitive</a> match for the attribute's canonical name, with no leading or
- trailing whitespace.</p>
- <p class=note>The values "true" and "false" are not allowed on boolean attributes. To represent
- a false value, the attribute has to be omitted altogether.</p>
- <div class=example>
- <p>Here is an example of a checkbox that is checked and disabled. The <code id=boolean-attributes:attr-input-checked><a href=#attr-input-checked>checked</a></code> and <code id=boolean-attributes:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>
- attributes are the boolean attributes.</p>
- <pre><label><input type=checkbox checked name=cheese disabled> Cheese</label></pre>
- <p>This could be equivalently written as this:
- <pre><label><input type=checkbox checked=checked name=cheese disabled=disabled> Cheese</label></pre>
- <p>You can also mix styles; the following is still equivalent:</p>
- <pre><label><input type='checkbox' checked name=cheese disabled=""> Cheese</label></pre>
- </div>
- <h4 id=keywords-and-enumerated-attributes>2.4.3 Keywords and enumerated attributes</h4>
- <p>Some attributes are defined as taking one of a finite set of keywords. Such attributes are
- called <dfn id=enumerated-attribute>enumerated attributes</dfn>. The keywords are each
- defined to map to a particular <em>state</em> (several keywords might map to the same state, in
- which case some of the keywords are synonyms of each other; additionally, some of the keywords can
- be said to be non-conforming, and are only in the specification for historical reasons). In
- addition, two default states can be given. The first is the <dfn id=invalid-value-default><i>invalid value default</i></dfn>, the
- second is the <dfn id=missing-value-default><i>missing value default</i></dfn>.</p>
- <p>If an enumerated attribute is specified, the attribute's value must be an <a href=#ascii-case-insensitive id=keywords-and-enumerated-attributes:ascii-case-insensitive>ASCII
- case-insensitive</a> match for one of the given keywords that are not said to be
- non-conforming, with no leading or trailing whitespace.</p>
- <p>When the attribute is specified, if its value is an <a href=#ascii-case-insensitive id=keywords-and-enumerated-attributes:ascii-case-insensitive-2>ASCII case-insensitive</a> match
- for one of the given keywords then that keyword's state is the state that the attribute
- represents. If the attribute value matches none of the given keywords, but the attribute has an
- <i id=keywords-and-enumerated-attributes:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i>, then the attribute represents that state. Otherwise, if the
- attribute value matches none of the keywords but there is a <i id=keywords-and-enumerated-attributes:missing-value-default><a href=#missing-value-default>missing value default</a></i> state
- defined, then <em>that</em> is the state represented by the attribute. Otherwise, there is no
- default, and invalid values mean that there is no state represented.</p>
- <p>When the attribute is <em>not</em> specified, if there is a <i id=keywords-and-enumerated-attributes:missing-value-default-2><a href=#missing-value-default>missing value default</a></i> state
- defined, then that is the state represented by the (missing) attribute. Otherwise, the absence of
- the attribute means that there is no state represented.</p>
- <p class=note>The empty string can be a valid keyword.</p>
- <h4 id=numbers>2.4.4 Numbers</h4>
- <h5 id=signed-integers>2.4.4.1 Signed integers</h5>
- <p>A string is a <dfn id=valid-integer>valid integer</dfn> if it consists of one or more <a href=#ascii-digits id=signed-integers:ascii-digits>ASCII digits</a>,
- optionally prefixed with a U+002D HYPHEN-MINUS character (-).</p>
- <p>A <a href=#valid-integer id=signed-integers:valid-integer>valid integer</a> without a U+002D HYPHEN-MINUS (-) prefix represents the number
- that is represented in base ten by that string of digits. A <a href=#valid-integer id=signed-integers:valid-integer-2>valid integer</a>
- <em>with</em> a U+002D HYPHEN-MINUS (-) prefix represents the number represented in base ten by
- the string of digits that follows the U+002D HYPHEN-MINUS, subtracted from zero.</p>
-
- <p>The <dfn id=rules-for-parsing-integers>rules for parsing integers</dfn> are as given in the following algorithm. When
- invoked, the steps must be followed in the order given, aborting at the first step that returns a
- value. This algorithm will return either an integer or an error.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially pointing at the
- start of the string.<li><p>Let <var>sign</var> have the value "positive".<li><p><a href=#skip-whitespace id=signed-integers:skip-whitespace>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, return an error.<li>
- <p>If the character indicated by <var>position</var> (the first character) is a U+002D
- HYPHEN-MINUS character (-):</p>
- <ol><li>Let <var>sign</var> be "negative".<li>Advance <var>position</var> to the next character.<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
- <p>Otherwise, if the character indicated by <var>position</var> (the first character) is a
- U+002B PLUS SIGN character (+):</p>
- <ol><li>Advance <var>position</var> to the next character. (The "<code>+</code>" is
- ignored, but it is not conforming.)<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
- <li><p>If the character indicated by <var>position</var> is not an <a href=#ascii-digits id=signed-integers:ascii-digits-2>ASCII digit</a>, then return an error.<li><p><a href=#collect-a-sequence-of-characters id=signed-integers:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=signed-integers:ascii-digits-3>ASCII digits</a>, and
- interpret the resulting sequence as a base-ten integer. Let <var>value</var> be that
- integer.<li><p>If <var>sign</var> is "positive", return <var>value</var>, otherwise return the result of
- subtracting <var>value</var> from zero.</ol>
-
- <h5 id=non-negative-integers>2.4.4.2 Non-negative integers</h5>
- <p>A string is a <dfn id=valid-non-negative-integer>valid non-negative integer</dfn> if it consists of one or more <a href=#ascii-digits id=non-negative-integers:ascii-digits>ASCII
- digits</a>.</p>
- <p>A <a href=#valid-non-negative-integer id=non-negative-integers:valid-non-negative-integer>valid non-negative integer</a> represents the number that is represented in base ten
- by that string of digits.</p>
-
- <p>The <dfn id=rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</dfn> are as given in the following algorithm.
- When invoked, the steps must be followed in the order given, aborting at the first step that
- returns a value. This algorithm will return either zero, a positive integer, or an error.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>value</var> be the result of parsing <var>input</var> using the
- <a href=#rules-for-parsing-integers id=non-negative-integers:rules-for-parsing-integers>rules for parsing integers</a>.<li><p>If <var>value</var> is an error, return an error.<li><p>If <var>value</var> is less than zero, return an error.<li><p>Return <var>value</var>.</ol>
-
-
- <h5 id=floating-point-numbers>2.4.4.3 Floating-point numbers</h5>
- <p>A string is a <dfn id=valid-floating-point-number>valid floating-point number</dfn> if it consists of:</p>
- <ol class=brief><li>Optionally, a U+002D HYPHEN-MINUS character (-).<li>One or both of the following, in the given order:
- <ol><li>A series of one or more <a href=#ascii-digits id=floating-point-numbers:ascii-digits>ASCII digits</a>.<li>
- <ol><li>A single U+002E FULL STOP character (.).<li>A series of one or more <a href=#ascii-digits id=floating-point-numbers:ascii-digits-2>ASCII digits</a>.</ol>
- </ol>
- <li>Optionally:
- <ol><li>Either a U+0065 LATIN SMALL LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E
- character (E).<li>Optionally, a U+002D HYPHEN-MINUS character (-) or U+002B PLUS SIGN character (+).<li>A series of one or more <a href=#ascii-digits id=floating-point-numbers:ascii-digits-3>ASCII digits</a>.</ol>
- </ol>
- <p>A <a href=#valid-floating-point-number id=floating-point-numbers:valid-floating-point-number>valid floating-point number</a> represents the number obtained by multiplying the
- significand by ten raised to the power of the exponent, where the significand is the first number,
- interpreted as base ten (including the decimal point and the number after the decimal point, if
- any, and interpreting the significand as a negative number if the whole string starts with a
- U+002D HYPHEN-MINUS character (-) and the number is not zero), and where the exponent is the
- number after the E, if any (interpreted as a negative number if there is a U+002D HYPHEN-MINUS
- character (-) between the E and the number and the number is not zero, or else ignoring a U+002B
- PLUS SIGN character (+) between the E and the number if there is one). If there is no E, then the
- exponent is treated as zero.</p>
- <p class=note>The Infinity and Not-a-Number (NaN) values are not <a href=#valid-floating-point-number id=floating-point-numbers:valid-floating-point-number-2>valid floating-point numbers</a>.</p>
-
- <p>The <dfn id=best-representation-of-the-number-as-a-floating-point-number>best
- representation of the number <var>n</var> as a floating-point number</dfn> is the string
- obtained from applying the JavaScript operator ToString to <var>n</var>. The JavaScript
- operator ToString is not uniquely determined. When there are multiple possible strings that could
- be obtained from the JavaScript operator ToString for a particular value, the user agent must
- always return the same string for that value (though it may differ from the value used by other
- user agents).</p>
- <p>The <dfn id=rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</dfn> are as given in the following
- algorithm. This algorithm must be aborted at the first step that returns something. This algorithm
- will return either a number or an error.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially pointing at the
- start of the string.<li><p>Let <var>value</var> have the value 1.<li><p>Let <var>divisor</var> have the value 1.<li><p>Let <var>exponent</var> have the value 1.<li><p><a href=#skip-whitespace id=floating-point-numbers:skip-whitespace>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, return an error.<li>
- <p>If the character indicated by <var>position</var> is a U+002D HYPHEN-MINUS character (-):</p>
- <ol><li>Change <var>value</var> and <var>divisor</var> to −1.<li>Advance <var>position</var> to the next character.<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
- <p>Otherwise, if the character indicated by <var>position</var> (the first character) is a
- U+002B PLUS SIGN character (+):</p>
- <ol><li>Advance <var>position</var> to the next character. (The "<code>+</code>"
- is ignored, but it is not conforming.)<li>If <var>position</var> is past the end of <var>input</var>, return an error.</ol>
- <li><p>If the character indicated by <var>position</var> is a U+002E FULL STOP (.), and that is
- not the last character in <var>input</var>, and the character after the character indicated by
- <var>position</var> is an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-4>ASCII digit</a>, then set
- <var>value</var> to zero and jump to the step labeled <i>fraction</i>.</p>
- <li><p>If the character indicated by <var>position</var> is not an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-5>ASCII digit</a>, then return an error.<li><p><a href=#collect-a-sequence-of-characters id=floating-point-numbers:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=floating-point-numbers:ascii-digits-6>ASCII digits</a>, and
- interpret the resulting sequence as a base-ten integer. Multiply <var>value</var> by that
- integer.<li>If <var>position</var> is past the end of <var>input</var>, jump to the step labeled
- <i>conversion</i>.<li><p><i>Fraction</i>: If the character indicated by <var>position</var> is a U+002E
- FULL STOP (.), run these substeps:</p>
- <ol><li><p>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, or if the character
- indicated by <var>position</var> is not an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-7>ASCII digit</a>,
- U+0065 LATIN SMALL LETTER E (e), or U+0045 LATIN CAPITAL LETTER E (E), then jump to the step
- labeled <i>conversion</i>.<li><p>If the character indicated by <var>position</var> is a U+0065 LATIN SMALL
- LETTER E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), skip the remainder of
- these substeps.</p>
- <li><p><i>Fraction loop</i>: Multiply <var>divisor</var> by ten.<li>Add the value of the character indicated by <var>position</var>, interpreted as a
- base-ten digit (0..9) and divided by <var>divisor</var>, to <var>value</var>.<li><p>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, then jump to the step
- labeled <i>conversion</i>.<li><p>If the character indicated by <var>position</var> is an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-8>ASCII digit</a>, jump back to the step labeled <i>fraction loop</i> in these
- substeps.</ol>
- <li><p>If the character indicated by <var>position</var> is a U+0065 LATIN SMALL LETTER
- E character (e) or a U+0045 LATIN CAPITAL LETTER E character (E), run these substeps:</p>
- <ol><li><p>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, then jump to the step
- labeled <i>conversion</i>.<li>
- <p>If the character indicated by <var>position</var> is a U+002D HYPHEN-MINUS character
- (-):</p>
- <ol><li>Change <var>exponent</var> to −1.<li>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, then jump to the step
- labeled <i>conversion</i>.</ol>
- <p>Otherwise, if the character indicated by <var>position</var> is a U+002B PLUS SIGN
- character (+):</p>
- <ol><li>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, then jump to the step
- labeled <i>conversion</i>.</ol>
- <li><p>If the character indicated by <var>position</var> is not an <a href=#ascii-digits id=floating-point-numbers:ascii-digits-9>ASCII digit</a>, then jump to the step labeled <i>conversion</i>.<li><p><a href=#collect-a-sequence-of-characters id=floating-point-numbers:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=floating-point-numbers:ascii-digits-10>ASCII digits</a>, and
- interpret the resulting sequence as a base-ten integer. Multiply <var>exponent</var>
- by that integer.<li><p>Multiply <var>value</var> by ten raised to the <var>exponent</var>th power.</ol>
- <li><p><i>Conversion</i>: Let <var>S</var> be the set of finite IEEE 754 double-precision
- floating-point values except −0, but with two special values added: 2<sup>1024</sup> and −2<sup>1024</sup>.<li><p>Let <var>rounded-value</var> be the number in <var>S</var> that is closest to
- <var>value</var>, selecting the number with an even significand if there are two equally close
- values. (The two special values 2<sup>1024</sup> and −2<sup>1024</sup>
- are considered to have even significands for this purpose.)<li><p>If <var>rounded-value</var> is 2<sup>1024</sup> or −2<sup>1024</sup>, return an error.<li><p>Return <var>rounded-value</var>.</ol>
-
- <h5 id=percentages-and-dimensions>2.4.4.4 Percentages and lengths</h5>
- <p>The <dfn id=rules-for-parsing-dimension-values>rules for parsing dimension values</dfn> are as given in the following algorithm. When
- invoked, the steps must be followed in the order given, aborting at the first step that returns a
- value. This algorithm will return either a number greater than or equal to 1.0, or an error; if a
- number is returned, then it is further categorised as either a percentage or a length.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially pointing at the
- start of the string.<li><p><a href=#skip-whitespace id=percentages-and-dimensions:skip-whitespace>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, return an error.<li><p>If the character indicated by <var>position</var> is a U+002B PLUS SIGN character (+),
- advance <var>position</var> to the next character.<li><p><a href=#collect-a-sequence-of-characters id=percentages-and-dimensions:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are U+0030 DIGIT ZERO (0) characters,
- and discard them.<li><p>If <var>position</var> is past the end of <var>input</var>, return an error.<li><p>If the character indicated by <var>position</var> is not one of U+0031 DIGIT ONE (1) to
- U+0039 DIGIT NINE (9), then return an error.<li><p><a href=#collect-a-sequence-of-characters id=percentages-and-dimensions:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=percentages-and-dimensions:ascii-digits>ASCII digits</a>, and
- interpret the resulting sequence as a base-ten integer. Let <var>value</var> be that number.<li><p>If <var>position</var> is past the end of <var>input</var>, return <var>value</var> as a
- length.<li>
- <p>If the character indicated by <var>position</var> is a U+002E FULL STOP character (.):</p>
- <ol><li><p>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, or if the character
- indicated by <var>position</var> is not an <a href=#ascii-digits id=percentages-and-dimensions:ascii-digits-2>ASCII digit</a>, then
- return <var>value</var> as a length.<li><p>Let <var>divisor</var> have the value 1.<li><p><i>Fraction loop</i>: Multiply <var>divisor</var> by ten.<li>Add the value of the character indicated by <var>position</var>, interpreted as a base-ten
- digit (0..9) and divided by <var>divisor</var>, to <var>value</var>.<li><p>Advance <var>position</var> to the next character.<li><p>If <var>position</var> is past the end of <var>input</var>, then return <var>value</var>
- as a length.<li><p>If the character indicated by <var>position</var> is an <a href=#ascii-digits id=percentages-and-dimensions:ascii-digits-3>ASCII digit</a>, return to the step labeled <i>fraction loop</i> in these
- substeps.</ol>
- <li><p>If <var>position</var> is past the end of <var>input</var>, return <var>value</var> as a
- length.<li><p>If the character indicated by <var>position</var> is a U+0025 PERCENT SIGN character (%),
- return <var>value</var> as a percentage.<li><p>Return <var>value</var> as a length.</ol>
-
- <h5 id=lists-of-integers>2.4.4.5 Lists of integers</h5>
- <p>A <dfn id=valid-list-of-integers>valid list of integers</dfn> is a number of <a href=#valid-integer id=lists-of-integers:valid-integer>valid
- integers</a> separated by U+002C COMMA characters, with no other characters (e.g. no <a href=#space-character id=lists-of-integers:space-character>space characters</a>). In addition, there might be restrictions on the
- number of integers that can be given, or on the range of values allowed.</p>
-
- <p>The <dfn id=rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</dfn> are as follows:</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially pointing at the
- start of the string.<li><p>Let <var>numbers</var> be an initially empty list of integers. This list will be the
- result of this algorithm.<li><p>If there is a character in the string <var>input</var> at position <var>position</var>,
- and it is either a U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then advance
- <var>position</var> to the next character in <var>input</var>, or to beyond the end of the string
- if there are no more characters.<li><p>If <var>position</var> points to beyond the end of <var>input</var>, return
- <var>numbers</var> and abort.<li><p>If the character in the string <var>input</var> at position <var>position</var> is a
- U+0020 SPACE, U+002C COMMA, or U+003B SEMICOLON character, then return to step 4.<li><p>Let <var>negated</var> be false.<li><p>Let <var>value</var> be 0.<li><p>Let <var>started</var> be false. This variable is set to true when the parser sees a
- number or a U+002D HYPHEN-MINUS character (-).<li><p>Let <var>got number</var> be false. This variable is set to true when the parser sees a
- number.<li><p>Let <var>finished</var> be false. This variable is set to true to switch parser into a
- mode where it ignores characters until the next separator.<li><p>Let <var>bogus</var> be false.<li><p><i>Parser</i>: If the character in the string <var>input</var> at position
- <var>position</var> is:</p>
- <dl class=switch><dt>A U+002D HYPHEN-MINUS character<dd>
- <p>Follow these substeps:</p>
- <ol><li>If <var>got number</var> is true, let <var>finished</var> be true.<li>If <var>finished</var> is true, skip to the next step in the overall set of steps.<li>If <var>started</var> is true, let <var>negated</var> be false.<li>Otherwise, if <var>started</var> is false and if <var>bogus</var> is false, let
- <var>negated</var> be true.<li>Let <var>started</var> be true.</ol>
- <dt>An <a href=#ascii-digits id=lists-of-integers:ascii-digits>ASCII digit</a><dd>
- <p>Follow these substeps:</p>
- <ol><li>If <var>finished</var> is true, skip to the next step in the overall set of steps.<li>Multiply <var>value</var> by ten.<li>Add the value of the digit, interpreted in base ten, to <var>value</var>.<li>Let <var>started</var> be true.<li>Let <var>got number</var> be true.</ol>
- <dt>A U+0020 SPACE character<dt>A U+002C COMMA character<dt>A U+003B SEMICOLON character<dd>
- <p>Follow these substeps:</p>
- <ol><li>If <var>got number</var> is false, return the <var>numbers</var> list and abort. This
- happens if an entry in the list has no digits, as in "<code>1,2,x,4</code>".<li>If <var>negated</var> is true, then negate <var>value</var>.<li>Append <var>value</var> to the <var>numbers</var> list.<li>Jump to step 4 in the overall set of steps.</ol>
- <dt>A character in the range U+0001 to U+001F, U+0021 to U+002B, U+002D to U+002F, U+003A, U+003C to U+0040, U+005B to U+0060, U+007b to U+007F
- (i.e. any other non-alphabetic ASCII character)<dd>
- <p>Follow these substeps:</p>
- <ol><li>If <var>got number</var> is true, let <var>finished</var> be true.<li>If <var>finished</var> is true, skip to the next step in the overall set of steps.<li>Let <var>negated</var> be false.</ol>
- <dt>Any other character<dd>
- <p>Follow these substeps:</p>
- <ol><li>If <var>finished</var> is true, skip to the next step in the overall set of steps.<li>Let <var>negated</var> be false.<li>Let <var>bogus</var> be true.<li>If <var>started</var> is true, then return the <var>numbers</var> list, and abort. (The
- value in <var>value</var> is not appended to the list first; it is dropped.)</ol>
- </dl>
- <li><p>Advance <var>position</var> to the next character in <var>input</var>, or to beyond the
- end of the string if there are no more characters.<li><p>If <var>position</var> points to a character (and not to beyond the end of
- <var>input</var>), jump to the big <i>Parser</i> step above.<li><p>If <var>negated</var> is true, then negate <var>value</var>.<li><p>If <var>got number</var> is true, then append <var>value</var> to the <var>numbers</var>
- list.<li><p>Return the <var>numbers</var> list and abort.</ol>
-
-
- <h5 id=lists-of-dimensions>2.4.4.6 Lists of dimensions</h5>
-
- <p>The <dfn id=rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</dfn> are as follows. These rules return a list
- of zero or more pairs consisting of a number and a unit, the unit being one of <i>percentage</i>,
- <i>relative</i>, and <i>absolute</i>.</p>
- <ol><li><p>Let <var>raw input</var> be the string being parsed.<li><p>If the last character in <var>raw input</var> is a U+002C COMMA character (,),
- then remove that character from <var>raw input</var>.<li><p><a href=#split-a-string-on-commas id=lists-of-dimensions:split-a-string-on-commas>Split the string <var>raw input</var> on
- commas</a>. Let <var>raw tokens</var> be the resulting list of tokens.<li><p>Let <var>result</var> be an empty list of number/unit pairs.<li>
- <p>For each token in <var>raw tokens</var>, run the following substeps:</p>
- <ol><li><p>Let <var>input</var> be the token.<li><p>Let <var>position</var> be a pointer into <var>input</var>,
- initially pointing at the start of the string.<li><p>Let <var>value</var> be the number 0.<li><p>Let <var>unit</var> be <i>absolute</i>.<li><p>If <var>position</var> is past the end of <var>input</var>, set <var>unit</var> to <i>relative</i> and jump to the last substep.<li><p>If the character at <var>position</var> is an <a href=#ascii-digits id=lists-of-dimensions:ascii-digits>ASCII digit</a>, <a href=#collect-a-sequence-of-characters id=lists-of-dimensions:collect-a-sequence-of-characters>collect a sequence of characters</a> that are <a href=#ascii-digits id=lists-of-dimensions:ascii-digits-2>ASCII
- digits</a>, interpret the resulting sequence as an integer in base ten, and increment <var>value</var> by that integer.<li>
- <p>If the character at <var>position</var> is a U+002E FULL STOP character (.), run
- these substeps:</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=lists-of-dimensions:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> consisting of <a href=#space-character id=lists-of-dimensions:space-character>space characters</a> and <a href=#ascii-digits id=lists-of-dimensions:ascii-digits-3>ASCII digits</a>. Let <var>s</var>
- be the resulting sequence.<li><p>Remove all <a href=#space-character id=lists-of-dimensions:space-character-2>space characters</a> in <var>s</var>.<li>
- <p>If <var>s</var> is not the empty string, run these subsubsteps:</p>
- <ol><li><p>Let <var>length</var> be the number of characters in <var>s</var> (after the spaces were removed).<li><p>Let <var>fraction</var> be the result of interpreting <var>s</var> as a base-ten integer, and then dividing that number by <span>10<sup><var>length</var></sup></span>.<li><p>Increment <var>value</var> by <var>fraction</var>.</ol>
- </ol>
- <li><p><a href=#skip-whitespace id=lists-of-dimensions:skip-whitespace>Skip whitespace</a>.<li>
- <p>If the character at <var>position</var> is a U+0025 PERCENT SIGN character (%),
- then set <var>unit</var> to <i>percentage</i>.</p>
- <p>Otherwise, if the character at <var>position</var> is a U+002A ASTERISK character
- (*), then set <var>unit</var> to <i>relative</i>.</p>
- <li><p>Add an entry to <var>result</var> consisting of the number given by <var>value</var> and the unit given by <var>unit</var>.</ol>
- <li><p>Return the list <var>result</var>.</ol>
-
- <h4 id=dates-and-times>2.4.5 Dates and times</h4>
- <p>In the algorithms below, the <dfn id=number-of-days-in-month-month-of-year-year>number of days in month <var>month</var> of year
- <var>year</var></dfn> is: <em>31</em> if <var>month</var> is 1, 3, 5, 7, 8,
- 10, or 12; <em>30</em> if <var>month</var> is 4, 6, 9, or 11; <em>29</em> if <var>month</var> is 2 and <var>year</var> is a number divisible by 400, or if <var>year</var> is a number divisible by 4 but not by 100; and <em>28</em> otherwise. This
- takes into account leap years in the Gregorian calendar. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>When <a href=#ascii-digits id=dates-and-times:ascii-digits>ASCII digits</a> are used in the date and time syntaxes defined in this section,
- they express numbers in base ten.</p>
-
- <p class=note>While the formats described here are intended to be subsets of the corresponding
- ISO8601 formats, this specification defines parsing rules in much more detail than ISO8601.
- Implementors are therefore encouraged to carefully examine any date parsing libraries before using
- them to implement the parsing rules described below; ISO8601 libraries might not parse dates and
- times in exactly the same manner. <a href=#refsISO8601>[ISO8601]</a></p>
-
- <p>Where this specification refers to the <dfn id=proleptic-gregorian-calendar>proleptic Gregorian calendar</dfn>, it means the
- modern Gregorian calendar, extrapolated backwards to year 1. A date in the <a href=#proleptic-gregorian-calendar id=dates-and-times:proleptic-gregorian-calendar>proleptic
- Gregorian calendar</a>, sometimes explicitly referred to as a <dfn id=proleptic-gregorian-date>proleptic-Gregorian
- date</dfn>, is one that is described using that calendar even if that calendar was not in use at
- the time (or place) in question. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p class=note>The use of the Gregorian calendar as the wire format in this specification is an
- arbitrary choice resulting from the cultural biases of those involved in the decision. See also
- the section discussing <a href=#input-author-notes>date, time, and number formats</a> in forms
- (for authors), <a href=#input-impl-notes>implemention notes regarding
- localization of form controls</a>, and the <code id=dates-and-times:the-time-element><a href=#the-time-element>time</a></code> element.</p>
- <h5 id=months>2.4.5.1 Months</h5>
- <p>A <dfn id=concept-month>month</dfn> consists of a specific <a href=#proleptic-gregorian-date id=months:proleptic-gregorian-date>proleptic-Gregorian
- date</a> with no time-zone information and no date information beyond a year and a month. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A string is a <dfn id=valid-month-string>valid month string</dfn> representing a year <var>year</var> and
- month <var>month</var> if it consists of the following components in the given order:</p>
- <ol><li>Four or more <a href=#ascii-digits id=months:ascii-digits>ASCII digits</a>, representing <var>year</var>, where <var>year</var> > 0<li>A U+002D HYPHEN-MINUS character (-)<li>Two <a href=#ascii-digits id=months:ascii-digits-2>ASCII digits</a>, representing the month <var>month</var>, in the range
- 1 ≤ <var>month</var> ≤ 12</ol>
-
- <p>The rules to <dfn id=parse-a-month-string>parse a month string</dfn> are as follows. This will return either a year and
- month, or nothing. If at any point the algorithm says that it "fails", this means that it is
- aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-month-component id=months:parse-a-month-component>Parse a month component</a> to obtain <var>year</var> and <var>month</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the
- end of <var>input</var>, then fail.<li><p>Return <var>year</var> and <var>month</var>.</ol>
- <p>The rules to <dfn id=parse-a-month-component>parse a month component</dfn>, given an <var>input</var> string and
- a <var>position</var>, are as follows. This will return either a year and a month, or
- nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
- point and returns nothing.</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=months:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=months:ascii-digits-3>ASCII digits</a>. If the
- collected sequence is not at least four characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>year</var>.<li><p>If <var>year</var> is not a number greater than zero, then fail.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
- Otherwise, move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=months:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=months:ascii-digits-4>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>month</var>.<li><p>If <var>month</var> is not a number in the range 1 ≤ <var>month</var> ≤ 12, then fail.<li><p>Return <var>year</var> and <var>month</var>.</ol>
-
- <h5 id=dates>2.4.5.2 Dates</h5>
- <p>A <dfn id=concept-date>date</dfn> consists of a specific <a href=#proleptic-gregorian-date id=dates:proleptic-gregorian-date>proleptic-Gregorian
- date</a> with no time-zone information, consisting of a year, a month, and a day. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A string is a <dfn id=valid-date-string>valid date string</dfn> representing a year <var>year</var>, month
- <var>month</var>, and day <var>day</var> if it consists of the following
- components in the given order:</p>
- <ol><li>A <a href=#valid-month-string id=dates:valid-month-string>valid month string</a>, representing <var>year</var> and <var>month</var><li>A U+002D HYPHEN-MINUS character (-)<li>Two <a href=#ascii-digits id=dates:ascii-digits>ASCII digits</a>, representing <var>day</var>, in the range
- 1 ≤ <var>day</var> ≤ <var>maxday</var> where <var>maxday</var> is the <a href=#number-of-days-in-month-month-of-year-year id=dates:number-of-days-in-month-month-of-year-year>number of
- days in the month <var>month</var> and year <var>year</var></a></ol>
-
- <p>The rules to <dfn id=parse-a-date-string>parse a date string</dfn> are as follows. This will return either a date, or
- nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
- point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-date-component id=dates:parse-a-date-component>Parse a date component</a> to obtain <var>year</var>, <var>month</var>, and <var>day</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Let <var>date</var> be the date with year <var>year</var>, month <var>month</var>, and day <var>day</var>.<li><p>Return <var>date</var>.</ol>
- <p>The rules to <dfn id=parse-a-date-component>parse a date component</dfn>, given an <var>input</var> string and a
- <var>position</var>, are as follows. This will return either a year, a month, and a day,
- or nothing. If at any point the algorithm says that it "fails", this means that it is aborted at
- that point and returns nothing.</p>
- <ol><li><p><a href=#parse-a-month-component id=dates:parse-a-month-component>Parse a month component</a> to obtain <var>year</var> and <var>month</var>. If this returns nothing, then fail.<li><p>Let <var>maxday</var> be the <a href=#number-of-days-in-month-month-of-year-year id=dates:number-of-days-in-month-month-of-year-year-2>number of days in month <var>month</var> of year <var>year</var></a>.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
- Otherwise, move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=dates:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=dates:ascii-digits-2>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>day</var>.<li><p>If <var>day</var> is not a number in the range 1 ≤ <var>day</var> ≤ <var>maxday</var>, then fail.<li><p>Return <var>year</var>, <var>month</var>, and <var>day</var>.</ol>
-
- <h5 id=yearless-dates>2.4.5.3 Yearless dates</h5>
- <p>A <dfn id=concept-yearless-date>yearless date</dfn> consists of a Gregorian month and a
- day within that month, but with no associated year. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A string is a <dfn id=valid-yearless-date-string>valid yearless date string</dfn> representing a month <var>month</var> and a day <var>day</var> if it consists of the following components
- in the given order:</p>
- <ol><li>Optionally, two U+002D HYPHEN-MINUS characters (-)<li>Two <a href=#ascii-digits id=yearless-dates:ascii-digits>ASCII digits</a>, representing the month <var>month</var>, in the range
- 1 ≤ <var>month</var> ≤ 12<li>A U+002D HYPHEN-MINUS character (-)<li>Two <a href=#ascii-digits id=yearless-dates:ascii-digits-2>ASCII digits</a>, representing <var>day</var>, in the range
- 1 ≤ <var>day</var> ≤ <var>maxday</var> where <var>maxday</var> is the <a href=#number-of-days-in-month-month-of-year-year id=yearless-dates:number-of-days-in-month-month-of-year-year>number of
- days</a> in the month <var>month</var> and any arbitrary leap year (e.g. 4 or
- 2000)</ol>
- <p class=note>In other words, if the <var>month</var> is "<code>02</code>",
- meaning February, then the day can be 29, as if the year was a leap year.</p>
-
- <p>The rules to <dfn id=parse-a-yearless-date-string>parse a yearless date string</dfn> are as follows. This will return either a
- month and a day, or nothing. If at any point the algorithm says that it "fails", this means that
- it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-yearless-date-component id=yearless-dates:parse-a-yearless-date-component>Parse a yearless date component</a> to obtain <var>month</var> and <var>day</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Return <var>month</var> and <var>day</var>.</ol>
- <p>The rules to <dfn id=parse-a-yearless-date-component>parse a yearless date component</dfn>, given an <var>input</var>
- string and a <var>position</var>, are as follows. This will return either a month and a
- day, or nothing. If at any point the algorithm says that it "fails", this means that it is aborted
- at that point and returns nothing.</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=yearless-dates:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are U+002D HYPHEN-MINUS characters (-).
- If the collected sequence is not exactly zero or two characters long, then fail.<li><p><a href=#collect-a-sequence-of-characters id=yearless-dates:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=yearless-dates:ascii-digits-3>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>month</var>.<li><p>If <var>month</var> is not a number in the range 1 ≤ <var>month</var> ≤ 12, then fail.<li><p>Let <var>maxday</var> be the <a href=#number-of-days-in-month-month-of-year-year id=yearless-dates:number-of-days-in-month-month-of-year-year-2>number of days</a> in month <var>month</var> of any arbitrary leap year (e.g. 4
- or 2000).<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
- Otherwise, move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=yearless-dates:collect-a-sequence-of-characters-3>Collect a sequence of characters</a> that are <a href=#ascii-digits id=yearless-dates:ascii-digits-4>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>day</var>.<li><p>If <var>day</var> is not a number in the range 1 ≤ <var>day</var> ≤ <var>maxday</var>, then fail.<li><p>Return <var>month</var> and <var>day</var>.</ol>
-
- <h5 id=times>2.4.5.4 Times</h5>
- <p>A <dfn id=concept-time>time</dfn> consists of a specific time with no time-zone
- information, consisting of an hour, a minute, a second, and a fraction of a second.</p>
- <p>A string is a <dfn id=valid-time-string>valid time string</dfn> representing an hour <var>hour</var>, a
- minute <var>minute</var>, and a second <var>second</var> if it consists of the
- following components in the given order:</p>
- <ol><li>Two <a href=#ascii-digits id=times:ascii-digits>ASCII digits</a>, representing <var>hour</var>, in the range
- 0 ≤ <var>hour</var> ≤ 23<li>A U+003A COLON character (:)<li>Two <a href=#ascii-digits id=times:ascii-digits-2>ASCII digits</a>, representing <var>minute</var>, in the range
- 0 ≤ <var>minute</var> ≤ 59<li>If <var>second</var> is non-zero, or optionally if <var>second</var> is
- zero:
- <ol><li>A U+003A COLON character (:)<li>Two <a href=#ascii-digits id=times:ascii-digits-3>ASCII digits</a>, representing the integer part of <var>second</var>,
- in the range 0 ≤ <var>s</var> ≤ 59<li>If <var>second</var> is not an integer, or optionally if <var>second</var> is an integer:
- <ol><li>A 002E FULL STOP character (.)<li>One, two, or three <a href=#ascii-digits id=times:ascii-digits-4>ASCII digits</a>, representing the fractional part of <var>second</var></ol>
- </ol>
- </ol>
- <p class=note>The <var>second</var> component cannot be 60 or 61; leap seconds cannot
- be represented.</p>
-
- <p>The rules to <dfn id=parse-a-time-string>parse a time string</dfn> are as follows. This will return either a time, or
- nothing. If at any point the algorithm says that it "fails", this means that it is aborted at that
- point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-time-component id=times:parse-a-time-component>Parse a time component</a> to obtain <var>hour</var>, <var>minute</var>, and <var>second</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Let <var>time</var> be the time with hour <var>hour</var>, minute <var>minute</var>, and second <var>second</var>.<li><p>Return <var>time</var>.</ol>
- <p>The rules to <dfn id=parse-a-time-component>parse a time component</dfn>, given an <var>input</var> string and a
- <var>position</var>, are as follows. This will return either an hour, a minute, and a
- second, or nothing. If at any point the algorithm says that it "fails", this means that it is
- aborted at that point and returns nothing.</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=times:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=times:ascii-digits-5>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>hour</var>.<li>If <var>hour</var> is not a number in the range 0 ≤ <var>hour</var> ≤ 23, then fail.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+003A COLON character, then fail. Otherwise,
- move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=times:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=times:ascii-digits-6>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>minute</var>.<li>If <var>minute</var> is not a number in the range 0 ≤ <var>minute</var> ≤ 59, then fail.<li><p>Let <var>second</var> be a string with the value "0".<li>
- <p>If <var>position</var> is not beyond the end of <var>input</var> and the
- character at <var>position</var> is a U+003A COLON, then run these substeps:</p>
- <ol><li><p>Advance <var>position</var> to the next character in <var>input</var>.<li><p>If <var>position</var> is beyond the end of <var>input</var>, or at
- the last character in <var>input</var>, or if the next <em>two</em> characters in <var>input</var> starting at <var>position</var> are not both <a href=#ascii-digits id=times:ascii-digits-7>ASCII
- digits</a>, then fail.<li><p><a href=#collect-a-sequence-of-characters id=times:collect-a-sequence-of-characters-3>Collect a sequence of characters</a> that are either <a href=#ascii-digits id=times:ascii-digits-8>ASCII digits</a>
- or U+002E FULL STOP characters. If the collected sequence is three characters long, or if it is
- longer than three characters long and the third character is not a U+002E FULL STOP character,
- or if it has more than one U+002E FULL STOP character, then fail. Otherwise, let the collected
- string be <var>second</var> instead of its previous value.</ol>
- <li><p>Interpret <var>second</var> as a base-ten number (possibly with a fractional
- part). Let <var>second</var> be that number instead of the string version.<li><p>If <var>second</var> is not a number in the range 0 ≤ <var>second</var> < 60, then fail.<li><p>Return <var>hour</var>, <var>minute</var>, and <var>second</var>.</ol>
-
- <h5 id=local-dates-and-times>2.4.5.5 Local dates and times</h5>
- <p>A <dfn id=concept-datetime-local>local date and time</dfn> consists of a specific
- <a href=#proleptic-gregorian-date id=local-dates-and-times:proleptic-gregorian-date>proleptic-Gregorian date</a>, consisting of a year, a month, and a day, and a time,
- consisting of an hour, a minute, a second, and a fraction of a second, but expressed without a
- time zone. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A string is a <dfn id=valid-local-date-and-time-string>valid local date and time string</dfn> representing a date and time if it
- consists of the following components in the given order:</p>
- <ol><li>A <a href=#valid-date-string id=local-dates-and-times:valid-date-string>valid date string</a> representing the date<li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character<li>A <a href=#valid-time-string id=local-dates-and-times:valid-time-string>valid time string</a> representing the time</ol>
- <p>A string is a <dfn id=valid-normalised-local-date-and-time-string>valid normalised local date and time string</dfn> representing a date and
- time if it consists of the following components in the given order:</p>
- <ol><li>A <a href=#valid-date-string id=local-dates-and-times:valid-date-string-2>valid date string</a> representing the date<li>A U+0054 LATIN CAPITAL LETTER T character (T)<li>A <a href=#valid-time-string id=local-dates-and-times:valid-time-string-2>valid time string</a> representing the time, expressed as the shortest possible
- string for the given time (e.g. omitting the seconds component entirely if the given time is zero
- seconds past the minute)</ol>
-
- <p>The rules to <dfn id=parse-a-local-date-and-time-string>parse a local date and time string</dfn> are as follows. This will return
- either a date and time, or nothing. If at any point the algorithm says that it "fails", this means
- that it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-date-component id=local-dates-and-times:parse-a-date-component>Parse a date component</a> to obtain <var>year</var>, <var>month</var>, and <var>day</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
- (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var>position</var>
- forwards one character.<li><p><a href=#parse-a-time-component id=local-dates-and-times:parse-a-time-component>Parse a time component</a> to obtain <var>hour</var>, <var>minute</var>, and <var>second</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Let <var>date</var> be the date with year <var>year</var>, month <var>month</var>, and day <var>day</var>.<li><p>Let <var>time</var> be the time with hour <var>hour</var>, minute <var>minute</var>, and second <var>second</var>.<li><p>Return <var>date</var> and <var>time</var>.</ol>
-
- <h5 id=time-zones>2.4.5.6 Time zones</h5>
- <p>A <dfn id=concept-timezone>time-zone offset</dfn> consists of a signed number of hours and
- minutes.</p>
- <p>A string is a <dfn id=valid-time-zone-offset-string>valid time-zone offset string</dfn> representing a time-zone offset if it
- consists of either:</p>
- <ul><li><p>A U+005A LATIN CAPITAL LETTER Z character (Z), allowed only if the time zone is
- UTC<li>
- <p>Or, the following components, in the given order:</p>
- <ol><li>Either a U+002B PLUS SIGN character (+) or, if the time-zone offset is not zero, a U+002D
- HYPHEN-MINUS character (-), representing the sign of the time-zone offset<li>Two <a href=#ascii-digits id=time-zones:ascii-digits>ASCII digits</a>, representing the hours component <var>hour</var> of
- the time-zone offset, in the range 0 ≤ <var>hour</var> ≤ 23<li>Optionally, a U+003A COLON character (:)<li>Two <a href=#ascii-digits id=time-zones:ascii-digits-2>ASCII digits</a>, representing the minutes component <var>minute</var> of the time-zone offset, in the range 0 ≤ <var>minute</var> ≤ 59</ol>
- </ul>
- <p class=note>This format allows for time-zone offsets from -23:59 to +23:59. Right now, in
- practice, the range of offsets of actual time zones is -12:00 to +14:00, and the minutes component
- of offsets of actual time zones is always either 00, 30, or 45. There is no guarantee that this
- will remain so forever, however, since time zones are used as political footballs and are thus
- subject to very whimsical policy decisions.</p>
- <p class=note>See also the usage notes and examples in the <a href=#concept-datetime id=time-zones:concept-datetime>global
- date and time</a> section below for details on using time-zone offsets with historical times
- that predate the formation of formal time zones.</p>
-
- <p>The rules to <dfn id=parse-a-time-zone-offset-string>parse a time-zone offset string</dfn> are as follows. This will return either
- a time-zone offset, or nothing. If at any point the algorithm says that it "fails", this means
- that it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-time-zone-offset-component id=time-zones:parse-a-time-zone-offset-component>Parse a time-zone offset component</a> to obtain <var>timezone<sub>hours</sub></var> and <var>timezone<sub>minutes</sub></var>. If this
- returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Return the time-zone offset that is <var>timezone<sub>hours</sub></var>
- hours and <var>timezone<sub>minutes</sub></var> minutes from UTC.</ol>
- <p>The rules to <dfn id=parse-a-time-zone-offset-component>parse a time-zone offset component</dfn>, given an <var>input</var>
- string and a <var>position</var>, are as follows. This will return either time-zone hours
- and time-zone minutes, or nothing. If at any point the algorithm says that it "fails", this means
- that it is aborted at that point and returns nothing.</p>
- <ol><li>
- <p>If the character at <var>position</var> is a U+005A LATIN CAPITAL LETTER Z character
- (Z), then:</p>
- <ol><li><p>Let <var>timezone<sub>hours</sub></var> be 0.<li><p>Let <var>timezone<sub>minutes</sub></var> be 0.<li><p>Advance <var>position</var> to the next character in <var>input</var>.</ol>
- <p>Otherwise, if the character at <var>position</var> is either a U+002B PLUS SIGN (+)
- or a U+002D HYPHEN-MINUS (-), then:</p>
- <ol><li><p>If the character at <var>position</var> is a U+002B PLUS SIGN (+), let <var>sign</var> be "positive". Otherwise, it's a U+002D HYPHEN-MINUS (-); let <var>sign</var> be "negative".<li><p>Advance <var>position</var> to the next character in <var>input</var>.<li><p><a href=#collect-a-sequence-of-characters id=time-zones:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=time-zones:ascii-digits-3>ASCII digits</a>. Let
- <var>s</var> be the collected sequence.<li>
- <p>If <var>s</var> is exactly two characters long, then run these substeps:</p>
- <ol><li><p>Interpret <var>s</var> as a base-ten integer. Let that number be the <var>timezone<sub>hours</sub></var>.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if
- the character at <var>position</var> is not a U+003A COLON character, then fail.
- Otherwise, move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=time-zones:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=time-zones:ascii-digits-4>ASCII digits</a>. If
- the collected sequence is not exactly two characters long, then fail. Otherwise, interpret
- the resulting sequence as a base-ten integer. Let that number be the <var>timezone<sub>minutes</sub></var>.</ol>
- <p>If <var>s</var> is exactly four characters long, then run these substeps:</p>
- <ol><li><p>Interpret the first two characters of <var>s</var> as a base-ten integer. Let
- that number be the <var>timezone<sub>hours</sub></var>.<li><p>Interpret the last two characters of <var>s</var> as a base-ten integer. Let
- that number be the <var>timezone<sub>minutes</sub></var>.</ol>
- <p>Otherwise, fail.</p>
- <li>If <var>timezone<sub>hours</sub></var> is not a number in the range
- 0 ≤ <var>timezone<sub>hours</sub></var> ≤ 23, then
- fail.<li>If <var>sign</var> is "negative", then negate <var>timezone<sub>hours</sub></var>.<li>If <var>timezone<sub>minutes</sub></var> is not a number in the range
- 0 ≤ <var>timezone<sub>minutes</sub></var> ≤ 59,
- then fail.<li>If <var>sign</var> is "negative", then negate <var>timezone<sub>minutes</sub></var>.</ol>
- <p>Otherwise, fail.</p>
- <li><p>Return <var>timezone<sub>hours</sub></var> and <var>timezone<sub>minutes</sub></var>.</ol>
-
- <h5 id=global-dates-and-times>2.4.5.7 Global dates and times</h5>
- <p>A <dfn id=concept-datetime>global date and time</dfn> consists of a specific
- <a href=#proleptic-gregorian-date id=global-dates-and-times:proleptic-gregorian-date>proleptic-Gregorian date</a>, consisting of a year, a month, and a day, and a time,
- consisting of an hour, a minute, a second, and a fraction of a second, expressed with a time-zone
- offset, consisting of a signed number of hours and minutes. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A string is a <dfn id=valid-global-date-and-time-string>valid global date and time string</dfn> representing a date, time, and a
- time-zone offset if it consists of the following components in the given order:</p>
- <ol><li>A <a href=#valid-date-string id=global-dates-and-times:valid-date-string>valid date string</a> representing the date<li>A U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character<li>A <a href=#valid-time-string id=global-dates-and-times:valid-time-string>valid time string</a> representing the time<li>A <a href=#valid-time-zone-offset-string id=global-dates-and-times:valid-time-zone-offset-string>valid time-zone offset string</a> representing the time-zone offset</ol>
- <p>Times in dates before the formation of UTC in the mid twentieth century must be expressed and
- interpreted in terms of UT1 (contemporary Earth solar time at the 0° longitude), not UTC (the
- approximation of UT1 that ticks in SI seconds). Time before the formation of time zones must be
- expressed and interpeted as UT1 times with explicit time zones that approximate the contemporary
- difference between the appropriate local time and the time observed at the location of Greenwich,
- London.</p>
- <div class=example>
- <p>The following are some examples of dates written as <a href=#valid-global-date-and-time-string id=global-dates-and-times:valid-global-date-and-time-string>valid global date and time strings</a>.</p>
- <dl><dt>"<code>0037-12-13 00:00Z</code>"<dd>Midnight in areas using London time on the birthday of Nero (the Roman Emperor). See below
- for further discussion on which date this actually corresponds to.<dt>"<code>1979-10-14T12:00:00.001-04:00</code>"<dd>One millisecond after noon on October 14th 1979, in the time zone in use on the east coast
- of the USA during daylight saving time.<dt>"<code>8592-01-01T02:09+02:09</code>"<dd>Midnight UTC on the 1st of January, 8592. The time zone associated with that time is two
- hours and nine minutes ahead of UTC, which is not currently a real time zone, but is nonetheless
- allowed.</dl>
- <p>Several things are notable about these dates:</p>
- <ul><li>Years with fewer than four digits have to be zero-padded. The date "37-12-13" would not be a
- valid date.<li>If the "<code>T</code>" is replaced by a space, it must be a single space
- character. The string "<code>2001-12-21 12:00Z</code>" (with two spaces
- between the components) would not be parsed successfully.<li>To unambiguously identify a moment in time prior to the introduction of the Gregorian
- calendar (insofar as moments in time before the formation of UTC can be unambiguously
- identified), the date has to be first converted to the Gregorian calendar from the calendar in
- use at the time (e.g. from the Julian calendar). The date of Nero's birth is the 15th of
- December 37, in the Julian Calendar, which is the 13th of December 37 in the <a href=#proleptic-gregorian-calendar id=global-dates-and-times:proleptic-gregorian-calendar>proleptic
- Gregorian calendar</a>.<li>The time and time-zone offset components are not optional.<li>Dates before the year one can't be represented as a datetime in this version of HTML.<li>Times of specific events in ancient times are, at best, approximations, since time was not
- well coordinated or measured until relatively recent decades.<li>Time-zone offsets differ based on daylight savings time.</ul>
- </div>
- <p>A string is a <dfn id=valid-normalised-forced-utc-global-date-and-time-string>valid normalised forced-UTC global date and time string</dfn> representing a
- date, time, and a time-zone offset if it consists of the following components in the given
- order:</p>
- <ol><li>A <a href=#valid-date-string id=global-dates-and-times:valid-date-string-2>valid date string</a> representing the date converted to the UTC time zone<li>A U+0054 LATIN CAPITAL LETTER T character (T)<li>A <a href=#valid-time-string id=global-dates-and-times:valid-time-string-2>valid time string</a> representing the time converted to the UTC time zone and
- expressed as the shortest possible string for the given time (e.g. omitting the seconds component
- entirely if the given time is zero seconds past the minute)<li>A U+005A LATIN CAPITAL LETTER Z character (Z)</ol>
-
- <p>The rules to <dfn id=parse-a-global-date-and-time-string>parse a global date and time string</dfn> are as follows. This will return
- either a time in UTC, with associated time-zone offset information for round-tripping or display
- purposes, or nothing. If at any point the algorithm says that it "fails", this means that it is
- aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#parse-a-date-component id=global-dates-and-times:parse-a-date-component>Parse a date component</a> to obtain <var>year</var>, <var>month</var>, and <var>day</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is neither a U+0054 LATIN CAPITAL LETTER T character
- (T) nor a U+0020 SPACE character, then fail. Otherwise, move <var>position</var>
- forwards one character.<li><p><a href=#parse-a-time-component id=global-dates-and-times:parse-a-time-component>Parse a time component</a> to obtain <var>hour</var>, <var>minute</var>, and <var>second</var>. If this returns nothing, then fail.</p>
- <li><p>If <var>position</var> is beyond the end of <var>input</var>, then
- fail.<li><p><a href=#parse-a-time-zone-offset-component id=global-dates-and-times:parse-a-time-zone-offset-component>Parse a time-zone offset component</a> to obtain <var>timezone<sub>hours</sub></var> and <var>timezone<sub>minutes</sub></var>. If this
- returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Let <var>time</var> be the moment in time at year <var>year</var>, month
- <var>month</var>, day <var>day</var>, hours <var>hour</var>, minute
- <var>minute</var>, second <var>second</var>, subtracting <var>timezone<sub>hours</sub></var> hours and <var>timezone<sub>minutes</sub></var> minutes. That moment in time is a moment in the UTC time
- zone.<li><p>Let <var>timezone</var> be <var>timezone<sub>hours</sub></var>
- hours and <var>timezone<sub>minutes</sub></var> minutes from UTC.<li><p>Return <var>time</var> and <var>timezone</var>.</ol>
-
- <h5 id=weeks>2.4.5.8 Weeks</h5>
- <p>A <dfn id=concept-week>week</dfn> consists of a week-year number and a week number
- representing a seven-day period starting on a Monday. Each week-year in this calendaring system
- has either 52 or 53 such seven-day periods, as defined below. The seven-day period starting on the
- Gregorian date Monday December 29th 1969 (1969-12-29) is defined as week number 1 in week-year
- 1970. Consecutive weeks are numbered sequentially. The week before the number 1 week in a
- week-year is the last week in the previous week-year, and vice versa. <a href=#refsGREGORIAN>[GREGORIAN]</a></p>
- <p>A week-year with a number <var>year</var> has 53 weeks if it corresponds to either a
- year <var>year</var> in the <a href=#proleptic-gregorian-calendar id=weeks:proleptic-gregorian-calendar>proleptic Gregorian calendar</a> that has a Thursday
- as its first day (January 1st), or a year <var>year</var> in the <a href=#proleptic-gregorian-calendar id=weeks:proleptic-gregorian-calendar-2>proleptic
- Gregorian calendar</a> that has a Wednesday as its first day (January 1st) and where <var>year</var> is a number divisible by 400, or a number divisible by 4 but not by 100. All
- other week-years have 52 weeks.</p>
- <p>The <dfn id=week-number-of-the-last-day>week number of the last day</dfn> of a week-year with 53 weeks is 53; the week number
- of the last day of a week-year with 52 weeks is 52.</p>
- <p class=note>The week-year number of a particular day can be different than the number of the
- year that contains that day in the <a href=#proleptic-gregorian-calendar id=weeks:proleptic-gregorian-calendar-3>proleptic Gregorian calendar</a>. The first week in a
- week-year <var>y</var> is the week that contains the first Thursday of the Gregorian year
- <var>y</var>.</p>
- <p class=note>For modern purposes, a <a href=#concept-week id=weeks:concept-week>week</a> as defined here is
- equivalent to ISO weeks as defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>
- <p>A string is a <dfn id=valid-week-string>valid week string</dfn> representing a week-year <var>year</var>
- and week <var>week</var> if it consists of the following components in the given
- order:</p>
- <ol><li>Four or more <a href=#ascii-digits id=weeks:ascii-digits>ASCII digits</a>, representing <var>year</var>, where <var>year</var> > 0<li>A U+002D HYPHEN-MINUS character (-)<li>A U+0057 LATIN CAPITAL LETTER W character (W)<li>Two <a href=#ascii-digits id=weeks:ascii-digits-2>ASCII digits</a>, representing the week <var>week</var>, in the range
- 1 ≤ <var>week</var> ≤ <var>maxweek</var>, where <var>maxweek</var> is the <a href=#week-number-of-the-last-day id=weeks:week-number-of-the-last-day>week number of the last day</a> of week-year <var>year</var></ol>
-
- <p>The rules to <dfn id=parse-a-week-string>parse a week string</dfn> are as follows. This will return either a week-year
- number and week number, or nothing. If at any point the algorithm says that it "fails", this means
- that it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p><a href=#collect-a-sequence-of-characters id=weeks:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=weeks:ascii-digits-3>ASCII digits</a>. If the
- collected sequence is not at least four characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>year</var>.<li><p>If <var>year</var> is not a number greater than zero, then fail.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+002D HYPHEN-MINUS character, then fail.
- Otherwise, move <var>position</var> forwards one character.<li><p>If <var>position</var> is beyond the end of <var>input</var> or if the
- character at <var>position</var> is not a U+0057 LATIN CAPITAL LETTER W character (W),
- then fail. Otherwise, move <var>position</var> forwards one character.<li><p><a href=#collect-a-sequence-of-characters id=weeks:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=weeks:ascii-digits-4>ASCII digits</a>. If the
- collected sequence is not exactly two characters long, then fail. Otherwise, interpret the
- resulting sequence as a base-ten integer. Let that number be the <var>week</var>.<li><p>Let <var>maxweek</var> be the <a href=#week-number-of-the-last-day id=weeks:week-number-of-the-last-day-2>week number of the last day</a> of year
- <var>year</var>.<li><p>If <var>week</var> is not a number in the range 1 ≤ <var>week</var> ≤ <var>maxweek</var>, then fail.<li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li><p>Return the week-year number <var>year</var> and the week number <var>week</var>.</ol>
-
- <h5 id=durations>2.4.5.9 Durations</h5>
-
- <p>A <dfn id=concept-duration>duration</dfn> consists of a number of seconds.</p>
- <p class=note>Since months and seconds are not comparable (a month is not a precise number of
- seconds, but is instead a period whose exact length depends on the precise day from which it is
- measured) a <a href=#concept-duration id=durations:concept-duration>duration</a> as defined in this specification cannot
- include months (or years, which are equivalent to
- twelve months). Only durations that describe a specific number of seconds can be described.</p>
- <p>A string is a <dfn id=valid-duration-string>valid duration string</dfn> representing a <a href=#concept-duration id=durations:concept-duration-2>duration</a> <var>t</var> if it consists of either of the
- following:</p>
- <ul><li>
-
-
- <p>A literal U+0050 LATIN CAPITAL LETTER P character followed by one or more of the following
- subcomponents, in the order given, where the number of days, hours, minutes, and
- seconds corresponds to the same number of seconds as in <var>t</var>:</p>
- <ol><li><p>One or more <a href=#ascii-digits id=durations:ascii-digits>ASCII digits</a> followed by a U+0044 LATIN CAPITAL LETTER D
- character, representing a number of days.<li>
- <p>A U+0054 LATIN CAPITAL LETTER T character followed by one or more of the following
- subcomponents, in the order given:</p>
- <ol><li><p>One or more <a href=#ascii-digits id=durations:ascii-digits-2>ASCII digits</a> followed by a U+0048 LATIN CAPITAL LETTER H
- character, representing a number of hours.<li><p>One or more <a href=#ascii-digits id=durations:ascii-digits-3>ASCII digits</a> followed by a U+004D LATIN CAPITAL LETTER M
- character, representing a number of minutes.<li>
- <p>The following components:</p>
- <ol><li><p>One or more <a href=#ascii-digits id=durations:ascii-digits-4>ASCII digits</a>, representing a number of seconds.<li><p>Optionally, a U+002E FULL STOP character (.) followed by one, two, or three
- <a href=#ascii-digits id=durations:ascii-digits-5>ASCII digits</a>, representing a fraction of a second.<li><p>A U+0053 LATIN CAPITAL LETTER S character.</ol>
- </ol>
- </ol>
- <p class=note>This, as with a number of other date- and time-related microsyntaxes defined in
- this specification, is based on one of the formats defined in ISO 8601. <a href=#refsISO8601>[ISO8601]</a></p>
- <li>
- <p>One or more <a href=#duration-time-component id=durations:duration-time-component>duration time components</a>, each with
- a different <a href=#duration-time-component-scale id=durations:duration-time-component-scale>duration time component scale</a>, in any order; the sum of the represented
- seconds being equal to the number of seconds in <var>t</var>.</p>
- <p>A <dfn id=duration-time-component>duration time component</dfn> is a string consisting of the following components:</p>
- <ol><li><p>Zero or more <a href=#space-character id=durations:space-character>space characters</a>.<li><p>One or more <a href=#ascii-digits id=durations:ascii-digits-6>ASCII digits</a>, representing a number of time units, scaled by
- the <a href=#duration-time-component-scale id=durations:duration-time-component-scale-2>duration time component scale</a> specified (see below) to represent a number of
- seconds.<li><p>If the <a href=#duration-time-component-scale id=durations:duration-time-component-scale-3>duration time component scale</a> specified is 1 (i.e. the units are
- seconds), then, optionally, a U+002E FULL STOP character (.) followed by one, two, or three
- <a href=#ascii-digits id=durations:ascii-digits-7>ASCII digits</a>, representing a fraction of a second.<li><p>Zero or more <a href=#space-character id=durations:space-character-2>space characters</a>.<li>
- <p>One of the following characters, representing the <dfn id=duration-time-component-scale>duration time component scale</dfn>
- of the time unit used in the numeric part of the <a href=#duration-time-component id=durations:duration-time-component-2>duration time component</a>:</p>
- <dl><dt>U+0057 LATIN CAPITAL LETTER W character<dt>U+0077 LATIN SMALL LETTER W character<dd>Weeks. The scale is 604800.<dt>U+0044 LATIN CAPITAL LETTER D character<dt>U+0064 LATIN SMALL LETTER D character<dd>Days. The scale is 86400.<dt>U+0048 LATIN CAPITAL LETTER H character<dt>U+0068 LATIN SMALL LETTER H character<dd>Hours. The scale is 3600.<dt>U+004D LATIN CAPITAL LETTER M character<dt>U+006D LATIN SMALL LETTER M character<dd>Minutes. The scale is 60.<dt>U+0053 LATIN CAPITAL LETTER S character<dt>U+0073 LATIN SMALL LETTER S character<dd>Seconds. The scale is 1.</dl>
- <li><p>Zero or more <a href=#space-character id=durations:space-character-3>space
- characters</a>.</ol>
- <p class=note>This is not based on any of the formats in ISO 8601. It is intended to be a more
- human-readable alternative to the ISO 8601 duration format.</p>
- </ul>
-
- <p>The rules to <dfn id=parse-a-duration-string>parse a duration string</dfn> are as follows. This will return either a <a href=#concept-duration id=durations:concept-duration-3>duration</a> or nothing. If at any point the algorithm says that it
- "fails", this means that it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Let <var>months</var>, <var>seconds</var>, and <var>component
- count</var> all be zero.<li>
- <p>Let <var>M-disambiguator</var> be <i>minutes</i>.</p>
-
- <p class=note>This flag's other value is <i>months</i>. It is used to disambiguate the "M"
- unit in ISO8601 durations, which use the same unit for months and minutes. Months are not
- allowed, but are parsed for future compatibility and to avoid misinterpreting ISO8601 durations
- that would be valid in other contexts.</p>
- <li><p><a href=#skip-whitespace id=durations:skip-whitespace>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, then
- fail.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+0050 LATIN CAPITAL LETTER P character, then advance <var>position</var> to the
- next character, set <var>M-disambiguator</var> to <i>months</i>, and <a href=#skip-whitespace id=durations:skip-whitespace-2>skip
- whitespace</a>.<li>
- <p>Run the following substeps in a loop, until a step requiring the loop to be broken or the
- entire algorithm to fail is reached:</p>
- <ol><li><p>Let <var>units</var> be undefined. It will be assigned one of the following
- values: <i>years</i>, <i>months</i>, <i>weeks</i>, <i>days</i>, <i>hours</i>, <i>minutes</i>,
- and <i>seconds</i>.<li><p>Let <var>next character</var> be undefined. It is used to process characters
- from the <var>input</var>.<li><p>If <var>position</var> is past the end of <var>input</var>, then break
- the loop.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+0054 LATIN CAPITAL LETTER T character, then advance <var>position</var> to the
- next character, set <var>M-disambiguator</var> to <i>minutes</i>, <a href=#skip-whitespace id=durations:skip-whitespace-3>skip
- whitespace</a>, and return to the top of the loop.<li><p>Set <var>next character</var> to the character in <var>input</var>
- pointed to by <var>position</var>.<li>
- <p>If <var>next character</var> is a U+002E FULL STOP character (.), then let <var>N</var> equal zero. (Do not advance <var>position</var>. That is taken care
- of below.)</p>
- <p>Otherwise, if <var>next character</var> is an <a href=#ascii-digits id=durations:ascii-digits-8>ASCII
- digit</a>, then <a href=#collect-a-sequence-of-characters id=durations:collect-a-sequence-of-characters>collect a sequence of characters</a> that are <a href=#ascii-digits id=durations:ascii-digits-9>ASCII
- digits</a>, interpret the resulting sequence as a base-ten integer, and let <var>N</var> be that number.</p>
- <p>Otherwise <var>next character</var> is not part of a number; fail.</p>
- <li><p>If <var>position</var> is past the end of <var>input</var>, then
- fail.<li><p>Set <var>next character</var> to the character in <var>input</var>
- pointed to by <var>position</var>, and this time advance <var>position</var>
- to the next character. (If <var>next character</var> was a U+002E FULL STOP character
- (.) before, it will still be that character this time.)<li>
- <p>If <var>next character</var> is a U+002E FULL STOP character (.), then run these
- substeps:</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=durations:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=durations:ascii-digits-10>ASCII digits</a>. Let
- <var>s</var> be the resulting sequence.<li><p>If <var>s</var> is the empty string, then fail.<li><p>Let <var>length</var> be the number of characters in <var>s</var>.<li><p>Let <var>fraction</var> be the result of interpreting <var>s</var>
- as a base-ten integer, and then dividing that number by <span>10<sup><var>length</var></sup></span>.<li><p>Increment <var>N</var> by <var>fraction</var>.<li><p><a href=#skip-whitespace id=durations:skip-whitespace-4>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, then
- fail.<li><p>Set <var>next character</var> to the character in <var>input</var>
- pointed to by <var>position</var>, and advance <var>position</var> to the
- next character.<li><p>If <var>next character</var> is neither a U+0053 LATIN CAPITAL LETTER S
- character nor a U+0073 LATIN SMALL LETTER S character, then fail.<li><p>Set <var>units</var> to <i>seconds</i>.</ol>
- <p>Otherwise, run these substeps:</p>
- <ol><li><p>If <var>next character</var> is a <a href=#space-character id=durations:space-character-4>space character</a>, then
- <a href=#skip-whitespace id=durations:skip-whitespace-5>skip whitespace</a>, set <var>next character</var> to the character in <var>input</var> pointed to by <var>position</var>, and advance <var>position</var> to the next character.<li>
-
- <p>If <var>next character</var> is a U+0059 LATIN CAPITAL LETTER Y character, or a
- U+0079 LATIN SMALL LETTER Y character, set <var>units</var> to <i>years</i> and set
- <var>M-disambiguator</var> to <i>months</i>.</p>
- <p>If <var>next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
- U+006D LATIN SMALL LETTER M character, and <var>M-disambiguator</var> is
- <i>months</i>, then set <var>units</var> to <i>months</i>.</p>
- <p>If <var>next character</var> is a U+0057 LATIN CAPITAL LETTER W character or a
- U+0077 LATIN SMALL LETTER W character, set <var>units</var> to <i>weeks</i> and set
- <var>M-disambiguator</var> to <i>minutes</i>.</p>
- <p>If <var>next character</var> is a U+0044 LATIN CAPITAL LETTER D character or a
- U+0064 LATIN SMALL LETTER D character, set <var>units</var> to <i>days</i> and set
- <var>M-disambiguator</var> to <i>minutes</i>.</p>
- <p>If <var>next character</var> is a U+0048 LATIN CAPITAL LETTER H character or a
- U+0068 LATIN SMALL LETTER H character, set <var>units</var> to <i>hours</i> and set
- <var>M-disambiguator</var> to <i>minutes</i>.</p>
- <p>If <var>next character</var> is a U+004D LATIN CAPITAL LETTER M character or a
- U+006D LATIN SMALL LETTER M character, and <var>M-disambiguator</var> is
- <i>minutes</i>, then set <var>units</var> to <i>minutes</i>.</p>
- <p>If <var>next character</var> is a U+0053 LATIN CAPITAL LETTER S character or a
- U+0073 LATIN SMALL LETTER S character, set <var>units</var> to <i>seconds</i> and
- set <var>M-disambiguator</var> to <i>minutes</i>.</p>
- <p>Otherwise if <var>next character</var> is none of the above characters, then
- fail.</p>
- </ol>
- <li><p>Increment <var>component count</var>.<li><p>Let <var>multiplier</var> be 1.<li><p>If <var>units</var> is <i>years</i>, multiply <var>multiplier</var> by
- 12 and set <var>units</var> to <i>months</i>.<li>
- <p>If <var>units</var> is <i>months</i>, add the product of <var>N</var> and
- <var>multiplier</var> to <var>months</var>.</p>
- <p>Otherwise, run these substeps:</p>
- <ol><li><p>If <var>units</var> is <i>weeks</i>, multiply <var>multiplier</var>
- by 7 and set <var>units</var> to <i>days</i>.<li><p>If <var>units</var> is <i>days</i>, multiply <var>multiplier</var>
- by 24 and set <var>units</var> to <i>hours</i>.<li><p>If <var>units</var> is <i>hours</i>, multiply <var>multiplier</var>
- by 60 and set <var>units</var> to <i>minutes</i>.<li><p>If <var>units</var> is <i>minutes</i>, multiply <var>multiplier</var> by 60 and set <var>units</var> to <i>seconds</i>.<li><p>Forcibly, <var>units</var> is now <i>seconds</i>. Add the product of <var>N</var> and <var>multiplier</var> to <var>seconds</var>.</ol>
- <li><p><a href=#skip-whitespace id=durations:skip-whitespace-6>Skip whitespace</a>.</ol>
- <li><p>If <var>component count</var> is zero,
- fail.<li><p>If <var>months</var> is not zero, fail.<li><p>Return the <a href=#concept-duration id=durations:concept-duration-4>duration</a> consisting of <var>seconds</var> seconds.</ol>
-
- <h5 id=vaguer-moments-in-time>2.4.5.10 Vaguer moments in time</h5>
- <p>A string is a <dfn id=valid-date-string-with-optional-time>valid date string with optional time</dfn> if
- it is also one of the following:</p>
- <ul><li>A <a href=#valid-date-string id=vaguer-moments-in-time:valid-date-string>valid date string</a><li>A <a href=#valid-global-date-and-time-string id=vaguer-moments-in-time:valid-global-date-and-time-string>valid global date and time string</a></ul>
-
- <hr>
- <p>The rules to <dfn id=parse-a-date-or-time-string>parse a date or time string</dfn> are as follows. The algorithm will return
- either a <a href=#concept-date id=vaguer-moments-in-time:concept-date>date</a>, a <a href=#concept-time id=vaguer-moments-in-time:concept-time>time</a>, a <a href=#concept-datetime id=vaguer-moments-in-time:concept-datetime>global date and time</a>, or nothing. If at any point the algorithm
- says that it "fails", this means that it is aborted at that point and returns nothing.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Set <var>start position</var> to the same position as <var>position</var>.<li><p>Set the <var>date present</var> and <var>time present</var> flags to
- true.<li><p><a href=#parse-a-date-component id=vaguer-moments-in-time:parse-a-date-component>Parse a date component</a> to obtain <var>year</var>, <var>month</var>, and <var>day</var>. If this fails, then set the <var>date
- present</var> flag to false.</p>
- <li>
- <p>If <var>date present</var> is true, and <var>position</var> is not beyond
- the end of <var>input</var>, and the character at <var>position</var> is
- either a U+0054 LATIN CAPITAL LETTER T character (T) or a U+0020 SPACE character, then advance
- <var>position</var> to the next character in <var>input</var>.</p>
- <p>Otherwise, if <var>date present</var> is true, and either <var>position</var> is beyond the end of <var>input</var> or the character at <var>position</var> is neither a U+0054 LATIN CAPITAL LETTER T character (T) nor a U+0020
- SPACE character, then set <var>time present</var> to false.</p>
- <p>Otherwise, if <var>date present</var> is false, set <var>position</var>
- back to the same position as <var>start position</var>.</p>
- <li><p>If the <var>time present</var> flag is true, then <a href=#parse-a-time-component id=vaguer-moments-in-time:parse-a-time-component>parse a time
- component</a> to obtain <var>hour</var>, <var>minute</var>, and <var>second</var>. If this returns nothing, then fail.<li><p>If the <var>date present</var> and <var>time present</var> flags are
- both true, but <var>position</var> is beyond the end of <var>input</var>, then
- fail.<li><p>If the <var>date present</var> and <var>time present</var> flags are
- both true, <a href=#parse-a-time-zone-offset-component id=vaguer-moments-in-time:parse-a-time-zone-offset-component>parse a time-zone offset component</a> to obtain <var>timezone<sub>hours</sub></var> and <var>timezone<sub>minutes</sub></var>. If this
- returns nothing, then fail.</p>
- <li><p>If <var>position</var> is <em>not</em> beyond the end of <var>input</var>, then fail.<li>
- <p>If the <var>date present</var> flag is true and the <var>time present</var>
- flag is false, then let <var>date</var> be the date with year <var>year</var>,
- month <var>month</var>, and day <var>day</var>, and return <var>date</var>.</p>
- <p>Otherwise, if the <var>time present</var> flag is true and the <var>date
- present</var> flag is false, then let <var>time</var> be the time with hour <var>hour</var>, minute <var>minute</var>, and second <var>second</var>,
- and return <var>time</var>.</p>
- <p>Otherwise, let <var>time</var> be the moment in time at year <var>year</var>, month <var>month</var>, day <var>day</var>, hours <var>hour</var>, minute <var>minute</var>, second <var>second</var>,
- subtracting <var>timezone<sub>hours</sub></var> hours and <var>timezone<sub>minutes</sub></var> minutes, that moment in time being a moment
- in the UTC time zone; let <var>timezone</var> be <var>timezone<sub>hours</sub></var> hours and <var>timezone<sub>minutes</sub></var>
- minutes from UTC; and return <var>time</var> and <var>timezone</var>.</p>
- </ol>
-
- <h4 id=colours>2.4.6 Colours</h4>
- <p>A <dfn id=simple-colour>simple colour</dfn> consists of three 8-bit numbers in the range 0..255, representing the
- red, green, and blue components of the colour respectively, in the sRGB colour space. <a href=#refsSRGB>[SRGB]</a></p>
- <p>A string is a <dfn id=valid-simple-colour>valid simple colour</dfn> if it is exactly seven characters long, and the
- first character is a U+0023 NUMBER SIGN character (#), and the remaining six characters are all
- <a href=#ascii-hex-digits id=colours:ascii-hex-digits>ASCII hex digits</a>, with the first two digits representing the red component, the
- middle two digits representing the green component, and the last two digits representing the blue
- component, in hexadecimal.</p>
- <p>A string is a <dfn id=valid-lowercase-simple-colour>valid lowercase simple colour</dfn> if it is a <a href=#valid-simple-colour id=colours:valid-simple-colour>valid simple
- colour</a> and doesn't use any characters in the range U+0041 LATIN CAPITAL LETTER A to U+0046
- LATIN CAPITAL LETTER F.</p>
-
- <p>The <dfn id=rules-for-parsing-simple-colour-values>rules for parsing simple colour values</dfn> are as given in the following algorithm.
- When invoked, the steps must be followed in the order given, aborting at the first step that
- returns a value. This algorithm will return either a <a href=#simple-colour id=colours:simple-colour>simple colour</a> or an error.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>If <var>input</var> is not exactly seven characters long, then return an
- error.<li><p>If the first character in <var>input</var> is not a U+0023 NUMBER SIGN character
- (#), then return an error.<li><p>If the last six characters of <var>input</var> are not all <a href=#ascii-hex-digits id=colours:ascii-hex-digits-2>ASCII hex
- digits</a>, then return an error.<li><p>Let <var>result</var> be a <a href=#simple-colour id=colours:simple-colour-2>simple colour</a>.</p>
- <li><p>Interpret the second and third characters as a hexadecimal number and let the result be
- the red component of <var>result</var>.</p>
- <li><p>Interpret the fourth and fifth characters as a hexadecimal number and let the result be
- the green component of <var>result</var>.</p>
- <li><p>Interpret the sixth and seventh characters as a hexadecimal number and let the result be
- the blue component of <var>result</var>.</p>
- <li><p>Return <var>result</var>.</p>
- </ol>
- <p>The <dfn id=rules-for-serialising-simple-colour-values>rules for serialising simple colour values</dfn> given a <a href=#simple-colour id=colours:simple-colour-3>simple colour</a> are
- as given in the following algorithm:</p>
- <ol><li><p>Let <var>result</var> be a string consisting of a single U+0023 NUMBER SIGN
- character (#).<li><p>Convert the red, green, and blue components in turn to two-digit hexadecimal numbers using
- <a href=#lowercase-ascii-hex-digits id=colours:lowercase-ascii-hex-digits>lowercase ASCII hex digits</a>, zero-padding if necessary, and append these numbers to
- <var>result</var>, in the order red, green, blue.</p>
- <li><p>Return <var>result</var>, which will be a <a href=#valid-lowercase-simple-colour id=colours:valid-lowercase-simple-colour>valid lowercase simple
- colour</a>.</ol>
- <hr>
- <p>Some obsolete legacy attributes parse colours in a more complicated manner, using the <dfn id=rules-for-parsing-a-legacy-colour-value>rules
- for parsing a legacy colour value</dfn>, which are given in the following algorithm. When invoked,
- the steps must be followed in the order given, aborting at the first step that returns a value.
- This algorithm will return either a <a href=#simple-colour id=colours:simple-colour-4>simple colour</a> or an error.</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>If <var>input</var> is the empty string, then return an error.<li><p><a href=#strip-leading-and-trailing-whitespace id=colours:strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var>input</var>.<li><p>If <var>input</var> is an <a href=#ascii-case-insensitive id=colours:ascii-case-insensitive>ASCII case-insensitive</a> match for the
- string "<code>transparent</code>", then return an error.<li>
- <p>If <var>input</var> is an <a href=#ascii-case-insensitive id=colours:ascii-case-insensitive-2>ASCII case-insensitive</a> match for one of the
- keywords listed in the <a href=http://www.w3.org/TR/css3-color/#svg-color>SVG color
- keywords</a> section of the CSS3 Color specification, then return the <a href=#simple-colour id=colours:simple-colour-5>simple
- colour</a> corresponding to that keyword. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
- <p class=note><a href=http://www.w3.org/TR/css3-color/#css2-system>CSS2 System
- Colors</a> are not recognised.</p>
- <li>
- <p>If <var>input</var> is four characters long, and the first character in <var>input</var> is a U+0023 NUMBER SIGN character (#), and the last three characters of
- <var>input</var> are all <a href=#ascii-hex-digits id=colours:ascii-hex-digits-3>ASCII hex digits</a>, then run these substeps:</p>
- <ol><li><p>Let <var>result</var> be a <a href=#simple-colour id=colours:simple-colour-6>simple colour</a>.</p>
- <li><p>Interpret the second character of <var>input</var> as a hexadecimal digit; let
- the red component of <var>result</var> be the resulting number multiplied by 17.</p>
- <li><p>Interpret the third character of <var>input</var> as a hexadecimal digit; let
- the green component of <var>result</var> be the resulting number multiplied by 17.</p>
- <li><p>Interpret the fourth character of <var>input</var> as a hexadecimal digit; let
- the blue component of <var>result</var> be the resulting number multiplied by 17.</p>
- <li><p>Return <var>result</var>.</p>
- </ol>
- <li><p>Replace any characters in <var>input</var> that have a Unicode code point greater
- than U+FFFF (i.e. any characters that are not in the basic multilingual plane) with the
- two-character string "<code>00</code>".<li><p>If <var>input</var> is longer than 128 characters, truncate <var>input</var>, leaving only the first 128 characters.<li><p>If the first character in <var>input</var> is a U+0023 NUMBER SIGN character (#),
- remove it.<li><p>Replace any character in <var>input</var> that is not an <a href=#ascii-hex-digits id=colours:ascii-hex-digits-4>ASCII hex digit</a> with the character U+0030 DIGIT ZERO (0).<li><p>While <var>input</var>'s length is zero or not a multiple of three, append a
- U+0030 DIGIT ZERO (0) character to <var>input</var>.<li><p>Split <var>input</var> into three strings of equal length, to obtain three
- components. Let <var>length</var> be the length of those components (one third the
- length of <var>input</var>).<li><p>If <var>length</var> is greater than 8, then remove the leading <span><var>length</var>-8</span> characters in each component, and let <var>length</var> be 8.<li><p>While <var>length</var> is greater than two and the first character in each
- component is a U+0030 DIGIT ZERO (0) character, remove that character and reduce <var>length</var> by one.<li><p>If <var>length</var> is <em>still</em> greater than two, truncate each component,
- leaving only the first two characters in each.<li><p>Let <var>result</var> be a <a href=#simple-colour id=colours:simple-colour-7>simple colour</a>.</p>
- <li><p>Interpret the first component as a hexadecimal number; let the red component of <var>result</var> be the resulting number.<li><p>Interpret the second component as a hexadecimal number; let the green component of <var>result</var> be the resulting number.<li><p>Interpret the third component as a hexadecimal number; let the blue component of <var>result</var> be the resulting number.<li><p>Return <var>result</var>.</p>
- </ol>
-
- <hr>
- <p class=note>The <a href=#canvas-context-2d id=colours:canvas-context-2d>2D graphics context</a> has a separate
- colour syntax that also handles opacity.</p>
- <h4 id=space-separated-tokens>2.4.7 Space-separated tokens</h4>
- <p>A <dfn id=set-of-space-separated-tokens>set of space-separated tokens</dfn> is a string containing zero or more words (known as
- tokens) separated by one or more <a href=#space-character id=space-separated-tokens:space-character>space characters</a>, where
- words consist of any string of one or more characters, none of which are <a href=#space-character id=space-separated-tokens:space-character-2>space characters</a>.</p>
- <p>A string containing a <a href=#set-of-space-separated-tokens id=space-separated-tokens:set-of-space-separated-tokens>set of space-separated tokens</a> may have leading or trailing
- <a href=#space-character id=space-separated-tokens:space-character-3>space characters</a>.</p>
- <p>An <dfn id=unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</dfn> is a <a href=#set-of-space-separated-tokens id=space-separated-tokens:set-of-space-separated-tokens-2>set of space-separated
- tokens</a> where none of the tokens are duplicated.</p>
- <p>An <dfn id=ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</dfn> is a <a href=#set-of-space-separated-tokens id=space-separated-tokens:set-of-space-separated-tokens-3>set of space-separated
- tokens</a> where none of the tokens are duplicated but where the order of the tokens is
- meaningful.</p>
- <p><a href=#set-of-space-separated-tokens id=space-separated-tokens:set-of-space-separated-tokens-4>Sets of space-separated tokens</a> sometimes
- have a defined set of allowed values. When a set of allowed values is defined, the tokens must all
- be from that list of allowed values; other values are non-conforming. If no such set of allowed
- values is provided, then all values are conforming.</p>
- <p class=note>How tokens in a <a href=#set-of-space-separated-tokens id=space-separated-tokens:set-of-space-separated-tokens-5>set of space-separated tokens</a> are to be compared
- (e.g. case-sensitively or not) is defined on a per-set basis.</p>
-
- <p>When a user agent has to <dfn id=split-a-string-on-spaces>split a string on spaces</dfn>, it must use the following
- algorithm:</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Let <var>tokens</var> be an ordered list of tokens, initially empty.<li><p><a href=#skip-whitespace id=space-separated-tokens:skip-whitespace>Skip whitespace</a><li><p>While <var>position</var> is not past the end of <var>input</var>:</p>
- <ol><li><p><a href=#collect-a-sequence-of-characters id=space-separated-tokens:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not <a href=#space-character id=space-separated-tokens:space-character-4>space characters</a>.<li><p>Append the string collected in the previous step to <var>tokens</var>.<li><p><a href=#skip-whitespace id=space-separated-tokens:skip-whitespace-2>Skip whitespace</a></ol>
- <li><p>Return <var>tokens</var>.</ol>
-
- <h4 id=comma-separated-tokens>2.4.8 Comma-separated tokens</h4>
- <p>A <dfn id=set-of-comma-separated-tokens>set of comma-separated tokens</dfn> is a string containing zero or more tokens each
- separated from the next by a single U+002C COMMA character (,), where tokens consist of any string
- of zero or more characters, neither beginning nor ending with <a href=#space-character id=comma-separated-tokens:space-character>space
- characters</a>, nor containing any U+002C COMMA characters (,), and optionally surrounded by
- <a href=#space-character id=comma-separated-tokens:space-character-2>space characters</a>.</p>
- <p class=example>For instance, the string "<code> a ,b,,d d </code>" consists of four tokens: "a", "b", the empty
- string, and "d d". Leading and trailing whitespace around each token doesn't count as part of
- the token, and the empty string can be a token.</p>
- <p><a href=#set-of-comma-separated-tokens id=comma-separated-tokens:set-of-comma-separated-tokens>Sets of comma-separated tokens</a> sometimes
- have further restrictions on what consists a valid token. When such restrictions are defined, the
- tokens must all fit within those restrictions; other values are non-conforming. If no such
- restrictions are specified, then all values are conforming.</p>
-
- <p>When a user agent has to <dfn id=split-a-string-on-commas>split a string on commas</dfn>, it must use the following
- algorithm:</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Let <var>tokens</var> be an ordered list of tokens, initially empty.<li><p><i>Token</i>: If <var>position</var> is past the end of <var>input</var>, jump to the last step.<li><p><a href=#collect-a-sequence-of-characters id=comma-separated-tokens:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not U+002C COMMA characters (,).
- Let <var>s</var> be the resulting sequence (which might be the empty string).<li><p><a href=#strip-leading-and-trailing-whitespace id=comma-separated-tokens:strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var>s</var>.<li><p>Append <var>s</var> to <var>tokens</var>.<li><p>If <var>position</var> is not past the end of <var>input</var>, then
- the character at <var>position</var> is a U+002C COMMA character (,); advance <var>position</var> past that character.<li><p>Jump back to the step labeled <i>token</i>.<li><p>Return <var>tokens</var>.</ol>
-
- <h4 id=syntax-references>2.4.9 References</h4>
- <p>A <dfn id=valid-hash-name-reference>valid hash-name reference</dfn> to an element of type <var>type</var> is a
- string consisting of a U+0023 NUMBER SIGN character (#) followed by a string which exactly matches
- the value of the <code>name</code> attribute of an element with type <var>type</var> in the document.</p>
-
- <p>The <dfn id=rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</dfn> to an element of type <var>type</var>, given a context node <var>scope</var>, are as follows:</p>
- <ol><li><p>If the string being parsed does not contain a U+0023 NUMBER SIGN character, or if the
- first such character in the string is the last character in the string, then return null and
- abort these steps.<li><p>Let <var>s</var> be the string from the character immediately after the first
- U+0023 NUMBER SIGN character in the string being parsed up to the end of that string.<li><p>Return the first element of type <var>type</var> in <a href=#tree-order id=syntax-references:tree-order>tree order</a> in the subtree rooted at <var>scope</var> that has an <code id=syntax-references:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute whose value is a <a href=#case-sensitive id=syntax-references:case-sensitive>case-sensitive</a> match for <var>s</var> or a <code>name</code> attribute whose value is a <a href=#compatibility-caseless id=syntax-references:compatibility-caseless>compatibility
- caseless</a> match for <var>s</var>.</ol>
-
- <h4 id=mq>2.4.10 Media queries</h4>
- <p>A string is a <dfn id=valid-media-query-list>valid media query list</dfn> if it matches the <code><media-query-list></code> production of the Media Queries specification. <a href=#refsMQ>[MQ]</a></p>
- <p>A string <dfn id=matches-the-environment>matches the environment</dfn> of the user if it is the empty string, a string
- consisting of only <a href=#space-character id=mq:space-character>space characters</a>, or is a media query list
- that matches the user's environment according to the definitions given in the Media Queries
- specification. <a href=#refsMQ>[MQ]</a></p>
- <h3 id=urls>2.5 URLs</h3>
- <h4 id=terminology-2>2.5.1 Terminology</h4>
- <p>A <a href=#url id=terminology-2:url>URL</a> is a <dfn id=valid-url>valid URL</dfn> if it conforms to the authoring conformance
- requirements in the WHATWG URL standard. <a href=#refsURL>[URL]</a></p>
- <p>A string is a <dfn id=valid-non-empty-url>valid non-empty URL</dfn> if it is a <a href=#valid-url id=terminology-2:valid-url>valid URL</a> but it is not
- the empty string.</p>
- <p>A string is a <dfn id=valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace id=terminology-2:strip-leading-and-trailing-whitespace>stripping leading and trailing whitespace</a>
- from it, it is a <a href=#valid-url id=terminology-2:valid-url-2>valid URL</a>.</p>
- <p>A string is a <dfn id=valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</dfn> if, after <a href=#strip-leading-and-trailing-whitespace id=terminology-2:strip-leading-and-trailing-whitespace-2>stripping leading and trailing whitespace</a>
- from it, it is a <a href=#valid-non-empty-url id=terminology-2:valid-non-empty-url>valid non-empty URL</a>.</p>
- <p>This specification defines the URL <dfn id=about:legacy-compat><code>about:legacy-compat</code></dfn> as a reserved,
- though unresolvable, <code id=terminology-2:about-protocol><a data-x-internal=about-protocol href=http://tools.ietf.org/html/rfc6694#section-2>about:</a></code> URL, for use in <a href=#syntax-doctype id=terminology-2:syntax-doctype>DOCTYPE</a>s in <a href=#html-documents id=terminology-2:html-documents>HTML documents</a> when needed for
- compatibility with XML tools. <a href=#refsABOUT>[ABOUT]</a></p>
- <p>This specification defines the URL <dfn id=about:srcdoc><code>about:srcdoc</code></dfn> as a reserved, though
- unresolvable, <code id=terminology-2:about-protocol-2><a data-x-internal=about-protocol href=http://tools.ietf.org/html/rfc6694#section-2>about:</a></code> URL, that is used as <a id="terminology-2:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the
- document's address</a> of <a href=#an-iframe-srcdoc-document id=terminology-2:an-iframe-srcdoc-document><code>iframe</code> <code>srcdoc</code> documents</a>. <a href=#refsABOUT>[ABOUT]</a></p>
- <p>The <dfn id=fallback-base-url>fallback base URL</dfn> of a <code id=terminology-2:document><a href=#document>Document</a></code> object is the <a href=#absolute-url id=terminology-2:absolute-url>absolute
- URL</a> obtained by running these substeps:</p>
- <ol><li><p>If the <code id=terminology-2:document-2><a href=#document>Document</a></code> is <a href=#an-iframe-srcdoc-document id=terminology-2:an-iframe-srcdoc-document-2>an <code>iframe</code> <code>srcdoc</code> document</a>, then return the <a href=#document-base-url id=terminology-2:document-base-url>document base
- URL</a> of the <code id=terminology-2:document-3><a href=#document>Document</a></code>'s <a href=#browsing-context id=terminology-2:browsing-context>browsing context</a>'s <a href=#browsing-context-container id=terminology-2:browsing-context-container>browsing context
- container</a>'s <a id=terminology-2:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> and abort these steps.<li>
-
-
- <p>If <a id="terminology-2:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> is <code id=terminology-2:about:blank><a href=#about:blank>about:blank</a></code>, and the
- <code id=terminology-2:document-4><a href=#document>Document</a></code>'s <a href=#browsing-context id=terminology-2:browsing-context-2>browsing context</a> has a <a href=#creator-browsing-context id=terminology-2:creator-browsing-context>creator browsing
- context</a>, then return the <a href=#document-base-url id=terminology-2:document-base-url-2>document base URL</a> of the <a href=#creator-document id=terminology-2:creator-document>creator
- <code>Document</code></a>, and abort these steps.</p>
- <li><p>Return <a id="terminology-2:the-document's-address-3" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>.</ol>
- <p>The <dfn id=document-base-url>document base URL</dfn> of a <code id=terminology-2:document-5><a href=#document>Document</a></code> object is the <a href=#absolute-url id=terminology-2:absolute-url-2>absolute
- URL</a> obtained by running these substeps:</p>
- <ol><li><p>If there is no <code id=terminology-2:the-base-element><a href=#the-base-element>base</a></code> element that has an <code id=terminology-2:attr-base-href><a href=#attr-base-href>href</a></code> attribute in the <code id=terminology-2:document-6><a href=#document>Document</a></code>, then the
- <a href=#document-base-url id=terminology-2:document-base-url-3>document base URL</a> is the <code id=terminology-2:document-7><a href=#document>Document</a></code>'s <a href=#fallback-base-url id=terminology-2:fallback-base-url>fallback base URL</a>;
- abort these steps.<li><p>Otherwise, the <a href=#document-base-url id=terminology-2:document-base-url-4>document base URL</a> is the <a href=#frozen-base-url id=terminology-2:frozen-base-url>frozen base URL</a> of the
- first <code id=terminology-2:the-base-element-2><a href=#the-base-element>base</a></code> element in the <code id=terminology-2:document-8><a href=#document>Document</a></code> that has an <code id=terminology-2:attr-base-href-2><a href=#attr-base-href>href</a></code> attribute, in <a href=#tree-order id=terminology-2:tree-order>tree order</a>.</ol>
-
- <h4 id=resolving-urls>2.5.2 Resolving URLs</h4>
- <p>Resolving a URL is the process of taking a <a href=#relative-url id=resolving-urls:relative-url>relative URL</a> and obtaining the
- <a href=#absolute-url id=resolving-urls:absolute-url>absolute URL</a> that it implies.</p>
- <p>To <dfn id=resolve-a-url>resolve a URL</dfn> to an <a href=#absolute-url id=resolving-urls:absolute-url-2>absolute URL</a> relative to either another
- <a href=#absolute-url id=resolving-urls:absolute-url-3>absolute URL</a> or an element, the user agent must use the following steps. Resolving a
- URL can result in an error, in which case the URL is not resolvable.</p>
- <ol><li><p>Let <var>url</var> be the <a href=#url id=resolving-urls:url>URL</a> being resolved.<li>
- <p>Let <var>encoding</var> be determined as follows:</p>
- <dl class=switch><dt>If the URL had a character encoding defined when the URL was created or defined or when
- this algorithm was invoked<dd>The URL character encoding is as defined.<dt>If the URL came from a script (e.g. as an argument to a method)<dd>The URL character encoding is the <a href=#api-url-character-encoding id=resolving-urls:api-url-character-encoding>API URL character encoding</a> specified by the
- script's <a href=#settings-object id=resolving-urls:settings-object>settings object</a>.<dt>If the URL came from a DOM node (e.g. from an element)<dd>The node has a <code id=resolving-urls:document><a href=#document>Document</a></code>, and the URL character encoding is the
- <a href="#document's-character-encoding" id="resolving-urls:document's-character-encoding">document's character encoding</a>.</dl>
- <li><p>If <var>encoding</var> is <a href=#a-utf-16-encoding id=resolving-urls:a-utf-16-encoding>a UTF-16 encoding</a>, then change the value
- of <var>encoding</var> to UTF-8.<li>
- <p>If the algorithm was invoked with an <a href=#absolute-url id=resolving-urls:absolute-url-4>absolute URL</a> to use as the base URL, let
- <var>base</var> be that <a href=#absolute-url id=resolving-urls:absolute-url-5>absolute URL</a>.</p>
- <p>Otherwise, let <var>base</var> be <a href="#the-element's-base-url" id="resolving-urls:the-element's-base-url">the element's base URL</a>.</p>
- <li><p>Apply the <a href=#url-parser id=resolving-urls:url-parser>URL parser</a> to <var>url</var>, with <var>base</var> as the base URL, with <var>encoding</var> as the encoding.<li><p>If this returns failure, then abort these steps with an error.<li><p>Let <var>parsed URL</var> be the result of the <a href=#url-parser id=resolving-urls:url-parser-2>URL parser</a>.<li><p>Let <var>serialised URL</var> be the result of apply the <a href=#concept-url-serialiser id=resolving-urls:concept-url-serialiser>URL serialiser</a> to <var>parsed URL</var>.<li><p>Return <var>serialised URL</var> as the <dfn id=resulting-absolute-url>resulting absolute URL</dfn> and <var>parsed
- URL</var> as the <dfn id=resulting-parsed-url>resulting parsed URL</dfn>.</ol>
- <p>Given an element, <dfn id="the-element's-base-url">the element's base URL</dfn> is the <i>base URI of the element</i>, as
- defined by the XML Base specification, with <i>the base URI of the document entity</i> being
- defined as the <a href=#document-base-url id=resolving-urls:document-base-url>document base URL</a> of the <code id=resolving-urls:document-2><a href=#document>Document</a></code> that owns the element.
- <a href=#refsXMLBASE>[XMLBASE]</a></p>
- <p>For the purposes of the XML Base specification, user agents must act as if all
- <code id=resolving-urls:document-3><a href=#document>Document</a></code> objects represented XML documents.</p>
- <p class=note>It is possible for <code id=resolving-urls:the-xml:base-attribute-(xml-only)><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes to be
- present even in HTML fragments, as such attributes can be added dynamically using script. (Such
- scripts would not be conforming, however, as <code id=resolving-urls:the-xml:base-attribute-(xml-only)-2><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code>
- attributes are not allowed in <a href=#html-documents id=resolving-urls:html-documents>HTML documents</a>.)</p>
-
-
- <h4 id=dynamic-changes-to-base-urls>2.5.3 Dynamic changes to base URLs</h4>
- <p>When an <code id=dynamic-changes-to-base-urls:the-xml:base-attribute-(xml-only)><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is set, changed, or removed, the
- attribute's element, and all descendant elements, are <a href=#affected-by-a-base-url-change id=dynamic-changes-to-base-urls:affected-by-a-base-url-change>affected by a base URL
- change</a>.</p>
- <p>When a document's <a href=#document-base-url id=dynamic-changes-to-base-urls:document-base-url>document base URL</a> changes, all elements in that document are
- <a href=#affected-by-a-base-url-change id=dynamic-changes-to-base-urls:affected-by-a-base-url-change-2>affected by a base URL change</a>.</p>
- <p>The following are <a href=#base-url-change-steps id=dynamic-changes-to-base-urls:base-url-change-steps>base URL change steps</a>, which run when an element is
- <a href=#affected-by-a-base-url-change id=dynamic-changes-to-base-urls:affected-by-a-base-url-change-3>affected by a base URL change</a> (as defined by the DOM specification):</p>
- <dl class=switch><dt>If the element creates a <a href=#hyperlink id=dynamic-changes-to-base-urls:hyperlink>hyperlink</a><dd>
- <p>If the <a href=#absolute-url id=dynamic-changes-to-base-urls:absolute-url>absolute URL</a> identified by the hyperlink is being shown to the user, or
- if any data derived from that URL is affecting the display, then the <code id=dynamic-changes-to-base-urls:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute should be <a href=#resolve-a-url id=dynamic-changes-to-base-urls:resolve-a-url>re-resolved</a> relative to the element and the UI updated appropriately.</p>
- <p class=example>For example, the CSS <code id=dynamic-changes-to-base-urls:selector-link><a href=#selector-link>:link</a></code>/<code id=dynamic-changes-to-base-urls:selector-visited><a href=#selector-visited>:visited</a></code> pseudo-classes might have been affected.</p>
- <p>If the hyperlink has a <code id=dynamic-changes-to-base-urls:ping><a href=#ping>ping</a></code> attribute and its <a href=#absolute-url id=dynamic-changes-to-base-urls:absolute-url-2>absolute URL(s)</a> are being shown to the user, then the <code id=dynamic-changes-to-base-urls:ping-2><a href=#ping>ping</a></code> attribute's tokens should be <a href=#resolve-a-url id=dynamic-changes-to-base-urls:resolve-a-url-2>re-resolved</a> relative to the element and the UI updated appropriately.</p>
- <dt>If the element is a <code id=dynamic-changes-to-base-urls:the-q-element><a href=#the-q-element>q</a></code>, <code id=dynamic-changes-to-base-urls:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>, <code id=dynamic-changes-to-base-urls:the-ins-element><a href=#the-ins-element>ins</a></code>, or
- <code id=dynamic-changes-to-base-urls:the-del-element><a href=#the-del-element>del</a></code> element with a <code>cite</code> attribute<dd>
- <p>If the <a href=#absolute-url id=dynamic-changes-to-base-urls:absolute-url-3>absolute URL</a> identified by the <code>cite</code> attribute is
- being shown to the user, or if any data derived from that URL is affecting the display, then the
- <a href=#url id=dynamic-changes-to-base-urls:url>URL</a> should be <a href=#resolve-a-url id=dynamic-changes-to-base-urls:resolve-a-url-3>re-resolved</a> relative to the
- element and the UI updated appropriately.</p>
- <dt>Otherwise<dd>
- <p>The element is not directly affected.</p>
- <p class=example>For instance, changing the base URL doesn't affect the image displayed by
- <code id=dynamic-changes-to-base-urls:the-img-element><a href=#the-img-element>img</a></code> elements, although subsequent accesses of the <code id=dynamic-changes-to-base-urls:dom-img-src><a href=#dom-img-src>src</a></code> IDL attribute from script will return a new <a href=#absolute-url id=dynamic-changes-to-base-urls:absolute-url-4>absolute
- URL</a> that might no longer correspond to the image being shown.</p>
- </dl>
-
-
- <h3 id=fetching-resources>2.6 Fetching resources</h3>
- <h4 id=terminology-3>2.6.1 Terminology</h4>
- <p id=concept-http-equivalent>User agents can implement a variety of transfer protocols, but
- this specification mostly defines behavior in terms of HTTP. <a href=#refsHTTP>[HTTP]</a></p>
- <p>The <dfn id=concept-http-equivalent-get>HTTP GET method</dfn> is equivalent to the default
- retrieval action of the protocol. For example, RETR in FTP. Such actions are idempotent and safe,
- in HTTP terms.</p>
- <p>The <dfn id=concept-http-equivalent-codes>HTTP response codes</dfn> are equivalent to
- statuses in other protocols that have the same basic meanings. For example, a "file not found"
- error is equivalent to a 404 code, a server error is equivalent to a 5xx code, and so on.</p>
- <p>The <dfn id=concept-http-equivalent-headers>HTTP headers</dfn> are equivalent to fields in
- other protocols that have the same basic meaning. For example, the HTTP authentication headers are
- equivalent to the authentication aspects of the FTP protocol.</p>
- <p>A <dfn id=referrer-source>referrer source</dfn> is either a <code id=terminology-3:document><a href=#document>Document</a></code> or a <a href=#url id=terminology-3:url>URL</a>.</p>
- <h4 id=processing-model>2.6.2 Processing model</h4>
- <p>When a user agent is to <dfn id=fetch>fetch</dfn> a resource or <a href=#url id=processing-model:url>URL</a>, optionally
- <strong>from</strong> an origin <i>origin</i>, optionally <strong>using</strong> a
- specific <a href=#referrer-source id=processing-model:referrer-source>referrer source</a> as an <i>override referrer source</i>, and optionally with
- any of a <i>synchronous flag</i>, a <i>manual redirect flag</i>, a <i>force same-origin flag</i>,
- and a <i>block cookies flag</i>, the following steps must be run. (When a
- <em><a href=#url id=processing-model:url-2>URL</a></em> is to be fetched, the URL identifies a resource to be obtained.)</p>
-
-
-
-
- <ol><li><p>If there is a specific <i>override referrer source</i>, and it is a <a href=#url id=processing-model:url-3>URL</a>, then
- let <var>referrer</var> be the <i>override referrer source</i>, and jump to the step
- labeled <i>clean referrer</i>.<li>
- <p>Let <var>document</var> be the appropriate <code id=processing-model:document><a href=#document>Document</a></code> as given by the
- following list:</p>
- <dl class=switch><dt>If there is a specific <i>override referrer source</i><dd>The <i>override referrer source</i>.<dt>When <a href=#navigate id=processing-model:navigate>navigating</a><dd>The <a href=#active-document id=processing-model:active-document>active document</a> of the <a href=#source-browsing-context id=processing-model:source-browsing-context>source browsing context</a>.<dt>When fetching resources for an element<dd>The element's <a id=processing-model:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</dl>
- <li>
- <p>While <var>document</var> is <a href=#an-iframe-srcdoc-document id=processing-model:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a>, let <var>document</var> be
- <var>document</var>'s <a href=#browsing-context id=processing-model:browsing-context>browsing context</a>'s <a href=#browsing-context-container id=processing-model:browsing-context-container>browsing context
- container</a>'s <a id=processing-model:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> instead.</p>
- <li>
- <p>If the <a href=#origin-2 id=processing-model:origin-2>origin</a> of <var>Document</var> is not a scheme/host/port tuple,
- then set <var>referrer</var> to the empty string and jump to the step labeled <i>clean
- referrer</i>.</p>
- <li>
- <p>Let <var>referrer</var> be <a id="processing-model:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> of <var>document</var>.</p>
- <li>
- <p><i>Clean referrer</i>: Apply the <a href=#url-parser id=processing-model:url-parser>URL parser</a> to <var>referrer</var> and let <var>parsed referrer</var> be the <a href=#resulting-parsed-url id=processing-model:resulting-parsed-url>resulting parsed URL</a>.</p>
- <li>
- <p>Let <var>referrer</var> be the result of applying the <a href=#concept-url-serialiser id=processing-model:concept-url-serialiser>URL serialiser</a> to <var>parsed referrer</var>, with the
- <i>exclude fragment flag</i> set.</p>
- <li>
- <p>If <var>referrer</var> is not the empty string, is not a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=processing-model:data-protocol data-x-internal=data-protocol><code>data:</code> URL</a>, and is not the <a href=#url id=processing-model:url-4>URL</a>
- "<code id=processing-model:about:blank><a href=#about:blank>about:blank</a></code>", then generate the <i>address of the resource from which Request-URIs
- are obtained</i> as required by HTTP for the <code id=processing-model:http-referer><a href=#http-referer>Referer</a></code> (sic)
- header from <var>referrer</var>. <a href=#refsHTTP>[HTTP]</a></p>
- <p>Otherwise, the <code id=processing-model:http-referer-2><a href=#http-referer>Referer</a></code> (sic) header must be omitted,
- regardless of its value.</p>
- <li><p>If the algorithm was not invoked with the <i>synchronous flag</i>, perform the remaining
- steps asynchronously.<li><p>If the <code id=processing-model:document-2><a href=#document>Document</a></code> with which any <a href=#concept-task id=processing-model:concept-task>tasks</a> <a href=#queue-a-task id=processing-model:queue-a-task>queued</a> by this algorithm would be associated doesn't have an
- associated <a href=#browsing-context id=processing-model:browsing-context-2>browsing context</a>, then abort these steps.<li>
- <p>This is the <i>main step</i>.</p>
- <p>If the resource is to be obtained from an <a href=#application-cache id=processing-model:application-cache>application cache</a>, then use the data
- from that <a href=#application-cache id=processing-model:application-cache-2>application cache</a>, as if it had been obtained in the manner appropriate
- given its <a href=#url id=processing-model:url-5>URL</a>.</p>
- <p>If the resource is identified by an <a href=#absolute-url id=processing-model:absolute-url>absolute URL</a>, and the resource is to be
- obtained using an idempotent action (such as an HTTP GET <a href=#concept-http-equivalent-get id=processing-model:concept-http-equivalent-get>or equivalent</a>), and it is already being downloaded
- for other reasons (e.g. another invocation of this algorithm), and this request would be
- identical to the previous one (e.g. same <code id=processing-model:http-accept><a href=#http-accept>Accept</a></code> and <code id=processing-model:http-origin><a href=#http-origin>Origin</a></code> headers), and the user agent is configured such that it is to
- reuse the data from the existing download instead of initiating a new one, then use the results
- of the existing download instead of starting a new one.</p>
- <p>Otherwise, if the resource is identified by an <a href=#absolute-url id=processing-model:absolute-url-2>absolute URL</a> with a scheme that
- does not define a mechanism to obtain the resource (e.g. it is a <code id=processing-model:mailto-protocol><a data-x-internal=mailto-protocol href=http://tools.ietf.org/html/rfc6068#section-2>mailto:</a></code> URL) or that the user agent does not support, then act as if the
- resource was an HTTP 204 No Content response with no other metadata.</p>
- <p>Otherwise, if the resource is identified by the <a href=#url id=processing-model:url-6>URL</a>
- <dfn id=about:blank><code>about:blank</code></dfn>, then the resource is immediately available and consists of
- the empty string, with no metadata.</p>
- <p>Otherwise, at a time convenient to the user and the user agent, download (or otherwise
- obtain) the resource, applying the semantics of the relevant specifications (e.g. performing an
- HTTP GET or POST operation, or reading the file from disk, or expanding <a href=http://tools.ietf.org/html/rfc2397#section-2 id=processing-model:data-protocol-2 data-x-internal=data-protocol><code>data:</code> URLs</a>, etc).</p>
- <p>For the purposes of the <code id=processing-model:http-referer-3><a href=#http-referer>Referer</a></code> (sic) header, use the
- <i>address of the resource from which Request-URIs are obtained</i> generated in the earlier
- step.</p>
- <p>For the purposes of the <code id=processing-model:http-origin-2><a href=#http-origin>Origin</a></code> header, if the <a href=#fetch id=processing-model:fetch>fetching algorithm</a> was explicitly initiated from an <i>origin</i>, then
- <i>the origin that initiated the HTTP request</i> is <i>origin</i>. Otherwise, this is <i>a
- request from a "privacy-sensitive" context</i>. <a href=#refsORIGIN>[ORIGIN]</a></p>
- <li>
- <p>If the algorithm was not invoked with the <i>block cookies flag</i>, and there are cookies to
- be set, then the user agent must run the following substeps:</p>
- <ol><li><p>Wait until ownership of the <a href=#storage-mutex id=processing-model:storage-mutex>storage mutex</a> can be taken by this instance of
- the <a href=#fetch id=processing-model:fetch-2>fetching</a> algorithm.<li><p>Take ownership of the <a href=#storage-mutex id=processing-model:storage-mutex-2>storage mutex</a>.<li><p>Update the cookies. <a href=#refsCOOKIES>[COOKIES]</a>
- <a href=#fingerprinting-vector id=processing-model:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- <li><p>Release the <a href=#storage-mutex id=processing-model:storage-mutex-3>storage mutex</a> so that it is once again free.</ol>
- <li>
- <p>If the fetched resource is an HTTP redirect <a href=#concept-http-equivalent-codes id=processing-model:concept-http-equivalent-codes>or
- equivalent</a>, then:</p>
- <dl class=switch><dt>If the <i>force same-origin flag</i> is set and the <a href=#url id=processing-model:url-7>URL</a> of the target of the
- redirect does not have the <a href=#same-origin id=processing-model:same-origin>same origin</a> as the <a href=#url id=processing-model:url-8>URL</a> for which the
- <a href=#fetch id=processing-model:fetch-3>fetch</a> algorithm was invoked<dd>
- <p>Abort these steps and return failure from this algorithm, as if the remote host could not
- be contacted.</p>
- <dt>If the <i>manual redirect flag</i> is set<dd>
- <p>Continue, using the fetched resource (the redirect) as the result of the algorithm. If the
- calling algorithm subsequently requires the user agent to <dfn id=transparently-follow-the-redirect>transparently follow the
- redirect</dfn>, then the user agent must resume this algorithm from the <i>main step</i>, but
- using the target of the redirect as the resource to fetch, rather than the original
- resource.</p>
- <dt>Otherwise<dd>
- <p>First, apply any relevant requirements for redirects (such as showing any appropriate
- prompts). Then, redo <i>main step</i>, but using the target of the redirect as the resource to
- fetch, rather than the original resource. For HTTP requests, the new request must include the
- same headers as the original request, except for headers for which other requirements are
- specified (such as the <code id=processing-model:http-host><a href=#http-host>Host</a></code> header). <a href=#refsHTTP>[HTTP]</a></p>
- <p class=note>The HTTP specification requires that 301, 302, and 307 redirects, when applied
- to methods other than the safe methods, not be followed without user confirmation. That would
- be an appropriate prompt for the purposes of the requirement in the paragraph above. <a href=#refsHTTP>[HTTP]</a></p>
- </dl>
- <li>
- <p>If the algorithm was not invoked with the <i>synchronous flag</i>: When the resource is
- available, or if there is an error of some description, <a href=#queue-a-task id=processing-model:queue-a-task-2>queue a task</a> that uses the
- resource as appropriate. If the resource can be processed incrementally, as, for instance, with
- a progressively interlaced JPEG or an HTML file, additional tasks may be queued to process the
- data as it is downloaded. The <a href=#task-source id=processing-model:task-source>task source</a> for these <a href=#concept-task id=processing-model:concept-task-2>tasks</a> is the <a href=#networking-task-source id=processing-model:networking-task-source>networking task source</a>.</p>
- <p>Otherwise, return the resource or error information to the calling algorithm.</p>
- </ol>
- <p>If the user agent can determine the actual length of the resource being <a href=#fetch id=processing-model:fetch-4>fetched</a> for an instance of this algorithm, and if that length is finite, then
- that length is the file's <dfn id=concept-fetch-total>size</dfn>. Otherwise, the subject of
- the algorithm (that is, the resource being fetched) has no known <a href=#concept-fetch-total id=processing-model:concept-fetch-total>size</a>. (For example, the HTTP <code id=processing-model:http-content-length><a href=#http-content-length>Content-Length</a></code> header might provide this information.)</p>
- <p>The user agent must also keep track of the <dfn id=concept-fetch-loaded>number of bytes
- downloaded</dfn> for each instance of this algorithm. This number must exclude any out-of-band
- metadata, such as HTTP headers.</p>
- <p class=note>The <a href=#application-cache id=processing-model:application-cache-3>application cache</a> processing model introduces some <a href=#changesToNetworkingModel>changes to the networking model</a> to handle the returning of
- cached resources.</p>
- <p class=note>The <a href=#navigate id=processing-model:navigate-2>navigation</a> processing model handles redirects
- itself, overriding the redirection handling that would be done by the fetching algorithm.</p>
- <p class=note>Whether the <a href=#content-type-sniffing>type sniffing rules</a> apply to the
- fetched resource depends on the algorithm that invokes the rules — they are not always
- applicable.</p>
- <h4 id=encrypted-http-and-related-security-concerns>2.6.3 Encrypted HTTP and related security concerns</h4>
- <p>Anything in this specification that refers to HTTP also applies to HTTP-over-TLS, as
- represented by <a href=#url id=encrypted-http-and-related-security-concerns:url>URLs</a> using the <code id=encrypted-http-and-related-security-concerns:https-protocol><a data-x-internal=https-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.2>https:</a></code> scheme. <a href=#refsHTTPS>[HTTPS]</a></p>
- <p class=warning>User agents should report certificate errors to the user and must either refuse
- to download resources sent with erroneous certificates or must act as if such resources were in
- fact served with no encryption.</p>
- <p>User agents should warn the user that there is a potential problem whenever the user visits a
- page that the user has previously visited, if the page uses less secure encryption on the second
- visit.</p>
- <p>Not doing so can result in users not noticing man-in-the-middle attacks.</p>
- <div class=example>
- <p>If a user connects to a server with a self-signed certificate, the user agent could allow the
- connection but just act as if there had been no encryption. If the user agent instead allowed the
- user to override the problem and then displayed the page as if it was fully and safely encrypted,
- the user could be easily tricked into accepting man-in-the-middle connections.</p>
- <p>If a user connects to a server with full encryption, but the page then refers to an external
- resource that has an expired certificate, then the user agent will act as if the resource was
- unavailable, possibly also reporting the problem to the user. If the user agent instead allowed
- the resource to be used, then an attacker could just look for "secure" sites that used resources
- from a different host and only apply man-in-the-middle attacks to that host, for example taking
- over scripts in the page.</p>
- <p>If a user bookmarks a site that uses a CA-signed certificate, and then later revisits that
- site directly but the site has started using a self-signed certificate, the user agent could warn
- the user that a man-in-the-middle attack is likely underway, instead of simply acting as if the
- page was not encrypted.</p>
- </div>
- <h4 id=content-type-sniffing>2.6.4 Determining the type of a resource</h4>
- <p>The <dfn id=content-type>Content-Type metadata</dfn> of a resource must be obtained and
- interpreted in a manner consistent with the requirements of the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
- <p>The <dfn id=content-type-sniffing-2><a href=http://mimesniff.spec.whatwg.org/#sniffed-mime-type>sniffed type of a resource</a></dfn>
- must be found in a manner consistent with the requirements given in the MIME Sniffing
- specification for finding the <i>sniffed media type</i> of the relevant sequence of octets. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
- <p>The <dfn id=content-type-sniffing:-image><a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically>rules for
- sniffing images specifically</a></dfn>, the <dfn id=content-type-sniffing:-text-or-binary><a href=http://mimesniff.spec.whatwg.org/#rules-for-text-or-binary>rules for distinguishing
- if a resource is text or binary</a></dfn>, and the <dfn id=content-type-sniffing:-video><a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically>rules
- for sniffing audio and video specifically</a></dfn> are also defined in the MIME Sniffing
- specification. These rules return a <a href=#mime-type id=content-type-sniffing:mime-type>MIME type</a> as their result. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
- <p class=warning>It is imperative that the rules in the MIME Sniffing specification be followed
- exactly. When a user agent uses different heuristics for content type detection than the server
- expects, security problems can occur. For more details, see the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a></p>
- <h4 id=extracting-character-encodings-from-meta-elements>2.6.5 Extracting character encodings from <code id=extracting-character-encodings-from-meta-elements:the-meta-element><a href=#the-meta-element>meta</a></code> elements</h4>
- <p>The <dfn id=algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a <code>meta</code> element</dfn>,
- given a string <var>s</var>, is as follows. It either returns a character encoding or
- nothing.</p>
- <ol><li><p>Let <var>position</var> be a pointer into <var>s</var>, initially
- pointing at the start of the string.<li><p><i>Loop</i>: Find the first seven characters in <var>s</var> after <var>position</var> that are an <a href=#ascii-case-insensitive id=extracting-character-encodings-from-meta-elements:ascii-case-insensitive>ASCII case-insensitive</a> match for the word "<code>charset</code>". If no such match is found, return nothing and abort these
- steps.<li><p>Skip any <a href=#space-character id=extracting-character-encodings-from-meta-elements:space-character>space characters</a> that immediately follow the
- word "<code>charset</code>" (there might not be any).<li><p>If the next character is not a U+003D EQUALS SIGN (=), then move <var>position</var> to point just before that next character, and jump back to the step
- labeled <i>loop</i>.<li><p>Skip any <a href=#space-character id=extracting-character-encodings-from-meta-elements:space-character-2>space characters</a> that immediately follow the
- equals sign (there might not be any).<li>
- <p>Process the next character as follows:</p>
- <dl class=switch><dt>If it is a U+0022 QUOTATION MARK character (") and there is a later U+0022 QUOTATION MARK character (") in <var>s</var><dt>If it is a U+0027 APOSTROPHE character (') and there is a later U+0027 APOSTROPHE character (') in <var>s</var><dd>Return the result of <a id=extracting-character-encodings-from-meta-elements:getting-an-encoding href=http://encoding.spec.whatwg.org/#concept-encoding-get data-x-internal=getting-an-encoding>getting an encoding</a> from the substring that is between
- this character and the next earliest occurrence of this character.<dt>If it is an unmatched U+0022 QUOTATION MARK character (")<dt>If it is an unmatched U+0027 APOSTROPHE character (')<dt>If there is no next character<dd>Return nothing.<dt>Otherwise<dd>Return the result of <a id=extracting-character-encodings-from-meta-elements:getting-an-encoding-2 href=http://encoding.spec.whatwg.org/#concept-encoding-get data-x-internal=getting-an-encoding>getting an encoding</a> from the substring that consists of
- this character up to but not including the first <a href=#space-character id=extracting-character-encodings-from-meta-elements:space-character-3>space character</a> or U+003B
- SEMICOLON character (;), or the end of <var>s</var>, whichever comes first.</dl>
- </ol>
- <p class=note>This algorithm is distinct from those in the HTTP specification (for example, HTTP
- doesn't allow the use of single quotes and requires supporting a backslash-escape mechanism that
- is not supported by this algorithm). While the algorithm is used in
- contexts that, historically, were related to HTTP, the syntax as supported by implementations
- diverged some time ago. <a href=#refsHTTP>[HTTP]</a></p>
-
- <h4 id=cors-settings-attributes>2.6.6 CORS settings attributes</h4>
- <p>A <dfn id=cors-settings-attribute>CORS settings attribute</dfn> is an <a href=#enumerated-attribute id=cors-settings-attributes:enumerated-attribute>enumerated attribute</a>. The following
- table lists the keywords and states for the attribute — the keywords in the left column map
- to the states in the cell in the second column on the same row as the keyword.</p>
- <table><thead><tr><th> Keyword
- <th> State
- <th> Brief description
- <tbody><tr><td><dfn id=attr-crossorigin-anonymous-keyword><code>anonymous</code></dfn>
- <td><dfn id=attr-crossorigin-anonymous>Anonymous</dfn>
- <td>Cross-origin CORS requests for the element will have the <i id=cors-settings-attributes:omit-credentials-flag><a href=#omit-credentials-flag>omit credentials flag</a></i> set.
- <tr><td><dfn id=attr-crossorigin-use-credentials-keyword><code>use-credentials</code></dfn>
- <td><dfn id=attr-crossorigin-use-credentials>Use Credentials</dfn>
- <td>Cross-origin CORS requests for the element will not have the <i id=cors-settings-attributes:omit-credentials-flag-2><a href=#omit-credentials-flag>omit credentials flag</a></i> set.
- </table>
- <p>The empty string is also a valid keyword, and maps to the <a href=#attr-crossorigin-anonymous id=cors-settings-attributes:attr-crossorigin-anonymous>Anonymous</a> state. The attribute's <i id=cors-settings-attributes:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i> is the <a href=#attr-crossorigin-anonymous id=cors-settings-attributes:attr-crossorigin-anonymous-2>Anonymous</a> state. For the
- purposes of <a href=#reflect id=cors-settings-attributes:reflect>reflection</a>, the canonical case for the <a href=#attr-crossorigin-anonymous id=cors-settings-attributes:attr-crossorigin-anonymous-3>Anonymous</a> state is the <code id=cors-settings-attributes:attr-crossorigin-anonymous-keyword><a href=#attr-crossorigin-anonymous-keyword>anonymous</a></code> keyword. The <i id=cors-settings-attributes:missing-value-default><a href=#missing-value-default>missing value default</a></i>, used when the attribute is omitted, is the <dfn id=attr-crossorigin-none>No
- CORS</dfn> state.</p>
-
- <h4 id=cors-enabled-fetch>2.6.7 CORS-enabled fetch</h4>
- <p>When the user agent is required to perform a <dfn id=potentially-cors-enabled-fetch>potentially CORS-enabled fetch</dfn> of an
- <a href=#absolute-url id=cors-enabled-fetch:absolute-url>absolute URL</a> <var>URL</var> with a mode <var>mode</var> that is
- either "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none>No CORS</a>", "<a href=#attr-crossorigin-anonymous id=cors-enabled-fetch:attr-crossorigin-anonymous>Anonymous</a>", or "<a href=#attr-crossorigin-use-credentials id=cors-enabled-fetch:attr-crossorigin-use-credentials>Use Credentials</a>", optionally using a
- <a href=#referrer-source id=cors-enabled-fetch:referrer-source>referrer source</a> <var>referrer source</var>, with an <a href=#origin-2 id=cors-enabled-fetch:origin-2>origin</a>
- <var>origin</var>, and with a default origin behaviour <var>default</var>
- which is either "<i>taint</i>" or "<i>fail</i>", it must run the first applicable set of steps
- from the following list. The default origin behaviour is only used if <var>mode</var> is
- "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none-2>No CORS</a>". This algorithm wraps the <a href=#fetch id=cors-enabled-fetch:fetch>fetch</a>
- algorithm above, and labels the obtained resource as either <dfn id=cors-same-origin>CORS-same-origin</dfn> or
- <dfn id=cors-cross-origin>CORS-cross-origin</dfn>, or blocks the resource entirely.</p>
- <dl class=switch><dt>If the <var>URL</var> has the <a href=#same-origin id=cors-enabled-fetch:same-origin>same origin</a> as <var>origin</var><dt>If the <var>URL</var> is a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=cors-enabled-fetch:data-protocol data-x-internal=data-protocol><code>data:</code> URL</a><dt>If the <var>URL</var> is <code id=cors-enabled-fetch:about:blank><a href=#about:blank>about:blank</a></code><dd>
- <p>Run these substeps:</p>
- <ol><li><p><a href=#fetch id=cors-enabled-fetch:fetch-2>Fetch</a> <var>URL</var>, using <var>referrer
- source</var> if one was specified, with the <i>manual redirect flag</i> set.<li><p><i>Loop</i>: Wait for the <a href=#fetch id=cors-enabled-fetch:fetch-3>fetch</a> algorithm to know if the result is a
- redirect or not.<li>
- <p>Follow the first appropriate steps from the following list:</p>
- <dl class=switch><dt>If the result of the <a href=#fetch id=cors-enabled-fetch:fetch-4>fetch</a> is a redirect, and the <a href=#origin-2 id=cors-enabled-fetch:origin-2-2>origin</a> of the
- target URL of the redirect is not the <a href=#same-origin id=cors-enabled-fetch:same-origin-2>same origin</a> as <var>origin</var><dd>
- <p>Set <var>URL</var> to the target URL of the redirect and return to the top of
- the <a href=#potentially-cors-enabled-fetch id=cors-enabled-fetch:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> algorithm (this time, one of the other
- branches below might be taken, based on the value of <var>mode</var>).</p>
- <dt>If the result of the <a href=#fetch id=cors-enabled-fetch:fetch-5>fetch</a> is a redirect<dd>
- <p class=note>The <a href=#origin-2 id=cors-enabled-fetch:origin-2-3>origin</a> of the target URL of the redirect is the <a href=#same-origin id=cors-enabled-fetch:same-origin-3>same
- origin</a> as <var>origin</var>.</p>
- <p><a href=#transparently-follow-the-redirect id=cors-enabled-fetch:transparently-follow-the-redirect>Transparently follow the redirect</a> and jump to the step labeled <i>loop</i>
- above.</p>
- <dt>Otherwise<dd>
- <p class=note>The resource is available, it is not a redirect, and its <a href=#origin-2 id=cors-enabled-fetch:origin-2-4>origin</a>
- is the <a href=#same-origin id=cors-enabled-fetch:same-origin-4>same origin</a> as <var>origin</var>.</p>
- <p>The <a href=#concept-task id=cors-enabled-fetch:concept-task>tasks</a> from the <a href=#fetch id=cors-enabled-fetch:fetch-6>fetch</a> algorithm are
- <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task>queued</a> normally, and for the purposes of the calling
- algorithm, the obtained resource is <a href=#cors-same-origin id=cors-enabled-fetch:cors-same-origin>CORS-same-origin</a>.</p>
- </dl>
- </ol>
- <dt>If <var>mode</var> is "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none-3>No CORS</a>" and
- <var>default</var> is <i>taint</i><dd>
- <p class=note>The <var>URL</var> does not have the <a href=#same-origin id=cors-enabled-fetch:same-origin-5>same origin</a> as <var>origin</var>.</p>
- <p><a href=#fetch id=cors-enabled-fetch:fetch-7>Fetch</a> <var>URL</var>, using <var>referrer
- source</var> if one was specified.</p>
- <p>The <a href=#concept-task id=cors-enabled-fetch:concept-task-2>tasks</a> from the <a href=#fetch id=cors-enabled-fetch:fetch-8>fetch</a> algorithm are <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-2>queued</a> normally, but for the purposes of the calling algorithm, the
- obtained resource is <a href=#cors-cross-origin id=cors-enabled-fetch:cors-cross-origin>CORS-cross-origin</a>. The user agent may report a cross-origin
- resource access failure to the user (e.g. in a debugging console).</p>
- <dt>If <var>mode</var> is "<a href=#attr-crossorigin-none id=cors-enabled-fetch:attr-crossorigin-none-4>No CORS</a>"<dd>
- <p class=note>The <var>URL</var> does not have the <a href=#same-origin id=cors-enabled-fetch:same-origin-6>same origin</a> as <var>origin</var>, and <var>default</var> is <i>fail</i>.</p>
- <p>Discard any data fetched as part of this algorithm, and prevent any <a href=#concept-task id=cors-enabled-fetch:concept-task-3>tasks</a> from such invocations of the <a href=#fetch id=cors-enabled-fetch:fetch-9>fetch</a> algorithm
- from being <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-3>queued</a>.
- For the purposes of the calling algorithm, the user agent must act as if there was a fatal
- network error and no resource was obtained. The user agent may report a cross-origin resource
- access failure to the user (e.g. in a debugging console).</p>
- <dt>If <var>mode</var> is "<a href=#attr-crossorigin-anonymous id=cors-enabled-fetch:attr-crossorigin-anonymous-2>Anonymous</a>"
- or "<a href=#attr-crossorigin-use-credentials id=cors-enabled-fetch:attr-crossorigin-use-credentials-2>Use Credentials</a>"<dd>
- <p class=note>The <var>URL</var> does not have the <a href=#same-origin id=cors-enabled-fetch:same-origin-7>same origin</a> as <var>origin</var>.</p>
- <p>Run these steps:</p>
- <ol><li><p>Perform a <a href=#cross-origin-request id=cors-enabled-fetch:cross-origin-request>cross-origin request</a> with the <i>request URL</i> set
- to <var>URL</var>, with the CORS <i>referrer source</i> set to <var>referrer source</var> if
- one was specified, the <i>source origin</i> set to <var>origin</var>, and with the <i id=cors-enabled-fetch:omit-credentials-flag><a href=#omit-credentials-flag>omit credentials flag</a></i> set if <var>mode</var> is "<a href=#attr-crossorigin-anonymous id=cors-enabled-fetch:attr-crossorigin-anonymous-3>Anonymous</a>" and not set otherwise. <a href=#refsFETCH>[FETCH]</a><li><p>Wait for the CORS <a href=#cross-origin-request-status id=cors-enabled-fetch:cross-origin-request-status>cross-origin request status</a> to have a value.<li>
- <p>Jump to the appropriate step from the following list:</p>
- <dl class=switch><dt>If the CORS <a href=#cross-origin-request-status id=cors-enabled-fetch:cross-origin-request-status-2>cross-origin request status</a> is not <i>success</i><dd>
- <p>Discard all fetched data and prevent any <a href=#concept-task id=cors-enabled-fetch:concept-task-4>tasks</a> from
- the <a href=#fetch id=cors-enabled-fetch:fetch-10>fetch</a> algorithm from being <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-4>queued</a>. For
- the purposes of the calling algorithm, the user agent must act as if there was a fatal
- network error and no resource was obtained. If a CORS <a href=#resource-sharing-check id=cors-enabled-fetch:resource-sharing-check>resource sharing check</a>
- failed, the user agent may report a cross-origin resource access failure to the user (e.g.
- in a debugging console).</p>
- <dt>If the CORS <a href=#cross-origin-request-status id=cors-enabled-fetch:cross-origin-request-status-3>cross-origin request status</a> is <i>success</i><dd>
- <p>The <a href=#concept-task id=cors-enabled-fetch:concept-task-5>tasks</a> from the <a href=#fetch id=cors-enabled-fetch:fetch-11>fetch</a> algorithm are
- <a href=#queue-a-task id=cors-enabled-fetch:queue-a-task-5>queued</a> normally, and for the purposes of the calling
- algorithm, the obtained resource is <a href=#cors-same-origin id=cors-enabled-fetch:cors-same-origin-2>CORS-same-origin</a>.</p>
- </dl>
- </ol>
- </dl>
-
- <h3 id=common-dom-interfaces>2.7 Common DOM interfaces</h3>
- <h4 id=reflecting-content-attributes-in-idl-attributes>2.7.1 Reflecting content attributes in IDL attributes</h4>
- <p>Some IDL attributes are defined to <dfn id=reflect>reflect</dfn> a particular content attribute. This
- means that on getting, the IDL attribute returns the current value of the content attribute, and
- on setting, the IDL attribute changes the value of the content attribute to the given value.</p>
-
- <p>In general, on getting, if the content attribute is not present, the IDL attribute must act as
- if the content attribute's value is the empty string; and on setting, if the content attribute is
- not present, it must first be added.</p>
- <p>If a reflecting IDL attribute is a <code id=reflecting-content-attributes-in-idl-attributes:idl-domstring><a href=#idl-domstring>DOMString</a></code> attribute whose content attribute is
- defined to contain a <a href=#url id=reflecting-content-attributes-in-idl-attributes:url>URL</a>, then on getting, the IDL attribute must <a href=#resolve-a-url id=reflecting-content-attributes-in-idl-attributes:resolve-a-url>resolve</a> the value of the content attribute relative to the element
- and return the resulting <a href=#absolute-url id=reflecting-content-attributes-in-idl-attributes:absolute-url>absolute URL</a> if that was successful, or the empty string
- otherwise; and on setting, must set the content attribute to the specified literal value. If the
- content attribute is absent, the IDL attribute must return the default value, if the content
- attribute has one, or else the empty string.</p>
- <p>If a reflecting IDL attribute is a <code id=reflecting-content-attributes-in-idl-attributes:idl-domstring-2><a href=#idl-domstring>DOMString</a></code> attribute whose content attribute is
- defined to contain one or more <a href=#url id=reflecting-content-attributes-in-idl-attributes:url-2>URLs</a>, then on getting, the IDL attribute
- must <a href=#split-a-string-on-spaces id=reflecting-content-attributes-in-idl-attributes:split-a-string-on-spaces>split the content attribute on spaces</a> and
- return the concatenation of <a href=#resolve-a-url id=reflecting-content-attributes-in-idl-attributes:resolve-a-url-2>resolving</a> each token URL to an
- <a href=#absolute-url id=reflecting-content-attributes-in-idl-attributes:absolute-url-2>absolute URL</a> relative to the element, with a single U+0020 SPACE character between
- each URL, ignoring any tokens that did not resolve successfully. If the content attribute is
- absent, the IDL attribute must return the default value, if the content attribute has one, or else
- the empty string. On setting, the IDL attribute must set the content attribute to the specified
- literal value.</p>
- <p>If a reflecting IDL attribute is a <code id=reflecting-content-attributes-in-idl-attributes:idl-domstring-3><a href=#idl-domstring>DOMString</a></code> attribute whose content attribute is
- an <a href=#enumerated-attribute id=reflecting-content-attributes-in-idl-attributes:enumerated-attribute>enumerated attribute</a>, and the IDL attribute is <dfn id=limited-to-only-known-values>limited to only known
- values</dfn>, then, on getting, the IDL attribute must return the conforming value associated with
- the state the attribute is in (in its canonical case), if any, or the empty string if the
- attribute is in a state that has no associated keyword value or if the attribute is not in a defined state
- (e.g. the attribute is missing and there is no <i id=reflecting-content-attributes-in-idl-attributes:missing-value-default><a href=#missing-value-default>missing value default</a></i>); and on setting, the
- content attribute must be set to the specified new value.</p>
- <p>If a reflecting IDL attribute is a nullable <code id=reflecting-content-attributes-in-idl-attributes:idl-domstring-4><a href=#idl-domstring>DOMString</a></code>
- attribute whose content attribute is an <a href=#enumerated-attribute id=reflecting-content-attributes-in-idl-attributes:enumerated-attribute-2>enumerated attribute</a>, then, on getting, if
- the corresponding content attribute is in its <i>missing value default</i> then the IDL attribute
- must return null, otherwise, the IDL attribute must return the conforming value associated with
- the state the attribute is in (in its canonical case); and on setting, if the new value is null,
- the content attribute must be removed, and otherwise, the content attribute must be set to the
- specified new value.</p>
- <p>If a reflecting IDL attribute is a <code id=reflecting-content-attributes-in-idl-attributes:idl-domstring-5><a href=#idl-domstring>DOMString</a></code> attribute but doesn't fall into any
- of the above categories, then the getting and setting must be done in a transparent,
- case-preserving manner.</p>
- <p>If a reflecting IDL attribute is a <code id=reflecting-content-attributes-in-idl-attributes:idl-boolean><a href=#idl-boolean>boolean</a></code> attribute, then on
- getting the IDL attribute must return true if the content attribute is set, and false if it is
- absent. On setting, the content attribute must be removed if the IDL attribute is set to false,
- and must be set to the empty string if the IDL attribute is set to true. (This corresponds to the
- rules for <a href=#boolean-attribute id=reflecting-content-attributes-in-idl-attributes:boolean-attribute>boolean content attributes</a>.)</p>
- <p>If a reflecting IDL attribute has a signed integer type (<code id=reflecting-content-attributes-in-idl-attributes:idl-long><a href=#idl-long>long</a></code>)
- then, on getting, the content attribute must be parsed according to the <a href=#rules-for-parsing-integers id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-integers>rules for parsing signed integers</a>, and if that is successful, and the
- value is in the range of the IDL attribute's type, the resulting value must be returned. If, on
- the other hand, it fails or returns an out of range value, or if the attribute is absent, then the
- default value must be returned instead, or 0 if there is no default value. On setting, the given
- value must be converted to the shortest possible string representing the number as a <a href=#valid-integer id=reflecting-content-attributes-in-idl-attributes:valid-integer>valid
- integer</a> and then that string must be used as the new content attribute value.</p>
- <p>If a reflecting IDL attribute has a signed integer type (<code id=reflecting-content-attributes-in-idl-attributes:idl-long-2><a href=#idl-long>long</a></code>)
- that is <dfn id=limited-to-only-non-negative-numbers>limited to only non-negative numbers</dfn> then, on getting, the content attribute
- must be parsed according to the <a href=#rules-for-parsing-non-negative-integers id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>, and if that
- is successful, and the value is in the range of the IDL attribute's type, the resulting value must
- be returned. If, on the other hand, it fails or returns an out of range value, or if the attribute
- is absent, the default value must be returned instead, or −1 if there is no default value.
- On setting, if the value is negative, the user agent must throw an <code id=reflecting-content-attributes-in-idl-attributes:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code>
- exception. Otherwise, the given value must be converted to the shortest possible string
- representing the number as a <a href=#valid-non-negative-integer id=reflecting-content-attributes-in-idl-attributes:valid-non-negative-integer>valid non-negative integer</a> and then that string must be
- used as the new content attribute value.</p>
- <p>If a reflecting IDL attribute has an <em>unsigned</em> integer type (<code id=reflecting-content-attributes-in-idl-attributes:idl-unsigned-long><a href=#idl-unsigned-long>unsigned long</a></code>) then, on getting, the content attribute must be
- parsed according to the <a href=#rules-for-parsing-non-negative-integers id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a>, and if that is
- successful, and the value is in the range 0 to 2147483647 inclusive, the resulting value must be
- returned. If, on the other hand, it fails or returns an out of range value, or if the attribute is
- absent, the default value must be returned instead, or 0 if there is no default value. On setting,
- first, if the new value is in the range 0 to 2147483647, then let <var>n</var> be the new value,
- otherwise let <var>n</var> be the default value, or 0 if there is no default value; then,
- <var>n</var> must be converted to the shortest possible string representing the number as a
- <a href=#valid-non-negative-integer id=reflecting-content-attributes-in-idl-attributes:valid-non-negative-integer-2>valid non-negative integer</a> and that string must be used as the new content attribute
- value.</p>
-
- <p>If a reflecting IDL attribute has an unsigned integer type (<code id=reflecting-content-attributes-in-idl-attributes:idl-unsigned-long-2><a href=#idl-unsigned-long>unsigned long</a></code>) that is <dfn id=limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative numbers
- greater than zero</dfn>, then the behavior is similar to the previous case, but zero is not
- allowed. On getting, the content attribute must first be parsed according to the <a href=#rules-for-parsing-non-negative-integers id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-non-negative-integers-3>rules for
- parsing non-negative integers</a>, and if that is successful, and the value is in the range 1
- to 2147483647 inclusive, the resulting value must be returned. If, on the other hand, it fails or
- returns an out of range value, or if the attribute is absent, the default value must be returned
- instead, or 1 if there is no default value. On setting, if the value is zero, the user agent must
- throw an <code id=reflecting-content-attributes-in-idl-attributes:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception. Otherwise, first, if the new value is in the range
- 1 to 2147483647, then let <var>n</var> be the new value, otherwise let <var>n</var> be the default
- value, or 1 if there is no default value; then, <var>n</var> must be converted to the shortest
- possible string representing the number as a <a href=#valid-non-negative-integer id=reflecting-content-attributes-in-idl-attributes:valid-non-negative-integer-3>valid non-negative integer</a> and that
- string must be used as the new content attribute value.</p>
- <p>If a reflecting IDL attribute has a floating-point number type (<code id=reflecting-content-attributes-in-idl-attributes:idl-double><a href=#idl-double>double</a></code> or <code id=reflecting-content-attributes-in-idl-attributes:idl-unrestricted-double><a href=#idl-unrestricted-double>unrestricted
- double</a></code>), then, on getting, the content attribute must be parsed according to the
- <a href=#rules-for-parsing-floating-point-number-values id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a>, and if that is successful, the
- resulting value must be returned. If, on the other hand, it fails, or if the attribute is absent,
- the default value must be returned instead, or 0.0 if there is no default value. On setting, the
- given value must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=reflecting-content-attributes-in-idl-attributes:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a floating-point
- number</a> and then that string must be used as the new content attribute value.</p>
- <p>If a reflecting IDL attribute has a floating-point number type (<code id=reflecting-content-attributes-in-idl-attributes:idl-double-2><a href=#idl-double>double</a></code> or <code id=reflecting-content-attributes-in-idl-attributes:idl-unrestricted-double-2><a href=#idl-unrestricted-double>unrestricted
- double</a></code>) that is <dfn id=limited-to-numbers-greater-than-zero>limited to numbers greater than zero</dfn>, then the behavior is
- similar to the previous case, but zero and negative values are not allowed. On getting, the
- content attribute must be parsed according to the <a href=#rules-for-parsing-floating-point-number-values id=reflecting-content-attributes-in-idl-attributes:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number
- values</a>, and if that is successful and the value is greater than 0.0, the resulting value
- must be returned. If, on the other hand, it fails or returns an out of range value, or if the
- attribute is absent, the default value must be returned instead, or 0.0 if there is no default
- value. On setting, if the value is less than or equal to zero, then the value must be ignored.
- Otherwise, the given value must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=reflecting-content-attributes-in-idl-attributes:best-representation-of-the-number-as-a-floating-point-number-2>best representation of the number as a
- floating-point number</a> and then that string must be used as the new content attribute
- value.</p>
- <p class=note>The values Infinity and Not-a-Number (NaN) values throw an exception on setting,
- as defined in the Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p>If a reflecting IDL attribute has the type <code id=reflecting-content-attributes-in-idl-attributes:domtokenlist><a href=#domtokenlist>DOMTokenList</a></code> or
- <code id=reflecting-content-attributes-in-idl-attributes:domsettabletokenlist><a href=#domsettabletokenlist>DOMSettableTokenList</a></code>, then on getting it must return a <code id=reflecting-content-attributes-in-idl-attributes:domtokenlist-2><a href=#domtokenlist>DOMTokenList</a></code> or
- <code id=reflecting-content-attributes-in-idl-attributes:domsettabletokenlist-2><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object (as appropriate) whose associated element is the element
- in question and whose associated attribute's local name is the name of the attribute in question.
- The same <code id=reflecting-content-attributes-in-idl-attributes:domtokenlist-3><a href=#domtokenlist>DOMTokenList</a></code> or <code id=reflecting-content-attributes-in-idl-attributes:domsettabletokenlist-3><a href=#domsettabletokenlist>DOMSettableTokenList</a></code> object must be returned
- every time for each attribute.</p>
- <p>If a reflecting IDL attribute has the type <code id=reflecting-content-attributes-in-idl-attributes:htmlelement><a href=#htmlelement>HTMLElement</a></code>, or an interface that
- descends from <code id=reflecting-content-attributes-in-idl-attributes:htmlelement-2><a href=#htmlelement>HTMLElement</a></code>, then, on getting, it must run the following algorithm
- (stopping at the first point where a value is returned):</p>
- <ol><li>If the corresponding content attribute is absent, then the IDL attribute must return
- null.<li>Let <var>candidate</var> be the element that the <code id=reflecting-content-attributes-in-idl-attributes:dom-document-getelementbyid><a href=#dom-document-getelementbyid>document.getElementById()</a></code> method would find when
- called on the content attribute's element's <a id=reflecting-content-attributes-in-idl-attributes:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> if it were passed as its argument the current value of
- the corresponding content attribute.<li>If <var>candidate</var> is null, or if it is not type-compatible with the IDL
- attribute, then the IDL attribute must return null.<li>Otherwise, it must return <var>candidate</var>.</ol>
- <p>On setting, if the given element has an <code id=reflecting-content-attributes-in-idl-attributes:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute, and has the
- same <a href=#home-subtree id=reflecting-content-attributes-in-idl-attributes:home-subtree>home subtree</a> as the element of the attribute being set, and the given element is
- the first element in that <a href=#home-subtree id=reflecting-content-attributes-in-idl-attributes:home-subtree-2>home subtree</a> whose <a href=#concept-id id=reflecting-content-attributes-in-idl-attributes:concept-id>ID</a> is
- the value of that <code id=reflecting-content-attributes-in-idl-attributes:the-id-attribute-2><a href=#the-id-attribute>id</a></code> attribute, then the content attribute must be
- set to the value of that <code id=reflecting-content-attributes-in-idl-attributes:the-id-attribute-3><a href=#the-id-attribute>id</a></code> attribute. Otherwise, the content
- attribute must be set to the empty string.</p>
-
- <h4 id=collections-2>2.7.2 Collections</h4>
- <p>The <code id=collections-2:htmlallcollection-2><a href=#htmlallcollection-2>HTMLAllCollection</a></code>, <code id=collections-2:htmlformcontrolscollection-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code>,
- <code id=collections-2:htmloptionscollection-2><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code>, and <code id=collections-2:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> interfaces are
- <a href=#collections id=collections-2:collections>collections</a> derived from the <code id=collections-2:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>
- <h5 id=htmlallcollection>2.7.2.1 HTMLAllCollection</h5>
- <p>The <code id=htmlallcollection:htmlallcollection-2><a href=#htmlallcollection-2>HTMLAllCollection</a></code> interface is used for the legacy <code id=htmlallcollection:dom-document-all><a href=#dom-document-all>document.all</a></code> attribute. It operates similarly to
- <code id=htmlallcollection:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code>; the main differences are that its <code id=htmlallcollection:dom-htmlallcollection-nameditem><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method returns an
- <code id=htmlallcollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> object when there are multiple matching elements, and that its <code id=htmlallcollection:dom-htmlallcollection-item><a href=#dom-htmlallcollection-item>item()</a></code> method can be used as a synonym for its <code id=htmlallcollection:dom-htmlallcollection-nameditem-2><a href=#dom-htmlallcollection-nameditem>namedItem()</a></code> method.</p>
- <p class=note>All <code id=htmlallcollection:htmlallcollection-2-2><a href=#htmlallcollection-2>HTMLAllCollection</a></code> objects are rooted at a <code id=htmlallcollection:document><a href=#document>Document</a></code>
- and have a filter that matches all elements, so the elements <a href=#represented-by-the-collection id=htmlallcollection:represented-by-the-collection>represented by the
- collection</a> of an <code id=htmlallcollection:htmlallcollection-2-3><a href=#htmlallcollection-2>HTMLAllCollection</a></code> object consist of all the descendant
- elements of the root <code id=htmlallcollection:document-2><a href=#document>Document</a></code>.</p>
- <pre class=idl>interface <dfn id=htmlallcollection-2>HTMLAllCollection</dfn> : <a href=#htmlcollection id=htmlallcollection:htmlcollection-3>HTMLCollection</a> {
- // inherits <a href=#dom-htmlcollection-length id=htmlallcollection:dom-htmlcollection-length>length</a> and 'getter'
- <a href=#element id=htmlallcollection:element>Element</a>? <a href=#dom-htmlallcollection-item id=htmlallcollection:dom-htmlallcollection-item-2>item</a>(unsigned long index);
- (<a href=#htmlcollection id=htmlallcollection:htmlcollection-4>HTMLCollection</a> or <a href=#element id=htmlallcollection:element-2>Element</a>)? <a href=#dom-htmlallcollection-item-string id=htmlallcollection:dom-htmlallcollection-item-string>item</a>(DOMString name);
- legacycaller getter (<a href=#htmlcollection id=htmlallcollection:htmlcollection-5>HTMLCollection</a> or <a href=#element id=htmlallcollection:element-3>Element</a>)? <a href=#dom-htmlallcollection-nameditem id=htmlallcollection:dom-htmlallcollection-nameditem-3>namedItem</a>(DOMString name); // shadows inherited namedItem()
- };</pre>
- <dl class=domintro><dt><var>collection</var> . <code id=htmlallcollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
- <p>Returns the number of elements in the collection.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmlallcollection:dom-htmlallcollection-item-3><a href=#dom-htmlallcollection-item>item</a></code>(<var>index</var>)<dt><var>collection</var>[<var>index</var>]<dd>
- <p>Returns the item with index <var>index</var> from the collection. The items are sorted in <a href=#tree-order id=htmlallcollection:tree-order>tree order</a>.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmlallcollection:dom-htmlallcollection-item-string-2><a href=#dom-htmlallcollection-item-string>item</a></code>(<var>name</var>)<dt><var>collection</var> = <var>collection</var> . <code id=htmlallcollection:dom-htmlallcollection-item-string-3><a href=#dom-htmlallcollection-item-string>item</a></code>(<var>name</var>)<dt><var>element</var> = <var>collection</var> . <code id=htmlallcollection:dom-htmlallcollection-nameditem-4><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>collection</var> = <var>collection</var> . <code id=htmlallcollection:dom-htmlallcollection-nameditem-5><a href=#dom-htmlallcollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>element</var> = <var>collection</var>(<var>name</var>)<dt><var>collection</var> = <var>collection</var>(<var>name</var>)<dt><var>collection</var>[<var>name</var>]<dd>
- <p>Returns the item with <a href=#concept-id id=htmlallcollection:concept-id>ID</a> or name <var>name</var> from the collection.</p>
- <p>If there are multiple matching items, then an <code id=htmlallcollection:htmlcollection-6><a href=#htmlcollection>HTMLCollection</a></code> object containing all those elements is returned.</p>
-
- <p>Only <code id=htmlallcollection:the-button-element><a href=#the-button-element>button</a></code>, <code id=htmlallcollection:the-form-element><a href=#the-form-element>form</a></code>, <code id=htmlallcollection:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=htmlallcollection:the-input-element><a href=#the-input-element>input</a></code>, <code id=htmlallcollection:the-map-element><a href=#the-map-element>map</a></code>, <code id=htmlallcollection:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=htmlallcollection:the-object-element><a href=#the-object-element>object</a></code>,
- <code id=htmlallcollection:the-select-element><a href=#the-select-element>select</a></code>, and <code id=htmlallcollection:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements can have a name for the purpose of this
- method; their name is given by the value of their <code>name</code> attribute.</p>
- </dl>
-
- <p>The object's <a href=#supported-property-indices id=htmlallcollection:supported-property-indices>supported property indices</a> are as defined for
- <code id=htmlallcollection:htmlcollection-7><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
- <p>The <dfn id=dom-htmlallcollection-item><code>item()</code></dfn> method, when invoked
- with a numeric argument, must act like the <a href=#dom-htmlcollection-item id=htmlallcollection:dom-htmlcollection-item>item()</a>
- method inherited from <code id=htmlallcollection:htmlcollection-8><a href=#htmlcollection>HTMLCollection</a></code>.</p>
-
- <p>The following elements are <dfn id=all-named-elements>"all"-named elements</dfn>:
- <code id=htmlallcollection:the-a-element><a href=#the-a-element>a</a></code>,
- <code id=htmlallcollection:the-applet-element><a href=#the-applet-element>applet</a></code>,
- <code id=htmlallcollection:the-button-element-2><a href=#the-button-element>button</a></code>,
- <code id=htmlallcollection:the-embed-element><a href=#the-embed-element>embed</a></code>,
- <code id=htmlallcollection:the-form-element-2><a href=#the-form-element>form</a></code>,
- <code id=htmlallcollection:frame><a href=#frame>frame</a></code>,
- <code id=htmlallcollection:frameset><a href=#frameset>frameset</a></code>,
- <code id=htmlallcollection:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>,
- <code id=htmlallcollection:the-img-element><a href=#the-img-element>img</a></code>,
- <code id=htmlallcollection:the-input-element-2><a href=#the-input-element>input</a></code>,
-
- <code id=htmlallcollection:the-map-element-2><a href=#the-map-element>map</a></code>,
- <code id=htmlallcollection:the-meta-element-2><a href=#the-meta-element>meta</a></code>,
- <code id=htmlallcollection:the-object-element-2><a href=#the-object-element>object</a></code>,
- <code id=htmlallcollection:the-select-element-2><a href=#the-select-element>select</a></code>, and
- <code id=htmlallcollection:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>
- </p>
- <p>The <a href=#supported-property-names id=htmlallcollection:supported-property-names>supported property names</a> consist of the non-empty values of all the <code id=htmlallcollection:the-id-attribute><a href=#the-id-attribute>id</a></code> attributes of all the elements <a href=#represented-by-the-collection id=htmlallcollection:represented-by-the-collection-2>represented by the
- collection</a>, and the non-empty values of all the <code>name</code> attributes of
- all the <a href=#all-named-elements id=htmlallcollection:all-named-elements>"all"-named elements</a> <a href=#represented-by-the-collection id=htmlallcollection:represented-by-the-collection-3>represented by the collection</a>, in
- <a href=#tree-order id=htmlallcollection:tree-order-2>tree order</a>, ignoring later duplicates, with the <code id=htmlallcollection:the-id-attribute-2><a href=#the-id-attribute>id</a></code> of
- an element preceding its <code>name</code> if it contributes both, they differ from each
- other, and neither is the duplicate of an earlier entry.</p>
- <p>The properties exposed in this way must be <a href=#unenumerable id=htmlallcollection:unenumerable>unenumerable</a>.</p>
- <p>The <dfn id=dom-htmlallcollection-item-string><code>item(<var>name</var>)</code></dfn> and <dfn id=dom-htmlallcollection-nameditem><code>namedItem(<var>name</var>)</code></dfn>
- methods must act according to the following algorithm:</p>
- <ol><li>If <var>name</var> is the empty string, return null and stop the algorithm.<li>
- <p>Let <var>collection</var> be an <code id=htmlallcollection:htmlcollection-9><a href=#htmlcollection>HTMLCollection</a></code> object rooted at the
- same <code id=htmlallcollection:document-3><a href=#document>Document</a></code> as the <code id=htmlallcollection:htmlallcollection-2-4><a href=#htmlallcollection-2>HTMLAllCollection</a></code> object on which the method was
- invoked, whose filter matches only elements that are either:</p>
- <ul><li><a href=#all-named-elements id=htmlallcollection:all-named-elements-2>"all"-named elements</a> with a <code>name</code> attribute equal to
- <var>name</var>, or,<li>elements with an <a href=#concept-id id=htmlallcollection:concept-id-2>ID</a> equal to <var>name</var>.</ul>
- <li>If, at the time the method is called, there is exactly one node in <var>collection</var>, then return that node and stop the algorithm.<li>Otherwise, if, at the time the method is called, <var>collection</var> is empty,
- return null and stop the algorithm.<li>Otherwise, return <var>collection</var>.</ol>
-
- <h5 id=htmlformcontrolscollection>2.7.2.2 HTMLFormControlsCollection</h5>
- <p>The <code id=htmlformcontrolscollection:htmlformcontrolscollection-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> interface is used for <a href=#collections id=htmlformcontrolscollection:collections>collections</a> of
- <a href=#category-listed id=htmlformcontrolscollection:category-listed>listed elements</a> in <code id=htmlformcontrolscollection:the-form-element><a href=#the-form-element>form</a></code> and
- <code id=htmlformcontrolscollection:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> elements.</p>
- <pre class=idl>interface <dfn id=htmlformcontrolscollection-2>HTMLFormControlsCollection</dfn> : <a href=#htmlcollection id=htmlformcontrolscollection:htmlcollection>HTMLCollection</a> {
- // inherits <a href=#dom-htmlcollection-length id=htmlformcontrolscollection:dom-htmlcollection-length>length</a> and <a href=#dom-htmlcollection-item id=htmlformcontrolscollection:dom-htmlcollection-item>item</a>()
- legacycaller getter (<a href=#radionodelist id=htmlformcontrolscollection:radionodelist>RadioNodeList</a> or <a href=#element id=htmlformcontrolscollection:element>Element</a>)? <a href=#dom-htmlformcontrolscollection-nameditem id=htmlformcontrolscollection:dom-htmlformcontrolscollection-nameditem>namedItem</a>(DOMString name); // shadows inherited namedItem()
- };
- interface <dfn id=radionodelist>RadioNodeList</dfn> : <a href=#nodelist id=htmlformcontrolscollection:nodelist>NodeList</a> {
- attribute DOMString <a href=#dom-radionodelist-value id=htmlformcontrolscollection:dom-radionodelist-value>value</a>;
- };</pre>
- <dl class=domintro><dt><var>collection</var> . <code id=htmlformcontrolscollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
- <p>Returns the number of elements in the collection.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmlformcontrolscollection:dom-htmlcollection-item-2><a href=#dom-htmlcollection-item>item</a></code>(<var>index</var>)<dt><var>collection</var>[<var>index</var>]<dd>
- <p>Returns the item with index <var>index</var> from the collection. The items are sorted in <a href=#tree-order id=htmlformcontrolscollection:tree-order>tree order</a>.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmlformcontrolscollection:dom-htmlformcontrolscollection-nameditem-2><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>radioNodeList</var> = <var>collection</var> . <code id=htmlformcontrolscollection:dom-htmlformcontrolscollection-nameditem-3><a href=#dom-htmlformcontrolscollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>collection</var>[<var>name</var>]<dt><var>collection</var>(<var>name</var>)<dd>
- <p>Returns the item with <a href=#concept-id id=htmlformcontrolscollection:concept-id>ID</a> or <code id=htmlformcontrolscollection:attr-fe-name><a href=#attr-fe-name>name</a></code> <var>name</var> from the collection.</p>
- <p>If there are multiple matching items, then a <code id=htmlformcontrolscollection:radionodelist-2><a href=#radionodelist>RadioNodeList</a></code> object containing all those elements is returned.</p>
- <dt><var>radioNodeList</var> . <var>value</var> [ = <var>value</var> ]<dd>
- <p>Returns the value of the first checked radio button represented by the object.</p>
- <p>Can be set, to check the first radio button with the given value represented by the object.</p>
- </dl>
-
- <p>The object's <a href=#supported-property-indices id=htmlformcontrolscollection:supported-property-indices>supported property indices</a> are as defined for
- <code id=htmlformcontrolscollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
- <p>The <a href=#supported-property-names id=htmlformcontrolscollection:supported-property-names>supported property names</a> consist of the non-empty values of all the <code id=htmlformcontrolscollection:the-id-attribute><a href=#the-id-attribute>id</a></code> and <code id=htmlformcontrolscollection:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attributes of all the
- elements <a href=#represented-by-the-collection id=htmlformcontrolscollection:represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order id=htmlformcontrolscollection:tree-order-2>tree order</a>, ignoring later
- duplicates, with the <code id=htmlformcontrolscollection:the-id-attribute-2><a href=#the-id-attribute>id</a></code> of an element preceding its <code id=htmlformcontrolscollection:attr-fe-name-3><a href=#attr-fe-name>name</a></code> if it contributes both, they differ from each other, and neither is the
- duplicate of an earlier entry.</p>
- <p>The properties exposed in this way must be <a href=#unenumerable id=htmlformcontrolscollection:unenumerable>unenumerable</a>.</p>
- <p>The <dfn id=dom-htmlformcontrolscollection-nameditem><code>namedItem(<var>name</var>)</code></dfn> method must act according to the following algorithm:</p>
- <ol><li>If <var>name</var> is the empty string, return null and stop the algorithm.<li>If, at the time the method is called, there is exactly one node in the collection that has
- either an <code id=htmlformcontrolscollection:the-id-attribute-3><a href=#the-id-attribute>id</a></code> attribute or a <code id=htmlformcontrolscollection:attr-fe-name-4><a href=#attr-fe-name>name</a></code>
- attribute equal to <var>name</var>, then return that node and stop the algorithm.<li>Otherwise, if there are no nodes in the collection that have either an <code id=htmlformcontrolscollection:the-id-attribute-4><a href=#the-id-attribute>id</a></code> attribute or a <code id=htmlformcontrolscollection:attr-fe-name-5><a href=#attr-fe-name>name</a></code> attribute equal
- to <var>name</var>, then return null and stop the algorithm.<li>Otherwise, create a new <code id=htmlformcontrolscollection:radionodelist-3><a href=#radionodelist>RadioNodeList</a></code> object representing a <a href=#live id=htmlformcontrolscollection:live>live</a>
- view of the <code id=htmlformcontrolscollection:htmlformcontrolscollection-2-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> object, further filtered so that the only
- nodes in the <code id=htmlformcontrolscollection:radionodelist-4><a href=#radionodelist>RadioNodeList</a></code> object are those that have either an <code id=htmlformcontrolscollection:the-id-attribute-5><a href=#the-id-attribute>id</a></code> attribute or a <code id=htmlformcontrolscollection:attr-fe-name-6><a href=#attr-fe-name>name</a></code> attribute equal
- to <var>name</var>. The nodes in the <code id=htmlformcontrolscollection:radionodelist-5><a href=#radionodelist>RadioNodeList</a></code> object must be sorted in
- <a href=#tree-order id=htmlformcontrolscollection:tree-order-3>tree order</a>.<li>Return that <code id=htmlformcontrolscollection:radionodelist-6><a href=#radionodelist>RadioNodeList</a></code> object.</ol>
- <hr>
- <p>Members of the <code id=htmlformcontrolscollection:radionodelist-7><a href=#radionodelist>RadioNodeList</a></code> interface inherited from the <code id=htmlformcontrolscollection:nodelist-2><a href=#nodelist>NodeList</a></code>
- interface must behave as they would on a <code id=htmlformcontrolscollection:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
- <p>The <dfn id=dom-radionodelist-value><code>value</code></dfn> IDL attribute on the
- <code id=htmlformcontrolscollection:radionodelist-8><a href=#radionodelist>RadioNodeList</a></code> object, on getting, must return the value returned by running the
- following steps:</p>
- <ol><li><p>Let <var>element</var> be the first element in <a href=#tree-order id=htmlformcontrolscollection:tree-order-4>tree order</a>
- represented by the <code id=htmlformcontrolscollection:radionodelist-9><a href=#radionodelist>RadioNodeList</a></code> object that is an <code id=htmlformcontrolscollection:the-input-element><a href=#the-input-element>input</a></code> element whose
- <code id=htmlformcontrolscollection:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="htmlformcontrolscollection:radio-button-state-(type=radio)">Radio Button</a> state and whose <a href=#concept-fe-checked id=htmlformcontrolscollection:concept-fe-checked>checkedness</a> is true. Otherwise, let it be null.<li><p>If <var>element</var> is null, return the empty string.<li><p>If <var>element</var> is an element with no <code id=htmlformcontrolscollection:attr-input-value><a href=#attr-input-value>value</a></code> attribute, return the string "<code>on</code>".<li><p>Otherwise, return the value of <var>element</var>'s <code id=htmlformcontrolscollection:attr-input-value-2><a href=#attr-input-value>value</a></code> attribute.</ol>
- <p>On setting, the <code id=htmlformcontrolscollection:dom-radionodelist-value-2><a href=#dom-radionodelist-value>value</a></code> IDL attribute must run the
- following steps:</p>
- <ol><li><p>If the new value is the string "<code>on</code>": let <var>element</var> be the first element in <a href=#tree-order id=htmlformcontrolscollection:tree-order-5>tree order</a>
- represented by the <code id=htmlformcontrolscollection:radionodelist-10><a href=#radionodelist>RadioNodeList</a></code> object that is an <code id=htmlformcontrolscollection:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=htmlformcontrolscollection:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="htmlformcontrolscollection:radio-button-state-(type=radio)-2">Radio Button</a> state and whose <code id=htmlformcontrolscollection:attr-input-value-3><a href=#attr-input-value>value</a></code> content attribute is either absent, or present and equal to the new value, if any. If no such element exists, then instead let <var>element</var> be null.</p>
- <p>Otherwise: let <var>element</var> be the first element in <a href=#tree-order id=htmlformcontrolscollection:tree-order-6>tree order</a>
- represented by the <code id=htmlformcontrolscollection:radionodelist-11><a href=#radionodelist>RadioNodeList</a></code> object that is an <code id=htmlformcontrolscollection:the-input-element-3><a href=#the-input-element>input</a></code> element whose
- <code id=htmlformcontrolscollection:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="htmlformcontrolscollection:radio-button-state-(type=radio)-3">Radio Button</a> state and whose <code id=htmlformcontrolscollection:attr-input-value-4><a href=#attr-input-value>value</a></code> content attribute is present and equal to the new value, if
- any. If no such element exists, then instead let <var>element</var> be null.<li><p>If <var>element</var> is not null, then set its <a href=#concept-fe-checked id=htmlformcontrolscollection:concept-fe-checked-2>checkedness</a> to true.</p>
- </ol>
-
- <h5 id=htmloptionscollection>2.7.2.3 HTMLOptionsCollection</h5>
- <p>The <code id=htmloptionscollection:htmloptionscollection-2><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> interface is used for <a href=#collections id=htmloptionscollection:collections>collections</a> of
- <code id=htmloptionscollection:the-option-element><a href=#the-option-element>option</a></code> elements. It is always rooted on a <code id=htmloptionscollection:the-select-element><a href=#the-select-element>select</a></code> element and has
- attributes and methods that manipulate that element's descendants.</p>
- <pre class=idl>interface <dfn id=htmloptionscollection-2>HTMLOptionsCollection</dfn> : <a href=#htmlcollection id=htmloptionscollection:htmlcollection>HTMLCollection</a> {
- // inherits <a href=#dom-htmlcollection-item id=htmloptionscollection:dom-htmlcollection-item>item</a>()
- attribute unsigned long <a href=#dom-htmloptionscollection-length id=htmloptionscollection:dom-htmloptionscollection-length>length</a>; // shadows inherited length
- <a href=#dom-htmloptionscollection-nameditem id=htmloptionscollection:dom-htmloptionscollection-nameditem>legacycaller</a> <a href=#htmloptionelement id=htmloptionscollection:htmloptionelement>HTMLOptionElement</a>? (DOMString name);
- <a href=#dom-htmloptionscollection-setter id=htmloptionscollection:dom-htmloptionscollection-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement id=htmloptionscollection:htmloptionelement-2>HTMLOptionElement</a>? option);
- void <a href=#dom-htmloptionscollection-add id=htmloptionscollection:dom-htmloptionscollection-add>add</a>((<a href=#htmloptionelement id=htmloptionscollection:htmloptionelement-3>HTMLOptionElement</a> or <a href=#htmloptgroupelement id=htmloptionscollection:htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement id=htmloptionscollection:htmlelement>HTMLElement</a> or long)? before = null);
- void <a href=#dom-htmloptionscollection-remove id=htmloptionscollection:dom-htmloptionscollection-remove>remove</a>(long index);
- attribute long <a href=#dom-htmloptionscollection-selectedindex id=htmloptionscollection:dom-htmloptionscollection-selectedindex>selectedIndex</a>;
- };</pre>
- <dl class=domintro><dt><var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-length-2><a href=#dom-htmloptionscollection-length>length</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the number of elements in the collection.</p>
- <p>When set to a smaller number, truncates the number of <code id=htmloptionscollection:the-option-element-2><a href=#the-option-element>option</a></code> elements in the corresponding container.</p>
- <p>When set to a greater number, adds new blank <code id=htmloptionscollection:the-option-element-3><a href=#the-option-element>option</a></code> elements to that container.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmloptionscollection:dom-htmlcollection-item-2><a href=#dom-htmlcollection-item>item</a></code>(<var>index</var>)<dt><var>collection</var>[<var>index</var>]<dd>
- <p>Returns the item with index <var>index</var> from the collection. The items are sorted in <a href=#tree-order id=htmloptionscollection:tree-order>tree order</a>.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-nameditem-2><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>nodeList</var> = <var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-nameditem-3><a href=#dom-htmloptionscollection-nameditem>namedItem</a></code>(<var>name</var>)<dt><var>collection</var>[<var>name</var>]<dt><var>collection</var>(<var>name</var>)<dd>
- <p>Returns the item with <a href=#concept-id id=htmloptionscollection:concept-id>ID</a> or <code id=htmloptionscollection:attr-option-name><a href=#attr-option-name>name</a></code> <var>name</var> from the collection.</p>
- <p>If there are multiple matching items, then the first is returned.</p>
- <dt><var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-add-2><a href=#dom-htmloptionscollection-add>add</a></code>(<var>element</var> [, <var>before</var> ] )<dd>
- <p>Inserts <var>element</var> before the node given by <var>before</var>.</p>
- <p>The <var>before</var> argument can be a number, in which case <var>element</var> is inserted before the item with that number, or an element from the
- collection, in which case <var>element</var> is inserted before that element.</p>
- <p>If <var>before</var> is omitted, null, or a number out of range, then <var>element</var> will be added at the end of the list.</p>
- <p>This method will throw a <code id=htmloptionscollection:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception if <var>element</var> is an ancestor of the element into which it is to be inserted.</p>
- <dt><var>collection</var> . <code id=htmloptionscollection:dom-htmloptionscollection-selectedindex-2><a href=#dom-htmloptionscollection-selectedindex>selectedIndex</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the index of the first selected item, if any, or −1 if there is no selected
- item.</p>
- <p>Can be set, to change the selection.</p>
- </dl>
-
- <p>The object's <a href=#supported-property-indices id=htmloptionscollection:supported-property-indices>supported property indices</a> are as defined for
- <code id=htmloptionscollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
- <p>On getting, the <dfn id=dom-htmloptionscollection-length><code>length</code></dfn>
- attribute must return the number of nodes <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection>represented by the collection</a>.</p>
- <p>On setting, the behavior depends on whether the new value is equal to, greater than, or less
- than the number of nodes <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection-2>represented by the collection</a> at that time. If the number is
- the same, then setting the attribute must do nothing. If the new value is greater, then <var>n</var> new <code id=htmloptionscollection:the-option-element-4><a href=#the-option-element>option</a></code> elements with no attributes and no child nodes must be
- appended to the <code id=htmloptionscollection:the-select-element-2><a href=#the-select-element>select</a></code> element on which the <code id=htmloptionscollection:htmloptionscollection-2-2><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is
- rooted, where <var>n</var> is the difference between the two numbers (new value minus old
- value). Mutation events must be fired as if a <code id=htmloptionscollection:documentfragment><a href=#documentfragment>DocumentFragment</a></code> containing the new
- <code id=htmloptionscollection:the-option-element-5><a href=#the-option-element>option</a></code> elements had been inserted. If the new value is lower, then the last <var>n</var> nodes in the collection must be removed from their parent nodes, where <var>n</var> is the difference between the two numbers (old value minus new value).</p>
- <p class=note>Setting <code id=htmloptionscollection:dom-htmloptionscollection-length-3><a href=#dom-htmloptionscollection-length>length</a></code> never removes
- or adds any <code id=htmloptionscollection:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> elements, and never adds new children to existing
- <code id=htmloptionscollection:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> elements (though it can remove children from them).</p>
- <p>The <a href=#supported-property-names id=htmloptionscollection:supported-property-names>supported property names</a> consist of the non-empty values of all the <code id=htmloptionscollection:the-id-attribute><a href=#the-id-attribute>id</a></code> and <code id=htmloptionscollection:attr-option-name-2><a href=#attr-option-name>name</a></code> attributes of all the
- elements <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection-3>represented by the collection</a>, in <a href=#tree-order id=htmloptionscollection:tree-order-2>tree order</a>, ignoring later
- duplicates, with the <code id=htmloptionscollection:the-id-attribute-2><a href=#the-id-attribute>id</a></code> of an element preceding its <code id=htmloptionscollection:attr-option-name-3><a href=#attr-option-name>name</a></code> if it contributes both, they differ from each other, and neither is
- the duplicate of an earlier entry.</p>
- <p>The properties exposed in this way must be <a href=#unenumerable id=htmloptionscollection:unenumerable>unenumerable</a>.</p>
- <p>The <dfn id=dom-htmloptionscollection-nameditem>legacy caller</dfn> of the
- <code id=htmloptionscollection:htmloptionscollection-2-3><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> interface must act like the <code id=htmloptionscollection:dom-htmlcollection-nameditem><a href=#dom-htmlcollection-nameditem>namedItem()</a></code> method on the ancestor
- <code id=htmloptionscollection:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> interface.</p>
- <p>When the user agent is to <dfn id=dom-htmloptionscollection-setter>set the value of a new
- indexed property or set the value of an existing indexed property</dfn> for a given property index
- <var>index</var> to a new value <var>value</var>, it must run the following
- algorithm:</p>
- <ol><li><p>If <var>value</var> is null, invoke the steps for the <code id=htmloptionscollection:dom-htmloptionscollection-remove-2><a href=#dom-htmloptionscollection-remove>remove</a></code> method with <var>index</var> as
- the argument, and abort these steps.<li><p>Let <var>length</var> be the number of nodes <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection-4>represented by the
- collection</a>.<li><p>Let <var>n</var> be <var>index</var> minus <var>length</var>.<li><p>If <var>n</var> is greater than zero, then <a href=#concept-node-append id=htmloptionscollection:concept-node-append>append</a> a <code id=htmloptionscollection:documentfragment-2><a href=#documentfragment>DocumentFragment</a></code> consisting of <span><var>n</var>-1</span> new <code id=htmloptionscollection:the-option-element-6><a href=#the-option-element>option</a></code> elements with no attributes and
- no child nodes to the <code id=htmloptionscollection:the-select-element-3><a href=#the-select-element>select</a></code> element on which the <code id=htmloptionscollection:htmloptionscollection-2-4><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code>
- is rooted.<li><p>If <var>n</var> is greater than or equal to zero, <a href=#concept-node-append id=htmloptionscollection:concept-node-append-2>append</a> <var>value</var> to the <code id=htmloptionscollection:the-select-element-4><a href=#the-select-element>select</a></code>
- element. Otherwise, <a href=#concept-node-replace id=htmloptionscollection:concept-node-replace>replace</a> the <var>index</var>th element in the collection by <var>value</var>.</ol>
- <p>The <dfn id=dom-htmloptionscollection-add><code>add(<var>element</var>, <var>before</var>)</code></dfn> method must act according to the following algorithm:</p>
- <ol><li><p>If <var>element</var> is an ancestor of the <code id=htmloptionscollection:the-select-element-5><a href=#the-select-element>select</a></code> element on which
- the <code id=htmloptionscollection:htmloptionscollection-2-5><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is rooted, then throw a <code id=htmloptionscollection:hierarchyrequesterror-2><a href=#hierarchyrequesterror>HierarchyRequestError</a></code>
- exception and abort these steps.<li><p>If <var>before</var> is an element, but that element isn't a descendant of the
- <code id=htmloptionscollection:the-select-element-6><a href=#the-select-element>select</a></code> element on which the <code id=htmloptionscollection:htmloptionscollection-2-6><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is rooted, then throw
- a <code id=htmloptionscollection:notfounderror><a href=#notfounderror>NotFoundError</a></code> exception and abort these steps.<li><p>If <var>element</var> and <var>before</var> are the same element, then
- return and abort these steps.<li><p>If <var>before</var> is a node, then let <var>reference</var> be that
- node. Otherwise, if <var>before</var> is an integer, and there is a <var>before</var>th node in the collection, let <var>reference</var> be that node.
- Otherwise, let <var>reference</var> be null.<li><p>If <var>reference</var> is not null, let <var>parent</var> be the parent
- node of <var>reference</var>. Otherwise, let <var>parent</var> be the
- <code id=htmloptionscollection:the-select-element-7><a href=#the-select-element>select</a></code> element on which the <code id=htmloptionscollection:htmloptionscollection-2-7><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is rooted.<li><p>Act as if the DOM <code id=htmloptionscollection:dom-node-insertbefore><a href=#dom-node-insertbefore>insertBefore()</a></code> method was
- invoked on the <var>parent</var> node, with <var>element</var> as the first
- argument and <var>reference</var> as the second argument.</p>
- </ol>
- <p>The <dfn id=dom-htmloptionscollection-remove><code>remove(<var>index</var>)</code></dfn> method must act according to the following algorithm:</p>
- <ol><li><p>If the number of nodes <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection-5>represented by the collection</a> is zero, abort these
- steps.<li><p>If <var>index</var> is not a number greater than or equal to 0 and less than the
- number of nodes <a href=#represented-by-the-collection id=htmloptionscollection:represented-by-the-collection-6>represented by the collection</a>, abort these steps.<li><p>Let <var>element</var> be the <var>index</var>th element in the
- collection.<li><p>Remove <var>element</var> from its parent node.</ol>
- <p>The <dfn id=dom-htmloptionscollection-selectedindex><code>selectedIndex</code></dfn> IDL
- attribute must act like the identically named attribute on the <code id=htmloptionscollection:the-select-element-8><a href=#the-select-element>select</a></code> element on
- which the <code id=htmloptionscollection:htmloptionscollection-2-8><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> is rooted</p>
-
-
- <h5 id=htmlpropertiescollection>2.7.2.4 HTMLPropertiesCollection</h5>
- <p>The <code id=htmlpropertiescollection:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> interface is used for <a href=#collections id=htmlpropertiescollection:collections>collections</a> of
- elements that add <a href=#the-properties-of-an-item id=htmlpropertiescollection:the-properties-of-an-item>name-value pairs</a> to a particular
- <a href=#concept-item id=htmlpropertiescollection:concept-item>item</a> in the <a href=#microdata id=htmlpropertiescollection:microdata>microdata</a> model.</p>
- <pre class=idl>interface <dfn id=htmlpropertiescollection-2>HTMLPropertiesCollection</dfn> : <a href=#htmlcollection id=htmlpropertiescollection:htmlcollection>HTMLCollection</a> {
- // inherits <a href=#dom-htmlcollection-length id=htmlpropertiescollection:dom-htmlcollection-length>length</a> and <a href=#dom-htmlcollection-item id=htmlpropertiescollection:dom-htmlcollection-item>item</a>()
- getter <a href=#propertynodelist id=htmlpropertiescollection:propertynodelist>PropertyNodeList</a>? <a href=#dom-htmlpropertiescollection-nameditem id=htmlpropertiescollection:dom-htmlpropertiescollection-nameditem>namedItem</a>(DOMString name); // shadows inherited namedItem()
- readonly attribute DOMString[] <a href=#dom-htmlpropertiescollection-names id=htmlpropertiescollection:dom-htmlpropertiescollection-names>names</a>;
- };
- typedef sequence<any> <dfn id=propertyvaluearray>PropertyValueArray</dfn>;
- interface <dfn id=propertynodelist>PropertyNodeList</dfn> : <a href=#nodelist id=htmlpropertiescollection:nodelist>NodeList</a> {
- <a href=#propertyvaluearray id=htmlpropertiescollection:propertyvaluearray>PropertyValueArray</a> <a href=#dom-propertynodelist-getvalues id=htmlpropertiescollection:dom-propertynodelist-getvalues>getValues</a>();
- };</pre>
- <dl class=domintro><dt><var>collection</var> . <code id=htmlpropertiescollection:dom-htmlcollection-length-2><a href=#dom-htmlcollection-length>length</a></code><dd>
- <p>Returns the number of elements in the collection.</p>
- <dt><var>element</var> = <var>collection</var> . <code id=htmlpropertiescollection:dom-htmlcollection-item-2><a href=#dom-htmlcollection-item>item</a></code>(<var>index</var>)<dt><var>collection</var>[<var>index</var>]<dd>
- <p>Returns the element with index <var>index</var> from the collection. The items are sorted in <a href=#tree-order id=htmlpropertiescollection:tree-order>tree order</a>.</p>
- <dt><var>propertyNodeList</var> = <var>collection</var> . <code id=htmlpropertiescollection:dom-htmlpropertiescollection-nameditem-2><a href=#dom-htmlpropertiescollection-nameditem>namedItem</a></code>(<var>name</var>)<dd>
- <p>Returns a <code id=htmlpropertiescollection:propertynodelist-2><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var>name</var>.</p>
- <dt><var>collection</var>[<var>name</var>]<dd>
- <p>Returns a <code id=htmlpropertiescollection:propertynodelist-3><a href=#propertynodelist>PropertyNodeList</a></code> object containing any elements that add a property named <var>name</var>. The <var>name</var> index has to be one of the values listed in the <code id=htmlpropertiescollection:dom-htmlpropertiescollection-names-2><a href=#dom-htmlpropertiescollection-names>names</a></code> list.</p>
- <dt><var>collection</var> . <code id=htmlpropertiescollection:dom-htmlpropertiescollection-names-3><a href=#dom-htmlpropertiescollection-names>names</a></code><dd>
- <p>Returns an array with the <a href=#property-names id=htmlpropertiescollection:property-names>property names</a> of the elements in the collection.</p>
- <dt><var>propertyNodeList</var> . <code id=htmlpropertiescollection:dom-propertynodelist-getvalues-2><a href=#dom-propertynodelist-getvalues>getValues</a></code>()<dd>
- <p>Returns an array of the various values that the relevant elements have.</p>
- </dl>
-
- <p>The object's <a href=#supported-property-indices id=htmlpropertiescollection:supported-property-indices>supported property indices</a> are as defined for
- <code id=htmlpropertiescollection:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> objects.</p>
- <p>The <a href=#supported-property-names id=htmlpropertiescollection:supported-property-names>supported property names</a> consist of the <a href=#property-names id=htmlpropertiescollection:property-names-2>property names</a> of all the
- elements <a href=#represented-by-the-collection id=htmlpropertiescollection:represented-by-the-collection>represented by the collection</a>, in <a href=#tree-order id=htmlpropertiescollection:tree-order-2>tree order</a>, ignoring later
- duplicates.</p>
- <p>The properties exposed in this way must be <a href=#unenumerable id=htmlpropertiescollection:unenumerable>unenumerable</a>.</p>
- <p>The <dfn id=dom-htmlpropertiescollection-names><code>names</code></dfn> attribute must
- return a <a href=#live id=htmlpropertiescollection:live>live</a> <a href=#dfn-read-only-array id=htmlpropertiescollection:dfn-read-only-array>read only</a> array object giving
- the <a href=#property-names id=htmlpropertiescollection:property-names-3>property names</a> of all the elements <a href=#represented-by-the-collection id=htmlpropertiescollection:represented-by-the-collection-2>represented by the collection</a>,
- listed in <a href=#tree-order id=htmlpropertiescollection:tree-order-3>tree order</a>, but with duplicates removed, leaving only the first occurrence
- of each name. The same object must be returned each time.</p>
- <p>The <dfn id=dom-htmlpropertiescollection-nameditem><code>namedItem(<var>name</var>)</code></dfn> method must return a <code id=htmlpropertiescollection:propertynodelist-4><a href=#propertynodelist>PropertyNodeList</a></code> object
- representing a <a href=#live id=htmlpropertiescollection:live-2>live</a> view of the <code id=htmlpropertiescollection:htmlpropertiescollection-2-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object, further
- filtered so that the only nodes in the <code id=htmlpropertiescollection:propertynodelist-5><a href=#propertynodelist>PropertyNodeList</a></code> object are those that have a
- <a href=#property-names id=htmlpropertiescollection:property-names-4>property name</a> equal to <var>name</var>. The nodes in
- the <code id=htmlpropertiescollection:propertynodelist-6><a href=#propertynodelist>PropertyNodeList</a></code> object must be sorted in <a href=#tree-order id=htmlpropertiescollection:tree-order-4>tree order</a>, and the same
- object must be returned each time a particular <var>name</var> is queried.</p>
- <hr>
- <p>Members of the <code id=htmlpropertiescollection:propertynodelist-7><a href=#propertynodelist>PropertyNodeList</a></code> interface inherited from the <code id=htmlpropertiescollection:nodelist-2><a href=#nodelist>NodeList</a></code>
- interface must behave as they would on a <code id=htmlpropertiescollection:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
- <p>The <dfn id=dom-propertynodelist-getvalues><code>getValues</code></dfn> method the
- <code id=htmlpropertiescollection:propertynodelist-8><a href=#propertynodelist>PropertyNodeList</a></code> object must return a newly constructed array whose values are the
- values obtained from the <code id=htmlpropertiescollection:dom-itemvalue><a href=#dom-itemvalue>itemValue</a></code> IDL attribute of each of the
- elements represented by the object, in <a href=#tree-order id=htmlpropertiescollection:tree-order-5>tree order</a>.</p>
-
- <h4 id=domstringmap>2.7.3 DOMStringMap</h4>
- <p>The <code id=domstringmap:domstringmap-2><a href=#domstringmap-2>DOMStringMap</a></code> interface represents a set of name-value pairs. It exposes these
- using the scripting language's native mechanisms for property access.</p>
-
- <p>When a <code id=domstringmap:domstringmap-2-2><a href=#domstringmap-2>DOMStringMap</a></code> object is instantiated, it is associated with three
- algorithms, one for getting the list of name-value pairs, one for setting names to certain values,
- and one for deleting names.</p>
- <pre class=idl>[OverrideBuiltins, Exposed=(Window,Worker)]
- interface <dfn id=domstringmap-2>DOMStringMap</dfn> {
- <a href=#dom-domstringmap-nameditem id=domstringmap:dom-domstringmap-nameditem>getter</a> DOMString (DOMString name);
- <a href=#dom-domstringmap-setitem id=domstringmap:dom-domstringmap-setitem>setter</a> <a href=#dom-domstringmap-additem id=domstringmap:dom-domstringmap-additem>creator</a> void (DOMString name, DOMString value);
- <a href=#dom-domstringmap-removeitem id=domstringmap:dom-domstringmap-removeitem>deleter</a> void (DOMString name);
- };</pre>
- <p>The <a href=#supported-property-names id=domstringmap:supported-property-names>supported property names</a> on a <code id=domstringmap:domstringmap-2-3><a href=#domstringmap-2>DOMStringMap</a></code> object at any instant
- are the names of each pair returned from the algorithm for getting the list of name-value pairs at
- that instant, in the order returned.</p>
- <p>To <dfn id=dom-domstringmap-nameditem>determine the value of a named property</dfn> <var>name</var> in a <code id=domstringmap:domstringmap-2-4><a href=#domstringmap-2>DOMStringMap</a></code>, the user agent must return the value component
- of the name-value pair whose name component is <var>name</var> in the list returned by
- the algorithm for getting the list of name-value pairs.</p>
- <p>To set the value of a <dfn id=dom-domstringmap-additem>new</dfn> or <dfn id=dom-domstringmap-setitem>existing</dfn> named property <var>name</var> to value
- <var>value</var>, the algorithm for setting names to certain values must be run, passing
- <var>name</var> as the name and the result of converting <var>value</var> to a
- <code id=domstringmap:idl-domstring><a href=#idl-domstring>DOMString</a></code> as the value.</p>
- <p>To <dfn id=dom-domstringmap-removeitem>delete an existing named property</dfn> <var>name</var>, the algorithm for deleting names must be run, passing <var>name</var> as the name.</p>
- <p class=note>The <code id=domstringmap:domstringmap-2-5><a href=#domstringmap-2>DOMStringMap</a></code> interface definition here is only intended for
- JavaScript environments. Other language bindings will need to define how <code id=domstringmap:domstringmap-2-6><a href=#domstringmap-2>DOMStringMap</a></code>
- is to be implemented for those languages.</p>
-
- <div class=example>
- <p>The <code id=domstringmap:dom-dataset><a href=#dom-dataset>dataset</a></code> attribute on elements exposes the <code id=domstringmap:attr-data-*><a href=#attr-data-*>data-*</a></code> attributes on the element.</p>
- <p>Given the following fragment and elements with similar constructions:</p>
- <pre><img class="tower" id="tower5" data-x="12" data-y="5"
- data-ai="robotarget" data-hp="46" data-ability="flames"
- src="towers/rocket.png alt="Rocket Tower"></pre>
- <p>...one could imagine a function <code>splashDamage()</code> that takes some arguments, the first
- of which is the element to process:</p>
- <pre>function splashDamage(node, x, y, damage) {
- if (node.classList.contains('tower') && // checking the 'class' attribute
- node.dataset.x == x && // reading the 'data-x' attribute
- node.dataset.y == y) { // reading the 'data-y' attribute
- var hp = parseInt(node.dataset.hp); // reading the 'data-hp' attribute
- hp = hp - damage;
- if (hp < 0) {
- hp = 0;
- node.dataset.ai = 'dead'; // setting the 'data-ai' attribute
- delete node.dataset.ability; // removing the 'data-ability' attribute
- }
- node.dataset.hp = hp; // setting the 'data-hp' attribute
- }
- }</pre>
- </div>
- <h4 id=domelementmap>2.7.4 DOMElementMap</h4>
- <p>The <code id=domelementmap:domelementmap-2><a href=#domelementmap-2>DOMElementMap</a></code> interface represents a set of name-element mappings. It exposes
- these using the scripting language's native mechanisms for property access.</p>
-
- <p>When a <code id=domelementmap:domelementmap-2-2><a href=#domelementmap-2>DOMElementMap</a></code> object is instantiated, it is associated with three
- algorithms, one for getting the list of name-element mappings, one for mapping a name to a certain
- element, and one for deleting mappings by name.</p>
- <pre class=idl>interface <dfn id=domelementmap-2>DOMElementMap</dfn> {
- <a href=#dom-domelementmap-nameditem id=domelementmap:dom-domelementmap-nameditem>getter</a> <a href=#element id=domelementmap:element>Element</a> (DOMString name);
- <a href=#dom-domelementmap-setitem id=domelementmap:dom-domelementmap-setitem>setter</a> <a href=#dom-domelementmap-additem id=domelementmap:dom-domelementmap-additem>creator</a> void (DOMString name, <a href=#element id=domelementmap:element-2>Element</a> value);
- <a href=#dom-domelementmap-removeitem id=domelementmap:dom-domelementmap-removeitem>deleter</a> void (DOMString name);
- };</pre>
- <p>The <a href=#supported-property-names id=domelementmap:supported-property-names>supported property names</a> on a <code id=domelementmap:domelementmap-2-3><a href=#domelementmap-2>DOMElementMap</a></code> object at any instant
- are the names for each mapping returned from the algorithm for getting the list of name-element
- mappings at that instant, in the order returned.</p>
- <p>To <dfn id=dom-domelementmap-nameditem>determine the value of a named property</dfn> <var>name</var> in a <code id=domelementmap:domelementmap-2-4><a href=#domelementmap-2>DOMElementMap</a></code>, the user agent must return the element
- component of the name-element mapping whose name component is <var>name</var> in the list
- returned by the algorithm for getting the list of name-element mappings.</p>
- <p>To set the value of a <dfn id=dom-domelementmap-additem>new</dfn> or <dfn id=dom-domelementmap-setitem>existing</dfn> named property <var>name</var> to value
- <var>value</var>, the algorithm for mapping a name to a certain element must be run,
- passing <var>name</var> as the name <var>value</var> as the element.</p>
- <p>To <dfn id=dom-domelementmap-removeitem>delete an existing named property</dfn> <var>name</var>, the algorithm for deleting mappings must be run, passing <var>name</var> as the name component of the mapping to be deleted.</p>
- <p class=note>The <code id=domelementmap:domelementmap-2-5><a href=#domelementmap-2>DOMElementMap</a></code> interface definition here is only intended for
- JavaScript environments. Other language bindings will need to define how
- <code id=domelementmap:domelementmap-2-6><a href=#domelementmap-2>DOMElementMap</a></code> is to be implemented for those languages.</p>
-
- <h4 id=transferable-objects>2.7.5 Transferable objects</h4>
- <p>Some objects support being copied and closed in one operation. This is called
- <i>transferring</i> the object, and is used in particular to transfer ownership of unsharable or
- expensive resources across worker boundaries.</p>
- <p>The following <code id=transferable-objects:transferable><a href=#transferable>Transferable</a></code> types exist:</p>
- <ul class=brief><li><code id=transferable-objects:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> <a href=#refsECMA262>[ECMA262]</a>
- <li><code id=transferable-objects:canvasproxy><a href=#canvasproxy>CanvasProxy</a></code> (defined in this specification)
- <li><code id=transferable-objects:messageport><a href=#messageport>MessagePort</a></code> (defined in this specification)
- </ul>
-
- <p>The following IDL block formalizes this:</p>
- <pre class=idl>typedef (<a href=#arraybuffer id=transferable-objects:arraybuffer-2>ArrayBuffer</a> or <a href=#canvasproxy id=transferable-objects:canvasproxy-2>CanvasProxy</a> or <a href=#messageport id=transferable-objects:messageport-2>MessagePort</a>) <dfn id=transferable>Transferable</dfn>;</pre>
- <p>To <dfn id=transfer-a-transferable-object>transfer a <code>Transferable</code> object</dfn> to a new owner, the user agent must
- run the steps defined for the type of object in question. The steps will return a new object of
- the same type, and will permanently <dfn id=concept-transferable-neutered>neuter</dfn> the
- original object. (This is an irreversible and non-idempotent operation; once an object has been
- transferred, it cannot be transferred, or indeed used, again.)</p>
- <p id=transferArrayBuffer>To <a href=#transfer-a-transferable-object id=transferable-objects:transfer-a-transferable-object>transfer</a> an
- <code id=transferable-objects:arraybuffer-3><a href=#arraybuffer>ArrayBuffer</a></code> object <var>old</var> to a new owner <var>owner</var>, a user agent must create a new <code id=transferable-objects:arraybuffer-4><a href=#arraybuffer>ArrayBuffer</a></code> object pointing at
- the same underlying data as <var>old</var>, thus obtaining <var>new</var>,
- must <a href=#concept-transferable-neutered id=transferable-objects:concept-transferable-neutered>neuter</a> the <var>old</var>
- object, and must finally return <var>new</var>. <a href=#refsECMA262>[ECMA262]</a></p>
-
- <p class=note>Rules for how to <a href=#transferCanvasProxy>transfer a
- <code>CanvasProxy</code> object</a> and how to <a href=#transferMessagePort>transfer a
- <code>MessagePort</code> object</a> are given in the relevant sections of this specification.</p>
-
-
- <h4 id=safe-passing-of-structured-data>2.7.6 Safe passing of structured data</h4>
- <p>When a user agent is required to obtain a <dfn id=structured-clone>structured clone</dfn> of a value, optionally
- with a <i>transfer map</i>, it must run the following algorithm, which either returns a separate
- value, or throws an exception. If a <i>transfer map</i> is provided, it consists of an association
- list of <code id=safe-passing-of-structured-data:transferable><a href=#transferable>Transferable</a></code> objects to placeholder objects.</p>
- <ol><li><p>Let <var>input</var> be the value being cloned.<li><p>Let <var>transfer map</var> be the <i>transfer map</i> passed to the algorithm, if any, or
- the empty list otherwise.<li><p>Let <var>memory</var> be an association list of pairs of objects, initially empty. This is
- used to handle duplicate references. In each pair of objects, one is called the <i>source</i> object and the other the <i>destination</i> object.<li><p>For each mapping in <var>transfer map</var>, add a mapping from the
- <code id=safe-passing-of-structured-data:transferable-2><a href=#transferable>Transferable</a></code> object (the source object) to the placeholder object (the destination
- object) to <var>memory</var>.<li><p>Let <var>output</var> be the value resulting from calling the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm>internal structured
- cloning algorithm</a> with <var>input</var> as the "<var>input</var>" argument, and
- <var>memory</var> as the "<var>memory</var>" argument.<li><p>Return <var>output</var>.</ol>
- <p>The <dfn id=internal-structured-cloning-algorithm>internal structured cloning algorithm</dfn> is always called with two arguments,
- <var>input</var> and <var>memory</var>, and its behavior is as follows:</p>
- <ol><li><p>If <var>input</var> is the source object of a pair of objects in <var>memory</var>, then
- return the destination object in that pair of objects and abort these steps.<li><p>If <var>input</var> is a primitive value, then return that value and abort these
- steps.<li><p>Let <var>deep clone</var> be <i>none</i>.<li>
- <p>The <var>input</var> value is an object. Jump to the appropriate step below:</p>
- <dl class=switch><dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-boolean-wrapper><a href=#idl-boolean-wrapper>Boolean</a></code> object<dd><p>Let <var>output</var> be a newly constructed Boolean object with the same value as
- <var>input</var>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-number-wrapper><a href=#idl-number-wrapper>Number</a></code> object<dd><p>Let <var>output</var> be a newly constructed Number object with the same value as
- <var>input</var>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-string-wrapper><a href=#idl-string-wrapper>String</a></code> object<dd><p>Let <var>output</var> be a newly constructed String object with the same value as
- <var>input</var>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-date><a href=#idl-date>Date</a></code> object<dd><p>Let <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:idl-date-2><a href=#idl-date>Date</a></code> object with the same
- value as <var>input</var>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-regexp><a href=#idl-regexp>RegExp</a></code> object<dd>
- <p>Let <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:idl-regexp-2><a href=#idl-regexp>RegExp</a></code> object with the same
- pattern and flags as <var>input</var>.</p>
- <p class=note>The value of the <code>lastIndex</code> property is not copied.</p>
- <dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:blob><a href=#blob>Blob</a></code> object<dd><p>If <var>input</var> has been disabled through the <code id=safe-passing-of-structured-data:dom-blob-close><a href=#dom-blob-close>close()</a></code> method, throw a <code id=safe-passing-of-structured-data:datacloneerror><a href=#datacloneerror>DataCloneError</a></code> exception
- and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone>structured clone</a> algorithm. Otherwise, let <var>output</var>
- be a newly constructed object of the same class as <var>input</var>, corresponding to the same
- underlying data.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:filelist><a href=#filelist>FileList</a></code> object<dd><p>Let <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:filelist-2><a href=#filelist>FileList</a></code> object containing a
- list of newly constructed <code id=safe-passing-of-structured-data:file><a href=#file>File</a></code> objects corresponding to the same underlying data
- as those in <var>input</var>, maintaining their relative order.<dt>If <var>input</var> is an <code id=safe-passing-of-structured-data:imagedata><a href=#imagedata>ImageData</a></code> object<dd><p>Let <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:imagedata-2><a href=#imagedata>ImageData</a></code> object whose <code id=safe-passing-of-structured-data:dom-imagedata-width><a href=#dom-imagedata-width>width</a></code> and <code id=safe-passing-of-structured-data:dom-imagedata-height><a href=#dom-imagedata-height>height</a></code>
- have values equal to the corresponding attributes on <var>input</var>, and whose <code id=safe-passing-of-structured-data:dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has the value obtained from invoking the
- <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-2>internal structured cloning algorithm</a> recursively with the value of the <code id=safe-passing-of-structured-data:dom-imagedata-data-2><a href=#dom-imagedata-data>data</a></code> attribute on <var>input</var> as the new
- "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
- argument.<dt>If <var>input</var> is an <code id=safe-passing-of-structured-data:imagebitmap><a href=#imagebitmap>ImageBitmap</a></code> object<dd><p>Let <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:imagebitmap-2><a href=#imagebitmap>ImageBitmap</a></code> object whose
- bitmap data is a copy of <var>input</var>'s bitmap data.<dt>If <var>input</var> is an <code id=safe-passing-of-structured-data:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> object<dd><p>If <var>input</var> has been <a href=#concept-transferable-neutered id=safe-passing-of-structured-data:concept-transferable-neutered>neutered</a>, throw a <code id=safe-passing-of-structured-data:datacloneerror-2><a href=#datacloneerror>DataCloneError</a></code>
- exception and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-2>structured clone</a> algorithm. Otherwise, let
- <var>output</var> be a newly constructed <code id=safe-passing-of-structured-data:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> object whose contents are a
- copy of <var>input</var>'s contents, with the same length.<dt>If <var>input</var> is an object with a [[DataView]] internal slot<dd>
- <p>Let <var>output</var> be a newly constructed object of the same class as <var>input</var>,
- with its [[DataView]] internal property present, its [[ViewedArrayBuffer]] internal property
- set to the value obtained from invoking the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-3>internal structured cloning algorithm</a>
- recursively with the value of the internal property on <var>input</var> as the new
- "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>" argument, and
- with the [[ByteLength]] and [[ByteOffset]] internal properties set to the same value as their
- counterparts on <var>input</var>.</p>
-
- <dt>If <var>input</var> is an <code id=safe-passing-of-structured-data:idl-array><a href=#idl-array>Array</a></code> object<dd>
- <p>Let <var>output</var> be a newly constructed empty <code id=safe-passing-of-structured-data:idl-array-2><a href=#idl-array>Array</a></code>
- object whose <code>length</code> is equal to the <code>length</code> of
- <var>input</var>, and set <var>deep clone</var> to <i>own</i>.</p>
- <p class=note>This means that the length of sparse arrays is preserved.</p>
- <dt>If <var>input</var> is an <code id=safe-passing-of-structured-data:idl-object><a href=#idl-object>Object</a></code> object<dd><p>Let <var>output</var> be a newly constructed empty <code id=safe-passing-of-structured-data:idl-object-2><a href=#idl-object>Object</a></code> object, and set <var>deep clone</var> to <i>own</i>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-map><a href=#idl-map>Map</a></code> object<dd><p>Let <var>output</var> be a newly constructed empty <code id=safe-passing-of-structured-data:idl-map-2><a href=#idl-map>Map</a></code>
- object, and set <var>deep clone</var> to <i>map</i>.<dt>If <var>input</var> is a <code id=safe-passing-of-structured-data:idl-set><a href=#idl-set>Set</a></code> object<dd><p>Let <var>output</var> be a newly constructed empty <code id=safe-passing-of-structured-data:idl-set-2><a href=#idl-set>Set</a></code>
- object, and set <var>deep clone</var> to <i>set</i>.<dt>If <var>input</var> is an object that another specification defines how to clone<dd><p>Let <var>output</var> be a clone of the object as defined by the other
- specification.<dt>If <var>input</var> is another native object type (e.g. <code id=safe-passing-of-structured-data:idl-error><a href=#idl-error>Error</a></code>, <code id=safe-passing-of-structured-data:idl-function><a href=#idl-function>Function</a></code>)<dt>If
- <var>input</var> is a host object (e.g. a DOM node)<dd><p>Throw a <code id=safe-passing-of-structured-data:datacloneerror-3><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-3>structured
- clone</a> algorithm.</dl>
- <p>For the purposes of the algorithm above, an object is a particular type of object
- <var>class</var> if its [[Class]] internal property is equal to <var>class</var>.</p>
- <p class=example>For example, "<var>input</var> is an <code id=safe-passing-of-structured-data:idl-object-3><a href=#idl-object>Object</a></code>
- object" if <var>input</var>'s [[Class]] internal property is equal to the string "<code>Object</code>".</p>
- <li><p>Add a mapping from <var>input</var> (the source object) to <var>output</var> (the
- destination object) to <var>memory</var>.<li>
- <p>If <var>deep clone</var> is set to <i>map</i>, then run these substeps. These substeps use
- the terminology and typographic conventions used in the JavaScript specification's definition of
- Maps. <a href=#refsECMA262>[ECMA262]</a></p>
- <ol><li><p>Let <var>source</var> be the List that is the value of <var>input</var>'s [[MapData]]
- internal slot, if any. If there is no such slot, then instead throw a
- <code id=safe-passing-of-structured-data:datacloneerror-4><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-4>structured clone</a>
- algorithm. <a href=#refsECMA262>[ECMA262]</a><li><p>Let <var>target</var> be the List that is the value of <var>output</var>'s [[MapData]]
- internal slot.<li>
- <p>For each Record {[[key]], [[value]]} <var>entry</var> that is an element of
- <var>source</var>, run the following substeps:</p>
- <ol><li><p>Let <var>key</var> have the value obtained from invoking the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-4>internal structured
- cloning algorithm</a> recursively with <var>entry</var>.[[key]] as the new
- "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
- argument.<li><p>Let <var>value</var> have the value obtained from invoking the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-5>internal
- structured cloning algorithm</a> recursively with <var>entry</var>.[[value]] as the new
- "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
- argument.<li><p>Let <var>new entry</var> be the Record {[[key]]: <var>key</var>, [[value]]:
- <var>value</var>}.<li><p>Append <var>new entry</var> as the last element of <var>target</var>.</ol>
- <li><p>Set <var>deep clone</var> to <i>own</i>.</ol>
- <li>
- <p>If <var>deep clone</var> is set to <i>set</i>, then run these substeps. These substeps use
- the terminology and typographic conventions used in the JavaScript specification's definition of
- Sets. <a href=#refsECMA262>[ECMA262]</a></p>
- <ol><li><p>Let <var>source</var> be the List that is the value of <var>input</var>'s [[SetData]]
- internal slot, if any. If there is no such slot, then instead throw a
- <code id=safe-passing-of-structured-data:datacloneerror-5><a href=#datacloneerror>DataCloneError</a></code> exception and abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-5>structured clone</a>
- algorithm. <a href=#refsECMA262>[ECMA262]</a><li><p>Let <var>target</var> be the List that is the value of <var>output</var>'s [[SetData]]
- internal slot.<li>
- <p>For each <var>entry</var> that is an element of <var>source</var> that is not <i>empty</i>,
- run the following substeps:</p>
- <ol><li><p>Let <var>new entry</var> have the value obtained from invoking the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-6>internal
- structured cloning algorithm</a> recursively with <var>entry</var> as the new
- "<var>input</var>" argument and <var>memory</var> as the new "<var>memory</var>"
- argument.<li><p>Append <var>new entry</var> as the last element of <var>target</var>.</ol>
- <li><p>Set <var>deep clone</var> to <i>own</i>.</ol>
- <li>
- <p>If <var>deep clone</var> is set to <i>own</i>, then, for each enumerable own property in
- <var>input</var>, run the following steps:</p>
- <ol><li><p>Let <var>name</var> be the name of the property.<li><p>Let <var>source value</var> be the result of calling the [[Get]] internal method of
- <var>input</var> with the argument <var>name</var>. If the [[Get]] internal method of a
- property involved executing script, and that script threw an uncaught exception, then abort the
- overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-6>structured clone</a> algorithm, with that exception being passed through to
- the caller.<li><p>Let <var>cloned value</var> be the result of invoking the <a href=#internal-structured-cloning-algorithm id=safe-passing-of-structured-data:internal-structured-cloning-algorithm-7>internal structured
- cloning algorithm</a> recursively with <var>source value</var> as the "<var>input</var>"
- argument and <var>memory</var> as the "<var>memory</var>" argument. If this results in an
- exception, then abort the overall <a href=#structured-clone id=safe-passing-of-structured-data:structured-clone-7>structured clone</a> algorithm, with that exception
- being passed through to the caller.<li><p>Add a new property to <var>output</var> having the name <var>name</var>, and having the
- value <var>cloned value</var>.</ol>
- <p>The order of the properties in the <var>input</var> and <var>output</var> objects must be the
- same, and any properties whose [[Get]] internal method involves running script must be processed
- in that same order.</p>
- <p class=note>This does not walk the prototype chain.</p>
- <p class=note>Property descriptors, setters, getters, and analogous features are not copied in
- this process. For example, the property in the input could be marked as read-only, but in the
- output it would just have the default state (typically read-write, though that could depend on
- the scripting environment).</p>
- <p class=note>Properties of Array objects are not treated any differently than those of other
- Objects. In particular, this means that non-index properties of arrays are copied as well.</p>
- <li><p>Return <var>output</var>.</ol>
- <p class=note>This algorithm preserves cycles and preserves the identity of duplicate objects in
- graphs.</p>
-
- <h4 id=callbacks>2.7.7 Callbacks</h4>
- <p>The following callback function type is used in various APIs that interact with
- <code id=callbacks:file><a href=#file>File</a></code> objects:</p>
- <pre class=idl>callback <dfn id=filecallback>FileCallback</dfn> = void (<a href=#file id=callbacks:file-2>File</a> file);</pre>
-
- <h4 id=garbage-collection>2.7.8 Garbage collection</h4>
- <p>There is an <dfn id=implied-strong-reference>implied strong reference</dfn> from any IDL attribute that returns a
- pre-existing object to that object.</p>
- <div class=example>
- <p>For example, the <code id=garbage-collection:dom-document-location><a href=#dom-document-location>document.location</a></code> attribute means
- that there is a strong reference from a <code id=garbage-collection:document><a href=#document>Document</a></code> object to its <code id=garbage-collection:location><a href=#location>Location</a></code>
- object. Similarly, there is always a strong reference from a <code id=garbage-collection:document-2><a href=#document>Document</a></code> to any
- descendant nodes, and from any node to its owner <code id=garbage-collection:document-3><a href=#document>Document</a></code>.</p>
- </div>
-
- <h3 id=namespaces>2.8 Namespaces</h3>
- <p>The <dfn id=html-namespace-2>HTML namespace</dfn> is: <code>http://www.w3.org/1999/xhtml</code></p>
- <p>The <dfn id=mathml-namespace>MathML namespace</dfn> is: <code>http://www.w3.org/1998/Math/MathML</code></p>
- <p>The <dfn id=svg-namespace>SVG namespace</dfn> is: <code>http://www.w3.org/2000/svg</code></p>
- <p>The <dfn id=xlink-namespace>XLink namespace</dfn> is: <code>http://www.w3.org/1999/xlink</code></p>
- <p>The <dfn id=xml-namespace>XML namespace</dfn> is: <code>http://www.w3.org/XML/1998/namespace</code></p>
- <p>The <dfn id=xmlns-namespace>XMLNS namespace</dfn> is: <code>http://www.w3.org/2000/xmlns/</code></p>
- <hr>
- <p>Data mining tools and other user agents that perform operations
- on content without running scripts, evaluating CSS or XPath
- expressions, or otherwise exposing the resulting DOM to arbitrary
- content, may "support namespaces" by just asserting that their DOM
- node analogues are in certain namespaces, without actually exposing
- the above strings.</p>
- <hr>
- <p class=note>In <a href=#syntax id=namespaces:syntax>the HTML syntax</a>, namespace prefixes
- and namespace declarations do not have the same effect as in XML.
- For instance, the colon has no special meaning in HTML element
- names.</p>
- <h2 id=dom>3 Semantics, structure, and APIs of HTML documents</h2>
- <h3 id=documents>3.1 Documents</h3>
- <p>Every XML and HTML document in an HTML UA is represented by a <code id=documents:document><a href=#document>Document</a></code> object. <a href=#refsDOM>[DOM]</a></p>
- <p><dfn id="the-document's-address"><a href=http://dom.spec.whatwg.org/#concept-document-url>The document's
- address</a></dfn> is the <i>URL associated with a <code id=documents:document-2><a href=#document>Document</a></code></i> (as defined in the DOM
- standard). It is initially set when the <code id=documents:document-3><a href=#document>Document</a></code> is created, but that can change
- during the lifetime of the <code id=documents:document-4><a href=#document>Document</a></code>; for example, it changes when the user <a href=#navigate id=documents:navigate>navigates</a> to a <a href=#scroll-to-fragid id=documents:scroll-to-fragid>fragment identifier</a>
- on the page and when the <code id=documents:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code> method is called
- with a new <a href=#url id=documents:url>URL</a>. <a href=#refsDOM>[DOM]</a></p>
-
- <p class=warning>Interactive user agents typically expose <a id="documents:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> in
- their user interface. This is the primary mechanism by which a user can tell if a site is
- attempting to impersonate another.</p>
- <p>When a <code id=documents:document-5><a href=#document>Document</a></code> is created by a <a href=#concept-script id=documents:concept-script>script</a> using
- the <code id=documents:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> or <code id=documents:dom-domimplementation-createhtmldocument><a href=#dom-domimplementation-createhtmldocument>createHTMLDocument()</a></code> APIs, <a id="documents:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the
- document's address</a> is the same as <a id="documents:the-document's-address-3" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> of the
- <a href=#responsible-document id=documents:responsible-document>responsible document</a> specified by the script's <a href=#settings-object id=documents:settings-object>settings object</a>, and the
- <code id=documents:document-6><a href=#document>Document</a></code> is both <a href=#ready-for-post-load-tasks id=documents:ready-for-post-load-tasks>ready for post-load tasks</a> and <a href=#completely-loaded id=documents:completely-loaded>completely
- loaded</a> immediately.</p>
- <p><dfn id="the-document's-referrer">The document's referrer</dfn> is an <a href=#absolute-url id=documents:absolute-url>absolute URL</a> that can be set when the
- <code id=documents:document-7><a href=#document>Document</a></code> is created. If it is not explicitly set, then its value is the empty
- string.</p>
- <p>Each <code id=documents:document-8><a href=#document>Document</a></code> object has a <dfn id=reload-override-flag>reload override flag</dfn> that is originally
- unset. The flag is set by the <code id=documents:dom-document-open><a href=#dom-document-open>document.open()</a></code> and <code id=documents:dom-document-open-2><a href=#dom-document-open>document.write()</a></code> methods in certain situations. When the flag is
- set, the <code id=documents:document-9><a href=#document>Document</a></code> also has a <dfn id=reload-override-buffer>reload override buffer</dfn> which is a Unicode
- string that is used as the source of the document when it is reloaded.</p>
- <p>When the user agent is to perform <dfn id=an-overridden-reload>an overridden reload</dfn>, given a <a href=#source-browsing-context id=documents:source-browsing-context>source
- browsing context</a>, it must act as follows:</p>
- <ol><li><p>Let <var>source</var> be the value of the <a href=#browsing-context id=documents:browsing-context>browsing context</a>'s
- <a href=#active-document id=documents:active-document>active document</a>'s <a href=#reload-override-buffer id=documents:reload-override-buffer>reload override buffer</a>.<li><p>Let <var>address</var> be the <a href=#browsing-context id=documents:browsing-context-2>browsing context</a>'s <a href=#active-document id=documents:active-document-2>active
- document</a>'s <a href=http://dom.spec.whatwg.org/#concept-document-url id="documents:the-document's-address-4" data-x-internal="the-document's-address">address</a>.<li>
- <p><a href=#navigate id=documents:navigate-2>Navigate</a> the <a href=#browsing-context id=documents:browsing-context-3>browsing context</a> to
- a resource whose source is <var>source</var>, with <a href=#replacement-enabled id=documents:replacement-enabled>replacement enabled</a>
- and <a href=#exceptions-enabled id=documents:exceptions-enabled>exceptions enabled</a>. The <a href=#source-browsing-context id=documents:source-browsing-context-2>source browsing context</a> is that given to
- the <a href=#an-overridden-reload id=documents:an-overridden-reload>overridden reload</a> algorithm. When the
- <a href=#navigate id=documents:navigate-3>navigate</a> algorithm creates a <code id=documents:document-10><a href=#document>Document</a></code> object for this purpose, set
- that <code id=documents:document-11><a href=#document>Document</a></code>'s <a href=#reload-override-flag id=documents:reload-override-flag>reload override flag</a> and set its <a href=#reload-override-buffer id=documents:reload-override-buffer-2>reload override
- buffer</a> to <var>source</var>.</p>
- <p>When it comes time to <a href="#set-the-document's-address" id="documents:set-the-document's-address">set the document's address</a> in the <a href=#navigate id=documents:navigate-4>navigation algorithm</a>, use <var>address</var> as the
- <a href=#override-url id=documents:override-url>override URL</a>.</p>
- </ol>
- <h4 id=the-document-object>3.1.1 The <code id=the-document-object:document><a href=#document>Document</a></code> object</h4>
- <p>The DOM specification defines a <code id=the-document-object:dom-document><a href=#dom-document>Document</a></code> interface, which
- this specification extends significantly:</p>
- <pre class=idl>enum <dfn id=documentreadystate>DocumentReadyState</dfn> { "loading", "interactive", "complete" };
- [OverrideBuiltins]
- partial /*sealed*/ interface <dfn id=document>Document</dfn> {
- // <a href=#resource-metadata-management id=the-document-object:resource-metadata-management>resource metadata management</a>
- [PutForwards=<a href=#dom-url-href id=the-document-object:dom-url-href>href</a>, Unforgeable] readonly attribute <a href=#location id=the-document-object:location>Location</a>? <a href=#dom-document-location id=the-document-object:dom-document-location>location</a>;
- attribute DOMString <a href=#dom-document-domain id=the-document-object:dom-document-domain>domain</a>;
- readonly attribute DOMString <a href=#dom-document-referrer id=the-document-object:dom-document-referrer>referrer</a>;
- attribute DOMString <a href=#dom-document-cookie id=the-document-object:dom-document-cookie>cookie</a>;
- readonly attribute DOMString <a href=#dom-document-lastmodified id=the-document-object:dom-document-lastmodified>lastModified</a>;
- readonly attribute <a href=#documentreadystate id=the-document-object:documentreadystate>DocumentReadyState</a> <a href=#dom-document-readystate id=the-document-object:dom-document-readystate>readyState</a>;
- // <a href=#dom-tree-accessors id=the-document-object:dom-tree-accessors>DOM tree accessors</a>
- <a href=#dom-document-nameditem id=the-document-object:dom-document-nameditem>getter</a> object (DOMString name);
- attribute DOMString <a href=#document.title id=the-document-object:document.title>title</a>;
- attribute DOMString <a href=#dom-document-dir id=the-document-object:dom-document-dir>dir</a>;
- attribute <a href=#htmlelement id=the-document-object:htmlelement>HTMLElement</a>? <a href=#dom-document-body id=the-document-object:dom-document-body>body</a>;
- readonly attribute <a href=#htmlheadelement id=the-document-object:htmlheadelement>HTMLHeadElement</a>? <a href=#dom-document-head id=the-document-object:dom-document-head>head</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection>HTMLCollection</a> <a href=#dom-document-images id=the-document-object:dom-document-images>images</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-2>HTMLCollection</a> <a href=#dom-document-embeds id=the-document-object:dom-document-embeds>embeds</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-3>HTMLCollection</a> <a href=#dom-document-plugins id=the-document-object:dom-document-plugins>plugins</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-4>HTMLCollection</a> <a href=#dom-document-links id=the-document-object:dom-document-links>links</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-5>HTMLCollection</a> <a href=#dom-document-forms id=the-document-object:dom-document-forms>forms</a>;
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-6>HTMLCollection</a> <a href=#dom-document-scripts id=the-document-object:dom-document-scripts>scripts</a>;
- NodeList <a href=#dom-document-getelementsbyname id=the-document-object:dom-document-getelementsbyname>getElementsByName</a>(DOMString elementName);
- NodeList <a href=#dom-document-getitems id=the-document-object:dom-document-getitems>getItems</a>(optional DOMString typeNames = ""); // <a href=#microdata id=the-document-object:microdata>microdata</a>
- readonly attribute <a href=#domelementmap-2 id=the-document-object:domelementmap-2>DOMElementMap</a> <a href=#dom-document-csselementmap id=the-document-object:dom-document-csselementmap>cssElementMap</a>;
- readonly attribute <a href=#htmlscriptelement id=the-document-object:htmlscriptelement>HTMLScriptElement</a>? <a href=#dom-document-currentscript id=the-document-object:dom-document-currentscript>currentScript</a>;
- // <a href=#dynamic-markup-insertion id=the-document-object:dynamic-markup-insertion>dynamic markup insertion</a>
- <a href=#document id=the-document-object:document-2>Document</a> <a href=#dom-document-open id=the-document-object:dom-document-open>open</a>(optional DOMString type = "text/html", optional DOMString replace = "");
- <a href=#windowproxy id=the-document-object:windowproxy>WindowProxy</a> <a href=#dom-document-open id=the-document-object:dom-document-open-2>open</a>(DOMString url, DOMString name, DOMString features, optional boolean replace = false);
- void <a href=#dom-document-close id=the-document-object:dom-document-close>close</a>();
- void <a href=#dom-document-write id=the-document-object:dom-document-write>write</a>(DOMString... text);
- void <a href=#dom-document-writeln id=the-document-object:dom-document-writeln>writeln</a>(DOMString... text);
- // <a href=#editing id=the-document-object:editing>user interaction</a>
- readonly attribute <a href=#windowproxy id=the-document-object:windowproxy-2>WindowProxy</a>? <a href=#dom-document-defaultview id=the-document-object:dom-document-defaultview>defaultView</a>;
- readonly attribute <a href=#element id=the-document-object:element>Element</a>? <a href=#dom-document-activeelement id=the-document-object:dom-document-activeelement>activeElement</a>;
- boolean <a href=#dom-document-hasfocus id=the-document-object:dom-document-hasfocus>hasFocus</a>();
- attribute DOMString <a href=#designMode id=the-document-object:designMode>designMode</a>;
- boolean <a href=#execCommand id=the-document-object:execCommand>execCommand</a>(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
- boolean <a href=#dom-document-querycommandenabled id=the-document-object:dom-document-querycommandenabled>queryCommandEnabled</a>(DOMString commandId);
- boolean <a href=#dom-document-querycommandindeterm id=the-document-object:dom-document-querycommandindeterm>queryCommandIndeterm</a>(DOMString commandId);
- boolean <a href=#dom-document-querycommandstate id=the-document-object:dom-document-querycommandstate>queryCommandState</a>(DOMString commandId);
- boolean <a href=#dom-document-querycommandsupported id=the-document-object:dom-document-querycommandsupported>queryCommandSupported</a>(DOMString commandId);
- DOMString <a href=#dom-document-querycommandvalue id=the-document-object:dom-document-querycommandvalue>queryCommandValue</a>(DOMString commandId);
- readonly attribute <a href=#htmlcollection id=the-document-object:htmlcollection-7>HTMLCollection</a> <a href=#dom-document-commands id=the-document-object:dom-document-commands>commands</a>;
- // special <a href=#event-handler-idl-attributes id=the-document-object:event-handler-idl-attributes>event handler IDL attributes</a> that only apply to Document objects
- [LenientThis] attribute <a href=#eventhandler id=the-document-object:eventhandler>EventHandler</a> <a href=#handler-onreadystatechange id=the-document-object:handler-onreadystatechange>onreadystatechange</a>;
- // <a href="#Document-partial">also has obsolete members</a>
- };
- <a href=#document id=the-document-object:document-3>Document</a> implements <a href=#globaleventhandlers id=the-document-object:globaleventhandlers>GlobalEventHandlers</a>;</pre>
- <h4 id=resource-metadata-management>3.1.2 <dfn>Resource metadata management</dfn></h4>
- <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-referrer><a href=#dom-document-referrer>referrer</a></code><dd>
- <p>Returns <a href=http://dom.spec.whatwg.org/#concept-document-url id="resource-metadata-management:the-document's-address" data-x-internal="the-document's-address">the address</a> of the <code id=resource-metadata-management:document><a href=#document>Document</a></code>
- from which the user navigated to this one, unless it was blocked or there was no such document,
- in which case it returns the empty string.</p>
- <p>The <code id=resource-metadata-management:link-type-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> link type can be used to block the
- referrer.</p>
- </dl>
-
- <p>The <dfn id=dom-document-referrer><code>referrer</code></dfn> attribute must return
- <a href="#the-document's-referrer" id="resource-metadata-management:the-document's-referrer">the document's referrer</a>.</p>
-
- <p class=note>In the case of HTTP, the <code id=resource-metadata-management:dom-document-referrer-2><a href=#dom-document-referrer>referrer</a></code> IDL
- attribute will match the <code id=resource-metadata-management:http-referer><a href=#http-referer>Referer</a></code> (sic) header that was sent when
- <a href=#fetch id=resource-metadata-management:fetch>fetching</a> the current page.</p>
- <p class=note>Typically user agents are configured to not report referrers in the case where the
- referrer uses an encrypted protocol and the current page does not (e.g. when navigating from an
- <code id=resource-metadata-management:https-protocol><a data-x-internal=https-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.2>https:</a></code> page to an <code id=resource-metadata-management:http-protocol><a data-x-internal=http-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.1>http:</a></code>
- page).</p>
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-cookie><a href=#dom-document-cookie>cookie</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the HTTP cookies that apply to the <code id=resource-metadata-management:document-2><a href=#document>Document</a></code>. If there are no cookies or
- cookies can't be applied to this resource, the empty string will be returned.</p>
- <p>Can be set, to add a new cookie to the element's set of HTTP cookies.</p>
- <p>If the contents are <a href=#sandboxed-origin-browsing-context-flag id=resource-metadata-management:sandboxed-origin-browsing-context-flag>sandboxed into a
- unique origin</a> (e.g. in an <code id=resource-metadata-management:the-iframe-element><a href=#the-iframe-element>iframe</a></code> with the <code id=resource-metadata-management:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute), a <code id=resource-metadata-management:securityerror><a href=#securityerror>SecurityError</a></code> exception
- will be thrown on getting and setting.</p>
- </dl>
-
- <p>The <dfn id=dom-document-cookie><code>cookie</code></dfn> attribute represents the cookies
- of the resource identified by <a id="resource-metadata-management:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>.</p>
- <p>A <code id=resource-metadata-management:document-3><a href=#document>Document</a></code> object that falls into one of the following conditions is a
- <dfn id=cookie-averse-document-object>cookie-averse <code>Document</code> object</dfn>:</p>
- <ul><li>A <code id=resource-metadata-management:document-4><a href=#document>Document</a></code> that has no <a href=#browsing-context id=resource-metadata-management:browsing-context>browsing context</a>.<li>A <code id=resource-metadata-management:document-5><a href=#document>Document</a></code> whose <a href=http://dom.spec.whatwg.org/#concept-document-url id="resource-metadata-management:the-document's-address-3" data-x-internal="the-document's-address">address</a> does not
- use a server-based naming authority.</ul>
-
- <p id=sandboxCookies>On getting, if the document is a <a href=#cookie-averse-document-object id=resource-metadata-management:cookie-averse-document-object>cookie-averse <code>Document</code>
- object</a>, then the user agent must return the empty string. Otherwise, if the
- <code id=resource-metadata-management:document-6><a href=#document>Document</a></code>'s <a href=#origin-2 id=resource-metadata-management:origin-2>origin</a> is not a scheme/host/port tuple, the user agent must
- throw a <code id=resource-metadata-management:securityerror-2><a href=#securityerror>SecurityError</a></code> exception. Otherwise, the user agent must first <a href=#obtain-the-storage-mutex id=resource-metadata-management:obtain-the-storage-mutex>obtain
- the storage mutex</a> and then return the <a href=#cookie-string id=resource-metadata-management:cookie-string>cookie-string</a> for <a id="resource-metadata-management:the-document's-address-4" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>
- for a "non-HTTP" API, decoded using the <a href=#utf-8-decoder id=resource-metadata-management:utf-8-decoder>UTF-8 decoder</a>. <a href=#refsCOOKIES>[COOKIES]</a>
- <a href=#fingerprinting-vector id=resource-metadata-management:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>On setting, if the document is a <a href=#cookie-averse-document-object id=resource-metadata-management:cookie-averse-document-object-2>cookie-averse <code>Document</code> object</a>, then
- the user agent must do nothing. Otherwise, if the <code id=resource-metadata-management:document-7><a href=#document>Document</a></code>'s <a href=#origin-2 id=resource-metadata-management:origin-2-2>origin</a> is
- not a scheme/host/port tuple, the user agent must throw a <code id=resource-metadata-management:securityerror-3><a href=#securityerror>SecurityError</a></code> exception.
- Otherwise, the user agent must <a href=#obtain-the-storage-mutex id=resource-metadata-management:obtain-the-storage-mutex-2>obtain the storage mutex</a> and then act as it would when
- <a href=#receives-a-set-cookie-string id=resource-metadata-management:receives-a-set-cookie-string>receiving a set-cookie-string</a> for <a id="resource-metadata-management:the-document's-address-5" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the
- document's address</a> via a "non-HTTP" API, consisting of the new value encoded as UTF-8. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsENCODING>[ENCODING]</a></p>
- <p class=note>Since the <code id=resource-metadata-management:dom-document-cookie-2><a href=#dom-document-cookie>cookie</a></code> attribute is accessible
- across frames, the path restrictions on cookies are only a tool to help manage which cookies are
- sent to which parts of the site, and are not in any way a security feature.</p>
- <hr>
-
- <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-lastmodified><a href=#dom-document-lastmodified>lastModified</a></code><dd>
- <p>Returns the date of the last modification to the document, as reported by the server, in the
- form "<code>MM/DD/YYYY hh:mm:ss</code>", in the user's local time zone.</p>
- <p>If the last modification date is not known, the current time is returned instead.</p>
- </dl>
-
- <p>The <dfn id=dom-document-lastmodified><code>lastModified</code></dfn> attribute, on
- getting, must return the date and time of the <code id=resource-metadata-management:document-8><a href=#document>Document</a></code>'s source file's last
- modification, in the user's local time zone, in the following format:</p>
- <ol><li> The month component of the date. <li> A U+002F SOLIDUS character (/). <li> The day component of the date. <li> A U+002F SOLIDUS character (/). <li> The year component of the date. <li> A U+0020 SPACE character. <li> The hours component of the time. <li> A U+003A COLON character (:). <li> The minutes component of the time. <li> A U+003A COLON character (:). <li> The seconds component of the time. </ol>
- <p>All the numeric components above, other than the year, must be given as two <a href=#ascii-digits id=resource-metadata-management:ascii-digits>ASCII
- digits</a> representing the number in base ten, zero-padded if necessary. The year must be
- given as the shortest possible string of four or more <a href=#ascii-digits id=resource-metadata-management:ascii-digits-2>ASCII digits</a> representing the
- number in base ten, zero-padded if necessary.</p>
- <p>The <code id=resource-metadata-management:document-9><a href=#document>Document</a></code>'s source file's last modification date and time must be derived from
- relevant features of the networking protocols used, e.g. from the value of the HTTP <code id=resource-metadata-management:http-last-modified><a href=#http-last-modified>Last-Modified</a></code> header of the document, or from metadata in the
- file system for local files. If the last modification date and time are not known, the attribute
- must return the current date and time in the above format.</p>
- <hr>
-
- <dl class=domintro><dt><var>document</var> . <code id=resource-metadata-management:dom-document-readystate><a href=#dom-document-readystate>readyState</a></code><dd>
- <p>Returns "<code>loading</code>" while the <code id=resource-metadata-management:document-10><a href=#document>Document</a></code> is loading, "<code>interactive</code>" once it is finished parsing but still loading sub-resources, and
- "<code>complete</code>" once it has loaded.</p>
- <p>The <code id=resource-metadata-management:event-readystatechange><a href=#event-readystatechange>readystatechange</a></code> event fires on the
- <code id=resource-metadata-management:document-11><a href=#document>Document</a></code> object when this value changes.</p>
- </dl>
-
- <p>Each document has a <dfn id=current-document-readiness>current document readiness</dfn>. When a <code id=resource-metadata-management:document-12><a href=#document>Document</a></code> object
- is created, it must have its <a href=#current-document-readiness id=resource-metadata-management:current-document-readiness>current document readiness</a> set to the string "<code>loading</code>" if the document is associated with an <a href=#html-parser id=resource-metadata-management:html-parser>HTML parser</a>, an
- <a href=#xml-parser id=resource-metadata-management:xml-parser>XML parser</a>, or an XSLT processor, and to the string "<code>complete</code>"
- otherwise. Various algorithms during page loading affect this value. When the value is set, the
- user agent must <a href=#fire-a-simple-event id=resource-metadata-management:fire-a-simple-event>fire a simple event</a> named <code id=resource-metadata-management:event-readystatechange-2><a href=#event-readystatechange>readystatechange</a></code> at the <code id=resource-metadata-management:document-13><a href=#document>Document</a></code> object.</p>
- <p>A <code id=resource-metadata-management:document-14><a href=#document>Document</a></code> is said to have an <dfn id=active-parser>active parser</dfn> if it is associated with an
- <a href=#html-parser id=resource-metadata-management:html-parser-2>HTML parser</a> or an <a href=#xml-parser id=resource-metadata-management:xml-parser-2>XML parser</a> that has not yet been <a href=#stop-parsing id=resource-metadata-management:stop-parsing>stopped</a> or <a href=#abort-a-parser id=resource-metadata-management:abort-a-parser>aborted</a>.</p>
- <p>The <dfn id=dom-document-readystate><code>readyState</code></dfn> IDL attribute must, on
- getting, return the <a href=#current-document-readiness id=resource-metadata-management:current-document-readiness-2>current document readiness</a>.</p>
-
- <h4 id=dom-tree-accessors>3.1.3 <dfn>DOM tree accessors</dfn></h4>
- <p><dfn id=the-html-element-2>The <code>html</code> element</dfn> of a document is the document's root element, if there
- is one and it's an <code id=dom-tree-accessors:the-html-element><a href=#the-html-element>html</a></code> element, or null otherwise.</p>
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-head><a href=#dom-document-head>head</a></code><dd>
- <p>Returns <a href=#the-head-element-2 id=dom-tree-accessors:the-head-element-2>the <code>head</code> element</a>.</p>
- </dl>
- <p><dfn id=the-head-element-2>The <code>head</code> element</dfn> of a document is the first <code id=dom-tree-accessors:the-head-element><a href=#the-head-element>head</a></code> element
- that is a child of <a href=#the-html-element-2 id=dom-tree-accessors:the-html-element-2>the <code>html</code> element</a>, if there is one, or null
- otherwise.</p>
-
- <p>The <dfn id=dom-document-head><code>head</code></dfn> attribute, on getting, must return
- <a href=#the-head-element-2 id=dom-tree-accessors:the-head-element-2-2>the <code>head</code> element</a> of the document (a <code id=dom-tree-accessors:the-head-element-3><a href=#the-head-element>head</a></code> element or
- null).</p>
-
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:document.title><a href=#document.title>title</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the document's title, as given by <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2>the <code>title</code> element</a> for
- HTML and as given by the SVG <code>title</code> element for SVG.</p>
- <p>Can be set, to update the document's title. If there is no appropriate element to update, the
- new value is ignored.</p>
- </dl>
- <p><dfn id=the-title-element-2>The <code>title</code> element</dfn> of a document is the first <code id=dom-tree-accessors:the-title-element><a href=#the-title-element>title</a></code> element
- in the document (in <a href=#tree-order id=dom-tree-accessors:tree-order>tree order</a>), if there is one, or null otherwise.</p>
-
- <p>The <dfn id=document.title><code>title</code></dfn> attribute
- must, on getting, run the following algorithm:</p>
- <ol><li><p>If the <a href=#root-element id=dom-tree-accessors:root-element>root element</a> is an <code id=dom-tree-accessors:svg-2><a href=#svg-2>svg</a></code> element in the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace>SVG
- namespace</a>, then let <var>value</var> be a concatenation of the data of all the
- child <code id=dom-tree-accessors:text><a href=#text>Text</a></code> nodes of the first <code>title</code> element in the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace-2>SVG
- namespace</a> that is a child of the <a href=#root-element id=dom-tree-accessors:root-element-2>root element</a>. <a href=#refsSVG>[SVG]</a><li><p>Otherwise, let <var>value</var> be a concatenation of the data of all the child
- <code id=dom-tree-accessors:text-2><a href=#text>Text</a></code> nodes of <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2-2>the <code>title</code> element</a>, in <a href=#tree-order id=dom-tree-accessors:tree-order-2>tree
- order</a>, or the empty string if <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2-3>the <code>title</code> element</a> is
- null.<li><p><a href=#strip-and-collapse-whitespace id=dom-tree-accessors:strip-and-collapse-whitespace>Strip and collapse whitespace</a> in <var>value</var>.<li><p>Return <var>value</var>.</ol>
- <p>On setting, the steps corresponding to the first matching condition in the following list must
- be run:</p>
- <dl class=switch><dt>If the <a href=#root-element id=dom-tree-accessors:root-element-3>root element</a> is an <code id=dom-tree-accessors:svg-2-2><a href=#svg-2>svg</a></code> element in the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace-3>SVG
- namespace</a> <a href=#refsSVG>[SVG]</a><dd>
- <ol><li><p>Let <var>element</var> be the first <code>title</code> element in
- the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace-4>SVG namespace</a> that is a child of the <a href=#root-element id=dom-tree-accessors:root-element-4>root element</a>, if any. If
- there isn't one, create a <code>title</code> element in the <a href=#svg-namespace id=dom-tree-accessors:svg-namespace-5>SVG
- namespace</a>, append it to the <a href=#root-element id=dom-tree-accessors:root-element-5>root element</a>, and let <var>element</var> be that element. <a href=#refsSVG>[SVG]</a><li><p>Act as if the <code id=dom-tree-accessors:textcontent><a href=#textcontent>textContent</a></code> IDL attribute of <var>element</var> was
- set to the new value being assigned.</ol>
- <dt>If the <a href=#root-element id=dom-tree-accessors:root-element-6>root element</a> is in the <a href=#html-namespace-2 id=dom-tree-accessors:html-namespace-2>HTML namespace</a><dd>
- <ol><li><p>If <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2-4>the <code>title</code> element</a> is null and <a href=#the-head-element-2 id=dom-tree-accessors:the-head-element-2-3>the <code>head</code>
- element</a> is null, then abort these steps.<li><p>If <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2-5>the <code>title</code> element</a> is null, then create a new
- <code id=dom-tree-accessors:the-title-element-3><a href=#the-title-element>title</a></code> element and <a href=#concept-node-append id=dom-tree-accessors:concept-node-append>append</a> it to <a href=#the-head-element-2 id=dom-tree-accessors:the-head-element-2-4>the
- <code>head</code> element</a>, and let <var>element</var> be the newly created
- element; otherwise, let <var>element</var> be <a href=#the-title-element-2 id=dom-tree-accessors:the-title-element-2-6>the <code>title</code>
- element</a>.<li><p>Act as if the <code id=dom-tree-accessors:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute of <var>element</var> was
- set to the new value being assigned.</ol>
- <dt>Otherwise<dd>
- <p>Do nothing.</p>
- </dl>
-
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-body><a href=#dom-document-body>body</a></code> [ = <var>value</var> ]<dd>
- <p>Returns <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2>the body element</a>.</p>
- <p>Can be set, to replace <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-2>the body element</a>.</p>
- <p>If the new value is not a <code id=dom-tree-accessors:the-body-element><a href=#the-body-element>body</a></code> or <code id=dom-tree-accessors:frameset><a href=#frameset>frameset</a></code> element, this will throw
- a <code id=dom-tree-accessors:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
- </dl>
- <p><dfn id=the-body-element-2>The body element</dfn> of a document is the first child of <a href=#the-html-element-2 id=dom-tree-accessors:the-html-element-2-2>the <code>html</code>
- element</a> that is either a <code id=dom-tree-accessors:the-body-element-3><a href=#the-body-element>body</a></code> element or a <code id=dom-tree-accessors:frameset-2><a href=#frameset>frameset</a></code> element. If
- there is no such element, it is null.</p>
-
- <p>The <dfn id=dom-document-body><code>body</code></dfn> attribute, on getting, must return
- <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-3>the body element</a> of the document (either a <code id=dom-tree-accessors:the-body-element-4><a href=#the-body-element>body</a></code> element, a
- <code id=dom-tree-accessors:frameset-3><a href=#frameset>frameset</a></code> element, or null). On setting, the following algorithm must be run:</p>
- <ol><li>If the new value is not a <code id=dom-tree-accessors:the-body-element-5><a href=#the-body-element>body</a></code> or <code id=dom-tree-accessors:frameset-4><a href=#frameset>frameset</a></code> element, then throw a
- <code id=dom-tree-accessors:hierarchyrequesterror-2><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception and abort these steps.<li>Otherwise, if the new value is the same as <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-4>the body element</a>, do nothing. Abort
- these steps.<li>Otherwise, if <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-5>the body element</a> is not null, then replace that element with the
- new value in the DOM, as if the root element's <code>replaceChild()</code> method had
- been called with the new value and <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-6>the incumbent body
- element</a> as its two arguments respectively, then abort these steps.<li>Otherwise, if there is no root element, throw a <code id=dom-tree-accessors:hierarchyrequesterror-3><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception
- and abort these steps.<li>Otherwise, <a href=#the-body-element-2 id=dom-tree-accessors:the-body-element-2-7>the body element</a> is null, but there's a root element. Append
- the new value to the root element.</ol>
-
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-images><a href=#dom-document-images>images</a></code><dd>
- <p>Returns an <code id=dom-tree-accessors:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=dom-tree-accessors:the-img-element><a href=#the-img-element>img</a></code> elements in the <code id=dom-tree-accessors:document><a href=#document>Document</a></code>.</p>
- <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-embeds><a href=#dom-document-embeds>embeds</a></code><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-plugins><a href=#dom-document-plugins>plugins</a></code><dd>
- <p>Return an <code id=dom-tree-accessors:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=dom-tree-accessors:the-embed-element><a href=#the-embed-element>embed</a></code> elements in the <code id=dom-tree-accessors:document-2><a href=#document>Document</a></code>.</p>
- <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-links><a href=#dom-document-links>links</a></code><dd>
- <p>Returns an <code id=dom-tree-accessors:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=dom-tree-accessors:the-a-element><a href=#the-a-element>a</a></code> and <code id=dom-tree-accessors:the-area-element><a href=#the-area-element>area</a></code> elements
- in the <code id=dom-tree-accessors:document-3><a href=#document>Document</a></code> that have <code id=dom-tree-accessors:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
- attributes.</p>
- <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-forms><a href=#dom-document-forms>forms</a></code><dd>
- <p>Return an <code id=dom-tree-accessors:htmlcollection-4><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=dom-tree-accessors:the-form-element><a href=#the-form-element>form</a></code> elements in the <code id=dom-tree-accessors:document-4><a href=#document>Document</a></code>.</p>
- <dt><var>document</var> . <code id=dom-tree-accessors:dom-document-scripts><a href=#dom-document-scripts>scripts</a></code><dd>
- <p>Return an <code id=dom-tree-accessors:htmlcollection-5><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=dom-tree-accessors:the-script-element><a href=#the-script-element>script</a></code> elements in the <code id=dom-tree-accessors:document-5><a href=#document>Document</a></code>.</p>
- </dl>
-
-
- <p>The <dfn id=dom-document-images><code>images</code></dfn> attribute must return an
- <code id=dom-tree-accessors:htmlcollection-6><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-6><a href=#document>Document</a></code> node, whose filter matches only
- <code id=dom-tree-accessors:the-img-element-2><a href=#the-img-element>img</a></code> elements.</p>
- <p>The <dfn id=dom-document-embeds><code>embeds</code></dfn> attribute must return an
- <code id=dom-tree-accessors:htmlcollection-7><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-7><a href=#document>Document</a></code> node, whose filter matches only
- <code id=dom-tree-accessors:the-embed-element-2><a href=#the-embed-element>embed</a></code> elements.</p>
- <p>The <dfn id=dom-document-plugins><code>plugins</code></dfn> attribute must return the
- same object as that returned by the <code id=dom-tree-accessors:dom-document-embeds-2><a href=#dom-document-embeds>embeds</a></code>
- attribute.</p>
- <p>The <dfn id=dom-document-links><code>links</code></dfn> attribute must return an
- <code id=dom-tree-accessors:htmlcollection-8><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-8><a href=#document>Document</a></code> node, whose filter matches only
- <code id=dom-tree-accessors:the-a-element-2><a href=#the-a-element>a</a></code> elements with <code id=dom-tree-accessors:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attributes and
- <code id=dom-tree-accessors:the-area-element-2><a href=#the-area-element>area</a></code> elements with <code id=dom-tree-accessors:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code> attributes.</p>
- <p>The <dfn id=dom-document-forms><code>forms</code></dfn> attribute must return an
- <code id=dom-tree-accessors:htmlcollection-9><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-9><a href=#document>Document</a></code> node, whose filter matches only
- <code id=dom-tree-accessors:the-form-element-2><a href=#the-form-element>form</a></code> elements.</p>
- <p>The <dfn id=dom-document-scripts><code>scripts</code></dfn> attribute must return an
- <code id=dom-tree-accessors:htmlcollection-10><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-10><a href=#document>Document</a></code> node, whose filter matches only
- <code id=dom-tree-accessors:the-script-element-2><a href=#the-script-element>script</a></code> elements.</p>
- <hr>
-
- <dl class=domintro><dt><var>collection</var> = <var>document</var> . <code id=dom-tree-accessors:dom-document-getelementsbyname><a href=#dom-document-getelementsbyname>getElementsByName</a></code>(<var>name</var>)<dd>
- <p>Returns a <code id=dom-tree-accessors:nodelist><a href=#nodelist>NodeList</a></code> of elements in the <code id=dom-tree-accessors:document-11><a href=#document>Document</a></code> that have a <code>name</code> attribute with the value <var>name</var>.</p>
- </dl>
-
- <p>The <dfn id=dom-document-getelementsbyname><code>getElementsByName(<var>name</var>)</code></dfn> method takes a string <var>name</var>, and must
- return a <a href=#live id=dom-tree-accessors:live>live</a> <code id=dom-tree-accessors:nodelist-2><a href=#nodelist>NodeList</a></code> containing all the <a href=#html-elements id=dom-tree-accessors:html-elements>HTML elements</a> in
- that document that have a <code>name</code> attribute whose value is equal to the <var>name</var> argument (in a <a href=#case-sensitive id=dom-tree-accessors:case-sensitive>case-sensitive</a> manner), in <a href=#tree-order id=dom-tree-accessors:tree-order-3>tree
- order</a>. When the method is invoked on a <code id=dom-tree-accessors:document-12><a href=#document>Document</a></code> object again with the same
- argument, the user agent may return the same as the object returned by the earlier call. In other
- cases, a new <code id=dom-tree-accessors:nodelist-3><a href=#nodelist>NodeList</a></code> object must be returned.</p>
-
- <hr>
- <dl class=domintro><dt><var>element</var> . <code id=dom-tree-accessors:dom-document-csselementmap><a href=#dom-document-csselementmap>cssElementMap</a></code><dd>
- <p>Returns a <code id=dom-tree-accessors:domelementmap-2><a href=#domelementmap-2>DOMElementMap</a></code> object for the <code id=dom-tree-accessors:document-13><a href=#document>Document</a></code> representing the
- current <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier>CSS element reference
- identifiers</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-document-csselementmap><code>cssElementMap</code></dfn> IDL attribute
- allows authors to define <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier-2>CSS element reference
- identifiers</a>, which are used in certain CSS features to override the normal <a href=#concept-id id=dom-tree-accessors:concept-id>ID</a>-based mapping. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>When a <code id=dom-tree-accessors:document-14><a href=#document>Document</a></code> is created, it must be associated with an initially-empty <dfn id=css-id-overrides-list>CSS
- ID overrides list</dfn>, which consists of a list of mappings each of which consists of a string
- name mapped to an <code id=dom-tree-accessors:element><a href=#element>Element</a></code> node.</p>
- <p>Each entry in the <a href=#css-id-overrides-list id=dom-tree-accessors:css-id-overrides-list>CSS ID overrides list</a>, while it is in the list and is either
- <a href=#in-a-document id=dom-tree-accessors:in-a-document>in the <code>Document</code></a> or is an <code id=dom-tree-accessors:the-img-element-3><a href=#the-img-element>img</a></code>,
- <code id=dom-tree-accessors:the-video-element><a href=#the-video-element>video</a></code>, or <code id=dom-tree-accessors:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element, defines a <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier-3>CSS element reference
- identifier</a> mapping the given name to the given <code id=dom-tree-accessors:element-2><a href=#element>Element</a></code>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>On getting, the <code id=dom-tree-accessors:dom-document-csselementmap-2><a href=#dom-document-csselementmap>cssElementMap</a></code> IDL attribute
- must return a <code id=dom-tree-accessors:domelementmap-2-2><a href=#domelementmap-2>DOMElementMap</a></code> object, associated with the following algorithms, which
- expose the current mappings:</p>
- <dl><dt>The algorithm for getting the list of name-element mappings<dd>
- <p>Return the <code id=dom-tree-accessors:document-15><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list id=dom-tree-accessors:css-id-overrides-list-2>CSS ID overrides list</a>, maintaining the order
- in which the entries were originally added to the list.</p>
- <dt>The algorithm for mapping a name to a certain element<dd>
- <p>Let <var>name</var> be the name passed to the algorithm and <var>element</var> be the <code id=dom-tree-accessors:element-3><a href=#element>Element</a></code> passed to the algorithm.</p>
- <p>If <var>element</var> is null, run the algorithm for deleting mappings by name,
- passing it <var>name</var>.</p>
- <p>Otherwise, if there is an entry in the <code id=dom-tree-accessors:document-16><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list id=dom-tree-accessors:css-id-overrides-list-3>CSS ID overrides
- list</a> whose name is <var>name</var>, replace its current value with <var>element</var>.</p>
- <p>Otherwise, add a mapping to the <code id=dom-tree-accessors:document-17><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list id=dom-tree-accessors:css-id-overrides-list-4>CSS ID overrides list</a>
- whose name is <var>name</var> and whose element is <var>element</var>.</p>
- <dt>The algorithm for deleting mappings by name<dd>
- <p>If there is an entry in the <code id=dom-tree-accessors:document-18><a href=#document>Document</a></code>'s <a href=#css-id-overrides-list id=dom-tree-accessors:css-id-overrides-list-5>CSS ID overrides list</a> whose
- name is the name passed to this algorithm, remove it. This also undefines the <a href=#css-element-reference-identifier id=dom-tree-accessors:css-element-reference-identifier-4>CSS element
- reference identifier</a> for that name. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- </dl>
- <p>The same object must be returned each time.</p>
-
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=dom-tree-accessors:dom-document-currentscript><a href=#dom-document-currentscript>currentScript</a></code><dd>
- <p>Returns the <code id=dom-tree-accessors:the-script-element-3><a href=#the-script-element>script</a></code> element that is currently executing. In the case of reentrant
- <code id=dom-tree-accessors:the-script-element-4><a href=#the-script-element>script</a></code> execution, returns the one that most recently started executing amongst
- those that have not yet finished executing.</p>
- <p>Returns null if the <code id=dom-tree-accessors:document-19><a href=#document>Document</a></code> is not currently executing a <code id=dom-tree-accessors:the-script-element-5><a href=#the-script-element>script</a></code>
- element (e.g. because the running script is an event handler, or a timeout).</p>
- </dl>
-
- <p>The <dfn id=dom-document-currentscript><code>currentScript</code></dfn> attribute, on
- getting, must return the value to which it was most recently initialized. When the
- <code id=dom-tree-accessors:document-20><a href=#document>Document</a></code> is created, the <code id=dom-tree-accessors:dom-document-currentscript-2><a href=#dom-document-currentscript>currentScript</a></code> must be initialised to null.</p>
-
-
- <hr>
- <p id=dom-document-namedItem-which>The <code id=dom-tree-accessors:document-21><a href=#document>Document</a></code> interface <a href=#support-named-properties id=dom-tree-accessors:support-named-properties>supports named properties</a>. The <a href=#supported-property-names id=dom-tree-accessors:supported-property-names>supported property names</a> at
- any moment consist of the values of the <code>name</code> content attributes of
- all the
- <code id=dom-tree-accessors:the-applet-element><a href=#the-applet-element>applet</a></code>,
- <a href=#exposed id=dom-tree-accessors:exposed>exposed</a> <code id=dom-tree-accessors:the-embed-element-3><a href=#the-embed-element>embed</a></code>,
- <code id=dom-tree-accessors:the-form-element-3><a href=#the-form-element>form</a></code>,
- <code id=dom-tree-accessors:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=dom-tree-accessors:the-img-element-4><a href=#the-img-element>img</a></code>, and
- <a href=#exposed id=dom-tree-accessors:exposed-2>exposed</a> <code id=dom-tree-accessors:the-object-element><a href=#the-object-element>object</a></code>
- elements in the <code id=dom-tree-accessors:document-22><a href=#document>Document</a></code> that have non-empty <code>name</code> content
- attributes, and the values of the <code id=dom-tree-accessors:the-id-attribute><a href=#the-id-attribute>id</a></code> content attributes of all the
- <code id=dom-tree-accessors:the-applet-element-2><a href=#the-applet-element>applet</a></code> and
- <a href=#exposed id=dom-tree-accessors:exposed-3>exposed</a> <code id=dom-tree-accessors:the-object-element-2><a href=#the-object-element>object</a></code>
- elements in the <code id=dom-tree-accessors:document-23><a href=#document>Document</a></code> that have non-empty <code id=dom-tree-accessors:the-id-attribute-2><a href=#the-id-attribute>id</a></code> content
- attributes, and the values of the <code id=dom-tree-accessors:the-id-attribute-3><a href=#the-id-attribute>id</a></code> content attributes of all the
- <code id=dom-tree-accessors:the-img-element-5><a href=#the-img-element>img</a></code>
- elements in the <code id=dom-tree-accessors:document-24><a href=#document>Document</a></code> that have both non-empty <code>name</code> content
- attributes and non-empty <code id=dom-tree-accessors:the-id-attribute-4><a href=#the-id-attribute>id</a></code> content attributes. The <a href=#supported-property-names id=dom-tree-accessors:supported-property-names-2>supported
- property names</a> must be in <a href=#tree-order id=dom-tree-accessors:tree-order-4>tree order</a>, ignoring later duplicates, with values
- from <code id=dom-tree-accessors:the-id-attribute-5><a href=#the-id-attribute>id</a></code> attributes coming before values from <code>name</code> attributes when the same element contributes both.</p>
- <p>To <a href=#determine-the-value-of-a-named-property id=dom-tree-accessors:determine-the-value-of-a-named-property>determine the value of a named property</a> <var>name</var> when <dfn id=dom-document-nameditem>the <code>Document</code> object is indexed for property
- retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>
- <ol><li>
- <p>Let <var>elements</var> be the list of <a href=#dom-document-nameditem-filter id=dom-tree-accessors:dom-document-nameditem-filter>named elements</a> with the name <var>name</var> in the <code id=dom-tree-accessors:document-25><a href=#document>Document</a></code>.
- <p class=note>There will be at least one such element, by definition.</p>
- <li>
- <p>If <var>elements</var> has only one element, and that element is an
- <code id=dom-tree-accessors:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> element, then return the <code id=dom-tree-accessors:windowproxy><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#nested-browsing-context id=dom-tree-accessors:nested-browsing-context>nested
- browsing context</a> represented by that <code id=dom-tree-accessors:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code> element, and abort these
- steps.</p>
- <li>
- <p>Otherwise, if <var>elements</var> has only one element, return that element and
- abort these steps.</p>
- <li>
- <p>Otherwise return an <code id=dom-tree-accessors:htmlcollection-11><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=dom-tree-accessors:document-26><a href=#document>Document</a></code> node,
- whose filter matches only <a href=#dom-document-nameditem-filter id=dom-tree-accessors:dom-document-nameditem-filter-2>named elements</a> with
- the name <var>name</var>.</p>
- </ol>
- <p><dfn id=dom-document-nameditem-filter>Named elements</dfn> with the name <var>name</var>, for the purposes of the above algorithm, are those that are either:</p>
- <ul><li><code id=dom-tree-accessors:the-applet-element-3><a href=#the-applet-element>applet</a></code>, <a href=#exposed id=dom-tree-accessors:exposed-4>exposed</a> <code id=dom-tree-accessors:the-embed-element-4><a href=#the-embed-element>embed</a></code>, <code id=dom-tree-accessors:the-form-element-4><a href=#the-form-element>form</a></code>,
- <code id=dom-tree-accessors:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>, <code id=dom-tree-accessors:the-img-element-6><a href=#the-img-element>img</a></code>, or <a href=#exposed id=dom-tree-accessors:exposed-5>exposed</a> <code id=dom-tree-accessors:the-object-element-3><a href=#the-object-element>object</a></code> elements that
- have a <code>name</code> content attribute whose value is <var>name</var>, or<li><code id=dom-tree-accessors:the-applet-element-4><a href=#the-applet-element>applet</a></code> or <a href=#exposed id=dom-tree-accessors:exposed-6>exposed</a> <code id=dom-tree-accessors:the-object-element-4><a href=#the-object-element>object</a></code> elements that have an <code id=dom-tree-accessors:the-id-attribute-6><a href=#the-id-attribute>id</a></code> content attribute whose value is <var>name</var>, or<li><code id=dom-tree-accessors:the-img-element-7><a href=#the-img-element>img</a></code> elements that have an <code id=dom-tree-accessors:the-id-attribute-7><a href=#the-id-attribute>id</a></code> content attribute
- whose value is <var>name</var>, and that have a non-empty <code>name</code>
- content attribute present also.</ul>
- <p>An <code id=dom-tree-accessors:the-embed-element-5><a href=#the-embed-element>embed</a></code> or <code id=dom-tree-accessors:the-object-element-5><a href=#the-object-element>object</a></code> element is said to be <dfn id=exposed>exposed</dfn> if it has
- no <a href=#exposed id=dom-tree-accessors:exposed-7>exposed</a> <code id=dom-tree-accessors:the-object-element-6><a href=#the-object-element>object</a></code> ancestor, and, for <code id=dom-tree-accessors:the-object-element-7><a href=#the-object-element>object</a></code> elements, is
- additionally either not showing its <a href=#fallback-content id=dom-tree-accessors:fallback-content>fallback content</a> or has no <code id=dom-tree-accessors:the-object-element-8><a href=#the-object-element>object</a></code> or
- <code id=dom-tree-accessors:the-embed-element-6><a href=#the-embed-element>embed</a></code> descendants.</p>
-
- <hr>
- <p class=note>The <code id=dom-tree-accessors:dom-document-dir><a href=#dom-document-dir>dir</a></code> attribute on the
- <code id=dom-tree-accessors:document-27><a href=#document>Document</a></code> interface is defined along with the <code id=dom-tree-accessors:the-dir-attribute><a href=#the-dir-attribute>dir</a></code>
- content attribute.</p>
-
- <h4 id=loading-xml-documents>3.1.4 Loading XML documents</h4>
- <pre class=idl>partial interface <a href=#xmldocument id=loading-xml-documents:xmldocument>XMLDocument</a> {
- boolean <a href=#dom-xmldocument-load id=loading-xml-documents:dom-xmldocument-load>load</a>(DOMString url);
- };</pre>
-
-
-
- <p>The <dfn id=dom-xmldocument-load><code>load(<var>url</var>)</code></dfn> method
- must run the following steps:</p>
- <ol><li><p>Let <var>document</var> be the <code id=loading-xml-documents:xmldocument-2><a href=#xmldocument>XMLDocument</a></code> object on which the
- method was invoked.<li><p><a href=#resolve-a-url id=loading-xml-documents:resolve-a-url>Resolve</a> the method's first argument, relative to the
- <a href=#api-base-url id=loading-xml-documents:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=loading-xml-documents:entry-settings-object>entry settings object</a>. If this is not
- successful, throw a <code id=loading-xml-documents:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. Otherwise, let <var>url</var> be the resulting <a href=#absolute-url id=loading-xml-documents:absolute-url>absolute URL</a>.<li><p>If the <a href=#origin-2 id=loading-xml-documents:origin-2>origin</a> of <var>url</var> is not the same as the
- <a href=#origin-2 id=loading-xml-documents:origin-2-2>origin</a> of <var>document</var>, throw a <code id=loading-xml-documents:securityerror><a href=#securityerror>SecurityError</a></code> exception
- and abort these steps.<li><p>Remove all child nodes of <var>document</var>, without firing any mutation
- events.<li><p>Set the <a href=#current-document-readiness id=loading-xml-documents:current-document-readiness>current document readiness</a> of <var>document</var> to "<code>loading</code>".<li><p> Run the remainder of these steps asynchronously, and return true from the
- method.<li><p>Let <var>result</var> be a <code id=loading-xml-documents:document><a href=#document>Document</a></code> object.<li><p>Let <var>success</var> be false.<li><p><a href=#fetch id=loading-xml-documents:fetch>Fetch</a> <var>url</var> from the <a href=#origin-2 id=loading-xml-documents:origin-2-3>origin</a> of
- <var>document</var>, using the <a href=#api-referrer-source id=loading-xml-documents:api-referrer-source>API referrer source</a> specified by the
- <a href=#entry-settings-object id=loading-xml-documents:entry-settings-object-2>entry settings object</a>, with the <i>synchronous flag</i> set and the <i>force same-origin flag</i> set.<li>
- <p>If the fetch attempt was successful, and the resource's <a href=#content-type id=loading-xml-documents:content-type>Content-Type metadata</a> is an <a href=#xml-mime-type id=loading-xml-documents:xml-mime-type>XML MIME type</a>, then run
- these substeps:</p>
- <ol><li><p>Create a new <a href=#xml-parser id=loading-xml-documents:xml-parser>XML parser</a> associated with the <var>result</var>
- document.<li><p>Pass this parser the fetched document.<li><p>If there is an XML well-formedness or XML namespace well-formedness error, then remove
- all child nodes from <var>result</var>. Otherwise let <var>success</var> be
- true.</ol>
- <li>
- <p> <a href=#queue-a-task id=loading-xml-documents:queue-a-task>Queue a task</a> to run the following steps. </p>
- <ol><li><p>Set the <a href=#current-document-readiness id=loading-xml-documents:current-document-readiness-2>current document readiness</a> of <var>document</var> to
- "<code>complete</code>".<li><p>Replace all the children of <var>document</var> by the children of <var>result</var> (even if it has no children), firing mutation events as if a
- <code id=loading-xml-documents:documentfragment><a href=#documentfragment>DocumentFragment</a></code> containing the new children had been inserted.<li><p><a href=#fire-a-simple-event id=loading-xml-documents:fire-a-simple-event>Fire a simple event</a> named <code id=loading-xml-documents:event-load><a href=#event-load>load</a></code> at <var>document</var>.</ol>
- </ol>
-
- <h3 id=elements>3.2 Elements</h3>
- <h4 id=semantics-2>3.2.1 Semantics</h4>
- <p>Elements, attributes, and attribute values in HTML are defined (by this specification) to have
- certain meanings (semantics). For example, the <code id=semantics-2:the-ol-element><a href=#the-ol-element>ol</a></code> element represents an ordered list,
- and the <code id=semantics-2:attr-lang><a href=#attr-lang>lang</a></code> attribute represents the language of the content.</p>
- <p>These definitions allow HTML processors, such as Web browsers or search engines, to present and
- use documents and applications in a wide variety of contexts that the author might not have
- considered.</p>
- <div class=example>
- <p>As a simple example, consider a Web page written by an author who only considered desktop
- computer Web browsers:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>My Page</title>
- </head>
- <body>
- <h1>Welcome to my page</h1>
- <p>I like cars and lorries and have a big Jeep!</p>
- <h2>Where I live</h2>
- <p>I live in a small hut on a mountain!</p>
- </body>
- </html></pre>
- <p>Because HTML conveys <em>meaning</em>, rather than presentation, the same
- page can also be used by a small browser on a mobile phone, without any change to the page.
- Instead of headings being in large letters as on the desktop, for example, the browser on the
- mobile phone might use the same size text for the whole the page, but with the headings in
- bold.</p>
- <p>But it goes further than just differences in screen size: the same page could equally be used
- by a blind user using a browser based around speech synthesis, which instead of displaying the
- page on a screen, reads the page to the user, e.g. using headphones. Instead of large text for
- the headings, the speech browser might use a different volume or a slower voice.</p>
- <p>That's not all, either. Since the browsers know which parts of the page are the headings, they
- can create a document outline that the user can use to quickly navigate around the document,
- using keys for "jump to next heading" or "jump to previous heading". Such features are especially
- common with speech browsers, where users would otherwise find quickly navigating a page quite
- difficult.</p>
- <p>Even beyond browsers, software can make use of this information. Search engines can use the
- headings to more effectively index a page, or to provide quick links to subsections of the page
- from their results. Tools can use the headings to create a table of contents (that is in fact how
- this very specification's table of contents is generated).</p>
- <p>This example has focused on headings, but the same principle applies to all of the semantics
- in HTML.</p>
- </div>
- <p>Authors must not use elements, attributes, or attribute values for purposes other than their
- appropriate intended semantic purpose, as doing so prevents software from correctly processing the
- page.</p>
- <div class=example>
- <p>For example, the following snippet, intended to represent the heading of a
- corporate site, is non-conforming because the second line is not intended to
- be a heading of a subsection, but merely a subheading or subtitle (a
- subordinate heading for the same section).</p>
- <pre class=bad><body>
- <h1>ACME Corporation</h1>
- <h2>The leaders in arbitrary fast delivery since 1920</h2>
- ...</pre>
- <p>The <code id=semantics-2:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element is intended for these kinds of situations:</p>
- <pre><body>
- <hgroup>
- <h1>ACME Corporation</h1>
- <h2>The leaders in arbitrary fast delivery since 1920</h2>
- </hgroup>
- ...</pre>
- </div>
- <div class=example>
- <p>The document in this next example is similarly non-conforming, despite
- being syntactically correct, because the data placed in the cells is clearly
- not tabular data, and the <code id=semantics-2:the-cite-element><a href=#the-cite-element>cite</a></code> element mis-used:</p>
- <pre class=bad><!DOCTYPE HTML>
- <html lang="en-GB">
- <head> <title> Demonstration </title> </head>
- <body>
- <table>
- <tr> <td> My favourite animal is the cat. </td> </tr>
- <tr>
- <td>
- —<a href="http://example.org/~ernest/"><cite>Ernest</cite></a>,
- in an essay from 1992
- </td>
- </tr>
- </table>
- </body>
- </html></pre>
- <p>This would make software that relies on these semantics fail: for example,
- a speech browser that allowed a blind user to navigate tables in the document
- would report the quote above as a table, confusing the user; similarly, a
- tool that extracted titles of works from pages would extract "Ernest" as the
- title of a work, even though it's actually a person's name, not a title.</p>
- <p>A corrected version of this document might be:</p>
- <pre><!DOCTYPE HTML>
- <html lang="en-GB">
- <head> <title> Demonstration </title> </head>
- <body>
- <blockquote>
- <p> My favourite animal is the cat. </p>
- </blockquote>
- <p>
- —<a href="http://example.org/~ernest/">Ernest</a>,
- in an essay from 1992
- </p>
- </body>
- </html></pre>
- </div>
- <p>Authors must not use elements, attributes, or attribute values that are not permitted by this
- specification or <a href=#other-applicable-specifications id=semantics-2:other-applicable-specifications>other applicable specifications</a>, as doing so makes it significantly
- harder for the language to be extended in the future.</p>
- <div class=example>
- <p>In the next example, there is a non-conforming attribute value ("carpet") and a non-conforming
- attribute ("texture"), which is not permitted by this specification:</p>
- <pre class=bad><label>Carpet: <input type="carpet" name="c" texture="deep pile"></label></pre>
- <p>Here would be an alternative and correct way to mark this up:</p>
- <pre><label>Carpet: <input type="text" class="carpet" name="c" data-texture="deep pile"></label></pre>
- </div>
- <p>Through scripting and using other mechanisms, the values of attributes, text, and indeed the
- entire structure of the document may change dynamically while a user agent is processing it. The
- semantics of a document at an instant in time are those represented by the state of the document
- at that instant in time, and the semantics of a document can therefore change over time. User
- agents must update their presentation of the document as this
- occurs.</p>
- <p class=example>HTML has a <code id=semantics-2:the-progress-element><a href=#the-progress-element>progress</a></code> element that describes a progress bar. If its
- "value" attribute is dynamically updated by a script, the UA would update the rendering to show
- the progress changing.</p>
- <h4 id=elements-in-the-dom>3.2.2 Elements in the DOM</h4>
- <p>The nodes representing <a href=#html-elements id=elements-in-the-dom:html-elements>HTML elements</a> in the DOM must
- implement, and expose to scripts, the interfaces listed for them in the relevant sections of this
- specification. This includes <a href=#html-elements id=elements-in-the-dom:html-elements-2>HTML elements</a> in <a href=#xml-documents id=elements-in-the-dom:xml-documents>XML documents</a>, even when
- those documents are in another context (e.g. inside an XSLT transform).</p>
- <p>Elements in the DOM <dfn id=represents>represent</dfn> things; that is, they have
- intrinsic <em>meaning</em>, also known as semantics.</p>
- <p class=example>For example, an <code id=elements-in-the-dom:the-ol-element><a href=#the-ol-element>ol</a></code> element represents an ordered list.</p>
- <p>The basic interface, from which all the <a href=#html-elements id=elements-in-the-dom:html-elements-3>HTML elements</a>' interfaces inherit, and which must be used by elements that have no additional requirements, is
- the <code id=elements-in-the-dom:htmlelement><a href=#htmlelement>HTMLElement</a></code> interface.</p>
- <pre class=idl>interface <dfn id=htmlelement>HTMLElement</dfn> : <a href=#element id=elements-in-the-dom:element>Element</a> {
- // metadata attributes
- attribute DOMString <a href=#dom-title id=elements-in-the-dom:dom-title>title</a>;
- attribute DOMString <a href=#dom-lang id=elements-in-the-dom:dom-lang>lang</a>;
- attribute boolean <a href=#dom-translate id=elements-in-the-dom:dom-translate>translate</a>;
- attribute DOMString <a href=#dom-dir id=elements-in-the-dom:dom-dir>dir</a>;
- readonly attribute <a href=#domstringmap-2 id=elements-in-the-dom:domstringmap-2>DOMStringMap</a> <a href=#dom-dataset id=elements-in-the-dom:dom-dataset>dataset</a>;
- // <a href=#microdata id=elements-in-the-dom:microdata>microdata</a>
- attribute boolean <a href=#dom-itemscope id=elements-in-the-dom:dom-itemscope>itemScope</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=elements-in-the-dom:dom-domsettabletokenlist-value>value</a>] readonly attribute <a href=#domsettabletokenlist id=elements-in-the-dom:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-itemtype id=elements-in-the-dom:dom-itemtype>itemType</a>;
- attribute DOMString <a href=#dom-itemid id=elements-in-the-dom:dom-itemid>itemId</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=elements-in-the-dom:dom-domsettabletokenlist-value-2>value</a>] readonly attribute <a href=#domsettabletokenlist id=elements-in-the-dom:domsettabletokenlist-2>DOMSettableTokenList</a> <a href=#dom-itemref id=elements-in-the-dom:dom-itemref>itemRef</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=elements-in-the-dom:dom-domsettabletokenlist-value-3>value</a>] readonly attribute <a href=#domsettabletokenlist id=elements-in-the-dom:domsettabletokenlist-3>DOMSettableTokenList</a> <a href=#dom-itemprop id=elements-in-the-dom:dom-itemprop>itemProp</a>;
- readonly attribute <a href=#htmlpropertiescollection-2 id=elements-in-the-dom:htmlpropertiescollection-2>HTMLPropertiesCollection</a> <a href=#dom-properties id=elements-in-the-dom:dom-properties>properties</a>;
- attribute any <a href=#dom-itemvalue id=elements-in-the-dom:dom-itemvalue>itemValue</a>; // acts as DOMString on setting
- // <a href=#editing id=elements-in-the-dom:editing>user interaction</a>
- attribute boolean <a href=#dom-hidden id=elements-in-the-dom:dom-hidden>hidden</a>;
- void <a href=#dom-click id=elements-in-the-dom:dom-click>click</a>();
- attribute long <a href=#dom-tabindex id=elements-in-the-dom:dom-tabindex>tabIndex</a>;
- void <a href=#dom-focus id=elements-in-the-dom:dom-focus>focus</a>();
- void <a href=#dom-blur id=elements-in-the-dom:dom-blur>blur</a>();
- attribute DOMString <a href=#dom-accesskey id=elements-in-the-dom:dom-accesskey>accessKey</a>;
- readonly attribute DOMString <a href=#dom-accesskeylabel id=elements-in-the-dom:dom-accesskeylabel>accessKeyLabel</a>;
- attribute boolean <a href=#dom-draggable id=elements-in-the-dom:dom-draggable>draggable</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=elements-in-the-dom:dom-domsettabletokenlist-value-4>value</a>] readonly attribute <a href=#domsettabletokenlist id=elements-in-the-dom:domsettabletokenlist-4>DOMSettableTokenList</a> <a href=#dom-dropzone id=elements-in-the-dom:dom-dropzone>dropzone</a>;
- attribute DOMString <a href=#dom-contenteditable id=elements-in-the-dom:dom-contenteditable>contentEditable</a>;
- readonly attribute boolean <a href=#dom-iscontenteditable id=elements-in-the-dom:dom-iscontenteditable>isContentEditable</a>;
- attribute <a href=#htmlmenuelement id=elements-in-the-dom:htmlmenuelement>HTMLMenuElement</a>? <a href=#dom-contextmenu id=elements-in-the-dom:dom-contextmenu>contextMenu</a>;
- attribute boolean <a href=#dom-spellcheck id=elements-in-the-dom:dom-spellcheck>spellcheck</a>;
- void <a href=#dom-forcespellcheck id=elements-in-the-dom:dom-forcespellcheck>forceSpellCheck</a>();
- // <a href=#command-api id=elements-in-the-dom:command-api>command API</a>
- readonly attribute DOMString? <a href=#dom-command-ro-commandtype id=elements-in-the-dom:dom-command-ro-commandtype>commandType</a>;
- readonly attribute DOMString? <a href=#dom-command-ro-commandlabel id=elements-in-the-dom:dom-command-ro-commandlabel>commandLabel</a>;
- readonly attribute DOMString? <a href=#dom-command-ro-commandicon id=elements-in-the-dom:dom-command-ro-commandicon>commandIcon</a>;
- readonly attribute boolean? <a href=#dom-command-ro-commandhidden id=elements-in-the-dom:dom-command-ro-commandhidden>commandHidden</a>;
- readonly attribute boolean? <a href=#dom-command-ro-commanddisabled id=elements-in-the-dom:dom-command-ro-commanddisabled>commandDisabled</a>;
- readonly attribute boolean? <a href=#dom-command-ro-commandchecked id=elements-in-the-dom:dom-command-ro-commandchecked>commandChecked</a>;
- };
- <a href=#htmlelement id=elements-in-the-dom:htmlelement-2>HTMLElement</a> implements <a href=#globaleventhandlers id=elements-in-the-dom:globaleventhandlers>GlobalEventHandlers</a>;
- interface <dfn id=htmlunknownelement>HTMLUnknownElement</dfn> : <a href=#htmlelement id=elements-in-the-dom:htmlelement-3>HTMLElement</a> { };</pre>
- <p>The <code id=elements-in-the-dom:htmlelement-4><a href=#htmlelement>HTMLElement</a></code> interface holds methods and attributes related to a number of
- disparate features, and the members of this interface are therefore described in various different
- sections of this specification.</p>
-
- <p>The <code id=elements-in-the-dom:htmlunknownelement><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface must be used for <a href=#html-elements id=elements-in-the-dom:html-elements-4>HTML elements</a> that
- are not defined by this specification (or <a href=#other-applicable-specifications id=elements-in-the-dom:other-applicable-specifications>other applicable specifications</a>).</p>
-
- <h4 id=element-definitions>3.2.3 Element definitions</h4>
- <p>Each element in this specification has a definition that includes the following
- information:</p>
- <dl><dt><dfn id=concept-element-categories>Categories</dfn><dd><p>A list of <a href=#content-categories id=element-definitions:content-categories>categories</a> to which the element belongs.
- These are used when defining the <a href=#content-models id=element-definitions:content-models>content models</a> for each element.<dt><dfn id=concept-element-contexts>Contexts in which this element can be used</dfn><dd>
- <p>A <em>non-normative</em> description of where the element can be used. This information is
- redundant with the content models of elements that allow this one as a child, and is provided
- only as a convenience.</p>
- <p class=note>For simplicity, only the most specific expectations are listed. For example, an
- element that is both <a href=#flow-content-2 id=element-definitions:flow-content-2>flow content</a> and <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2>phrasing content</a> can be used
- anywhere that either <a href=#flow-content-2 id=element-definitions:flow-content-2-2>flow content</a> or <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2-2>phrasing content</a> is expected, but
- since anywhere that <a href=#flow-content-2 id=element-definitions:flow-content-2-3>flow content</a> is expected, <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2-3>phrasing content</a> is also
- expected (since all <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2-4>phrasing content</a> is <a href=#flow-content-2 id=element-definitions:flow-content-2-4>flow content</a>), only "where
- <a href=#phrasing-content-2 id=element-definitions:phrasing-content-2-5>phrasing content</a> is expected" will be listed.</p>
- <dt><dfn id=concept-element-content-model>Content model</dfn><dd><p>A normative description of what content must be included as children and descendants of
- the element.<dt><dfn id=concept-element-tag-omission>Tag omission in text/html</dfn><dd><p>A <em>non-normative</em> description of whether, in the <code id=element-definitions:text/html><a href=#text/html>text/html</a></code> syntax, the
- <a href=#syntax-start-tag id=element-definitions:syntax-start-tag>start</a> and <a href=#syntax-end-tag id=element-definitions:syntax-end-tag>end</a> tags can
- be omitted. This information is redundant with the normative requirements given in the <a href=#syntax-tag-omission id=element-definitions:syntax-tag-omission>optional tags</a> section, and is provided in the element
- definitions only as a convenience.<dt><dfn id=concept-element-attributes>Content attributes</dfn><dd><p>A normative list of attributes that may be specified on the element (except where
- otherwise disallowed), along with non-normative descriptions of those attributes. (The content to
- the left of the dash is normative, the content to the right of the dash is not.)<dt><dfn id=concept-element-dom>DOM interface</dfn><dd><p>A normative definition of a DOM interface that such elements must implement.</dl>
- <p>This is then followed by a description of what the element <a href=#represents id=element-definitions:represents>represents</a>, along with
- any additional normative conformance criteria that may apply to authors and implementations. Examples are sometimes also included.</p>
- <h5 id=attributes>3.2.3.1 Attributes</h5>
- <p id=attribute-text>Except where otherwise specified, attributes on <a href=#html-elements id=attributes:html-elements>HTML elements</a>
- may have any string value, including the empty string. Except where explicitly stated, there is no
- restriction on what text can be specified in such attributes.</p>
- <h4 id=content-models>3.2.4 <dfn>Content models</dfn></h4>
- <p>Each element defined in this specification has a content model: a description of the element's
- expected <a href=#concept-html-contents id=content-models:concept-html-contents>contents</a>. An <a href=#html-elements id=content-models:html-elements>HTML
- element</a> must have contents that match the requirements described in the element's content
- model. The <dfn id=concept-html-contents>contents</dfn> of an element are its children in the
- DOM, except for <code id=content-models:the-template-element><a href=#the-template-element>template</a></code> elements, where the children are those in the <a href=#template-contents id=content-models:template-contents>template
- contents</a> (a separate <code id=content-models:documentfragment><a href=#documentfragment>DocumentFragment</a></code> assigned to the element when the element
- is created).</p>
- <p>The <a href=#space-character id=content-models:space-character>space characters</a> are always allowed between elements.
- User agents represent these characters between elements in the source markup as <code id=content-models:text><a href=#text>Text</a></code>
- nodes in the DOM. Empty
- <code id=content-models:text-2><a href=#text>Text</a></code> nodes and <code id=content-models:text-3><a href=#text>Text</a></code> nodes consisting of just sequences of those
- characters are considered <dfn id=inter-element-whitespace>inter-element whitespace</dfn>.</p>
- <p><a href=#inter-element-whitespace id=content-models:inter-element-whitespace>Inter-element whitespace</a>, comment nodes, and processing instruction nodes must be
- ignored when establishing whether an element's contents match the element's content model or not,
- and must be ignored when following algorithms that define document and element semantics.</p>
- <p class=note>Thus, an element <var>A</var> is said to be <i>preceded or followed</i>
- by a second element <var>B</var> if <var>A</var> and <var>B</var> have
- the same parent node and there are no other element nodes or <code id=content-models:text-4><a href=#text>Text</a></code> nodes (other than
- <a href=#inter-element-whitespace id=content-models:inter-element-whitespace-2>inter-element whitespace</a>) between them. Similarly, a node is the <i>only child</i> of
- an element if that element contains no other nodes other than <a href=#inter-element-whitespace id=content-models:inter-element-whitespace-3>inter-element
- whitespace</a>, comment nodes, and processing instruction nodes.</p>
- <p>Authors must not use <a href=#html-elements id=content-models:html-elements-2>HTML elements</a> anywhere except where they are explicitly
- allowed, as defined for each element, or as explicitly required by other specifications. For XML
- compound documents, these contexts could be inside elements from other namespaces, if those
- elements are defined as providing the relevant contexts.</p>
- <div class=example>
- <p>For example, the Atom specification defines a <code>content</code> element. When its
- <code>type</code> attribute has the value <code>xhtml</code>, the Atom
- specification requires that it contain a single HTML <code id=content-models:the-div-element><a href=#the-div-element>div</a></code> element. Thus, a
- <code id=content-models:the-div-element-2><a href=#the-div-element>div</a></code> element is allowed in that context, even though this is not explicitly
- normatively stated by this specification. <a href=#refsATOM>[ATOM]</a></p>
- </div>
- <p>In addition, <a href=#html-elements id=content-models:html-elements-3>HTML elements</a> may be orphan nodes (i.e. without a parent node).</p>
- <div class=example>
- <p>For example, creating a <code id=content-models:the-td-element><a href=#the-td-element>td</a></code> element and storing it in a global variable in a
- script is conforming, even though <code id=content-models:the-td-element-2><a href=#the-td-element>td</a></code> elements are otherwise only supposed to be used
- inside <code id=content-models:the-tr-element><a href=#the-tr-element>tr</a></code> elements.</p>
- <pre>var data = {
- name: "Banana",
- cell: document.createElement('td'),
- };</pre>
- </div>
- <h5 id=the-nothing-content-model>3.2.4.1 The "nothing" content model</h5>
- <p>When an element's content model is <dfn id=concept-content-nothing>nothing</dfn>, the
- element must contain no <code id=the-nothing-content-model:text><a href=#text>Text</a></code> nodes (other than <a href=#inter-element-whitespace id=the-nothing-content-model:inter-element-whitespace>inter-element whitespace</a>)
- and no element nodes.</p>
- <p class=note>Most HTML elements whose content model is "nothing" are also, for convenience,
- <a href=#void-elements id=the-nothing-content-model:void-elements>void elements</a> (elements that have no <a href=#syntax-end-tag id=the-nothing-content-model:syntax-end-tag>end tag</a> in
- the <a href=#syntax>HTML syntax</a>). However, these are entirely separate concepts.</p>
- <h5 id=kinds-of-content>3.2.4.2 Kinds of content</h5>
- <p>Each element in HTML falls into zero or more <dfn id=content-categories>categories</dfn>
- that group elements with similar characteristics together. The following broad categories are used
- in this specification:</p>
- <ul class=brief><li><a href=#metadata-content-2 id=kinds-of-content:metadata-content-2>Metadata content</a><li><a href=#flow-content-2 id=kinds-of-content:flow-content-2>Flow content</a><li><a href=#sectioning-content-2 id=kinds-of-content:sectioning-content-2>Sectioning content</a><li><a href=#heading-content-2 id=kinds-of-content:heading-content-2>Heading content</a><li><a href=#phrasing-content-2 id=kinds-of-content:phrasing-content-2>Phrasing content</a><li><a href=#embedded-content-category id=kinds-of-content:embedded-content-category>Embedded content</a><li><a href=#interactive-content-2 id=kinds-of-content:interactive-content-2>Interactive content</a></ul>
- <p class=note>Some elements also fall into other categories, which are defined in other parts of
- this specification.</p>
- <p>These categories are related as follows:</p>
-
- <p><object width=1000 height=288 data=images/content-venn.svg><img width=512 src=http://images.whatwg.org/content-venn.png height=288 alt=""></object></p>
- <p>Sectioning content, heading content, phrasing content, embedded content, and interactive
- content are all types of flow content. Metadata is sometimes flow content. Metadata and
- interactive content are sometimes phrasing content. Embedded content is also a type of phrasing
- content, and sometimes is interactive content.</p>
- <p>Other categories are also used for specific purposes, e.g. form controls are specified using a
- number of categories to define common requirements. Some elements have unique requirements and do
- not fit into any particular category.</p>
- <h6 id=metadata-content>3.2.4.2.1 Metadata content</h6>
- <p><dfn id=metadata-content-2>Metadata content</dfn> is content that sets up the presentation or behavior of the rest of
- the content, or that sets up the relationship of the document with other documents, or that
- conveys other "out of band" information.</p>
-
- <ul class="brief category-list"><li><code id=metadata-content:the-base-element><a href=#the-base-element>base</a></code><li><code id=metadata-content:the-link-element><a href=#the-link-element>link</a></code><li><code id=metadata-content:the-meta-element><a href=#the-meta-element>meta</a></code><li><code id=metadata-content:the-noscript-element><a href=#the-noscript-element>noscript</a></code><li><code id=metadata-content:the-script-element><a href=#the-script-element>script</a></code><li><code id=metadata-content:the-style-element><a href=#the-style-element>style</a></code><li><code id=metadata-content:the-template-element><a href=#the-template-element>template</a></code><li><code id=metadata-content:the-title-element><a href=#the-title-element>title</a></code></ul>
- <p>Elements from other namespaces whose semantics are primarily metadata-related (e.g. RDF) are
- also <a href=#metadata-content-2 id=metadata-content:metadata-content-2>metadata content</a>.</p>
- <div class=example>
- <p>Thus, in the XML serialisation, one can use RDF, like this:</p>
- <pre><html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:r="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
- <head>
- <title>Hedral's Home Page</title>
- <r:RDF>
- <Person xmlns="http://www.w3.org/2000/10/swap/pim/contact#"
- r:about="http://hedral.example.com/#">
- <fullName>Cat Hedral</fullName>
- <mailbox r:resource="mailto:hedral@damowmow.com"/>
- <personalTitle>Sir</personalTitle>
- </Person>
- </r:RDF>
- </head>
- <body>
- <h1>My home page</h1>
- <p>I like playing with string, I guess. Sister says squirrels are fun
- too so sometimes I follow her to play with them.</p>
- </body>
- </html></pre>
- <p>This isn't possible in the HTML serialisation, however.</p>
- </div>
- <h6 id=flow-content>3.2.4.2.2 Flow content</h6>
- <p>Most elements that are used in the body of documents and applications are categorised as
- <dfn id=flow-content-2>flow content</dfn>.</p>
-
- <ul class="brief category-list"><li><code id=flow-content:the-a-element><a href=#the-a-element>a</a></code><li><code id=flow-content:the-abbr-element><a href=#the-abbr-element>abbr</a></code><li><code id=flow-content:the-address-element><a href=#the-address-element>address</a></code><li><code id=flow-content:the-area-element><a href=#the-area-element>area</a></code> (if it is a descendant of a <code id=flow-content:the-map-element><a href=#the-map-element>map</a></code> element)<li><code id=flow-content:the-article-element><a href=#the-article-element>article</a></code><li><code id=flow-content:the-aside-element><a href=#the-aside-element>aside</a></code><li><code id=flow-content:the-audio-element><a href=#the-audio-element>audio</a></code><li><code id=flow-content:the-b-element><a href=#the-b-element>b</a></code><li><code id=flow-content:the-bdi-element><a href=#the-bdi-element>bdi</a></code><li><code id=flow-content:the-bdo-element><a href=#the-bdo-element>bdo</a></code><li><code id=flow-content:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code><li><code id=flow-content:the-br-element><a href=#the-br-element>br</a></code><li><code id=flow-content:the-button-element><a href=#the-button-element>button</a></code><li><code id=flow-content:the-canvas-element><a href=#the-canvas-element>canvas</a></code><li><code id=flow-content:the-cite-element><a href=#the-cite-element>cite</a></code><li><code id=flow-content:the-code-element><a href=#the-code-element>code</a></code><li><code id=flow-content:the-data-element><a href=#the-data-element>data</a></code><li><code id=flow-content:the-datalist-element><a href=#the-datalist-element>datalist</a></code><li><code id=flow-content:the-del-element><a href=#the-del-element>del</a></code><li><code id=flow-content:the-details-element><a href=#the-details-element>details</a></code><li><code id=flow-content:the-dfn-element><a href=#the-dfn-element>dfn</a></code><li><code id=flow-content:the-dialog-element><a href=#the-dialog-element>dialog</a></code><li><code id=flow-content:the-div-element><a href=#the-div-element>div</a></code><li><code id=flow-content:the-dl-element><a href=#the-dl-element>dl</a></code><li><code id=flow-content:the-em-element><a href=#the-em-element>em</a></code><li><code id=flow-content:the-embed-element><a href=#the-embed-element>embed</a></code><li><code id=flow-content:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code><li><code id=flow-content:the-figure-element><a href=#the-figure-element>figure</a></code><li><code id=flow-content:the-footer-element><a href=#the-footer-element>footer</a></code><li><code id=flow-content:the-form-element><a href=#the-form-element>form</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code><li><code id=flow-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code><li><code id=flow-content:the-header-element><a href=#the-header-element>header</a></code><li><code id=flow-content:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code><li><code id=flow-content:the-hr-element><a href=#the-hr-element>hr</a></code><li><code id=flow-content:the-i-element><a href=#the-i-element>i</a></code><li><code id=flow-content:the-iframe-element><a href=#the-iframe-element>iframe</a></code><li><code id=flow-content:the-img-element><a href=#the-img-element>img</a></code><li><code id=flow-content:the-input-element><a href=#the-input-element>input</a></code><li><code id=flow-content:the-ins-element><a href=#the-ins-element>ins</a></code><li><code id=flow-content:the-kbd-element><a href=#the-kbd-element>kbd</a></code><li><code id=flow-content:the-keygen-element><a href=#the-keygen-element>keygen</a></code><li><code id=flow-content:the-label-element><a href=#the-label-element>label</a></code><li><code id=flow-content:the-link-element><a href=#the-link-element>link</a></code> (if the <code id=flow-content:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)<li><code id=flow-content:the-main-element><a href=#the-main-element>main</a></code><li><code id=flow-content:the-map-element-2><a href=#the-map-element>map</a></code><li><code id=flow-content:the-mark-element><a href=#the-mark-element>mark</a></code><li><code id=flow-content:math><a href=#math>math</a></code><li><code id=flow-content:the-menu-element><a href=#the-menu-element>menu</a></code><li><code id=flow-content:the-meta-element><a href=#the-meta-element>meta</a></code> (if the <code id=flow-content:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)<li><code id=flow-content:the-meter-element><a href=#the-meter-element>meter</a></code><li><code id=flow-content:the-nav-element><a href=#the-nav-element>nav</a></code><li><code id=flow-content:the-noscript-element><a href=#the-noscript-element>noscript</a></code><li><code id=flow-content:the-object-element><a href=#the-object-element>object</a></code><li><code id=flow-content:the-ol-element><a href=#the-ol-element>ol</a></code><li><code id=flow-content:the-output-element><a href=#the-output-element>output</a></code><li><code id=flow-content:the-p-element><a href=#the-p-element>p</a></code><li><code id=flow-content:the-pre-element><a href=#the-pre-element>pre</a></code><li><code id=flow-content:the-progress-element><a href=#the-progress-element>progress</a></code><li><code id=flow-content:the-q-element><a href=#the-q-element>q</a></code><li><code id=flow-content:the-ruby-element><a href=#the-ruby-element>ruby</a></code><li><code id=flow-content:the-s-element><a href=#the-s-element>s</a></code><li><code id=flow-content:the-samp-element><a href=#the-samp-element>samp</a></code><li><code id=flow-content:the-script-element><a href=#the-script-element>script</a></code><li><code id=flow-content:the-section-element><a href=#the-section-element>section</a></code><li><code id=flow-content:the-select-element><a href=#the-select-element>select</a></code><li><code id=flow-content:the-small-element><a href=#the-small-element>small</a></code><li><code id=flow-content:the-span-element><a href=#the-span-element>span</a></code><li><code id=flow-content:the-strong-element><a href=#the-strong-element>strong</a></code><li><code id=flow-content:the-style-element><a href=#the-style-element>style</a></code> (if the <code id=flow-content:attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)<li><code id=flow-content:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code><li><code id=flow-content:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code><li><code id=flow-content:svg-2><a href=#svg-2>svg</a></code><li><code id=flow-content:the-table-element><a href=#the-table-element>table</a></code><li><code id=flow-content:the-template-element><a href=#the-template-element>template</a></code><li><code id=flow-content:the-textarea-element><a href=#the-textarea-element>textarea</a></code><li><code id=flow-content:the-time-element><a href=#the-time-element>time</a></code><li><code id=flow-content:the-u-element><a href=#the-u-element>u</a></code><li><code id=flow-content:the-ul-element><a href=#the-ul-element>ul</a></code><li><code id=flow-content:the-var-element><a href=#the-var-element>var</a></code><li><code id=flow-content:the-video-element><a href=#the-video-element>video</a></code><li><code id=flow-content:the-wbr-element><a href=#the-wbr-element>wbr</a></code><li><a href=#text-content id=flow-content:text-content>Text</a></ul>
- <h6 id=sectioning-content>3.2.4.2.3 Sectioning content</h6>
- <p><dfn id=sectioning-content-2>Sectioning content</dfn> is content that defines the scope of <a href=#heading-content-2 id=sectioning-content:heading-content-2>headings</a> and <a href=#the-footer-element id=sectioning-content:the-footer-element>footers</a>.</p>
-
- <ul class="brief category-list"><li><code id=sectioning-content:the-article-element><a href=#the-article-element>article</a></code><li><code id=sectioning-content:the-aside-element><a href=#the-aside-element>aside</a></code><li><code id=sectioning-content:the-nav-element><a href=#the-nav-element>nav</a></code><li><code id=sectioning-content:the-section-element><a href=#the-section-element>section</a></code></ul>
- <p>Each <a href=#sectioning-content-2 id=sectioning-content:sectioning-content-2>sectioning content</a> element potentially has a heading and an
- <a href=#outline id=sectioning-content:outline>outline</a>. See the section on <a href=#headings-and-sections id=sectioning-content:headings-and-sections>headings and sections</a> for further
- details.</p>
- <p class=note>There are also certain elements that are <a href=#sectioning-root id=sectioning-content:sectioning-root>sectioning
- roots</a>. These are distinct from <a href=#sectioning-content-2 id=sectioning-content:sectioning-content-2-2>sectioning content</a>, but they can also have an
- <a href=#outline id=sectioning-content:outline-2>outline</a>.</p>
- <h6 id=heading-content>3.2.4.2.4 Heading content</h6>
- <p><dfn id=heading-content-2>Heading content</dfn> defines the header of a section (whether explicitly marked up using
- <a href=#sectioning-content-2 id=heading-content:sectioning-content-2>sectioning content</a> elements, or implied by the heading content itself).</p>
-
- <ul class="brief category-list"><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code><li><code id=heading-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code><li><code id=heading-content:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code></ul>
- <h6 id=phrasing-content>3.2.4.2.5 Phrasing content</h6>
- <p><dfn id=phrasing-content-2>Phrasing content</dfn> is the text of the document, as well as elements that mark up that
- text at the intra-paragraph level. Runs of <a href=#phrasing-content-2 id=phrasing-content:phrasing-content-2>phrasing content</a> form <a href=#paragraph id=phrasing-content:paragraph>paragraphs</a>.</p>
-
- <ul class="brief category-list"><li><code id=phrasing-content:the-a-element><a href=#the-a-element>a</a></code><li><code id=phrasing-content:the-abbr-element><a href=#the-abbr-element>abbr</a></code><li><code id=phrasing-content:the-area-element><a href=#the-area-element>area</a></code> (if it is a descendant of a <code id=phrasing-content:the-map-element><a href=#the-map-element>map</a></code> element)<li><code id=phrasing-content:the-audio-element><a href=#the-audio-element>audio</a></code><li><code id=phrasing-content:the-b-element><a href=#the-b-element>b</a></code><li><code id=phrasing-content:the-bdi-element><a href=#the-bdi-element>bdi</a></code><li><code id=phrasing-content:the-bdo-element><a href=#the-bdo-element>bdo</a></code><li><code id=phrasing-content:the-br-element><a href=#the-br-element>br</a></code><li><code id=phrasing-content:the-button-element><a href=#the-button-element>button</a></code><li><code id=phrasing-content:the-canvas-element><a href=#the-canvas-element>canvas</a></code><li><code id=phrasing-content:the-cite-element><a href=#the-cite-element>cite</a></code><li><code id=phrasing-content:the-code-element><a href=#the-code-element>code</a></code><li><code id=phrasing-content:the-data-element><a href=#the-data-element>data</a></code><li><code id=phrasing-content:the-datalist-element><a href=#the-datalist-element>datalist</a></code><li><code id=phrasing-content:the-del-element><a href=#the-del-element>del</a></code><li><code id=phrasing-content:the-dfn-element><a href=#the-dfn-element>dfn</a></code><li><code id=phrasing-content:the-em-element><a href=#the-em-element>em</a></code><li><code id=phrasing-content:the-embed-element><a href=#the-embed-element>embed</a></code><li><code id=phrasing-content:the-i-element><a href=#the-i-element>i</a></code><li><code id=phrasing-content:the-iframe-element><a href=#the-iframe-element>iframe</a></code><li><code id=phrasing-content:the-img-element><a href=#the-img-element>img</a></code><li><code id=phrasing-content:the-input-element><a href=#the-input-element>input</a></code><li><code id=phrasing-content:the-ins-element><a href=#the-ins-element>ins</a></code><li><code id=phrasing-content:the-kbd-element><a href=#the-kbd-element>kbd</a></code><li><code id=phrasing-content:the-keygen-element><a href=#the-keygen-element>keygen</a></code><li><code id=phrasing-content:the-label-element><a href=#the-label-element>label</a></code><li><code id=phrasing-content:the-link-element><a href=#the-link-element>link</a></code> (if the <code id=phrasing-content:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)<li><code id=phrasing-content:the-map-element-2><a href=#the-map-element>map</a></code><li><code id=phrasing-content:the-mark-element><a href=#the-mark-element>mark</a></code><li><code id=phrasing-content:math><a href=#math>math</a></code><li><code id=phrasing-content:the-meta-element><a href=#the-meta-element>meta</a></code> (if the <code id=phrasing-content:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)<li><code id=phrasing-content:the-meter-element><a href=#the-meter-element>meter</a></code><li><code id=phrasing-content:the-noscript-element><a href=#the-noscript-element>noscript</a></code><li><code id=phrasing-content:the-object-element><a href=#the-object-element>object</a></code><li><code id=phrasing-content:the-output-element><a href=#the-output-element>output</a></code><li><code id=phrasing-content:the-progress-element><a href=#the-progress-element>progress</a></code><li><code id=phrasing-content:the-q-element><a href=#the-q-element>q</a></code><li><code id=phrasing-content:the-ruby-element><a href=#the-ruby-element>ruby</a></code><li><code id=phrasing-content:the-s-element><a href=#the-s-element>s</a></code><li><code id=phrasing-content:the-samp-element><a href=#the-samp-element>samp</a></code><li><code id=phrasing-content:the-script-element><a href=#the-script-element>script</a></code><li><code id=phrasing-content:the-select-element><a href=#the-select-element>select</a></code><li><code id=phrasing-content:the-small-element><a href=#the-small-element>small</a></code><li><code id=phrasing-content:the-span-element><a href=#the-span-element>span</a></code><li><code id=phrasing-content:the-strong-element><a href=#the-strong-element>strong</a></code><li><code id=phrasing-content:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code><li><code id=phrasing-content:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code><li><code id=phrasing-content:svg-2><a href=#svg-2>svg</a></code><li><code id=phrasing-content:the-template-element><a href=#the-template-element>template</a></code><li><code id=phrasing-content:the-textarea-element><a href=#the-textarea-element>textarea</a></code><li><code id=phrasing-content:the-time-element><a href=#the-time-element>time</a></code><li><code id=phrasing-content:the-u-element><a href=#the-u-element>u</a></code><li><code id=phrasing-content:the-var-element><a href=#the-var-element>var</a></code><li><code id=phrasing-content:the-video-element><a href=#the-video-element>video</a></code><li><code id=phrasing-content:the-wbr-element><a href=#the-wbr-element>wbr</a></code><li><a href=#text-content id=phrasing-content:text-content>Text</a></ul>
- <p class=note>Most elements that are categorised as phrasing content can only contain elements
- that are themselves categorised as phrasing content, not any flow content.</p>
- <p><dfn id=text-content>Text</dfn>, in the context of content models, means either nothing,
- or <code id=phrasing-content:text><a href=#text>Text</a></code> nodes. <a href=#text-content id=phrasing-content:text-content-2>Text</a> is sometimes used as a content
- model on its own, but is also <a href=#phrasing-content-2 id=phrasing-content:phrasing-content-2-2>phrasing content</a>, and can be <a href=#inter-element-whitespace id=phrasing-content:inter-element-whitespace>inter-element
- whitespace</a> (if the <code id=phrasing-content:text-2><a href=#text>Text</a></code> nodes are empty or contain just <a href=#space-character id=phrasing-content:space-character>space characters</a>).</p>
- <p><code id=phrasing-content:text-3><a href=#text>Text</a></code> nodes and attribute values must consist of <a href=#unicode-character id=phrasing-content:unicode-character>Unicode characters</a>, must not contain U+0000 characters, must not contain
- permanently undefined Unicode characters (noncharacters), and must not contain <a href=#control-characters id=phrasing-content:control-characters>control characters</a>
- other than <a href=#space-character id=phrasing-content:space-character-2>space characters</a>.
-
-
- This specification includes extra constraints on the exact value of <code id=phrasing-content:text-4><a href=#text>Text</a></code> nodes and
- attribute values depending on their precise context.
-
- </p>
- <h6 id=embedded-content-2>3.2.4.2.6 Embedded content</h6>
- <p><dfn id=embedded-content-category>Embedded content</dfn> is content that imports another
- resource into the document, or content from another vocabulary that
- is inserted into the document.</p>
-
- <ul class="brief category-list"><li><code id=embedded-content-2:the-audio-element><a href=#the-audio-element>audio</a></code><li><code id=embedded-content-2:the-canvas-element><a href=#the-canvas-element>canvas</a></code><li><code id=embedded-content-2:the-embed-element><a href=#the-embed-element>embed</a></code><li><code id=embedded-content-2:the-iframe-element><a href=#the-iframe-element>iframe</a></code><li><code id=embedded-content-2:the-img-element><a href=#the-img-element>img</a></code><li><code id=embedded-content-2:math><a href=#math>math</a></code><li><code id=embedded-content-2:the-object-element><a href=#the-object-element>object</a></code><li><code id=embedded-content-2:svg-2><a href=#svg-2>svg</a></code><li><code id=embedded-content-2:the-video-element><a href=#the-video-element>video</a></code></ul>
- <p>Elements that are from namespaces other than the <a href=#html-namespace-2 id=embedded-content-2:html-namespace-2>HTML namespace</a> and that convey
- content but not metadata, are <a href=#embedded-content-category id=embedded-content-2:embedded-content-category>embedded content</a> for the purposes of the content models
- defined in this specification. (For example, MathML, or SVG.)</p>
- <p>Some embedded content elements can have <dfn id=fallback-content>fallback content</dfn>: content that is to be used
- when the external resource cannot be used (e.g. because it is of an unsupported format). The
- element definitions state what the fallback is, if any.</p>
-
- <h6 id=interactive-content>3.2.4.2.7 Interactive content</h6>
- <p><dfn id=interactive-content-2>Interactive content</dfn> is content that is specifically intended for user
- interaction.</p>
-
- <ul class="brief category-list"><li><code id=interactive-content:the-a-element><a href=#the-a-element>a</a></code><li><code id=interactive-content:the-audio-element><a href=#the-audio-element>audio</a></code> (if the <code id=interactive-content:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)<li><code id=interactive-content:the-button-element><a href=#the-button-element>button</a></code><li><code id=interactive-content:the-details-element><a href=#the-details-element>details</a></code><li><code id=interactive-content:the-embed-element><a href=#the-embed-element>embed</a></code><li><code id=interactive-content:the-iframe-element><a href=#the-iframe-element>iframe</a></code><li><code id=interactive-content:the-img-element><a href=#the-img-element>img</a></code> (if the <code id=interactive-content:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<li><code id=interactive-content:the-input-element><a href=#the-input-element>input</a></code> (if the <code id=interactive-content:attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="interactive-content:hidden-state-(type=hidden)">Hidden</a> state)<li><code id=interactive-content:the-keygen-element><a href=#the-keygen-element>keygen</a></code><li><code id=interactive-content:the-label-element><a href=#the-label-element>label</a></code><li><code id=interactive-content:the-object-element><a href=#the-object-element>object</a></code> (if the <code id=interactive-content:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present)<li><code id=interactive-content:the-select-element><a href=#the-select-element>select</a></code><li><code id=interactive-content:the-textarea-element><a href=#the-textarea-element>textarea</a></code><li><a href=#sorting-interface-th-element id=interactive-content:sorting-interface-th-element>sorting interface <code>th</code> elements</a><li><code id=interactive-content:the-video-element><a href=#the-video-element>video</a></code> (if the <code id=interactive-content:attr-media-controls-2><a href=#attr-media-controls>controls</a></code> attribute is present)</ul>
- <p>The <code id=interactive-content:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute can also make any element into
- <a href=#interactive-content-2 id=interactive-content:interactive-content-2>interactive content</a>.</p>
- <h6 id=palpable-content>3.2.4.2.8 Palpable content</h6>
- <p>As a general rule, elements whose content model allows any <a href=#flow-content-2 id=palpable-content:flow-content-2>flow content</a> or
- <a href=#phrasing-content-2 id=palpable-content:phrasing-content-2>phrasing content</a> should have at least one node in its <a href=#concept-html-contents id=palpable-content:concept-html-contents>contents</a> that is <dfn id=palpable-content-2>palpable content</dfn> and that does
- not have the <code id=palpable-content:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute specified.</p>
- <p>This requirement is not a hard requirement, however, as there are many cases where an element
- can be empty legitimately, for example when it is used as a placeholder which will later be filled
- in by a script, or when the element is part of a template and would on most pages be filled in but
- on some pages is not relevant.</p>
- <p>Conformance checkers are encouraged to provide a mechanism for authors to find elements that
- fail to fulfill this requirement, as an authoring aid.</p>
- <p>The following elements are palpable content:</p>
-
- <ul class="brief category-list"><li><code id=palpable-content:the-a-element><a href=#the-a-element>a</a></code><li><code id=palpable-content:the-abbr-element><a href=#the-abbr-element>abbr</a></code><li><code id=palpable-content:the-address-element><a href=#the-address-element>address</a></code><li><code id=palpable-content:the-article-element><a href=#the-article-element>article</a></code><li><code id=palpable-content:the-aside-element><a href=#the-aside-element>aside</a></code><li><code id=palpable-content:the-audio-element><a href=#the-audio-element>audio</a></code> (if the <code id=palpable-content:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present)<li><code id=palpable-content:the-b-element><a href=#the-b-element>b</a></code><li><code id=palpable-content:the-bdi-element><a href=#the-bdi-element>bdi</a></code><li><code id=palpable-content:the-bdo-element><a href=#the-bdo-element>bdo</a></code><li><code id=palpable-content:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code><li><code id=palpable-content:the-button-element><a href=#the-button-element>button</a></code><li><code id=palpable-content:the-canvas-element><a href=#the-canvas-element>canvas</a></code><li><code id=palpable-content:the-cite-element><a href=#the-cite-element>cite</a></code><li><code id=palpable-content:the-code-element><a href=#the-code-element>code</a></code><li><code id=palpable-content:the-data-element><a href=#the-data-element>data</a></code><li><code id=palpable-content:the-details-element><a href=#the-details-element>details</a></code><li><code id=palpable-content:the-dfn-element><a href=#the-dfn-element>dfn</a></code><li><code id=palpable-content:the-div-element><a href=#the-div-element>div</a></code><li><code id=palpable-content:the-dl-element><a href=#the-dl-element>dl</a></code> (if the element's children include at least one name-value group)<li><code id=palpable-content:the-em-element><a href=#the-em-element>em</a></code><li><code id=palpable-content:the-embed-element><a href=#the-embed-element>embed</a></code><li><code id=palpable-content:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code><li><code id=palpable-content:the-figure-element><a href=#the-figure-element>figure</a></code><li><code id=palpable-content:the-footer-element><a href=#the-footer-element>footer</a></code><li><code id=palpable-content:the-form-element><a href=#the-form-element>form</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code><li><code id=palpable-content:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code><li><code id=palpable-content:the-header-element><a href=#the-header-element>header</a></code><li><code id=palpable-content:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code><li><code id=palpable-content:the-i-element><a href=#the-i-element>i</a></code><li><code id=palpable-content:the-iframe-element><a href=#the-iframe-element>iframe</a></code><li><code id=palpable-content:the-img-element><a href=#the-img-element>img</a></code><li><code id=palpable-content:the-input-element><a href=#the-input-element>input</a></code> (if the <code id=palpable-content:attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="palpable-content:hidden-state-(type=hidden)">Hidden</a> state)<li><code id=palpable-content:the-ins-element><a href=#the-ins-element>ins</a></code><li><code id=palpable-content:the-kbd-element><a href=#the-kbd-element>kbd</a></code><li><code id=palpable-content:the-keygen-element><a href=#the-keygen-element>keygen</a></code><li><code id=palpable-content:the-label-element><a href=#the-label-element>label</a></code><li><code id=palpable-content:the-main-element><a href=#the-main-element>main</a></code><li><code id=palpable-content:the-map-element><a href=#the-map-element>map</a></code><li><code id=palpable-content:the-mark-element><a href=#the-mark-element>mark</a></code><li><code id=palpable-content:math><a href=#math>math</a></code><li><code id=palpable-content:the-menu-element><a href=#the-menu-element>menu</a></code> (if the <code id=palpable-content:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state id=palpable-content:toolbar-state>toolbar</a> state)<li><code id=palpable-content:the-meter-element><a href=#the-meter-element>meter</a></code><li><code id=palpable-content:the-nav-element><a href=#the-nav-element>nav</a></code><li><code id=palpable-content:the-object-element><a href=#the-object-element>object</a></code><li><code id=palpable-content:the-ol-element><a href=#the-ol-element>ol</a></code> (if the element's children include at least one <code id=palpable-content:the-li-element><a href=#the-li-element>li</a></code> element)<li><code id=palpable-content:the-output-element><a href=#the-output-element>output</a></code><li><code id=palpable-content:the-p-element><a href=#the-p-element>p</a></code><li><code id=palpable-content:the-pre-element><a href=#the-pre-element>pre</a></code><li><code id=palpable-content:the-progress-element><a href=#the-progress-element>progress</a></code><li><code id=palpable-content:the-q-element><a href=#the-q-element>q</a></code><li><code id=palpable-content:the-ruby-element><a href=#the-ruby-element>ruby</a></code><li><code id=palpable-content:the-s-element><a href=#the-s-element>s</a></code><li><code id=palpable-content:the-samp-element><a href=#the-samp-element>samp</a></code><li><code id=palpable-content:the-section-element><a href=#the-section-element>section</a></code><li><code id=palpable-content:the-select-element><a href=#the-select-element>select</a></code><li><code id=palpable-content:the-small-element><a href=#the-small-element>small</a></code><li><code id=palpable-content:the-span-element><a href=#the-span-element>span</a></code><li><code id=palpable-content:the-strong-element><a href=#the-strong-element>strong</a></code><li><code id=palpable-content:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code><li><code id=palpable-content:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code><li><code id=palpable-content:svg-2><a href=#svg-2>svg</a></code><li><code id=palpable-content:the-table-element><a href=#the-table-element>table</a></code><li><code id=palpable-content:the-textarea-element><a href=#the-textarea-element>textarea</a></code><li><code id=palpable-content:the-time-element><a href=#the-time-element>time</a></code><li><code id=palpable-content:the-u-element><a href=#the-u-element>u</a></code><li><code id=palpable-content:the-ul-element><a href=#the-ul-element>ul</a></code> (if the element's children include at least one <code id=palpable-content:the-li-element-2><a href=#the-li-element>li</a></code> element)<li><code id=palpable-content:the-var-element><a href=#the-var-element>var</a></code><li><code id=palpable-content:the-video-element><a href=#the-video-element>video</a></code><li><a href=#text-content id=palpable-content:text-content>Text</a> that is not <a href=#inter-element-whitespace id=palpable-content:inter-element-whitespace>inter-element whitespace</a></ul>
- <h6 id=script-supporting-elements>3.2.4.2.9 Script-supporting elements</h6>
- <p><dfn id=script-supporting-elements-2>Script-supporting elements</dfn> are those that do not <a href=#represents id=script-supporting-elements:represents>represent</a> anything themselves (i.e. they are not rendered), but are
- used to support scripts, e.g. to provide functionality for the user.</p>
- <p>The following elements are script-supporting elements:</p>
-
- <ul class="brief category-list"><li><code id=script-supporting-elements:the-script-element><a href=#the-script-element>script</a></code><li><code id=script-supporting-elements:the-template-element><a href=#the-template-element>template</a></code></ul>
- <h5 id=transparent-content-models>3.2.4.3 Transparent content models</h5>
- <p>Some elements are described as <dfn id=transparent>transparent</dfn>; they have "transparent" in the
- description of their content model. The content model of a <a href=#transparent id=transparent-content-models:transparent>transparent</a> element is
- derived from the content model of its parent element: the elements required in the part of the
- content model that is "transparent" are the same elements as required in the part of the content
- model of the parent of the transparent element in which the transparent element finds itself.</p>
- <div class=example>
- <p>For instance, an <code id=transparent-content-models:the-ins-element><a href=#the-ins-element>ins</a></code> element inside a <code id=transparent-content-models:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element cannot contain an
- <code id=transparent-content-models:the-rt-element><a href=#the-rt-element>rt</a></code> element, because the part of the <code id=transparent-content-models:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code> element's content model that
- allows <code id=transparent-content-models:the-ins-element-2><a href=#the-ins-element>ins</a></code> elements is the part that allows <a href=#phrasing-content-2 id=transparent-content-models:phrasing-content-2>phrasing content</a>, and the
- <code id=transparent-content-models:the-rt-element-2><a href=#the-rt-element>rt</a></code> element is not <a href=#phrasing-content-2 id=transparent-content-models:phrasing-content-2-2>phrasing content</a>.</p>
- </div>
- <p class=note>In some cases, where transparent elements are nested in each other, the process
- has to be applied iteratively.</p>
- <div class=example>
- <p>Consider the following markup fragment:</p>
- <pre><p><object><param><ins><map><a href="/">Apples</a></map></ins></object></p></pre>
- <p>To check whether "Apples" is allowed inside the <code id=transparent-content-models:the-a-element><a href=#the-a-element>a</a></code> element, the content models are
- examined. The <code id=transparent-content-models:the-a-element-2><a href=#the-a-element>a</a></code> element's content model is transparent, as is the <code id=transparent-content-models:the-map-element><a href=#the-map-element>map</a></code>
- element's, as is the <code id=transparent-content-models:the-ins-element-3><a href=#the-ins-element>ins</a></code> element's, as is the part of the <code id=transparent-content-models:the-object-element><a href=#the-object-element>object</a></code>
- element's in which the <code id=transparent-content-models:the-ins-element-4><a href=#the-ins-element>ins</a></code> element is found. The <code id=transparent-content-models:the-object-element-2><a href=#the-object-element>object</a></code> element is
- found in the <code id=transparent-content-models:the-p-element><a href=#the-p-element>p</a></code> element, whose content model is <a href=#phrasing-content-2 id=transparent-content-models:phrasing-content-2-3>phrasing content</a>. Thus,
- "Apples" is allowed, as text is phrasing content.</p>
- </div>
- <p>When a transparent element has no parent, then the part of its content model that is
- "transparent" must instead be treated as accepting any <a href=#flow-content-2 id=transparent-content-models:flow-content-2>flow content</a>.</p>
- <h5 id=paragraphs>3.2.4.4 Paragraphs</h5>
- <p class=note>The term <a href=#paragraph id=paragraphs:paragraph>paragraph</a> as defined in this section is used for more than
- just the definition of the <code id=paragraphs:the-p-element><a href=#the-p-element>p</a></code> element. The <a href=#paragraph id=paragraphs:paragraph-2>paragraph</a> concept defined here
- is used to describe how to interpret documents. The <code id=paragraphs:the-p-element-2><a href=#the-p-element>p</a></code> element is merely one of
- several ways of marking up a <a href=#paragraph id=paragraphs:paragraph-3>paragraph</a>.</p>
-
- <p>A <dfn id=paragraph>paragraph</dfn> is typically a run of <a href=#phrasing-content-2 id=paragraphs:phrasing-content-2>phrasing content</a> that forms a block
- of text with one or more sentences that discuss a particular topic, as in typography, but can also
- be used for more general thematic grouping. For instance, an address is also a paragraph, as is a
- part of a form, a byline, or a stanza in a poem.</p>
- <div class=example>
- <p>In the following example, there are two paragraphs in a section. There is also a heading,
- which contains phrasing content that is not a paragraph. Note how the comments and
- <a href=#inter-element-whitespace id=paragraphs:inter-element-whitespace>inter-element whitespace</a> do not form paragraphs.</p>
- <pre><section>
- <h1>Example of paragraphs</h1>
- This is the <em>first</em> paragraph in this example.
- <p>This is the second.</p>
- <!-- This is not a paragraph. -->
- </section></pre>
- </div>
- <p>Paragraphs in <a href=#flow-content-2 id=paragraphs:flow-content-2>flow content</a> are defined relative to what the document looks like
- without the <code id=paragraphs:the-a-element><a href=#the-a-element>a</a></code>, <code id=paragraphs:the-ins-element><a href=#the-ins-element>ins</a></code>, <code id=paragraphs:the-del-element><a href=#the-del-element>del</a></code>, and <code id=paragraphs:the-map-element><a href=#the-map-element>map</a></code> elements
- complicating matters, since those elements, with their hybrid content models, can straddle
- paragraph boundaries, as shown in the first two examples below.</p>
- <p class=note>Generally, having elements straddle paragraph boundaries is best avoided.
- Maintaining such markup can be difficult.</p>
- <div class=example>
- <p>The following example takes the markup from the earlier example and puts <code id=paragraphs:the-ins-element-2><a href=#the-ins-element>ins</a></code> and
- <code id=paragraphs:the-del-element-2><a href=#the-del-element>del</a></code> elements around some of the markup to show that the text was changed (though in
- this case, the changes admittedly don't make much sense). Notice how this example has exactly the
- same paragraphs as the previous one, despite the <code id=paragraphs:the-ins-element-3><a href=#the-ins-element>ins</a></code> and <code id=paragraphs:the-del-element-3><a href=#the-del-element>del</a></code> elements
- — the <code id=paragraphs:the-ins-element-4><a href=#the-ins-element>ins</a></code> element straddles the heading and the first paragraph, and the
- <code id=paragraphs:the-del-element-4><a href=#the-del-element>del</a></code> element straddles the boundary between the two paragraphs.</p>
- <pre><section>
- <ins><h1>Example of paragraphs</h1>
- This is the <em>first</em> paragraph in</ins> this example<del>.
- <p>This is the second.</p></del>
- <!-- This is not a paragraph. -->
- </section></pre>
- </div>
-
- <p>Let <var>view</var> be a view of the DOM that replaces all <code id=paragraphs:the-a-element-2><a href=#the-a-element>a</a></code>,
- <code id=paragraphs:the-ins-element-5><a href=#the-ins-element>ins</a></code>, <code id=paragraphs:the-del-element-5><a href=#the-del-element>del</a></code>, and <code id=paragraphs:the-map-element-2><a href=#the-map-element>map</a></code> elements in the document with their <a href=#concept-html-contents id=paragraphs:concept-html-contents>contents</a>. Then, in <var>view</var>, for each run
- of sibling <a href=#phrasing-content-2 id=paragraphs:phrasing-content-2-2>phrasing content</a> nodes uninterrupted by other types of content, in an
- element that accepts content other than <a href=#phrasing-content-2 id=paragraphs:phrasing-content-2-3>phrasing content</a> as well as <a href=#phrasing-content-2 id=paragraphs:phrasing-content-2-4>phrasing
- content</a>, let <var>first</var> be the first node of the run, and let <var>last</var> be the last node of the run. For each such run that consists of at least one
- node that is neither <a href=#embedded-content-category id=paragraphs:embedded-content-category>embedded content</a> nor <a href=#inter-element-whitespace id=paragraphs:inter-element-whitespace-2>inter-element whitespace</a>, a
- paragraph exists in the original DOM from immediately before <var>first</var> to
- immediately after <var>last</var>. (Paragraphs can thus span across <code id=paragraphs:the-a-element-3><a href=#the-a-element>a</a></code>,
- <code id=paragraphs:the-ins-element-6><a href=#the-ins-element>ins</a></code>, <code id=paragraphs:the-del-element-6><a href=#the-del-element>del</a></code>, and <code id=paragraphs:the-map-element-3><a href=#the-map-element>map</a></code> elements.)</p>
- <p>Conformance checkers may warn authors of cases where they have paragraphs that overlap each
- other (this can happen with <code id=paragraphs:the-object-element><a href=#the-object-element>object</a></code>, <code id=paragraphs:the-video-element><a href=#the-video-element>video</a></code>, <code id=paragraphs:the-audio-element><a href=#the-audio-element>audio</a></code>, and
- <code id=paragraphs:the-canvas-element><a href=#the-canvas-element>canvas</a></code> elements, and indirectly through elements in other namespaces that allow HTML
- to be further embedded therein, like <code id=paragraphs:svg-2><a href=#svg-2>svg</a></code> or <code id=paragraphs:math><a href=#math>math</a></code>).</p>
-
-
- <p>A <a href=#paragraph id=paragraphs:paragraph-4>paragraph</a> is also formed explicitly by <code id=paragraphs:the-p-element-3><a href=#the-p-element>p</a></code> elements.</p>
- <p class=note>The <code id=paragraphs:the-p-element-4><a href=#the-p-element>p</a></code> element can be used to wrap individual paragraphs when there
- would otherwise not be any content other than phrasing content to separate the paragraphs from
- each other.</p>
- <div class=example>
- <p>In the following example, the link spans half of the first paragraph, all of the heading
- separating the two paragraphs, and half of the second paragraph. It straddles the paragraphs and
- the heading.</p>
- <pre><header>
- Welcome!
- <a href="about.html">
- This is home of...
- <h1>The Falcons!</h1>
- The Lockheed Martin multirole jet fighter aircraft!
- </a>
- This page discusses the F-16 Fighting Falcon's innermost secrets.
- </header></pre>
- <p>Here is another way of marking this up, this time showing the paragraphs explicitly, and
- splitting the one link element into three:</p>
- <pre><header>
- <p>Welcome! <a href="about.html">This is home of...</a></p>
- <h1><a href="about.html">The Falcons!</a></h1>
- <p><a href="about.html">The Lockheed Martin multirole jet
- fighter aircraft!</a> This page discusses the F-16 Fighting
- Falcon's innermost secrets.</p>
- </header></pre>
- </div>
- <div class=example>
-
- <p>It is possible for paragraphs to overlap when using certain elements that define fallback
- content. For example, in the following section:</p>
- <pre><section>
- <h1>My Cats</h1>
- You can play with my cat simulator.
- <object data="cats.sim">
- To see the cat simulator, use one of the following links:
- <ul>
- <li><a href="cats.sim">Download simulator file</a>
- <li><a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator</a>
- </ul>
- Alternatively, upgrade to the Mellblom Browser.
- </object>
- I'm quite proud of it.
- </section></pre>
- <p>There are five paragraphs:</p>
- <ol class=brief><li>The paragraph that says "You can play with my cat simulator. <i>object</i> I'm
- quite proud of it.", where <i>object</i> is the <code id=paragraphs:the-object-element-2><a href=#the-object-element>object</a></code> element.<li>The paragraph that says "To see the cat simulator, use one of the following links:".<li>The paragraph that says "Download simulator file".<li>The paragraph that says "Use online simulator".<li>The paragraph that says "Alternatively, upgrade to the Mellblom Browser.".</ol>
- <p>The first paragraph is overlapped by the other four. A user agent that supports the "cats.sim"
- resource will only show the first one, but a user agent that shows the fallback will confusingly
- show the first sentence of the first paragraph as if it was in the same paragraph as the second
- one, and will show the last paragraph as if it was at the start of the second sentence of the
- first paragraph.</p>
- <p>To avoid this confusion, explicit <code id=paragraphs:the-p-element-5><a href=#the-p-element>p</a></code> elements can be used. For example:</p>
-
- <pre><section>
- <h1>My Cats</h1>
- <p>You can play with my cat simulator.</p>
- <object data="cats.sim">
- <p>To see the cat simulator, use one of the following links:</p>
- <ul>
- <li><a href="cats.sim">Download simulator file</a>
- <li><a href="http://sims.example.com/watch?v=LYds5xY4INU">Use online simulator</a>
- </ul>
- <p>Alternatively, upgrade to the Mellblom Browser.</p>
- </object>
- <p>I'm quite proud of it.</p>
- </section></pre>
- </div>
- <h4 id=global-attributes>3.2.5 <dfn>Global attributes</dfn></h4>
- <p>The following attributes are common to and may be specified on all <a href=#html-elements id=global-attributes:html-elements>HTML
- elements</a> (even those not defined in this specification):</p>
- <ul class=brief><li><code id=global-attributes:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code><li><code id=global-attributes:classes><a href=#classes>class</a></code><li><code id=global-attributes:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code><li><code id=global-attributes:attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code><li><code id=global-attributes:the-dir-attribute><a href=#the-dir-attribute>dir</a></code><li><code id=global-attributes:the-draggable-attribute><a href=#the-draggable-attribute>draggable</a></code><li><code id=global-attributes:the-dropzone-attribute><a href=#the-dropzone-attribute>dropzone</a></code><li><code id=global-attributes:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code><li><code id=global-attributes:the-id-attribute><a href=#the-id-attribute>id</a></code><li><code id=global-attributes:attr-itemid><a href=#attr-itemid>itemid</a></code><li><code id=global-attributes:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code><li><code id=global-attributes:attr-itemref><a href=#attr-itemref>itemref</a></code><li><code id=global-attributes:attr-itemscope><a href=#attr-itemscope>itemscope</a></code><li><code id=global-attributes:attr-itemtype><a href=#attr-itemtype>itemtype</a></code><li><code id=global-attributes:attr-lang><a href=#attr-lang>lang</a></code><li><code id=global-attributes:attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code><li><code id=global-attributes:the-style-attribute><a href=#the-style-attribute>style</a></code><li><code id=global-attributes:attr-tabindex><a href=#attr-tabindex>tabindex</a></code><li><code id=global-attributes:attr-title><a href=#attr-title>title</a></code><li><code id=global-attributes:attr-translate><a href=#attr-translate>translate</a></code></ul>
-
- <p>These attributes are only defined by this specification as attributes for <a href=#html-elements id=global-attributes:html-elements-2>HTML
- elements</a>. When this specification refers to elements having these attributes, elements from
- namespaces that are not defined as having these attributes must not be considered as being
- elements with these attributes.</p>
- <div class=example>
- <p>For example, in the following XML fragment, the "<code>bogus</code>" element does not
- have a <code id=global-attributes:the-dir-attribute-2><a href=#the-dir-attribute>dir</a></code> attribute as defined in this specification, despite
- having an attribute with the literal name "<code>dir</code>". Thus, <a href=#the-directionality id=global-attributes:the-directionality>the
- directionality</a> of the inner-most <code id=global-attributes:the-span-element><a href=#the-span-element>span</a></code> element is '<a href=#concept-rtl id=global-attributes:concept-rtl>rtl</a>', inherited from the <code id=global-attributes:the-div-element><a href=#the-div-element>div</a></code> element indirectly through
- the "<code>bogus</code>" element.</p>
- <pre class=bad><div xmlns="http://www.w3.org/1999/xhtml" dir="rtl">
- <bogus xmlns="http://example.net/ns" dir="ltr">
- <span xmlns="http://www.w3.org/1999/xhtml">
- </span>
- </bogus>
- </div></pre>
- </div>
-
- <hr>
- <p>To enable assistive technology products to expose a more fine-grained interface than is
- otherwise possible with HTML elements and attributes, a set of <a href=#wai-aria id=global-attributes:wai-aria>annotations
- for assistive technology products</a> can be specified (the ARIA <code id=global-attributes:attr-aria-role><a href=#attr-aria-role>role</a></code> and <code id=global-attributes:attr-aria-*><a href=#attr-aria-*>aria-*</a></code> attributes). <a href=#refsARIA>[ARIA]</a></p>
- <hr>
- <p>The following <a href=#event-handler-content-attributes id=global-attributes:event-handler-content-attributes>event handler content attributes</a> may be specified on any <a href=#html-elements id=global-attributes:html-elements-3>HTML element</a>:</p>
- <ul class=brief><li><code id=global-attributes:handler-onabort><a href=#handler-onabort>onabort</a></code><li><code id=global-attributes:handler-onautocomplete><a href=#handler-onautocomplete>onautocomplete</a></code><li><code id=global-attributes:handler-onautocompleteerror><a href=#handler-onautocompleteerror>onautocompleteerror</a></code><li><code id=global-attributes:handler-onblur><a href=#handler-onblur>onblur</a></code>*<li><code id=global-attributes:handler-oncancel><a href=#handler-oncancel>oncancel</a></code><li><code id=global-attributes:handler-oncanplay><a href=#handler-oncanplay>oncanplay</a></code><li><code id=global-attributes:handler-oncanplaythrough><a href=#handler-oncanplaythrough>oncanplaythrough</a></code><li><code id=global-attributes:handler-onchange><a href=#handler-onchange>onchange</a></code><li><code id=global-attributes:handler-onclick><a href=#handler-onclick>onclick</a></code><li><code id=global-attributes:handler-onclose><a href=#handler-onclose>onclose</a></code><li><code id=global-attributes:handler-oncontextmenu><a href=#handler-oncontextmenu>oncontextmenu</a></code><li><code id=global-attributes:handler-oncuechange><a href=#handler-oncuechange>oncuechange</a></code><li><code id=global-attributes:handler-ondblclick><a href=#handler-ondblclick>ondblclick</a></code><li><code id=global-attributes:handler-ondrag><a href=#handler-ondrag>ondrag</a></code><li><code id=global-attributes:handler-ondragend><a href=#handler-ondragend>ondragend</a></code><li><code id=global-attributes:handler-ondragenter><a href=#handler-ondragenter>ondragenter</a></code><li><code id=global-attributes:handler-ondragexit><a href=#handler-ondragexit>ondragexit</a></code><li><code id=global-attributes:handler-ondragleave><a href=#handler-ondragleave>ondragleave</a></code><li><code id=global-attributes:handler-ondragover><a href=#handler-ondragover>ondragover</a></code><li><code id=global-attributes:handler-ondragstart><a href=#handler-ondragstart>ondragstart</a></code><li><code id=global-attributes:handler-ondrop><a href=#handler-ondrop>ondrop</a></code><li><code id=global-attributes:handler-ondurationchange><a href=#handler-ondurationchange>ondurationchange</a></code><li><code id=global-attributes:handler-onemptied><a href=#handler-onemptied>onemptied</a></code><li><code id=global-attributes:handler-onended><a href=#handler-onended>onended</a></code><li><code id=global-attributes:handler-onerror><a href=#handler-onerror>onerror</a></code>*<li><code id=global-attributes:handler-onfocus><a href=#handler-onfocus>onfocus</a></code>*<li><code id=global-attributes:handler-oninput><a href=#handler-oninput>oninput</a></code><li><code id=global-attributes:handler-oninvalid><a href=#handler-oninvalid>oninvalid</a></code><li><code id=global-attributes:handler-onkeydown><a href=#handler-onkeydown>onkeydown</a></code><li><code id=global-attributes:handler-onkeypress><a href=#handler-onkeypress>onkeypress</a></code><li><code id=global-attributes:handler-onkeyup><a href=#handler-onkeyup>onkeyup</a></code><li><code id=global-attributes:handler-onload><a href=#handler-onload>onload</a></code>*<li><code id=global-attributes:handler-onloadeddata><a href=#handler-onloadeddata>onloadeddata</a></code><li><code id=global-attributes:handler-onloadedmetadata><a href=#handler-onloadedmetadata>onloadedmetadata</a></code><li><code id=global-attributes:handler-onloadstart><a href=#handler-onloadstart>onloadstart</a></code><li><code id=global-attributes:handler-onmousedown><a href=#handler-onmousedown>onmousedown</a></code><li><code id=global-attributes:handler-onmouseenter><a href=#handler-onmouseenter>onmouseenter</a></code><li><code id=global-attributes:handler-onmouseleave><a href=#handler-onmouseleave>onmouseleave</a></code><li><code id=global-attributes:handler-onmousemove><a href=#handler-onmousemove>onmousemove</a></code><li><code id=global-attributes:handler-onmouseout><a href=#handler-onmouseout>onmouseout</a></code><li><code id=global-attributes:handler-onmouseover><a href=#handler-onmouseover>onmouseover</a></code><li><code id=global-attributes:handler-onmouseup><a href=#handler-onmouseup>onmouseup</a></code><li><code id=global-attributes:handler-onmousewheel><a href=#handler-onmousewheel>onmousewheel</a></code><li><code id=global-attributes:handler-onpause><a href=#handler-onpause>onpause</a></code><li><code id=global-attributes:handler-onplay><a href=#handler-onplay>onplay</a></code><li><code id=global-attributes:handler-onplaying><a href=#handler-onplaying>onplaying</a></code><li><code id=global-attributes:handler-onprogress><a href=#handler-onprogress>onprogress</a></code><li><code id=global-attributes:handler-onratechange><a href=#handler-onratechange>onratechange</a></code><li><code id=global-attributes:handler-onreset><a href=#handler-onreset>onreset</a></code><li><code id=global-attributes:handler-onresize><a href=#handler-onresize>onresize</a></code>*<li><code id=global-attributes:handler-onscroll><a href=#handler-onscroll>onscroll</a></code>*<li><code id=global-attributes:handler-onseeked><a href=#handler-onseeked>onseeked</a></code><li><code id=global-attributes:handler-onseeking><a href=#handler-onseeking>onseeking</a></code><li><code id=global-attributes:handler-onselect><a href=#handler-onselect>onselect</a></code><li><code id=global-attributes:handler-onshow><a href=#handler-onshow>onshow</a></code><li><code id=global-attributes:handler-onsort><a href=#handler-onsort>onsort</a></code><li><code id=global-attributes:handler-onstalled><a href=#handler-onstalled>onstalled</a></code><li><code id=global-attributes:handler-onsubmit><a href=#handler-onsubmit>onsubmit</a></code><li><code id=global-attributes:handler-onsuspend><a href=#handler-onsuspend>onsuspend</a></code><li><code id=global-attributes:handler-ontimeupdate><a href=#handler-ontimeupdate>ontimeupdate</a></code><li><code id=global-attributes:handler-ontoggle><a href=#handler-ontoggle>ontoggle</a></code><li><code id=global-attributes:handler-onvolumechange><a href=#handler-onvolumechange>onvolumechange</a></code><li><code id=global-attributes:handler-onwaiting><a href=#handler-onwaiting>onwaiting</a></code></ul>
- <p class=note>The attributes marked with an asterisk have a different meaning when specified on
- <code id=global-attributes:the-body-element><a href=#the-body-element>body</a></code> elements as those elements expose <a href=#event-handlers id=global-attributes:event-handlers>event handlers</a> of the
- <code id=global-attributes:window><a href=#window>Window</a></code> object with the same names.</p>
- <p class=note>While these attributes apply to all elements, they are not useful on all elements.
- For example, only <a href=#media-element id=global-attributes:media-element>media elements</a> will ever receive a <code id=global-attributes:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event fired by the user agent.</p>
- <hr>
- <p><a href=#custom-data-attribute id=global-attributes:custom-data-attribute>Custom data attributes</a> (e.g. <code>data-foldername</code> or <code>data-msgid</code>) can be specified on any <a href=#html-elements id=global-attributes:html-elements-4>HTML element</a>, to store custom data specific to the page.</p>
- <hr>
- <p>In <a href=#html-documents id=global-attributes:html-documents>HTML documents</a>, elements in the <a href=#html-namespace-2 id=global-attributes:html-namespace-2>HTML namespace</a> may have an <code>xmlns</code> attribute specified, if, and only if, it has the exact value "<code>http://www.w3.org/1999/xhtml</code>". This does not apply to <a href=#xml-documents id=global-attributes:xml-documents>XML
- documents</a>.</p>
- <p class=note>In HTML, the <code>xmlns</code> attribute has absolutely no effect. It
- is basically a talisman. It is allowed merely to make migration to and from XHTML mildly easier.
- When parsed by an <a href=#html-parser id=global-attributes:html-parser>HTML parser</a>, the attribute ends up in no namespace, not the "<code>http://www.w3.org/2000/xmlns/</code>" namespace like namespace declaration attributes in
- XML do.</p>
- <p class=note>In XML, an <code>xmlns</code> attribute is part of the namespace
- declaration mechanism, and an element cannot actually have an <code>xmlns</code>
- attribute in no namespace specified.</p>
- <hr>
- <p>The XML specification also allows the use of the <code id=global-attributes:attr-xml-space><a href=#attr-xml-space>xml:space</a></code>
- attribute in the <a href=#xml-namespace id=global-attributes:xml-namespace>XML namespace</a> on any element in an <a href=#xml-documents id=global-attributes:xml-documents-2>XML
- document</a>. This attribute has no effect on <a href=#html-elements id=global-attributes:html-elements-5>HTML elements</a>, as the default
- behavior in HTML is to preserve whitespace. <a href=#refsXML>[XML]</a></p>
- <p class=note>There is no way to serialise the <code id=global-attributes:attr-xml-space-2><a href=#attr-xml-space>xml:space</a></code>
- attribute on <a href=#html-elements id=global-attributes:html-elements-6>HTML elements</a> in the <code id=global-attributes:text/html><a href=#text/html>text/html</a></code> syntax.</p>
- <h5 id=the-id-attribute>3.2.5.1 The <dfn><code>id</code></dfn> attribute</h5>
- <p>The <code id=the-id-attribute:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute specifies its element's <a href=#concept-id id=the-id-attribute:concept-id>unique identifier (ID)</a>. <a href=#refsDOM>[DOM]</a></p>
- <p>The value must be unique amongst all the <a href=#concept-id id=the-id-attribute:concept-id-2>IDs</a> in the element's
- <a href=#home-subtree id=the-id-attribute:home-subtree>home subtree</a> and must contain at least one character. The value must not contain any
- <a href=#space-character id=the-id-attribute:space-character>space characters</a>.</p>
-
- <p class=note>There are no other restrictions on what form an ID can take; in particular, IDs
- can consist of just digits, start with a digit, start with an underscore, consist of just
- punctuation, etc.</p>
- <p class=note>An element's <a href=#concept-id id=the-id-attribute:concept-id-3>unique identifier</a> can be used for a
- variety of purposes, most notably as a way to link to specific parts of a document using fragment
- identifiers, as a way to target an element when scripting, and as a way to style a specific
- element from CSS.</p>
-
- <p>Identifiers are opaque strings. Particular meanings should not be derived from the value of the
- <code id=the-id-attribute:the-id-attribute-2><a href=#the-id-attribute>id</a></code> attribute.</p>
-
- <h5 id=the-title-attribute>3.2.5.2 The <code id=the-title-attribute:attr-title><a href=#attr-title>title</a></code> attribute</h5>
- <p>The <dfn id=attr-title><code>title</code></dfn> attribute <a href=#represents id=the-title-attribute:represents>represents</a> advisory
- information for the element, such as would be appropriate for a tooltip. On a link, this could be
- the title or a description of the target resource; on an image, it could be the image credit or a
- description of the image; on a paragraph, it could be a footnote or commentary on the text; on a
- citation, it could be further information about the source; on <a href=#interactive-content-2 id=the-title-attribute:interactive-content-2>interactive content</a>,
- it could be a label for, or instructions for, use of the element; and so forth. The value is
- text.</p>
-
- <p class=note>Relying on the <code id=the-title-attribute:attr-title-2><a href=#attr-title>title</a></code> attribute is currently
- discouraged as many user agents do not expose the attribute in an accessible manner as required by
- this specification (e.g. requiring a pointing device such as a mouse to cause a tooltip to appear,
- which excludes keyboard-only users and touch-only users, such as anyone with a modern phone or
- tablet).</p>
- <p>If this attribute is omitted from an element, then it implies that the <code id=the-title-attribute:attr-title-3><a href=#attr-title>title</a></code> attribute of the nearest ancestor <a href=#html-elements id=the-title-attribute:html-elements>HTML
- element</a> with a <code id=the-title-attribute:attr-title-4><a href=#attr-title>title</a></code> attribute set is also relevant to this
- element. Setting the attribute overrides this, explicitly stating that the advisory information of
- any ancestors is not relevant to this element. Setting the attribute to the empty string indicates
- that the element has no advisory information.</p>
- <p>If the <code id=the-title-attribute:attr-title-5><a href=#attr-title>title</a></code> attribute's value contains U+000A LINE FEED (LF)
- characters, the content is split into multiple lines. Each U+000A LINE FEED (LF) character
- represents a line break.</p>
- <div class=example>
- <p>Caution is advised with respect to the use of newlines in <code id=the-title-attribute:attr-title-6><a href=#attr-title>title</a></code> attributes.</p>
- <p>For instance, the following snippet actually defines an abbreviation's expansion <em>with a
- line break in it</em>:</p>
- <pre class=bad><p>My logs show that there was some interest in <abbr title="Hypertext
- Transport Protocol">HTTP</abbr> today.</p></pre>
- </div>
- <p>Some elements, such as <code id=the-title-attribute:the-link-element><a href=#the-link-element>link</a></code>, <code id=the-title-attribute:the-abbr-element><a href=#the-abbr-element>abbr</a></code>, and <code id=the-title-attribute:the-input-element><a href=#the-input-element>input</a></code>, define
- additional semantics for the <code id=the-title-attribute:attr-title-7><a href=#attr-title>title</a></code> attribute beyond the semantics
- described above.</p>
-
- <p>The <dfn id=advisory-information>advisory information</dfn> of an element is the value that the following algorithm
- returns, with the algorithm being aborted once a value is returned. When the algorithm returns the
- empty string, then there is no advisory information.</p>
- <ol><li><p>If the element is a <code id=the-title-attribute:the-link-element-2><a href=#the-link-element>link</a></code>, <code id=the-title-attribute:the-style-element><a href=#the-style-element>style</a></code>, <code id=the-title-attribute:the-dfn-element><a href=#the-dfn-element>dfn</a></code>,
- <code id=the-title-attribute:the-abbr-element-2><a href=#the-abbr-element>abbr</a></code>, or <code id=the-title-attribute:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element, then: if the element has a <code>title</code> attribute, return the value of that attribute,
- otherwise, return the empty string.<li><p>Otherwise, if the element has a <code id=the-title-attribute:attr-title-8><a href=#attr-title>title</a></code> attribute, then
- return its value.<li><p>Otherwise, if the element has a parent element, then return the parent element's
- <a href=#advisory-information id=the-title-attribute:advisory-information>advisory information</a>.<li><p>Otherwise, return the empty string.</ol>
- <p>User agents should inform the user when elements have <a href=#advisory-information id=the-title-attribute:advisory-information-2>advisory information</a>,
- otherwise the information would not be discoverable.</p>
- <hr>
- <p>The <dfn id=dom-title><code>title</code></dfn> IDL attribute must <a href=#reflect id=the-title-attribute:reflect>reflect</a> the
- <code id=the-title-attribute:attr-title-9><a href=#attr-title>title</a></code> content attribute.</p>
-
- <h5 id=the-lang-and-xml:lang-attributes>3.2.5.3 The <code id=the-lang-and-xml:lang-attributes:attr-lang><a href=#attr-lang>lang</a></code> and <code id=the-lang-and-xml:lang-attributes:attr-xml-lang><a href=#attr-xml-lang>xml:lang</a></code> attributes</h5>
- <p>The <dfn id=attr-lang><code>lang</code></dfn> attribute (in no namespace) specifies the
- primary language for the element's contents and for any of the element's attributes that contain
- text. Its value must be a valid BCP 47 language tag, or the empty string. Setting the attribute to
- the empty string indicates that the primary language is unknown. <a href=#refsBCP47>[BCP47]</a></p>
- <p>The <dfn id=attr-xml-lang><code>lang</code></dfn> attribute in the <a href=#xml-namespace id=the-lang-and-xml:lang-attributes:xml-namespace>XML
- namespace</a> is defined in XML. <a href=#refsXML>[XML]</a></p>
- <p>If these attributes are omitted from an element, then the language of this element is the same
- as the language of its parent element, if any.</p>
- <p>The <code id=the-lang-and-xml:lang-attributes:attr-lang-2><a href=#attr-lang>lang</a></code> attribute in no namespace may be used on any <a href=#html-elements id=the-lang-and-xml:lang-attributes:html-elements>HTML element</a>.</p>
- <p>The <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-2><code>lang</code> attribute in the <span>XML
- namespace</span></a> may be used on <a href=#html-elements id=the-lang-and-xml:lang-attributes:html-elements-2>HTML elements</a> in <a href=#xml-documents id=the-lang-and-xml:lang-attributes:xml-documents>XML documents</a>,
- as well as elements in other namespaces if the relevant specifications allow it (in particular,
- MathML and SVG allow <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-3><code>lang</code> attributes in the
- <span>XML namespace</span></a> to be specified on their elements). If both the <code id=the-lang-and-xml:lang-attributes:attr-lang-3><a href=#attr-lang>lang</a></code> attribute in no namespace and the <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-4><code>lang</code> attribute in the <span>XML namespace</span></a> are specified on the same
- element, they must have exactly the same value when compared in an <a href=#ascii-case-insensitive id=the-lang-and-xml:lang-attributes:ascii-case-insensitive>ASCII
- case-insensitive</a> manner.</p>
- <p>Authors must not use the <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-5><code>lang</code> attribute in
- the <span>XML namespace</span></a> on <a href=#html-elements id=the-lang-and-xml:lang-attributes:html-elements-3>HTML elements</a> in <a href=#html-documents id=the-lang-and-xml:lang-attributes:html-documents>HTML
- documents</a>. To ease migration to and from XHTML, authors may specify an attribute in no
- namespace with no prefix and with the literal localname "<code>xml:lang</code>" on
- <a href=#html-elements id=the-lang-and-xml:lang-attributes:html-elements-4>HTML elements</a> in <a href=#html-documents id=the-lang-and-xml:lang-attributes:html-documents-2>HTML documents</a>, but such attributes must only be
- specified if a <code id=the-lang-and-xml:lang-attributes:attr-lang-4><a href=#attr-lang>lang</a></code> attribute in no namespace is also specified,
- and both attributes must have the same value when compared in an <a href=#ascii-case-insensitive id=the-lang-and-xml:lang-attributes:ascii-case-insensitive-2>ASCII
- case-insensitive</a> manner.</p>
- <p class=note>The attribute in no namespace with no prefix and with the literal localname "<code>xml:lang</code>" has no effect on language processing.</p>
-
- <hr>
- <p>To determine the <dfn id=language>language</dfn> of a node, user agents must look at the nearest ancestor
- element (including the element itself if the node is an element) that has a <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-6><code>lang</code> attribute in the <span>XML
- namespace</span></a> set or is an <a href=#html-elements id=the-lang-and-xml:lang-attributes:html-elements-5>HTML element</a> and has a
- <code id=the-lang-and-xml:lang-attributes:attr-lang-5><a href=#attr-lang>lang</a></code> in no namespace attribute set. That attribute specifies the
- language of the node (regardless of its value).</p>
- <p>If both the <code id=the-lang-and-xml:lang-attributes:attr-lang-6><a href=#attr-lang>lang</a></code> attribute in no namespace and the <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-7><code>lang</code> attribute in the <span>XML
- namespace</span></a> are set on an element, user agents must use the <a href=#attr-xml-lang id=the-lang-and-xml:lang-attributes:attr-xml-lang-8><code>lang</code> attribute in the <span>XML
- namespace</span></a>, and the <code id=the-lang-and-xml:lang-attributes:attr-lang-7><a href=#attr-lang>lang</a></code> attribute in no namespace
- must be <a href=#ignore id=the-lang-and-xml:lang-attributes:ignore>ignored</a> for the purposes of determining the element's
- language.</p>
- <p>If neither the node nor any of the node's ancestors, including the <a href=#root-element id=the-lang-and-xml:lang-attributes:root-element>root element</a>,
- have either attribute set, but there is a <a href=#pragma-set-default-language id=the-lang-and-xml:lang-attributes:pragma-set-default-language>pragma-set default language</a> set, then that
- is the language of the node. If there is no <a href=#pragma-set-default-language id=the-lang-and-xml:lang-attributes:pragma-set-default-language-2>pragma-set default language</a> set, then
- language information from a higher-level protocol (such as HTTP), if any, must be used as the
- final fallback language instead. In the absence of any such language information, and in cases
- where the higher-level protocol reports multiple languages, the language of the node is unknown,
- and the corresponding language tag is the empty string.</p>
- <p>If the resulting value is not a recognised language tag, then it must be treated as an unknown
- language having the given language tag, distinct from all other languages. For the purposes of
- round-tripping or communicating with other services that expect language tags, user agents should
- pass unknown language tags through unmodified, and tagged as being BCP 47 language tags, so that
- subsequent services do not interpret the data as another type of language description. <a href=#refsBCP47>[BCP47]</a></p>
- <p class=example>Thus, for instance, an element with <code>lang="xyzzy"</code> would be
- matched by the selector <code>:lang(xyzzy)</code> (e.g. in CSS), but it would not be
- matched by <code>:lang(abcde)</code>, even though both are equally invalid. Similarly, if
- a Web browser and screen reader working in unison communicated about the language of the element,
- the browser would tell the screen reader that the language was "xyzzy", even if it knew it was
- invalid, just in case the screen reader actually supported a language with that tag after all.
- Even if the screen reader supported both BCP 47 and another syntax for encoding language names,
- and in that other syntax the string "xyzzy" was a way to denote the Belarusian language, it would
- be <em>incorrect</em> for the screen reader to then start treating text as Belarusian, because
- "xyzzy" is not how Belarusian is described in BCP 47 codes (BCP 47 uses the code "be" for
- Belarusian).</p>
- <p>If the resulting value is the empty string, then it must be interpreted as meaning that the
- language of the node is explicitly unknown.</p>
- <hr>
- <p>User agents may use the element's language to determine proper processing or rendering (e.g. in
- the selection of appropriate fonts or pronunciations, for dictionary selection, or for the user
- interfaces of form controls such as date pickers). </p>
-
- <hr>
- <p>The <dfn id=dom-lang><code>lang</code></dfn> IDL attribute must <a href=#reflect id=the-lang-and-xml:lang-attributes:reflect>reflect</a> the
- <code id=the-lang-and-xml:lang-attributes:attr-lang-8><a href=#attr-lang>lang</a></code> content attribute in no namespace.</p>
-
- <h5 id=the-translate-attribute>3.2.5.4 The <code id=the-translate-attribute:attr-translate><a href=#attr-translate>translate</a></code> attribute</h5>
-
- <p>The <dfn id=attr-translate><code>translate</code></dfn> attribute is an <a href=#enumerated-attribute id=the-translate-attribute:enumerated-attribute>enumerated
- attribute</a> that is used to specify whether an element's attribute values and the values of
- its <code id=the-translate-attribute:text><a href=#text>Text</a></code> node children are to be translated when the page is localized, or whether to
- leave them unchanged.</p>
- <p>The attribute's keywords are the empty string, <code>yes</code>, and <code>no</code>. The empty string and the <code>yes</code> keyword map to the
- <i>yes</i> state. The <code>no</code> keyword maps to the <i>no</i> state. In addition,
- there is a third state, the <i>inherit</i> state, which is the <i id=the-translate-attribute:missing-value-default><a href=#missing-value-default>missing value default</a></i> (and
- the <i id=the-translate-attribute:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i>).</p>
- <p>Each element (even non-HTML elements) has a <dfn id=translation-mode>translation mode</dfn>, which is in either the
- <a href=#translate-enabled id=the-translate-attribute:translate-enabled>translate-enabled</a> state or the <a href=#no-translate id=the-translate-attribute:no-translate>no-translate</a> state. If an <a href=#html-elements id=the-translate-attribute:html-elements>HTML element</a>'s <code id=the-translate-attribute:attr-translate-2><a href=#attr-translate>translate</a></code>
- attribute is in the <i>yes</i> state, then the element's <a href=#translation-mode id=the-translate-attribute:translation-mode>translation mode</a> is in the
- <a href=#translate-enabled id=the-translate-attribute:translate-enabled-2>translate-enabled</a> state; otherwise, if the element's <code id=the-translate-attribute:attr-translate-3><a href=#attr-translate>translate</a></code> attribute is in the <i>no</i> state, then the element's
- <a href=#translation-mode id=the-translate-attribute:translation-mode-2>translation mode</a> is in the <a href=#no-translate id=the-translate-attribute:no-translate-2>no-translate</a> state. Otherwise, either the
- element's <code id=the-translate-attribute:attr-translate-4><a href=#attr-translate>translate</a></code> attribute is in the <i>inherit</i> state,
- or the element is not an <a href=#html-elements id=the-translate-attribute:html-elements-2>HTML element</a> and thus does not have a
- <code id=the-translate-attribute:attr-translate-5><a href=#attr-translate>translate</a></code> attribute; in either case, the element's
- <a href=#translation-mode id=the-translate-attribute:translation-mode-3>translation mode</a> is in the same state as its parent element's, if any, or in the
- <a href=#translate-enabled id=the-translate-attribute:translate-enabled-3>translate-enabled</a> state, if the element is a <a href=#root-element id=the-translate-attribute:root-element>root element</a>.</p>
- <p>When an element is in the <dfn id=translate-enabled>translate-enabled</dfn> state, the element's <a href=#translatable-attributes id=the-translate-attribute:translatable-attributes>translatable
- attributes</a> and the values of its <code id=the-translate-attribute:text-2><a href=#text>Text</a></code> node children are to be translated when
- the page is localized.</p>
- <p>When an element is in the <dfn id=no-translate>no-translate</dfn> state, the element's attribute values and the
- values of its <code id=the-translate-attribute:text-3><a href=#text>Text</a></code> node children are to be left as-is when the page is localized,
- e.g. because the element contains a person's name or a the name of a computer program.</p>
- <p>The following attributes are <dfn id=translatable-attributes>translatable attributes</dfn>:</p>
- <ul class=brief><li><code id=the-translate-attribute:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code id=the-translate-attribute:the-th-element><a href=#the-th-element>th</a></code> elements<li><code>alt</code> on <code id=the-translate-attribute:attr-area-alt><a href=#attr-area-alt>area</a></code>,
- <code id=the-translate-attribute:attr-img-alt><a href=#attr-img-alt>img</a></code>, and
- <code id=the-translate-attribute:attr-input-alt><a href=#attr-input-alt>input</a></code> elements<li><code id=the-translate-attribute:attr-meta-content><a href=#attr-meta-content>content</a></code> on <code id=the-translate-attribute:the-meta-element><a href=#the-meta-element>meta</a></code> elements, if the <code id=the-translate-attribute:attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is known to be translatable<li><code id=the-translate-attribute:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> on <code id=the-translate-attribute:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=the-translate-attribute:the-area-element><a href=#the-area-element>area</a></code> elements<li><code>label</code> on <code id=the-translate-attribute:attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
- <code id=the-translate-attribute:attr-menu-label><a href=#attr-menu-label>menu</a></code>,
- <code id=the-translate-attribute:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
- <code id=the-translate-attribute:attr-option-label><a href=#attr-option-label>option</a></code>, and
- <code id=the-translate-attribute:attr-track-label><a href=#attr-track-label>track</a></code> elements<li><code id=the-translate-attribute:attr-lang><a href=#attr-lang>lang</a></code> on <a href=#html-elements id=the-translate-attribute:html-elements-3>HTML elements</a>; must be "translated" to match the language used in the translation<li><code>placeholder</code> on <code id=the-translate-attribute:attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
- <code id=the-translate-attribute:attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements<li><code id=the-translate-attribute:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> on <code id=the-translate-attribute:the-iframe-element><a href=#the-iframe-element>iframe</a></code> elements; must be parsed and recursively processed<li><code id=the-translate-attribute:the-style-attribute><a href=#the-style-attribute>style</a></code> on <a href=#html-elements id=the-translate-attribute:html-elements-4>HTML elements</a>; must be parsed and recursively processed (e.g. for the values of 'content' properties)<li><code id=the-translate-attribute:attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements id=the-translate-attribute:html-elements-5>HTML elements</a><li><code id=the-translate-attribute:attr-input-value><a href=#attr-input-value>value</a></code> on <code id=the-translate-attribute:the-input-element><a href=#the-input-element>input</a></code> elements with a
- <code id=the-translate-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#button-state-(type=button)" id="the-translate-attribute:button-state-(type=button)">Button</a> state
- or the <a href="#reset-button-state-(type=reset)" id="the-translate-attribute:reset-button-state-(type=reset)">Reset Button</a> state</ul>
- <p>Other specifications may define other attributes that are also <a href=#translatable-attributes id=the-translate-attribute:translatable-attributes-2>translatable
- attributes</a>. For example, ARIA would define the <code id=the-translate-attribute:attr-aria-label><a data-x-internal=attr-aria-label href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-label>aria-label</a></code> attribute as translatable.</p>
-
- <hr>
- <p>The <dfn id=dom-translate><code>translate</code></dfn> IDL attribute must, on getting,
- return true if the element's <a href=#translation-mode id=the-translate-attribute:translation-mode-4>translation mode</a> is <a href=#translate-enabled id=the-translate-attribute:translate-enabled-4>translate-enabled</a>, and
- false otherwise. On setting, it must set the content attribute's value to "<code>yes</code>" if the new value is true, and set the content attribute's value to "<code>no</code>" otherwise.</p>
-
- <div class=example>
- <p>In this example, everything in the document is to be translated when the page is localized,
- except the sample keyboard input and sample program output:</p>
- <pre><!DOCTYPE HTML>
- <html> <!-- default on the root element is translate=yes -->
- <head>
- <title>The Bee Game</title> <!-- implied translate=yes inherited from ancestors -->
- </head>
- <body>
- <p>The Bee Game is a text adventure game in English.</p>
- <p>When the game launches, the first thing you should do is type
- <kbd <strong>translate=no</strong>>eat honey</kbd>. The game will respond with:</p>
- <pre><samp <strong>translate=no</strong>>Yum yum! That was some good honey!</samp></pre>
- </body>
- </html></pre>
- </div>
- <h5 id=the-xml:base-attribute-(xml-only)>3.2.5.5 The <dfn><code>xml:base</code></dfn> attribute (XML only)</h5>
- <p>The <code id=the-xml:base-attribute-(xml-only):the-xml:base-attribute-(xml-only)><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute is defined in XML Base. <a href=#refsXMLBASE>[XMLBASE]</a></p>
- <p>The <code id=the-xml:base-attribute-(xml-only):the-xml:base-attribute-(xml-only)-2><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute may be used on <a href=#html-elements id=the-xml:base-attribute-(xml-only):html-elements>HTML
- elements</a> of <a href=#xml-documents id=the-xml:base-attribute-(xml-only):xml-documents>XML documents</a>. Authors must not use the <code id=the-xml:base-attribute-(xml-only):the-xml:base-attribute-(xml-only)-3><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attribute on <a href=#html-elements id=the-xml:base-attribute-(xml-only):html-elements-2>HTML elements</a> in <a href=#html-documents id=the-xml:base-attribute-(xml-only):html-documents>HTML
- documents</a>.</p>
- <h5 id=the-dir-attribute>3.2.5.6 The <dfn><code>dir</code></dfn> attribute</h5>
- <p>The <code id=the-dir-attribute:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute specifies the element's text directionality.
- The attribute is an <a href=#enumerated-attribute id=the-dir-attribute:enumerated-attribute>enumerated attribute</a> with the following keywords and states:</p>
- <dl><dt>The <dfn id=attr-dir-ltr><code>ltr</code></dfn> keyword, which maps to the <dfn id=attr-dir-ltr-state>ltr</dfn> state<dd>
- <p>Indicates that the contents of the element are explicitly directionally isolated
- left-to-right text.</p>
- <dt>The <dfn id=attr-dir-rtl><code>rtl</code></dfn> keyword, which maps to the <dfn id=attr-dir-rtl-state>rtl</dfn> state<dd>
- <p>Indicates that the contents of the element are explicitly directionally isolated
- right-to-left text.</p>
- <dt>The <dfn id=attr-dir-auto><code>auto</code></dfn> keyword, which maps to the <dfn id=attr-dir-auto-state>auto</dfn> state<dd>
- <p>Indicates that the contents of the element are explicitly directionally isolated text, but
- that the direction is to be determined programmatically using the contents of the element (as
- described below).</p>
- <p class=note>The heuristic used by this state is very crude (it just looks at the first
- character with a strong directionality, in a manner analogous to the Paragraph Level
- determination in the bidirectional algorithm). Authors are urged to only use this value as a
- last resort when the direction of the text is truly unknown and no better server-side heuristic
- can be applied. <a href=#refsBIDI>[BIDI]</a></p>
- <p class=note>For <code id=the-dir-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> and <code id=the-dir-attribute:the-pre-element><a href=#the-pre-element>pre</a></code> elements, the heuristic is
- applied on a per-paragraph level.</p>
- </dl>
- <p>The attribute has no <i id=the-dir-attribute:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i> and no <i id=the-dir-attribute:missing-value-default><a href=#missing-value-default>missing value default</a></i>.</p>
- <hr>
- <p><dfn id=the-directionality>The directionality</dfn> of an element (any element, not just an <a href=#html-elements id=the-dir-attribute:html-elements>HTML element</a>) is either '<dfn id=concept-ltr>ltr</dfn>' or '<dfn id=concept-rtl>rtl</dfn>', and is determined as per the first appropriate set of steps from
- the following list:</p>
- <dl class=switch><dt>If the element's <code id=the-dir-attribute:the-dir-attribute-2><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-ltr-state id=the-dir-attribute:attr-dir-ltr-state>ltr</a> state<dt>If the element is a <a href=#root-element id=the-dir-attribute:root-element>root element</a> and the <code id=the-dir-attribute:the-dir-attribute-3><a href=#the-dir-attribute>dir</a></code>
- attribute is not in a defined state (i.e. it is not present or has an invalid value)<dt>If the element is an <code id=the-dir-attribute:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=the-dir-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#telephone-state-(type=tel)" id="the-dir-attribute:telephone-state-(type=tel)">Telephone</a> state, and the <code id=the-dir-attribute:the-dir-attribute-4><a href=#the-dir-attribute>dir</a></code>
- attribute is not in a defined state (i.e. it is not present or has an invalid value)<dd><p><a href=#the-directionality id=the-dir-attribute:the-directionality>The directionality</a> of the element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr>ltr</a>'.<dt>If the element's <code id=the-dir-attribute:the-dir-attribute-5><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-rtl-state id=the-dir-attribute:attr-dir-rtl-state>rtl</a> state<dd><p><a href=#the-directionality id=the-dir-attribute:the-directionality-2>The directionality</a> of the element is '<a href=#concept-rtl id=the-dir-attribute:concept-rtl>rtl</a>'.<dt>If the element is an <code id=the-dir-attribute:the-input-element-2><a href=#the-input-element>input</a></code> element whose <code id=the-dir-attribute:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-dir-attribute:text-(type=text)-state-and-search-state-(type=search)">Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-dir-attribute:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>,
- <a href="#telephone-state-(type=tel)" id="the-dir-attribute:telephone-state-(type=tel)-2">Telephone</a>, <a href="#url-state-(type=url)" id="the-dir-attribute:url-state-(type=url)">URL</a>, or <a href="#e-mail-state-(type=email)" id="the-dir-attribute:e-mail-state-(type=email)">E-mail</a>
- state, and the <code id=the-dir-attribute:the-dir-attribute-6><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state id=the-dir-attribute:attr-dir-auto-state>auto</a> state<dt>If the element is a <code id=the-dir-attribute:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element and the <code id=the-dir-attribute:the-dir-attribute-7><a href=#the-dir-attribute>dir</a></code>
- attribute is in the <a href=#attr-dir-auto-state id=the-dir-attribute:attr-dir-auto-state-2>auto</a> state<dd>
- <p>If the element's <a href=#concept-fe-value id=the-dir-attribute:concept-fe-value>value</a> contains a character of
- bidirectional character type AL or R, and there is no character of bidirectional character type
- L anywhere before it in the element's <a href=#concept-fe-value id=the-dir-attribute:concept-fe-value-2>value</a>, then
- <a href=#the-directionality id=the-dir-attribute:the-directionality-3>the directionality</a> of the element is '<a href=#concept-rtl id=the-dir-attribute:concept-rtl-2>rtl</a>'. <a href=#refsBIDI>[BIDI]</a></p>
- <p>Otherwise, if the element's <a href=#concept-fe-value id=the-dir-attribute:concept-fe-value-3>value</a> is not the empty
- string, or if the element is a <a href=#root-element id=the-dir-attribute:root-element-2>root element</a>, <a href=#the-directionality id=the-dir-attribute:the-directionality-4>the directionality</a> of the
- element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-2>ltr</a>'.</p>
- <p>Otherwise, <a href=#the-directionality id=the-dir-attribute:the-directionality-5>the directionality</a> of the element is the same as the element's parent
- element's <a href=#the-directionality id=the-dir-attribute:the-directionality-6>directionality</a>.</p>
- <dt>If the element's <code id=the-dir-attribute:the-dir-attribute-8><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state id=the-dir-attribute:attr-dir-auto-state-3>auto</a> state<dt>If the element is a <code id=the-dir-attribute:the-bdi-element><a href=#the-bdi-element>bdi</a></code> element and the <code id=the-dir-attribute:the-dir-attribute-9><a href=#the-dir-attribute>dir</a></code>
- attribute is not in a defined state (i.e. it is not present or has an invalid value)<dd>
- <p>Find the first character in <a href=#tree-order id=the-dir-attribute:tree-order>tree order</a> that matches the following criteria:</p>
- <ul><li><p>The character is from a <code id=the-dir-attribute:text><a href=#text>Text</a></code> node that is a descendant of the element whose
- <a href=#the-directionality id=the-dir-attribute:the-directionality-7>directionality</a> is being determined.<li><p>The character is of bidirectional character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a><li>
- <p>The character is not in a <code id=the-dir-attribute:text-2><a href=#text>Text</a></code> node that has an ancestor element that is a
- descendant of the element whose <a href=#the-directionality id=the-dir-attribute:the-directionality-8>directionality</a> is
- being determined and that is either:</p>
- <ul class=brief><li>A <code id=the-dir-attribute:the-bdi-element-2><a href=#the-bdi-element>bdi</a></code> element.
- <li>A <code id=the-dir-attribute:the-script-element><a href=#the-script-element>script</a></code> element.
- <li>A <code id=the-dir-attribute:the-style-element><a href=#the-style-element>style</a></code> element.
- <li>A <code id=the-dir-attribute:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> element.
- <li>An element with a <code id=the-dir-attribute:the-dir-attribute-10><a href=#the-dir-attribute>dir</a></code> attribute in a defined state.
- </ul>
- </ul>
- <p>If such a character is found and it is of bidirectional character type AL or R, <a href=#the-directionality id=the-dir-attribute:the-directionality-9>the
- directionality</a> of the element is '<a href=#concept-rtl id=the-dir-attribute:concept-rtl-3>rtl</a>'.</p>
- <p>If such a character is found and it is of bidirectional character type L, <a href=#the-directionality id=the-dir-attribute:the-directionality-10>the
- directionality</a> of the element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-3>ltr</a>'.</p>
- <p>Otherwise, if the element is a <a href=#root-element id=the-dir-attribute:root-element-3>root element</a>, <a href=#the-directionality id=the-dir-attribute:the-directionality-11>the directionality</a> of
- the element is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-4>ltr</a>'.</p>
- <p>Otherwise, <a href=#the-directionality id=the-dir-attribute:the-directionality-12>the directionality</a> of the element the same as the element's parent
- element's <a href=#the-directionality id=the-dir-attribute:the-directionality-13>directionality</a>.</p>
- <dt>If the element has a parent element and the <code id=the-dir-attribute:the-dir-attribute-11><a href=#the-dir-attribute>dir</a></code> attribute is
- not in a defined state (i.e. it is not present or has an invalid value)<dd><p><a href=#the-directionality id=the-dir-attribute:the-directionality-14>The directionality</a> of the element is the same as the element's parent
- element's <a href=#the-directionality id=the-dir-attribute:the-directionality-15>directionality</a>.</dl>
- <p class=note>Since the <code id=the-dir-attribute:the-dir-attribute-12><a href=#the-dir-attribute>dir</a></code> attribute is only defined for
- <a href=#html-elements id=the-dir-attribute:html-elements-2>HTML elements</a>, it cannot be present on elements from other namespaces. Thus, elements
- from other namespaces always just inherit their <a href=#the-directionality id=the-dir-attribute:the-directionality-16>directionality</a> from their parent element, or, if they don't have one,
- default to '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-5>ltr</a>'.</p>
-
- <p class=note>This attribute <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <hr>
- <p>The <dfn id=directionality-of-the-attribute>directionality of an attribute</dfn> of an
- <a href=#html-elements id=the-dir-attribute:html-elements-3>HTML element</a>, which is used when the text of that attribute is
- to be included in the rendering in some manner, is determined as per the first appropriate set of
- steps from the following list:</p>
- <dl class=switch><dt>If the attribute is a <a href=#directionality-capable-attribute id=the-dir-attribute:directionality-capable-attribute>directionality-capable attribute</a> and the element's <code id=the-dir-attribute:the-dir-attribute-13><a href=#the-dir-attribute>dir</a></code> attribute is in the <a href=#attr-dir-auto-state id=the-dir-attribute:attr-dir-auto-state-4>auto</a>
- state<dd>
- <p>Find the first character (in logical order) of the attribute's value that is of bidirectional
- character type L, AL, or R. <a href=#refsBIDI>[BIDI]</a></p>
- <p>If such a character is found and it is of bidirectional character type AL or R, the
- <a href=#directionality-of-the-attribute id=the-dir-attribute:directionality-of-the-attribute>directionality of the attribute</a> is '<a href=#concept-rtl id=the-dir-attribute:concept-rtl-4>rtl</a>'.</p>
- <p>Otherwise, the <a href=#directionality-of-the-attribute id=the-dir-attribute:directionality-of-the-attribute-2>directionality of the attribute</a> is '<a href=#concept-ltr id=the-dir-attribute:concept-ltr-6>ltr</a>'.</p>
- <dt>Otherwise<dd>The <a href=#directionality-of-the-attribute id=the-dir-attribute:directionality-of-the-attribute-3>directionality of the attribute</a> is the same as <a href=#the-directionality id=the-dir-attribute:the-directionality-17>the element's directionality</a>.</dl>
- <p>The following attributes are <dfn id=directionality-capable-attribute>directionality-capable attributes</dfn>:</p>
- <ul class=brief><li><code id=the-dir-attribute:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> on <code id=the-dir-attribute:the-th-element><a href=#the-th-element>th</a></code> elements<li><code>alt</code> on <code id=the-dir-attribute:attr-area-alt><a href=#attr-area-alt>area</a></code>,
- <code id=the-dir-attribute:attr-img-alt><a href=#attr-img-alt>img</a></code>, and
- <code id=the-dir-attribute:attr-input-alt><a href=#attr-input-alt>input</a></code> elements<li><code id=the-dir-attribute:attr-meta-content><a href=#attr-meta-content>content</a></code> on <code id=the-dir-attribute:the-meta-element><a href=#the-meta-element>meta</a></code> elements, if the <code id=the-dir-attribute:attr-meta-name><a href=#attr-meta-name>name</a></code> attribute specifies a metadata name whose value is primarily intended to be human-readable rather than machine-readable<li><code>label</code> on <code id=the-dir-attribute:attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>,
- <code id=the-dir-attribute:attr-menu-label><a href=#attr-menu-label>menu</a></code>,
- <code id=the-dir-attribute:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>,
- <code id=the-dir-attribute:attr-option-label><a href=#attr-option-label>option</a></code>, and
- <code id=the-dir-attribute:attr-track-label><a href=#attr-track-label>track</a></code> elements<li><code>placeholder</code> on <code id=the-dir-attribute:attr-input-placeholder><a href=#attr-input-placeholder>input</a></code> and
- <code id=the-dir-attribute:attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code> elements<li><code id=the-dir-attribute:attr-title><a href=#attr-title>title</a></code> on all <a href=#html-elements id=the-dir-attribute:html-elements-4>HTML elements</a></ul>
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=the-dir-attribute:dom-dir><a href=#dom-dir>dir</a></code> [ = <var>value</var> ]<dd>
- <p>Returns <a href=#the-html-element-2 id=the-dir-attribute:the-html-element-2>the <code>html</code> element</a>'s <code id=the-dir-attribute:the-dir-attribute-14><a href=#the-dir-attribute>dir</a></code> attribute's value, if any.</p>
- <p>Can be set, to either "<code>ltr</code>", "<code>rtl</code>", or "<code>auto</code>" to replace <a href=#the-html-element-2 id=the-dir-attribute:the-html-element-2-2>the <code>html</code> element</a>'s <code id=the-dir-attribute:the-dir-attribute-15><a href=#the-dir-attribute>dir</a></code> attribute's value.</p>
- <p>If there is no <a href=#the-html-element-2 id=the-dir-attribute:the-html-element-2-3><code>html</code> element</a>, returns the empty string and ignores new values.</p>
- </dl>
-
- <p>The <dfn id=dom-dir><code>dir</code></dfn> IDL attribute on an element must
- <a href=#reflect id=the-dir-attribute:reflect>reflect</a> the <code id=the-dir-attribute:the-dir-attribute-16><a href=#the-dir-attribute>dir</a></code> content attribute of that element,
- <a href=#limited-to-only-known-values id=the-dir-attribute:limited-to-only-known-values>limited to only known values</a>.</p>
- <p>The <dfn id=dom-document-dir><code>dir</code></dfn> IDL attribute on <code id=the-dir-attribute:document><a href=#document>Document</a></code>
- objects must <a href=#reflect id=the-dir-attribute:reflect-2>reflect</a> the <code id=the-dir-attribute:the-dir-attribute-17><a href=#the-dir-attribute>dir</a></code> content attribute of
- <a href=#the-html-element-2 id=the-dir-attribute:the-html-element-2-4>the <code>html</code> element</a>, if any, <a href=#limited-to-only-known-values id=the-dir-attribute:limited-to-only-known-values-2>limited to only known values</a>. If
- there is no such element, then the attribute must return the empty string and do nothing on
- setting.</p>
-
- <p class=note>Authors are strongly encouraged to use the <code id=the-dir-attribute:the-dir-attribute-18><a href=#the-dir-attribute>dir</a></code>
- attribute to indicate text direction rather than using CSS, since that way their documents will
- continue to render correctly even in the absence of CSS (e.g. as interpreted by search
- engines).</p>
- <div class=example>
- <p>This markup fragment is of an IM conversation.</p>
- <pre><p dir=auto class="u1"><b><bdi>Student</bdi>:</b> How do you write "What's your name?" in Arabic?</p>
- <p dir=auto class="u2"><b><bdi>Teacher</bdi>:</b> ما اسمك؟</p>
- <p dir=auto class="u1"><b><bdi>Student</bdi>:</b> Thanks.</p>
- <p dir=auto class="u2"><b><bdi>Teacher</bdi>:</b> That's written "شكرًا".</p>
- <p dir=auto class="u2"><b><bdi>Teacher</bdi>:</b> Do you know how to write "Please"?</p>
- <p dir=auto class="u1"><b><bdi>Student</bdi>:</b> "من فضلك", right?</p></pre>
- <p>Given a suitable style sheet and the default alignment styles for the <code id=the-dir-attribute:the-p-element><a href=#the-p-element>p</a></code> element,
- namely to align the text to the <i>start edge</i> of the paragraph, the resulting rendering could
- be as follows:</p>
- <p><img width=366 src=http://images.whatwg.org/im.png height=157 alt="Each paragraph rendered as a separate block, with the paragraphs left-aligned except the second paragraph and the last one, which would be right aligned, with the usernames ('Student' and 'Teacher' in this example) flush right, with a colon to their left, and the text first to the left of that."></p>
- <p>As noted earlier, the <code id=the-dir-attribute:attr-dir-auto><a href=#attr-dir-auto>auto</a></code> value is not a panacea. The
- final paragraph in this example is misinterpreted as being right-to-left text, since it begins
- with an Arabic character, which causes the "right?" to be to the left of the Arabic text.</p>
- </div>
- <h5 id=classes>3.2.5.7 The <dfn><code>class</code></dfn> attribute</h5>
- <p>Every <a href=#html-elements id=classes:html-elements>HTML element</a> may have a <code id=classes:classes><a href=#classes>class</a></code> attribute specified.</p>
- <p>The attribute, if specified, must have a value that is a <a href=#set-of-space-separated-tokens id=classes:set-of-space-separated-tokens>set of space-separated
- tokens</a> representing the various classes that the element belongs to.</p>
-
- <p>The classes that an <a href=#html-elements id=classes:html-elements-2>HTML element</a> has assigned to it consists
- of all the classes returned when the value of the <code id=classes:classes-2><a href=#classes>class</a></code> attribute
- is <a href=#split-a-string-on-spaces id=classes:split-a-string-on-spaces>split on spaces</a>. (Duplicates are ignored.)</p>
-
- <p class=note>Assigning classes to an element affects class matching in selectors in CSS, the
- <code id=classes:dom-document-getelementsbyclassname><a href=#dom-document-getelementsbyclassname>getElementsByClassName()</a></code> method in the
- DOM, and other such features.</p>
- <p>There are no additional restrictions on the tokens authors can use in the <code id=classes:classes-3><a href=#classes>class</a></code> attribute, but authors are encouraged to use values that describe
- the nature of the content, rather than values that describe the desired presentation of the
- content.</p>
-
- <hr>
- <p class=note>The <dfn id=dom-classname><code>className</code></dfn> and <dfn id=dom-classlist><code>classList</code></dfn> IDL attributes, defined in the DOM
- specification, <a href=#reflect id=classes:reflect>reflect</a> the <code id=classes:classes-4><a href=#classes>class</a></code> content attribute.
- <a href=#refsDOM>[DOM]</a></p>
-
- <h5 id=the-style-attribute>3.2.5.8 The <dfn><code>style</code></dfn> attribute</h5>
- <p>All <a href=#html-elements id=the-style-attribute:html-elements>HTML elements</a> may have the <code id=the-style-attribute:the-style-attribute><a href=#the-style-attribute>style</a></code> content
- attribute set. This is a <a href=#css-styling-attribute id=the-style-attribute:css-styling-attribute>CSS styling attribute</a> as defined by the CSS Styling
- Attribute Syntax specification. <a href=#refsCSSATTR>[CSSATTR]</a></p>
-
- <p>In user agents that support CSS, the attribute's value must be parsed when the attribute is
- added or has its value changed,
- according to the rules given for <a href=#css-styling-attribute id=the-style-attribute:css-styling-attribute-2>CSS styling
- attributes</a>. <a href=#refsCSSATTR>[CSSATTR]</a></p>
-
- <p>Documents that use <code id=the-style-attribute:the-style-attribute-2><a href=#the-style-attribute>style</a></code> attributes on any of their elements
- must still be comprehensible and usable if those attributes were removed.</p>
- <p class=note>In particular, using the <code id=the-style-attribute:the-style-attribute-3><a href=#the-style-attribute>style</a></code> attribute to hide
- and show content, or to convey meaning that is otherwise not included in the document, is
- non-conforming. (To hide and show content, use the <code id=the-style-attribute:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code>
- attribute.)</p>
- <hr>
- <dl class=domintro><dt><var>element</var> . <code id=the-style-attribute:dom-style><a href=#dom-style>style</a></code><dd>
- <p>Returns a <code id=the-style-attribute:cssstyledeclaration><a href=#cssstyledeclaration>CSSStyleDeclaration</a></code> object for the element's <code id=the-style-attribute:the-style-attribute-4><a href=#the-style-attribute>style</a></code> attribute.</p>
- </dl>
-
- <p>The <dfn id=dom-style><code>style</code></dfn> IDL attribute is defined in the CSS Object
- Model (CSSOM) specification. <a href=#refsCSSOM>[CSSOM]</a></p>
-
- <div class=example>
- <p>In the following example, the words that refer to colours are marked up using the
- <code id=the-style-attribute:the-span-element><a href=#the-span-element>span</a></code> element and the <code id=the-style-attribute:the-style-attribute-5><a href=#the-style-attribute>style</a></code> attribute to make those
- words show up in the relevant colours in visual media.</p>
- <pre><p>My sweat suit is <span style="color: green; background:
- transparent">green</span> and my eyes are <span style="color: blue;
- background: transparent">blue</span>.</p></pre>
- </div>
- <h5 id=embedding-custom-non-visible-data-with-the-data-*-attributes>3.2.5.9 <dfn>Embedding custom non-visible data</dfn> with the <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*><a href=#attr-data-*>data-*</a></code> attributes</h5>
- <p>A <dfn id=custom-data-attribute>custom data attribute</dfn> is an attribute in no namespace whose name starts with the
- string "<dfn id=attr-data-*><code>data-</code></dfn>", has at least one character after the
- hyphen, is <a href=#xml-compatible id=embedding-custom-non-visible-data-with-the-data-*-attributes:xml-compatible>XML-compatible</a>, and contains no <a href=#uppercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters>uppercase ASCII letters</a>.</p>
- <p class=note>All attribute names on <a href=#html-elements id=embedding-custom-non-visible-data-with-the-data-*-attributes:html-elements>HTML elements</a> in <a href=#html-documents id=embedding-custom-non-visible-data-with-the-data-*-attributes:html-documents>HTML documents</a>
- get ASCII-lowercased automatically, so the restriction on ASCII uppercase letters doesn't affect
- such documents.</p>
- <p><a href=#custom-data-attribute id=embedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute>Custom data attributes</a> are intended to store custom
- data private to the page or application, for which there are no more appropriate attributes or
- elements.</p>
- <p>These attributes are not intended for use by software that is not known to the administrators
- of the site that uses the attributes. For generic extensions that are to be used by multiple
- independent tools, either this specification should be extended to provide the feature explicitly,
- or a technology like <a href=#microdata id=embedding-custom-non-visible-data-with-the-data-*-attributes:microdata>microdata</a> should be used (with a standardised vocabulary).</p>
- <div class=example>
- <p>For instance, a site about music could annotate list items representing tracks in an album
- with custom data attributes containing the length of each track. This information could then be
- used by the site itself to allow the user to sort the list by track length, or to filter the list
- for tracks of certain lengths.</p>
- <pre><ol>
- <li data-length="2m11s">Beyond The Sea</li>
- ...
- </ol></pre>
- <p>It would be inappropriate, however, for the user to use generic software not associated with
- that music site to search for tracks of a certain length by looking at this data.</p>
- <p>This is because these attributes are intended for use by the site's own scripts, and are not a
- generic extension mechanism for publicly-usable metadata.</p>
- </div>
- <div class=example>
- <p>Similarly, a page author could write markup that provides information for a translation tool
- that they are intending to use:</p>
- <pre><p>The third <span data-mytrans-de="Anspruch">claim</span> covers the case of <span
- translate="no">HTML</span> markup.</p></pre>
- <p>In this example, the "<code>data-mytrans-de</code>" attribute gives specific text
- for the MyTrans product to use when translating the phrase "claim" to German. However, the
- standard <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:attr-translate><a href=#attr-translate>translate</a></code> attribute is used to tell it that in all
- languages, "HTML" is to remain unchanged. When a standard attribute is available, there is no
- need for a <a href=#custom-data-attribute id=embedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-2>custom data attribute</a> to be used.</p>
- </div>
- <p>Every <a href=#html-elements id=embedding-custom-non-visible-data-with-the-data-*-attributes:html-elements-2>HTML element</a> may have any number of <a href=#custom-data-attribute id=embedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-3>custom data attributes</a> specified, with any value.</p>
- <hr>
- <dl class=domintro><dt><var>element</var> . <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:dom-dataset><a href=#dom-dataset>dataset</a></code><dd>
- <p>Returns a <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-2><a href=#domstringmap-2>DOMStringMap</a></code> object for the element's <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-2><a href=#attr-data-*>data-*</a></code> attributes.</p>
- <p>Hyphenated names become camel-cased. For example, <code>data-foo-bar=""</code>
- becomes <code>element.dataset.fooBar</code>.</p>
- </dl>
-
- <p>The <dfn id=dom-dataset><code>dataset</code></dfn> IDL attribute provides convenient
- accessors for all the <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-3><a href=#attr-data-*>data-*</a></code> attributes on an element. On
- getting, the <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:dom-dataset-2><a href=#dom-dataset>dataset</a></code> IDL attribute must return a
- <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:domstringmap-2-2><a href=#domstringmap-2>DOMStringMap</a></code> object, associated with the following algorithms, which expose these
- attributes on their element:</p>
- <dl><dt>The algorithm for getting the list of name-value pairs<dd>
- <ol><li>Let <var>list</var> be an empty list of name-value
- pairs.<li>For each content attribute on the element whose first five characters are the string "<code>data-</code>" and whose remaining characters (if any) do not include any
- <a href=#uppercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-2>uppercase ASCII letters</a>, in the order that those attributes are listed in the
- element's <a href=#attribute-list id=embedding-custom-non-visible-data-with-the-data-*-attributes:attribute-list>attribute list</a>, add a name-value pair to <var>list</var> whose
- name is the attribute's name with the first five characters removed and whose value is the
- attribute's value.<li>For each name in <var>list</var>, for each U+002D HYPHEN-MINUS character (-) in the
- name that is followed by a <a href=#lowercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:lowercase-ascii-letters>lowercase ASCII letter</a>,
- remove the U+002D HYPHEN-MINUS character (-) and replace the character that followed it by the
- same character <a href=#converted-to-ascii-uppercase id=embedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-uppercase>converted to ASCII uppercase</a>.<li>Return <var>list</var>.</ol>
- <dt>The algorithm for setting names to certain values<dd>
- <ol><li>Let <var>name</var> be the name passed to the algorithm.<li>Let <var>value</var> be the value passed to the algorithm.<li>If <var>name</var> contains a U+002D HYPHEN-MINUS character (-) followed by a
- <a href=#lowercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:lowercase-ascii-letters-2>lowercase ASCII letter</a>, throw a
- <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.<li>For each <a href=#uppercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-3>uppercase ASCII letter</a> in <var>name</var>, insert a U+002D HYPHEN-MINUS character (-) before the character and
- replace the character with the same character <a href=#converted-to-ascii-lowercase id=embedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-lowercase>converted to ASCII lowercase</a>.<li>Insert the string <code>data-</code> at the front of <var>name</var>.<li>Set the value of the attribute with the name <var>name</var>, to the value <var>value</var>, replacing any previous value if the attribute already existed. If <code>setAttribute()</code> would have thrown an exception when setting an attribute with
- the name <var>name</var>, then this must throw the same exception.</ol>
- <dt>The algorithm for deleting names<dd>
- <ol><li>Let <var>name</var> be the name passed to the algorithm.<li>For each <a href=#uppercase-ascii-letters id=embedding-custom-non-visible-data-with-the-data-*-attributes:uppercase-ascii-letters-4>uppercase ASCII letter</a> in <var>name</var>, insert a U+002D HYPHEN-MINUS character (-) before the character and
- replace the character with the same character <a href=#converted-to-ascii-lowercase id=embedding-custom-non-visible-data-with-the-data-*-attributes:converted-to-ascii-lowercase-2>converted to ASCII lowercase</a>.<li>Insert the string <code>data-</code> at the front of <var>name</var>.<li>Remove the attribute with the name <var>name</var>, if such an attribute exists.
- Do nothing otherwise.</ol>
- <p class=note>This algorithm will only get invoked by the Web IDL specification for names that
- are given by the earlier algorithm for getting the list of name-value pairs. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- </dl>
- <p>The same object must be returned each time.</p>
-
- <div class=example>
- <p>If a Web page wanted an element to represent a space ship, e.g. as part of a game, it would
- have to use the <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:classes><a href=#classes>class</a></code> attribute along with <code id=embedding-custom-non-visible-data-with-the-data-*-attributes:attr-data-*-4><a href=#attr-data-*>data-*</a></code> attributes:</p>
- <pre><div class="spaceship" data-ship-id="92432"
- data-weapons="laser 2" data-shields="50%"
- data-x="30" data-y="10" data-z="90">
- <button class="fire"
- onclick="spaceships[this.parentNode.dataset.shipId].fire()">
- Fire
- </button>
- </div></pre>
- <p>Notice how the hyphenated attribute name becomes camel-cased in the API.</p>
- </div>
- <p>Authors should carefully design such extensions so that when the attributes are ignored and any
- associated CSS dropped, the page is still usable.</p>
-
- <p>User agents must not derive any implementation behavior from these attributes or values.
- Specifications intended for user agents must not define these attributes to have any meaningful
- values.</p>
-
- <p>JavaScript libraries may use the <a href=#custom-data-attribute id=embedding-custom-non-visible-data-with-the-data-*-attributes:custom-data-attribute-4>custom data
- attributes</a>, as they are considered to be part of the page on which they are used. Authors
- of libraries that are reused by many authors are encouraged to include their name in the attribute
- names, to reduce the risk of clashes. Where it makes sense, library authors are also encouraged to
- make the exact name used in the attribute names customizable, so that libraries whose authors
- unknowingly picked the same name can be used on the same page, and so that multiple versions of a
- particular library can be used on the same page even when those versions are not mutually
- compatible.</p>
- <div class=example>
- <p>For example, a library called "DoQuery" could use attribute names like <code>data-doquery-range</code>, and a library called "jJo" could use attributes names like
- <code>data-jjo-range</code>. The jJo library could also provide an API to set which
- prefix to use (e.g. <code>J.setDataPrefix('j2')</code>, making the attributes have names
- like <code>data-j2-range</code>).</p>
- </div>
- <h4 id=requirements-relating-to-the-bidirectional-algorithm>3.2.6 Requirements relating to the bidirectional algorithm</h4>
-
- <h5 id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters>3.2.6.1 Authoring conformance criteria for bidirectional-algorithm formatting characters</h5>
-
- <p><a href=#text-content id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:text-content>Text content</a> in <a href=#html-elements id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements>HTML elements</a> with <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:text><a href=#text>Text</a></code> nodes in their
- <a href=#concept-html-contents id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:concept-html-contents>contents</a>, and text in attributes of <a href=#html-elements id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements-2>HTML
- elements</a> that allow free-form text, may contain characters in the ranges U+202A to U+202E
- and U+2066 to U+2069 (the bidirectional-algorithm formatting characters). However, the use of
- these characters is restricted so that any embedding or overrides generated by these characters do
- not start and end with different parent elements, and so that all such embeddings and overrides
- are explicitly terminated by a U+202C POP DIRECTIONAL FORMATTING character. This helps reduce
- incidences of text being reused in a manner that has unforeseen effects on the bidirectional
- algorithm. <a href=#refsBIDI>[BIDI]</a></p>
- <p>The aforementioned restrictions are defined by specifying that certain parts of documents form
- <a href=#bidirectional-algorithm-formatting-character-ranges id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting character ranges</a>, and then imposing a requirement
- on such ranges.</p>
- <p>The strings resulting from applying the following algorithm to an <a href=#html-elements id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements-3>HTML element</a> <var>element</var> are <a href=#bidirectional-algorithm-formatting-character-ranges id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:bidirectional-algorithm-formatting-character-ranges-2>bidirectional-algorithm
- formatting character ranges</a>:</p>
- <ol><li><p>Let <var>output</var> be an empty list of strings.<li><p>Let <var>string</var> be an empty string.<li><p>Let <var>node</var> be the first child node of <var>element</var>, if
- any, or null otherwise.<li><p><i>Loop</i>: If <var>node</var> is null, jump to the step labeled
- <i>end</i>.<li>
- <p>Process <var>node</var> according to the first matching step from the following
- list:</p>
- <dl class=switch><dt>If <var>node</var> is a <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:text-2><a href=#text>Text</a></code> node<dd><p>Append the text data of <var>node</var> to <var>string</var>.<dt>If <var>node</var> is a <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-br-element><a href=#the-br-element>br</a></code> element<dt>If <var>node</var> is an <a href=#html-elements id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements-4>HTML element</a> that is
- <a href=#flow-content-2 id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:flow-content-2>flow content</a> but that is not also <a href=#phrasing-content-2 id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:phrasing-content-2>phrasing content</a><dd><p>If <var>string</var> is not the empty string, push <var>string</var>
- onto <var>output</var>, and let <var>string</var> be empty string.<dt>Otherwise<dd>Do nothing.</dl>
- <li><p>Let <var>node</var> be <var>node</var>'s next sibling, if any, or null
- otherwise.<li><p>Jump to the step labeled <i>loop</i>.<li><p><i>End</i>: If <var>string</var> is not the empty string, push <var>string</var> onto <var>output</var>.<li><p>Return <var>output</var> as the <a href=#bidirectional-algorithm-formatting-character-ranges id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:bidirectional-algorithm-formatting-character-ranges-3>bidirectional-algorithm formatting
- character ranges</a>.</ol>
- <p>The value of a namespace-less attribute of an <a href=#html-elements id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:html-elements-5>HTML element</a>
- is a <a href=#bidirectional-algorithm-formatting-character-ranges id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:bidirectional-algorithm-formatting-character-ranges-4>bidirectional-algorithm
- formatting character range</a>.</p>
- <p>Any strings that, as described above, are <dfn id=bidirectional-algorithm-formatting-character-ranges>bidirectional-algorithm formatting character
- ranges</dfn> must match the <code>string</code> production in the following ABNF, the
- character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
- <pre>string = *( plaintext ( embedding / override / isolation ) ) plaintext
- embedding = ( lre / rle ) string pdf
- override = ( lro / rlo ) string pdf
- isolation = ( lri / rli / fsi ) string pdi
- lre = %x202A ; U+202A LEFT-TO-RIGHT EMBEDDING
- rle = %x202B ; U+202B RIGHT-TO-LEFT EMBEDDING
- lro = %x202D ; U+202D LEFT-TO-RIGHT OVERRIDE
- rlo = %x202E ; U+202E RIGHT-TO-LEFT OVERRIDE
- pdf = %x202C ; U+202C POP DIRECTIONAL FORMATTING
- lri = %x2066 ; U+2066 LEFT-TO-RIGHT ISOLATE
- rli = %x2067 ; U+2067 RIGHT-TO-LEFT ISOLATE
- fsi = %x2068 ; U+2068 FIRST STRONG ISOLATE
- pdi = %x2069 ; U+2069 POP DIRECTIONAL ISOLATE
- plaintext = *( %x0000-2029 / %x202F-2065 / %x206A-10FFFF )
- ; any string with no bidirectional-algorithm formatting characters</pre>
- <p class=note>While the U+2069 POP DIRECTIONAL ISOLATE character implicitly also ends open
- embeddings and overrides, text that relies on this implicit scope closure is not conforming to
- this specification. All strings of embeddings, overrides, and isolations need to be explicitly
- terminated to conform to this section's requirements.</p>
- <p class=note>Authors are encouraged to use the <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute, the
- <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-bdo-element><a href=#the-bdo-element>bdo</a></code> element, and the <code id=authoring-conformance-criteria-for-bidirectional-algorithm-formatting-characters:the-bdi-element><a href=#the-bdi-element>bdi</a></code> element, rather than maintaining the
- bidirectional-algorithm formatting characters manually. The bidirectional-algorithm formatting
- characters interact poorly with CSS.</p>
-
- <h5 id=user-agent-conformance-criteria>3.2.6.2 User agent conformance criteria</h5>
- <p>User agents must implement the Unicode bidirectional algorithm to determine the proper ordering
- of characters when rendering documents and parts of documents. <a href=#refsBIDI>[BIDI]</a></p>
- <p>The mapping of HTML to the Unicode bidirectional algorithm must be done in one of three ways.
- Either the user agent must implement CSS, including in particular the CSS 'unicode-bidi',
- 'direction', and 'content' properties, and must have, in its user agent style sheet, the rules
- using those properties given in this specification's <a href=#rendering>rendering</a> section,
- or, alternatively, the user agent must act as if it implemented just the aforementioned properties
- and had a user agent style sheet that included all the aforementioned rules, but without letting
- style sheets specified in documents override them, or, alternatively, the user agent must
- implement another styling language with equivalent semantics. <a href=#refsCSSWM>[CSSWM]</a> <a href=#refsCSSGC>[CSSGC]</a></p>
- <p id=bidireq>The following elements and attributes have requirements defined by the <a href=#rendering>rendering</a> section that, due to the requirements in this section, are
- requirements on all user agents (not just those that <a href=#renderingUA>support the suggested
- default rendering</a>):</p>
- <ul class=brief><li><code id=user-agent-conformance-criteria:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute<li><code id=user-agent-conformance-criteria:the-bdi-element><a href=#the-bdi-element>bdi</a></code> element<li><code id=user-agent-conformance-criteria:the-bdo-element><a href=#the-bdo-element>bdo</a></code> element<li><code id=user-agent-conformance-criteria:the-br-element><a href=#the-br-element>br</a></code> element<li><code id=user-agent-conformance-criteria:the-pre-element><a href=#the-pre-element>pre</a></code> element<li><code id=user-agent-conformance-criteria:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element<li><code id=user-agent-conformance-criteria:the-wbr-element><a href=#the-wbr-element>wbr</a></code> element</ul>
-
- <h4 id=wai-aria>3.2.7 <dfn>WAI-ARIA</dfn></h4>
- <p>Authors may use the ARIA <code id=wai-aria:attr-aria-role><a href=#attr-aria-role>role</a></code> and <code id=wai-aria:attr-aria-*><a href=#attr-aria-*>aria-*</a></code> attributes on <a href=#html-elements id=wai-aria:html-elements>HTML elements</a>, in accordance with
- the requirements described in the ARIA specifications, except where these conflict with the
- <a id=wai-aria:strong-native-semantics href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header data-x-internal=strong-native-semantics>strong native semantics</a> or are equal to the <a id=wai-aria:default-implicit-aria-semantics href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA
- semantics</a> described below. These exceptions are intended to prevent authors from making
- assistive technology products report nonsensical states that do not represent the actual state of
- the document. <a href=#refsARIA>[ARIA]</a></p>
- <p>Authors must not set the ARIA <code id=wai-aria:attr-aria-role-2><a href=#attr-aria-role>role</a></code> and <code id=wai-aria:attr-aria-*-2><a href=#attr-aria-*>aria-*</a></code> attributes in a manner that conflicts with the semantics
- described in the following table, except that the <code id=wai-aria:attr-aria-role-presentation><a data-x-internal=attr-aria-role-presentation href=http://www.w3.org/TR/wai-aria/roles#presentation>presentation</a></code> role may always be used. Authors must not
- set the ARIA <code id=wai-aria:attr-aria-role-3><a href=#attr-aria-role>role</a></code> and <code id=wai-aria:attr-aria-*-3><a href=#attr-aria-*>aria-*</a></code> attributes to values that match the <a id=wai-aria:default-implicit-aria-semantics-2 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA
- semantics</a> defined in the following two tables.</p>
-
- <p>User agents must implement ARIA semantics on all <a href=#html-elements id=wai-aria:html-elements-2>HTML elements</a>, as defined in the
- ARIA specifications. The <a id=wai-aria:default-implicit-aria-semantics-3 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantics</a> defined below must be
- recognised by implementations for the purposes of ARIA processing. <a href=#refsARIAIMPL>[ARIAIMPL]</a></p>
- <p class=note>The ARIA attributes defined in the ARIA specifications, and the <a id=wai-aria:strong-native-semantics-2 href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header data-x-internal=strong-native-semantics>strong
- native semantics</a> and <a id=wai-aria:default-implicit-aria-semantics-4 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantics</a> defined below, do not
- have any effect on CSS pseudo-class matching, user interface modalities that don't use assistive
- technologies, or the default actions of user interaction events as described in this
- specification.</p>
-
- <p>The following table defines the <a id=wai-aria:strong-native-semantics-3 href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header data-x-internal=strong-native-semantics>strong native semantics</a> and corresponding
- <a id=wai-aria:default-implicit-aria-semantics-5 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantics</a> that apply to <a href=#html-elements id=wai-aria:html-elements-3>HTML elements</a>. Each
- language feature (element or attribute) in a cell in the first column implies the ARIA semantics
- (any role, states, and properties) given in the cell in the second column of the same row. When multiple rows apply to an element, the role from the last row to define a role
- must be applied, and the states and properties from all the rows must be combined.</p>
- <table id=table-aria-strong><thead><tr><th>Language feature
- <th><a id=wai-aria:strong-native-semantics-4 href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header data-x-internal=strong-native-semantics>Strong native semantics</a> and <a id=wai-aria:default-implicit-aria-semantics-6 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantics</a>
- <tbody><tr><td><code id=wai-aria:the-area-element><a href=#the-area-element>area</a></code> element that creates a <a href=#hyperlink id=wai-aria:hyperlink>hyperlink</a>
- <td><code id=wai-aria:attr-aria-role-link><a data-x-internal=attr-aria-role-link href=http://www.w3.org/TR/wai-aria/roles#link>link</a></code> role
- <tr><td><code id=wai-aria:the-base-element><a href=#the-base-element>base</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none>No role</a>
- <tr><td><code id=wai-aria:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element
- <td><code id=wai-aria:attr-aria-role-listbox><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code> role, with the <code id=wai-aria:attr-aria-multiselectable><a data-x-internal=attr-aria-multiselectable href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable>aria-multiselectable</a></code> property set to "false"
- <tr><td><code id=wai-aria:the-details-element><a href=#the-details-element>details</a></code> element
- <td><code id=wai-aria:attr-aria-expanded><a data-x-internal=attr-aria-expanded href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded>aria-expanded</a></code> state set to "true" if the element's
- <code id=wai-aria:attr-details-open><a href=#attr-details-open>open</a></code> attribute is present, and set to "false" otherwise
- <tr><td><code id=wai-aria:the-dialog-element><a href=#the-dialog-element>dialog</a></code> element without an <code id=wai-aria:attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute
- <td>The <code id=wai-aria:attr-aria-hidden><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element
- <td><code id=wai-aria:attr-aria-role-group><a data-x-internal=attr-aria-role-group href=http://www.w3.org/TR/wai-aria/roles#group>group</a></code> role
- <tr><td><code id=wai-aria:the-head-element><a href=#the-head-element>head</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-2>No role</a>, with the <code id=wai-aria:attr-aria-hidden-2><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element
- <td><code id=wai-aria:attr-aria-role-heading><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth>outline
- depth</a>
- <tr><td><code id=wai-aria:the-hr-element><a href=#the-hr-element>hr</a></code> element
- <td><code id=wai-aria:attr-aria-role-separator><a data-x-internal=attr-aria-role-separator href=http://www.w3.org/TR/wai-aria/roles#separator>separator</a></code> role
- <tr><td><code id=wai-aria:the-html-element><a href=#the-html-element>html</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-3>No role</a>
- <tr><td><code id=wai-aria:the-img-element><a href=#the-img-element>img</a></code> element whose <code id=wai-aria:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute's value is empty
- <td><code id=wai-aria:attr-aria-role-presentation-2><a data-x-internal=attr-aria-role-presentation href=http://www.w3.org/TR/wai-aria/roles#presentation>presentation</a></code> role
- <tr><td><code id=wai-aria:the-input-element><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#checkbox-state-(type=checkbox)" id="wai-aria:checkbox-state-(type=checkbox)">Checkbox</a> state
- <td><code id=wai-aria:attr-aria-checked><a data-x-internal=attr-aria-checked href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked>aria-checked</a></code> state set to "mixed" if the element's
- <code id=wai-aria:dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is true, or "true" if
- the element's <a href=#concept-fe-checked id=wai-aria:concept-fe-checked>checkedness</a> is true, or "false" otherwise
- <tr><td><code id=wai-aria:the-input-element-2><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#colour-state-(type=color)" id="wai-aria:colour-state-(type=color)">Colour</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-4>No role</a>
- <tr><td><code id=wai-aria:the-input-element-3><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#date-state-(type=date)" id="wai-aria:date-state-(type=date)">Date</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-5>No role</a>, with the <code id=wai-aria:attr-aria-readonly><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-4><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#date-and-time-state-(type=datetime)" id="wai-aria:date-and-time-state-(type=datetime)">Date and Time</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-6>No role</a>, with the <code id=wai-aria:attr-aria-readonly-2><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-5><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#local-date-and-time-state-(type=datetime-local)" id="wai-aria:local-date-and-time-state-(type=datetime-local)">Local Date and Time</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-7>No role</a>, with the <code id=wai-aria:attr-aria-readonly-3><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-3><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-6><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#e-mail-state-(type=email)" id="wai-aria:e-mail-state-(type=email)">E-mail</a> state with no <a href=#concept-input-list id=wai-aria:concept-input-list>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-textbox><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-4><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-4><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-7><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-7><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#file-upload-state-(type=file)" id="wai-aria:file-upload-state-(type=file)">File Upload</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-8>No role</a>
- <tr><td><code id=wai-aria:the-input-element-8><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-8><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#hidden-state-(type=hidden)" id="wai-aria:hidden-state-(type=hidden)">Hidden</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-9>No role</a>
- <tr><td><code id=wai-aria:the-input-element-9><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-9><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#month-state-(type=month)" id="wai-aria:month-state-(type=month)">Month</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-10>No role</a>, with the <code id=wai-aria:attr-aria-readonly-5><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-5><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-10><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-10><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#number-state-(type=number)" id="wai-aria:number-state-(type=number)">Number</a> state
- <td><code id=wai-aria:attr-aria-role-spinbutton><a data-x-internal=attr-aria-role-spinbutton href=http://www.w3.org/TR/wai-aria/roles#spinbutton>spinbutton</a></code> role, with the <code id=wai-aria:attr-aria-readonly-6><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-6><a href=#attr-input-readonly>readonly</a></code> attribute, the <code id=wai-aria:attr-aria-valuemax><a data-x-internal=attr-aria-valuemax href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax>aria-valuemax</a></code> property set to the element's <a href=#concept-input-max id=wai-aria:concept-input-max>maximum</a>, the <code id=wai-aria:attr-aria-valuemin><a data-x-internal=attr-aria-valuemin href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin>aria-valuemin</a></code> property set to the element's <a href=#concept-input-min id=wai-aria:concept-input-min>minimum</a>, and, if the result of applying the <a href=#rules-for-parsing-floating-point-number-values id=wai-aria:rules-for-parsing-floating-point-number-values>rules for
- parsing floating-point number values</a> to the element's <a href=#concept-fe-value id=wai-aria:concept-fe-value>value</a> is a number, with the <code id=wai-aria:attr-aria-valuenow><a data-x-internal=attr-aria-valuenow href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow>aria-valuenow</a></code> property set to that number
- <tr><td><code id=wai-aria:the-input-element-11><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-11><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#password-state-(type=password)" id="wai-aria:password-state-(type=password)">Password</a> state
- <td><code id=wai-aria:attr-aria-role-textbox-2><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-7><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-7><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-12><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-12><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#radio-button-state-(type=radio)" id="wai-aria:radio-button-state-(type=radio)">Radio Button</a> state
- <td><code id=wai-aria:attr-aria-checked-2><a data-x-internal=attr-aria-checked href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked>aria-checked</a></code> state set to "true" if the element's
- <a href=#concept-fe-checked id=wai-aria:concept-fe-checked-2>checkedness</a> is true, or "false" otherwise
- <tr><td><code id=wai-aria:the-input-element-13><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-13><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#range-state-(type=range)" id="wai-aria:range-state-(type=range)">Range</a> state and the <code id=wai-aria:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute not specified
- <td><code id=wai-aria:attr-aria-role-slider><a data-x-internal=attr-aria-role-slider href=http://www.w3.org/TR/wai-aria/roles#slider>slider</a></code> role, with the <code id=wai-aria:attr-aria-valuemax-2><a data-x-internal=attr-aria-valuemax href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax>aria-valuemax</a></code> property set to the element's <a href=#concept-input-max id=wai-aria:concept-input-max-2>maximum</a>, the <code id=wai-aria:attr-aria-valuemin-2><a data-x-internal=attr-aria-valuemin href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin>aria-valuemin</a></code> property set to the element's <a href=#concept-input-min id=wai-aria:concept-input-min-2>minimum</a>, and the <code id=wai-aria:attr-aria-valuenow-2><a data-x-internal=attr-aria-valuenow href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow>aria-valuenow</a></code> property set to the result of applying the
- <a href=#rules-for-parsing-floating-point-number-values id=wai-aria:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values</a> to the element's <a href=#concept-fe-value id=wai-aria:concept-fe-value-2>value</a>, if that results in a number, or the <a href=#concept-input-value-default-range id=wai-aria:concept-input-value-default-range>default value</a> otherwise
- <tr><td><code id=wai-aria:the-input-element-14><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-14><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#range-state-(type=range)" id="wai-aria:range-state-(type=range)-2">Range</a> state and the <code id=wai-aria:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code> attribute not specified
- <td><code id=wai-aria:attr-aria-valuemax-3><a data-x-internal=attr-aria-valuemax href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax>aria-valuemax</a></code> property set to the element's <a href=#concept-input-max id=wai-aria:concept-input-max-3>maximum</a>, and the <code id=wai-aria:attr-aria-valuemin-3><a data-x-internal=attr-aria-valuemin href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin>aria-valuemin</a></code> property set to the element's <a href=#concept-input-min id=wai-aria:concept-input-min-3>minimum</a>
-
- <tr><td><code id=wai-aria:the-input-element-15><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-15><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#reset-button-state-(type=reset)" id="wai-aria:reset-button-state-(type=reset)">Reset Button</a> state
- <td><code id=wai-aria:attr-aria-role-button><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role
- <tr><td><code id=wai-aria:the-input-element-16><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-16><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="wai-aria:text-(type=text)-state-and-search-state-(type=search)">Search</a> state with no <a href=#concept-input-list id=wai-aria:concept-input-list-2>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-textbox-3><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-8><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-8><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-17><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-17><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#submit-button-state-(type=submit)" id="wai-aria:submit-button-state-(type=submit)">Submit Button</a> state
- <td><code id=wai-aria:attr-aria-role-button-2><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role
- <tr><td><code id=wai-aria:the-input-element-18><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-18><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#telephone-state-(type=tel)" id="wai-aria:telephone-state-(type=tel)">Telephone</a> state with no <a href=#concept-input-list id=wai-aria:concept-input-list-3>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-textbox-4><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-9><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-9><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-19><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-19><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="wai-aria:text-(type=text)-state-and-search-state-(type=search)-2">Text</a> state with no <a href=#concept-input-list id=wai-aria:concept-input-list-4>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-textbox-5><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-10><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-10><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-20><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-20><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="wai-aria:text-(type=text)-state-and-search-state-(type=search)-3">Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" id="wai-aria:text-(type=text)-state-and-search-state-(type=search)-4">Search</a>, <a href="#telephone-state-(type=tel)" id="wai-aria:telephone-state-(type=tel)-2">Telephone</a>, <a href="#url-state-(type=url)" id="wai-aria:url-state-(type=url)">URL</a>, or
- <a href="#e-mail-state-(type=email)" id="wai-aria:e-mail-state-(type=email)-2">E-mail</a> states with a <a href=#concept-input-list id=wai-aria:concept-input-list-5>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-combobox><a data-x-internal=attr-aria-role-combobox href=http://www.w3.org/TR/wai-aria/roles#combobox>combobox</a></code> role, with the <code id=wai-aria:attr-aria-owns><a data-x-internal=attr-aria-owns href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns>aria-owns</a></code> property set to the same value as the <code id=wai-aria:attr-input-list><a href=#attr-input-list>list</a></code> attribute, and the <code id=wai-aria:attr-aria-readonly-11><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-11><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-21><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-21><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#time-state-(type=time)" id="wai-aria:time-state-(type=time)">Time</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-11>No role</a>, with the <code id=wai-aria:attr-aria-readonly-12><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-12><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-22><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-22><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#url-state-(type=url)" id="wai-aria:url-state-(type=url)-2">URL</a> state with no <a href=#concept-input-list id=wai-aria:concept-input-list-6>suggestions source element</a>
- <td><code id=wai-aria:attr-aria-role-textbox-6><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-readonly-13><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-13><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-23><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-23><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#week-state-(type=week)" id="wai-aria:week-state-(type=week)">Week</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-12>No role</a>, with the <code id=wai-aria:attr-aria-readonly-14><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-input-readonly-14><a href=#attr-input-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-input-element-24><a href=#the-input-element>input</a></code> element that is <a href=#concept-input-required id=wai-aria:concept-input-required>required</a>
- <td>The <code id=wai-aria:attr-aria-required><a data-x-internal=attr-aria-required href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-required>aria-required</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-keygen-element><a href=#the-keygen-element>keygen</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-13>No role</a>
- <tr><td><code id=wai-aria:the-label-element><a href=#the-label-element>label</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-14>No role</a>
- <tr><td><code id=wai-aria:the-link-element><a href=#the-link-element>link</a></code> element that creates a <a href=#hyperlink id=wai-aria:hyperlink-2>hyperlink</a>
- <td><code id=wai-aria:attr-aria-role-link-2><a data-x-internal=attr-aria-role-link href=http://www.w3.org/TR/wai-aria/roles#link>link</a></code> role
- <tr><td><code id=wai-aria:the-menu-element><a href=#the-menu-element>menu</a></code> element with a <code id=wai-aria:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute in the
- <a href=#popup-menu-state id=wai-aria:popup-menu-state>popup menu</a> state
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-15>No role</a>
- <tr><td><code id=wai-aria:the-meta-element><a href=#the-meta-element>meta</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-16>No role</a>
- <tr><td><code id=wai-aria:the-meter-element><a href=#the-meter-element>meter</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-17>No role</a>
- <tr><td><code id=wai-aria:the-nav-element><a href=#the-nav-element>nav</a></code> element
- <td><code id=wai-aria:attr-aria-role-navigation><a data-x-internal=attr-aria-role-navigation href=http://www.w3.org/TR/wai-aria/roles#navigation>navigation</a></code> role
- <tr><td><code id=wai-aria:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element, when <span>scripting is enabled</span>
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-18>No role</a>, with the <code id=wai-aria:attr-aria-hidden-3><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-19>No role</a>
- <tr><td><code id=wai-aria:the-option-element><a href=#the-option-element>option</a></code> element that is in a <a href=#concept-select-option-list id=wai-aria:concept-select-option-list>list of
- options</a>
- <td><code id=wai-aria:attr-aria-selected><a data-x-internal=attr-aria-selected href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-selected>aria-selected</a></code> and <code id=wai-aria:attr-aria-checked-3><a data-x-internal=attr-aria-checked href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-checked>aria-checked</a></code> states set to "true" if the element's <a href=#concept-option-selectedness id=wai-aria:concept-option-selectedness>selectedness</a> is true, and "false" otherwise
-
- <tr><td><code id=wai-aria:the-option-element-2><a href=#the-option-element>option</a></code> element that represents a suggestion in a <code id=wai-aria:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code> element
- or that is in a <a href=#concept-select-option-list id=wai-aria:concept-select-option-list-2>list of options</a> of a
- <code id=wai-aria:the-select-element><a href=#the-select-element>select</a></code> element with a <code id=wai-aria:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
- attribute or a <a href=#concept-select-size id=wai-aria:concept-select-size>display size</a> greater than 1
- <td><code id=wai-aria:attr-aria-role-option><a data-x-internal=attr-aria-role-option href=http://www.w3.org/TR/wai-aria/roles#option>option</a></code> role
- <tr><td><code id=wai-aria:the-param-element><a href=#the-param-element>param</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-20>No role</a>
- <tr><td><code id=wai-aria:the-progress-element><a href=#the-progress-element>progress</a></code> element
- <td><code id=wai-aria:attr-aria-role-progressbar><a data-x-internal=attr-aria-role-progressbar href=http://www.w3.org/TR/wai-aria/roles#progressbar>progressbar</a></code> role, with, if the progress bar
- is determinate, the <code id=wai-aria:attr-aria-valuemax-4><a data-x-internal=attr-aria-valuemax href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemax>aria-valuemax</a></code> property set to the
- maximum value of the progress bar, the <code id=wai-aria:attr-aria-valuemin-4><a data-x-internal=attr-aria-valuemin href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuemin>aria-valuemin</a></code>
- property set to zero, and the <code id=wai-aria:attr-aria-valuenow-3><a data-x-internal=attr-aria-valuenow href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-valuenow>aria-valuenow</a></code> property
- set to the current value of the progress bar
- <tr><td><code id=wai-aria:the-script-element><a href=#the-script-element>script</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-21>No role</a>, with the <code id=wai-aria:attr-aria-hidden-4><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-select-element-2><a href=#the-select-element>select</a></code> element with a <code id=wai-aria:attr-select-multiple-2><a href=#attr-select-multiple>multiple</a></code> attribute
- <td><code id=wai-aria:attr-aria-role-listbox-2><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code> role, with the <code id=wai-aria:attr-aria-multiselectable-2><a data-x-internal=attr-aria-multiselectable href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable>aria-multiselectable</a></code> property set to "true"
- <tr><td><code id=wai-aria:the-select-element-3><a href=#the-select-element>select</a></code> element with no <code id=wai-aria:attr-select-multiple-3><a href=#attr-select-multiple>multiple</a></code>
- attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-2>display size</a> equal to 1
- <td><code id=wai-aria:attr-aria-multiselectable-3><a data-x-internal=attr-aria-multiselectable href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable>aria-multiselectable</a></code> property set to "false"
- <tr><td><code id=wai-aria:the-select-element-4><a href=#the-select-element>select</a></code> element with no <code id=wai-aria:attr-select-multiple-4><a href=#attr-select-multiple>multiple</a></code>
- attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-3>display size</a> greater than 1
- <td><code id=wai-aria:attr-aria-role-listbox-3><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code> role, with the <code id=wai-aria:attr-aria-multiselectable-4><a data-x-internal=attr-aria-multiselectable href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiselectable>aria-multiselectable</a></code> property set to "false"
- <tr><td><code id=wai-aria:the-select-element-5><a href=#the-select-element>select</a></code> element with a <code id=wai-aria:attr-select-required><a href=#attr-select-required>required</a></code> attribute
- <td>The <code id=wai-aria:attr-aria-required-2><a data-x-internal=attr-aria-required href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-required>aria-required</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-source-element><a href=#the-source-element>source</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-22>No role</a>
- <tr><td><code id=wai-aria:the-style-element><a href=#the-style-element>style</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-23>No role</a>, with the <code id=wai-aria:attr-aria-hidden-5><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-summary-element><a href=#the-summary-element>summary</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-24>No role</a>
- <tr><td><code id=wai-aria:the-table-element><a href=#the-table-element>table</a></code> element
- <td><code id=wai-aria:attr-aria-role-grid><a data-x-internal=attr-aria-role-grid href=http://www.w3.org/TR/wai-aria/roles#grid>grid</a></code> role with the <code id=wai-aria:attr-aria-readonly-15><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true"
- <tr><td><code id=wai-aria:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element
- <td><code id=wai-aria:attr-aria-role-rowgroup><a data-x-internal=attr-aria-role-rowgroup href=http://www.w3.org/TR/wai-aria/roles#rowgroup>rowgroup</a></code> role
- <tr><td><code id=wai-aria:the-td-element><a href=#the-td-element>td</a></code> element
- <td><code id=wai-aria:attr-aria-role-gridcell><a data-x-internal=attr-aria-role-gridcell href=http://www.w3.org/TR/wai-aria/roles#gridcell>gridcell</a></code> role
- <tr><td><code id=wai-aria:the-template-element><a href=#the-template-element>template</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-25>No role</a>, with the <code id=wai-aria:attr-aria-hidden-6><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element
- <td><code id=wai-aria:attr-aria-role-textbox-7><a data-x-internal=attr-aria-role-textbox href=http://www.w3.org/TR/wai-aria/roles#textbox>textbox</a></code> role, with the <code id=wai-aria:attr-aria-multiline><a data-x-internal=attr-aria-multiline href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-multiline>aria-multiline</a></code> property set to "true", and the <code id=wai-aria:attr-aria-readonly-16><a data-x-internal=attr-aria-readonly href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-readonly>aria-readonly</a></code> property set to "true" if the element has a
- <code id=wai-aria:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute
- <tr><td><code id=wai-aria:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element with a <code id=wai-aria:attr-textarea-required><a href=#attr-textarea-required>required</a></code> attribute
- <td>The <code id=wai-aria:attr-aria-required-3><a data-x-internal=attr-aria-required href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-required>aria-required</a></code> state set to "true"
- <tr><td><code id=wai-aria:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element
- <td><code id=wai-aria:attr-aria-role-rowgroup-2><a data-x-internal=attr-aria-role-rowgroup href=http://www.w3.org/TR/wai-aria/roles#rowgroup>rowgroup</a></code> role
- <tr><td><code id=wai-aria:the-thead-element><a href=#the-thead-element>thead</a></code> element
- <td><code id=wai-aria:attr-aria-role-rowgroup-3><a data-x-internal=attr-aria-role-rowgroup href=http://www.w3.org/TR/wai-aria/roles#rowgroup>rowgroup</a></code> role
- <tr><td><code id=wai-aria:the-th-element><a href=#the-th-element>th</a></code> element that is a <a href=#sorting-capable-th-element id=wai-aria:sorting-capable-th-element>sorting-capable <code>th</code> element</a> whose <a href=#column-key-ordinality id=wai-aria:column-key-ordinality>column key ordinality</a> is 1
- <td><code id=wai-aria:attr-aria-role-columnheader><a data-x-internal=attr-aria-role-columnheader href=http://www.w3.org/TR/wai-aria/roles#columnheader>columnheader</a></code> role, with the <code id=wai-aria:attr-aria-sort><a data-x-internal=attr-aria-sort href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-sort>aria-sort</a></code> state set to "ascending" if the element's <a href=#column-sort-direction id=wai-aria:column-sort-direction>column
- sort direction</a> is <i>normal</i>, and "descending" otherwise.
- <tr><td><code id=wai-aria:the-title-element><a href=#the-title-element>title</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-26>No role</a>
- <tr><td><code id=wai-aria:the-tr-element><a href=#the-tr-element>tr</a></code> element
- <td><code id=wai-aria:attr-aria-role-row><a data-x-internal=attr-aria-role-row href=http://www.w3.org/TR/wai-aria/roles#row>row</a></code> role
- <tr><td>Element that is <a href=#concept-fe-disabled id=wai-aria:concept-fe-disabled>disabled</a>
- <td>The <code id=wai-aria:attr-aria-disabled><a data-x-internal=attr-aria-disabled href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-disabled>aria-disabled</a></code> state set to "true"
- <tr><td>Element that is <a href=#inert id=wai-aria:inert>inert</a>
- <td>The <code id=wai-aria:attr-aria-hidden-7><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td>Element with a <code id=wai-aria:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute
- <td>The <code id=wai-aria:attr-aria-hidden-8><a data-x-internal=attr-aria-hidden href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden>aria-hidden</a></code> state set to "true"
- <tr><td>Element that is a <a href=#candidate-for-constraint-validation id=wai-aria:candidate-for-constraint-validation>candidate for constraint validation</a> but that does not <a href=#concept-fv-valid id=wai-aria:concept-fv-valid>satisfy its constraints</a>
- <td>The <code id=wai-aria:attr-aria-invalid><a data-x-internal=attr-aria-invalid href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-invalid>aria-invalid</a></code> state set to "true"
- </table>
- <p>Some <a href=#html-elements id=wai-aria:html-elements-4>HTML elements</a> have native semantics that can be overridden. The following
- table lists these elements and their <a id=wai-aria:default-implicit-aria-semantics-7 href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantics</a>, along with the
- restrictions that apply to those elements. Each language feature (element or attribute) in a cell
- in the first column implies, unless otherwise overridden, the ARIA semantic (role, state, or
- property) given in the cell in the second column of the same row, but this semantic may be
- overridden under the conditions listed in the cell in the third column of that row. In addition,
- any element may be given the <code id=wai-aria:attr-aria-role-presentation-3><a data-x-internal=attr-aria-role-presentation href=http://www.w3.org/TR/wai-aria/roles#presentation>presentation</a></code> role,
- regardless of the restrictions below.</p>
- <table id=table-aria-weak><thead><tr><th>Language feature
- <th>Default implicit ARIA semantic
- <th>Restrictions
- <tbody><tr><td><code id=wai-aria:the-a-element><a href=#the-a-element>a</a></code> element that creates a <a href=#hyperlink id=wai-aria:hyperlink-3>hyperlink</a>
- <td><code id=wai-aria:attr-aria-role-link-3><a data-x-internal=attr-aria-role-link href=http://www.w3.org/TR/wai-aria/roles#link>link</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-link-4><a data-x-internal=attr-aria-role-link href=http://www.w3.org/TR/wai-aria/roles#link>link</a></code>, <code id=wai-aria:attr-aria-role-menuitem><a data-x-internal=attr-aria-role-menuitem href=http://www.w3.org/TR/wai-aria/roles#menuitem>menuitem</a></code>, <code id=wai-aria:attr-aria-role-tab><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>,
- or <code id=wai-aria:attr-aria-role-treeitem><a data-x-internal=attr-aria-role-treeitem href=http://www.w3.org/TR/wai-aria/roles#treeitem>treeitem</a></code>
- <tr><td><code id=wai-aria:the-address-element><a href=#the-address-element>address</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-27>No role</a>
- <td>If specified, role must be <code id=wai-aria:attr-aria-role-contentinfo><a data-x-internal=attr-aria-role-contentinfo href=http://www.w3.org/TR/wai-aria/roles#contentinfo>contentinfo</a></code>
- <tr><td><code id=wai-aria:the-article-element><a href=#the-article-element>article</a></code> element
- <td><code id=wai-aria:attr-aria-role-article><a data-x-internal=attr-aria-role-article href=http://www.w3.org/TR/wai-aria/roles#article>article</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-article-2><a data-x-internal=attr-aria-role-article href=http://www.w3.org/TR/wai-aria/roles#article>article</a></code>, <code id=wai-aria:attr-aria-role-document><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>, <code id=wai-aria:attr-aria-role-application><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>, or <code id=wai-aria:attr-aria-role-main><a data-x-internal=attr-aria-role-main href=http://www.w3.org/TR/wai-aria/roles#main>main</a></code>
- <tr><td><code id=wai-aria:the-aside-element><a href=#the-aside-element>aside</a></code> element
- <td><code id=wai-aria:attr-aria-role-complementary><a data-x-internal=attr-aria-role-complementary href=http://www.w3.org/TR/wai-aria/roles#complementary>complementary</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-complementary-2><a data-x-internal=attr-aria-role-complementary href=http://www.w3.org/TR/wai-aria/roles#complementary>complementary</a></code>, <code id=wai-aria:attr-aria-role-note><a data-x-internal=attr-aria-role-note href=http://www.w3.org/TR/wai-aria/roles#note>note</a></code>, or <code id=wai-aria:attr-aria-role-search><a data-x-internal=attr-aria-role-search href=http://www.w3.org/TR/wai-aria/roles#search>search</a></code>
- <tr><td><code id=wai-aria:the-audio-element><a href=#the-audio-element>audio</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-28>No role</a>
- <td>If specified, role must be <code id=wai-aria:attr-aria-role-application-2><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>
- <tr><td><code id=wai-aria:the-button-element><a href=#the-button-element>button</a></code> element
- <td><code id=wai-aria:attr-aria-role-button-3><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-button-4><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code>, <code id=wai-aria:attr-aria-role-menuitem-2><a data-x-internal=attr-aria-role-menuitem href=http://www.w3.org/TR/wai-aria/roles#menuitem>menuitem</a></code>
- <tr><td><code id=wai-aria:the-details-element-2><a href=#the-details-element>details</a></code> element
- <td><code id=wai-aria:attr-aria-role-group-2><a data-x-internal=attr-aria-role-group href=http://www.w3.org/TR/wai-aria/roles#group>group</a></code> role
- <td>Role must be a role that supports <code id=wai-aria:attr-aria-expanded-2><a data-x-internal=attr-aria-expanded href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-expanded>aria-expanded</a></code>
- <tr><td><code id=wai-aria:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element
- <td><code id=wai-aria:attr-aria-role-dialog><a data-x-internal=attr-aria-role-dialog href=http://www.w3.org/TR/wai-aria/roles#dialog>dialog</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-alert><a data-x-internal=attr-aria-role-alert href=http://www.w3.org/TR/wai-aria/roles#alert>alert</a></code>,
- <code id=wai-aria:attr-aria-role-alertdialog><a data-x-internal=attr-aria-role-alertdialog href=http://www.w3.org/TR/wai-aria/roles#alertdialog>alertdialog</a></code>,
- <code id=wai-aria:attr-aria-role-application-3><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>,
- <code id=wai-aria:attr-aria-role-contentinfo-2><a data-x-internal=attr-aria-role-contentinfo href=http://www.w3.org/TR/wai-aria/roles#contentinfo>contentinfo</a></code>,
- <code id=wai-aria:attr-aria-role-dialog-2><a data-x-internal=attr-aria-role-dialog href=http://www.w3.org/TR/wai-aria/roles#dialog>dialog</a></code>,
- <code id=wai-aria:attr-aria-role-document-2><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>,
- <code id=wai-aria:attr-aria-role-log><a data-x-internal=attr-aria-role-log href=http://www.w3.org/TR/wai-aria/roles#log>log</a></code>,
- <code id=wai-aria:attr-aria-role-main-2><a data-x-internal=attr-aria-role-main href=http://www.w3.org/TR/wai-aria/roles#main>main</a></code>,
- <code id=wai-aria:attr-aria-role-marquee><a data-x-internal=attr-aria-role-marquee href=http://www.w3.org/TR/wai-aria/roles#marquee>marquee</a></code>,
- <code id=wai-aria:attr-aria-role-region><a data-x-internal=attr-aria-role-region href=http://www.w3.org/TR/wai-aria/roles#region>region</a></code>,
- <code id=wai-aria:attr-aria-role-search-2><a data-x-internal=attr-aria-role-search href=http://www.w3.org/TR/wai-aria/roles#search>search</a></code>, or
- <code id=wai-aria:attr-aria-role-status><a data-x-internal=attr-aria-role-status href=http://www.w3.org/TR/wai-aria/roles#status>status</a></code>
- <tr><td><code id=wai-aria:the-embed-element><a href=#the-embed-element>embed</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-29>No role</a>
- <td>If specified, role must be either <code id=wai-aria:attr-aria-role-application-4><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>, <code id=wai-aria:attr-aria-role-document-3><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>, or <code id=wai-aria:attr-aria-role-img><a data-x-internal=attr-aria-role-img href=http://www.w3.org/TR/wai-aria/roles#img>img</a></code>
- <tr><td><code id=wai-aria:the-footer-element><a href=#the-footer-element>footer</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-30>No role</a>
- <td>If specified, role must be <code id=wai-aria:attr-aria-role-contentinfo-3><a data-x-internal=attr-aria-role-contentinfo href=http://www.w3.org/TR/wai-aria/roles#contentinfo>contentinfo</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-2><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-2><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-2>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-3><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-2><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-3><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-4><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-3><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-3>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-5><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-3><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-4><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-6><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-4><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-4>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-7><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-4><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-5><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-8><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-5><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-5>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-9><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-5><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-6><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-10><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-6><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-6>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-11><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-6><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element that does not have an <code id=wai-aria:the-hgroup-element-7><a href=#the-hgroup-element>hgroup</a></code> ancestor
- <td><code id=wai-aria:attr-aria-role-heading-12><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> role, with the <code id=wai-aria:attr-aria-level-7><a data-x-internal=attr-aria-level href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-level>aria-level</a></code> property set to the element's <a href=#outline-depth id=wai-aria:outline-depth-7>outline
- depth</a>
- <td>Role must be either <code id=wai-aria:attr-aria-role-heading-13><a data-x-internal=attr-aria-role-heading href=http://www.w3.org/TR/wai-aria/roles#heading>heading</a></code> or <code id=wai-aria:attr-aria-role-tab-7><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>
- <tr><td><code id=wai-aria:the-header-element><a href=#the-header-element>header</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-31>No role</a>
- <td>If specified, role must be <code id=wai-aria:attr-aria-role-banner><a data-x-internal=attr-aria-role-banner href=http://www.w3.org/TR/wai-aria/roles#banner>banner</a></code>
- <tr><td><code id=wai-aria:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-32>No role</a>
- <td>If specified, role must be either <code id=wai-aria:attr-aria-role-application-5><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>, <code id=wai-aria:attr-aria-role-document-4><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>, or <code id=wai-aria:attr-aria-role-img-2><a data-x-internal=attr-aria-role-img href=http://www.w3.org/TR/wai-aria/roles#img>img</a></code>
- <tr><td><code id=wai-aria:the-img-element-2><a href=#the-img-element>img</a></code> element whose <code id=wai-aria:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute's value is absent
- <td><code id=wai-aria:attr-aria-role-img-3><a data-x-internal=attr-aria-role-img href=http://www.w3.org/TR/wai-aria/roles#img>img</a></code> role
- <td>No restrictions
- <tr><td><code id=wai-aria:the-img-element-3><a href=#the-img-element>img</a></code> element whose <code id=wai-aria:attr-img-alt-3><a href=#attr-img-alt>alt</a></code> attribute's value is
- present and not empty
- <td><code id=wai-aria:attr-aria-role-img-4><a data-x-internal=attr-aria-role-img href=http://www.w3.org/TR/wai-aria/roles#img>img</a></code> role
- <td>No restrictions
- <tr><td><code id=wai-aria:the-input-element-25><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-24><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#button-state-(type=button)" id="wai-aria:button-state-(type=button)">Button</a> state
- <td><code id=wai-aria:attr-aria-role-button-5><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-button-6><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code>, <code id=wai-aria:attr-aria-role-menuitem-3><a data-x-internal=attr-aria-role-menuitem href=http://www.w3.org/TR/wai-aria/roles#menuitem>menuitem</a></code>
- <tr><td><code id=wai-aria:the-input-element-26><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-25><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#checkbox-state-(type=checkbox)" id="wai-aria:checkbox-state-(type=checkbox)-2">Checkbox</a> state
- <td><code id=wai-aria:attr-aria-role-checkbox><a data-x-internal=attr-aria-role-checkbox href=http://www.w3.org/TR/wai-aria/roles#checkbox>checkbox</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-checkbox-2><a data-x-internal=attr-aria-role-checkbox href=http://www.w3.org/TR/wai-aria/roles#checkbox>checkbox</a></code> or <code id=wai-aria:attr-aria-role-menuitemcheckbox><a data-x-internal=attr-aria-role-menuitemcheckbox href=http://www.w3.org/TR/wai-aria/roles#menuitemcheckbox>menuitemcheckbox</a></code>
- <tr><td><code id=wai-aria:the-input-element-27><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-26><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#image-button-state-(type=image)" id="wai-aria:image-button-state-(type=image)">Image Button</a> state
- <td><code id=wai-aria:attr-aria-role-button-7><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-button-8><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code>, <code id=wai-aria:attr-aria-role-menuitem-4><a data-x-internal=attr-aria-role-menuitem href=http://www.w3.org/TR/wai-aria/roles#menuitem>menuitem</a></code>
- <tr><td><code id=wai-aria:the-input-element-28><a href=#the-input-element>input</a></code> element with a <code id=wai-aria:attr-input-type-27><a href=#attr-input-type>type</a></code> attribute in
- the <a href="#radio-button-state-(type=radio)" id="wai-aria:radio-button-state-(type=radio)-2">Radio Button</a> state
- <td><code id=wai-aria:attr-aria-role-radio><a data-x-internal=attr-aria-role-radio href=http://www.w3.org/TR/wai-aria/roles#radio>radio</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-radio-2><a data-x-internal=attr-aria-role-radio href=http://www.w3.org/TR/wai-aria/roles#radio>radio</a></code> or <code id=wai-aria:attr-aria-role-menuitemradio><a data-x-internal=attr-aria-role-menuitemradio href=http://www.w3.org/TR/wai-aria/roles#menuitemradio>menuitemradio</a></code>
- <tr><td><code id=wai-aria:the-li-element><a href=#the-li-element>li</a></code> element whose parent is an <code id=wai-aria:the-ol-element><a href=#the-ol-element>ol</a></code> or <code id=wai-aria:the-ul-element><a href=#the-ul-element>ul</a></code> element
- <td><code id=wai-aria:attr-aria-role-listitem><a data-x-internal=attr-aria-role-listitem href=http://www.w3.org/TR/wai-aria/roles#listitem>listitem</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-listitem-2><a data-x-internal=attr-aria-role-listitem href=http://www.w3.org/TR/wai-aria/roles#listitem>listitem</a></code>,
- <code id=wai-aria:attr-aria-role-menuitemcheckbox-2><a data-x-internal=attr-aria-role-menuitemcheckbox href=http://www.w3.org/TR/wai-aria/roles#menuitemcheckbox>menuitemcheckbox</a></code>,
- <code id=wai-aria:attr-aria-role-menuitemradio-2><a data-x-internal=attr-aria-role-menuitemradio href=http://www.w3.org/TR/wai-aria/roles#menuitemradio>menuitemradio</a></code>,
- <code id=wai-aria:attr-aria-role-option-2><a data-x-internal=attr-aria-role-option href=http://www.w3.org/TR/wai-aria/roles#option>option</a></code>,
- <code id=wai-aria:attr-aria-role-tab-8><a data-x-internal=attr-aria-role-tab href=http://www.w3.org/TR/wai-aria/roles#tab>tab</a></code>, or
- <code id=wai-aria:attr-aria-role-treeitem-2><a data-x-internal=attr-aria-role-treeitem href=http://www.w3.org/TR/wai-aria/roles#treeitem>treeitem</a></code>
- <tr><td><code id=wai-aria:the-main-element><a href=#the-main-element>main</a></code> element
- <td><code id=wai-aria:attr-aria-role-main-3><a data-x-internal=attr-aria-role-main href=http://www.w3.org/TR/wai-aria/roles#main>main</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-document-5><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>, <code id=wai-aria:attr-aria-role-application-6><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>, or <code id=wai-aria:attr-aria-role-main-4><a data-x-internal=attr-aria-role-main href=http://www.w3.org/TR/wai-aria/roles#main>main</a></code>
- <tr><td><code id=wai-aria:the-menu-element-2><a href=#the-menu-element>menu</a></code> element with a <code id=wai-aria:attr-menu-type-2><a href=#attr-menu-type>type</a></code> attribute in the
- <a href=#toolbar-state id=wai-aria:toolbar-state>toolbar</a> state
- <td><code id=wai-aria:attr-aria-role-toolbar><a data-x-internal=attr-aria-role-toolbar href=http://www.w3.org/TR/wai-aria/roles#toolbar>toolbar</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-directory><a data-x-internal=attr-aria-role-directory href=http://www.w3.org/TR/wai-aria/roles#directory>directory</a></code>, <code id=wai-aria:attr-aria-role-list><a data-x-internal=attr-aria-role-list href=http://www.w3.org/TR/wai-aria/roles#list>list</a></code>, <code id=wai-aria:attr-aria-role-listbox-4><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code>,
- <code id=wai-aria:attr-aria-role-menu><a data-x-internal=attr-aria-role-menu href=http://www.w3.org/TR/wai-aria/roles#menu>menu</a></code>, <code id=wai-aria:attr-aria-role-menubar><a data-x-internal=attr-aria-role-menubar href=http://www.w3.org/TR/wai-aria/roles#menubar>menubar</a></code>, <code id=wai-aria:attr-aria-role-tablist><a data-x-internal=attr-aria-role-tablist href=http://www.w3.org/TR/wai-aria/roles#tablist>tablist</a></code>, <code id=wai-aria:attr-aria-role-toolbar-2><a data-x-internal=attr-aria-role-toolbar href=http://www.w3.org/TR/wai-aria/roles#toolbar>toolbar</a></code>, or <code id=wai-aria:attr-aria-role-tree><a data-x-internal=attr-aria-role-tree href=http://www.w3.org/TR/wai-aria/roles#tree>tree</a></code>
- <tr><td><code id=wai-aria:the-object-element><a href=#the-object-element>object</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-33>No role</a>
- <td>If specified, role must be either <code id=wai-aria:attr-aria-role-application-7><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>, <code id=wai-aria:attr-aria-role-document-6><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>, or <code id=wai-aria:attr-aria-role-img-5><a data-x-internal=attr-aria-role-img href=http://www.w3.org/TR/wai-aria/roles#img>img</a></code>
- <tr><td><code id=wai-aria:the-ol-element-2><a href=#the-ol-element>ol</a></code> element
- <td><code id=wai-aria:attr-aria-role-list-2><a data-x-internal=attr-aria-role-list href=http://www.w3.org/TR/wai-aria/roles#list>list</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-directory-2><a data-x-internal=attr-aria-role-directory href=http://www.w3.org/TR/wai-aria/roles#directory>directory</a></code>,
- <code id=wai-aria:attr-aria-role-group-3><a data-x-internal=attr-aria-role-group href=http://www.w3.org/TR/wai-aria/roles#group>group</a></code>,
- <code id=wai-aria:attr-aria-role-list-3><a data-x-internal=attr-aria-role-list href=http://www.w3.org/TR/wai-aria/roles#list>list</a></code>,
- <code id=wai-aria:attr-aria-role-listbox-5><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code>,
- <code id=wai-aria:attr-aria-role-menu-2><a data-x-internal=attr-aria-role-menu href=http://www.w3.org/TR/wai-aria/roles#menu>menu</a></code>,
- <code id=wai-aria:attr-aria-role-menubar-2><a data-x-internal=attr-aria-role-menubar href=http://www.w3.org/TR/wai-aria/roles#menubar>menubar</a></code>,
- <code id=wai-aria:attr-aria-role-tablist-2><a data-x-internal=attr-aria-role-tablist href=http://www.w3.org/TR/wai-aria/roles#tablist>tablist</a></code>,
- <code id=wai-aria:attr-aria-role-toolbar-3><a data-x-internal=attr-aria-role-toolbar href=http://www.w3.org/TR/wai-aria/roles#toolbar>toolbar</a></code>, or
- <code id=wai-aria:attr-aria-role-tree-2><a data-x-internal=attr-aria-role-tree href=http://www.w3.org/TR/wai-aria/roles#tree>tree</a></code>
- <tr><td><code id=wai-aria:the-option-element-3><a href=#the-option-element>option</a></code> element that is in a <a href=#concept-select-option-list id=wai-aria:concept-select-option-list-3>list of
- options</a> of a <code id=wai-aria:the-select-element-6><a href=#the-select-element>select</a></code> element with no <code id=wai-aria:attr-select-multiple-5><a href=#attr-select-multiple>multiple</a></code> attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-4>display size</a> equal to 1
- <td><code id=wai-aria:attr-aria-role-option-3><a data-x-internal=attr-aria-role-option href=http://www.w3.org/TR/wai-aria/roles#option>option</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-option-4><a data-x-internal=attr-aria-role-option href=http://www.w3.org/TR/wai-aria/roles#option>option</a></code>,
- <code id=wai-aria:attr-aria-role-menuitem-5><a data-x-internal=attr-aria-role-menuitem href=http://www.w3.org/TR/wai-aria/roles#menuitem>menuitem</a></code>,
- <code id=wai-aria:attr-aria-role-menuitemradio-3><a data-x-internal=attr-aria-role-menuitemradio href=http://www.w3.org/TR/wai-aria/roles#menuitemradio>menuitemradio</a></code>, or
- <code id=wai-aria:attr-aria-role-separator-2><a data-x-internal=attr-aria-role-separator href=http://www.w3.org/TR/wai-aria/roles#separator>separator</a></code>
- <tr><td><code id=wai-aria:the-output-element><a href=#the-output-element>output</a></code> element
- <td><code id=wai-aria:attr-aria-role-status-2><a data-x-internal=attr-aria-role-status href=http://www.w3.org/TR/wai-aria/roles#status>status</a></code> role
- <td>No restrictions
- <tr><td><code id=wai-aria:the-section-element><a href=#the-section-element>section</a></code> element
- <td><code id=wai-aria:attr-aria-role-region-2><a data-x-internal=attr-aria-role-region href=http://www.w3.org/TR/wai-aria/roles#region>region</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-alert-2><a data-x-internal=attr-aria-role-alert href=http://www.w3.org/TR/wai-aria/roles#alert>alert</a></code>,
- <code id=wai-aria:attr-aria-role-alertdialog-2><a data-x-internal=attr-aria-role-alertdialog href=http://www.w3.org/TR/wai-aria/roles#alertdialog>alertdialog</a></code>,
- <code id=wai-aria:attr-aria-role-application-8><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>,
- <code id=wai-aria:attr-aria-role-contentinfo-4><a data-x-internal=attr-aria-role-contentinfo href=http://www.w3.org/TR/wai-aria/roles#contentinfo>contentinfo</a></code>,
- <code id=wai-aria:attr-aria-role-dialog-3><a data-x-internal=attr-aria-role-dialog href=http://www.w3.org/TR/wai-aria/roles#dialog>dialog</a></code>,
- <code id=wai-aria:attr-aria-role-document-7><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code>,
- <code id=wai-aria:attr-aria-role-log-2><a data-x-internal=attr-aria-role-log href=http://www.w3.org/TR/wai-aria/roles#log>log</a></code>,
- <code id=wai-aria:attr-aria-role-main-5><a data-x-internal=attr-aria-role-main href=http://www.w3.org/TR/wai-aria/roles#main>main</a></code>,
- <code id=wai-aria:attr-aria-role-marquee-2><a data-x-internal=attr-aria-role-marquee href=http://www.w3.org/TR/wai-aria/roles#marquee>marquee</a></code>,
- <code id=wai-aria:attr-aria-role-region-3><a data-x-internal=attr-aria-role-region href=http://www.w3.org/TR/wai-aria/roles#region>region</a></code>,
- <code id=wai-aria:attr-aria-role-search-3><a data-x-internal=attr-aria-role-search href=http://www.w3.org/TR/wai-aria/roles#search>search</a></code>, or
- <code id=wai-aria:attr-aria-role-status-3><a data-x-internal=attr-aria-role-status href=http://www.w3.org/TR/wai-aria/roles#status>status</a></code>
- <tr><td><code id=wai-aria:the-select-element-7><a href=#the-select-element>select</a></code> element with no <code id=wai-aria:attr-select-multiple-6><a href=#attr-select-multiple>multiple</a></code>
- attribute and with a <a href=#concept-select-size id=wai-aria:concept-select-size-5>display size</a> equal to 1
- <td><code id=wai-aria:attr-aria-role-listbox-6><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-listbox-7><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code> or
- <code id=wai-aria:attr-aria-role-menu-3><a data-x-internal=attr-aria-role-menu href=http://www.w3.org/TR/wai-aria/roles#menu>menu</a></code>
- <tr><td><code id=wai-aria:the-th-element-2><a href=#the-th-element>th</a></code> element that is not a <a href=#sorting-capable-th-element id=wai-aria:sorting-capable-th-element-2>sorting-capable <code>th</code> element</a> or whose <a href=#column-key-ordinality id=wai-aria:column-key-ordinality-2>column key ordinality</a> is not 1
- <td><code id=wai-aria:attr-aria-role-gridcell-2><a data-x-internal=attr-aria-role-gridcell href=http://www.w3.org/TR/wai-aria/roles#gridcell>gridcell</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-columnheader-2><a data-x-internal=attr-aria-role-columnheader href=http://www.w3.org/TR/wai-aria/roles#columnheader>columnheader</a></code>,
- <code id=wai-aria:attr-aria-role-rowheader><a data-x-internal=attr-aria-role-rowheader href=http://www.w3.org/TR/wai-aria/roles#rowheader>rowheader</a></code>, or
- <code id=wai-aria:attr-aria-role-gridcell-3><a data-x-internal=attr-aria-role-gridcell href=http://www.w3.org/TR/wai-aria/roles#gridcell>gridcell</a></code>
- <tr><td><code id=wai-aria:the-ul-element-2><a href=#the-ul-element>ul</a></code> element
- <td><code id=wai-aria:attr-aria-role-list-4><a data-x-internal=attr-aria-role-list href=http://www.w3.org/TR/wai-aria/roles#list>list</a></code> role
- <td>Role must be either
- <code id=wai-aria:attr-aria-role-directory-3><a data-x-internal=attr-aria-role-directory href=http://www.w3.org/TR/wai-aria/roles#directory>directory</a></code>,
- <code id=wai-aria:attr-aria-role-group-4><a data-x-internal=attr-aria-role-group href=http://www.w3.org/TR/wai-aria/roles#group>group</a></code>,
- <code id=wai-aria:attr-aria-role-list-5><a data-x-internal=attr-aria-role-list href=http://www.w3.org/TR/wai-aria/roles#list>list</a></code>,
- <code id=wai-aria:attr-aria-role-listbox-8><a data-x-internal=attr-aria-role-listbox href=http://www.w3.org/TR/wai-aria/roles#listbox>listbox</a></code>,
- <code id=wai-aria:attr-aria-role-menu-4><a data-x-internal=attr-aria-role-menu href=http://www.w3.org/TR/wai-aria/roles#menu>menu</a></code>,
- <code id=wai-aria:attr-aria-role-menubar-3><a data-x-internal=attr-aria-role-menubar href=http://www.w3.org/TR/wai-aria/roles#menubar>menubar</a></code>,
- <code id=wai-aria:attr-aria-role-tablist-3><a data-x-internal=attr-aria-role-tablist href=http://www.w3.org/TR/wai-aria/roles#tablist>tablist</a></code>,
- <code id=wai-aria:attr-aria-role-toolbar-4><a data-x-internal=attr-aria-role-toolbar href=http://www.w3.org/TR/wai-aria/roles#toolbar>toolbar</a></code>, or
- <code id=wai-aria:attr-aria-role-tree-3><a data-x-internal=attr-aria-role-tree href=http://www.w3.org/TR/wai-aria/roles#tree>tree</a></code>
- <tr><td><code id=wai-aria:the-video-element><a href=#the-video-element>video</a></code> element
- <td><a href=#concept-role-none id=wai-aria:concept-role-none-34>No role</a>
- <td>If specified, role must be <code id=wai-aria:attr-aria-role-application-9><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>
- <tr><td><a href=#the-body-element-2 id=wai-aria:the-body-element-2>The body element</a>
- <td><code id=wai-aria:attr-aria-role-document-8><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code> role
- <td>Role must be either <code id=wai-aria:attr-aria-role-document-9><a data-x-internal=attr-aria-role-document href=http://www.w3.org/TR/wai-aria/roles#document>document</a></code> or <code id=wai-aria:attr-aria-role-application-10><a data-x-internal=attr-aria-role-application href=http://www.w3.org/TR/wai-aria/roles#application>application</a></code>
- </table>
- <p>The entry "<dfn id=concept-role-none>no role</dfn>", when used as a <a href=http://www.w3.org/TR/wai-aria/host_languages#host_general_conflict_header id=wai-aria:strong-native-semantics-5 data-x-internal=strong-native-semantics>strong native semantic</a>, means that no role other than <code id=wai-aria:attr-aria-role-presentation-4><a data-x-internal=attr-aria-role-presentation href=http://www.w3.org/TR/wai-aria/roles#presentation>presentation</a></code> can be used. When used as a <a href=http://www.w3.org/TR/wai-aria/host_languages#implicit_semantics id=wai-aria:default-implicit-aria-semantics-8 data-x-internal=default-implicit-aria-semantics>default implicit ARIA semantic</a>, it means the user
- agent has no default mapping to ARIA roles. (However, it probably will have its own mappings to
- the accessibility layer.)</p>
-
- <p>Conformance checkers are encouraged to phrase errors such that authors are encouraged to use
- more appropriate elements rather than remove accessibility annotations. For example, if an
- <code id=wai-aria:the-a-element-2><a href=#the-a-element>a</a></code> element is marked as having the <code id=wai-aria:attr-aria-role-button-9><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code>
- role, a conformance checker could say "Use a more appropriate element to represent a button, for
- example a <code id=wai-aria:the-button-element-2><a href=#the-button-element>button</a></code> element or an <code id=wai-aria:the-input-element-29><a href=#the-input-element>input</a></code> element" rather than "The <code id=wai-aria:attr-aria-role-button-10><a data-x-internal=attr-aria-role-button href=http://www.w3.org/TR/wai-aria/roles#button>button</a></code> role cannot be used with <code id=wai-aria:the-a-element-3><a href=#the-a-element>a</a></code> elements".</p>
-
- <div class=example>
- <p>These features can be used to make accessibility tools render content to their users in more
- useful ways. For example, ASCII art, which is really an image, appears to be text, and in the
- absence of appropriate annotations would end up being rendered by screen readers as a very
- painful reading of lots of punctuation. Using the features described in this section, one can
- instead make the ATs skip the ASCII art and just read the caption:</p>
- <pre><figure <strong>role="img" aria-labelledby="fish-caption"</strong>>
- <pre>
- o .'`/
- ' / (
- O .-'` ` `'-._ .')
- _/ (o) '. .' /
- ) ))) >< <
- `\ |_\ _.' '. \
- '-._ _ .-' '.)
- jgs `\__\
- </pre>
- <figcaption <strong>id="fish-caption"</strong>>
- Joan G. Stark, "<cite>fish</cite>".
- October 1997. ASCII on electrons. 28×8.
- </figcaption>
- </figure>
- </pre>
-
- </div>
- <h2 id=semantics>4 The elements of HTML</h2>
- <h3 id=the-root-element>4.1 The root element</h3>
- <h4 id=the-html-element>4.1.1 The <dfn><code>html</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-html-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-html-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the root element of a document.<dd>Wherever a subdocument fragment is allowed in a compound document.<dt><a href=#concept-element-content-model id=the-html-element:concept-element-content-model>Content model</a>:<dd>A <code id=the-html-element:the-head-element><a href=#the-head-element>head</a></code> element followed by a <code id=the-html-element:the-body-element><a href=#the-body-element>body</a></code> element.<dt><a href=#concept-element-tag-omission id=the-html-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-html-element:the-html-element><a href=#the-html-element>html</a></code> element's <a href=#syntax-start-tag id=the-html-element:syntax-start-tag>start tag</a> can be omitted
- if the first thing inside the <code id=the-html-element:the-html-element-2><a href=#the-html-element>html</a></code> element is not a <a href=#syntax-comments id=the-html-element:syntax-comments>comment</a>.<dd>An <code id=the-html-element:the-html-element-3><a href=#the-html-element>html</a></code> element's <a href=#syntax-end-tag id=the-html-element:syntax-end-tag>end tag</a> can be omitted if
- the <code id=the-html-element:the-html-element-4><a href=#the-html-element>html</a></code> element is not immediately followed by a <a href=#syntax-comments id=the-html-element:syntax-comments-2>comment</a>.<dt><a href=#concept-element-attributes id=the-html-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-html-element:global-attributes>Global attributes</a><dd><code id=the-html-element:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> — <a href=#concept-appcache-manifest id=the-html-element:concept-appcache-manifest>Application cache manifest</a><dt><a href=#concept-element-dom id=the-html-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlhtmlelement>HTMLHtmlElement</dfn> : <a href=#htmlelement id=the-html-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLHtmlElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-html-element:the-html-element-5><a href=#the-html-element>html</a></code> element <a href=#represents id=the-html-element:represents>represents</a> the root of an HTML document.</p>
- <p>Authors are encouraged to specify a <code id=the-html-element:attr-lang><a href=#attr-lang>lang</a></code> attribute on the root
- <code id=the-html-element:the-html-element-6><a href=#the-html-element>html</a></code> element, giving the document's language. This aids speech synthesis tools to
- determine what pronunciations to use, translation tools to determine what rules to use, and so
- forth.</p>
- <p>The <dfn id=attr-html-manifest><code>manifest</code></dfn> attribute gives the address of
- the document's <a href=#application-cache id=the-html-element:application-cache>application cache</a> <a href=#concept-appcache-manifest id=the-html-element:concept-appcache-manifest-2>manifest</a>, if there is one. If the attribute is present,
- the attribute's value must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-html-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
- spaces</a>.</p>
- <p>The <code id=the-html-element:attr-html-manifest-2><a href=#attr-html-manifest>manifest</a></code> attribute only <a href=#concept-appcache-init id=the-html-element:concept-appcache-init>has an effect</a> during the early stages of document load.
- Changing the attribute dynamically thus has no effect (and thus, no DOM API is provided for this
- attribute).</p>
- <p class=note>For the purposes of <a href=#concept-appcache-init id=the-html-element:concept-appcache-init-2>application cache
- selection</a>, later <code id=the-html-element:the-base-element><a href=#the-base-element>base</a></code> elements cannot affect the <a href=#resolve-a-url id=the-html-element:resolve-a-url>resolving of relative URLs</a> in <code id=the-html-element:attr-html-manifest-3><a href=#attr-html-manifest>manifest</a></code>
- attributes, as the attributes are processed before those elements are seen.</p>
- <p class=note>The <code id=the-html-element:dom-applicationcache><a href=#dom-applicationcache>window.applicationCache</a></code> IDL
- attribute provides scripted access to the offline <a href=#application-cache id=the-html-element:application-cache-2>application cache</a> mechanism.</p>
- <div class=example>
- <p>The <code id=the-html-element:the-html-element-7><a href=#the-html-element>html</a></code> element in the following example declares that the document's language
- is English.</p>
- <pre><!DOCTYPE html>
- <strong><html lang="en"></strong>
- <head>
- <title>Swapping Songs</title>
- </head>
- <body>
- <h1>Swapping Songs</h1>
- <p>Tonight I swapped some of the songs I wrote with some friends, who
- gave me some of the songs they wrote. I love sharing my music.</p>
- </body>
- <strong></html></strong></pre>
- </div>
- <h3 id=document-metadata>4.2 Document metadata</h3>
- <h4 id=the-head-element>4.2.1 The <dfn><code>head</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-head-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-head-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the first element in an <code id=the-head-element:the-html-element><a href=#the-html-element>html</a></code> element.<dt><a href=#concept-element-content-model id=the-head-element:concept-element-content-model>Content model</a>:<dd>If the document is <a href=#an-iframe-srcdoc-document id=the-head-element:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a> or if title information is available from a higher-level protocol: Zero or more elements of <a href=#metadata-content-2 id=the-head-element:metadata-content-2>metadata content</a>, of which no more than one is a <code id=the-head-element:the-title-element><a href=#the-title-element>title</a></code> element and no more than one is a <code id=the-head-element:the-base-element><a href=#the-base-element>base</a></code> element.<dd>Otherwise: One or more elements of <a href=#metadata-content-2 id=the-head-element:metadata-content-2-2>metadata content</a>, of which exactly one is a <code id=the-head-element:the-title-element-2><a href=#the-title-element>title</a></code> element and no more than one is a <code id=the-head-element:the-base-element-2><a href=#the-base-element>base</a></code> element.<dt><a href=#concept-element-tag-omission id=the-head-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-head-element:the-head-element><a href=#the-head-element>head</a></code> element's <a href=#syntax-start-tag id=the-head-element:syntax-start-tag>start tag</a> can be omitted if
- the element is empty, or if the first thing inside the <code id=the-head-element:the-head-element-2><a href=#the-head-element>head</a></code> element is an
- element.<dd>A <code id=the-head-element:the-head-element-3><a href=#the-head-element>head</a></code> element's <a href=#syntax-end-tag id=the-head-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-head-element:the-head-element-4><a href=#the-head-element>head</a></code> element is not immediately followed by a <a href=#space-character id=the-head-element:space-character>space character</a> or a <a href=#syntax-comments id=the-head-element:syntax-comments>comment</a>.<dt><a href=#concept-element-attributes id=the-head-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-head-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-head-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlheadelement>HTMLHeadElement</dfn> : <a href=#htmlelement id=the-head-element:htmlelement>HTMLElement</a> {};</pre>
- </dl>
- <p>The <code id=the-head-element:the-head-element-5><a href=#the-head-element>head</a></code> element <a href=#represents id=the-head-element:represents>represents</a> a collection of metadata for the
- <code id=the-head-element:document><a href=#document>Document</a></code>.</p>
- <div class=example>
- <p>The collection of metadata in a <code id=the-head-element:the-head-element-6><a href=#the-head-element>head</a></code> element can be large or small. Here is an
- example of a very short one:</p>
- <pre><!doctype html>
- <html>
- <head>
- <title>A document with a short head</title>
- </head>
- <body>
- ...</pre>
- <p>Here is an example of a longer one:</p>
- <pre><!DOCTYPE HTML>
- <HTML>
- <HEAD>
- <META CHARSET="UTF-8">
- <BASE HREF="http://www.example.com/">
- <TITLE>An application with a long head</TITLE>
- <LINK REL="STYLESHEET" HREF="default.css">
- <LINK REL="STYLESHEET ALTERNATE" HREF="big.css" TITLE="Big Text">
- <SCRIPT SRC="support.js"></SCRIPT>
- <META NAME="APPLICATION-NAME" CONTENT="Long headed application">
- </HEAD>
- <BODY>
- ...</pre>
- </div>
- <p class=note>The <code id=the-head-element:the-title-element-3><a href=#the-title-element>title</a></code> element is a required child in most situations, but when a
- higher-level protocol provides title information, e.g. in the Subject line of an e-mail when HTML
- is used as an e-mail authoring format, the <code id=the-head-element:the-title-element-4><a href=#the-title-element>title</a></code> element can be omitted.</p>
- <h4 id=the-title-element>4.2.2 The <dfn><code>title</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-title-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-title-element:metadata-content-2>Metadata content</a>.<dt><a href=#concept-element-contexts id=the-title-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>In a <code id=the-title-element:the-head-element><a href=#the-head-element>head</a></code> element containing no other <code id=the-title-element:the-title-element><a href=#the-title-element>title</a></code> elements.<dt><a href=#concept-element-content-model id=the-title-element:concept-element-content-model>Content model</a>:<dd><a href=#text-content id=the-title-element:text-content>Text</a> that is not <a href=#inter-element-whitespace id=the-title-element:inter-element-whitespace>inter-element whitespace</a>.<dt><a href=#concept-element-tag-omission id=the-title-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-title-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-title-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-title-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltitleelement>HTMLTitleElement</dfn> : <a href=#htmlelement id=the-title-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-title-text id=the-title-element:dom-title-text>text</a>;
- };</pre>
- </dl>
- <p>The <code id=the-title-element:the-title-element-2><a href=#the-title-element>title</a></code> element <a href=#represents id=the-title-element:represents>represents</a> the document's title or name. Authors
- should use titles that identify their documents even when they are used out of context, for
- example in a user's history or bookmarks, or in search results. The document's title is often
- different from its first heading, since the first heading does not have to stand alone when taken
- out of context.</p>
- <p>There must be no more than one <code id=the-title-element:the-title-element-3><a href=#the-title-element>title</a></code> element per document.</p>
- <p class=note>If it's reasonable for the <code id=the-title-element:document><a href=#document>Document</a></code> to have no title, then the
- <code id=the-title-element:the-title-element-4><a href=#the-title-element>title</a></code> element is probably not required. See the <code id=the-title-element:the-head-element-2><a href=#the-head-element>head</a></code> element's content
- model for a description of when the element is required.</p>
- <dl class=domintro><dt><var>title</var> . <code id=the-title-element:dom-title-text-2><a href=#dom-title-text>text</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the contents of the element, ignoring child nodes that aren't <code id=the-title-element:text><a href=#text>Text</a></code>
- nodes.</p>
- <p>Can be set, to replace the element's children with the given value.</p>
- </dl>
-
- <p>The IDL attribute <dfn id=dom-title-text><code>text</code></dfn> must return a
- concatenation of the contents of all the <code id=the-title-element:text-2><a href=#text>Text</a></code> nodes that are children of the
- <code id=the-title-element:the-title-element-5><a href=#the-title-element>title</a></code> element (ignoring any other nodes such as comments or elements), in <a href=#tree-order id=the-title-element:tree-order>tree order</a>.
- On setting, it must act the same way as the <code id=the-title-element:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
-
- <div class=example>
- <p>Here are some examples of appropriate titles, contrasted with the top-level headings that
- might be used on those same pages.</p>
- <pre> <title>Introduction to The Mating Rituals of Bees</title>
- ...
- <h1>Introduction</h1>
- <p>This companion guide to the highly successful
- <cite>Introduction to Medieval Bee-Keeping</cite> book is...</pre>
- <p>The next page might be a part of the same site. Note how the title describes the subject
- matter unambiguously, while the first heading assumes the reader knows what the context is and
- therefore won't wonder if the dances are Salsa or Waltz:</p>
- <pre> <title>Dances used during bee mating rituals</title>
- ...
- <h1>The Dances</h1></pre>
- </div>
- <p>The string to use as the document's title is given by the <code id=the-title-element:document.title><a href=#document.title>document.title</a></code> IDL attribute.</p>
-
- <p>User agents should use the document's title when referring to the document in their user
- interface. When the contents of a <code id=the-title-element:the-title-element-6><a href=#the-title-element>title</a></code> element are used in this way, <a href=#the-directionality id=the-title-element:the-directionality>the
- directionality</a> of that <code id=the-title-element:the-title-element-7><a href=#the-title-element>title</a></code> element should be used to set the directionality
- of the document's title in the user interface.</p>
-
- <h4 id=the-base-element>4.2.3 The <dfn><code>base</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-base-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-base-element:metadata-content-2>Metadata content</a>.<dt><a href=#concept-element-contexts id=the-base-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>In a <code id=the-base-element:the-head-element><a href=#the-head-element>head</a></code> element containing no other <code id=the-base-element:the-base-element><a href=#the-base-element>base</a></code> elements.<dt><a href=#concept-element-content-model id=the-base-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-base-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-base-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-base-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-base-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-base-element:global-attributes>Global attributes</a><dd><code id=the-base-element:attr-base-href><a href=#attr-base-href>href</a></code> — <a href=#document-base-url id=the-base-element:document-base-url>Document base URL</a><dd><code id=the-base-element:attr-base-target><a href=#attr-base-target>target</a></code> — Default <a href=#browsing-context id=the-base-element:browsing-context>browsing context</a> for <a href=#hyperlink id=the-base-element:hyperlink>hyperlink</a> <a href=#navigate id=the-base-element:navigate>navigation</a> and <a href=#form-submission-2 id=the-base-element:form-submission-2>form submission</a><dt><a href=#concept-element-dom id=the-base-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlbaseelement>HTMLBaseElement</dfn> : <a href=#htmlelement id=the-base-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-base-href id=the-base-element:dom-base-href>href</a>;
- attribute DOMString <a href=#dom-base-target id=the-base-element:dom-base-target>target</a>;
- };</pre>
- </dl>
- <p>The <code id=the-base-element:the-base-element-2><a href=#the-base-element>base</a></code> element allows authors to specify the <a href=#document-base-url id=the-base-element:document-base-url-2>document base URL</a> for
- the purposes of <a href=#resolve-a-url id=the-base-element:resolve-a-url>resolving relative URLs</a>, and the name of the
- default <a href=#browsing-context id=the-base-element:browsing-context-2>browsing context</a> for the purposes of <a href=#following-hyperlinks-2 id=the-base-element:following-hyperlinks-2>following hyperlinks</a>. The
- element does not <a href=#represents id=the-base-element:represents>represent</a> any content beyond this
- information.</p>
- <p>There must be no more than one <code id=the-base-element:the-base-element-3><a href=#the-base-element>base</a></code> element per document.</p>
- <p>A <code id=the-base-element:the-base-element-4><a href=#the-base-element>base</a></code> element must have either an <code id=the-base-element:attr-base-href-2><a href=#attr-base-href>href</a></code>
- attribute, a <code id=the-base-element:attr-base-target-2><a href=#attr-base-target>target</a></code> attribute, or both.</p>
- <p>The <dfn id=attr-base-href><code>href</code></dfn> content attribute, if specified, must
- contain a <a href=#valid-url-potentially-surrounded-by-spaces id=the-base-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>.</p>
- <p>A <code id=the-base-element:the-base-element-5><a href=#the-base-element>base</a></code> element, if it has an <code id=the-base-element:attr-base-href-3><a href=#attr-base-href>href</a></code> attribute,
- must come before any other elements in the tree that have attributes defined as taking <a href=#url id=the-base-element:url>URLs</a>, except the <code id=the-base-element:the-html-element><a href=#the-html-element>html</a></code> element (its <code id=the-base-element:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute isn't affected by <code id=the-base-element:the-base-element-6><a href=#the-base-element>base</a></code>
- elements).</p>
-
- <p class=note>If there are multiple <code id=the-base-element:the-base-element-7><a href=#the-base-element>base</a></code> elements with <code id=the-base-element:attr-base-href-4><a href=#attr-base-href>href</a></code> attributes, all but the first are ignored.</p>
-
- <p>The <dfn id=attr-base-target><code>target</code></dfn> attribute, if specified, must
- contain a <a href=#valid-browsing-context-name-or-keyword id=the-base-element:valid-browsing-context-name-or-keyword>valid browsing context name or keyword</a>, which specifies which
- <a href=#browsing-context id=the-base-element:browsing-context-3>browsing context</a> is to be used as the default when <a href=#hyperlink id=the-base-element:hyperlink-2>hyperlinks</a> and <a href=#the-form-element id=the-base-element:the-form-element>forms</a> in the
- <code id=the-base-element:document><a href=#document>Document</a></code> cause <a href=#navigate id=the-base-element:navigate-2>navigation</a>.</p>
- <p>A <code id=the-base-element:the-base-element-8><a href=#the-base-element>base</a></code> element, if it has a <code id=the-base-element:attr-base-target-3><a href=#attr-base-target>target</a></code>
- attribute, must come before any elements in the tree that represent <a href=#hyperlink id=the-base-element:hyperlink-3>hyperlinks</a>.</p>
-
- <p class=note>If there are multiple <code id=the-base-element:the-base-element-9><a href=#the-base-element>base</a></code> elements with <code id=the-base-element:attr-base-target-4><a href=#attr-base-target>target</a></code> attributes, all but the first are ignored.</p>
- <p>A <code id=the-base-element:the-base-element-10><a href=#the-base-element>base</a></code> element that is the first <code id=the-base-element:the-base-element-11><a href=#the-base-element>base</a></code> element with an <code id=the-base-element:attr-base-href-5><a href=#attr-base-href>href</a></code> content attribute in a particular <code id=the-base-element:document-2><a href=#document>Document</a></code> has a
- <dfn id=frozen-base-url>frozen base URL</dfn>. The <a href=#frozen-base-url id=the-base-element:frozen-base-url>frozen base URL</a> must be <a href=#set-the-frozen-base-url id=the-base-element:set-the-frozen-base-url>set</a>, synchronously, whenever any of the following situations occur:</p>
- <ul class=brief><li>The <code id=the-base-element:the-base-element-12><a href=#the-base-element>base</a></code> element becomes the first <code id=the-base-element:the-base-element-13><a href=#the-base-element>base</a></code> element in <a href=#tree-order id=the-base-element:tree-order>tree
- order</a> with an <code id=the-base-element:attr-base-href-6><a href=#attr-base-href>href</a></code> content attribute in its
- <code id=the-base-element:document-3><a href=#document>Document</a></code>.<li>The <code id=the-base-element:the-base-element-14><a href=#the-base-element>base</a></code> element is the first <code id=the-base-element:the-base-element-15><a href=#the-base-element>base</a></code> element in <a href=#tree-order id=the-base-element:tree-order-2>tree
- order</a> with an <code id=the-base-element:attr-base-href-7><a href=#attr-base-href>href</a></code> content attribute in its
- <code id=the-base-element:document-4><a href=#document>Document</a></code>, and its <code id=the-base-element:attr-base-href-8><a href=#attr-base-href>href</a></code> content attribute is
- changed.</ul>
- <p>To <dfn id=set-the-frozen-base-url>set the frozen base URL</dfn>, <a href=#resolve-a-url id=the-base-element:resolve-a-url-2>resolve</a> the value of
- the element's <code id=the-base-element:attr-base-href-9><a href=#attr-base-href>href</a></code> content attribute relative to the
- <code id=the-base-element:document-5><a href=#document>Document</a></code>'s <a href=#fallback-base-url id=the-base-element:fallback-base-url>fallback base URL</a>; if this is successful, set the
- <a href=#frozen-base-url id=the-base-element:frozen-base-url-2>frozen base URL</a> to the <a href=#resulting-absolute-url id=the-base-element:resulting-absolute-url>resulting absolute URL</a>, otherwise, set the
- <a href=#frozen-base-url id=the-base-element:frozen-base-url-3>frozen base URL</a> to the <a href=#fallback-base-url id=the-base-element:fallback-base-url-2>fallback base URL</a>.</p>
- <p>The <dfn id=dom-base-href><code>href</code></dfn> IDL attribute, on getting, must return
- the result of running the following algorithm:
- <ol><li><p>If the <code id=the-base-element:the-base-element-16><a href=#the-base-element>base</a></code> element has no <code id=the-base-element:attr-base-href-10><a href=#attr-base-href>href</a></code> content
- attribute, then return the <a href=#document-base-url id=the-base-element:document-base-url-3>document base URL</a> and abort these steps.<li><p>Let <var>fallback base url</var> be the <code id=the-base-element:document-6><a href=#document>Document</a></code>'s <a href=#fallback-base-url id=the-base-element:fallback-base-url-3>fallback
- base URL</a>.<li><p>Let <var>url</var> be the value of the <code id=the-base-element:attr-base-href-11><a href=#attr-base-href>href</a></code>
- attribute of the <code id=the-base-element:the-base-element-17><a href=#the-base-element>base</a></code> element.<li><p><a href=#resolve-a-url id=the-base-element:resolve-a-url-3>Resolve</a> <var>url</var> relative to <var>fallback base url</var> (thus, the <code id=the-base-element:the-base-element-18><a href=#the-base-element>base</a></code> <code id=the-base-element:attr-base-href-12><a href=#attr-base-href>href</a></code> attribute isn't affected by <code id=the-base-element:the-xml:base-attribute-(xml-only)><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes or <code id=the-base-element:the-base-element-19><a href=#the-base-element>base</a></code> elements).<li><p>If the previous step was successful, return the resulting <a href=#absolute-url id=the-base-element:absolute-url>absolute URL</a> and
- abort these steps.<li><p>Otherwise, return the empty string.</ol>
- <p>The <code id=the-base-element:dom-base-href-2><a href=#dom-base-href>href</a></code> IDL attribute, on setting, must set the <code id=the-base-element:attr-base-href-13><a href=#attr-base-href>href</a></code> content attribute to the given new value.</p>
- <p>The <dfn id=dom-base-target><code>target</code></dfn> IDL attribute must
- <a href=#reflect id=the-base-element:reflect>reflect</a> the content attribute of the same name.</p>
-
- <div class=example>
- <p>In this example, a <code id=the-base-element:the-base-element-20><a href=#the-base-element>base</a></code> element is used to set the <a href=#document-base-url id=the-base-element:document-base-url-4>document base
- URL</a>:</p>
- <pre><!DOCTYPE html>
- <html>
- <head>
- <title>This is an example for the &lt;base&gt; element</title>
- <base href="http://www.example.com/news/index.html">
- </head>
- <body>
- <p>Visit the <a href="archives.html">archives</a>.</p>
- </body>
- </html></pre>
- <p>The link in the above example would be a link to "<code>http://www.example.com/news/archives.html</code>".</p>
- </div>
- <h4 id=the-link-element>4.2.4 The <dfn><code>link</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-link-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-link-element:metadata-content-2>Metadata content</a>.<dd>If the <code id=the-link-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content-2 id=the-link-element:flow-content-2>flow content</a>.<dd>If the <code id=the-link-element:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content-2 id=the-link-element:phrasing-content-2>phrasing content</a>.<dt><a href=#concept-element-contexts id=the-link-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#metadata-content-2 id=the-link-element:metadata-content-2-2>metadata content</a> is expected.<dd>In a <code id=the-link-element:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code id=the-link-element:the-head-element><a href=#the-head-element>head</a></code> element.<dd>If the <code id=the-link-element:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content-2 id=the-link-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-link-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-link-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-link-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-link-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-link-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-link-element:global-attributes>Global attributes</a><dd><code id=the-link-element:attr-link-href><a href=#attr-link-href>href</a></code> — Address of the <a href=#hyperlink id=the-link-element:hyperlink>hyperlink</a><dd><code id=the-link-element:attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code> — How the element handles crossorigin requests<dd><code id=the-link-element:attr-link-rel><a href=#attr-link-rel>rel</a></code> — Relationship between the document containing the hyperlink and the destination resource<dd><code id=the-link-element:attr-link-media><a href=#attr-link-media>media</a></code> — Applicable media<dd><code id=the-link-element:attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code> — Language of the linked resource<dd><code id=the-link-element:attr-link-type><a href=#attr-link-type>type</a></code> — Hint for the type of the referenced resource<dd><code id=the-link-element:attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> — Sizes of the icons (for <code id=the-link-element:attr-link-rel-2><a href=#attr-link-rel>rel</a></code>="<code id=the-link-element:rel-icon><a href=#rel-icon>icon</a></code>")<dd>Also, the <code id=the-link-element:attr-link-title><a href=#attr-link-title>title</a></code> attribute <a href=#attr-link-title id=the-link-element:attr-link-title-2>has special semantics</a> on this element: Title of the link; alternative style sheet set name.<dt><a href=#concept-element-dom id=the-link-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmllinkelement>HTMLLinkElement</dfn> : <a href=#htmlelement id=the-link-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-link-href id=the-link-element:dom-link-href>href</a>;
- attribute DOMString? <a href=#dom-link-crossorigin id=the-link-element:dom-link-crossorigin>crossOrigin</a>;
- attribute DOMString <a href=#dom-link-rel id=the-link-element:dom-link-rel>rel</a>;
- readonly attribute <a href=#domtokenlist id=the-link-element:domtokenlist>DOMTokenList</a> <a href=#dom-link-rellist id=the-link-element:dom-link-rellist>relList</a>;
- attribute DOMString <a href=#dom-link-media id=the-link-element:dom-link-media>media</a>;
- attribute DOMString <a href=#dom-link-hreflang id=the-link-element:dom-link-hreflang>hreflang</a>;
- attribute DOMString <a href=#dom-link-type id=the-link-element:dom-link-type>type</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=the-link-element:dom-domsettabletokenlist-value>value</a>] readonly attribute <a href=#domsettabletokenlist id=the-link-element:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-link-sizes id=the-link-element:dom-link-sizes>sizes</a>;
- // <a href="#HTMLLinkElement-partial">also has obsolete members</a>
- };
- <a href=#htmllinkelement id=the-link-element:htmllinkelement>HTMLLinkElement</a> implements <a href=#linkstyle id=the-link-element:linkstyle>LinkStyle</a>;</pre>
- </dl>
- <p>The <code id=the-link-element:the-link-element><a href=#the-link-element>link</a></code> element allows authors to link their document to other resources.</p>
- <p>The destination of the link(s) is given by the <dfn id=attr-link-href><code>href</code></dfn> attribute, which must be present and must contain a
- <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-link-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. If the <code id=the-link-element:attr-link-href-2><a href=#attr-link-href>href</a></code> attribute is absent, then the element does not define a
- link.</p>
- <p>A <code id=the-link-element:the-link-element-2><a href=#the-link-element>link</a></code> element must have either a <code id=the-link-element:attr-link-rel-3><a href=#attr-link-rel>rel</a></code> attribute
- or an <code id=the-link-element:names:-the-itemprop-attribute-4><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, but not both.</p>
- <p class=note>If the <code id=the-link-element:attr-link-rel-4><a href=#attr-link-rel>rel</a></code> attribute is used, the element is
- restricted to the <code id=the-link-element:the-head-element-2><a href=#the-head-element>head</a></code> element. When used with the <code id=the-link-element:names:-the-itemprop-attribute-5><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, the element can be used both in the
- <code id=the-link-element:the-head-element-3><a href=#the-head-element>head</a></code> element and in the <code id=the-link-element:the-body-element><a href=#the-body-element>body</a></code> of the page, subject to the constraints of
- the microdata model.</p>
- <p>The types of link indicated (the relationships) are given by the value of the <dfn id=attr-link-rel><code>rel</code></dfn> attribute, which, if present, must have a value that
- is a <a href=#set-of-space-separated-tokens id=the-link-element:set-of-space-separated-tokens>set of space-separated tokens</a>. The <a href=#linkTypes>allowed keywords and
- their meanings</a> are defined in a later section. If the <code id=the-link-element:attr-link-rel-5><a href=#attr-link-rel>rel</a></code> attribute is absent, has no keywords, or if none of the keywords
- used are allowed according to the definitions in this specification, then the element does not
- create any links.</p>
- <p>Two categories of links can be created using the <code id=the-link-element:the-link-element-3><a href=#the-link-element>link</a></code> element: <a href=#external-resource-link id=the-link-element:external-resource-link>Links to external resources</a> and <a href=#hyperlink id=the-link-element:hyperlink-2>hyperlinks</a>. The <a href=#linkTypes>link types section</a> defines
- whether a particular link type is an external resource or a hyperlink. One <code id=the-link-element:the-link-element-4><a href=#the-link-element>link</a></code>
- element can create multiple links (of which some might be external resource links and some might
- be hyperlinks); exactly which and how many links are created depends on the keywords given in the
- <code id=the-link-element:attr-link-rel-6><a href=#attr-link-rel>rel</a></code> attribute. User agents must process the links on a per-link
- basis, not a per-element basis.</p>
- <p class=note>Each link created for a <code id=the-link-element:the-link-element-5><a href=#the-link-element>link</a></code> element is handled separately. For
- instance, if there are two <code id=the-link-element:the-link-element-6><a href=#the-link-element>link</a></code> elements with <code>rel="stylesheet"</code>,
- they each count as a separate external resource, and each is affected by its own attributes
- independently. Similarly, if a single <code id=the-link-element:the-link-element-7><a href=#the-link-element>link</a></code> element has a <code id=the-link-element:attr-link-rel-7><a href=#attr-link-rel>rel</a></code> attribute with the value <code>next stylesheet</code>,
- it creates both a <a href=#hyperlink id=the-link-element:hyperlink-3>hyperlink</a> (for the <code id=the-link-element:link-type-next><a href=#link-type-next>next</a></code> keyword) and
- an <a href=#external-resource-link id=the-link-element:external-resource-link-2>external resource link</a> (for the <code id=the-link-element:link-type-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code>
- keyword), and they are affected by other attributes (such as <code id=the-link-element:attr-link-media-2><a href=#attr-link-media>media</a></code> or <code id=the-link-element:attr-link-title-3><a href=#attr-link-title>title</a></code>)
- differently.</p>
- <div class=example>
- <p>For example, the following <code id=the-link-element:the-link-element-8><a href=#the-link-element>link</a></code> element creates two hyperlinks (to the same
- page):</p>
- <pre><link rel="author license" href="/about"></pre>
- <p>The two links created by this element are one whose semantic is that the target page has
- information about the current page's author, and one whose semantic is that the target page has
- information regarding the license under which the current page is provided.</p>
- </div>
- <p>The <dfn id=attr-link-crossorigin><code>crossorigin</code></dfn> attribute is a <a href=#cors-settings-attribute id=the-link-element:cors-settings-attribute>CORS
- settings attribute</a>. It is intended for use with external resource links.</p>
- <p>The exact behavior for links to external resources depends on the exact relationship, as
- defined for the relevant link type. Some of the attributes control whether or not the external
- resource is to be applied (as defined below).</p>
-
- <p>For external resources that are represented in the DOM (for example, style sheets), the DOM
- representation must be made available (modulo cross-origin restrictions) even if the resource is
- not applied. To <dfn id=concept-link-obtain>obtain the resource</dfn>, the user agent must
- run the following steps:</p>
- <ol><li><p>If the <code id=the-link-element:attr-link-href-3><a href=#attr-link-href>href</a></code> attribute's value is the empty string,
- then abort these steps.<li><p><a href=#resolve-a-url id=the-link-element:resolve-a-url>Resolve</a> the <a href=#url id=the-link-element:url>URL</a> given by the <code id=the-link-element:attr-link-href-4><a href=#attr-link-href>href</a></code> attribute, relative to the element.<li><p>If the previous step fails, then abort these steps.<li>
- <p>Do a <a href=#potentially-cors-enabled-fetch id=the-link-element:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the resulting <a href=#absolute-url id=the-link-element:absolute-url>absolute
- URL</a>, with the <i>mode</i> being the current state of the element's <code id=the-link-element:attr-link-crossorigin-2><a href=#attr-link-crossorigin>crossorigin</a></code> content attribute, the <i>origin</i>
- being the <a href=#origin-2 id=the-link-element:origin-2>origin</a> of the <code id=the-link-element:the-link-element-9><a href=#the-link-element>link</a></code> element's <a id=the-link-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the
- <i>default origin behaviour</i> set to <i>taint</i>.</p>
- <p>The resource obtained in this fashion can be either <a href=#cors-same-origin id=the-link-element:cors-same-origin>CORS-same-origin</a> or
- <a href=#cors-cross-origin id=the-link-element:cors-cross-origin>CORS-cross-origin</a>.</p>
- </ol>
- <p>User agents may opt to only try to obtain such resources when they are needed, instead of
- pro-actively <a href=#fetch id=the-link-element:fetch>fetching</a> all the external resources that are not
- applied.</p>
- <p>The semantics of the protocol used (e.g. HTTP) must be followed when fetching external
- resources. (For example, redirects will be followed and 404 responses will cause the external
- resource to not be applied.)</p>
-
- <p>Once the attempts to obtain the resource and its <a href=#critical-subresources id=the-link-element:critical-subresources>critical subresources</a> are
- complete, the user agent must, if the loads were successful, <a href=#queue-a-task id=the-link-element:queue-a-task>queue a task</a> to
- <a href=#fire-a-simple-event id=the-link-element:fire-a-simple-event>fire a simple event</a> named <code id=the-link-element:event-load><a href=#event-load>load</a></code> at the
- <code id=the-link-element:the-link-element-10><a href=#the-link-element>link</a></code> element, or, if the resource or one of its <a href=#critical-subresources id=the-link-element:critical-subresources-2>critical subresources</a>
- failed to completely load for any reason (e.g. DNS error, HTTP 404 response, a connection being
- prematurely closed, unsupported Content-Type), <a href=#queue-a-task id=the-link-element:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=the-link-element:fire-a-simple-event-2>fire a simple
- event</a> named <code id=the-link-element:event-error><a href=#event-error>error</a></code> at the <code id=the-link-element:the-link-element-11><a href=#the-link-element>link</a></code> element.
- Non-network errors in processing the resource or its subresources (e.g. CSS parse errors, PNG
- decoding errors) are not failures for the purposes of this paragraph.</p>
- <p>The <a href=#task-source id=the-link-element:task-source>task source</a> for these <a href=#concept-task id=the-link-element:concept-task>tasks</a> is the <a href=#dom-manipulation-task-source id=the-link-element:dom-manipulation-task-source>DOM
- manipulation task source</a>.</p>
- <p>The element must <a href=#delay-the-load-event id=the-link-element:delay-the-load-event>delay the load event</a> of the element's <a id=the-link-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> until all the
- attempts to obtain the resource and its <a href=#critical-subresources id=the-link-element:critical-subresources-3>critical subresources</a> are complete.
- (Resources that the user agent has not yet attempted to obtain, e.g. because it is waiting for the
- resource to be needed, do not <a href=#delay-the-load-event id=the-link-element:delay-the-load-event-2>delay the load event</a>.)</p>
- <hr>
- <p id=linkui>Interactive user agents may provide users with a means to <a href=#following-hyperlinks-2 id=the-link-element:following-hyperlinks-2>follow the hyperlinks</a> created using the <code id=the-link-element:the-link-element-12><a href=#the-link-element>link</a></code> element, somewhere
- within their user interface. The exact interface is not defined by this specification, but it
- could include the following information (obtained from the element's attributes, again as defined
- below), in some form or another (possibly simplified), for each hyperlink created with each
- <code id=the-link-element:the-link-element-13><a href=#the-link-element>link</a></code> element in the document:</p>
- <ul><li>The relationship between this document and the resource (given by the <code id=the-link-element:attr-link-rel-8><a href=#attr-link-rel>rel</a></code> attribute)<li>The title of the resource (given by the <code id=the-link-element:attr-link-title-4><a href=#attr-link-title>title</a></code>
- attribute).<li>The address of the resource (given by the <code id=the-link-element:attr-link-href-5><a href=#attr-link-href>href</a></code>
- attribute).<li>The language of the resource (given by the <code id=the-link-element:attr-link-hreflang-2><a href=#attr-link-hreflang>hreflang</a></code>
- attribute).<li>The optimum media for the resource (given by the <code id=the-link-element:attr-link-media-3><a href=#attr-link-media>media</a></code>
- attribute).</ul>
- <p>User agents could also include other information, such as the type of the resource (as given by
- the <code id=the-link-element:attr-link-type-2><a href=#attr-link-type>type</a></code> attribute).</p>
-
- <p class=note>Hyperlinks created with the <code id=the-link-element:the-link-element-14><a href=#the-link-element>link</a></code> element and its <code id=the-link-element:attr-link-rel-9><a href=#attr-link-rel>rel</a></code> attribute apply to the whole page. This contrasts with the <code id=the-link-element:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute of <code id=the-link-element:the-a-element><a href=#the-a-element>a</a></code> and <code id=the-link-element:the-area-element><a href=#the-area-element>area</a></code> elements,
- which indicates the type of a link whose context is given by the link's location within the
- document.</p>
- <p>The <dfn id=attr-link-media><code>media</code></dfn> attribute says which media the
- resource applies to. The value must be a <a href=#valid-media-query-list id=the-link-element:valid-media-query-list>valid media query list</a>.</p>
-
- <p>If the link is a <a href=#hyperlink id=the-link-element:hyperlink-4>hyperlink</a> then the <code id=the-link-element:attr-link-media-4><a href=#attr-link-media>media</a></code>
- attribute is purely advisory, and describes for which media the document in question was
- designed.</p>
- <p>However, if the link is an <a href=#external-resource-link id=the-link-element:external-resource-link-3>external resource link</a>, then the <code id=the-link-element:attr-link-media-5><a href=#attr-link-media>media</a></code> attribute is prescriptive. The user agent must apply the
- external resource when the <code id=the-link-element:attr-link-media-6><a href=#attr-link-media>media</a></code> attribute's value
- <a href=#matches-the-environment id=the-link-element:matches-the-environment>matches the environment</a> and the other relevant conditions apply, and must not apply
- it otherwise.</p>
- <p class=note>The external resource might have further restrictions defined within that limit
- its applicability. For example, a CSS style sheet might have some <code>@media</code>
- blocks. This specification does not override such further restrictions or requirements.</p>
-
- <p id=default-media>The default, if the <code id=the-link-element:attr-link-media-7><a href=#attr-link-media>media</a></code> attribute is
- omitted, is "<code>all</code>", meaning that by default links apply to all media.</p>
- <p>The <dfn id=attr-link-hreflang><code>hreflang</code></dfn> attribute on the
- <code id=the-link-element:the-link-element-15><a href=#the-link-element>link</a></code> element has the same semantics as the <a href=#attr-hyperlink-hreflang id=the-link-element:attr-hyperlink-hreflang><code>hreflang</code> attribute on <code>a</code> and
- <code>area</code> elements</a>.</p>
- <p>The <dfn id=attr-link-type><code>type</code></dfn> attribute gives the <a href=#mime-type id=the-link-element:mime-type>MIME
- type</a> of the linked resource. It is purely advisory. The value must be a <a href=#valid-mime-type id=the-link-element:valid-mime-type>valid MIME
- type</a>.</p>
- <p>For <a href=#external-resource-link id=the-link-element:external-resource-link-4>external resource links</a>, the <code id=the-link-element:attr-link-type-3><a href=#attr-link-type>type</a></code> attribute is used as a hint to user agents so that they can
- avoid fetching resources they do not support. If the attribute is present, then
- the user agent must assume that the resource is of the given type (even if that is not a
- <a href=#valid-mime-type id=the-link-element:valid-mime-type-2>valid MIME type</a>, e.g. the empty string). If the attribute is omitted, but the
- external resource link type has a default type defined, then the user agent must assume that the
- resource is of that type. If the UA does not support the given <a href=#mime-type id=the-link-element:mime-type-2>MIME type</a> for the
- given link relationship, then the UA should not <a href=#concept-link-obtain id=the-link-element:concept-link-obtain>obtain</a>
- the resource; if the UA does support the given <a href=#mime-type id=the-link-element:mime-type-3>MIME type</a> for the given link
- relationship, then the UA should <a href=#concept-link-obtain id=the-link-element:concept-link-obtain-2>obtain</a> the resource at
- the appropriate time as specified for the <a href=#external-resource-link id=the-link-element:external-resource-link-5>external resource link</a>'s particular type.
- If the attribute is omitted, and the external resource link type does not have a default type
- defined, but the user agent would <a href=#concept-link-obtain id=the-link-element:concept-link-obtain-3>obtain</a> the resource if
- the type was known and supported, then the user agent should <a href=#concept-link-obtain id=the-link-element:concept-link-obtain-4>obtain</a> the resource under the assumption that it will be
- supported.</p>
-
- <p>User agents must not consider the <code id=the-link-element:attr-link-type-4><a href=#attr-link-type>type</a></code> attribute
- authoritative — upon fetching the resource, user agents must not use the <code id=the-link-element:attr-link-type-5><a href=#attr-link-type>type</a></code> attribute to determine its actual type. Only the actual type
- (as defined in the next paragraph) is used to determine whether to <em>apply</em> the resource,
- not the aforementioned assumed type.</p>
- <p id=concept-link-type-sniffing>If the external resource link type defines rules for processing
- the resource's <a href=#content-type id=the-link-element:content-type>Content-Type metadata</a>, then those rules apply.
- Otherwise, if the resource is expected to be an image, user agents may apply the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id=the-link-element:content-type-sniffing:-image data-x-internal=content-type-sniffing:-image>image sniffing rules</a>, with the <var>official
- type</var> being the type determined from the resource's <a href=#content-type id=the-link-element:content-type-2>Content-Type
- metadata</a>, and use the resulting sniffed type of the resource as if it was the actual type.
- Otherwise, if neither of these conditions apply or if the user agent opts not to apply the image
- sniffing rules, then the user agent must use the resource's <a href=#content-type id=the-link-element:content-type-3>Content-Type metadata</a> to determine the type of the resource. If there
- is no type metadata, but the external resource link type has a default type defined, then the user
- agent must assume that the resource is of that type.</p>
- <p class=note>The <code id=the-link-element:link-type-stylesheet-2><a href=#link-type-stylesheet>stylesheet</a></code> link type defines rules for
- processing the resource's <a href=#content-type id=the-link-element:content-type-4>Content-Type metadata</a>.</p>
- <p>Once the user agent has established the type of the resource, the user agent must apply the
- resource if it is of a supported type and the other relevant conditions apply, and must ignore the
- resource otherwise.</p>
- <div class=example>
- <p>If a document contains style sheet links labeled as follows:</p>
- <pre><link rel="stylesheet" href="A" type="text/plain">
- <link rel="stylesheet" href="B" type="text/css">
- <link rel="stylesheet" href="C"></pre>
- <p>...then a compliant UA that supported only CSS style sheets would fetch the B and C files, and
- skip the A file (since <code id=the-link-element:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code> is not the <a href=#mime-type id=the-link-element:mime-type-4>MIME type</a> for CSS style
- sheets).</p>
- <p>For files B and C, it would then check the actual types returned by the server. For those that
- are sent as <code id=the-link-element:text/css><a href=#text/css>text/css</a></code>, it would apply the styles, but for those labeled as
- <code id=the-link-element:text/plain-2><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>, or any other type, it would not.</p>
- <p>If one of the two files was returned without a <a href=#content-type id=the-link-element:content-type-5>Content-Type</a> metadata, or with a
- syntactically incorrect type like <code>Content-Type: "null"</code>, then the
- default type for <code id=the-link-element:link-type-stylesheet-3><a href=#link-type-stylesheet>stylesheet</a></code> links would kick in. Since that
- default type is <code>text/css</code>, the style sheet <em>would</em> nonetheless be
- applied.</p>
- </div>
-
- <p>The <dfn id=attr-link-title><code>title</code></dfn> attribute gives the title of the
- link. With one exception, it is purely advisory. The value is text. The exception is for style
- sheet links, where the <code id=the-link-element:attr-link-title-5><a href=#attr-link-title>title</a></code> attribute defines
- <a href=#alternative-style-sheet-sets id=the-link-element:alternative-style-sheet-sets>alternative style sheet sets</a>.</p>
- <p class=note>The <code id=the-link-element:attr-link-title-6><a href=#attr-link-title>title</a></code> attribute on <code id=the-link-element:the-link-element-16><a href=#the-link-element>link</a></code>
- elements differs from the global <code id=the-link-element:attr-title><a href=#attr-title>title</a></code> attribute of most other
- elements in that a link without a title does not inherit the title of the parent element: it
- merely has no title.</p>
- <p>The <code id=the-link-element:attr-link-sizes-2><a href=#attr-link-sizes>sizes</a></code> attribute is used with the <code id=the-link-element:rel-icon-2><a href=#rel-icon>icon</a></code> link type. The attribute must not be specified on <code id=the-link-element:the-link-element-17><a href=#the-link-element>link</a></code>
- elements that do not have a <code id=the-link-element:attr-link-rel-10><a href=#attr-link-rel>rel</a></code> attribute that specifies the
- <code id=the-link-element:rel-icon-3><a href=#rel-icon>icon</a></code> keyword.</p>
-
- <p>The <a href=#activation-behavior id=the-link-element:activation-behavior>activation behavior</a> of <code id=the-link-element:the-link-element-18><a href=#the-link-element>link</a></code> elements that create <a href=#hyperlink id=the-link-element:hyperlink-5>hyperlinks</a> is to run the following steps:</p>
- <ol><li><p>If the <code id=the-link-element:the-link-element-19><a href=#the-link-element>link</a></code> element's <a id=the-link-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-link-element:fully-active>fully active</a>,
- then abort these steps.<li><p><a href=#following-hyperlinks-2 id=the-link-element:following-hyperlinks-2-2>Follow the hyperlink</a> created by the
- <code id=the-link-element:the-link-element-20><a href=#the-link-element>link</a></code> element.</ol>
- <p>HTTP <code id=the-link-element:http-link><a href=#http-link>Link:</a></code> headers, if supported, must be assumed to come
- before any links in the document, in the order that they were given in the HTTP message. These
- headers are to be processed according to the rules given in the relevant specifications. <a href=#refsHTTP>[HTTP]</a> <a href=#refsWEBLINK>[WEBLINK]</a></p>
- <p class=note>Registration of relation types in HTTP Link: headers is distinct from <a href=#linkTypes>HTML link types</a>, and thus their semantics can be different from same-named
- HTML types.</p>
- <p>The IDL attributes <dfn id=dom-link-href><code>href</code></dfn>, <dfn id=dom-link-rel><code>rel</code></dfn>, <dfn id=dom-link-media><code>media</code></dfn>,
- <dfn id=dom-link-hreflang><code>hreflang</code></dfn>, <dfn id=dom-link-type><code>type</code></dfn>, and <dfn id=dom-link-sizes><code>sizes</code></dfn> each must <a href=#reflect id=the-link-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
- <p>The <dfn id=dom-link-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
- <a href=#reflect id=the-link-element:reflect-2>reflect</a> the <code id=the-link-element:attr-link-crossorigin-3><a href=#attr-link-crossorigin>crossorigin</a></code> content attribute.</p>
- <p>The IDL attribute <dfn id=dom-link-rellist><code>relList</code></dfn> must <a href=#reflect id=the-link-element:reflect-3>reflect</a> the <code id=the-link-element:attr-link-rel-11><a href=#attr-link-rel>rel</a></code> content attribute.</p>
-
- <p>The <code id=the-link-element:linkstyle-2><a href=#linkstyle>LinkStyle</a></code> interface is also implemented by this element. <a href=#refsCSSOM>[CSSOM]</a></p>
- <div class=example>
- <p>Here, a set of <code id=the-link-element:the-link-element-21><a href=#the-link-element>link</a></code> elements provide some style sheets:</p>
- <pre><!-- a persistent style sheet -->
- <link rel="stylesheet" href="default.css">
- <!-- the preferred alternate style sheet -->
- <link rel="stylesheet" href="green.css" title="Green styles">
- <!-- some alternate style sheets -->
- <link rel="alternate stylesheet" href="contrast.css" title="High contrast">
- <link rel="alternate stylesheet" href="big.css" title="Big fonts">
- <link rel="alternate stylesheet" href="wide.css" title="Wide screen"></pre>
- </div>
- <div class=example>
- <p>The following example shows how you can specify versions of the page that use alternative
- formats, are aimed at other languages, and that are intended for other media:</p>
- <pre><link rel=alternate href="/en/html" hreflang=en type=text/html title="English HTML">
- <link rel=alternate href="/fr/html" hreflang=fr type=text/html title="French HTML">
- <link rel=alternate href="/en/html/print" hreflang=en type=text/html media=print title="English HTML (for printing)">
- <link rel=alternate href="/fr/html/print" hreflang=fr type=text/html media=print title="French HTML (for printing)">
- <link rel=alternate href="/en/pdf" hreflang=en type=application/pdf title="English PDF">
- <link rel=alternate href="/fr/pdf" hreflang=fr type=application/pdf title="French PDF"></pre>
- </div>
- <h4 id=the-meta-element>4.2.5 The <dfn id=meta><code>meta</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-meta-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-meta-element:metadata-content-2>Metadata content</a>.<dd>If the <code id=the-meta-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#flow-content-2 id=the-meta-element:flow-content-2>flow content</a>.<dd>If the <code id=the-meta-element:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: <a href=#phrasing-content-2 id=the-meta-element:phrasing-content-2>phrasing content</a>.<dt><a href=#concept-element-contexts id=the-meta-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>If the <code id=the-meta-element:attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute is present, or if the element's <code id=the-meta-element:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is in the <a href=#attr-meta-http-equiv-content-type id=the-meta-element:attr-meta-http-equiv-content-type>Encoding declaration state</a>: in a <code id=the-meta-element:the-head-element><a href=#the-head-element>head</a></code> element.<dd>If the <code id=the-meta-element:attr-meta-http-equiv-2><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is present but not in the <a href=#attr-meta-http-equiv-content-type id=the-meta-element:attr-meta-http-equiv-content-type-2>Encoding declaration state</a>: in a <code id=the-meta-element:the-head-element-2><a href=#the-head-element>head</a></code> element.<dd>If the <code id=the-meta-element:attr-meta-http-equiv-3><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is present but not in the <a href=#attr-meta-http-equiv-content-type id=the-meta-element:attr-meta-http-equiv-content-type-3>Encoding declaration state</a>: in a <code id=the-meta-element:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code id=the-meta-element:the-head-element-3><a href=#the-head-element>head</a></code> element.<dd>If the <code id=the-meta-element:attr-meta-name><a href=#attr-meta-name>name</a></code> attribute is present: where <a href=#metadata-content-2 id=the-meta-element:metadata-content-2-2>metadata content</a> is expected.<dd>If the <code id=the-meta-element:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#metadata-content-2 id=the-meta-element:metadata-content-2-3>metadata content</a> is expected.<dd>If the <code id=the-meta-element:names:-the-itemprop-attribute-4><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present: where <a href=#phrasing-content-2 id=the-meta-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-meta-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-meta-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-meta-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-meta-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-meta-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-meta-element:global-attributes>Global attributes</a><dd><code id=the-meta-element:attr-meta-name-2><a href=#attr-meta-name>name</a></code> — Metadata name<dd><code id=the-meta-element:attr-meta-http-equiv-4><a href=#attr-meta-http-equiv>http-equiv</a></code> — Pragma directive<dd><code id=the-meta-element:attr-meta-content><a href=#attr-meta-content>content</a></code> — Value of the element<dd><code id=the-meta-element:attr-meta-charset-2><a href=#attr-meta-charset>charset</a></code> — <a href=#character-encoding-declaration id=the-meta-element:character-encoding-declaration>Character encoding declaration</a><dt><a href=#concept-element-dom id=the-meta-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlmetaelement>HTMLMetaElement</dfn> : <a href=#htmlelement id=the-meta-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-meta-name id=the-meta-element:dom-meta-name>name</a>;
- attribute DOMString <a href=#dom-meta-httpequiv id=the-meta-element:dom-meta-httpequiv>httpEquiv</a>;
- attribute DOMString <a href=#dom-meta-content id=the-meta-element:dom-meta-content>content</a>;
- // <a href="#HTMLMetaElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-meta-element:the-meta-element><a href=#the-meta-element>meta</a></code> element <a href=#represents id=the-meta-element:represents>represents</a> various kinds of metadata that cannot be
- expressed using the <code id=the-meta-element:the-title-element><a href=#the-title-element>title</a></code>, <code id=the-meta-element:the-base-element><a href=#the-base-element>base</a></code>, <code id=the-meta-element:the-link-element><a href=#the-link-element>link</a></code>, <code id=the-meta-element:the-style-element><a href=#the-style-element>style</a></code>,
- and <code id=the-meta-element:the-script-element><a href=#the-script-element>script</a></code> elements.</p>
- <p>The <code id=the-meta-element:the-meta-element-2><a href=#the-meta-element>meta</a></code> element can represent document-level metadata with the <code id=the-meta-element:attr-meta-name-3><a href=#attr-meta-name>name</a></code> attribute, pragma directives with the <code id=the-meta-element:attr-meta-http-equiv-5><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute, and the file's <a href=#character-encoding-declaration id=the-meta-element:character-encoding-declaration-2>character encoding
- declaration</a> when an HTML document is serialised to string form (e.g. for transmission over
- the network or for disk storage) with the <code id=the-meta-element:attr-meta-charset-3><a href=#attr-meta-charset>charset</a></code>
- attribute.</p>
- <p>Exactly one of the <code id=the-meta-element:attr-meta-name-4><a href=#attr-meta-name>name</a></code>, <code id=the-meta-element:attr-meta-http-equiv-6><a href=#attr-meta-http-equiv>http-equiv</a></code>, <code id=the-meta-element:attr-meta-charset-4><a href=#attr-meta-charset>charset</a></code>,
- and <code id=the-meta-element:names:-the-itemprop-attribute-5><a href=#names:-the-itemprop-attribute>itemprop</a></code> attributes must be specified.</p>
- <p>If either <code id=the-meta-element:attr-meta-name-5><a href=#attr-meta-name>name</a></code>, <code id=the-meta-element:attr-meta-http-equiv-7><a href=#attr-meta-http-equiv>http-equiv</a></code>, or <code id=the-meta-element:names:-the-itemprop-attribute-6><a href=#names:-the-itemprop-attribute>itemprop</a></code> is
- specified, then the <code id=the-meta-element:attr-meta-content-2><a href=#attr-meta-content>content</a></code> attribute must also be
- specified. Otherwise, it must be omitted.</p>
- <p>The <dfn id=attr-meta-charset><code>charset</code></dfn> attribute specifies the character
- encoding used by the document. This is a <a href=#character-encoding-declaration id=the-meta-element:character-encoding-declaration-3>character encoding declaration</a>. If the
- attribute is present in an <a href=#xml-documents id=the-meta-element:xml-documents>XML document</a>, its value must be an
- <a href=#ascii-case-insensitive id=the-meta-element:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>UTF-8</code>" (and the
- document is therefore forced to use UTF-8 as its encoding).</p>
- <p class=note>The <code id=the-meta-element:attr-meta-charset-5><a href=#attr-meta-charset>charset</a></code> attribute on the
- <code id=the-meta-element:the-meta-element-3><a href=#the-meta-element>meta</a></code> element has no effect in XML documents, and is only allowed in order to
- facilitate migration to and from XHTML.</p>
- <p>There must not be more than one <code id=the-meta-element:the-meta-element-4><a href=#the-meta-element>meta</a></code> element with a <code id=the-meta-element:attr-meta-charset-6><a href=#attr-meta-charset>charset</a></code> attribute per document.</p>
- <p>The <dfn id=attr-meta-content><code>content</code></dfn> attribute gives the value of the
- document metadata or pragma directive when the element is used for those purposes. The allowed
- values depend on the exact context, as described in subsequent sections of this specification.</p>
- <p>If a <code id=the-meta-element:the-meta-element-5><a href=#the-meta-element>meta</a></code> element has a <dfn id=attr-meta-name><code>name</code></dfn>
- attribute, it sets document metadata. Document metadata is expressed in terms of name-value pairs,
- the <code id=the-meta-element:attr-meta-name-6><a href=#attr-meta-name>name</a></code> attribute on the <code id=the-meta-element:the-meta-element-6><a href=#the-meta-element>meta</a></code> element giving the
- name, and the <code id=the-meta-element:attr-meta-content-3><a href=#attr-meta-content>content</a></code> attribute on the same element giving
- the value. The name specifies what aspect of metadata is being set; valid names and the meaning of
- their values are described in the following sections. If a <code id=the-meta-element:the-meta-element-7><a href=#the-meta-element>meta</a></code> element has no <code id=the-meta-element:attr-meta-content-4><a href=#attr-meta-content>content</a></code> attribute, then the value part of the metadata name-value
- pair is the empty string.</p>
-
- <p>The <dfn id=dom-meta-name><code>name</code></dfn> and <dfn id=dom-meta-content><code>content</code></dfn> IDL attributes must <a href=#reflect id=the-meta-element:reflect>reflect</a> the
- respective content attributes of the same name. The IDL attribute <dfn id=dom-meta-httpequiv><code>httpEquiv</code></dfn> must <a href=#reflect id=the-meta-element:reflect-2>reflect</a> the content
- attribute <code id=the-meta-element:attr-meta-http-equiv-8><a href=#attr-meta-http-equiv>http-equiv</a></code>.</p>
-
- <h5 id=standard-metadata-names>4.2.5.1 Standard metadata names</h5>
- <p>This specification defines a few names for the <code id=standard-metadata-names:attr-meta-name><a href=#attr-meta-name>name</a></code>
- attribute of the <code id=standard-metadata-names:the-meta-element><a href=#the-meta-element>meta</a></code> element.</p>
- <p>Names are case-insensitive<span class=impl>, and must be compared in an <a href=#ascii-case-insensitive id=standard-metadata-names:ascii-case-insensitive>ASCII
- case-insensitive</a> manner</span>.</p>
- <dl><dt><dfn id=meta-application-name><code>application-name</code></dfn><dd>
- <p>The value must be a short free-form string giving the name of the Web application that the
- page represents. If the page is not a Web application, the <code id=standard-metadata-names:meta-application-name><a href=#meta-application-name>application-name</a></code> metadata name must not be used.
- Translations of the Web application's name may be given, using the <code id=standard-metadata-names:attr-lang><a href=#attr-lang>lang</a></code> attribute to specify the language of each name.</p>
- <p>There must not be more than one <code id=standard-metadata-names:the-meta-element-2><a href=#the-meta-element>meta</a></code> element with a given <a href=#language id=standard-metadata-names:language>language</a>
- and with its <code id=standard-metadata-names:attr-meta-name-2><a href=#attr-meta-name>name</a></code> attribute set to the value <code id=standard-metadata-names:meta-application-name-2><a href=#meta-application-name>application-name</a></code> per document.</p>
-
- <p>User agents may use the application name in UI in preference to the page's
- <code id=standard-metadata-names:the-title-element><a href=#the-title-element>title</a></code>, since the title might include status messages and the like relevant to the
- status of the page at a particular moment in time instead of just being the name of the
- application.</p>
- <p>To find the application name to use given an ordered list of languages (e.g. British English,
- American English, and English), user agents must run the following steps:</p>
- <ol><li><p>Let <var>languages</var> be the list of languages.<li><p>Let <var>default language</var> be the <a href=#language id=standard-metadata-names:language-2>language</a> of the
- <code id=standard-metadata-names:document><a href=#document>Document</a></code>'s <a href=#root-element-of-a-document-object id=standard-metadata-names:root-element-of-a-document-object>root element</a>,
- if any, and if that language is not unknown.</p>
- <li><p>If there is a <var>default language</var>, and if it is not the same language
- as any of the languages in <var>languages</var>, append it to <var>languages</var>.<li>
- <p>Let <var>winning language</var> be the first language in <var>languages</var> for which there is a <code id=standard-metadata-names:the-meta-element-3><a href=#the-meta-element>meta</a></code> element in the
- <code id=standard-metadata-names:document-2><a href=#document>Document</a></code> that has its <code id=standard-metadata-names:attr-meta-name-3><a href=#attr-meta-name>name</a></code> attribute set to
- the value <code id=standard-metadata-names:meta-application-name-3><a href=#meta-application-name>application-name</a></code> and whose
- <a href=#language id=standard-metadata-names:language-3>language</a> is the language in question.</p>
- <p>If none of the languages have such a <code id=standard-metadata-names:the-meta-element-4><a href=#the-meta-element>meta</a></code> element, then abort these steps;
- there's no given application name.</p>
- <li>
- <p>Return the value of the <code id=standard-metadata-names:attr-meta-content><a href=#attr-meta-content>content</a></code> attribute of the
- first <code id=standard-metadata-names:the-meta-element-5><a href=#the-meta-element>meta</a></code> element in the <code id=standard-metadata-names:document-3><a href=#document>Document</a></code> in <a href=#tree-order id=standard-metadata-names:tree-order>tree order</a> that
- has its <code id=standard-metadata-names:attr-meta-name-4><a href=#attr-meta-name>name</a></code> attribute set to the value <code id=standard-metadata-names:meta-application-name-4><a href=#meta-application-name>application-name</a></code> and whose <a href=#language id=standard-metadata-names:language-4>language</a> is <var>winning language</var>.</p>
- </ol>
- <p class=note>This algorithm would be used by a browser when it needs a name for the page, for
- instance, to label a bookmark. The languages it would provide to the algorithm would be the
- user's preferred languages.</p>
-
- <dt><dfn id=meta-author><code>author</code></dfn><dd><p>The value must be a free-form string giving the name of one of the page's
- authors.<dt><dfn id=meta-description><code>description</code></dfn><dd><p>The value must be a free-form string that describes the page. The value must be
- appropriate for use in a directory of pages, e.g. in a search engine. There must not be more than
- one <code id=standard-metadata-names:the-meta-element-6><a href=#the-meta-element>meta</a></code> element with its <code id=standard-metadata-names:attr-meta-name-5><a href=#attr-meta-name>name</a></code> attribute set to
- the value <code id=standard-metadata-names:meta-description><a href=#meta-description>description</a></code> per document.<dt><dfn id=meta-generator><code>generator</code></dfn><dd>
- <p>The value must be a free-form string that identifies one of the software packages used to
- generate the document. This value must not be used on pages whose markup is not generated by
- software, e.g. pages whose markup was written by a user in a text editor.</p>
- <div class=example>
- <p>Here is what a tool called "Frontweaver" could include in its output, in the page's
- <code id=standard-metadata-names:the-head-element><a href=#the-head-element>head</a></code> element, to identify itself as the tool used to generate the page:</p>
- <pre><meta name=generator content="Frontweaver 8.2"></pre>
- </div>
- <dt><dfn id=meta-keywords><code>keywords</code></dfn><dd>
- <p>The value must be a <a href=#set-of-comma-separated-tokens id=standard-metadata-names:set-of-comma-separated-tokens>set of comma-separated tokens</a>, each of which is a keyword
- relevant to the page.</p>
- <div class=example>
- <p>This page about typefaces on British motorways uses a <code id=standard-metadata-names:the-meta-element-7><a href=#the-meta-element>meta</a></code> element to specify
- some keywords that users might use to look for the page:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Typefaces on UK motorways</title>
- <meta name="keywords" content="british,type face,font,fonts,highway,highways">
- </head>
- <body>
- ...</pre>
- </div>
- <p class=note>Many search engines do not consider such keywords, because this feature has
- historically been used unreliably and even misleadingly as a way to spam search engine results
- in a way that is not helpful for users.</p>
-
- <p>To obtain the list of keywords that the author has specified as applicable to the page, the
- user agent must run the following steps:</p>
- <ol><li><p>Let <var>keywords</var> be an empty list.<li>
- <p>For each <code id=standard-metadata-names:the-meta-element-8><a href=#the-meta-element>meta</a></code> element with a <code id=standard-metadata-names:attr-meta-name-6><a href=#attr-meta-name>name</a></code>
- attribute and a <code id=standard-metadata-names:attr-meta-content-2><a href=#attr-meta-content>content</a></code> attribute and whose <code id=standard-metadata-names:attr-meta-name-7><a href=#attr-meta-name>name</a></code> attribute's value is <code id=standard-metadata-names:meta-keywords><a href=#meta-keywords>keywords</a></code>, run the following substeps:</p>
- <ol><li><p><a href=#split-a-string-on-commas id=standard-metadata-names:split-a-string-on-commas>Split the value of the element's <code>content</code> attribute on commas</a>.<li><p>Add the resulting tokens, if any, to <var>keywords</var>.</ol>
- <li><p>Remove any duplicates from <var>keywords</var>.<li><p>Return <var>keywords</var>. This is the list of keywords that the author has
- specified as applicable to the page.</ol>
- <p>User agents should not use this information when there is insufficient confidence in the
- reliability of the value.</p>
- <p class=example>For instance, it would be reasonable for a content management system to use
- the keyword information of pages within the system to populate the index of a site-specific
- search engine, but a large-scale content aggregator that used this information would likely find
- that certain users would try to game its ranking mechanism through the use of inappropriate
- keywords.</p>
-
- </dl>
- <h5 id=other-metadata-names>4.2.5.2 Other metadata names</h5>
- <p><dfn id=concept-meta-extensions>Extensions to the predefined set of metadata names</dfn>
- may be registered in the <a href=http://wiki.whatwg.org/wiki/MetaExtensions>WHATWG Wiki
- MetaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
- <p>Anyone is free to edit the WHATWG Wiki MetaExtensions page at any time to add a type. These new
- names must be specified with the following information:</p>
- <dl><dt>Keyword<dd><p>The actual name being defined. The name should not be confusingly similar to any other
- defined name (e.g. differing only in case).<dt>Brief description<dd><p>A short non-normative description of what the metadata name's meaning is, including the
- format the value is required to be in.<dt>Specification<dd>A link to a more detailed description of the metadata name's semantics and requirements. It
- could be another page on the Wiki, or a link to an external page.<dt>Synonyms<dd><p>A list of other names that have exactly the same processing requirements. Authors should
- not use the names defined to be synonyms, they are only intended to allow user agents to support
- legacy content. Anyone may remove synonyms that are not used in practice; only names that need to
- be processed as synonyms for compatibility with legacy content are to be registered in this
- way.<dt>Status<dd>
- <p>One of the following:</p>
- <dl><dt>Proposed<dd>The name has not received wide peer review and approval. Someone has proposed it and is, or
- soon will be, using it.<dt>Ratified<dd>The name has received wide peer review and approval. It has a specification that
- unambiguously defines how to handle pages that use the name, including when they use it in
- incorrect ways.<dt>Discontinued<dd>The metadata name has received wide peer review and it has been found wanting. Existing
- pages are using this metadata name, but new pages should avoid it. The "brief description" and
- "specification" entries will give details of what authors should use instead, if anything.</dl>
- <p>If a metadata name is found to be redundant with existing values, it should be removed and
- listed as a synonym for the existing value.</p>
- <p>If a metadata name is registered in the "proposed" state for a period of a month or more
- without being used or specified, then it may be removed from the registry.</p>
- <p>If a metadata name is added with the "proposed" status and found to be redundant with
- existing values, it should be removed and listed as a synonym for the existing value. If a
- metadata name is added with the "proposed" status and found to be harmful, then it should be
- changed to "discontinued" status.</p>
- <p>Anyone can change the status at any time, but should only do so in accordance with the
- definitions above.</p>
- </dl>
-
- <p>Conformance checkers must use the information given on the WHATWG Wiki MetaExtensions page to
- establish if a value is allowed or not: values defined in this specification or marked as
- "proposed" or "ratified" must be accepted, whereas values marked as "discontinued" or not listed
- in either this specification or on the aforementioned page must be rejected as invalid.
- Conformance checkers may cache this information (e.g. for performance reasons or to avoid the use
- of unreliable network connectivity).</p>
- <p>When an author uses a new metadata name not defined by either this specification or the Wiki
- page, conformance checkers should offer to add the value to the Wiki, with the details described
- above, with the "proposed" status.</p>
-
- <p>Metadata names whose values are to be <a href=#url id=other-metadata-names:url>URLs</a> must not be proposed or
- accepted. Links must be represented using the <code id=other-metadata-names:the-link-element><a href=#the-link-element>link</a></code> element, not the <code id=other-metadata-names:the-meta-element><a href=#the-meta-element>meta</a></code>
- element.</p>
- <h5 id=pragma-directives>4.2.5.3 Pragma directives</h5>
- <p>When the <dfn id=attr-meta-http-equiv><code>http-equiv</code></dfn> attribute is specified
- on a <code id=pragma-directives:the-meta-element><a href=#the-meta-element>meta</a></code> element, the element is a pragma directive.</p>
- <p>The <code id=pragma-directives:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is an <a href=#enumerated-attribute id=pragma-directives:enumerated-attribute>enumerated
- attribute</a>. The following table lists the keywords defined for this attribute. The states
- given in the first cell of the rows with keywords give the states to which those keywords map.
- Some of the keywords are non-conforming, as noted in the last
- column.</p>
- <table id=table-http-equiv><thead><tr><th>State
- <th>Keyword
- <th>Notes
- <tbody><tr><td><a href=#attr-meta-http-equiv-content-language id=pragma-directives:attr-meta-http-equiv-content-language>Content Language</a>
- <td><code>content-language</code>
- <td>Non-conforming
- <tr><td><a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type>Encoding declaration</a>
- <td><code>content-type</code>
- <td>
- <tr><td><a href=#attr-meta-http-equiv-default-style id=pragma-directives:attr-meta-http-equiv-default-style>Default style</a>
- <td><code>default-style</code>
- <td>
- <tr><td><a href=#attr-meta-http-equiv-refresh id=pragma-directives:attr-meta-http-equiv-refresh>Refresh</a>
- <td><code>refresh</code>
- <td>
- <tr><td><a href=#attr-meta-http-equiv-set-cookie id=pragma-directives:attr-meta-http-equiv-set-cookie>Cookie setter</a>
- <td><code>set-cookie</code>
- <td>Non-conforming
- </table>
-
- <p>When a <code id=pragma-directives:the-meta-element-2><a href=#the-meta-element>meta</a></code> element is <a href=#insert-an-element-into-a-document id=pragma-directives:insert-an-element-into-a-document>inserted
- into the document</a>, if its <code id=pragma-directives:attr-meta-http-equiv-2><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute is
- present and represents one of the above states, then the user agent must run the algorithm
- appropriate for that state, as described in the following list:</p>
-
- <dl><dt><dfn id=attr-meta-http-equiv-content-language>Content language state</dfn>
- (<code>http-equiv="content-language"</code>)
- <dd>
- <p class=note>This feature is non-conforming. Authors are encouraged to use the <code id=pragma-directives:attr-lang><a href=#attr-lang>lang</a></code> attribute instead.</p>
- <p>This pragma sets the <dfn id=pragma-set-default-language>pragma-set default language</dfn>. Until such a pragma is
- successfully processed, there is no <a href=#pragma-set-default-language id=pragma-directives:pragma-set-default-language>pragma-set default language</a>.</p>
-
- <ol><li><p>If the <code id=pragma-directives:the-meta-element-3><a href=#the-meta-element>meta</a></code> element has no <code id=pragma-directives:attr-meta-content><a href=#attr-meta-content>content</a></code>
- attribute, then abort these steps.<li><p>If the element's <code id=pragma-directives:attr-meta-content-2><a href=#attr-meta-content>content</a></code> attribute contains a
- U+002C COMMA character (,) then abort these steps.<li><p>Let <var>input</var> be the value of the element's <code id=pragma-directives:attr-meta-content-3><a href=#attr-meta-content>content</a></code> attribute.<li><p>Let <var>position</var> point at the first character of <var>input</var>.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace>Skip whitespace</a>.<li><p><a href=#collect-a-sequence-of-characters id=pragma-directives:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are not <a href=#space-character id=pragma-directives:space-character>space characters</a>.<li><p>Let <var>candidate</var> be the string that resulted from the previous
- step.<li><p>If <var>candidate</var> is the empty string, abort these steps.<li>
- <p>Set the <a href=#pragma-set-default-language id=pragma-directives:pragma-set-default-language-2>pragma-set default language</a> to <var>candidate</var>.</p>
- <p class=note>If the value consists of multiple space-separated tokens, tokens after the
- first are ignored.</p>
- </ol>
- <p class=note>This pragma is almost, but not quite, entirely unlike the HTTP <code id=pragma-directives:http-content-language><a href=#http-content-language>Content-Language</a></code> header of the same name. <a href=#refsHTTP>[HTTP]</a></p>
- <dt><dfn id=attr-meta-http-equiv-content-type>Encoding declaration state</dfn> (<code>http-equiv="content-type"</code>)
- <dd>
- <p>The <a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type-2>Encoding declaration state</a> is
- just an alternative form of setting the <code id=pragma-directives:attr-meta-charset><a href=#attr-meta-charset>charset</a></code>
- attribute: it is a <a href=#character-encoding-declaration id=pragma-directives:character-encoding-declaration>character encoding declaration</a>. This state's user
- agent requirements are all handled by the parsing section of the specification.</p>
- <p>For <code id=pragma-directives:the-meta-element-4><a href=#the-meta-element>meta</a></code> elements with an <code id=pragma-directives:attr-meta-http-equiv-3><a href=#attr-meta-http-equiv>http-equiv</a></code>
- attribute in the <a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type-3>Encoding declaration
- state</a>, the <code id=pragma-directives:attr-meta-content-4><a href=#attr-meta-content>content</a></code> attribute must have a value
- that is an <a href=#ascii-case-insensitive id=pragma-directives:ascii-case-insensitive>ASCII case-insensitive</a> match for a string that consists of: the literal
- string "<code>text/html;</code>", optionally followed by any number of <a href=#space-character id=pragma-directives:space-character-2>space characters</a>, followed by the literal string "<code>charset=</code>", followed by one of the <a href=#encoding-label id=pragma-directives:encoding-label>labels</a> of
- the <a href=#encoding id=pragma-directives:encoding>character encoding</a> of the <a href=#character-encoding-declaration id=pragma-directives:character-encoding-declaration-2>character encoding
- declaration</a>.</p>
- <p>A document must not contain both a <code id=pragma-directives:the-meta-element-5><a href=#the-meta-element>meta</a></code> element with an <code id=pragma-directives:attr-meta-http-equiv-4><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the <a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type-4>Encoding declaration state</a> and a
- <code id=pragma-directives:the-meta-element-6><a href=#the-meta-element>meta</a></code> element with the <code id=pragma-directives:attr-meta-charset-2><a href=#attr-meta-charset>charset</a></code> attribute
- present.</p>
- <p>The <a href=#attr-meta-http-equiv-content-type id=pragma-directives:attr-meta-http-equiv-content-type-5>Encoding declaration state</a> may be
- used in <a href=#html-documents id=pragma-directives:html-documents>HTML documents</a>, but elements with an <code id=pragma-directives:attr-meta-http-equiv-5><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in that state must not be used in
- <a href=#xml-documents id=pragma-directives:xml-documents>XML documents</a>.</p>
- <dt><dfn id=attr-meta-http-equiv-default-style>Default style state</dfn> (<code>http-equiv="default-style"</code>)
- <dd>
- <p>This pragma sets the name of the default <a href=#alternative-style-sheet-sets id=pragma-directives:alternative-style-sheet-sets>alternative style sheet set</a>.</p>
-
- <ol><li><p>If the <code id=pragma-directives:the-meta-element-7><a href=#the-meta-element>meta</a></code> element has no <code id=pragma-directives:attr-meta-content-5><a href=#attr-meta-content>content</a></code>
- attribute, or if that attribute's value is the empty string, then abort these steps.<li><p>Set the <a href=#preferred-style-sheet-set id=pragma-directives:preferred-style-sheet-set>preferred style sheet set</a> to the value of the element's <code id=pragma-directives:attr-meta-content-6><a href=#attr-meta-content>content</a></code> attribute. <a href=#refsCSSOM>[CSSOM]</a></ol>
-
- <dt><dfn id=attr-meta-http-equiv-refresh>Refresh state</dfn> (<code>http-equiv="refresh"</code>)
- <dd>
- <p>This pragma acts as timed redirect.</p>
-
- <ol><li><p>If another <code id=pragma-directives:the-meta-element-8><a href=#the-meta-element>meta</a></code> element with an <code id=pragma-directives:attr-meta-http-equiv-6><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the <a href=#attr-meta-http-equiv-refresh id=pragma-directives:attr-meta-http-equiv-refresh-2>Refresh state</a> has already been successfully
- processed (i.e. when it was inserted the user agent processed it and reached the last step of
- this list of steps), then abort these steps.<li><p>If the <code id=pragma-directives:the-meta-element-9><a href=#the-meta-element>meta</a></code> element has no <code id=pragma-directives:attr-meta-content-7><a href=#attr-meta-content>content</a></code>
- attribute, or if that attribute's value is the empty string, then abort these steps.<li><p>Let <var>input</var> be the value of the element's <code id=pragma-directives:attr-meta-content-8><a href=#attr-meta-content>content</a></code> attribute.<li><p>Let <var>position</var> point at the first character of <var>input</var>.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace-2>Skip whitespace</a>.<li><p><a href=#collect-a-sequence-of-characters id=pragma-directives:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are <a href=#ascii-digits id=pragma-directives:ascii-digits>ASCII digits</a>, and
- parse the resulting string using the <a href=#rules-for-parsing-non-negative-integers id=pragma-directives:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>. If
- the sequence of characters collected is the empty string, then no number will have been parsed;
- abort these steps. Otherwise, let <var>time</var> be the parsed number.<li><p><a href=#collect-a-sequence-of-characters id=pragma-directives:collect-a-sequence-of-characters-3>Collect a sequence of characters</a> that are <a href=#ascii-digits id=pragma-directives:ascii-digits-2>ASCII digits</a> and
- U+002E FULL STOP characters (.). Ignore any collected characters.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace-3>Skip whitespace</a>.<li><p>Let <var>url</var> be the address of the current page.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+003B SEMICOLON character (;) or a U+002C COMMA character (,), then advance <var>position</var> to the next character. Otherwise, jump to the last step.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace-4>Skip whitespace</a>.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+0055 LATIN CAPITAL LETTER U character (U) or a U+0075 LATIN SMALL LETTER U character
- (u), then advance <var>position</var> to the next character. Otherwise, jump to the
- last step.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+0052 LATIN CAPITAL LETTER R character (R) or a U+0072 LATIN SMALL LETTER R character
- (r), then advance <var>position</var> to the next character. Otherwise, jump to the
- last step.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is s U+004C LATIN CAPITAL LETTER L character (L) or a U+006C LATIN SMALL LETTER L character
- (l), then advance <var>position</var> to the next character. Otherwise, jump to the
- last step.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace-5>Skip whitespace</a>.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is a U+003D EQUALS SIGN (=), then advance <var>position</var> to the next character.
- Otherwise, jump to the last step.<li><p><a href=#skip-whitespace id=pragma-directives:skip-whitespace-6>Skip whitespace</a>.<li><p>If the character in <var>input</var> pointed to by <var>position</var>
- is either a U+0027 APOSTROPHE character (') or U+0022 QUOTATION MARK character ("), then let
- <var>quote</var> be that character, and advance <var>position</var> to the
- next character. Otherwise, let <var>quote</var> be the empty string.<li><p>Let <var>url</var> be equal to the substring of <var>input</var> from
- the character at <var>position</var> to the end of the string.<li><p>If <var>quote</var> is not the empty string, and there is a character in <var>url</var> equal to <var>quote</var>, then truncate <var>url</var> at
- that character, so that it and all subsequent characters are removed.</p>
- <li><p>Strip any trailing <a href=#space-character id=pragma-directives:space-character-3>space characters</a> from the end of
- <var>url</var>.<li><p>Strip any U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED (LF), and U+000D CARRIAGE
- RETURN (CR) characters from <var>url</var>.<li><p><a href=#resolve-a-url id=pragma-directives:resolve-a-url>Resolve</a> the <var>url</var> value to an
- <a href=#absolute-url id=pragma-directives:absolute-url>absolute URL</a>, relative to the <code id=pragma-directives:the-meta-element-10><a href=#the-meta-element>meta</a></code> element. If this fails, abort
- these steps.<li>
- <p>Perform one or more of the following steps:</p>
- <ul><li>
- <p>After the refresh has come due (as defined below), if the user has not canceled the
- redirect and if the <code id=pragma-directives:the-meta-element-11><a href=#the-meta-element>meta</a></code> element's <a id=pragma-directives:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=pragma-directives:active-sandboxing-flag-set>active
- sandboxing flag set</a> does not have the <a href=#sandboxed-automatic-features-browsing-context-flag id=pragma-directives:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing
- context flag</a> set, <a href=#navigate id=pragma-directives:navigate>navigate</a> the
- <code id=pragma-directives:document><a href=#document>Document</a></code>'s <a href=#browsing-context id=pragma-directives:browsing-context>browsing context</a> to <var>url</var>, with
- <a href=#replacement-enabled id=pragma-directives:replacement-enabled>replacement enabled</a>, and with the <code id=pragma-directives:document-2><a href=#document>Document</a></code>'s <a href=#browsing-context id=pragma-directives:browsing-context-2>browsing
- context</a> as the <a href=#source-browsing-context id=pragma-directives:source-browsing-context>source browsing context</a>.</p>
- <p>For the purposes of the previous paragraph, a refresh is said to have come due as soon as
- the <em>later</em> of the following two conditions occurs:</p>
- <ul><li>At least <var>time</var> seconds have elapsed since the document has
- <a href=#completely-loaded id=pragma-directives:completely-loaded>completely loaded</a>, adjusted to take into account user or user agent
- preferences.<li>At least <var>time</var> seconds have elapsed since the <code id=pragma-directives:the-meta-element-12><a href=#the-meta-element>meta</a></code>
- element was <a href=#insert-an-element-into-a-document id=pragma-directives:insert-an-element-into-a-document-2>inserted into the
- <code>Document</code></a>, adjusted to take into account user or user agent
- preferences.</ul>
- <li><p>Provide the user with an interface that, when selected, <a href=#navigate id=pragma-directives:navigate-2>navigates</a> a <a href=#browsing-context id=pragma-directives:browsing-context-3>browsing context</a> to
- <var>url</var>, with the <code id=pragma-directives:document-3><a href=#document>Document</a></code>'s <a href=#browsing-context id=pragma-directives:browsing-context-4>browsing context</a> as
- the <a href=#source-browsing-context id=pragma-directives:source-browsing-context-2>source browsing context</a>.<li><p>Do nothing.</ul>
- <p>In addition, the user agent may, as with anything, inform the user of any and all aspects
- of its operation, including the state of any timers, the destinations of any timed redirects,
- and so forth.</p>
- </ol>
-
- <p>For <code id=pragma-directives:the-meta-element-13><a href=#the-meta-element>meta</a></code> elements with an <code id=pragma-directives:attr-meta-http-equiv-7><a href=#attr-meta-http-equiv>http-equiv</a></code>
- attribute in the <a href=#attr-meta-http-equiv-refresh id=pragma-directives:attr-meta-http-equiv-refresh-3>Refresh state</a>, the <code id=pragma-directives:attr-meta-content-9><a href=#attr-meta-content>content</a></code> attribute must have a value consisting either of:</p>
- <ul><li>just a <a href=#valid-non-negative-integer id=pragma-directives:valid-non-negative-integer>valid non-negative integer</a>, or<li>a <a href=#valid-non-negative-integer id=pragma-directives:valid-non-negative-integer-2>valid non-negative integer</a>, followed by a U+003B SEMICOLON character
- (;), followed by one or more <a href=#space-character id=pragma-directives:space-character-4>space characters</a>, followed
- by a substring that is an <a href=#ascii-case-insensitive id=pragma-directives:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code>URL</code>", followed by a U+003D EQUALS SIGN character (=), followed by a <a href=#valid-url id=pragma-directives:valid-url>valid
- URL</a> that does not start with a literal U+0027 APOSTROPHE (') or U+0022 QUOTATION MARK
- (") character.</ul>
- <p>In the former case, the integer represents a number of seconds before the page is to be
- reloaded; in the latter case the integer represents a number of seconds before the page is to be
- replaced by the page at the given <a href=#url id=pragma-directives:url>URL</a>.</p>
- <div class=example>
- <p>A news organization's front page could include the following markup in the page's
- <code id=pragma-directives:the-head-element><a href=#the-head-element>head</a></code> element, to ensure that the page automatically reloads from the server every
- five minutes:</p>
- <pre><meta http-equiv="Refresh" content="300"></pre>
- </div>
- <div class=example>
- <p>A sequence of pages could be used as an automated slide show by making each page refresh to
- the next page in the sequence, using markup such as the following:</p>
- <pre><meta http-equiv="Refresh" content="20; URL=page4.html"></pre>
- </div>
- <dt><dfn id=attr-meta-http-equiv-set-cookie>Cookie setter</dfn> (<code>http-equiv="set-cookie"</code>)
- <dd>
- <p>This pragma sets an HTTP cookie. <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p>It is non-conforming. Real HTTP headers should be used instead.</p>
- <ol><li><p>If the <code id=pragma-directives:the-meta-element-14><a href=#the-meta-element>meta</a></code> element has no <code id=pragma-directives:attr-meta-content-10><a href=#attr-meta-content>content</a></code>
- attribute, or if that attribute's value is the empty string, then abort these steps.<li><p><a href=#obtain-the-storage-mutex id=pragma-directives:obtain-the-storage-mutex>Obtain the storage mutex</a>.<li><p>Act as if <a href=#receives-a-set-cookie-string id=pragma-directives:receives-a-set-cookie-string>receiving a
- set-cookie-string</a> for <a id="pragma-directives:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> via a "non-HTTP" API,
- consisting of the value of the element's <code id=pragma-directives:attr-meta-content-11><a href=#attr-meta-content>content</a></code>
- attribute encoded as UTF-8. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsENCODING>[ENCODING]</a></ol>
- </dl>
- <p>There must not be more than one <code id=pragma-directives:the-meta-element-15><a href=#the-meta-element>meta</a></code> element with any particular state in the
- document at a time.</p>
- <h5 id=other-pragma-directives>4.2.5.4 Other pragma directives</h5>
- <p><dfn id=concept-http-equiv-extensions>Extensions to the predefined set of pragma
- directives</dfn> may, under certain conditions, be registered in the <a href=http://wiki.whatwg.org/wiki/PragmaExtensions>WHATWG Wiki PragmaExtensions page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
- <p>Such extensions must use a name that is identical to an HTTP header registered in the Permanent
- Message Header Field Registry, and must have behavior identical to that described for the HTTP
- header. <a href=#refsIANAPERMHEADERS>[IANAPERMHEADERS]</a></p>
- <p>Pragma directives corresponding to headers describing metadata, or not requiring specific user
- agent processing, must not be registered; instead, use <a href=#concept-meta-extensions id=other-pragma-directives:concept-meta-extensions>metadata names</a>. Pragma directives corresponding to headers
- that affect the HTTP processing model (e.g. caching) must not be registered, as they would result
- in HTTP-level behavior being different for user agents that implement HTML than for user agents
- that do not.</p>
- <p>Anyone is free to edit the WHATWG Wiki PragmaExtensions page at any time to add a pragma
- directive satisfying these conditions. Such registrations must specify the following
- information:</p>
- <dl><dt>Keyword<dd><p>The actual name being defined. The name must match a previously-registered HTTP name with
- the same requirements.<dt>Brief description<dd><p>A short non-normative description of the purpose of the pragma directive.<dt>Specification<dd>A link to the specification defining the corresponding HTTP header.</dl>
-
- <p>Conformance checkers must use the information given on the WHATWG Wiki PragmaExtensions page to
- establish if a value is allowed or not: values defined in this specification or listed on the
- aforementioned page must be accepted, whereas values not listed in either this specification or on
- the aforementioned page must be rejected as invalid. Conformance checkers may cache this
- information (e.g. for performance reasons or to avoid the use of unreliable network
- connectivity).</p>
-
- <h5 id=charset>4.2.5.5 Specifying the document's character encoding</h5>
-
- <p>A <dfn id=character-encoding-declaration>character encoding declaration</dfn> is a mechanism by which the <a href=#encoding id=charset:encoding>character encoding</a> used to store or transmit a document is specified.</p>
- <p>The following restrictions apply to <a href=#character-encoding-declaration id=charset:character-encoding-declaration>character
- encoding declarations</a>:</p>
- <ul><li>The character encoding name given must be an <a href=#ascii-case-insensitive id=charset:ascii-case-insensitive>ASCII case-insensitive</a> match for
- one of the <a href=#encoding-label id=charset:encoding-label>labels</a> of the <a href=#encoding id=charset:encoding-2>character
- encoding</a> used to serialise the file. <a href=#refsENCODING>[ENCODING]</a><li>The character encoding declaration must be serialised without the use of <a href=#syntax-charref id=charset:syntax-charref>character references</a> or character escapes of any kind.<li id=charset1024><span id=charset512>The element containing the character encoding
- declaration must be serialised completely within the first 1024 bytes of the
- document.</span></ul>
- <p>In addition, due to a number of restrictions on <code id=charset:the-meta-element><a href=#the-meta-element>meta</a></code> elements, there can only be
- one <code id=charset:the-meta-element-2><a href=#the-meta-element>meta</a></code>-based character encoding declaration per document.</p>
- <p>If an <a href=#html-documents id=charset:html-documents>HTML document</a> does not start with a BOM, and its
- <a href=#encoding id=charset:encoding-3>encoding</a> is not explicitly given by <a href=#content-type id=charset:content-type>Content-Type
- metadata</a>, and the document is not <a href=#an-iframe-srcdoc-document id=charset:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a>, then the character encoding used must be
- an <a href=#ascii-compatible-character-encoding id=charset:ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, and the encoding must be specified using a
- <code id=charset:the-meta-element-3><a href=#the-meta-element>meta</a></code> element with a <code id=charset:attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute or a
- <code id=charset:the-meta-element-4><a href=#the-meta-element>meta</a></code> element with an <code id=charset:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute
- in the <a href=#attr-meta-http-equiv-content-type id=charset:attr-meta-http-equiv-content-type>Encoding declaration state</a>.</p>
- <p class=note>A character encoding declaration is required (either in the <a href=#content-type id=charset:content-type-2>Content-Type metadata</a> or explicitly in the file) even if the encoding
- is US-ASCII, because a character encoding is needed to process non-ASCII characters entered by the
- user in forms, in URLs generated by scripts, and so forth.</p>
- <p>If the document is <a href=#an-iframe-srcdoc-document id=charset:an-iframe-srcdoc-document-2>an <code>iframe</code> <code>srcdoc</code>
- document</a>, the document must not have a <a href=#character-encoding-declaration id=charset:character-encoding-declaration-2>character encoding declaration</a>. (In
- this case, the source is already decoded, since it is part of the document that contained the
- <code id=charset:the-iframe-element><a href=#the-iframe-element>iframe</a></code>.)</p>
- <p>If an <a href=#html-documents id=charset:html-documents-2>HTML document</a> contains a <code id=charset:the-meta-element-5><a href=#the-meta-element>meta</a></code> element
- with a <code id=charset:attr-meta-charset-2><a href=#attr-meta-charset>charset</a></code> attribute or a <code id=charset:the-meta-element-6><a href=#the-meta-element>meta</a></code> element
- with an <code id=charset:attr-meta-http-equiv-2><a href=#attr-meta-http-equiv>http-equiv</a></code> attribute in the <a href=#attr-meta-http-equiv-content-type id=charset:attr-meta-http-equiv-content-type-2>Encoding declaration state</a>, then the character
- encoding used must be an <a href=#ascii-compatible-character-encoding id=charset:ascii-compatible-character-encoding-2>ASCII-compatible character encoding</a>.</p>
- <p>Authors should use UTF-8. Conformance checkers may advise authors against using legacy
- encodings. <a href=#refsENCODING>[ENCODING]</a></p>
-
- <p>Authoring tools should default to using UTF-8 for newly-created documents. <a href=#refsENCODING>[ENCODING]</a></p>
-
- <p>Encodings in which a series of bytes in the range 0x20 to 0x7E can encode characters other than
- the corresponding characters in the range U+0020 to U+007E represent a potential security
- vulnerability: a user agent that does not support the encoding (or does not support the label used
- to declare the encoding, or does not use the same mechanism to detect the encoding of unlabeled
- content as another user agent) might end up interpreting technically benign plain text content as
- HTML tags and JavaScript. Authors should therefore not use these encodings. For example, this
- applies to encodings in which the bytes corresponding to "<code><script></code>" in
- ASCII can encode a different string. Authors should not use such encodings, which are known to
- include JIS_C6226-1983, JIS_X0212-1990,
- HZ-GB-2312, JOHAB (Windows code page 1361), encodings based on
- ISO-2022, and encodings
- based on EBCDIC. Furthermore, authors must not use the CESU-8, UTF-7, BOCU-1 and SCSU encodings,
- which also fall into this category; these encodings were never intended for use for Web content.
- <a href=#refsRFC1345>[RFC1345]</a>
- <a href=#refsRFC1842>[RFC1842]</a>
- <a href=#refsRFC1468>[RFC1468]</a>
- <a href=#refsRFC2237>[RFC2237]</a>
- <a href=#refsRFC1554>[RFC1554]</a>
- <a href=#refsCP50220>[CP50220]</a>
- <a href=#refsRFC1922>[RFC1922]</a>
- <a href=#refsRFC1557>[RFC1557]</a>
- <a href=#refsCESU8>[CESU8]</a>
- <a href=#refsUTF7>[UTF7]</a>
- <a href=#refsBOCU1>[BOCU1]</a>
- <a href=#refsSCSU>[SCSU]</a>
-
- </p>
- <p>Authors should not use UTF-32, as the encoding detection algorithms described in this
- specification intentionally do not distinguish it from UTF-16. <a href=#refsUNICODE>[UNICODE]</a></p>
- <p class=note>Using non-UTF-8 encodings can have unexpected results on form submission and URL
- encodings, which use the <a href="#document's-character-encoding" id="charset:document's-character-encoding">document's character encoding</a> by default.</p>
- <p>In XHTML, the XML declaration should be used for inline character encoding information, if
- necessary.</p>
- <div class=example>
- <p>In HTML, to declare that the character encoding is UTF-8, the author could include the
- following markup near the top of the document (in the <code id=charset:the-head-element><a href=#the-head-element>head</a></code> element):</p>
- <pre><meta charset="utf-8"></pre>
- <p>In XML, the XML declaration would be used instead, at the very top of the markup:</p>
- <pre><?xml version="1.0" encoding="utf-8"?></pre>
- </div>
- <h4 id=the-style-element>4.2.6 The <dfn><code>style</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-style-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-style-element:metadata-content-2>Metadata content</a>.<dd>If the <code id=the-style-element:attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present: <a href=#flow-content-2 id=the-style-element:flow-content-2>flow content</a>.<dt><a href=#concept-element-contexts id=the-style-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>If the <code id=the-style-element:attr-style-scoped-2><a href=#attr-style-scoped>scoped</a></code> attribute is absent: where <a href=#metadata-content-2 id=the-style-element:metadata-content-2-2>metadata content</a> is expected.<dd>If the <code id=the-style-element:attr-style-scoped-3><a href=#attr-style-scoped>scoped</a></code> attribute is absent: in a <code id=the-style-element:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element that is a child of a <code id=the-style-element:the-head-element><a href=#the-head-element>head</a></code> element.<dd>If the <code id=the-style-element:attr-style-scoped-4><a href=#attr-style-scoped>scoped</a></code> attribute is present: where <a href=#flow-content-2 id=the-style-element:flow-content-2-2>flow content</a> is expected, but before any other <a href=#flow-content-2 id=the-style-element:flow-content-2-3>flow content</a> other than <a href=#inter-element-whitespace id=the-style-element:inter-element-whitespace>inter-element whitespace</a> and <code id=the-style-element:the-style-element><a href=#the-style-element>style</a></code> elements, and not as the child of an element whose content model is <a href=#transparent id=the-style-element:transparent>transparent</a>.<dt><a href=#concept-element-content-model id=the-style-element:concept-element-content-model>Content model</a>:<dd>Depends on the value of the <code id=the-style-element:attr-style-type><a href=#attr-style-type>type</a></code> attribute, but must match requirements described in prose below.<dt><a href=#concept-element-tag-omission id=the-style-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-style-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-style-element:global-attributes>Global attributes</a><dd><code id=the-style-element:attr-style-media><a href=#attr-style-media>media</a></code> — Applicable media<dd><code id=the-style-element:attr-style-type-2><a href=#attr-style-type>type</a></code> — Type of embedded resource<dd><code id=the-style-element:attr-style-scoped-5><a href=#attr-style-scoped>scoped</a></code> — Whether the styles apply to the entire document or just the parent subtree<dd>Also, the <code id=the-style-element:attr-style-title><a href=#attr-style-title>title</a></code> attribute <a href=#attr-style-title id=the-style-element:attr-style-title-2>has special semantics</a> on this element: Alternative style sheet set name.<dt><a href=#concept-element-dom id=the-style-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlstyleelement>HTMLStyleElement</dfn> : <a href=#htmlelement id=the-style-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-style-media id=the-style-element:dom-style-media>media</a>;
- attribute DOMString <a href=#dom-style-type id=the-style-element:dom-style-type>type</a>;
- attribute boolean <a href=#dom-style-scoped id=the-style-element:dom-style-scoped>scoped</a>;
- };
- <a href=#htmlstyleelement id=the-style-element:htmlstyleelement>HTMLStyleElement</a> implements <a href=#linkstyle id=the-style-element:linkstyle>LinkStyle</a>;</pre>
- </dl>
- <p>The <code id=the-style-element:the-style-element-2><a href=#the-style-element>style</a></code> element allows authors to embed style information in their documents.
- The <code id=the-style-element:the-style-element-3><a href=#the-style-element>style</a></code> element is one of several inputs to the styling processing
- model. The element does not <a href=#represents id=the-style-element:represents>represent</a> content for the
- user.</p>
- <p>The <dfn id=attr-style-type><code>type</code></dfn> attribute gives the styling language.
- If the attribute is present, its value must be a <a href=#valid-mime-type id=the-style-element:valid-mime-type>valid MIME type</a> that designates a
- styling language. The <code>charset</code> parameter must not be specified. The default
- value for the <code id=the-style-element:attr-style-type-3><a href=#attr-style-type>type</a></code> attribute, which is used if the attribute
- is absent, is "<code>text/css</code>". <a href=#refsRFC2318>[RFC2318]</a></p>
-
- <p>When examining types
- to determine if they support the language, user agents must not ignore unknown MIME parameters
- — types with unknown parameters must be assumed to be unsupported. The <code>charset</code> parameter must be treated as an unknown parameter for the purpose of
- comparing <a href=#mime-type id=the-style-element:mime-type>MIME types</a> here.</p>
-
- <p>The <dfn id=attr-style-media><code>media</code></dfn> attribute says which media the
- styles apply to. The value must be a <a href=#valid-media-query-list id=the-style-element:valid-media-query-list>valid media query list</a>. The user
- agent must apply the styles when the <code id=the-style-element:attr-style-media-2><a href=#attr-style-media>media</a></code> attribute's
- value <a href=#matches-the-environment id=the-style-element:matches-the-environment>matches the environment</a> and the other relevant conditions apply, and must not
- apply them otherwise.</p>
-
- <p class=note>The styles might be further limited in scope, e.g. in CSS with the use of <code>@media</code> blocks. This specification does not override such further restrictions or
- requirements.</p>
-
- <p id=style-default-media>The default, if the <code id=the-style-element:attr-style-media-3><a href=#attr-style-media>media</a></code>
- attribute is omitted, is "<code>all</code>", meaning that by default styles apply to all
- media.</p>
- <p>The <dfn id=attr-style-scoped><code>scoped</code></dfn> attribute is a <a href=#boolean-attribute id=the-style-element:boolean-attribute>boolean
- attribute</a>. If present, it indicates that the styles are intended just for the subtree
- rooted at the <code id=the-style-element:the-style-element-4><a href=#the-style-element>style</a></code> element's parent element, as opposed to the whole
- <code id=the-style-element:document><a href=#document>Document</a></code>.</p>
- <p>If the <code id=the-style-element:attr-style-scoped-6><a href=#attr-style-scoped>scoped</a></code> attribute is present and the element has a
- parent element, then the <code id=the-style-element:the-style-element-5><a href=#the-style-element>style</a></code> element must precede any <a href=#flow-content-2 id=the-style-element:flow-content-2-4>flow content</a> in
- its parent element other than <a href=#inter-element-whitespace id=the-style-element:inter-element-whitespace-2>inter-element whitespace</a> and other <code id=the-style-element:the-style-element-6><a href=#the-style-element>style</a></code>
- elements, and the parent element's content model must not have a <a href=#transparent id=the-style-element:transparent-2>transparent</a>
- component.</p>
- <p class=note>This implies that scoped <code id=the-style-element:the-style-element-7><a href=#the-style-element>style</a></code> elements cannot be children of, e.g.,
- <code id=the-style-element:the-a-element><a href=#the-a-element>a</a></code> or <code id=the-style-element:the-ins-element><a href=#the-ins-element>ins</a></code> elements, even when those are used as <a href=#flow-content-2 id=the-style-element:flow-content-2-5>flow content</a>
- containers.</p>
- <p class=note>A <code id=the-style-element:the-style-element-8><a href=#the-style-element>style</a></code> element <em>without</em> a <code id=the-style-element:attr-style-scoped-7><a href=#attr-style-scoped>scoped</a></code> attribute is restricted to appearing in the
- <code id=the-style-element:the-head-element-2><a href=#the-head-element>head</a></code> of the document.</p>
- <p>A style sheet declared by a <code id=the-style-element:the-style-element-9><a href=#the-style-element>style</a></code> element that has a <code id=the-style-element:attr-style-scoped-8><a href=#attr-style-scoped>scoped</a></code> attribute and has a parent node that is an element is
- <i>scoped</i>, with the <i>scoping root</i> being the <code id=the-style-element:the-style-element-10><a href=#the-style-element>style</a></code> element's parent
- element. <a href=#refsCSSSCOPED>[CSSSCOPED]</a></p>
-
- <p id=title-on-style>The <dfn id=attr-style-title><code>title</code></dfn> attribute on
- <code id=the-style-element:the-style-element-11><a href=#the-style-element>style</a></code> elements defines <a href=#alternative-style-sheet-sets id=the-style-element:alternative-style-sheet-sets>alternative style sheet sets</a>. If the
- <code id=the-style-element:the-style-element-12><a href=#the-style-element>style</a></code> element has no <code id=the-style-element:attr-style-title-3><a href=#attr-style-title>title</a></code> attribute, then it
- has no title; the <code id=the-style-element:attr-title><a href=#attr-title>title</a></code> attribute of ancestors does not apply to
- the <code id=the-style-element:the-style-element-13><a href=#the-style-element>style</a></code> element. <a href=#refsCSSOM>[CSSOM]</a></p>
- <p class=note>The <code id=the-style-element:attr-style-title-4><a href=#attr-style-title>title</a></code> attribute on <code id=the-style-element:the-style-element-14><a href=#the-style-element>style</a></code>
- elements, like the <code id=the-style-element:attr-link-title><a href=#attr-link-title>title</a></code> attribute on <code id=the-style-element:the-link-element><a href=#the-link-element>link</a></code>
- elements, differs from the global <code id=the-style-element:attr-title-2><a href=#attr-title>title</a></code> attribute in that a
- <code id=the-style-element:the-style-element-15><a href=#the-style-element>style</a></code> block without a title does not inherit the title of the parent element: it
- merely has no title.</p>
- <p>The <code id=the-style-element:textcontent><a href=#textcontent>textContent</a></code> of a <code id=the-style-element:the-style-element-16><a href=#the-style-element>style</a></code> element must match the <code>style</code> production in the following ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
- <pre>style = no-c-start *( c-start no-c-end c-end no-c-start )
- no-c-start = < any string that doesn't contain a substring that matches c-start >
- c-start = "<!--"
- no-c-end = < any string that doesn't contain a substring that matches c-end >
- c-end = "-->"</pre>
-
- <hr>
-
- <p>Whenever one of the following conditions occur for an element whose <code id=the-style-element:document-2><a href=#document>Document</a></code> is in
- a <a href=#browsing-context id=the-style-element:browsing-context>browsing context</a>:</p>
- <ul><li>the element is popped off the <a href=#stack-of-open-elements id=the-style-element:stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser id=the-style-element:html-parser>HTML
- parser</a> or <a href=#xml-parser id=the-style-element:xml-parser>XML parser</a>,
- <li>the element is not on the <a href=#stack-of-open-elements id=the-style-element:stack-of-open-elements-2>stack of open elements</a> of an <a href=#html-parser id=the-style-element:html-parser-2>HTML parser</a>
- or <a href=#xml-parser id=the-style-element:xml-parser-2>XML parser</a>, and it is <a href=#insert-an-element-into-a-document id=the-style-element:insert-an-element-into-a-document>inserted into a document</a> or <a href=#remove-an-element-from-a-document id=the-style-element:remove-an-element-from-a-document>removed from a document</a>,
- <li>the element is not on the <a href=#stack-of-open-elements id=the-style-element:stack-of-open-elements-3>stack of open elements</a> of an <a href=#html-parser id=the-style-element:html-parser-3>HTML parser</a>
- or <a href=#xml-parser id=the-style-element:xml-parser-3>XML parser</a>, and one of its child nodes is modified by a script,
- </ul>
- <p>...the user agent must <a href=#queue-a-task id=the-style-element:queue-a-task>queue a task</a> to invoke the <dfn id=update-a-style-block>update a <code>style</code>
- block</dfn> algorithm that applies for the style sheet language specified by the element's <code id=the-style-element:attr-style-type-4><a href=#attr-style-type>type</a></code> attribute, passing it the element's <dfn id=style-data>style
- data</dfn>.</p>
- <p>For styling languages that consist of pure text (as opposed to XML), a <code id=the-style-element:the-style-element-17><a href=#the-style-element>style</a></code>
- element's <a href=#style-data id=the-style-element:style-data>style data</a> is the concatenation of the contents of all the
- <code id=the-style-element:text><a href=#text>Text</a></code> nodes that are children of the <code id=the-style-element:the-style-element-18><a href=#the-style-element>style</a></code> element (not any other nodes
- such as comments or elements), in <a href=#tree-order id=the-style-element:tree-order>tree order</a>. For XML-based styling languages, the
- <a href=#style-data id=the-style-element:style-data-2>style data</a> consists of all the child nodes of the <code id=the-style-element:the-style-element-19><a href=#the-style-element>style</a></code> element.</p>
- <p>The <a href=#update-a-style-block id=the-style-element:update-a-style-block>update a <code>style</code> block</a> algorithm for CSS (<code id=the-style-element:text/css><a href=#text/css>text/css</a></code>) is
- as follows:</p>
- <ol><li><p>Let <var>element</var> be the <code id=the-style-element:the-style-element-20><a href=#the-style-element>style</a></code> element.<li><p>If <var>element</var> has an <a href=#associated-css-style-sheet id=the-style-element:associated-css-style-sheet>associated CSS style sheet</a>, <a href=#remove-a-css-style-sheet id=the-style-element:remove-a-css-style-sheet>remove the CSS style sheet</a> in question.<li><p>If <var>element</var> is not <a href=#in-a-document id=the-style-element:in-a-document>in a <code>Document</code></a>, then abort
- these steps.<li>
- <p><a href=#create-a-css-style-sheet id=the-style-element:create-a-css-style-sheet>Create a CSS style sheet</a> with the following properties:</p>
- <dl><dt><a href=#concept-css-style-sheet-type id=the-style-element:concept-css-style-sheet-type>type</a><dd><p><code>text/css</code><dt><a href=#concept-css-style-sheet-owner-node id=the-style-element:concept-css-style-sheet-owner-node>owner node</a><dd><p><var>element</var><dt><a href=#concept-css-style-sheet-media id=the-style-element:concept-css-style-sheet-media>media</a><dd>
- <p>The <code id=the-style-element:attr-style-media-4><a href=#attr-style-media>media</a></code> attribute of <var>element</var>.</p>
- <p class=note>This is a reference to the (possibly absent at this time) attribute, rather
- than a copy of the attribute's current value. The CSSOM specification defines what happens
- when the attribute is dynamically set, changed, or removed.</p>
- <dt><a href=#concept-css-style-sheet-title id=the-style-element:concept-css-style-sheet-title>title</a><dd>
- <p>The <code id=the-style-element:attr-style-title-5><a href=#attr-style-title>title</a></code> attribute of <var>element</var>.</p>
- <p class=note>Again, this is a <em>reference</em> to the attribute.</p>
- <dt><a href=#concept-css-style-sheet-alternate-flag id=the-style-element:concept-css-style-sheet-alternate-flag>alternate flag</a><dd><p>Unset.<dt><a href=#concept-css-style-sheet-origin-clean-flag id=the-style-element:concept-css-style-sheet-origin-clean-flag>origin-clean flag</a><dd><p>Set.<dt><a href=#concept-css-style-sheet-location id=the-style-element:concept-css-style-sheet-location>location</a><dt><a href=#concept-css-style-sheet-parent-css-style-sheet id=the-style-element:concept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet</a><dt><a href=#concept-css-style-sheet-owner-css-rule id=the-style-element:concept-css-style-sheet-owner-css-rule>owner CSS rule</a><dd><p>null<dt><a href=#concept-css-style-sheet-disabeld-flag id=the-style-element:concept-css-style-sheet-disabeld-flag>disabled flag</a><dd><p>Left at its default value.<dt><a href=#concept-css-style-sheet-css-rules id=the-style-element:concept-css-style-sheet-css-rules>CSS rules</a><dd><p>Left uninitialized.</dl>
-
- </ol>
- <p>This specification does not define any other styling language's <i id=the-style-element:update-a-style-block-2><a href=#update-a-style-block>update a <code>style</code> block</a></i> algorithm.</p>
-
- <p>Once the attempts to obtain the style sheet's <a href=#critical-subresources id=the-style-element:critical-subresources>critical subresources</a>, if any, are
- complete, or, if the style sheet has no <a href=#critical-subresources id=the-style-element:critical-subresources-2>critical subresources</a>, once the style sheet
- has been parsed and processed, the user agent must, if the loads were successful or there were
- none, <a href=#queue-a-task id=the-style-element:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=the-style-element:fire-a-simple-event>fire a simple event</a> named <code id=the-style-element:event-load><a href=#event-load>load</a></code> at the <code id=the-style-element:the-style-element-21><a href=#the-style-element>style</a></code> element, or, if one of the style sheet's
- <a href=#critical-subresources id=the-style-element:critical-subresources-3>critical subresources</a> failed to completely load for any reason (e.g. DNS error, HTTP
- 404 response, a connection being prematurely closed, unsupported Content-Type), <a href=#queue-a-task id=the-style-element:queue-a-task-3>queue a
- task</a> to <a href=#fire-a-simple-event id=the-style-element:fire-a-simple-event-2>fire a simple event</a> named <code id=the-style-element:event-error><a href=#event-error>error</a></code> at
- the <code id=the-style-element:the-style-element-22><a href=#the-style-element>style</a></code> element. Non-network errors in processing the style sheet or its
- subresources (e.g. CSS parse errors, PNG decoding errors) are not failures for the purposes of
- this paragraph.</p>
- <p>The <a href=#task-source id=the-style-element:task-source>task source</a> for these <a href=#concept-task id=the-style-element:concept-task>tasks</a> is the <a href=#dom-manipulation-task-source id=the-style-element:dom-manipulation-task-source>DOM
- manipulation task source</a>.</p>
- <p>The element must <a href=#delay-the-load-event id=the-style-element:delay-the-load-event>delay the load event</a> of the element's <a id=the-style-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> until all the
- attempts to obtain the style sheet's <a href=#critical-subresources id=the-style-element:critical-subresources-4>critical subresources</a>, if any, are complete.</p>
-
- <p class=note>This specification does not specify a style system, but CSS is expected to be
- supported by most Web browsers. <a href=#refsCSS>[CSS]</a></p>
-
- <p>The <dfn id=dom-style-media><code>media</code></dfn>, <dfn id=dom-style-type><code>type</code></dfn> and <dfn id=dom-style-scoped><code>scoped</code></dfn> IDL attributes must <a href=#reflect id=the-style-element:reflect>reflect</a> the
- respective content attributes of the same name.</p>
-
- <p>The <code id=the-style-element:linkstyle-2><a href=#linkstyle>LinkStyle</a></code> interface is also implemented by this element. <a href=#refsCSSOM>[CSSOM]</a></p>
- <div class=example>
- <p>The following document has its stress emphasis styled as bright red text rather than italics
- text, while leaving titles of works and Latin words in their default italics. It shows how using
- appropriate elements enables easier restyling of documents.</p>
- <pre><!DOCTYPE html>
- <html lang="en-US">
- <head>
- <title>My favorite book</title>
- <style>
- body { color: black; background: white; }
- em { font-style: normal; color: red; }
- </style>
- </head>
- <body>
- <p>My <em>favorite</em> book of all time has <em>got</em> to be
- <cite>A Cat's Life</cite>. It is a book by P. Rahmel that talks
- about the <i lang="la">Felis Catus</i> in modern human society.</p>
- </body>
- </html></pre>
- </div>
-
- <h4 id=interactions-of-styling-and-scripting>4.2.7 Interactions of styling and scripting</h4>
- <p>Style sheets, whether added by a <code id=interactions-of-styling-and-scripting:the-link-element><a href=#the-link-element>link</a></code> element, a <code id=interactions-of-styling-and-scripting:the-style-element><a href=#the-style-element>style</a></code> element, an
- <code id=interactions-of-styling-and-scripting:xml-stylesheet><a data-x-internal=xml-stylesheet href=http://www.w3.org/TR/xml-stylesheet/#the-xml-stylesheet-processing-instruction><?xml-stylesheet?></a></code> PI, an HTTP <code id=interactions-of-styling-and-scripting:http-link><a href=#http-link>Link:</a></code> header, or
- some other mechanism, have a <dfn id=style-sheet-ready>style sheet ready</dfn> flag, which is initially unset.</p>
- <p>When a style sheet is ready to be applied, its <a href=#style-sheet-ready id=interactions-of-styling-and-scripting:style-sheet-ready>style sheet ready</a> flag must be set.
- If the style sheet referenced no other resources (e.g. it was an internal style sheet given by a
- <code id=interactions-of-styling-and-scripting:the-style-element-2><a href=#the-style-element>style</a></code> element with no <code>@import</code> rules), then the style rules must
- be synchronously made available to script; otherwise, the style rules must only be made available
- to script once the <a href=#event-loop id=interactions-of-styling-and-scripting:event-loop>event loop</a> reaches its <i>update the rendering</i> step.</p>
- <p>A style sheet in the context of the <code id=interactions-of-styling-and-scripting:document><a href=#document>Document</a></code> of an <a href=#html-parser id=interactions-of-styling-and-scripting:html-parser>HTML parser</a> or
- <a href=#xml-parser id=interactions-of-styling-and-scripting:xml-parser>XML parser</a> is said to be <dfn id=a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts</dfn> if the
- element was created by that <code id=interactions-of-styling-and-scripting:document-2><a href=#document>Document</a></code>'s parser, and the element is either a
- <code id=interactions-of-styling-and-scripting:the-style-element-3><a href=#the-style-element>style</a></code> element or a <code id=interactions-of-styling-and-scripting:the-link-element-2><a href=#the-link-element>link</a></code> element that was an <a href=#link-type-stylesheet id=interactions-of-styling-and-scripting:link-type-stylesheet>external resource link that contributes to the styling processing
- model</a> when the element was created by the parser, and the element's style sheet was enabled
- when the element was created by the parser, and the element's <a href=#style-sheet-ready id=interactions-of-styling-and-scripting:style-sheet-ready-2>style sheet ready</a> flag
- is not yet set, and, the last time the <a href=#event-loop id=interactions-of-styling-and-scripting:event-loop-2>event loop</a> reached step 1, the element was
- <a href=#in-a-document id=interactions-of-styling-and-scripting:in-a-document>in that <code>Document</code></a>, and the user agent hasn't given
- up on that particular style sheet yet. A user agent may give up on a style sheet at any time.</p>
- <p class=note>Giving up on a style sheet before the style sheet loads, if the style sheet
- eventually does still load, means that the script might end up operating with incorrect
- information. For example, if a style sheet sets the colour of an element to green, but a script
- that inspects the resulting style is executed before the sheet is loaded, the script will find
- that the element is black (or whatever the default colour is), and might thus make poor choices
- (e.g. deciding to use black as the colour elsewhere on the page, instead of green). Implementors
- have to balance the likelihood of a script using incorrect information with the performance impact
- of doing nothing while waiting for a slow network request to finish.</p>
- <p>A <code id=interactions-of-styling-and-scripting:document-3><a href=#document>Document</a></code> <dfn id=has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking scripts</dfn> if there is
- either <a href=#a-style-sheet-that-is-blocking-scripts id=interactions-of-styling-and-scripting:a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts</a> in the context of that
- <code id=interactions-of-styling-and-scripting:document-4><a href=#document>Document</a></code>, or if that <code id=interactions-of-styling-and-scripting:document-5><a href=#document>Document</a></code> is in a <a href=#browsing-context id=interactions-of-styling-and-scripting:browsing-context>browsing context</a> that
- has a <a href=#parent-browsing-context id=interactions-of-styling-and-scripting:parent-browsing-context>parent browsing context</a>, and the <a href=#active-document id=interactions-of-styling-and-scripting:active-document>active document</a> of that
- <a href=#parent-browsing-context id=interactions-of-styling-and-scripting:parent-browsing-context-2>parent browsing context</a> itself <a href=#has-a-style-sheet-that-is-blocking-scripts id=interactions-of-styling-and-scripting:has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
- scripts</a>.</p>
- <p>A <code id=interactions-of-styling-and-scripting:document-6><a href=#document>Document</a></code> <dfn id=has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</dfn> if it does not
- <a href=#has-a-style-sheet-that-is-blocking-scripts id=interactions-of-styling-and-scripting:has-a-style-sheet-that-is-blocking-scripts-2>have a style sheet that is blocking
- scripts</a> as defined in the previous paragraph.</p>
-
- <h3 id=sections>4.3 Sections</h3>
- <h4 id=the-body-element>4.3.1 The <dfn><code>body</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-body-element:concept-element-categories>Categories</a>:<dd><a href=#sectioning-root id=the-body-element:sectioning-root>Sectioning root</a>.<dt><a href=#concept-element-contexts id=the-body-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the second element in an <code id=the-body-element:the-html-element><a href=#the-html-element>html</a></code> element.<dt><a href=#concept-element-content-model id=the-body-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-body-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-body-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-body-element:the-body-element><a href=#the-body-element>body</a></code> element's <a href=#syntax-start-tag id=the-body-element:syntax-start-tag>start tag</a> can be omitted
- if the element is empty, or if the first thing inside the <code id=the-body-element:the-body-element-2><a href=#the-body-element>body</a></code> element is not a
- <a href=#space-character id=the-body-element:space-character>space character</a> or a <a href=#syntax-comments id=the-body-element:syntax-comments>comment</a>, except if the
- first thing inside the <code id=the-body-element:the-body-element-3><a href=#the-body-element>body</a></code> element is a <code id=the-body-element:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=the-body-element:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=the-body-element:the-script-element><a href=#the-script-element>script</a></code>, <code id=the-body-element:the-style-element><a href=#the-style-element>style</a></code>, or <code id=the-body-element:the-template-element><a href=#the-template-element>template</a></code> element. <dd>A <code id=the-body-element:the-body-element-4><a href=#the-body-element>body</a></code> element's <a href=#syntax-end-tag id=the-body-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-body-element:the-body-element-5><a href=#the-body-element>body</a></code> element is not immediately followed by a <a href=#syntax-comments id=the-body-element:syntax-comments-2>comment</a>.<dt><a href=#concept-element-attributes id=the-body-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-body-element:global-attributes>Global attributes</a><dd><code id=the-body-element:handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code><dd><code id=the-body-element:handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code><dd><code id=the-body-element:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code><dd><code id=the-body-element:handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code><dd><code id=the-body-element:handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>onlanguagechange</a></code><dd><code id=the-body-element:handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code><dd><code id=the-body-element:handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code><dd><code id=the-body-element:handler-window-ononline><a href=#handler-window-ononline>ononline</a></code><dd><code id=the-body-element:handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code><dd><code id=the-body-element:handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code><dd><code id=the-body-element:handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code><dd><code id=the-body-element:handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code><dd><code id=the-body-element:handler-window-onunload><a href=#handler-window-onunload>onunload</a></code><dt><a href=#concept-element-dom id=the-body-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlbodyelement>HTMLBodyElement</dfn> : <a href=#htmlelement id=the-body-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLBodyElement-partial">also has obsolete members</a>
- };
- <a href=#htmlbodyelement id=the-body-element:htmlbodyelement>HTMLBodyElement</a> implements <a href=#windoweventhandlers id=the-body-element:windoweventhandlers>WindowEventHandlers</a>;</pre>
- </dl>
- <p>The <code id=the-body-element:the-body-element-6><a href=#the-body-element>body</a></code> element <a href=#represents id=the-body-element:represents>represents</a> the main content of the document.</p>
- <p>In conforming documents, there is only one <code id=the-body-element:the-body-element-7><a href=#the-body-element>body</a></code> element. The <code id=the-body-element:dom-document-body><a href=#dom-document-body>document.body</a></code> IDL attribute provides scripts with easy access to
- a document's <code id=the-body-element:the-body-element-8><a href=#the-body-element>body</a></code> element.</p>
-
- <p class=note>Some DOM operations (for example, parts of the <a href=#dnd id=the-body-element:dnd>drag and drop</a> model)
- are defined in terms of "<a href=#the-body-element-2 id=the-body-element:the-body-element-2-2>the body element</a>". This refers to a particular element in
- the DOM, as per the definition of the term, and not any arbitrary <code id=the-body-element:the-body-element-9><a href=#the-body-element>body</a></code> element.</p>
-
- <p>The <code id=the-body-element:the-body-element-10><a href=#the-body-element>body</a></code> element exposes as <a href=#event-handler-content-attributes id=the-body-element:event-handler-content-attributes>event handler content attributes</a> a number
- of the <a href=#event-handlers id=the-body-element:event-handlers>event handlers</a> of the <code id=the-body-element:window><a href=#window>Window</a></code> object. It also mirrors their
- <a href=#event-handler-idl-attributes id=the-body-element:event-handler-idl-attributes>event handler IDL attributes</a>.</p>
- <p>The <code id=the-body-element:handler-onblur><a href=#handler-onblur>onblur</a></code>, <code id=the-body-element:handler-onerror><a href=#handler-onerror>onerror</a></code>,
- <code id=the-body-element:handler-onfocus><a href=#handler-onfocus>onfocus</a></code>, <code id=the-body-element:handler-onload><a href=#handler-onload>onload</a></code>, <code id=the-body-element:handler-onresize><a href=#handler-onresize>onresize</a></code>, and <code id=the-body-element:handler-onscroll><a href=#handler-onscroll>onscroll</a></code>
- <a href=#event-handlers id=the-body-element:event-handlers-2>event handlers</a> of the <code id=the-body-element:window-2><a href=#window>Window</a></code> object, exposed on the <code id=the-body-element:the-body-element-11><a href=#the-body-element>body</a></code>
- element, replace the generic <a href=#event-handlers id=the-body-element:event-handlers-3>event handlers</a> with the same names normally supported by
- <a href=#html-elements id=the-body-element:html-elements>HTML elements</a>.</p>
- <p class=example>Thus, for example, a bubbling <code id=the-body-element:event-error><a href=#event-error>error</a></code> event
- dispatched on a child of <a href=#the-body-element-2 id=the-body-element:the-body-element-2-3>the body element</a> of a <code id=the-body-element:document><a href=#document>Document</a></code> would first
- trigger the <code id=the-body-element:handler-onerror-2><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-content-attributes id=the-body-element:event-handler-content-attributes-2>event handler content
- attributes</a> of that element, then that of the root <code id=the-body-element:the-html-element-2><a href=#the-html-element>html</a></code> element, and only
- <em>then</em> would it trigger the <code id=the-body-element:handler-onerror-3><a href=#handler-onerror>onerror</a></code> <a href=#event-handler-content-attributes id=the-body-element:event-handler-content-attributes-3>event handler content attribute</a> on the
- <code id=the-body-element:the-body-element-12><a href=#the-body-element>body</a></code> element. This is because the event would bubble from the target, to the
- <code id=the-body-element:the-body-element-13><a href=#the-body-element>body</a></code>, to the <code id=the-body-element:the-html-element-3><a href=#the-html-element>html</a></code>, to the <code id=the-body-element:document-2><a href=#document>Document</a></code>, to the
- <code id=the-body-element:window-3><a href=#window>Window</a></code>, and the <a href=#event-handlers id=the-body-element:event-handlers-4>event handler</a> on the
- <code id=the-body-element:the-body-element-14><a href=#the-body-element>body</a></code> is watching the <code id=the-body-element:window-4><a href=#window>Window</a></code> not the <code id=the-body-element:the-body-element-15><a href=#the-body-element>body</a></code>. A regular event
- listener attached to the <code id=the-body-element:the-body-element-16><a href=#the-body-element>body</a></code> using <code>addEventListener()</code>,
- however, would be run when the event bubbled through the <code id=the-body-element:the-body-element-17><a href=#the-body-element>body</a></code> and not when it reaches
- the <code id=the-body-element:window-5><a href=#window>Window</a></code> object.</p>
- <div class=example>
- <p>This page updates an indicator to show whether or not the user is online:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Online or offline?</title>
- <script>
- function update(online) {
- document.getElementById('status').textContent =
- online ? 'Online' : 'Offline';
- }
- </script>
- </head>
- <body ononline="update(true)"
- onoffline="update(false)"
- onload="update(navigator.onLine)">
- <p>You are: <span id="status">(Unknown)</span></p>
- </body>
- </html></pre>
- </div>
- <h4 id=the-article-element>4.3.2 The <dfn><code>article</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-article-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-article-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-content-2 id=the-article-element:sectioning-content-2>Sectioning content</a>.<dd><a href=#palpable-content-2 id=the-article-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-article-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-article-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-article-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-article-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-article-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-article-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-article-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-article-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-article-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-article-element:the-article-element><a href=#the-article-element>article</a></code> element <a href=#represents id=the-article-element:represents>represents</a> a complete, or self-contained,
- composition in a document, page, application, or site and that is, in principle, independently
- distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or
- newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any
- other independent item of content.</p>
-
- <p>When <code id=the-article-element:the-article-element-2><a href=#the-article-element>article</a></code> elements are nested, the inner <code id=the-article-element:the-article-element-3><a href=#the-article-element>article</a></code> elements
- represent articles that are in principle related to the contents of the outer article. For
- instance, a blog entry on a site that accepts user-submitted comments could represent the comments
- as <code id=the-article-element:the-article-element-4><a href=#the-article-element>article</a></code> elements nested within the <code id=the-article-element:the-article-element-5><a href=#the-article-element>article</a></code> element for the blog
- entry.</p>
- <p>Author information associated with an <code id=the-article-element:the-article-element-6><a href=#the-article-element>article</a></code> element (q.v. the
- <code id=the-article-element:the-address-element><a href=#the-address-element>address</a></code> element) does not apply to nested <code id=the-article-element:the-article-element-7><a href=#the-article-element>article</a></code> elements.</p>
- <p class=note>When used specifically with content to be redistributed in syndication, the
- <code id=the-article-element:the-article-element-8><a href=#the-article-element>article</a></code> element is similar in purpose to the <code>entry</code> element in
- Atom. <a href=#refsATOM>[ATOM]</a>
- <p class=note>The schema.org microdata vocabulary can be used to provide the publication date
- for an <code id=the-article-element:the-article-element-9><a href=#the-article-element>article</a></code> element, using one of the CreativeWork subtypes.</p>
- <p>When the main content of the page (i.e. excluding footers, headers, navigation blocks, and
- sidebars) is all one single self-contained composition, that content may be marked with an
- <code id=the-article-element:the-article-element-10><a href=#the-article-element>article</a></code>, but it is technically redundant in that case (since it's self-evident that
- the page is a single composition, as it is a single document).</p>
- <div id=article-example class=example>
- <p>This example shows a blog post using the <code id=the-article-element:the-article-element-11><a href=#the-article-element>article</a></code> element, with some schema.org
- annotations:</p>
- <pre><article itemscope itemtype="http://schema.org/BlogPosting">
- <header>
- <h1 itemprop="headline">The Very First Rule of Life</h1>
- <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
- <link itemprop="url" href="?comments=0">
- </header>
- <p>If there's a microphone anywhere near you, assume it's hot and
- sending whatever you're saying to the world. Seriously.</p>
- <p><em>...</em></p>
- <footer>
- <a itemprop="discussionUrl" href="?comments=1">Show comments...</a>
- </footer>
- </article></pre>
- <p>Here is that same blog post, but showing some of the comments:</p>
- <pre><article itemscope itemtype="http://schema.org/BlogPosting">
- <header>
- <h1 itemprop="headline">The Very First Rule of Life</h1>
- <p><time itemprop="datePublished" datetime="2009-10-09">3 days ago</time></p>
- <link itemprop="url" href="?comments=0">
- </header>
- <p>If there's a microphone anywhere near you, assume it's hot and
- sending whatever you're saying to the world. Seriously.</p>
- <p><em>...</em></p>
- <section>
- <h1>Comments</h1>
- <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
- <link itemprop="url" href="#c1">
- <footer>
- <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
- <span itemprop="name">George Washington</span>
- </span></p>
- <p><time itemprop="commentTime" datetime="2009-10-10">15 minutes ago</time></p>
- </footer>
- <p>Yeah! Especially when talking about your lobbyist friends!</p>
- </article>
- <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
- <link itemprop="url" href="#c2">
- <footer>
- <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
- <span itemprop="name">George Hammond</span>
- </span></p>
- <p><time itemprop="commentTime" datetime="2009-10-10">5 minutes ago</time></p>
- </footer>
- <p>Hey, you have the same first name as me.</p>
- </article>
- </section>
- </article></pre>
- <p>Notice the use of <code id=the-article-element:the-footer-element><a href=#the-footer-element>footer</a></code> to give the information for each comment (such as who
- wrote it and when): the <code id=the-article-element:the-footer-element-2><a href=#the-footer-element>footer</a></code> element <em>can</em> appear at the start of its
- section when appropriate, such as in this case. (Using <code id=the-article-element:the-header-element><a href=#the-header-element>header</a></code> in this case wouldn't
- be wrong either; it's mostly a matter of authoring preference.)</p>
- </div>
- <h4 id=the-section-element>4.3.3 The <dfn><code>section</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-section-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-section-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-content-2 id=the-section-element:sectioning-content-2>Sectioning content</a>.<dd><a href=#palpable-content-2 id=the-section-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-section-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-section-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-section-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-section-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-section-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-section-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-section-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-section-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-section-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-section-element:the-section-element><a href=#the-section-element>section</a></code> element <a href=#represents id=the-section-element:represents>represents</a> a generic section of a document or
- application. A section, in this context, is a thematic grouping of content, typically with a
- heading.</p>
- <p class=example>Examples of sections would be chapters, the various tabbed pages in a tabbed
- dialog box, or the numbered sections of a thesis. A Web site's home page could be split into
- sections for an introduction, news items, and contact information.</p>
- <p class=note>Authors are encouraged to use the <code id=the-section-element:the-article-element><a href=#the-article-element>article</a></code> element instead of the
- <code id=the-section-element:the-section-element-2><a href=#the-section-element>section</a></code> element when it would make sense to syndicate the contents of the
- element.</p>
- <p id=use-div-for-wrappers class=note>The <code id=the-section-element:the-section-element-3><a href=#the-section-element>section</a></code> element is not a generic
- container element. When an element is needed only for styling purposes or as a convenience for
- scripting, authors are encouraged to use the <code id=the-section-element:the-div-element><a href=#the-div-element>div</a></code> element instead. A general rule is
- that the <code id=the-section-element:the-section-element-4><a href=#the-section-element>section</a></code> element is appropriate only if the element's contents would be
- listed explicitly in the document's <a href=#outline id=the-section-element:outline>outline</a>.</p>
- <div class=example>
- <p>In the following example, we see an article (part of a larger Web page) about apples,
- containing two short sections.</p>
- <pre><article>
- <hgroup>
- <h1>Apples</h1>
- <h2>Tasty, delicious fruit!</h2>
- </hgroup>
- <p>The apple is the pomaceous fruit of the apple tree.</p>
- <section>
- <h1>Red Delicious</h1>
- <p>These bright red apples are the most common found in many
- supermarkets.</p>
- </section>
- <section>
- <h1>Granny Smith</h1>
- <p>These juicy, green apples make a great filling for
- apple pies.</p>
- </section>
- </article></pre>
- <p>Notice how the use of <code id=the-section-element:the-section-element-5><a href=#the-section-element>section</a></code> means that the author can use <code id=the-section-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
- elements throughout, without having to worry about whether a particular section is at the top
- level, the second level, the third level, and so on.</p>
- </div>
- <div class=example>
- <p>Here is a graduation programme with two sections, one for the list of people graduating, and
- one for the description of the ceremony. (The markup in this example features an uncommon style
- sometimes used to minimise the amount of <a href=#inter-element-whitespace id=the-section-element:inter-element-whitespace>inter-element whitespace</a>.)</p>
- <pre><!DOCTYPE Html>
- <Html
- ><Head
- ><Title
- >Graduation Ceremony Summer 2022</Title
- ></Head
- ><Body
- ><H1
- >Graduation</H1
- ><Section
- ><H1
- >Ceremony</H1
- ><P
- >Opening Procession</P
- ><P
- >Speech by Validactorian</P
- ><P
- >Speech by Class President</P
- ><P
- >Presentation of Diplomas</P
- ><P
- >Closing Speech by Headmaster</P
- ></Section
- ><Section
- ><H1
- >Graduates</H1
- ><Ul
- ><Li
- >Molly Carpenter</Li
- ><Li
- >Anastasia Luccio</Li
- ><Li
- >Ebenezar McCoy</Li
- ><Li
- >Karrin Murphy</Li
- ><Li
- >Thomas Raith</Li
- ><Li
- >Susan Rodriguez</Li
- ></Ul
- ></Section
- ></Body
- ></Html></pre>
- </div>
- <div class=example>
- <p>In this example, a book author has marked up some sections as chapters and some as appendices,
- and uses CSS to style the headers in these two classes of section differently. The whole book is
- wrapped in an <code id=the-section-element:the-article-element-2><a href=#the-article-element>article</a></code> element as part of an even larger document containing other
- books.</p>
- <pre><article class="book">
- <style>
- section { border: double medium; margin: 2em; }
- section.chapter h1 { font: 2em Roboto, Helvetica Neue, sans-serif; }
- section.appendix h1 { font: small-caps 2em Roboto, Helvetica Neue, sans-serif; }
- </style>
- <header>
- <hgroup>
- <h1>My Book</h1>
- <h2>A sample with not much content</h2>
- </hgroup>
- <p><small>Published by Dummy Publicorp Ltd.</small></p>
- </header>
- <section class="chapter">
- <h1>My First Chapter</h1>
- <p>This is the first of my chapters. It doesn't say much.</p>
- <p>But it has two paragraphs!</p>
- </section>
- <section class="chapter">
- <h1>It Continutes: The Second Chapter</h1>
- <p>Bla dee bla, dee bla dee bla. Boom.</p>
- </section>
- <section class="chapter">
- <h1>Chapter Three: A Further Example</h1>
- <p>It's not like a battle between brightness and earthtones would go
- unnoticed.</p>
- <p>But it might ruin my story.</p>
- </section>
- <section class="appendix">
- <h1>Appendix A: Overview of Examples</h1>
- <p>These are demonstrations.</p>
- </section>
- <section class="appendix">
- <h1>Appendix B: Some Closing Remarks</h1>
- <p>Hopefully this long example shows that you <em>can</em> style
- sections, so long as they are used to indicate actual sections.</p>
- </section>
- </article></pre>
- </div>
- <h4 id=the-nav-element>4.3.4 The <dfn><code>nav</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-nav-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-nav-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-content-2 id=the-nav-element:sectioning-content-2>Sectioning content</a>.<dd><a href=#palpable-content-2 id=the-nav-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-nav-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-nav-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-nav-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-nav-element:flow-content-2-3>Flow content</a>, but with no <code id=the-nav-element:the-main-element><a href=#the-main-element>main</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-nav-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-nav-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-nav-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-nav-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-nav-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-nav-element:the-nav-element><a href=#the-nav-element>nav</a></code> element <a href=#represents id=the-nav-element:represents>represents</a> a section of a page that links to other
- pages or to parts within the page: a section with navigation links.</p>
- <p class=note>Not all groups of links on a page need to be in a <code id=the-nav-element:the-nav-element-2><a href=#the-nav-element>nav</a></code> element —
- the element is primarily intended for sections that consist of major navigation blocks. In
- particular, it is common for footers to have a short list of links to various pages of a site,
- such as the terms of service, the home page, and a copyright page. The <code id=the-nav-element:the-footer-element><a href=#the-footer-element>footer</a></code> element
- alone is sufficient for such cases; while a <code id=the-nav-element:the-nav-element-3><a href=#the-nav-element>nav</a></code> element can be used in such cases, it
- is usually unnecessary.</p>
- <p class=note>User agents (such as screen readers) that are targeted at users who can benefit
- from navigation information being omitted in the initial rendering, or who can benefit from
- navigation information being immediately available, can use this element as a way to determine
- what content on the page to initially skip or provide on request (or both).</p>
- <div class=example>
- <p>In the following example, there are two <code id=the-nav-element:the-nav-element-4><a href=#the-nav-element>nav</a></code> elements, one for primary navigation
- around the site, and one for secondary navigation around the page itself.</p>
- <pre><body>
- <h1>The Wiki Center Of Exampland</h1>
- <nav>
- <ul>
- <li><a href="/">Home</a></li>
- <li><a href="/events">Current Events</a></li>
- <em>...more...</em>
- </ul>
- </nav>
- <article>
- <header>
- <h1>Demos in Exampland</h1>
- <p>Written by A. N. Other.</p>
- </header>
- <nav>
- <ul>
- <li><a href="#public">Public demonstrations</a></li>
- <li><a href="#destroy">Demolitions</a></li>
- <em>...more...</em>
- </ul>
- </nav>
- <div>
- <section id="public">
- <h1>Public demonstrations</h1>
- <p><em>...more...</em></p>
- </section>
- <section id="destroy">
- <h1>Demolitions</h1>
- <p><em>...more...</em></p>
- </section>
- <em>...more...</em>
- </div>
- <footer>
- <p><a href="?edit">Edit</a> | <a href="?delete">Delete</a> | <a href="?Rename">Rename</a></p>
- </footer>
- </article>
- <footer>
- <p><small>© copyright 1998 Exampland Emperor</small></p>
- </footer>
- </body></pre>
- </div>
- <div class=example>
- <p>In the following example, the page has several places where links are present, but only one of
- those places is considered a navigation section.</p>
- <pre><body itemscope itemtype="http://schema.org/Blog">
- <header>
- <h1>Wake up sheeple!</h1>
- <p><a href="news.html">News</a> -
- <a href="blog.html">Blog</a> -
- <a href="forums.html">Forums</a></p>
- <p>Last Modified: <span itemprop="dateModified">2009-04-01</span></p>
- <nav>
- <h1>Navigation</h1>
- <ul>
- <li><a href="articles.html">Index of all articles</a></li>
- <li><a href="today.html">Things sheeple need to wake up for today</a></li>
- <li><a href="successes.html">Sheeple we have managed to wake</a></li>
- </ul>
- </nav>
- </header>
- <main>
- <article itemprop="blogPosts" itemscope itemtype="http://schema.org/BlogPosting">
- <header>
- <h1 itemprop="headline">My Day at the Beach</h1>
- </header>
- <main itemprop="articleBody">
- <p>Today I went to the beach and had a lot of fun.</p>
- <em>...more content...</em>
- </main>
- <footer>
- <p>Posted <time itemprop="datePublished" datetime="2009-10-10">Thursday</time>.</p>
- </footer>
- </article>
- <em>...more blog posts...</em>
- </main>
- <footer>
- <p>Copyright ©
- <span itemprop="copyrightYear">2010</span>
- <span itemprop="copyrightHolder">The Example Company</span>
- </p>
- <p><a href="about.html">About</a> -
- <a href="policy.html">Privacy Policy</a> -
- <a href="contact.html">Contact Us</a></p>
- </footer>
- </body></pre>
- <p>Notice the <code id=the-nav-element:the-main-element-2><a href=#the-main-element>main</a></code> elements being used to wrap all the contents of the page other
- than the header and footer, and all the contents of the blog entry other than its header and
- footer.</p>
- <p>You can also see microdata annotations in the above example that use the schema.org vocabulary
- to provide the publication date and other metadata about the blog post.</p>
- </div>
- <div class=example>
- <p>A <code id=the-nav-element:the-nav-element-5><a href=#the-nav-element>nav</a></code> element doesn't have to contain a list, it can contain other kinds of
- content as well. In this navigation block, links are provided in prose:</p>
- <pre><nav>
- <h1>Navigation</h1>
- <p>You are on my home page. To the north lies <a href="/blog">my
- blog</a>, from whence the sounds of battle can be heard. To the east
- you can see a large mountain, upon which many <a
- href="/school">school papers</a> are littered. Far up thus mountain
- you can spy a little figure who appears to be me, desperately
- scribbling a <a href="/school/thesis">thesis</a>.</p>
- <p>To the west are several exits. One fun-looking exit is labeled <a
- href="http://games.example.com/">"games"</a>. Another more
- boring-looking exit is labeled <a
- href="http://isp.example.net/">ISP™</a>.</p>
- <p>To the south lies a dark and dank <a href="/about">contacts
- page</a>. Cobwebs cover its disused entrance, and at one point you
- see a rat run quickly out of the page.</p>
- </nav></pre>
- </div>
- <h4 id=the-aside-element>4.3.5 The <dfn><code>aside</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-aside-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-aside-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-content-2 id=the-aside-element:sectioning-content-2>Sectioning content</a>.<dd><a href=#palpable-content-2 id=the-aside-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-aside-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-aside-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-aside-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-aside-element:flow-content-2-3>Flow content</a>, but with no <code id=the-aside-element:the-main-element><a href=#the-main-element>main</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-aside-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-aside-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-aside-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-aside-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-aside-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-aside-element:the-aside-element><a href=#the-aside-element>aside</a></code> element <a href=#represents id=the-aside-element:represents>represents</a> a section of a page that consists of
- content that is tangentially related to the content around the <code id=the-aside-element:the-aside-element-2><a href=#the-aside-element>aside</a></code> element, and
- which could be considered separate from that content. Such sections are often represented as
- sidebars in printed typography.</p>
- <p>The element can be used for typographical effects like pull quotes or sidebars, for
- advertising, for groups of <code id=the-aside-element:the-nav-element><a href=#the-nav-element>nav</a></code> elements, and for other content that is considered
- separate from the main content of the page.</p>
- <p class=note>It's not appropriate to use the <code id=the-aside-element:the-aside-element-3><a href=#the-aside-element>aside</a></code> element just for
- parentheticals, since those are part of the main flow of the document.</p>
- <div class=example>
- <p>The following example shows how an aside is used to mark up background material on Switzerland
- in a much longer news story on Europe.</p>
- <pre><aside>
- <h1>Switzerland</h1>
- <p>Switzerland, a land-locked country in the middle of geographic
- Europe, has not joined the geopolitical European Union, though it is
- a signatory to a number of European treaties.</p>
- </aside></pre>
- </div>
- <div class=example>
- <p>The following example shows how an aside is used to mark up a pull quote in a longer
- article.</p>
- <pre>...
- <p>He later joined a large company, continuing on the same work.
- <q>I love my job. People ask me what I do for fun when I'm not at
- work. But I'm paid to do my hobby, so I never know what to
- answer. Some people wonder what they would do if they didn't have to
- work... but I know what I would do, because I was unemployed for a
- year, and I filled that time doing exactly what I do now.</q></p>
- <aside>
- <q> People ask me what I do for fun when I'm not at work. But I'm
- paid to do my hobby, so I never know what to answer. </q>
- </aside>
- <p>Of course his work — or should that be hobby? —
- isn't his only passion. He also enjoys other pleasures.</p>
- ...</pre>
- </div>
- <div class=example>
- <p>The following extract shows how <code id=the-aside-element:the-aside-element-4><a href=#the-aside-element>aside</a></code> can be used for blogrolls and other side
- content on a blog:</p>
- <pre><body>
- <header>
- <h1>My wonderful blog</h1>
- <p>My tagline</p>
- </header>
- <aside>
- <!-- <em>this aside contains two sections that are tangentially related
- to the page, namely, links to other blogs, and links to blog posts
- from this blog</em> -->
- <nav>
- <h1>My blogroll</h1>
- <ul>
- <li><a href="http://blog.example.com/">Example Blog</a>
- </ul>
- </nav>
- <nav>
- <h1>Archives</h1>
- <ol reversed>
- <li><a href="/last-post">My last post</a>
- <li><a href="/first-post">My first post</a>
- </ol>
- </nav>
- </aside>
- <aside>
- <!-- <em>this aside is tangentially related to the page also, it
- contains twitter messages from the blog author</em> -->
- <h1>Twitter Feed</h1>
- <blockquote cite="http://twitter.example.net/t31351234">
- I'm on vacation, writing my blog.
- </blockquote>
- <blockquote cite="http://twitter.example.net/t31219752">
- I'm going to go on vacation soon.
- </blockquote>
- </aside>
- <article>
- <!-- <em>this is a blog post</em> -->
- <h1>My last post</h1>
- <p>This is my last post.</p>
- <footer>
- <p><a href="/last-post" rel=bookmark>Permalink</a>
- </footer>
- </article>
- <article>
- <!-- <em>this is also a blog post</em> -->
- <h1>My first post</h1>
- <p>This is my first post.</p>
- <aside>
- <!-- <em>this aside is about the blog post, since it's inside the
- <article> element; it would be wrong, for instance, to put the
- blogroll here, since the blogroll isn't really related to this post
- specifically, only to the page as a whole</em> -->
- <h1>Posting</h1>
- <p>While I'm thinking about it, I wanted to say something about
- posting. Posting is fun!</p>
- </aside>
- <footer>
- <p><a href="/first-post" rel=bookmark>Permalink</a>
- </footer>
- </article>
- <footer>
- <nav>
- <a href="/archives">Archives</a> —
- <a href="/about">About me</a> —
- <a href="/copyright">Copyright</a>
- </nav>
- </footer>
- </body></pre>
- </div>
- <h4 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>4.3.6 The <dfn id=the-h1-element><code>h1</code></dfn>, <dfn id=the-h2-element><code>h2</code></dfn>, <dfn id=the-h3-element><code>h3</code></dfn>, <dfn id=the-h4-element><code>h4</code></dfn>, <dfn id=the-h5-element><code>h5</code></dfn>, and
- <dfn id=the-h6-element><code>h6</code></dfn> elements</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:flow-content-2>Flow content</a>.<dd><a href=#heading-content-2 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:heading-content-2>Heading content</a>.<dd><a href=#palpable-content-2 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of an <code id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element.<dd>Where <a href=#flow-content-2 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlheadingelement>HTMLHeadingElement</dfn> : <a href=#htmlelement id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:htmlelement>HTMLElement</a> {
- // <a href="#HTMLHeadingElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>These elements <a href=#represents id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:represents>represent</a> headings for their sections.</p>
- <p>The semantics and meaning of these elements are defined in the section on <a href=#headings-and-sections id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:headings-and-sections>headings and
- sections</a>.</p>
- <p>These elements have a <dfn id=rank>rank</dfn> given by the number in their name. The <code id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
- element is said to have the highest rank, the <code id=the-h1,-h2,-h3,-h4,-h5,-and-h6-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element has the lowest rank, and two
- elements with the same name have equal rank.</p>
- <div class=example>
- <p>As far as their respective document outlines (their heading and section structures) are
- concerned, these two snippets are semantically equivalent:</p>
- <pre><body>
- <h1>Let's call it a draw(ing surface)</h1>
- <h2>Diving in</h2>
- <h2>Simple shapes</h2>
- <h2>Canvas coordinates</h2>
- <h3>Canvas coordinates diagram</h3>
- <h2>Paths</h2>
- </body></pre>
- <pre><body>
- <h1>Let's call it a draw(ing surface)</h1>
- <section>
- <h1>Diving in</h1>
- </section>
- <section>
- <h1>Simple shapes</h1>
- </section>
- <section>
- <h1>Canvas coordinates</h1>
- <section>
- <h1>Canvas coordinates diagram</h1>
- </section>
- </section>
- <section>
- <h1>Paths</h1>
- </section>
- </body></pre>
- <p>Authors might prefer the former style for its terseness, or the latter style for its
- convenience in the face of heavy editing; which is best is purely an issue of preferred authoring
- style.</p>
- <p>The two styles can be combined, for compatibility with legacy tools while still
- future-proofing for when that compatibility is no longer needed. This third snippet again has the
- same outline as the previous two:</p>
- <pre><body>
- <h1>Let's call it a draw(ing surface)</h1>
- <section>
- <h2>Diving in</h2>
- </section>
- <section>
- <h2>Simple shapes</h2>
- </section>
- <section>
- <h2>Canvas coordinates</h2>
- <section>
- <h3>Canvas coordinates diagram</h3>
- </section>
- </section>
- <section>
- <h2>Paths</h2>
- </section>
- </body></pre>
- </div>
- <h4 id=the-hgroup-element>4.3.7 The <dfn><code>hgroup</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-hgroup-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-hgroup-element:flow-content-2>Flow content</a>.<dd><a href=#heading-content-2 id=the-hgroup-element:heading-content-2>Heading content</a>.<dd><a href=#palpable-content-2 id=the-hgroup-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-hgroup-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-hgroup-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-hgroup-element:concept-element-content-model>Content model</a>:<dd>One or more <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, and <code id=the-hgroup-element:the-template-element><a href=#the-template-element>template</a></code> elements.<dt><a href=#concept-element-tag-omission id=the-hgroup-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-hgroup-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-hgroup-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-hgroup-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-hgroup-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-hgroup-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element <a href=#represents id=the-hgroup-element:represents>represents</a> the heading of a section, which
- consists of all the <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-7><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element children of the
- <code id=the-hgroup-element:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code> element. The element is used to group a set of
- <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-9><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-10><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements when the heading has multiple levels, such as
- subheadings, alternative titles, or taglines.</p>
- <p>The <a href=#rank id=the-hgroup-element:rank>rank</a> of an <code id=the-hgroup-element:the-hgroup-element-3><a href=#the-hgroup-element>hgroup</a></code> element is the rank of the highest-ranked
- <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-11><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-12><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element descendant of the <code id=the-hgroup-element:the-hgroup-element-4><a href=#the-hgroup-element>hgroup</a></code> element, if
- there are any such elements, or otherwise the same as for an <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-13><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element (the highest
- rank). Other elements of <a href=#heading-content-2 id=the-hgroup-element:heading-content-2-2>heading content</a> in the <code id=the-hgroup-element:the-hgroup-element-5><a href=#the-hgroup-element>hgroup</a></code> element indicate
- subheadings or subtitles.</p>
- <p>The section on <a href=#headings-and-sections id=the-hgroup-element:headings-and-sections>headings and sections</a> defines how <code id=the-hgroup-element:the-hgroup-element-6><a href=#the-hgroup-element>hgroup</a></code> elements are
- assigned to individual sections.</p>
- <div class=example>
- <p>Here are some examples of valid headings.</p>
- <pre><hgroup>
- <h1>The reality dysfunction</h1>
- <h2>Space is not the only void</h2>
- </hgroup></pre>
- <pre><hgroup>
- <h1>Dr. Strangelove</h1>
- <h2>Or: How I Learned to Stop Worrying and Love the Bomb</h2>
- </hgroup></pre>
- <p>The point of using <code id=the-hgroup-element:the-hgroup-element-7><a href=#the-hgroup-element>hgroup</a></code> in these examples is to mask the <code id=the-hgroup-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-14><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
- element (which acts as a secondary title) from the <a href=#outline id=the-hgroup-element:outline>outline</a> algorithm.</p>
-
- <p>How a user agent exposes such multi-level headings in user interfaces (e.g. in tables of
- contents or search results) is left open to implementors, as it is a user interface issue. The
- first example above could be rendered as:</p>
- <pre>The reality dysfunction: Space is not the only void</pre>
- <p>Alternatively, it could look like this:
- <pre>The reality dysfunction (Space is not the only void)</pre>
- <p>In interfaces where a title can be rendered on multiple lines, it could be rendered as
- follows, maybe with the first line in a bigger font size:</p>
- <pre>The reality dysfunction
- Space is not the only void</pre>
- </div>
- <h4 id=the-header-element>4.3.8 The <dfn><code>header</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-header-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-header-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-header-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-header-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-header-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-header-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-header-element:flow-content-2-3>Flow content</a>, but with no <code id=the-header-element:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-header-element:the-footer-element><a href=#the-footer-element>footer</a></code>, or <code id=the-header-element:the-main-element><a href=#the-main-element>main</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-header-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-header-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-header-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-header-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-header-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-header-element:the-header-element-2><a href=#the-header-element>header</a></code> element <a href=#represents id=the-header-element:represents>represents</a> a group of introductory or navigational
- aids.</p>
- <p class=note>A <code id=the-header-element:the-header-element-3><a href=#the-header-element>header</a></code> element is intended to usually contain the section's heading
- (an <code id=the-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=the-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element or an <code id=the-header-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element), but this is
- not required. The <code id=the-header-element:the-header-element-4><a href=#the-header-element>header</a></code> element can also be used to wrap a section's table of
- contents, a search form, or any relevant logos.</p>
- <div class=example>
- <p>Here are some sample headers. This first one is for a game:</p>
- <pre><header>
- <p>Welcome to...</p>
- <h1>Voidwars!</h1>
- </header></pre>
- <p>The following snippet shows how the element can be used to mark
- up a specification's header:</p>
- <pre><header>
- <hgroup>
- <h1>Scalable Vector Graphics (SVG) 1.2</h1>
- <h2>W3C Working Draft 27 October 2004</h2>
- </hgroup>
- <dl>
- <dt>This version:</dt>
- <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20041027/">http://www.w3.org/TR/2004/WD-SVG12-20041027/</a></dd>
- <dt>Previous version:</dt>
- <dd><a href="http://www.w3.org/TR/2004/WD-SVG12-20040510/">http://www.w3.org/TR/2004/WD-SVG12-20040510/</a></dd>
- <dt>Latest version of SVG 1.2:</dt>
- <dd><a href="http://www.w3.org/TR/SVG12/">http://www.w3.org/TR/SVG12/</a></dd>
- <dt>Latest SVG Recommendation:</dt>
- <dd><a href="http://www.w3.org/TR/SVG/">http://www.w3.org/TR/SVG/</a></dd>
- <dt>Editor:</dt>
- <dd>Dean Jackson, W3C, <a href="mailto:dean@w3.org">dean@w3.org</a></dd>
- <dt>Authors:</dt>
- <dd>See <a href="#authors">Author List</a></dd>
- </dl>
- <p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notic <em>...</em>
- </header></pre>
- </div>
- <p class=note>The <code id=the-header-element:the-header-element-5><a href=#the-header-element>header</a></code> element is not <a href=#sectioning-content-2 id=the-header-element:sectioning-content-2>sectioning content</a>; it doesn't
- introduce a new section.</p>
- <div class=example>
- <p>In this example, the page has a page heading given by the <code id=the-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element, and two
- subsections whose headings are given by <code id=the-header-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> elements. The content after the
- <code id=the-header-element:the-header-element-6><a href=#the-header-element>header</a></code> element is still part of the last subsection started in the
- <code id=the-header-element:the-header-element-7><a href=#the-header-element>header</a></code> element, because the <code id=the-header-element:the-header-element-8><a href=#the-header-element>header</a></code> element doesn't take part in the
- <a href=#outline id=the-header-element:outline>outline</a> algorithm.</p>
- <pre><body>
- <header>
- <h1>Little Green Guys With Guns</h1>
- <nav>
- <ul>
- <li><a href="/games">Games</a>
- <li><a href="/forum">Forum</a>
- <li><a href="/download">Download</a>
- </ul>
- </nav>
- <h2>Important News</h2> <!-- this starts a second subsection -->
- <!-- this is part of the subsection entitled "Important News" -->
- <p>To play today's games you will need to update your client.</p>
- <h2>Games</h2> <!-- this starts a third subsection -->
- </header>
- <p>You have three active games:</p>
- <!-- this is still part of the subsection entitled "Games" -->
- ...</pre>
- </div>
- <h4 id=the-footer-element>4.3.9 The <dfn><code>footer</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-footer-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-footer-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-footer-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-footer-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-footer-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-footer-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-footer-element:flow-content-2-3>Flow content</a>, but with no <code id=the-footer-element:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-footer-element:the-footer-element><a href=#the-footer-element>footer</a></code>, or <code id=the-footer-element:the-main-element><a href=#the-main-element>main</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-footer-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-footer-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-footer-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-footer-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-footer-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-footer-element:the-footer-element-2><a href=#the-footer-element>footer</a></code> element <a href=#represents id=the-footer-element:represents>represents</a> a footer for its nearest ancestor
- <a href=#sectioning-content-2 id=the-footer-element:sectioning-content-2>sectioning content</a> or <a href=#sectioning-root id=the-footer-element:sectioning-root>sectioning root</a> element. A footer typically
- contains information about its section such as who wrote it, links to related documents, copyright
- data, and the like.</p>
- <p>When the <code id=the-footer-element:the-footer-element-3><a href=#the-footer-element>footer</a></code> element contains entire sections, they <a href=#represents id=the-footer-element:represents-2>represent</a> appendices, indexes, long colophons, verbose license
- agreements, and other such content.</p>
- <p class=note>Contact information for the author or editor of a section belongs in an
- <code id=the-footer-element:the-address-element><a href=#the-address-element>address</a></code> element, possibly itself inside a <code id=the-footer-element:the-footer-element-4><a href=#the-footer-element>footer</a></code>. Bylines and other
- information that could be suitable for both a <code id=the-footer-element:the-header-element-2><a href=#the-header-element>header</a></code> or a <code id=the-footer-element:the-footer-element-5><a href=#the-footer-element>footer</a></code> can be
- placed in either (or neither). The primary purpose of these elements is merely to help the author
- write self-explanatory markup that is easy to maintain and style; they are not intended to impose
- specific structures on authors.</p>
- <p>Footers don't necessarily have to appear at the <em>end</em> of a section, though they usually
- do.</p>
- <p>When the nearest ancestor <a href=#sectioning-content-2 id=the-footer-element:sectioning-content-2-2>sectioning content</a> or <a href=#sectioning-root id=the-footer-element:sectioning-root-2>sectioning root</a>
- element is <a href=#the-body-element-2 id=the-footer-element:the-body-element-2>the body element</a>, then it applies to the whole page.</p>
- <p class=note>The <code id=the-footer-element:the-footer-element-6><a href=#the-footer-element>footer</a></code> element is not <a href=#sectioning-content-2 id=the-footer-element:sectioning-content-2-3>sectioning content</a>; it doesn't
- introduce a new section.</p>
- <div class=example>
- <p>Here is a page with two footers, one at the top and one at the bottom, with the same
- content:</p>
- <pre><body>
- <footer><a href="../">Back to index...</a></footer>
- <hgroup>
- <h1>Lorem ipsum</h1>
- <h2>The ipsum of all lorems</h2>
- </hgroup>
- <p>A dolor sit amet, consectetur adipisicing elit, sed do eiusmod
- tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
- veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
- ea commodo consequat. Duis aute irure dolor in reprehenderit in
- voluptate velit esse cillum dolore eu fugiat nulla
- pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
- culpa qui officia deserunt mollit anim id est laborum.</p>
- <footer><a href="../">Back to index...</a></footer>
- </body></pre>
- </div>
- <div class=example>
- <p>Here is an example which shows the <code id=the-footer-element:the-footer-element-7><a href=#the-footer-element>footer</a></code> element being used both for a site-wide
- footer and for a section footer.</p>
- <pre><!DOCTYPE HTML>
- <HTML><HEAD>
- <TITLE>The Ramblings of a Scientist</TITLE>
- <BODY>
- <H1>The Ramblings of a Scientist</H1>
- <ARTICLE>
- <H1>Episode 15</H1>
- <VIDEO SRC="/fm/015.ogv" CONTROLS PRELOAD>
- <P><A HREF="/fm/015.ogv">Download video</A>.</P>
- </VIDEO>
- <FOOTER> <!-- footer for article -->
- <P>Published <TIME DATETIME="2009-10-21T18:26-07:00">on 2009/10/21 at 6:26pm</TIME></P>
- </FOOTER>
- </ARTICLE>
- <ARTICLE>
- <H1>My Favorite Trains</H1>
- <P>I love my trains. My favorite train of all time is a Köf.</P>
- <P>It is fun to see them pull some coal cars because they look so
- dwarfed in comparison.</P>
- <FOOTER> <!-- footer for article -->
- <P>Published <TIME DATETIME="2009-09-15T14:54-07:00">on 2009/09/15 at 2:54pm</TIME></P>
- </FOOTER>
- </ARTICLE>
- <FOOTER> <!-- site wide footer -->
- <NAV>
- <P><A HREF="/credits.html">Credits</A> —
- <A HREF="/tos.html">Terms of Service</A> —
- <A HREF="/index.html">Blog Index</A></P>
- </NAV>
- <P>Copyright © 2009 Gordon Freeman</P>
- </FOOTER>
- </BODY>
- </HTML></pre>
- </div>
- <div class=example>
- <p>Some site designs have what is sometimes referred to as "fat footers" — footers that
- contain a lot of material, including images, links to other articles, links to pages for sending
- feedback, special offers... in some ways, a whole "front page" in the footer.</p>
- <p>This fragment shows the bottom of a page on a site with a "fat footer":</p>
- <pre>...
- <footer>
- <nav>
- <section>
- <h1>Articles</h1>
- <p><img src="images/somersaults.jpeg" alt=""> Go to the gym with
- our somersaults class! Our teacher Jim takes you through the paces
- in this two-part article. <a href="articles/somersaults/1">Part
- 1</a> · <a href="articles/somersaults/2">Part 2</a></p>
- <p><img src="images/kindplus.jpeg"> Tired of walking on the edge of
- a clif<!-- sic -->? Our guest writer Lara shows you how to bumble
- your way through the bars. <a href="articles/kindplus/1">Read
- more...</a></p>
- <p><img src="images/crisps.jpeg"> The chips are down, now all
- that's left is a potato. What can you do with it? <a
- href="articles/crisps/1">Read more...</a></p>
- </section>
- <ul>
- <li> <a href="/about">About us...</a>
- <li> <a href="/feedback">Send feedback!</a>
- <li> <a href="/sitemap">Sitemap</a>
- </ul>
- </nav>
- <p><small>Copyright © 2015 The Snacker —
- <a href="/tos">Terms of Service</a></small></p>
- </footer>
- </body></pre>
- </div>
- <h4 id=the-address-element>4.3.10 The <dfn><code>address</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-address-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-address-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-address-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-address-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-address-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-address-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-address-element:flow-content-2-3>Flow content</a>, but with no <a href=#heading-content-2 id=the-address-element:heading-content-2>heading
- content</a> descendants, no <a href=#sectioning-content-2 id=the-address-element:sectioning-content-2>sectioning content</a>
- descendants, and no <code id=the-address-element:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-address-element:the-footer-element><a href=#the-footer-element>footer</a></code>, or
- <code id=the-address-element:the-address-element><a href=#the-address-element>address</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-address-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-address-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-address-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-address-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-address-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-address-element:the-address-element-2><a href=#the-address-element>address</a></code> element <a href=#represents id=the-address-element:represents>represents</a> the contact information for its
- nearest <code id=the-address-element:the-article-element><a href=#the-article-element>article</a></code> or <code id=the-address-element:the-body-element><a href=#the-body-element>body</a></code> element ancestor. If that is <a href=#the-body-element-2 id=the-address-element:the-body-element-2>the body
- element</a>, then the contact information applies to the document as a whole.</p>
- <div class=example>
- <p>For example, a page at the W3C Web site related to HTML might
- include the following contact information:</p>
- <pre><ADDRESS>
- <A href="../People/Raggett/">Dave Raggett</A>,
- <A href="../People/Arnaud/">Arnaud Le Hors</A>,
- contact persons for the <A href="Activity">W3C HTML Activity</A>
- </ADDRESS></pre>
- </div>
- <p>The <code id=the-address-element:the-address-element-3><a href=#the-address-element>address</a></code> element must not be used to represent arbitrary addresses (e.g. postal
- addresses), unless those addresses are in fact the relevant contact information. (The
- <code id=the-address-element:the-p-element><a href=#the-p-element>p</a></code> element is the appropriate element for marking up postal addresses in general.)</p>
- <p>The <code id=the-address-element:the-address-element-4><a href=#the-address-element>address</a></code> element must not contain information other than contact
- information.</p>
- <div class=example>
- <p>For example, the following is non-conforming use of the
- <code id=the-address-element:the-address-element-5><a href=#the-address-element>address</a></code> element:</p>
- <pre class=bad><ADDRESS>Last Modified: 1999/12/24 23:37:50</ADDRESS></pre>
- </div>
- <p>Typically, the <code id=the-address-element:the-address-element-6><a href=#the-address-element>address</a></code> element would be included along with other information in a
- <code id=the-address-element:the-footer-element-2><a href=#the-footer-element>footer</a></code> element.</p>
-
- <p>The contact information for a node <var>node</var> is a collection of
- <code id=the-address-element:the-address-element-7><a href=#the-address-element>address</a></code> elements defined by the first applicable entry from the following list:</p>
- <dl class=switch><dt>If <var>node</var> is an <code id=the-address-element:the-article-element-2><a href=#the-article-element>article</a></code> element<dt>If <var>node</var> is a <code id=the-address-element:the-body-element-3><a href=#the-body-element>body</a></code> element<dd>
- <p>The contact information consists of all the <code id=the-address-element:the-address-element-8><a href=#the-address-element>address</a></code> elements that have <var>node</var> as an ancestor and do not have another <code id=the-address-element:the-body-element-4><a href=#the-body-element>body</a></code> or
- <code id=the-address-element:the-article-element-3><a href=#the-article-element>article</a></code> element ancestor that is a descendant of <var>node</var>.</p>
- <dt>If <var>node</var> has an ancestor element that is an <code id=the-address-element:the-article-element-4><a href=#the-article-element>article</a></code> element<dt>If <var>node</var> has an ancestor element that is a <code id=the-address-element:the-body-element-5><a href=#the-body-element>body</a></code> element<dd>
- <p>The contact information of <var>node</var> is the same as the contact information of
- the nearest <code id=the-address-element:the-article-element-5><a href=#the-article-element>article</a></code> or <code id=the-address-element:the-body-element-6><a href=#the-body-element>body</a></code> element ancestor, whichever is
- nearest.</p>
- <dt>If <var>node</var>'s <a id=the-address-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> has <a href=#the-body-element-2 id=the-address-element:the-body-element-2-2>a body
- element</a><dd>
- <p>The contact information of <var>node</var> is the same as the contact information of
- <a href=#the-body-element-2 id=the-address-element:the-body-element-2-3>the body element</a> of the <code id=the-address-element:document><a href=#document>Document</a></code>.</p>
- <dt>Otherwise<dd>
- <p>There is no contact information for <var>node</var>.</p>
- </dl>
- <p>User agents may expose the contact information of a node to the user, or use it for other
- purposes, such as indexing sections based on the sections' contact information.</p>
-
- <div class=example>
- <p>In this example the footer contains contact information and a copyright notice.</p>
- <pre><footer>
- <address>
- For more details, contact
- <a href="mailto:js@example.com">John Smith</a>.
- </address>
- <p><small>© copyright 2038 Example Corp.</small></p>
- </footer></pre>
- </div>
- <h4 id=headings-and-sections>4.3.11 <dfn>Headings and sections</dfn></h4>
- <p>The <code id=headings-and-sections:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=headings-and-sections:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements and the <code id=headings-and-sections:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element are
- headings.</p>
- <p>The first element of <a href=#heading-content-2 id=headings-and-sections:heading-content-2>heading content</a> in an element of <a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2>sectioning
- content</a> <a href=#represents id=headings-and-sections:represents>represents</a> the heading for that section. Subsequent headings of equal
- or higher <a href=#rank id=headings-and-sections:rank>rank</a> start new (implied) sections, headings of lower <a href=#rank id=headings-and-sections:rank-2>rank</a>
- start implied subsections that are part of the previous one. In both cases, the element
- <a href=#represents id=headings-and-sections:represents-2>represents</a> the heading of the implied section.</p>
- <p>Certain elements are said to be <dfn id=sectioning-root>sectioning roots</dfn>, including
- <code id=headings-and-sections:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code> and <code id=headings-and-sections:the-td-element><a href=#the-td-element>td</a></code> elements. These elements can have their own outlines,
- but the sections and headings inside these elements do not contribute to the outlines of their
- ancestors.</p>
-
- <ul class="brief category-list"><li><code id=headings-and-sections:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code><li><code id=headings-and-sections:the-body-element><a href=#the-body-element>body</a></code><li><code id=headings-and-sections:the-details-element><a href=#the-details-element>details</a></code><li><code id=headings-and-sections:the-dialog-element><a href=#the-dialog-element>dialog</a></code><li><code id=headings-and-sections:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code><li><code id=headings-and-sections:the-figure-element><a href=#the-figure-element>figure</a></code><li><code id=headings-and-sections:the-td-element-2><a href=#the-td-element>td</a></code></ul>
-
- <p><a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2-2>Sectioning content</a> elements are always considered subsections of their nearest
- ancestor <a href=#sectioning-root id=headings-and-sections:sectioning-root>sectioning root</a> or their nearest ancestor element of <a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2-3>sectioning
- content</a>, whichever is nearest, regardless of what implied sections other headings may have
- created.</p>
- <div class=example>
- <p>For the following fragment:</p>
- <pre><body>
- <h1>Foo</h1>
- <h2>Bar</h2>
- <blockquote>
- <h3>Bla</h3>
- </blockquote>
- <p>Baz</p>
- <h2>Quux</h2>
- <section>
- <h3>Thud</h3>
- </section>
- <p>Grunt</p>
- </body></pre>
- <p>...the structure would be:</p>
- <ol><li>
- Foo (heading of explicit <code id=headings-and-sections:the-body-element-2><a href=#the-body-element>body</a></code> section, containing the "Grunt" paragraph)
- <ol><li>
- Bar (heading starting implied section, containing a block quote and the "Baz" paragraph)
- <li>
- Quux (heading starting implied section with no content other than the heading itself)
- <li>
- Thud (heading of explicit <code id=headings-and-sections:the-section-element><a href=#the-section-element>section</a></code> section)
- </ol>
- </ol>
- <p>Notice how the <code id=headings-and-sections:the-section-element-2><a href=#the-section-element>section</a></code> ends the earlier implicit section so that a later
- paragraph ("Grunt") is back at the top level.</p>
- </div>
- <p>Sections may contain headings of any <a href=#rank id=headings-and-sections:rank-3>rank</a>, but authors are strongly encouraged to
- either use only <code id=headings-and-sections:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements, or to use elements of the appropriate <a href=#rank id=headings-and-sections:rank-4>rank</a>
- for the section's nesting level.</p>
- <p>Authors are also encouraged to explicitly wrap sections in elements of <a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2-4>sectioning
- content</a>, instead of relying on the implicit sections generated by having multiple headings
- in one element of <a href=#sectioning-content-2 id=headings-and-sections:sectioning-content-2-5>sectioning content</a>.</p>
- <div class=example>
- <p>For example, the following is correct:</p>
- <pre><body>
- <h4>Apples</h4>
- <p>Apples are fruit.</p>
- <section>
- <h2>Taste</h2>
- <p>They taste lovely.</p>
- <h6>Sweet</h6>
- <p>Red apples are sweeter than green ones.</p>
- <h1>Colour</h1>
- <p>Apples come in various colours.</p>
- </section>
- </body></pre>
- <p>However, the same document would be more clearly expressed as:</p>
- <pre><body>
- <h1>Apples</h1>
- <p>Apples are fruit.</p>
- <section>
- <h2>Taste</h2>
- <p>They taste lovely.</p>
- <section>
- <h3>Sweet</h3>
- <p>Red apples are sweeter than green ones.</p>
- </section>
- </section>
- <section>
- <h2>Colour</h2>
- <p>Apples come in various colours.</p>
- </section>
- </body></pre>
- <p>Both of the documents above are semantically identical and would produce the same outline in
- compliant user agents.</p>
- <p>This third example is also semantically identical, and might be easier to maintain (e.g. if
- sections are often moved around in editing):</p>
- <pre><body>
- <h1>Apples</h1>
- <p>Apples are fruit.</p>
- <section>
- <h1>Taste</h1>
- <p>They taste lovely.</p>
- <section>
- <h1>Sweet</h1>
- <p>Red apples are sweeter than green ones.</p>
- </section>
- </section>
- <section>
- <h1>Colour</h1>
- <p>Apples come in various colours.</p>
- </section>
- </body></pre>
- <p>This final example would need explicit style rules to be rendered well in legacy browsers.
- Legacy browsers without CSS support would render all the headings as top-level headings.</p>
- </div>
- <h5 id=outlines>4.3.11.1 Creating an outline</h5>
-
-
- <p>This section defines an algorithm for creating an outline for a <a href=#sectioning-content-2 id=outlines:sectioning-content-2>sectioning content</a>
- element or a <a href=#sectioning-root id=outlines:sectioning-root>sectioning root</a> element. It is defined in terms of a walk over the nodes
- of a DOM tree, in <a href=#tree-order id=outlines:tree-order>tree order</a>, with each node being visited when it is <i>entered</i> and when it
- is <i>exited</i> during the walk.</p>
-
- <p>The <dfn id=outline>outline</dfn> for a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-2>sectioning content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-2>sectioning
- root</a> element consists of a list of one or more potentially nested <a href=#concept-section id=outlines:concept-section>sections</a>. The element for which an <a href=#outline id=outlines:outline>outline</a> is created
- is said to be <dfn id="the-outline's-owner">the outline's owner</dfn>.</p>
- <p>A <dfn id=concept-section>section</dfn> is a container that corresponds to some nodes in
- the original DOM tree. Each section can have one heading associated with it, and can contain any
- number of further nested sections. The algorithm for the outline also
- associates each node in the DOM tree with a particular section and potentially a heading.
- (The sections in the outline aren't <code id=outlines:the-section-element><a href=#the-section-element>section</a></code> elements, though some may correspond to
- such elements — they are merely conceptual sections.)</p>
- <div class=example>
- <p>The following markup fragment:</p>
- <pre><body>
- <h1>A</h1>
- <p>B</p>
- <h2>C</h2>
- <p>D</p>
- <h2>E</h2>
- <p>F</p>
- </body></pre>
- <p>...results in the following outline being created for the <code id=outlines:the-body-element><a href=#the-body-element>body</a></code> node (and thus the
- entire document):</p>
- <ol class=brief><li>
- <p>Section created for <code id=outlines:the-body-element-2><a href=#the-body-element>body</a></code> node.</p>
- <p>Associated with heading "A".</p>
- <p>Also associated with paragraph "B".</p>
- <p>Nested sections:</p>
- <ol class=brief><li>
- <p>Section implied for first <code id=outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
- <p>Associated with heading "C".</p>
- <p>Also associated with paragraph "D".</p>
- <p>No nested sections.</p>
- <li>
- <p>Section implied for second <code id=outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code> element.</p>
- <p>Associated with heading "E".</p>
- <p>Also associated with paragraph "F".</p>
- <p>No nested sections.</p>
- </ol>
- </ol>
- </div>
-
- <p>The algorithm that must be followed during a walk of a DOM subtree rooted at a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-3>sectioning
- content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-3>sectioning root</a> element to determine that element's
- <a href=#outline id=outlines:outline-2>outline</a> is as follows:</p>
- <ol><li><p>Let <var>current outline target</var> be null. (It holds the element whose
- <a href=#outline id=outlines:outline-3>outline</a> is being created.)<li><p>Let <var>current section</var> be null. (It holds a pointer to a <a href=#concept-section id=outlines:concept-section-2>section</a>, so that elements in the DOM can all be associated with a
- section.)<li><p>Create a stack to hold elements, which is used to handle nesting. Initialise this stack to
- empty.<li>
- <p>Walk over the DOM in <a href=#tree-order id=outlines:tree-order-2>tree order</a>, starting with the <a href=#sectioning-content-2 id=outlines:sectioning-content-2-4>sectioning
- content</a> element or <a href=#sectioning-root id=outlines:sectioning-root-4>sectioning root</a> element at the root of the subtree for
- which an outline is to be created, and trigger the first relevant step below for each element as
- the walk enters and exits it.</p>
- <dl class=switch><dt>When exiting an element, if that element is the element at the top of the stack<dd>
- <p class=note>The element being exited is a <a href=#heading-content-2 id=outlines:heading-content-2>heading content</a> element or an
- element with a <code id=outlines:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute.</p>
- <p>Pop that element from the stack.</p>
- <dt>If the top of the stack is a <a href=#heading-content-2 id=outlines:heading-content-2-2>heading content</a> element or an element with a
- <code id=outlines:the-hidden-attribute-2><a href=#the-hidden-attribute>hidden</a></code> attribute<dd><p>Do nothing.<dt>When entering an element with a <code id=outlines:the-hidden-attribute-3><a href=#the-hidden-attribute>hidden</a></code> attribute<dd>
- <p>Push the element being entered onto the stack. (This causes the algorithm to skip that
- element and any descendants of the element.)</p>
- <dt>When entering a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-5>sectioning content</a> element<dd>
- <p>Run these steps:</p>
- <ol><li>
- <p>If <var>current outline target</var> is not null, run these substeps:</p>
- <ol><li><p>If the <var>current section</var> has no heading, create an implied
- heading and let that be the heading for the <var>current section</var>.<li><p>Push <var>current outline target</var> onto the stack.</ol>
- <li><p>Let <var>current outline target</var> be the element that is being
- entered.<li><p>Let <var>current section</var> be a newly created <a href=#concept-section id=outlines:concept-section-3>section</a> for the <var>current outline target</var>
- element.<li><p>Associate <var>current outline target</var> with <var>current
- section</var>.<li><p>Let there be a new <a href=#outline id=outlines:outline-4>outline</a> for the new <var>current outline
- target</var>, initialised with just the new <var>current section</var> as the only
- <a href=#concept-section id=outlines:concept-section-4>section</a> in the outline.</ol>
- <dt>When exiting a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-6>sectioning content</a> element, if the stack is not empty<dd>
- <p>Run these steps:</p>
- <ol><li><p>If the <var>current section</var> has no heading, create an implied heading
- and let that be the heading for the <var>current section</var>.<li><p>Pop the top element from the stack, and let the <var>current outline
- target</var> be that element.<li><p>Let <var>current section</var> be the last section in the
- <a href=#outline id=outlines:outline-5>outline</a> of the <var>current outline target</var> element.<li><p>Append the <a href=#outline id=outlines:outline-6>outline</a> of the <a href=#sectioning-content-2 id=outlines:sectioning-content-2-7>sectioning content</a> element being
- exited to the <var>current section</var>. (This does not change which section is
- the last section in the <a href=#outline id=outlines:outline-7>outline</a>.)</ol>
- <dt>When entering a <a href=#sectioning-root id=outlines:sectioning-root-5>sectioning root</a> element<dd>
- <p>Run these steps:</p>
- <ol><li><p>If <var>current outline target</var> is not null, push <var>current outline target</var> onto the stack.<li><p>Let <var>current outline target</var> be the element that is being
- entered.<li><p>Let <var>current outline target</var>'s <i>parent section</i> be <var>current section</var>.<li><p>Let <var>current section</var> be a newly created <a href=#concept-section id=outlines:concept-section-5>section</a> for the <var>current outline target</var>
- element.<li><p>Let there be a new <a href=#outline id=outlines:outline-8>outline</a> for the new <var>current outline
- target</var>, initialised with just the new <var>current section</var> as the only
- <a href=#concept-section id=outlines:concept-section-6>section</a> in the outline.</ol>
- <dt>When exiting a <a href=#sectioning-root id=outlines:sectioning-root-6>sectioning root</a> element, if the stack is not empty<dd>
- <p>Run these steps:</p>
- <ol><li><p>If the <var>current section</var> has no heading, create an implied heading
- and let that be the heading for the <var>current section</var>.<li><p>Let <var>current section</var> be <var>current outline
- target</var>'s <i>parent section</i>.<li><p>Pop the top element from the stack, and let the <var>current outline
- target</var> be that element.</ol>
- <dt>When exiting a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-8>sectioning content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-7>sectioning root</a>
- element (when the stack is empty)<dd>
- <p class=note>The <var>current outline target</var> is the element being exited,
- and it is the <a href=#sectioning-content-2 id=outlines:sectioning-content-2-9>sectioning content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-8>sectioning root</a>
- element at the root of the subtree for which an outline is being generated.</p>
- <p>If the <var>current section</var> has no heading, create an implied heading and
- let that be the heading for the <var>current section</var>.</p>
- <p>Skip to the next step in the overall set of steps. (The walk is over.)</p>
- <dt>When entering a <a href=#heading-content-2 id=outlines:heading-content-2-3>heading content</a> element<dd>
- <p>If the <var>current section</var> has no heading, let the element being entered be
- the heading for the <var>current section</var>.</p>
- <p>Otherwise, if the element being entered has a <a href=#rank id=outlines:rank>rank</a> equal to or higher than the
- heading of the last section of the <a href=#outline id=outlines:outline-9>outline</a> of the <var>current outline
- target</var>, or if the heading of the last section of the <a href=#outline id=outlines:outline-10>outline</a> of the <var>current outline target</var> is an implied heading, then create a new <a href=#concept-section id=outlines:concept-section-7>section</a> and append it to the <a href=#outline id=outlines:outline-11>outline</a> of the <var>current outline target</var> element, so that this new section is the new last
- section of that outline. Let <var>current section</var> be that new section. Let the
- element being entered be the new heading for the <var>current section</var>.</p>
- <p>Otherwise, run these substeps:</p>
- <ol><li><p>Let <var>candidate section</var> be <var>current
- section</var>.<li><p><i>Heading loop</i>: If the element being entered has a <a href=#rank id=outlines:rank-2>rank</a> lower than
- the <a href=#rank id=outlines:rank-3>rank</a> of the heading of the <var>candidate section</var>, then create a new
- <a href=#concept-section id=outlines:concept-section-8>section</a>, and append it to <var>candidate
- section</var>. (This does not change which section is the last section in the outline.) Let
- <var>current section</var> be this new section. Let the element being entered be the
- new heading for the <var>current section</var>. Abort these substeps.</p>
- <li><p>Let <var>new candidate section</var> be the <a href=#concept-section id=outlines:concept-section-9>section</a> that contains <var>candidate section</var> in
- the <a href=#outline id=outlines:outline-12>outline</a> of <var>current outline target</var>.<li><p>Let <var>candidate section</var> be <var>new candidate
- section</var>.<li><p>Return to the step labeled <i>heading loop</i>.</ol>
- <p>Push the element being entered onto the stack. (This causes the algorithm to skip any
- descendants of the element.)</p>
- <p class=note>Recall that <code id=outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> has the <em>highest</em> rank, and <code id=outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
- has the lowest rank.</p>
- <dt>Otherwise<dd><p>Do nothing.</dl>
- <p id=associatedSection>In addition, whenever the walk exits a node, after doing the steps
- above, if the node is not associated with a <a href=#concept-section id=outlines:concept-section-10>section</a> yet,
- associate the node with the <a href=#concept-section id=outlines:concept-section-11>section</a> <var>current
- section</var>.</p>
- <li><p>Associate all non-element nodes that are in the subtree for which an outline is being
- created with the <a href=#concept-section id=outlines:concept-section-12>section</a> with which their parent element is
- associated.<li><p>Associate all nodes in the subtree with the heading of the <a href=#concept-section id=outlines:concept-section-13>section</a> with which they are associated, if any.</ol>
- <p>The tree of sections created by the algorithm above, or a proper subset thereof, must be used
- when generating document outlines, for example when generating tables of contents.</p>
- <p>The outline created for <a href=#the-body-element-2 id=outlines:the-body-element-2-2>the body element</a> of a <code id=outlines:document><a href=#document>Document</a></code> is the
- <a href=#outline id=outlines:outline-13>outline</a> of the entire document.</p>
- <p>When creating an interactive table of contents, entries should jump the user to the relevant
- <a href=#sectioning-content-2 id=outlines:sectioning-content-2-10>sectioning content</a> element, if the <a href=#concept-section id=outlines:concept-section-14>section</a> was
- created for a real element in the original document, or to the relevant <a href=#heading-content-2 id=outlines:heading-content-2-4>heading
- content</a> element, if the <a href=#concept-section id=outlines:concept-section-15>section</a> in the tree was
- generated for a heading in the above process.</p>
- <p class=note>Selecting the first <a href=#concept-section id=outlines:concept-section-16>section</a> of the document
- therefore always takes the user to the top of the document, regardless of where the first heading
- in the <code id=outlines:the-body-element-3><a href=#the-body-element>body</a></code> is to be found.</p>
- <p>The <dfn id=outline-depth>outline depth</dfn> of a <a href=#heading-content-2 id=outlines:heading-content-2-5>heading content</a> element associated with a <a href=#concept-section id=outlines:concept-section-17>section</a> <var>section</var> is the number of <a href=#concept-section id=outlines:concept-section-18>sections</a> that are ancestors of <var>section</var> in the
- outermost <a href=#outline id=outlines:outline-14>outline</a> that <var>section</var> finds itself in when the <a href=#outline id=outlines:outline-15>outlines</a> of its <code id=outlines:document-2><a href=#document>Document</a></code>'s elements are created, plus 1. The
- <a href=#outline-depth id=outlines:outline-depth>outline depth</a> of a <a href=#heading-content-2 id=outlines:heading-content-2-6>heading content</a> element not associated with a <a href=#concept-section id=outlines:concept-section-19>section</a> is 1.</p>
- <p>User agents should provide default headings for sections that do not have explicit section
- headings.</p>
- <div class=example>
- <p>Consider the following snippet:</p>
- <pre><body>
- <nav>
- <p><a href="/">Home</a></p>
- </nav>
- <p>Hello world.</p>
- <aside>
- <p>My cat is cute.</p>
- </aside>
- </body></pre>
- <p>Although it contains no headings, this snippet has three sections: a document (the
- <code id=outlines:the-body-element-4><a href=#the-body-element>body</a></code>) with two subsections (a <code id=outlines:the-nav-element><a href=#the-nav-element>nav</a></code> and an <code id=outlines:the-aside-element><a href=#the-aside-element>aside</a></code>). A user
- agent could present the outline as follows:</p>
- <ol class=brief><li>Untitled document
- <ol><li>Navigation<li>Sidebar</ol>
- </ol>
- <p>These default headings ("Untitled document", "Navigation", "Sidebar") are not specified by
- this specification, and might vary with the user's language, the page's language, the user's
- preferences, the user agent implementor's preferences, etc.</p>
- </div>
- <div class=note>
- <p>The following JavaScript function shows how the tree walk could be implemented. The <var>root</var> argument is the root of the tree to walk (either a <a href=#sectioning-content-2 id=outlines:sectioning-content-2-11>sectioning
- content</a> element or a <a href=#sectioning-root id=outlines:sectioning-root-9>sectioning root</a> element), and the <var>enter</var> and <var>exit</var> arguments are callbacks that are called with
- the nodes as they are entered and exited. <a href=#refsECMA262>[ECMA262]</a></p>
- <pre>function (root, enter, exit) {
- var node = root;
- start: while (node) {
- enter(node);
- if (node.firstChild) {
- node = node.firstChild;
- continue start;
- }
- while (node) {
- exit(node);
- if (node == root) {
- node = null;
- } else if (node.nextSibling) {
- node = node.nextSibling;
- continue start;
- } else {
- node = node.parentNode;
- }
- }
- }
- }</pre>
- </div>
-
- <h5 id=sample-outlines>4.3.11.2 Sample outlines</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>The following document shows a straight-forward application of the <a href=#outline id=sample-outlines:outline>outline</a>
- algorithm. First, here is the document, which is a book with very short chapters and
- subsections:</p>
- <pre><!DOCTYPE HTML>
- <title>The Tax Book (all in one page)</title>
- <h1>The Tax Book</h1>
- <h2>Earning money</h2>
- <p>Earning money is good.</p>
- <h3>Getting a job</h3>
- <p>To earn money you typically need a job.</p>
- <h2>Spending money</h2>
- <p>Spending is what money is mainly used for.</p>
- <h3>Cheap things</h3>
- <p>Buying cheap things often not cost-effective.</p>
- <h3>Expensive things</h3>
- <p>The most expensive thing is often not the most cost-effective either.</p>
- <h2>Investing money</h2>
- <p>You can lend your money to other people.</p>
- <h2>Losing money</h2>
- <p>If you spend money or invest money, sooner or later you will lose money.
- <h3>Poor judgement</h3>
- <p>Usually if you lose money it's because you made a mistake.</p></pre>
- <p>This book would form the following outline:</p>
- <ol class=brief><li> The Tax Book
- <ol class=brief><li> Earning money
- <ol class=brief><li> Getting a job
- </ol>
- <li> Spending money
- <ol class=brief><li> Cheap things
- <li> Expensive things
- </ol>
- <li> Investing money
- <li> Losing money
- <ol class=brief><li> Poor judgement
- </ol>
- </ol>
- </ol>
- <p>Notice that the <code id=sample-outlines:the-title-element><a href=#the-title-element>title</a></code> element does not participate in the outline.</p>
- </div>
- <div class=example>
- <p>Here is a similar document, but this time using <code id=sample-outlines:the-section-element><a href=#the-section-element>section</a></code> elements to get the same
- effect:</p>
- <pre><!DOCTYPE HTML>
- <title>The Tax Book (all in one page)</title>
- <h1>The Tax Book</h1>
- <section>
- <h1>Earning money</h1>
- <p>Earning money is good.</p>
- <section>
- <h1>Getting a job</h1>
- <p>To earn money you typically need a job.</p>
- </section>
- </section>
- <section>
- <h1>Spending money</h1>
- <p>Spending is what money is mainly used for.</p>
- <section>
- <h1>Cheap things</h1>
- <p>Buying cheap things often not cost-effective.</p>
- </section>
- <section>
- <h1>Expensive things</h1>
- <p>The most expensive thing is often not the most cost-effective either.</p>
- </section>
- </section>
- <section>
- <h1>Investing money</h1>
- <p>You can lend your money to other people.</p>
- </section>
- <section>
- <h1>Losing money</h1>
- <p>If you spend money or invest money, sooner or later you will lose money.
- <section>
- <h1>Poor judgement</h1>
- <p>Usually if you lose money it's because you made a mistake.</p>
- </section>
- </section></pre>
- <p>This book would form the same outline:</p>
- <ol class=brief><li> The Tax Book
- <ol class=brief><li> Earning money
- <ol class=brief><li> Getting a job
- </ol>
- <li> Spending money
- <ol class=brief><li> Cheap things
- <li> Expensive things
- </ol>
- <li> Investing money
- <li> Losing money
- <ol class=brief><li> Poor judgement
- </ol>
- </ol>
- </ol>
- </div>
- <div class=example>
- <p>A document can contain multiple top-level headings:</p>
- <pre><!DOCTYPE HTML>
- <title>Alphabetic Fruit</title>
- <h1>Apples</h1>
- <p>Pomaceous.</p>
- <h1>Bananas</h1>
- <p>Edible.</p>
- <h1>Carambola</h1>
- <p>Star.</p></pre>
- <p>This would form the following simple outline consisting of three top-level sections:</p>
- <ol class=brief><li> Apples
- <li> Bananas
- <li> Carambola
- </ol>
- <p>Effectively, the <code id=sample-outlines:the-body-element><a href=#the-body-element>body</a></code> element is split into three.</p>
- </div>
- <div class=example>
- <p>Mixing both the <code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> model and the
- <code id=sample-outlines:the-section-element-2><a href=#the-section-element>section</a></code>/<code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> model can lead to some unintuitive results.</p>
- <p>Consider for example the following, which is just the previous example but with the contents
- of the (implied) <code id=sample-outlines:the-body-element-2><a href=#the-body-element>body</a></code> wrapped in a <code id=sample-outlines:the-section-element-3><a href=#the-section-element>section</a></code>:</p>
- <pre><!DOCTYPE HTML>
- <title>Alphabetic Fruit</title>
- <section>
- <h1>Apples</h1>
- <p>Pomaceous.</p>
- <h1>Bananas</h1>
- <p>Edible.</p>
- <h1>Carambola</h1>
- <p>Star.</p>
- </section></pre>
- <p>The resulting outline would be:</p>
- <ol class=brief><li> <i>(untitled page)</i>
- <ol class=brief><li> Apples
- <li> Bananas
- <li> Carambola
- </ol>
- </ol>
- <p>This result is described as <i>unintuitive</i> because it results in three subsections even
- though there's only one <code id=sample-outlines:the-section-element-4><a href=#the-section-element>section</a></code> element. Effectively, the <code id=sample-outlines:the-section-element-5><a href=#the-section-element>section</a></code> is
- split into three, just like the implied <code id=sample-outlines:the-body-element-3><a href=#the-body-element>body</a></code> element in the previous example.</p>
- <p>(In this example, "<i>(untitled page)</i>" is the implied heading for the <code id=sample-outlines:the-body-element-4><a href=#the-body-element>body</a></code>
- element, since it has no explicit heading.)</p>
- </div>
- <div class=example>
- <p>Headings never rise above other sections. Thus, in the following example, the first
- <code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> does not actually describe the page header; it describes the header for the
- second half of the page:</p>
- <pre><!DOCTYPE HTML>
- <title>Feathers on The Site of Encyclopedic Knowledge</title>
- <section>
- <h1>A plea from our caretakers</h1>
- <p>Please, we beg of you, send help! We're stuck in the server room!</p>
- </section>
- <h1>Feathers</h1>
- <p>Epidermal growths.</p>
- </pre>
- <p>The resulting outline would be:</p>
- <ol class=brief><li> <i>(untitled page)</i>
- <ol class=brief><li> A plea from our caretakers
- </ol>
- <li> Feathers
- </ol>
- </div>
- <div class=example>
- <p>Thus, when an <code id=sample-outlines:the-article-element><a href=#the-article-element>article</a></code> element starts with a <code id=sample-outlines:the-nav-element><a href=#the-nav-element>nav</a></code> block and only later
- has its heading, the result is that the <code id=sample-outlines:the-nav-element-2><a href=#the-nav-element>nav</a></code> block is not part of the same section as
- the rest of the <code id=sample-outlines:the-article-element-2><a href=#the-article-element>article</a></code> in the outline. For instance, take this document:</p>
- <pre><!DOCTYPE HTML>
- <title>We're adopting a child! — Ray's blog</title>
- <h1>Ray's blog</h1>
- <article>
- <header>
- <nav>
- <a href="?t=-1d">Yesterday</a>;
- <a href="?t=-7d">Last week</a>;
- <a href="?t=-1m">Last month</a>
- </nav>
- <h1>We're adopting a child!</h1>
- </header>
- <main>
- <p>As of today, Janine and I have signed the papers to become
- the proud parents of baby Diane! We've been looking forward to
- this day for weeks.</p>
- </main>
- </article></pre>
- <p>The resulting outline would be:</p>
- <ol class=brief><li> Ray's blog
- <ol class=brief><li> <i>Untitled article</i>
- <ol class=brief><li> <i>Untitled navigation section</i>
- </ol>
- <li> We're adopting a child!
- </ol>
- </ol>
- <p>Also worthy of note in this example is that the <code id=sample-outlines:the-header-element><a href=#the-header-element>header</a></code> and <code id=sample-outlines:the-main-element><a href=#the-main-element>main</a></code>
- elements have no effect whatsoever on the document outline.</p>
- </div>
- <div class=example>
- <p>The <code id=sample-outlines:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element can be used for subheadings. For example:</p>
- <pre><!DOCTYPE HTML>
- <title>Chronotype: CS Student</title>
- <hgroup>
- <h1> The morning </h1>
- <h2> 06:00 to 12:00 </h2>
- </hgroup>
- <p>We sleep.</p>
- <hgroup>
- <h1> The afternoon </h1>
- <h2> 12:00 to 18:00 </h2>
- </hgroup>
- <p>We study.</p>
- <hgroup>
- <h2>Additional Commentary</h2>
- <h3>Because not all this is necessarily true</h3>
- <h6>Ok it's almost certainly not true</h6>
- </hgroup>
- <p>Yeah we probably play, rather than study.</p>
- <hgroup>
- <h1> The evening </h1>
- <h2> 18:00 to 00:00 </h2>
- </hgroup>
- <p>We play.</p>
- <hgroup>
- <h1> The night </h1>
- <h2> 00:00 to 06:00 </h2>
- </hgroup>
- <p>We play some more.</p></pre>
- <p>The resulting outline would be:</p>
- <ol class=brief><li> The morning <small>06:00 to 12:00</small>
- <li> The afternoon <small>12:00 to 18:00</small>
- <ol class=brief><li> Additional Commentary <small>Because not all this is necessarily true <small>Ok it's almost certainly not true</small></small>
- </ol>
- <li> The evening <small>18:00 to 00:00</small>
- <li> The night <small>00:00 to 06:00</small>
- </ol>
- <p>Exactly how this is represented by user agents, as most interface issues, is left as a matter
- of implementation preference, but the key part is that the <code id=sample-outlines:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code>'s descendant
- <code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=sample-outlines:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements are what form the element's heading. Thus, the
- following would be equally valid:</p>
- <ol class=brief><li> The morning — 06:00 to 12:00
- <li> The afternoon — 12:00 to 18:00
- <ol class=brief><li> Additional Commentary — Because not all this is necessarily true — Ok it's almost certainly not true
- </ol>
- <li> The evening — 18:00 to 00:00
- <li> The night — 00:00 to 06:00
- </ol>
- <p>But so would the following:</p>
- <ol class=brief><li> The morning
- <li> The afternoon
- <ol class=brief><li> Additional Commentary
- </ol>
- <li> The evening
- <li> The night
- </ol>
- <p>The following would also be valid, though maybe less practical in most contexts:</p>
- <ol class=brief><li> <p>The morning
- <p> 06:00 to 12:00
- <li> <p>The afternoon
- <p> 12:00 to 18:00
- <ol class=brief><li> <p> Additional Commentary
- <p> Because not all this is necessarily true
- <p> Ok it's almost certainly not true
- </ol>
- <li> <p>The evening
- <p> 18:00 to 00:00
- <li> <p>The night
- <p> 00:00 to 06:00
- </ol>
- </div>
- <h5 id=exposing-outlines-to-users>4.3.11.3 Exposing outlines to users</h5>
- <p>User agents are encouraged to expose page outlines to users to aid in navigation. This is
- especially true for non-visual media, e.g. screen readers.</p>
- <p>However, to mitigate the difficulties that arise from authors misusing <a href=#sectioning-content-2 id=exposing-outlines-to-users:sectioning-content-2>sectioning
- content</a>, user agents are also encouraged to offer a mode that navigates the page using
- <a href=#heading-content-2 id=exposing-outlines-to-users:heading-content-2>heading content</a> alone.</p>
- <div class=example>
- <p>For instance, a user agent could map the arrow keys as follows:</p>
- <dl><dt><kbd><kbd>Shift</kbd>+<kbd>← Left</kbd></kbd>
- <dd>Go to previous section, including subsectons of previous sections
- <dt><kbd><kbd>Shift</kbd>+<kbd>→ Right</kbd></kbd>
- <dd>Go to next section, including subsections of the current section
- <dt><kbd><kbd>Shift</kbd>+<kbd>↑ Up</kbd></kbd>
- <dd>Go to parent section of the current section
- <dt><kbd><kbd>Shift</kbd>+<kbd>↓ Down</kbd></kbd>
- <dd>Go to next section, skipping subsections of the current section
- </dl>
- <p>Plus in addition, the user agent could map the <kbd><kbd>j</kbd></kbd> and
- <kbd><kbd>k</kbd></kbd> keys to navigating to the previous or next element of <a href=#heading-content-2 id=exposing-outlines-to-users:heading-content-2-2>heading
- content</a>, regardless of the section's outline depth and ignoring sections with no
- headings.</p>
- </div>
- <h4 id=usage-summary-2>4.3.12 Usage summary</h4>
- <p><i>This section is non-normative.</i></p>
- <table class=vertical-summary-table><thead><tr><th rowspan=2>Element
- <th>Purpose
- <tr><th>Example
- <tbody><tr><td rowspan=2><code id=usage-summary-2:the-body-element><a href=#the-body-element>body</a></code>
- <td>The main content of the document.
- <tr><td><pre class=example><!DOCTYPE HTML>
- <html>
- <head> <title>Steve Hill's Home Page</title> </head>
- <strong><body></strong> <p>Hard Trance is My Life.</p> <strong></body></strong>
- </html></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-article-element><a href=#the-article-element>article</a></code>
- <td>A complete, or self-contained, composition in a document, page, application, or site and that is, in principle, independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.
- <tr><td><pre class=example><strong><article></strong>
- <img src="/tumblr_masqy2s5yn1rzfqbpo1_500.jpg" alt="Yellow smiley face with the caption 'masif'">
- <p>My fave Masif tee so far!</p>
- <footer>Posted 2 days ago</footer>
- <strong></article></strong>
- <strong><article></strong>
- <img src="/tumblr_m9tf6wSr6W1rzfqbpo1_500.jpg" alt="">
- <p>Happy 2nd birthday Masif Saturdays!!!</p>
- <footer>Posted 3 weeks ago</footer>
- <strong></article></strong></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-section-element><a href=#the-section-element>section</a></code>
- <td>A generic section of a document or application. A section, in this context, is a thematic grouping of content, typically with a heading.
- <tr><td><pre class=example><h1>Biography</h1>
- <strong><section></strong>
- <h1>The facts</h1>
- <p>1500+ shows, 14+ countries</p>
- <strong></section></strong>
- <strong><section></strong>
- <h1>2010/2011 figures per year</h1>
- <p>100+ shows, 8+ countries</p>
- <strong></section></strong></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-nav-element><a href=#the-nav-element>nav</a></code>
- <td>A section of a page that links to other pages or to parts within the page: a section with navigation links.
- <tr><td><pre class=example><strong><nav></strong>
- <p><a href="/">Home</a>
- <p><a href="/biog.html">Bio</a>
- <p><a href="/discog.html">Discog</a>
- <strong></nav></strong></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-aside-element><a href=#the-aside-element>aside</a></code>
- <td>A section of a page that consists of content that is tangentially related to the content around the <code id=usage-summary-2:the-aside-element-2><a href=#the-aside-element>aside</a></code> element, and which could be considered separate from that content. Such sections are often represented as sidebars in printed typography.
- <tr><td><pre class=example><h1>Music</h1>
- <p>As any burner can tell you, the event has a lot of trance.</p>
- <strong><aside></strong>You can buy the music we played at our <a href="buy.html">playlist page</a>.<strong></aside></strong>
- <p>This year we played a kind of trance that originated in Belgium, Germany, and the Netherlands in the mid 90s.</p></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
- <td>A section heading
- <tr><td><pre class=example><strong><h1></strong>The Guide To Music On The Playa<strong></h1></strong>
- <strong><h2></strong>The Main Stage<strong></h2></strong>
- <p>If you want to play on a stage, you should bring one.</p>
- <strong><h2></strong>Amplified Music<strong></h2></strong>
- <p>Amplifiers up to 300W or 90dB are welcome.</p></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>
- <td>The heading of a section, which consists of all the <code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> element children of the <code id=usage-summary-2:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code> element. The element is used to group a set of <code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=usage-summary-2:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements when the heading has multiple levels, such as subheadings, alternative titles, or taglines.
- <tr><td><pre class=example><strong><hgroup></strong>
- <h1>Burning Music</h1>
- <h2>The Guide To Music On The Playa</h2>
- <strong></hgroup></strong>
- <section>
- <strong><hgroup></strong>
- <h1>Main Stage</h1>
- <h2>The Fiction Of A Music Festival</h2>
- <strong></hgroup></strong>
- <p>If you want to play on a stage, you should bring one.</p>
- </section>
- <section>
- <strong><hgroup></strong>
- <h1>Loudness!</h1>
- <h2>Questions About Amplified Music</h2>
- <strong></hgroup></strong>
- <p>Amplifiers up to 300W or 90dB are welcome.</p>
- </section></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-header-element><a href=#the-header-element>header</a></code>
- <td>A group of introductory or navigational aids.
- <tr><td><pre class=example><article>
- <strong><header></strong>
- <h1>Hard Trance is My Life</h1>
- <p>By DJ Steve Hill and Technikal</p>
- <strong></header></strong>
- <p>The album with the amusing punctuation has red artwork.</p>
- </article></pre>
- <tr><td rowspan=2><code id=usage-summary-2:the-footer-element><a href=#the-footer-element>footer</a></code>
- <td>A footer for its nearest ancestor <a href=#sectioning-content-2 id=usage-summary-2:sectioning-content-2>sectioning content</a> or <a href=#sectioning-root id=usage-summary-2:sectioning-root>sectioning root</a> element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.
- <tr><td><pre class=example><article>
- <h1>Hard Trance is My Life</h1>
- <p>The album with the amusing punctuation has red artwork.</p>
- <strong><footer></strong>
- <p>Artists: DJ Steve Hill and Technikal</p>
- <strong></footer></strong>
- </article></pre>
- </table>
- <h5 id=article-or-section>4.3.12.1 Article or section?</h5>
- <p><i>This section is non-normative.</i></p>
- <p>A <code id=article-or-section:the-section-element><a href=#the-section-element>section</a></code> forms part of something else. An <code id=article-or-section:the-article-element><a href=#the-article-element>article</a></code> is its own thing.
- But how does one know which is which? Mostly the real answer is "it depends on author intent".</p>
- <p>For example, one could imagine a book with a "Granny Smith" chapter that just said "These
- juicy, green apples make a great filling for apple pies."; that would be a <code id=article-or-section:the-section-element-2><a href=#the-section-element>section</a></code>
- because there'd be lots of other chapters on (maybe) other kinds of apples.</p>
- <p>On the other hand, one could imagine a tweet or reddit comment or tumblr post or newspaper
- classified ad that just said "Granny Smith. These juicy, green apples make a great filling for
- apple pies."; it would then be <code id=article-or-section:the-article-element-2><a href=#the-article-element>article</a></code>s because that was the whole thing.</p>
- <p>A comment on an article is not part of the <code id=article-or-section:the-article-element-3><a href=#the-article-element>article</a></code> on which it is commenting,
- therefore it is its own <code id=article-or-section:the-article-element-4><a href=#the-article-element>article</a></code>.</p>
- <h3 id=grouping-content>4.4 Grouping content</h3>
- <h4 id=the-p-element>4.4.1 The <dfn><code>p</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-p-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-p-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-p-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-p-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-p-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-p-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-p-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-p-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-p-element:the-p-element><a href=#the-p-element>p</a></code> element's <a href=#syntax-end-tag id=the-p-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-p-element:the-p-element-2><a href=#the-p-element>p</a></code> element is immediately followed by an <code id=the-p-element:the-address-element><a href=#the-address-element>address</a></code>, <code id=the-p-element:the-article-element><a href=#the-article-element>article</a></code>,
- <code id=the-p-element:the-aside-element><a href=#the-aside-element>aside</a></code>, <code id=the-p-element:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>, <code id=the-p-element:the-div-element><a href=#the-div-element>div</a></code>, <code id=the-p-element:the-dl-element><a href=#the-dl-element>dl</a></code>,
- <code id=the-p-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>, <code id=the-p-element:the-footer-element><a href=#the-footer-element>footer</a></code>, <code id=the-p-element:the-form-element><a href=#the-form-element>form</a></code>, <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>,
- <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=the-p-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code id=the-p-element:the-header-element><a href=#the-header-element>header</a></code>,
- <code id=the-p-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>, <code id=the-p-element:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=the-p-element:the-main-element><a href=#the-main-element>main</a></code>, <code id=the-p-element:the-menu-element><a href=#the-menu-element>menu</a></code>, <code id=the-p-element:the-nav-element><a href=#the-nav-element>nav</a></code>,
- <code id=the-p-element:the-ol-element><a href=#the-ol-element>ol</a></code>, <code id=the-p-element:the-p-element-3><a href=#the-p-element>p</a></code>, <code id=the-p-element:the-pre-element><a href=#the-pre-element>pre</a></code>, <code id=the-p-element:the-section-element><a href=#the-section-element>section</a></code>, <code id=the-p-element:the-table-element><a href=#the-table-element>table</a></code>, or
- <code id=the-p-element:the-ul-element><a href=#the-ul-element>ul</a></code>, element, or if there is no more content in the parent element and the parent
- element is not an <code id=the-p-element:the-a-element><a href=#the-a-element>a</a></code> element.<dt><a href=#concept-element-attributes id=the-p-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-p-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-p-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlparagraphelement>HTMLParagraphElement</dfn> : <a href=#htmlelement id=the-p-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLParagraphElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-p-element:the-p-element-4><a href=#the-p-element>p</a></code> element <a href=#represents id=the-p-element:represents>represents</a> a <a href=#paragraph id=the-p-element:paragraph>paragraph</a>.</p>
- <p class=note>While paragraphs are usually represented in visual media by blocks of text that
- are physically separated from adjacent blocks through blank lines, a style sheet or user agent
- would be equally justified in presenting paragraph breaks in a different manner, for instance
- using inline pilcrows (¶).</p>
- <div class=example>
- <p>The following examples are conforming HTML fragments:</p>
- <pre><p>The little kitten gently seated himself on a piece of
- carpet. Later in his life, this would be referred to as the time the
- cat sat on the mat.</p></pre>
- <pre><fieldset>
- <legend>Personal information</legend>
- <p>
- <label>Name: <input name="n"></label>
- <label><input name="anon" type="checkbox"> Hide from other users</label>
- </p>
- <p><label>Address: <textarea name="a"></textarea></label></p>
- </fieldset></pre>
- <pre><p>There was once an example from Femley,<br>
- Whose markup was of dubious quality.<br>
- The validator complained,<br>
- So the author was pained,<br>
- To move the error from the markup to the rhyming.</p></pre>
- </div>
- <p>The <code id=the-p-element:the-p-element-5><a href=#the-p-element>p</a></code> element should not be used when a more specific element is more
- appropriate.</p>
- <div class=example>
- <p>The following example is technically correct:</p>
- <pre><section>
- <!-- ... -->
- <p>Last modified: 2001-04-23</p>
- <p>Author: fred@example.com</p>
- </section></pre>
- <p>However, it would be better marked-up as:</p>
- <pre><section>
- <!-- ... -->
- <footer>Last modified: 2001-04-23</footer>
- <address>Author: fred@example.com</address>
- </section></pre>
- <p>Or:</p>
- <pre><section>
- <!-- ... -->
- <footer>
- <p>Last modified: 2001-04-23</p>
- <address>Author: fred@example.com</address>
- </footer>
- </section></pre>
- </div>
- <div class=note>
- <p>List elements (in particular, <code id=the-p-element:the-ol-element-2><a href=#the-ol-element>ol</a></code> and <code id=the-p-element:the-ul-element-2><a href=#the-ul-element>ul</a></code> elements) cannot be children
- of <code id=the-p-element:the-p-element-6><a href=#the-p-element>p</a></code> elements. When a sentence contains a bulleted list, therefore, one might wonder
- how it should be marked up.</p>
- <div class=example>
- <p>For instance, this fantastic sentence has bullets relating to</p>
- <ul><li>wizards,
- <li>faster-than-light travel, and
- <li>telepathy,
- </ul>
- <p>and is further discussed below.</p>
- </div>
- <p>The solution is to realise that a <i id=the-p-element:paragraph-2><a href=#paragraph>paragraph</a></i>, in HTML terms, is not a
- logical concept, but a structural one. In the fantastic example above, there are actually
- <em>five</em> <a href=#paragraph id=the-p-element:paragraph-3>paragraphs</a> as defined by this specification: one
- before the list, one for each bullet, and one after the list.</p>
- <div class=example>
- <p>The markup for the above example could therefore be:</p>
- <pre><p>For instance, this fantastic sentence has bullets relating to</p>
- <ul>
- <li>wizards,
- <li>faster-than-light travel, and
- <li>telepathy,
- </ul>
- <p>and is further discussed below.</p></pre>
- </div>
- <p>Authors wishing to conveniently style such "logical" paragraphs consisting of multiple
- "structural" paragraphs can use the <code id=the-p-element:the-div-element-2><a href=#the-div-element>div</a></code> element instead of the <code id=the-p-element:the-p-element-7><a href=#the-p-element>p</a></code>
- element.</p>
- <div class=example>
- <p>Thus for instance the above example could become the following:</p>
- <pre><div>For instance, this fantastic sentence has bullets relating to
- <ul>
- <li>wizards,
- <li>faster-than-light travel, and
- <li>telepathy,
- </ul>
- and is further discussed below.</div></pre>
- <p>This example still has five structural paragraphs, but now the author can style just the
- <code id=the-p-element:the-div-element-3><a href=#the-div-element>div</a></code> instead of having to consider each part of the example separately.</p>
- </div>
- </div>
- <h4 id=the-hr-element>4.4.2 The <dfn><code>hr</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-hr-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-hr-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-contexts id=the-hr-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-hr-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-hr-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-hr-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-hr-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-hr-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-hr-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-hr-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-hr-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlhrelement>HTMLHRElement</dfn> : <a href=#htmlelement id=the-hr-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLHRElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-hr-element:the-hr-element><a href=#the-hr-element>hr</a></code> element <a href=#represents id=the-hr-element:represents>represents</a> a <a href=#paragraph id=the-hr-element:paragraph>paragraph</a>-level thematic
- break, e.g. a scene change in a story, or a transition to another topic within a section of a
- reference book.</p>
- <div class=example>
- <p>The following fictional extract from a project manual shows two sections that use the
- <code id=the-hr-element:the-hr-element-2><a href=#the-hr-element>hr</a></code> element to separate topics within the section.</p>
- <pre><section>
- <h1>Communication</h1>
- <p>There are various methods of communication. This section
- covers a few of the important ones used by the project.</p>
- <strong><hr></strong>
- <p>Communication stones seem to come in pairs and have mysterious
- properties:</p>
- <ul>
- <li>They can transfer thoughts in two directions once activated
- if used alone.</li>
- <li>If used with another device, they can transfer one's
- consciousness to another body.</li>
- <li>If both stones are used with another device, the
- consciousnesses switch bodies.</li>
- </ul>
- <strong><hr></strong>
- <p>Radios use the electromagnetic spectrum in the meter range and
- longer.</p>
- <strong><hr></strong>
- <p>Signal flares use the electromagnetic spectrum in the
- nanometer range.</p>
- </section>
- <section>
- <h1>Food</h1>
- <p>All food at the project is rationed:</p>
- <dl>
- <dt>Potatoes</dt>
- <dd>Two per day</dd>
- <dt>Soup</dt>
- <dd>One bowl per day</dd>
- </dl>
- <strong><hr></strong>
- <p>Cooking is done by the chefs on a set rotation.</p>
- </section></pre>
- <p>There is no need for an <code id=the-hr-element:the-hr-element-3><a href=#the-hr-element>hr</a></code> element between the sections themselves, since the
- <code id=the-hr-element:the-section-element><a href=#the-section-element>section</a></code> elements and the <code id=the-hr-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements imply thematic changes
- themselves.</p>
- </div>
- <div class=example>
- <p>The following extract from <cite>Pandora's Star</cite> by Peter F. Hamilton shows two
- paragraphs that precede a scene change and the paragraph that follows it. The scene change,
- represented in the printed book by a gap containing a solitary centered star between the second
- and third paragraphs, is here represented using the <code id=the-hr-element:the-hr-element-4><a href=#the-hr-element>hr</a></code> element.</p>
-
- <pre lang=en-GB><p>Dudley was ninety-two, in his second life, and fast approaching
- time for another rejuvenation. Despite his body having the physical
- age of a standard fifty-year-old, the prospect of a long degrading
- campaign within academia was one he regarded with dread. For a
- supposedly advanced civilization, the Intersolar Commonwealth could be
- appallingly backward at times, not to mention cruel.</p>
- <p><i>Maybe it won't be that bad</i>, he told himself. The lie was
- comforting enough to get him through the rest of the night's
- shift.</p>
- <strong><hr></strong>
- <p>The Carlton AllLander drove Dudley home just after dawn. Like the
- astronomer, the vehicle was old and worn, but perfectly capable of
- doing its job. It had a cheap diesel engine, common enough on a
- semi-frontier world like Gralmond, although its drive array was a
- thoroughly modern photoneural processor. With its high suspension and
- deep-tread tyres it could plough along the dirt track to the
- observatory in all weather and seasons, including the metre-deep snow
- of Gralmond's winters.</p></pre>
- </div>
- <p class=note>The <code id=the-hr-element:the-hr-element-5><a href=#the-hr-element>hr</a></code> element does not affect the document's
- <a href=#outline id=the-hr-element:outline>outline</a>.</p>
- <h4 id=the-pre-element>4.4.3 The <dfn><code>pre</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-pre-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-pre-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-pre-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-pre-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-pre-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-pre-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-pre-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-pre-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-pre-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-pre-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-pre-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlpreelement>HTMLPreElement</dfn> : <a href=#htmlelement id=the-pre-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLPreElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-pre-element:the-pre-element><a href=#the-pre-element>pre</a></code> element <a href=#represents id=the-pre-element:represents>represents</a> a block of preformatted text, in which
- structure is represented by typographic conventions rather than by elements.</p>
- <p class=note>In <a href=#syntax id=the-pre-element:syntax>the HTML syntax</a>, a leading newline character immediately following
- the <code id=the-pre-element:the-pre-element-2><a href=#the-pre-element>pre</a></code> element start tag is stripped.</p>
- <p>Some examples of cases where the <code id=the-pre-element:the-pre-element-3><a href=#the-pre-element>pre</a></code> element could be used:</p>
- <ul><li>Including an e-mail, with paragraphs indicated by blank lines, lists indicated by lines
- prefixed with a bullet, and so on.<li>Including fragments of computer code, with structure indicated according to the conventions
- of that language.<li>Displaying ASCII art.</ul>
- <p class=note>Authors are encouraged to consider how preformatted text will be experienced when
- the formatting is lost, as will be the case for users of speech synthesizers, braille displays,
- and the like. For cases like ASCII art, it is likely that an alternative presentation, such as a
- textual description, would be more universally accessible to the readers of the document.</p>
- <p>To represent a block of computer code, the <code id=the-pre-element:the-pre-element-4><a href=#the-pre-element>pre</a></code> element can be used with a
- <code id=the-pre-element:the-code-element><a href=#the-code-element>code</a></code> element; to represent a block of computer output the <code id=the-pre-element:the-pre-element-5><a href=#the-pre-element>pre</a></code> element
- can be used with a <code id=the-pre-element:the-samp-element><a href=#the-samp-element>samp</a></code> element. Similarly, the <code id=the-pre-element:the-kbd-element><a href=#the-kbd-element>kbd</a></code> element can be used
- within a <code id=the-pre-element:the-pre-element-6><a href=#the-pre-element>pre</a></code> element to indicate text that the user is to enter.</p>
-
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <div class=example>
- <p>In the following snippet, a sample of computer code is presented.</p>
- <pre><p>This is the <code>Panel</code> constructor:</p>
- <pre><code>function Panel(element, canClose, closeHandler) {
- this.element = element;
- this.canClose = canClose;
- this.closeHandler = function () { if (closeHandler) closeHandler() };
- }</code></pre></pre>
- </div>
- <div class=example>
- <p>In the following snippet, <code id=the-pre-element:the-samp-element-2><a href=#the-samp-element>samp</a></code> and <code id=the-pre-element:the-kbd-element-2><a href=#the-kbd-element>kbd</a></code> elements are mixed in the
- contents of a <code id=the-pre-element:the-pre-element-7><a href=#the-pre-element>pre</a></code> element to show a session of Zork I.</p>
- <pre><pre><samp>You are in an open field west of a big white house with a boarded
- front door.
- There is a small mailbox here.
- ></samp> <kbd>open mailbox</kbd>
- <samp>Opening the mailbox reveals:
- A leaflet.
- ></samp></pre></pre>
- </div>
- <div class=example>
- <p>The following shows a contemporary poem that uses the <code id=the-pre-element:the-pre-element-8><a href=#the-pre-element>pre</a></code> element to preserve its
- unusual formatting, which forms an intrinsic part of the poem itself.</p>
- <pre><pre> maxling
- it is with a heart
- heavy
- that i admit loss of a feline
- so loved
- a friend lost to the
- unknown
- (night)
- ~cdr 11dec07</pre></pre>
- </div>
- <h4 id=the-blockquote-element>4.4.4 The <dfn><code>blockquote</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-blockquote-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-blockquote-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-root id=the-blockquote-element:sectioning-root>Sectioning root</a>.<dd><a href=#palpable-content-2 id=the-blockquote-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-blockquote-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-blockquote-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-blockquote-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-blockquote-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-blockquote-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-blockquote-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-blockquote-element:global-attributes>Global attributes</a><dd><code id=the-blockquote-element:attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code> — Link to the source of the quotation or more information about the edit<dt><a href=#concept-element-dom id=the-blockquote-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlquoteelement>HTMLQuoteElement</dfn> : <a href=#htmlelement id=the-blockquote-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-quote-cite id=the-blockquote-element:dom-quote-cite>cite</a>;
- };</pre>
- <p class=note>The <code id=the-blockquote-element:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code> interface is
- also used by the <code id=the-blockquote-element:the-q-element><a href=#the-q-element>q</a></code> element.</p>
- </dl>
- <p>The <code id=the-blockquote-element:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code> element <a href=#represents id=the-blockquote-element:represents>represents</a> a section that is quoted from
- another source.</p>
- <p>Content inside a <code id=the-blockquote-element:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code> must be quoted from another source, whose address, if
- it has one, may be cited in the <dfn id=attr-blockquote-cite><code>cite</code></dfn>
- attribute.</p>
- <p>If the <code id=the-blockquote-element:attr-blockquote-cite-2><a href=#attr-blockquote-cite>cite</a></code> attribute is present, it must be a
- <a href=#valid-url-potentially-surrounded-by-spaces id=the-blockquote-element:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>. To obtain the
- corresponding citation link, the value of the attribute must be <a href=#resolve-a-url id=the-blockquote-element:resolve-a-url>resolved</a> relative to the element. User agents may allow users to follow such
- citation links, but they are primarily intended for private use (e.g. by server-side scripts
- collecting statistics about a site's use of quotations), not for readers.</p>
- <p>The content of a <code id=the-blockquote-element:the-blockquote-element-3><a href=#the-blockquote-element>blockquote</a></code> may be abbreviated or may have context added in the
- conventional manner for the text's language.</p>
- <div class=example>
- <p>For example, in English this is traditionally done using square brackets. Consider a page with
- the sentence "Fred ate the cracker. He then said he liked apples and fish."; it could be quoted
- as follows:</p>
- <pre><blockquote>
- <p>[Fred] then said he liked [...] fish.</p>
- </blockquote></pre>
- </div>
- <p>Attribution for the quotation, if any, must be placed outside the <code id=the-blockquote-element:the-blockquote-element-4><a href=#the-blockquote-element>blockquote</a></code>
- element.</p>
- <div class=example>
- <p>For example, here the attribution is given in a paragraph after the quote:</p>
- <pre><blockquote>
- <p>I contend that we are both atheists. I just believe in one fewer
- god than you do. When you understand why you dismiss all the other
- possible gods, you will understand why I dismiss yours.</p>
- </blockquote>
- <p>— Stephen Roberts</p></pre>
- <p>The other examples below show other ways of showing attribution.</p>
- </div>
-
- <p>The <dfn id=dom-quote-cite><code>cite</code></dfn> IDL attribute must <a href=#reflect id=the-blockquote-element:reflect>reflect</a>
- the element's <code>cite</code> content attribute.</p>
-
- <div class=example>
- <p>Here a <code id=the-blockquote-element:the-blockquote-element-5><a href=#the-blockquote-element>blockquote</a></code> element is used in conjunction with a <code id=the-blockquote-element:the-figure-element><a href=#the-figure-element>figure</a></code>
- element and its <code id=the-blockquote-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> to clearly relate a quote to its attribution (which is
- not part of the quote and therefore doesn't belong inside the <code id=the-blockquote-element:the-blockquote-element-6><a href=#the-blockquote-element>blockquote</a></code>
- itself):</p>
- <pre><figure>
- <blockquote>
- <p>The truth may be puzzling. It may take some work to grapple with.
- It may be counterintuitive. It may contradict deeply held
- prejudices. It may not be consonant with what we desperately want to
- be true. But our preferences do not determine what's true. We have a
- method, and that method helps us to reach not absolute truth, only
- asymptotic approaches to the truth — never there, just closer
- and closer, always finding vast new oceans of undiscovered
- possibilities. Cleverly designed experiments are the key.</p>
- </blockquote>
- <figcaption>Carl Sagan, in "<cite>Wonder and Skepticism</cite>", from
- the <cite>Skeptical Enquirer</cite> Volume 19, Issue 1 (January-February
- 1995)</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>This next example shows the use of <code id=the-blockquote-element:the-cite-element><a href=#the-cite-element>cite</a></code> alongside <code id=the-blockquote-element:the-blockquote-element-7><a href=#the-blockquote-element>blockquote</a></code>:</p>
- <pre><p>His next piece was the aptly named <cite>Sonnet 130</cite>:</p>
- <blockquote cite="http://quotes.example.org/s/sonnet130.html">
- <p>My mistress' eyes are nothing like the sun,<br>
- Coral is far more red, than her lips red,<br>
- ...</pre>
- </div>
- <div class=example>
- <p>This example shows how a forum post could use <code id=the-blockquote-element:the-blockquote-element-8><a href=#the-blockquote-element>blockquote</a></code> to show what post a user
- is replying to. The <code id=the-blockquote-element:the-article-element><a href=#the-article-element>article</a></code> element is used for each post, to mark up the
- threading.</p>
- <pre><article>
- <h1><a href="http://bacon.example.com/?blog=109431">Bacon on a crowbar</a></h1>
- <article>
- <header><strong>t3yw</strong> 12 points 1 hour ago</header>
- <p>I bet a narwhal would love that.</p>
- <footer><a href="?pid=29578">permalink</a></footer>
- <article>
- <header><strong>greg</strong> 8 points 1 hour ago</header>
- <blockquote><p>I bet a narwhal would love that.</p></blockquote>
- <p>Dude narwhals don't eat bacon.</p>
- <footer><a href="?pid=29579">permalink</a></footer>
- <article>
- <header><strong>t3yw</strong> 15 points 1 hour ago</header>
- <blockquote>
- <blockquote><p>I bet a narwhal would love that.</p></blockquote>
- <p>Dude narwhals don't eat bacon.</p>
- </blockquote>
- <p>Next thing you'll be saying they don't get capes and wizard
- hats either!</p>
- <footer><a href="?pid=29580">permalink</a></footer>
- <article>
- <article>
- <header><strong>boing</strong> -5 points 1 hour ago</header>
- <p>narwhals are worse than ceiling cat</p>
- <footer><a href="?pid=29581">permalink</a></footer>
- </article>
- </article>
- </article>
- </article>
- <article>
- <header><strong>fred</strong> 1 points 23 minutes ago</header>
- <blockquote><p>I bet a narwhal would love that.</p></blockquote>
- <p>I bet they'd love to peel a banana too.</p>
- <footer><a href="?pid=29582">permalink</a></footer>
- </article>
- </article>
- </article></pre>
- </div>
- <div class=example>
- <p>This example shows the use of a <code id=the-blockquote-element:the-blockquote-element-9><a href=#the-blockquote-element>blockquote</a></code> for short snippets, demonstrating that
- one does not have to use <code id=the-blockquote-element:the-p-element><a href=#the-p-element>p</a></code> elements inside <code id=the-blockquote-element:the-blockquote-element-10><a href=#the-blockquote-element>blockquote</a></code> elements:</p>
- <pre><p>He began his list of "lessons" with the following:</p>
- <blockquote>One should never assume that his side of
- the issue will be recognized, let alone that it will
- be conceded to have merits.</blockquote>
- <p>He continued with a number of similar points, ending with:</p>
- <blockquote>Finally, one should be prepared for the threat
- of breakdown in negotiations at any given moment and not
- be cowed by the possibility.</blockquote>
- <p>We shall now discuss these points...</pre>
- </div>
- <p class=note><a href=#conversations>Examples of how to represent a conversation</a> are shown
- in a later section; it is not appropriate to use the <code id=the-blockquote-element:the-cite-element-2><a href=#the-cite-element>cite</a></code> and <code id=the-blockquote-element:the-blockquote-element-11><a href=#the-blockquote-element>blockquote</a></code>
- elements for this purpose.</p>
- <h4 id=the-ol-element>4.4.5 The <dfn><code>ol</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-ol-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-ol-element:flow-content-2>Flow content</a>.<dd>If the element's children include at least one <code id=the-ol-element:the-li-element><a href=#the-li-element>li</a></code> element: <a href=#palpable-content-2 id=the-ol-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-ol-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-ol-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-ol-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-ol-element:the-li-element-2><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements-2 id=the-ol-element:script-supporting-elements-2>script-supporting</a> elements.<dt><a href=#concept-element-tag-omission id=the-ol-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-ol-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-ol-element:global-attributes>Global attributes</a><dd><code id=the-ol-element:attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> — Number the list backwards<dd><code id=the-ol-element:attr-ol-start><a href=#attr-ol-start>start</a></code> — <a href=#ordinal-value id=the-ol-element:ordinal-value>Ordinal value</a> of the first item<dd><code id=the-ol-element:attr-ol-type><a href=#attr-ol-type>type</a></code> — Kind of list marker<dt><a href=#concept-element-dom id=the-ol-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlolistelement>HTMLOListElement</dfn> : <a href=#htmlelement id=the-ol-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-ol-reversed id=the-ol-element:dom-ol-reversed>reversed</a>;
- attribute long <a href=#dom-ol-start id=the-ol-element:dom-ol-start>start</a>;
- attribute DOMString <a href=#dom-ol-type id=the-ol-element:dom-ol-type>type</a>;
- // <a href="#HTMLOListElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-ol-element:the-ol-element><a href=#the-ol-element>ol</a></code> element <a href=#represents id=the-ol-element:represents>represents</a> a list of items, where the items have been
- intentionally ordered, such that changing the order would change the meaning of the document.</p>
- <p>The items of the list are the <code id=the-ol-element:the-li-element-3><a href=#the-li-element>li</a></code> element child nodes of the <code id=the-ol-element:the-ol-element-2><a href=#the-ol-element>ol</a></code>
- element, in <a href=#tree-order id=the-ol-element:tree-order>tree order</a>.</p>
- <p>The <dfn id=attr-ol-reversed><code>reversed</code></dfn> attribute is a <a href=#boolean-attribute id=the-ol-element:boolean-attribute>boolean
- attribute</a>. If present, it indicates that the list is a descending list (..., 3, 2, 1). If
- the attribute is omitted, the list is an ascending list (1, 2, 3, ...).</p>
- <p>The <dfn id=attr-ol-start><code>start</code></dfn> attribute, if present, must be a
- <a href=#valid-integer id=the-ol-element:valid-integer>valid integer</a> giving the <a href=#ordinal-value id=the-ol-element:ordinal-value-2>ordinal value</a> of the first list item.</p>
-
- <p>If the <code id=the-ol-element:attr-ol-start-2><a href=#attr-ol-start>start</a></code> attribute is present, user agents must <a href=#rules-for-parsing-integers id=the-ol-element:rules-for-parsing-integers>parse it as an integer</a>, in order to determine the
- attribute's value. The default value, used if the attribute is missing or if the value cannot be
- converted to a number according to the referenced algorithm, is 1 if the element has no <code id=the-ol-element:attr-ol-reversed-2><a href=#attr-ol-reversed>reversed</a></code> attribute, and is the number of child <code id=the-ol-element:the-li-element-4><a href=#the-li-element>li</a></code>
- elements otherwise.</p>
- <p>The first item in the list has the <a href=#ordinal-value id=the-ol-element:ordinal-value-3>ordinal value</a> given by the <code id=the-ol-element:the-ol-element-3><a href=#the-ol-element>ol</a></code>
- element's <code id=the-ol-element:attr-ol-start-3><a href=#attr-ol-start>start</a></code> attribute, unless that <code id=the-ol-element:the-li-element-5><a href=#the-li-element>li</a></code> element
- has a <code id=the-ol-element:attr-li-value><a href=#attr-li-value>value</a></code> attribute with a value that can be successfully
- parsed, in which case it has the <a href=#ordinal-value id=the-ol-element:ordinal-value-4>ordinal value</a> given by that <code id=the-ol-element:attr-li-value-2><a href=#attr-li-value>value</a></code> attribute.</p>
- <p>Each subsequent item in the list has the <a href=#ordinal-value id=the-ol-element:ordinal-value-5>ordinal value</a> given by its <code id=the-ol-element:attr-li-value-3><a href=#attr-li-value>value</a></code> attribute, if it has one, or, if it doesn't, the <a href=#ordinal-value id=the-ol-element:ordinal-value-6>ordinal
- value</a> of the previous item, plus one if the <code id=the-ol-element:attr-ol-reversed-3><a href=#attr-ol-reversed>reversed</a></code>
- is absent, or minus one if it is present.</p>
-
- <p>The <dfn id=attr-ol-type><code>type</code></dfn> attribute can be used to specify the kind
- of marker to use in the list, in the cases where that matters (e.g. because items are to be
- referenced by their number/letter). The attribute, if specified, must have a value that is a
- <a href=#case-sensitive id=the-ol-element:case-sensitive>case-sensitive</a> match for one of the characters given in the first cell of one of the
- rows of the following table. The <code id=the-ol-element:attr-ol-type-2><a href=#attr-ol-type>type</a></code>
- attribute represents the state given in the cell in the second column of the row whose first cell
- matches the attribute's value; if none of the cells match, or if the attribute is omitted, then
- the attribute represents the <a href=#attr-ol-type-state-decimal id=the-ol-element:attr-ol-type-state-decimal>decimal</a>
- state.</p>
- <table><thead><tr><th>Keyword
- <th>State
- <th>Description
- <th colspan=8>Examples for values 1-3 and 3999-4001
- <tbody><tr><td><dfn id=attr-ol-type-keyword-decimal><code>1</code></dfn> (U+0031)
- <td><dfn id=attr-ol-type-state-decimal>decimal</dfn>
- <td>Decimal numbers
- <td class=eg><samp>1.</samp> <td class=eg><samp>2.</samp> <td class=eg><samp>3.</samp> <td class=eg>... <td class=eg><samp>3999.</samp> <td class=eg><samp>4000.</samp> <td class=eg><samp>4001.</samp> <td class=eg>...
- <tr><td><dfn id=attr-ol-type-keyword-lower-alpha><code>a</code></dfn> (U+0061)
- <td><dfn id=attr-ol-type-state-lower-alpha>lower-alpha</dfn>
- <td>Lowercase latin alphabet
- <td class=eg><samp>a.</samp> <td class=eg><samp>b.</samp> <td class=eg><samp>c.</samp> <td class=eg>... <td class=eg><samp>ewu.</samp> <td class=eg><samp>ewv.</samp> <td class=eg><samp>eww.</samp> <td class=eg>...
- <tr><td><dfn id=attr-ol-type-keyword-upper-alpha><code>A</code></dfn> (U+0041)
- <td><dfn id=attr-ol-type-state-upper-alpha>upper-alpha</dfn>
- <td>Uppercase latin alphabet
- <td class=eg><samp>A.</samp> <td class=eg><samp>B.</samp> <td class=eg><samp>C.</samp> <td class=eg>... <td class=eg><samp>EWU.</samp> <td class=eg><samp>EWV.</samp> <td class=eg><samp>EWW.</samp> <td class=eg>...
- <tr><td><dfn id=attr-ol-type-keyword-lower-roman><code>i</code></dfn> (U+0069)
- <td><dfn id=attr-ol-type-state-lower-roman>lower-roman</dfn>
- <td>Lowercase roman numerals
- <td class=eg><samp>i.</samp> <td class=eg><samp>ii.</samp> <td class=eg><samp>iii.</samp> <td class=eg>... <td class=eg><samp>mmmcmxcix.</samp> <td class=eg><samp>i̅v̅.</samp> <td class=eg><samp>i̅v̅i.</samp> <td class=eg>...
- <tr><td><dfn id=attr-ol-type-keyword-upper-roman><code>I</code></dfn> (U+0049)
- <td><dfn id=attr-ol-type-state-upper-roman>upper-roman</dfn>
- <td>Uppercase roman numerals
- <td class=eg><samp>I.</samp> <td class=eg><samp>II.</samp> <td class=eg><samp>III.</samp> <td class=eg>... <td class=eg><samp>MMMCMXCIX.</samp> <td class=eg><samp>I̅V̅.</samp> <td class=eg><samp>I̅V̅I.</samp> <td class=eg>...
- </table>
-
- <p>User agents should render the items of the list in a manner consistent with the state of the
- <code id=the-ol-element:attr-ol-type-3><a href=#attr-ol-type>type</a></code> attribute of the <code id=the-ol-element:the-ol-element-4><a href=#the-ol-element>ol</a></code> element. Numbers less than
- or equal to zero should always use the decimal system regardless of the <code id=the-ol-element:attr-ol-type-4><a href=#attr-ol-type>type</a></code> attribute.</p>
- <p class=note>For CSS user agents, a mapping for this attribute to the 'list-style-type' CSS
- property is given <a href=#decohints>in the rendering section</a> (the mapping is
- straightforward: the states above have the same names as their corresponding CSS values).</p>
-
- <p class=note>It is possible to redefine the default CSS list styles used to implement this
- attribute in CSS user agents; doing so will affect how list items are rendered.</p>
-
-
- <p>The <dfn id=dom-ol-reversed><code>reversed</code></dfn>, <dfn id=dom-ol-start><code>start</code></dfn>, and <dfn id=dom-ol-type><code>type</code></dfn> IDL attributes must <a href=#reflect id=the-ol-element:reflect>reflect</a> the
- respective content attributes of the same name. The <code id=the-ol-element:dom-ol-start-2><a href=#dom-ol-start>start</a></code> IDL
- attribute has the same default as its content attribute.</p>
-
- <div class=example>
- <p>The following markup shows a list where the order matters, and where the <code id=the-ol-element:the-ol-element-5><a href=#the-ol-element>ol</a></code>
- element is therefore appropriate. Compare this list to the equivalent list in the <code id=the-ol-element:the-ul-element><a href=#the-ul-element>ul</a></code>
- section to see an example of the same items using the <code id=the-ol-element:the-ul-element-2><a href=#the-ul-element>ul</a></code> element.</p>
- <pre><p>I have lived in the following countries (given in the order of when
- I first lived there):</p>
- <ol>
- <li>Switzerland
- <li>United Kingdom
- <li>United States
- <li>Norway
- </ol></pre>
- <p>Note how changing the order of the list changes the meaning of the document. In the following
- example, changing the relative order of the first two items has changed the birthplace of the
- author:</p>
- <pre><p>I have lived in the following countries (given in the order of when
- I first lived there):</p>
- <ol>
- <li>United Kingdom
- <li>Switzerland
- <li>United States
- <li>Norway
- </ol></pre>
- </div>
- <h4 id=the-ul-element>4.4.6 The <dfn><code>ul</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-ul-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-ul-element:flow-content-2>Flow content</a>.<dd>If the element's children include at least one <code id=the-ul-element:the-li-element><a href=#the-li-element>li</a></code> element: <a href=#palpable-content-2 id=the-ul-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-ul-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-ul-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-ul-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-ul-element:the-li-element-2><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements-2 id=the-ul-element:script-supporting-elements-2>script-supporting</a> elements.<dt><a href=#concept-element-tag-omission id=the-ul-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-ul-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-ul-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-ul-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlulistelement>HTMLUListElement</dfn> : <a href=#htmlelement id=the-ul-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLUListElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-ul-element:the-ul-element><a href=#the-ul-element>ul</a></code> element <a href=#represents id=the-ul-element:represents>represents</a> a list of items, where the order of the
- items is not important — that is, where changing the order would not materially change the
- meaning of the document.</p>
- <p>The items of the list are the <code id=the-ul-element:the-li-element-3><a href=#the-li-element>li</a></code> element child nodes of the <code id=the-ul-element:the-ul-element-2><a href=#the-ul-element>ul</a></code>
- element.</p>
- <div class=example>
- <p>The following markup shows a list where the order does not matter, and where the
- <code id=the-ul-element:the-ul-element-3><a href=#the-ul-element>ul</a></code> element is therefore appropriate. Compare this list to the equivalent list in the
- <code id=the-ul-element:the-ol-element><a href=#the-ol-element>ol</a></code> section to see an example of the same items using the <code id=the-ul-element:the-ol-element-2><a href=#the-ol-element>ol</a></code>
- element.</p>
- <pre><p>I have lived in the following countries:</p>
- <ul>
- <li>Norway
- <li>Switzerland
- <li>United Kingdom
- <li>United States
- </ul></pre>
- <p>Note that changing the order of the list does not change the meaning of the document. The
- items in the snippet above are given in alphabetical order, but in the snippet below they are
- given in order of the size of their current account balance in 2007, without changing the meaning
- of the document whatsoever:</p>
- <pre><p>I have lived in the following countries:</p>
- <ul>
- <li>Switzerland
- <li>Norway
- <li>United Kingdom
- <li>United States
- </ul></pre>
- </div>
- <h4 id=the-li-element>4.4.7 The <dfn><code>li</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-li-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-li-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Inside <code id=the-li-element:the-ol-element><a href=#the-ol-element>ol</a></code> elements.<dd>Inside <code id=the-li-element:the-ul-element><a href=#the-ul-element>ul</a></code> elements.<dd>Inside <code id=the-li-element:the-menu-element><a href=#the-menu-element>menu</a></code> elements whose <code id=the-li-element:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state id=the-li-element:toolbar-state>toolbar</a> state.<dt><a href=#concept-element-content-model id=the-li-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-li-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-li-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-li-element:the-li-element><a href=#the-li-element>li</a></code> element's <a href=#syntax-end-tag id=the-li-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-li-element:the-li-element-2><a href=#the-li-element>li</a></code> element is immediately followed by another <code id=the-li-element:the-li-element-3><a href=#the-li-element>li</a></code> element or if there is
- no more content in the parent element.<dt><a href=#concept-element-attributes id=the-li-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-li-element:global-attributes>Global attributes</a><dd>If the element is a child of an <code id=the-li-element:the-ol-element-2><a href=#the-ol-element>ol</a></code> element: <code id=the-li-element:attr-li-value><a href=#attr-li-value>value</a></code> — <a href=#ordinal-value id=the-li-element:ordinal-value>Ordinal value</a> of the list item<dt><a href=#concept-element-dom id=the-li-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmllielement>HTMLLIElement</dfn> : <a href=#htmlelement id=the-li-element:htmlelement>HTMLElement</a> {
- attribute long <a href=#dom-li-value id=the-li-element:dom-li-value>value</a>;
- // <a href="#HTMLLIElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-li-element:the-li-element-4><a href=#the-li-element>li</a></code> element <a href=#represents id=the-li-element:represents>represents</a> a list item. If its parent element is an
- <code id=the-li-element:the-ol-element-3><a href=#the-ol-element>ol</a></code>, <code id=the-li-element:the-ul-element-2><a href=#the-ul-element>ul</a></code>, or <code id=the-li-element:the-menu-element-2><a href=#the-menu-element>menu</a></code> element, then the element is an item of the
- parent element's list, as defined for those elements. Otherwise, the list item has no defined
- list-related relationship to any other <code id=the-li-element:the-li-element-5><a href=#the-li-element>li</a></code> element.</p>
- <p>If the parent element is an <code id=the-li-element:the-ol-element-4><a href=#the-ol-element>ol</a></code> element, then the <code id=the-li-element:the-li-element-6><a href=#the-li-element>li</a></code> element has an
- <dfn id=ordinal-value>ordinal value</dfn>.</p>
- <p>The <dfn id=attr-li-value><code>value</code></dfn> attribute, if present, must be a
- <a href=#valid-integer id=the-li-element:valid-integer>valid integer</a> giving the <a href=#ordinal-value id=the-li-element:ordinal-value-2>ordinal value</a> of the list item.</p>
-
- <p>If the <code id=the-li-element:attr-li-value-2><a href=#attr-li-value>value</a></code> attribute is present, user agents must <a href=#rules-for-parsing-integers id=the-li-element:rules-for-parsing-integers>parse it as an integer</a>, in order to determine the
- attribute's value. If the attribute's value cannot be converted to a number, the attribute must be
- treated as if it was absent. The attribute has no default value.</p>
- <p>The <code id=the-li-element:attr-li-value-3><a href=#attr-li-value>value</a></code> attribute is processed relative to the element's
- parent <code id=the-li-element:the-ol-element-5><a href=#the-ol-element>ol</a></code> element (q.v.), if there is one. If there is not, the attribute has no
- effect.</p>
- <p>The <dfn id=dom-li-value><code>value</code></dfn> IDL attribute must <a href=#reflect id=the-li-element:reflect>reflect</a>
- the value of the <code id=the-li-element:attr-li-value-4><a href=#attr-li-value>value</a></code> content attribute.</p>
-
- <div class=example>
- <p>The following example, the top ten movies are listed (in reverse order). Note the way the list
- is given a title by using a <code id=the-li-element:the-figure-element><a href=#the-figure-element>figure</a></code> element and its <code id=the-li-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code>
- element.</p>
- <pre><figure>
- <figcaption>The top 10 movies of all time</figcaption>
- <ol>
- <li value="10"><cite>Josie and the Pussycats</cite>, 2001</li>
- <li value="9"><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
- <li value="8"><cite>A Bug's Life</cite>, 1998</li>
- <li value="7"><cite>Toy Story</cite>, 1995</li>
- <li value="6"><cite>Monsters, Inc</cite>, 2001</li>
- <li value="5"><cite>Cars</cite>, 2006</li>
- <li value="4"><cite>Toy Story 2</cite>, 1999</li>
- <li value="3"><cite>Finding Nemo</cite>, 2003</li>
- <li value="2"><cite>The Incredibles</cite>, 2004</li>
- <li value="1"><cite>Ratatouille</cite>, 2007</li>
- </ol>
- </figure></pre>
- <p>The markup could also be written as follows, using the <code id=the-li-element:attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code> attribute on the <code id=the-li-element:the-ol-element-6><a href=#the-ol-element>ol</a></code> element:</p>
- <pre><figure>
- <figcaption>The top 10 movies of all time</figcaption>
- <ol reversed>
- <li><cite>Josie and the Pussycats</cite>, 2001</li>
- <li><cite lang="sh">Црна мачка, бели мачор</cite>, 1998</li>
- <li><cite>A Bug's Life</cite>, 1998</li>
- <li><cite>Toy Story</cite>, 1995</li>
- <li><cite>Monsters, Inc</cite>, 2001</li>
- <li><cite>Cars</cite>, 2006</li>
- <li><cite>Toy Story 2</cite>, 1999</li>
- <li><cite>Finding Nemo</cite>, 2003</li>
- <li><cite>The Incredibles</cite>, 2004</li>
- <li><cite>Ratatouille</cite>, 2007</li>
- </ol>
- </figure></pre>
- </div>
- <p class=note>While it is conforming to include heading elements (e.g. <code id=the-li-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) inside
- <code id=the-li-element:the-li-element-7><a href=#the-li-element>li</a></code> elements, it likely does not convey the semantics that the author intended. A
- heading starts a new section, so a heading in a list implicitly splits the list into spanning
- multiple sections.</p>
- <h4 id=the-dl-element>4.4.8 The <dfn><code>dl</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-dl-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-dl-element:flow-content-2>Flow content</a>.<dd>If the element's children include at least one name-value group: <a href=#palpable-content-2 id=the-dl-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-dl-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-dl-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-dl-element:concept-element-content-model>Content model</a>:<dd>Zero or more groups each consisting of one or more <code id=the-dl-element:the-dt-element><a href=#the-dt-element>dt</a></code> elements followed by one or more <code id=the-dl-element:the-dd-element><a href=#the-dd-element>dd</a></code> elements, optionally intermixed with <a href=#script-supporting-elements-2 id=the-dl-element:script-supporting-elements-2>script-supporting elements</a>.<dt><a href=#concept-element-tag-omission id=the-dl-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-dl-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-dl-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-dl-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldlistelement>HTMLDListElement</dfn> : <a href=#htmlelement id=the-dl-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLDListElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-dl-element:the-dl-element><a href=#the-dl-element>dl</a></code> element <a href=#represents id=the-dl-element:represents>represents</a> an association list consisting of zero or
- more name-value groups (a description list). A name-value group consists of one or more names
- (<code id=the-dl-element:the-dt-element-2><a href=#the-dt-element>dt</a></code> elements) followed by one or more values (<code id=the-dl-element:the-dd-element-2><a href=#the-dd-element>dd</a></code> elements), ignoring any
- nodes other than <code id=the-dl-element:the-dt-element-3><a href=#the-dt-element>dt</a></code> and <code id=the-dl-element:the-dd-element-3><a href=#the-dd-element>dd</a></code> elements. Within a single <code id=the-dl-element:the-dl-element-2><a href=#the-dl-element>dl</a></code>
- element, there should not be more than one <code id=the-dl-element:the-dt-element-4><a href=#the-dt-element>dt</a></code> element for each name.</p>
- <p>Name-value groups may be terms and definitions, metadata topics and values, questions and
- answers, or any other groups of name-value data.</p>
- <p>The values within a group are alternatives; multiple paragraphs forming part of the same value
- must all be given within the same <code id=the-dl-element:the-dd-element-4><a href=#the-dd-element>dd</a></code> element.</p>
- <p>The order of the list of groups, and of the names and values within each group, may be
- significant.</p>
-
- <p>If a <code id=the-dl-element:the-dl-element-3><a href=#the-dl-element>dl</a></code> element has no <code id=the-dl-element:the-dt-element-5><a href=#the-dt-element>dt</a></code> or <code id=the-dl-element:the-dd-element-5><a href=#the-dd-element>dd</a></code> element children, it
- contains no groups.</p>
- <p>If a <code id=the-dl-element:the-dl-element-4><a href=#the-dl-element>dl</a></code> element has one or more non-<a href=#inter-element-whitespace id=the-dl-element:inter-element-whitespace>whitespace</a> <code id=the-dl-element:text><a href=#text>Text</a></code> node children, or has child elements that are
- neither <code id=the-dl-element:the-dt-element-6><a href=#the-dt-element>dt</a></code> nor <code id=the-dl-element:the-dd-element-6><a href=#the-dd-element>dd</a></code> elements, all such <code id=the-dl-element:text-2><a href=#text>Text</a></code> nodes and
- elements, as well as their descendants (including any <code id=the-dl-element:the-dt-element-7><a href=#the-dt-element>dt</a></code> or <code id=the-dl-element:the-dd-element-7><a href=#the-dd-element>dd</a></code>
- elements), do not form part of any groups in that <code id=the-dl-element:the-dl-element-5><a href=#the-dl-element>dl</a></code>.</p>
- <p>If a <code id=the-dl-element:the-dl-element-6><a href=#the-dl-element>dl</a></code> element has one or more <code id=the-dl-element:the-dt-element-8><a href=#the-dt-element>dt</a></code> element children but no
- <code id=the-dl-element:the-dd-element-8><a href=#the-dd-element>dd</a></code> element children, then it consists of one group with names but no values.</p>
- <p>If a <code id=the-dl-element:the-dl-element-7><a href=#the-dl-element>dl</a></code> element has one or more <code id=the-dl-element:the-dd-element-9><a href=#the-dd-element>dd</a></code> element children but no
- <code id=the-dl-element:the-dt-element-9><a href=#the-dt-element>dt</a></code> element children, then it consists of one group with values but no names.</p>
- <p>If a <code id=the-dl-element:the-dl-element-8><a href=#the-dl-element>dl</a></code> element's first <code id=the-dl-element:the-dt-element-10><a href=#the-dt-element>dt</a></code> or <code id=the-dl-element:the-dd-element-10><a href=#the-dd-element>dd</a></code> element child is a
- <code id=the-dl-element:the-dd-element-11><a href=#the-dd-element>dd</a></code> element, then the first group has no associated name.</p>
- <p>If a <code id=the-dl-element:the-dl-element-9><a href=#the-dl-element>dl</a></code> element's last <code id=the-dl-element:the-dt-element-11><a href=#the-dt-element>dt</a></code> or <code id=the-dl-element:the-dd-element-12><a href=#the-dd-element>dd</a></code> element child is a
- <code id=the-dl-element:the-dt-element-12><a href=#the-dt-element>dt</a></code> element, then the last group has no associated value.</p>
- <p class=note>When a <code id=the-dl-element:the-dl-element-10><a href=#the-dl-element>dl</a></code> element doesn't match its content model, it is often due to
- accidentally using <code id=the-dl-element:the-dd-element-13><a href=#the-dd-element>dd</a></code> elements in the place of <code id=the-dl-element:the-dt-element-13><a href=#the-dt-element>dt</a></code> elements and vice
- versa. Conformance checkers can spot such mistakes and might be able to advise authors how to
- correctly use the markup.</p>
-
- <div class=example>
- <p>In the following example, one entry ("Authors") is linked to two values ("John" and
- "Luke").</p>
- <pre><dl>
- <dt> Authors
- <dd> John
- <dd> Luke
- <dt> Editor
- <dd> Frank
- </dl></pre>
- </div>
- <div class=example>
- <p>In the following example, one definition is linked to two terms.</p>
- <pre><dl>
- <dt lang="en-US"> <dfn>color</dfn> </dt>
- <dt lang="en-GB"> <dfn>colour</dfn> </dt>
- <dd> A sensation which (in humans) derives from the ability of
- the fine structure of the eye to distinguish three differently
- filtered analyses of a view. </dd>
- </dl></pre>
- </div>
- <div class=example>
- <p>The following example illustrates the use of the <code id=the-dl-element:the-dl-element-11><a href=#the-dl-element>dl</a></code> element to mark up metadata
- of sorts. At the end of the example, one group has two metadata labels ("Authors" and "Editors")
- and two values ("Robert Rothman" and "Daniel Jackson").</p>
- <pre><dl>
- <dt> Last modified time </dt>
- <dd> 2004-12-23T23:33Z </dd>
- <dt> Recommended update interval </dt>
- <dd> 60s </dd>
- <dt> Authors </dt>
- <dt> Editors </dt>
- <dd> Robert Rothman </dd>
- <dd> Daniel Jackson </dd>
- </dl></pre>
- </div>
- <div class=example>
- <p>The following example shows the <code id=the-dl-element:the-dl-element-12><a href=#the-dl-element>dl</a></code> element used to give a set of instructions.
- The order of the instructions here is important (in the other examples, the order of the blocks
- was not important).</p>
- <pre><p>Determine the victory points as follows (use the
- first matching case):</p>
- <dl>
- <dt> If you have exactly five gold coins </dt>
- <dd> You get five victory points </dd>
- <dt> If you have one or more gold coins, and you have one or more silver coins </dt>
- <dd> You get two victory points </dd>
- <dt> If you have one or more silver coins </dt>
- <dd> You get one victory point </dd>
- <dt> Otherwise </dt>
- <dd> You get no victory points </dd>
- </dl></pre>
- </div>
- <div class=example>
- <p>The following snippet shows a <code id=the-dl-element:the-dl-element-13><a href=#the-dl-element>dl</a></code> element being used as a glossary. Note the use
- of <code id=the-dl-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> to indicate the word being defined.</p>
- <pre><dl>
- <dt><dfn>Apartment</dfn>, n.</dt>
- <dd>An execution context grouping one or more threads with one or
- more COM objects.</dd>
- <dt><dfn>Flat</dfn>, n.</dt>
- <dd>A deflated tire.</dd>
- <dt><dfn>Home</dfn>, n.</dt>
- <dd>The user's login directory.</dd>
- </dl></pre>
- </div>
- <p class=note>The <code id=the-dl-element:the-dl-element-14><a href=#the-dl-element>dl</a></code> element is inappropriate for marking up dialogue. <a href=#conversations>Examples of how to mark up dialogue</a> are shown below.</p>
- <h4 id=the-dt-element>4.4.9 The <dfn><code>dt</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-dt-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-dt-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Before <code id=the-dt-element:the-dd-element><a href=#the-dd-element>dd</a></code> or <code id=the-dt-element:the-dt-element><a href=#the-dt-element>dt</a></code> elements inside <code id=the-dt-element:the-dl-element><a href=#the-dl-element>dl</a></code> elements.<dt><a href=#concept-element-content-model id=the-dt-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-dt-element:flow-content-2>Flow content</a>, but with no <code id=the-dt-element:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-dt-element:the-footer-element><a href=#the-footer-element>footer</a></code>, <a href=#sectioning-content-2 id=the-dt-element:sectioning-content-2>sectioning content</a>, or <a href=#heading-content-2 id=the-dt-element:heading-content-2>heading content</a> descendants.<dt><a href=#concept-element-tag-omission id=the-dt-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-dt-element:the-dt-element-2><a href=#the-dt-element>dt</a></code> element's <a href=#syntax-end-tag id=the-dt-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-dt-element:the-dt-element-3><a href=#the-dt-element>dt</a></code> element is immediately followed by another <code id=the-dt-element:the-dt-element-4><a href=#the-dt-element>dt</a></code> element or a
- <code id=the-dt-element:the-dd-element-2><a href=#the-dd-element>dd</a></code> element.<dt><a href=#concept-element-attributes id=the-dt-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-dt-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-dt-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-dt-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-dt-element:the-dt-element-5><a href=#the-dt-element>dt</a></code> element <a href=#represents id=the-dt-element:represents>represents</a> the term, or name, part of a
- term-description group in a description list (<code id=the-dt-element:the-dl-element-2><a href=#the-dl-element>dl</a></code> element).</p>
- <p class=note>The <code id=the-dt-element:the-dt-element-6><a href=#the-dt-element>dt</a></code> element itself, when used in a <code id=the-dt-element:the-dl-element-3><a href=#the-dl-element>dl</a></code> element, does
- not indicate that its contents are a term being defined, but this can be indicated using the
- <code id=the-dt-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> element.</p>
- <div class=example>
- <p>This example shows a list of frequently asked questions (a FAQ) marked up using the
- <code id=the-dt-element:the-dt-element-7><a href=#the-dt-element>dt</a></code> element for questions and the <code id=the-dt-element:the-dd-element-3><a href=#the-dd-element>dd</a></code> element for answers.</p>
- <pre><article>
- <h1>FAQ</h1>
- <dl>
- <dt>What do we want?</dt>
- <dd>Our data.</dd>
- <dt>When do we want it?</dt>
- <dd>Now.</dd>
- <dt>Where is it?</dt>
- <dd>We are not sure.</dd>
- </dl>
- </article></pre>
- </div>
- <h4 id=the-dd-element>4.4.10 The <dfn><code>dd</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-dd-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-dd-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>After <code id=the-dd-element:the-dt-element><a href=#the-dt-element>dt</a></code> or <code id=the-dd-element:the-dd-element><a href=#the-dd-element>dd</a></code> elements inside <code id=the-dd-element:the-dl-element><a href=#the-dl-element>dl</a></code> elements.<dt><a href=#concept-element-content-model id=the-dd-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-dd-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-dd-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-dd-element:the-dd-element-2><a href=#the-dd-element>dd</a></code> element's <a href=#syntax-end-tag id=the-dd-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-dd-element:the-dd-element-3><a href=#the-dd-element>dd</a></code> element is immediately followed by another <code id=the-dd-element:the-dd-element-4><a href=#the-dd-element>dd</a></code> element or a
- <code id=the-dd-element:the-dt-element-2><a href=#the-dt-element>dt</a></code> element, or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-dd-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-dd-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-dd-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-dd-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-dd-element:the-dd-element-5><a href=#the-dd-element>dd</a></code> element <a href=#represents id=the-dd-element:represents>represents</a> the description, definition, or value, part
- of a term-description group in a description list (<code id=the-dd-element:the-dl-element-2><a href=#the-dl-element>dl</a></code> element).</p>
- <div class=example>
- <p>A <code id=the-dd-element:the-dl-element-3><a href=#the-dl-element>dl</a></code> can be used to define a vocabulary list, like in a dictionary. In the
- following example, each entry, given by a <code id=the-dd-element:the-dt-element-3><a href=#the-dt-element>dt</a></code> with a <code id=the-dd-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code>, has several
- <code id=the-dd-element:the-dd-element-6><a href=#the-dd-element>dd</a></code>s, showing the various parts of the definition.</p>
-
- <pre><dl>
- <dt><dfn>happiness</dfn></dt>
- <dd class="pronunciation">/'hæ p. nes/</dd>
- <dd class="part-of-speech"><i><abbr>n.</abbr></i></dd>
- <dd>The state of being happy.</dd>
- <dd>Good fortune; success. <q>Oh <b>happiness</b>! It worked!</q></dd>
- <dt><dfn>rejoice</dfn></dt>
- <dd class="pronunciation">/ri jois'/</dd>
- <dd><i class="part-of-speech"><abbr>v.intr.</abbr></i> To be delighted oneself.</dd>
- <dd><i class="part-of-speech"><abbr>v.tr.</abbr></i> To cause one to be delighted.</dd>
- </dl></pre>
- </div>
- <h4 id=the-figure-element>4.4.11 The <dfn><code>figure</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-figure-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-figure-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-root id=the-figure-element:sectioning-root>Sectioning root</a>.<dd><a href=#palpable-content-2 id=the-figure-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-figure-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-figure-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-figure-element:concept-element-content-model>Content model</a>:<dd>Either: One <code id=the-figure-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> element followed by <a href=#flow-content-2 id=the-figure-element:flow-content-2-3>flow content</a>.<dd>Or: <a href=#flow-content-2 id=the-figure-element:flow-content-2-4>Flow content</a> followed by one <code id=the-figure-element:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code> element.<dd>Or: <a href=#flow-content-2 id=the-figure-element:flow-content-2-5>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-figure-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-figure-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-figure-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-figure-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-figure-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
-
- <p>The <code id=the-figure-element:the-figure-element><a href=#the-figure-element>figure</a></code> element <a href=#represents id=the-figure-element:represents>represents</a> some <a href=#flow-content-2 id=the-figure-element:flow-content-2-6>flow content</a>,
- optionally with a caption, that is self-contained (like a complete sentence) and is typically
- referenced as a single unit from the main flow of the document.</p>
- <p class=note>Self-contained in this context does not necessarily mean independent. For example,
- each sentence in a paragraph is self-contained; an image that is part of a sentence would be
- inappropriate for <code id=the-figure-element:the-figure-element-2><a href=#the-figure-element>figure</a></code>, but an entire sentence made of images would be fitting.</p>
- <p>The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc.</p>
- <div class=note>
- <p>When a <code id=the-figure-element:the-figure-element-3><a href=#the-figure-element>figure</a></code> is referred to from the main content of the document by identifying
- it by its caption (e.g. by figure number), it enables such content to be easily moved away from
- that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix, without
- affecting the flow of the document.</p>
- <p>If a <code id=the-figure-element:the-figure-element-4><a href=#the-figure-element>figure</a></code> element is referenced by its relative position, e.g. "in the
- photograph above" or "as the next figure shows", then moving the figure would disrupt the page's
- meaning. Authors are encouraged to consider using labels to refer to figures, rather than using
- such relative references, so that the page can easily be restyled without affecting the page's
- meaning.</p>
- </div>
- <p>The first <code id=the-figure-element:the-figcaption-element-3><a href=#the-figcaption-element>figcaption</a></code> element child of the element, if
- any, represents the caption of the <code id=the-figure-element:the-figure-element-5><a href=#the-figure-element>figure</a></code> element's contents. If there is no child
- <code id=the-figure-element:the-figcaption-element-4><a href=#the-figcaption-element>figcaption</a></code> element, then there is no caption.</p>
- <p>A <code id=the-figure-element:the-figure-element-6><a href=#the-figure-element>figure</a></code> element's contents are part of the surrounding flow. If the purpose of
- the page is to display the figure, for example a photograph on an image sharing site, the
- <code id=the-figure-element:the-figure-element-7><a href=#the-figure-element>figure</a></code> and <code id=the-figure-element:the-figcaption-element-5><a href=#the-figcaption-element>figcaption</a></code> elements can be used to explicitly provide a
- caption for that figure. For content that is only tangentially related, or that serves a separate
- purpose than the surrounding flow, the <code id=the-figure-element:the-aside-element><a href=#the-aside-element>aside</a></code> element should be used (and can itself
- wrap a <code id=the-figure-element:the-figure-element-8><a href=#the-figure-element>figure</a></code>). For example, a pull quote that repeats content from an
- <code id=the-figure-element:the-article-element><a href=#the-article-element>article</a></code> would be more appropriate in an <code id=the-figure-element:the-aside-element-2><a href=#the-aside-element>aside</a></code> than in a
- <code id=the-figure-element:the-figure-element-9><a href=#the-figure-element>figure</a></code>, because it isn't part of the content, it's a repetition of the content for
- the purposes of enticing readers or highlighting key topics.</p>
- <div class=example>
- <p>This example shows the <code id=the-figure-element:the-figure-element-10><a href=#the-figure-element>figure</a></code> element to mark up a code listing.</p>
- <pre><p>In <a href="#l4">listing 4</a> we see the primary core interface
- API declaration.</p>
- <figure id="l4">
- <figcaption>Listing 4. The primary core interface API declaration.</figcaption>
- <pre><code>interface PrimaryCore {
- boolean verifyDataLine();
- void sendData(in sequence&lt;byte> data);
- void initSelfDestruct();
- }</code></pre>
- </figure>
- <p>The API is designed to use UTF-8.</p></pre>
- </div>
- <div class=example>
- <p>Here we see a <code id=the-figure-element:the-figure-element-11><a href=#the-figure-element>figure</a></code> element to mark up a photo that is the main content of the
- page (as in a gallery).</p>
- <pre><!DOCTYPE HTML>
- <title>Bubbles at work — My Gallery™</title>
- <figure>
- <img src="bubbles-work.jpeg"
- alt="Bubbles, sitting in his office chair, works on his
- latest project intently.">
- <figcaption>Bubbles at work</figcaption>
- </figure>
- <nav><a href="19414.html">Prev</a> — <a href="19416.html">Next</a></nav></pre>
- </div>
- <div class=example>
- <p>In this example, we see an image that is <em>not</em> a figure, as well as an image and a
- video that are. The first image is literally part of the example's second sentence, so it's not a
- self-contained unit, and thus <code id=the-figure-element:the-figure-element-12><a href=#the-figure-element>figure</a></code> would be inappropriate.</p>
- <pre><h2>Malinko's comics</h2>
- <p>This case centered on some sort of "intellectual property"
- infringement related to a comic (see Exhibit A). The suit started
- after a trailer ending with these words:
- <blockquote>
- <img src="promblem-packed-action.png" alt="ROUGH COPY! Promblem-Packed Action!">
- </blockquote>
- <p>...was aired. A lawyer, armed with a Bigger Notebook, launched a
- preemptive strike using snowballs. A complete copy of the trailer is
- included with Exhibit B.
- <figure>
- <img src="ex-a.png" alt="Two squiggles on a dirty piece of paper.">
- <figcaption>Exhibit A. The alleged <cite>rough copy</cite> comic.</figcaption>
- </figure>
- <figure>
- <video src="ex-b.mov"></video>
- <figcaption>Exhibit B. The <cite>Rough Copy</cite> trailer.</figcaption>
- </figure>
- <p>The case was resolved out of court.</pre>
- </div>
- <div class=example>
- <p>Here, a part of a poem is marked up using <code id=the-figure-element:the-figure-element-13><a href=#the-figure-element>figure</a></code>.</p>
- <pre><figure>
- <p>'Twas brillig, and the slithy toves<br>
- Did gyre and gimble in the wabe;<br>
- All mimsy were the borogoves,<br>
- And the mome raths outgrabe.</p>
- <figcaption><cite>Jabberwocky</cite> (first verse). Lewis Carroll, 1832-98</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>In this example, which could be part of a much larger work discussing a castle, nested
- <code id=the-figure-element:the-figure-element-14><a href=#the-figure-element>figure</a></code> elements are used to provide both a group caption and individual captions for
- each figure in the group:</p>
- <pre><figure>
- <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption>
- <figure>
- <figcaption>Etching. Anonymous, ca. 1423.</figcaption>
- <img src="castle1423.jpeg" alt="The castle has one tower, and a tall wall around it.">
- </figure>
- <figure>
- <figcaption>Oil-based paint on canvas. Maria Towle, 1858.</figcaption>
- <img src="castle1858.jpeg" alt="The castle now has two towers and two walls.">
- </figure>
- <figure>
- <figcaption>Film photograph. Peter Jankle, 1999.</figcaption>
- <img src="castle1999.jpeg" alt="The castle lies in ruins, the original tower all that remains in one piece.">
- </figure>
- </figure></pre>
- </div>
- <div class=example>
- <p>The previous example could also be more succintly written as follows (using <code id=the-figure-element:attr-title><a href=#attr-title>title</a></code> attributes in place of the nested
- <code id=the-figure-element:the-figure-element-15><a href=#the-figure-element>figure</a></code>/<code id=the-figure-element:the-figcaption-element-6><a href=#the-figcaption-element>figcaption</a></code> pairs):</p>
- <pre><figure>
- <img src="castle1423.jpeg" title="Etching. Anonymous, ca. 1423."
- alt="The castle has one tower, and a tall wall around it.">
- <img src="castle1858.jpeg" title="Oil-based paint on canvas. Maria Towle, 1858."
- alt="The castle now has two towers and two walls.">
- <img src="castle1999.jpeg" title="Film photograph. Peter Jankle, 1999."
- alt="The castle lies in ruins, the original tower all that remains in one piece.">
- <figcaption>The castle through the ages: 1423, 1858, and 1999 respectively.</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>The figure is sometimes referenced only implicitly from the content:</p>
-
- <pre><article>
- <h1>Fiscal negotiations stumble in Congress as deadline nears</h1>
- <figure>
- <img src="obama-reid.jpeg" alt="Obama and Reid sit together smiling in the Oval Office.">
- <figcaption>Barrak Obama and Harry Reid. White House press photograph.</figcaption>
- </figure>
- <p>Negotiations in Congress to end the fiscal impasse sputtered on Tuesday, leaving both chambers
- grasping for a way to reopen the government and raise the country's borrowing authority with a
- Thursday deadline drawing near.</p>
- ...
- </article></pre>
- </div>
- <h4 id=the-figcaption-element>4.4.12 The <dfn><code>figcaption</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-figcaption-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-figcaption-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the first or last child of a <code id=the-figcaption-element:the-figure-element><a href=#the-figure-element>figure</a></code> element.<dt><a href=#concept-element-content-model id=the-figcaption-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-figcaption-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-figcaption-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-figcaption-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-figcaption-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-figcaption-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-figcaption-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-figcaption-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> element <a href=#represents id=the-figcaption-element:represents>represents</a> a caption or legend for the rest of
- the contents of the <code id=the-figcaption-element:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code> element's parent <code id=the-figcaption-element:the-figure-element-2><a href=#the-figure-element>figure</a></code> element, if any.</p>
- <h4 id=the-main-element>4.4.13 The <dfn><code>main</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-main-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-main-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-main-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-main-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-main-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-main-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-main-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-main-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-main-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-main-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-main-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-main-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-main-element:the-main-element><a href=#the-main-element>main</a></code> element can be used as a container for the dominant contents of another
- element. It <a href=#represents id=the-main-element:represents>represents</a> its children.</p>
- <p class=note>The <code id=the-main-element:the-main-element-2><a href=#the-main-element>main</a></code> element is distinct from the <code id=the-main-element:the-section-element><a href=#the-section-element>section</a></code> and
- <code id=the-main-element:the-article-element><a href=#the-article-element>article</a></code> elements in that the <code id=the-main-element:the-main-element-3><a href=#the-main-element>main</a></code> element does not contribute to the
- document <a href=#outline id=the-main-element:outline>outline</a>.</p>
- <p class=note>There is no restriction as to the number of <code id=the-main-element:the-main-element-4><a href=#the-main-element>main</a></code> elements in a
- document. Indeed, there are many cases where it would make sense to have multiple
- <code id=the-main-element:the-main-element-5><a href=#the-main-element>main</a></code> elements. For example, a page with multiple <code id=the-main-element:the-article-element-2><a href=#the-article-element>article</a></code> elements might
- need to indicate the dominant contents of each such element.</p>
- <div class=example>
- <p>In this example, the author has used a presentation where each component of the page is
- rendered in a box. To wrap the main content of the page (as opposed to the header, the footer,
- the navigation bar, and a sidebar), the <code id=the-main-element:the-main-element-6><a href=#the-main-element>main</a></code> element is used.</p>
- <pre><!DOCTYPE html>
- <title>RPG System 17</title>
- <style>
- header, nav, aside, main, footer {
- margin: 0.5em; border: thin solid; padding: 0.5em;
- background: #EFF; color: black; box-shadow: 0 0 0.25em #033;
- }
- h1, h2, p { margin: 0; }
- nav, main { float: left; }
- aside { float: right; }
- footer { clear: both; }
- </style>
- <header>
- <h1>System Eighteen</h1>
- </header>
- <nav>
- <a href="../16/">← System 17</a>
- <a href="../18/">RPXIX →</a>
- </nav>
- <aside>
- <p>This system has no HP mechanic, so there's no healing.
- </aside>
- <main>
- <h2>Character creation</h2>
- <p>Attributes (magic, strength, agility) are purchased at the cost of one point per level.</p>
- <h2>Rolls</h2>
- <p>Each encounter, roll the dice for all your skills. If you roll more than the opponent, you win.</p>
- </main>
- <footer>
- <p>Copyright © 2013
- </footer></pre>
- </div>
- <h4 id=the-div-element>4.4.14 The <dfn><code>div</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-div-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-div-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-div-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-div-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-div-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-div-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-div-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-div-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-div-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-div-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-div-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldivelement>HTMLDivElement</dfn> : <a href=#htmlelement id=the-div-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLDivElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-div-element:the-div-element><a href=#the-div-element>div</a></code> element has no special meaning at all. It <a href=#represents id=the-div-element:represents>represents</a> its
- children. It can be used with the <code id=the-div-element:classes><a href=#classes>class</a></code>, <code id=the-div-element:attr-lang><a href=#attr-lang>lang</a></code>, and <code id=the-div-element:attr-title><a href=#attr-title>title</a></code> attributes to mark up
- semantics common to a group of consecutive elements.</p>
- <p class=note>Authors are strongly encouraged to view the <code id=the-div-element:the-div-element-2><a href=#the-div-element>div</a></code> element as an element
- of last resort, for when no other element is suitable. Use of more appropriate elements instead of
- the <code id=the-div-element:the-div-element-3><a href=#the-div-element>div</a></code> element leads to better accessibility for readers and easier maintainability
- for authors.</p>
- <div class=example>
- <p>For example, a blog post would be marked up using <code id=the-div-element:the-article-element><a href=#the-article-element>article</a></code>, a chapter using
- <code id=the-div-element:the-section-element><a href=#the-section-element>section</a></code>, a page's navigation aids using <code id=the-div-element:the-nav-element><a href=#the-nav-element>nav</a></code>, and a group of form
- controls using <code id=the-div-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>.</p>
- <p>On the other hand, <code id=the-div-element:the-div-element-4><a href=#the-div-element>div</a></code> elements can be useful for stylistic purposes or to wrap
- multiple paragraphs within a section that are all to be annotated in a similar way. In the
- following example, we see <code id=the-div-element:the-div-element-5><a href=#the-div-element>div</a></code> elements used as a way to set the language of two
- paragraphs at once, instead of setting the language on the two paragraph elements separately:</p>
- <pre><article lang="en-US">
- <h1>My use of language and my cats</h1>
- <p>My cat's behavior hasn't changed much since her absence, except
- that she plays her new physique to the neighbors regularly, in an
- attempt to get pets.</p>
- <div lang="en-GB">
- <p>My other cat, coloured black and white, is a sweetie. He followed
- us to the pool today, walking down the pavement with us. Yesterday
- he apparently visited our neighbours. I wonder if he recognises that
- their flat is a mirror image of ours.</p>
- <p>Hm, I just noticed that in the last paragraph I used British
- English. But I'm supposed to write in American English. So I
- shouldn't say "pavement" or "flat" or "colour"...</p>
- </div>
- <p>I should say "sidewalk" and "apartment" and "color"!</p>
- </article></pre>
- </div>
- <h3 id=text-level-semantics>4.5 Text-level semantics</h3>
- <h4 id=the-a-element>4.5.1 The <dfn><code>a</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-a-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-a-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-a-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-a-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-a-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-a-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-a-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-a-element:concept-element-content-model>Content model</a>:<dd><a href=#transparent id=the-a-element:transparent>Transparent</a>, but there must be no <a href=#interactive-content-2 id=the-a-element:interactive-content-2-2>interactive content</a> descendant.<dt><a href=#concept-element-tag-omission id=the-a-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-a-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-a-element:global-attributes>Global attributes</a><dd><code id=the-a-element:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> — Address of the <a href=#hyperlink id=the-a-element:hyperlink>hyperlink</a><dd><code id=the-a-element:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> — <a href=#browsing-context id=the-a-element:browsing-context>Browsing context</a> for <a href=#hyperlink id=the-a-element:hyperlink-2>hyperlink</a> <a href=#navigate id=the-a-element:navigate>navigation</a><dd><code id=the-a-element:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> — Whether to download the resource instead of navigating to it, and its file name if so<dd><code id=the-a-element:ping><a href=#ping>ping</a></code> — <a href=#url id=the-a-element:url>URLs</a> to ping<dd><code id=the-a-element:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> — Relationship between the document containing the hyperlink and the destination resource<dd><code id=the-a-element:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code> — Language of the linked resource<dd><code id=the-a-element:attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> — Hint for the type of the referenced resource<dt><a href=#concept-element-dom id=the-a-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlanchorelement>HTMLAnchorElement</dfn> : <a href=#htmlelement id=the-a-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-a-target id=the-a-element:dom-a-target>target</a>;
- attribute DOMString <a href=#dom-a-download id=the-a-element:dom-a-download>download</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=the-a-element:dom-domsettabletokenlist-value>value</a>] attribute <a href=#domsettabletokenlist id=the-a-element:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-a-ping id=the-a-element:dom-a-ping>ping</a>;
- attribute DOMString <a href=#dom-a-rel id=the-a-element:dom-a-rel>rel</a>;
- readonly attribute <a href=#domtokenlist id=the-a-element:domtokenlist>DOMTokenList</a> <a href=#dom-a-rellist id=the-a-element:dom-a-rellist>relList</a>;
- attribute DOMString <a href=#dom-a-hreflang id=the-a-element:dom-a-hreflang>hreflang</a>;
- attribute DOMString <a href=#dom-a-type id=the-a-element:dom-a-type>type</a>;
- attribute DOMString <a href=#dom-a-text id=the-a-element:dom-a-text>text</a>;
- // <a href="#HTMLAnchorElement-partial">also has obsolete members</a>
- };
- <a href=#htmlanchorelement id=the-a-element:htmlanchorelement>HTMLAnchorElement</a> implements <a href=#urlutils id=the-a-element:urlutils>URLUtils</a>;</pre>
- </dl>
- <p>If the <code id=the-a-element:the-a-element><a href=#the-a-element>a</a></code> element has an <code id=the-a-element:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute,
- then it <a href=#represents id=the-a-element:represents>represents</a> a <a href=#hyperlink id=the-a-element:hyperlink-3>hyperlink</a> (a hypertext anchor) labeled by its
- contents.</p>
-
- <p>If the <code id=the-a-element:the-a-element-2><a href=#the-a-element>a</a></code> element has no <code id=the-a-element:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code> attribute,
- then the element <a href=#represents id=the-a-element:represents-2>represents</a> a placeholder for where a link might otherwise have been
- placed, if it had been relevant, consisting of just the element's contents.</p>
- <p>The <code id=the-a-element:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code>, <code id=the-a-element:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code>, <code id=the-a-element:ping-2><a href=#ping>ping</a></code>,
- <code id=the-a-element:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>rel</a></code>, <code id=the-a-element:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code id=the-a-element:attr-hyperlink-type-2><a href=#attr-hyperlink-type>type</a></code>
- attributes must be omitted if the <code id=the-a-element:attr-hyperlink-href-4><a href=#attr-hyperlink-href>href</a></code> attribute is not
- present.</p>
- <p>If the <code id=the-a-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an <code id=the-a-element:the-a-element-3><a href=#the-a-element>a</a></code> element,
- then the <code id=the-a-element:attr-hyperlink-href-5><a href=#attr-hyperlink-href>href</a></code> attribute must also be specified.</p>
- <div class=example>
- <p>If a site uses a consistent navigation toolbar on every page, then the link that would
- normally link to the page itself could be marked up using an <code id=the-a-element:the-a-element-4><a href=#the-a-element>a</a></code> element:</p>
- <pre><nav>
- <ul>
- <li> <a href="/">Home</a> </li>
- <li> <a href="/news">News</a> </li>
- <li> <a>Examples</a> </li>
- <li> <a href="/legal">Legal</a> </li>
- </ul>
- </nav></pre>
- </div>
-
- <p>The <code id=the-a-element:attr-hyperlink-href-6><a href=#attr-hyperlink-href>href</a></code>, <code id=the-a-element:attr-hyperlink-target-3><a href=#attr-hyperlink-target>target</a></code>, <code id=the-a-element:attr-hyperlink-download-3><a href=#attr-hyperlink-download>download</a></code>, and <code id=the-a-element:ping-3><a href=#ping>ping</a></code>
- attributes affect what happens when users <a href=#following-hyperlinks-2 id=the-a-element:following-hyperlinks-2>follow
- hyperlinks</a> or <a href=#downloading-hyperlinks id=the-a-element:downloading-hyperlinks>download hyperlinks</a> created using
- the <code id=the-a-element:the-a-element-5><a href=#the-a-element>a</a></code> element. The <code id=the-a-element:attr-hyperlink-rel-3><a href=#attr-hyperlink-rel>rel</a></code>, <code id=the-a-element:attr-hyperlink-hreflang-3><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code id=the-a-element:attr-hyperlink-type-3><a href=#attr-hyperlink-type>type</a></code>
- attributes may be used to indicate to the user the likely nature of the target resource before the
- user follows the link.</p>
- <p>The <a href=#activation-behavior id=the-a-element:activation-behavior>activation behavior</a> of <code id=the-a-element:the-a-element-6><a href=#the-a-element>a</a></code> elements that create <a href=#hyperlink id=the-a-element:hyperlink-4>hyperlinks</a> is to run the following steps:</p>
- <ol><li><p>If the <code id=the-a-element:the-a-element-7><a href=#the-a-element>a</a></code> element's <a id=the-a-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-a-element:fully-active>fully active</a>, then abort these steps.<li>
- <p>If either the <code id=the-a-element:the-a-element-8><a href=#the-a-element>a</a></code> element has a <code id=the-a-element:attr-hyperlink-download-4><a href=#attr-hyperlink-download>download</a></code> attribute and the algorithm is not <a href=#allowed-to-show-a-popup id=the-a-element:allowed-to-show-a-popup>allowed
- to show a popup</a>, or the element's <code id=the-a-element:attr-hyperlink-target-4><a href=#attr-hyperlink-target>target</a></code>
- attribute is present and applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=the-a-element:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a
- browsing context name</a>, using the value of the <code id=the-a-element:attr-hyperlink-target-5><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name, would result
- in there not being a chosen browsing context, then run these substeps:</p>
- <ol><li><p>If there is an <a href=#entry-settings-object id=the-a-element:entry-settings-object>entry settings object</a>, throw an
- <code id=the-a-element:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.<li><p>Abort these steps without following the hyperlink.</ol>
- <li><p>If the target of the <code id=the-a-element:event-click><a href=#event-click>click</a></code> event is an <code id=the-a-element:the-img-element><a href=#the-img-element>img</a></code>
- element with an <code id=the-a-element:attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> attribute specified, then server-side
- image map processing must be performed, as follows:</p>
- <ol><li>If the <code id=the-a-element:event-click-2><a href=#event-click>click</a></code> event was a real pointing-device-triggered
- <code id=the-a-element:event-click-3><a href=#event-click>click</a></code> event on the <code id=the-a-element:the-img-element-2><a href=#the-img-element>img</a></code> element, then let <var>x</var> be the distance in CSS pixels from the left edge of the image's left border,
- if it has one, or the left edge of the image otherwise, to the location of the click, and let
- <var>y</var> be the distance in CSS pixels from the top edge of the image's top
- border, if it has one, or the top edge of the image otherwise, to the location of the click.
- Otherwise, let <var>x</var> and <var>y</var> be zero.<li>Let the <dfn id=hyperlink-suffix><var>hyperlink suffix</var></dfn> be a U+003F QUESTION MARK character, the
- value of <var>x</var> expressed as a base-ten integer using <a href=#ascii-digits id=the-a-element:ascii-digits>ASCII digits</a>,
- a U+002C COMMA character (,), and the value of <var>y</var> expressed as a base-ten
- integer using <a href=#ascii-digits id=the-a-element:ascii-digits-2>ASCII digits</a>.</ol>
- <li><p>Finally, the user agent must <a href=#following-hyperlinks-2 id=the-a-element:following-hyperlinks-2-2>follow the
- hyperlink</a> or <a href=#downloading-hyperlinks id=the-a-element:downloading-hyperlinks-2>download the hyperlink</a> created
- by the <code id=the-a-element:the-a-element-9><a href=#the-a-element>a</a></code> element, as determined by the <code id=the-a-element:attr-hyperlink-download-5><a href=#attr-hyperlink-download>download</a></code> attribute and any expressed user preference. If
- the steps above defined a <var id=the-a-element:hyperlink-suffix><a href=#hyperlink-suffix>hyperlink suffix</a></var>, then take that
- into account when following or downloading the hyperlink.</ol>
-
- <dl class=domintro><dt><var>a</var> . <code id=the-a-element:dom-a-text-2><a href=#dom-a-text>text</a></code><dd>
- <p>Same as <code id=the-a-element:textcontent><a href=#textcontent>textContent</a></code>.</p>
- </dl>
-
- <p>The IDL attributes <dfn id=dom-a-download><code>download</code></dfn>, <dfn id=dom-a-ping><code>ping</code></dfn>, <dfn id=dom-a-target><code>target</code></dfn>,
- <dfn id=dom-a-rel><code>rel</code></dfn>, <dfn id=dom-a-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-a-type><code>type</code></dfn>, must <a href=#reflect id=the-a-element:reflect>reflect</a> the respective content
- attributes of the same name.</p>
- <p>The IDL attribute <dfn id=dom-a-rellist><code>relList</code></dfn> must
- <a href=#reflect id=the-a-element:reflect-2>reflect</a> the <code id=the-a-element:attr-hyperlink-rel-4><a href=#attr-hyperlink-rel>rel</a></code> content attribute.</p>
- <p>The <dfn id=dom-a-text><code>text</code></dfn> IDL attribute, on getting, must return the
- same value as the <code id=the-a-element:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute on the element, and on setting, must act
- as if the <code id=the-a-element:textcontent-3><a href=#textcontent>textContent</a></code> IDL attribute on the element had been set to the new value.</p>
- <hr>
- <p>The <code id=the-a-element:the-a-element-10><a href=#the-a-element>a</a></code> element also supports the <code id=the-a-element:urlutils-2><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>
- <p>When the element is created, and whenever the element's <code id=the-a-element:attr-hyperlink-href-7><a href=#attr-hyperlink-href>href</a></code> content attribute is set, changed, or removed, the user
- agent must invoke the element's <code id=the-a-element:urlutils-3><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input id=the-a-element:concept-uu-set-the-input>set the input</a> algorithm with the value of the <code id=the-a-element:attr-hyperlink-href-8><a href=#attr-hyperlink-href>href</a></code> content attribute, if any, or the empty string otherwise,
- as the given value.</p>
- <p>The element's <code id=the-a-element:urlutils-4><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base id=the-a-element:concept-uu-get-the-base>get the
- base</a> algorithm must simply return <a href="#the-element's-base-url" id="the-a-element:the-element's-base-url">the element's base URL</a>.</p>
- <p>The element's <code id=the-a-element:urlutils-5><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding id=the-a-element:concept-uu-query-encoding>query
- encoding</a> is the <a href="#document's-character-encoding" id="the-a-element:document's-character-encoding">document's character encoding</a>.</p>
- <p>When the element's <code id=the-a-element:urlutils-6><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update id=the-a-element:concept-uu-update>update steps</a> with a string <var>value</var>, the user
- agent must set the element's <code id=the-a-element:attr-hyperlink-href-9><a href=#attr-hyperlink-href>href</a></code> content attribute to
- the string <var>value</var>.</p>
-
- <div class=example>
- <p>The <code id=the-a-element:the-a-element-11><a href=#the-a-element>a</a></code> element may be wrapped around entire paragraphs, lists, tables, and so
- forth, even entire sections, so long as there is no interactive content within (e.g. buttons or
- other links). This example shows how this can be used to make an entire advertising block into a
- link:</p>
- <pre><aside class="advertising">
- <h1>Advertising</h1>
- <a href="http://ad.example.com/?adid=1929&amp;pubid=1422">
- <section>
- <h1>Mellblomatic 9000!</h1>
- <p>Turn all your widgets into mellbloms!</p>
- <p>Only $9.99 plus shipping and handling.</p>
- </section>
- </a>
- <a href="http://ad.example.com/?adid=375&amp;pubid=1422">
- <section>
- <h1>The Mellblom Browser</h1>
- <p>Web browsing at the speed of light.</p>
- <p>No other browser goes faster!</p>
- </section>
- </a>
- </aside></pre>
- </div>
- <h4 id=the-em-element>4.5.2 The <dfn><code>em</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-em-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-em-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-em-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-em-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-em-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-em-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-em-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-em-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-em-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-em-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-em-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-em-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-em-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-em-element:the-em-element><a href=#the-em-element>em</a></code> element <a href=#represents id=the-em-element:represents>represents</a> stress emphasis of its contents.</p>
- <p>The level of stress that a particular piece of content has is given by its number of ancestor
- <code id=the-em-element:the-em-element-2><a href=#the-em-element>em</a></code> elements.</p>
- <p>The placement of stress emphasis changes the meaning of the sentence. The element thus forms an
- integral part of the content. The precise way in which stress is used in this way depends on the
- language.</p>
- <div class=example>
- <p>These examples show how changing the stress emphasis changes the meaning. First, a general
- statement of fact, with no stress:</p>
- <pre><p>Cats are cute animals.</p></pre>
- <p>By emphasizing the first word, the statement implies that the kind of animal under discussion
- is in question (maybe someone is asserting that dogs are cute):</p>
- <pre><p><em>Cats</em> are cute animals.</p></pre>
- <p>Moving the stress to the verb, one highlights that the truth of the entire sentence is in
- question (maybe someone is saying cats are not cute):</p>
- <pre><p>Cats <em>are</em> cute animals.</p></pre>
- <p>By moving it to the adjective, the exact nature of the cats is reasserted (maybe someone
- suggested cats were <em>mean</em> animals):</p>
- <pre><p>Cats are <em>cute</em> animals.</p></pre>
- <p>Similarly, if someone asserted that cats were vegetables, someone correcting this might
- emphasise the last word:</p>
- <pre><p>Cats are cute <em>animals</em>.</p></pre>
- <p>By emphasizing the entire sentence, it becomes clear that the speaker is fighting hard to get
- the point across. This kind of stress emphasis also typically affects the punctuation, hence the
- exclamation mark here.</p>
- <pre><p><em>Cats are cute animals!</em></p></pre>
- <p>Anger mixed with emphasizing the cuteness could lead to markup such as:</p>
- <pre><p><em>Cats are <em>cute</em> animals!</em></p></pre>
- </div>
- <div class=note>
- <p>The <code id=the-em-element:the-em-element-3><a href=#the-em-element>em</a></code> element isn't a generic "italics" element. Sometimes, text is intended to
- stand out from the rest of the paragraph, as if it was in a different mood or voice. For this,
- the <code id=the-em-element:the-i-element><a href=#the-i-element>i</a></code> element is more appropriate.</p>
- <p>The <code id=the-em-element:the-em-element-4><a href=#the-em-element>em</a></code> element also isn't intended to convey importance; for that purpose, the
- <code id=the-em-element:the-strong-element><a href=#the-strong-element>strong</a></code> element is more appropriate.</p>
-
- </div>
- <h4 id=the-strong-element>4.5.3 The <dfn><code>strong</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-strong-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-strong-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-strong-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-strong-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-strong-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-strong-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-strong-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-strong-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-strong-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-strong-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-strong-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-strong-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-strong-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-strong-element:the-strong-element><a href=#the-strong-element>strong</a></code> element <a href=#represents id=the-strong-element:represents>represents</a> strong importance, seriousness, or
- urgency for its contents.</p>
- <p><strong>Importance</strong>: The <code id=the-strong-element:the-strong-element-2><a href=#the-strong-element>strong</a></code> element can be used in a heading, caption,
- or paragraph to distinguish the part that really matters from other parts that might be more
- detailed, more jovial, or merely boilerplate. (This is distinct from marking up subheadings, for
- which the <code id=the-strong-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element is appropriate.)</p>
- <p class=example>For example, the first word of the previous paragraph is marked up with
- <code id=the-strong-element:the-strong-element-3><a href=#the-strong-element>strong</a></code> to distinguish it from the more detailed text in the rest of the
- paragraph.</p>
- <p><strong>Seriousness</strong>: The <code id=the-strong-element:the-strong-element-4><a href=#the-strong-element>strong</a></code> element can be used to mark up a warning
- or caution notice.</p>
- <p><strong>Urgency</strong>: The <code id=the-strong-element:the-strong-element-5><a href=#the-strong-element>strong</a></code> element can be used to denote contents that
- the user needs to see sooner than other parts of the document.</p>
- <p>The relative level of importance of a piece of content is given by its number of ancestor
- <code id=the-strong-element:the-strong-element-6><a href=#the-strong-element>strong</a></code> elements; each <code id=the-strong-element:the-strong-element-7><a href=#the-strong-element>strong</a></code> element increases the importance of its
- contents.</p>
- <p>Changing the importance of a piece of text with the <code id=the-strong-element:the-strong-element-8><a href=#the-strong-element>strong</a></code> element does not change
- the meaning of the sentence.</p>
- <div class=example>
- <p>Here, the word "chapter" and the actual chapter number are mere boilerplate, and the actual
- name of the chapter is marked up with <code id=the-strong-element:the-strong-element-9><a href=#the-strong-element>strong</a></code>:</p>
- <pre><h1>Chapter 1: <strong>The Praxis</strong></h1></pre>
- <p>In the following example, the name of the diagram in the caption is marked up with
- <code id=the-strong-element:the-strong-element-10><a href=#the-strong-element>strong</a></code>, to distinguish it from boilerplate text (before) and the description
- (after):</p>
- <pre><figcaption>Figure 1. <strong>Ant colony dynamics</strong>. The ants in this colony are
- affected by the heat source (upper left) and the food source (lower right).</figcaption></pre>
- <p>In this example, the heading is really "Flowers, Bees, and Honey", but the author has added a
- light-hearted addition to the heading. The <code id=the-strong-element:the-strong-element-11><a href=#the-strong-element>strong</a></code> element is thus used to mark up
- the first part to distinguish it from the latter part.</p>
- <pre><h1><strong>Flowers, Bees, and Honey</strong> and other things I don't understand</h1></pre>
- </div>
- <div class=example>
- <p>Here is an example of a warning notice in a game, with the
- various parts marked up according to how important they are:</p>
-
- <pre><p><strong>Warning.</strong> This dungeon is dangerous.
- <strong>Avoid the ducks.</strong> Take any gold you find.
- <strong><strong>Do not take any of the diamonds</strong>,
- they are explosive and <strong>will destroy anything within
- ten meters.</strong></strong> You have been warned.</p></pre>
- </div>
- <div class=example>
- <p>In this example, the <code id=the-strong-element:the-strong-element-12><a href=#the-strong-element>strong</a></code> element is used to denote the part of the text that
- the user is intended to read first.</p>
- <pre><p>Welcome to Remy, the reminder system.</p>
- <p>Your tasks for today:</p>
- <ul>
- <li><p><strong>Turn off the oven.</strong></p></li>
- <li><p>Put out the trash.</p></li>
- <li><p>Do the laundry.</p></li>
- </ul></pre>
- </div>
- <h4 id=the-small-element>4.5.4 The <dfn><code>small</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-small-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-small-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-small-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-small-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-small-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-small-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-small-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-small-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-small-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-small-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-small-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-small-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-small-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-small-element:the-small-element><a href=#the-small-element>small</a></code> element <a href=#represents id=the-small-element:represents>represents</a> side comments such as small print.</p>
- <p class=note>Small print typically features disclaimers, caveats, legal restrictions, or
- copyrights. Small print is also sometimes used for attribution, or for satisfying licensing
- requirements.</p>
- <p class=note>The <code id=the-small-element:the-small-element-2><a href=#the-small-element>small</a></code> element does not "de-emphasize" or lower the importance of
- text emphasized by the <code id=the-small-element:the-em-element><a href=#the-em-element>em</a></code> element or marked as important with the <code id=the-small-element:the-strong-element><a href=#the-strong-element>strong</a></code>
- element. To mark text as not emphasized or important, simply do not mark it up with the
- <code id=the-small-element:the-em-element-2><a href=#the-em-element>em</a></code> or <code id=the-small-element:the-strong-element-2><a href=#the-strong-element>strong</a></code> elements respectively.</p>
- <p>The <code id=the-small-element:the-small-element-3><a href=#the-small-element>small</a></code> element should not be used for extended spans of text, such as multiple
- paragraphs, lists, or sections of text. It is only intended for short runs of text. The text of a
- page listing terms of use, for instance, would not be a suitable candidate for the
- <code id=the-small-element:the-small-element-4><a href=#the-small-element>small</a></code> element: in such a case, the text is not a side comment, it is the main content
- of the page.</p>
- <p>The <code id=the-small-element:the-small-element-5><a href=#the-small-element>small</a></code> element must not be used for subheadings; for that purpose, use the
- <code id=the-small-element:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> element.</p>
- <div class=example>
- <p>In this example, the <code id=the-small-element:the-small-element-6><a href=#the-small-element>small</a></code> element is used to indicate that value-added tax is
- not included in a price of a hotel room:</p>
- <pre class=example><dl>
- <dt>Single room
- <dd>199 € <small>breakfast included, VAT not included</small>
- <dt>Double room
- <dd>239 € <small>breakfast included, VAT not included</small>
- </dl></pre>
- </div>
- <div class=example>
- <p>In this second example, the <code id=the-small-element:the-small-element-7><a href=#the-small-element>small</a></code> element is used for a side comment in an
- article.</p>
- <pre><p>Example Corp today announced record profits for the
- second quarter <small>(Full Disclosure: Foo News is a subsidiary of
- Example Corp)</small>, leading to speculation about a third quarter
- merger with Demo Group.</p></pre>
- <p>This is distinct from a sidebar, which might be multiple paragraphs long and is removed from
- the main flow of text. In the following example, we see a sidebar from the same article. This
- sidebar also has small print, indicating the source of the information in the sidebar.</p>
- <pre><aside>
- <h1>Example Corp</h1>
- <p>This company mostly creates small software and Web
- sites.</p>
- <p>The Example Corp company mission is "To provide entertainment
- and news on a sample basis".</p>
- <p><small>Information obtained from <a
- href="http://example.com/about.html">example.com</a> home
- page.</small></p>
- </aside></pre>
- </div>
- <div class=example>
- <p>In this last example, the <code id=the-small-element:the-small-element-8><a href=#the-small-element>small</a></code> element is marked as being <em>important</em>
- small print.</p>
- <pre><p><strong><small>Continued use of this service will result in a kiss.</small></strong></p></pre>
- </div>
- <h4 id=the-s-element>4.5.5 The <dfn><code>s</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-s-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-s-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-s-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-s-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-s-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-s-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-s-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-s-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-s-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-s-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-s-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-s-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-s-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-s-element:the-s-element><a href=#the-s-element>s</a></code> element <a href=#represents id=the-s-element:represents>represents</a> contents that are no longer accurate or no
- longer relevant.</p>
- <p class=note>The <code id=the-s-element:the-s-element-2><a href=#the-s-element>s</a></code> element is not appropriate when indicating document edits; to
- mark a span of text as having been removed from a document, use the <code id=the-s-element:the-del-element><a href=#the-del-element>del</a></code> element.</p>
- <div class=example>
- <p>In this example a recommended retail price has been marked as no longer relevant as the
- product in question has a new sale price.</p>
- <pre><p>Buy our Iced Tea and Lemonade!</p>
- <p><s>Recommended retail price: $3.99 per bottle</s></p>
- <p><strong>Now selling for just $2.99 a bottle!</strong></p></pre>
- </div>
- <h4 id=the-cite-element>4.5.6 The <dfn><code>cite</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-cite-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-cite-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-cite-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-cite-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-cite-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-cite-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-cite-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-cite-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-cite-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-cite-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-cite-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-cite-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-cite-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-cite-element:the-cite-element><a href=#the-cite-element>cite</a></code> element <a href=#represents id=the-cite-element:represents>represents</a> the title of a work (e.g.
- a book,
- a paper,
- an essay,
- a poem,
- a score,
- a song,
- a script,
- a film,
- a TV show,
- a game,
- a sculpture,
- a painting,
- a theatre production,
- a play,
- an opera,
- a musical,
- an exhibition,
- a legal case report,
- a computer program,
- etc). This can be a work that is being quoted or referenced in detail (i.e. a citation), or it can
- just be a work that is mentioned in passing.</p>
- <p>A person's name is not the title of a work — even if people call that person a piece of
- work — and the element must therefore not be used to mark up people's names. (In some cases,
- the <code id=the-cite-element:the-b-element><a href=#the-b-element>b</a></code> element might be appropriate for names; e.g. in a gossip article where the
- names of famous people are keywords rendered with a different style to draw attention to them. In
- other cases, if an element is <em>really</em> needed, the <code id=the-cite-element:the-span-element><a href=#the-span-element>span</a></code> element can be
- used.)</p>
- <div class=example>
- <p>This next example shows a typical use of the <code id=the-cite-element:the-cite-element-2><a href=#the-cite-element>cite</a></code> element:</p>
- <pre><p>My favorite book is <cite>The Reality Dysfunction</cite> by
- Peter F. Hamilton. My favorite comic is <cite>Pearls Before
- Swine</cite> by Stephan Pastis. My favorite track is <cite>Jive
- Samba</cite> by the Cannonball Adderley Sextet.</p></pre>
- </div>
- <div class=example>
- <p>This is correct usage:</p>
- <pre><p>According to the Wikipedia article <cite>HTML</cite>, as it
- stood in mid-February 2008, leaving attribute values unquoted is
- unsafe. This is obviously an over-simplification.</p></pre>
- <p>The following, however, is incorrect usage, as the <code id=the-cite-element:the-cite-element-3><a href=#the-cite-element>cite</a></code> element here is
- containing far more than the title of the work:</p>
- <pre class=bad><!-- do not copy this example, it is an example of bad usage! -->
- <p>According to <cite>the Wikipedia article on HTML</cite>, as it
- stood in mid-February 2008, leaving attribute values unquoted is
- unsafe. This is obviously an over-simplification.</p></pre>
- </div>
- <div class=example>
- <p>The <code id=the-cite-element:the-cite-element-4><a href=#the-cite-element>cite</a></code> element is obviously a key part of any citation in a bibliography, but
- it is only used to mark the title:</p>
- <pre><p><cite>Universal Declaration of Human Rights</cite>, United Nations,
- December 1948. Adopted by General Assembly resolution 217 A (III).</p></pre>
- </div>
- <p class=note>A <em>citation</em> is not a <em>quote</em> (for which the <code id=the-cite-element:the-q-element><a href=#the-q-element>q</a></code> element
- is appropriate).</p>
- <div class=example>
- <p>This is incorrect usage, because <code id=the-cite-element:the-cite-element-5><a href=#the-cite-element>cite</a></code> is not for quotes:</p>
- <pre class=bad><p><cite>This is wrong!</cite>, said Ian.</p></pre>
- <p>This is also incorrect usage, because a person is not a work:</p>
- <pre class=bad><p><q>This is still wrong!</q>, said <cite>Ian</cite>.</p></pre>
- <p>The correct usage does not use a <code id=the-cite-element:the-cite-element-6><a href=#the-cite-element>cite</a></code> element:</p>
- <pre><p><q>This is correct</q>, said Ian.</p></pre>
- <p>As mentioned above, the <code id=the-cite-element:the-b-element-2><a href=#the-b-element>b</a></code> element might be relevant for marking names as being
- keywords in certain kinds of documents:</p>
- <pre><p>And then <b>Ian</b> said <q>this might be right, in a
- gossip column, maybe!</q>.</p></pre>
- </div>
- <h4 id=the-q-element>4.5.7 The <dfn><code>q</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-q-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-q-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-q-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-q-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-q-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-q-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-q-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-q-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-q-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-q-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-q-element:global-attributes>Global attributes</a><dd><code id=the-q-element:attr-q-cite><a href=#attr-q-cite>cite</a></code> — Link to the source of the quotation or more information about the edit<dt><a href=#concept-element-dom id=the-q-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-q-element:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code>.</dl>
- <p>The <code id=the-q-element:the-q-element><a href=#the-q-element>q</a></code> element <a href=#represents id=the-q-element:represents>represents</a> some <a href=#phrasing-content-2 id=the-q-element:phrasing-content-2-4>phrasing
- content</a> quoted from another source.</p>
- <p>Quotation punctuation (such as quotation marks) that is quoting the contents of the element
- must not appear immediately before, after, or inside <code id=the-q-element:the-q-element-2><a href=#the-q-element>q</a></code> elements; they will be
- inserted into the rendering by the user agent.</p>
- <p>Content inside a <code id=the-q-element:the-q-element-3><a href=#the-q-element>q</a></code> element must be quoted from another source, whose address, if
- it has one, may be cited in the <dfn id=attr-q-cite><code>cite</code></dfn> attribute. The
- source may be fictional, as when quoting characters in a novel or screenplay.</p>
- <p>If the <code id=the-q-element:attr-q-cite-2><a href=#attr-q-cite>cite</a></code> attribute is present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces id=the-q-element:valid-url-potentially-surrounded-by-spaces>valid URL
- potentially surrounded by spaces</a>. To obtain the corresponding citation
- link, the value of the attribute must be <a href=#resolve-a-url id=the-q-element:resolve-a-url>resolved</a> relative to
- the element. User agents may allow users to follow such citation links, but they are
- primarily intended for private use (e.g. by server-side scripts collecting statistics about a
- site's use of quotations), not for readers.</p>
- <p>The <code id=the-q-element:the-q-element-4><a href=#the-q-element>q</a></code> element must not be used in place of quotation marks that do not represent
- quotes; for example, it is inappropriate to use the <code id=the-q-element:the-q-element-5><a href=#the-q-element>q</a></code> element for marking up
- sarcastic statements.</p>
- <p>The use of <code id=the-q-element:the-q-element-6><a href=#the-q-element>q</a></code> elements to mark up quotations is entirely optional; using explicit
- quotation punctuation without <code id=the-q-element:the-q-element-7><a href=#the-q-element>q</a></code> elements is just as correct.</p>
- <div class=example>
- <p>Here is a simple example of the use of the <code id=the-q-element:the-q-element-8><a href=#the-q-element>q</a></code> element:</p>
- <pre><p>The man said <q>Things that are impossible just take
- longer</q>. I disagreed with him.</p></pre>
- </div>
- <div class=example>
- <p>Here is an example with both an explicit citation link in the <code id=the-q-element:the-q-element-9><a href=#the-q-element>q</a></code> element, and an
- explicit citation outside:</p>
- <pre><p>The W3C page <cite>About W3C</cite> says the W3C's
- mission is <q cite="http://www.w3.org/Consortium/">To lead the
- World Wide Web to its full potential by developing protocols and
- guidelines that ensure long-term growth for the Web</q>. I
- disagree with this mission.</p></pre>
- </div>
- <div class=example>
- <p>In the following example, the quotation itself contains a quotation:</p>
- <pre><p>In <cite>Example One</cite>, he writes <q>The man
- said <q>Things that are impossible just take longer</q>. I
- disagreed with him</q>. Well, I disagree even more!</p></pre>
- </div>
- <div class=example>
- <p>In the following example, quotation marks are used instead of the <code id=the-q-element:the-q-element-10><a href=#the-q-element>q</a></code> element:</p>
- <pre><p>His best argument was ❝I disagree❞, which
- I thought was laughable.</p></pre>
- </div>
- <div class=example>
- <p>In the following example, there is no quote — the quotation marks are used to name a
- word. Use of the <code id=the-q-element:the-q-element-11><a href=#the-q-element>q</a></code> element in this case would be inappropriate.</p>
- <pre><p>The word "ineffable" could have been used to describe the disaster
- resulting from the campaign's mismanagement.</p></pre>
- </div>
- <h4 id=the-dfn-element>4.5.8 The <dfn><code>dfn</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-dfn-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-dfn-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-dfn-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-dfn-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-dfn-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-dfn-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-dfn-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-dfn-element:phrasing-content-2-3>Phrasing content</a>, but there must be no <code id=the-dfn-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-dfn-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-dfn-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-dfn-element:global-attributes>Global attributes</a><dd>Also, the <code id=the-dfn-element:attr-dfn-title><a href=#attr-dfn-title>title</a></code> attribute <a href=#attr-dfn-title id=the-dfn-element:attr-dfn-title-2>has special semantics</a> on this element: Full term or expansion of abbreviation.<dt><a href=#concept-element-dom id=the-dfn-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-dfn-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-dfn-element:the-dfn-element-2><a href=#the-dfn-element>dfn</a></code> element <a href=#represents id=the-dfn-element:represents>represents</a> the defining instance of a term. The <a href=#paragraph id=the-dfn-element:paragraph>paragraph</a>, <a href=#the-dl-element id=the-dfn-element:the-dl-element>description list group</a>, or <a href=#sectioning-content-2 id=the-dfn-element:sectioning-content-2>section</a> that is the nearest ancestor of the <code id=the-dfn-element:the-dfn-element-3><a href=#the-dfn-element>dfn</a></code>
- element must also contain the definition(s) for the <a href=#defining-term id=the-dfn-element:defining-term>term</a> given
- by the <code id=the-dfn-element:the-dfn-element-4><a href=#the-dfn-element>dfn</a></code> element.</p>
- <p><dfn id=defining-term>Defining term</dfn>: If the <code id=the-dfn-element:the-dfn-element-5><a href=#the-dfn-element>dfn</a></code> element has a <dfn id=attr-dfn-title><code>title</code></dfn> attribute, then the exact value of that attribute
- is the term being defined. Otherwise, if it contains exactly one element child node and no child
- <code id=the-dfn-element:text><a href=#text>Text</a></code> nodes, and that child element is an <code id=the-dfn-element:the-abbr-element><a href=#the-abbr-element>abbr</a></code> element with a <code id=the-dfn-element:attr-abbr-title><a href=#attr-abbr-title>title</a></code> attribute, then the exact value of <em>that</em> attribute is
- the term being defined. Otherwise, it is the exact <code id=the-dfn-element:textcontent><a href=#textcontent>textContent</a></code> of the
- <code id=the-dfn-element:the-dfn-element-6><a href=#the-dfn-element>dfn</a></code> element that gives the term being defined.</p>
-
- <p>If the <code id=the-dfn-element:attr-dfn-title-3><a href=#attr-dfn-title>title</a></code> attribute of the <code id=the-dfn-element:the-dfn-element-7><a href=#the-dfn-element>dfn</a></code> element is
- present, then it must contain only the term being defined.</p>
- <p class=note>The <code id=the-dfn-element:attr-title><a href=#attr-title>title</a></code> attribute of ancestor elements does not
- affect <code id=the-dfn-element:the-dfn-element-8><a href=#the-dfn-element>dfn</a></code> elements.</p>
- <p>An <code id=the-dfn-element:the-a-element><a href=#the-a-element>a</a></code> element that links to a <code id=the-dfn-element:the-dfn-element-9><a href=#the-dfn-element>dfn</a></code> element represents an instance of
- the term defined by the <code id=the-dfn-element:the-dfn-element-10><a href=#the-dfn-element>dfn</a></code> element.</p>
- <div class=example>
- <p>In the following fragment, the term "Garage Door Opener" is first defined in the first
- paragraph, then used in the second. In both cases, its abbreviation is what is actually
- displayed.</p>
- <pre><p>The <strong><dfn><abbr title="Garage Door Opener">GDO</abbr></dfn></strong>
- is a device that allows off-world teams to open the iris.</p>
- <!-- ... later in the document: -->
- <p>Teal'c activated his <strong><abbr title="Garage Door Opener">GDO</abbr></strong>
- and so Hammond ordered the iris to be opened.</p></pre>
- <p>With the addition of an <code id=the-dfn-element:the-a-element-2><a href=#the-a-element>a</a></code> element, the reference can be made explicit:</p>
- <pre><p>The <dfn <strong>id=gdo</strong>><abbr title="Garage Door Opener">GDO</abbr></dfn>
- is a device that allows off-world teams to open the iris.</p>
- <!-- ... later in the document: -->
- <p>Teal'c activated his <strong><a href=#gdo></strong><abbr title="Garage Door Opener">GDO</abbr><strong></a></strong>
- and so Hammond ordered the iris to be opened.</p></pre>
- </div>
- <h4 id=the-abbr-element>4.5.9 The <dfn><code>abbr</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-abbr-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-abbr-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-abbr-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-abbr-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-abbr-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-abbr-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-abbr-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-abbr-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-abbr-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-abbr-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-abbr-element:global-attributes>Global attributes</a><dd>Also, the <code id=the-abbr-element:attr-abbr-title><a href=#attr-abbr-title>title</a></code> attribute <a href=#attr-abbr-title id=the-abbr-element:attr-abbr-title-2>has special semantics</a> on this element: Full term or expansion of abbreviation.<dt><a href=#concept-element-dom id=the-abbr-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-abbr-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-abbr-element:the-abbr-element><a href=#the-abbr-element>abbr</a></code> element <a href=#represents id=the-abbr-element:represents>represents</a> an abbreviation or acronym, optionally
- with its expansion. The <dfn id=attr-abbr-title><code>title</code></dfn> attribute may be
- used to provide an expansion of the abbreviation. The attribute, if specified, must contain an
- expansion of the abbreviation, and nothing else.</p>
- <div class=example>
- <p>The paragraph below contains an abbreviation marked up with the <code id=the-abbr-element:the-abbr-element-2><a href=#the-abbr-element>abbr</a></code> element.
- This paragraph <a href=#defining-term id=the-abbr-element:defining-term>defines the term</a> "Web Hypertext Application
- Technology Working Group".</p>
- <pre><p>The <dfn id=whatwg><abbr
- title="Web Hypertext Application Technology Working Group">WHATWG</abbr></dfn>
- is a loose unofficial collaboration of Web browser manufacturers and
- interested parties who wish to develop new technologies designed to
- allow authors to write and deploy Applications over the World Wide
- Web.</p></pre>
- <p>An alternative way to write this would be:</p>
- <pre><p>The <dfn id=whatwg>Web Hypertext Application Technology
- Working Group</dfn> (<abbr
- title="Web Hypertext Application Technology Working Group">WHATWG</abbr>)
- is a loose unofficial collaboration of Web browser manufacturers and
- interested parties who wish to develop new technologies designed to
- allow authors to write and deploy Applications over the World Wide
- Web.</p></pre>
- </div>
- <div class=example>
- <p>This paragraph has two abbreviations. Notice how only one is defined; the other, with no
- expansion associated with it, does not use the <code id=the-abbr-element:the-abbr-element-3><a href=#the-abbr-element>abbr</a></code> element.</p>
- <pre><p>The
- <abbr title="Web Hypertext Application Technology Working Group">WHATWG</abbr>
- started working on HTML5 in 2004.</p></pre>
- </div>
- <div class=example>
- <p>This paragraph links an abbreviation to its definition.</p>
- <pre><p>The <a href="#whatwg"><abbr
- title="Web Hypertext Application Technology Working Group">WHATWG</abbr></a>
- community does not have much representation from Asia.</p></pre>
- </div>
- <div class=example>
- <p>This paragraph marks up an abbreviation without giving an expansion, possibly as a hook to
- apply styles for abbreviations (e.g. smallcaps).</p>
- <pre><p>Philip` and Dashiva both denied that they were going to
- get the issue counts from past revisions of the specification to
- backfill the <abbr>WHATWG</abbr> issue graph.</p></pre>
- </div>
- <p>If an abbreviation is pluralized, the expansion's grammatical number (plural vs singular) must
- match the grammatical number of the contents of the element.</p>
- <div class=example>
- <p>Here the plural is outside the element, so the expansion is in the singular:</p>
- <pre><p>Two <abbr title="Working Group">WG</abbr>s worked on
- this specification: the <abbr>WHATWG</abbr> and the
- <abbr>HTMLWG</abbr>.</p></pre>
- <p>Here the plural is inside the element, so the expansion is in the plural:</p>
- <pre><p>Two <abbr title="Working Groups">WGs</abbr> worked on
- this specification: the <abbr>WHATWG</abbr> and the
- <abbr>HTMLWG</abbr>.</p></pre>
- </div>
- <p>Abbreviations do not have to be marked up using this element. It is expected to be useful in
- the following cases:</p>
- <ul><li>Abbreviations for which the author wants to give expansions, where using the
- <code id=the-abbr-element:the-abbr-element-4><a href=#the-abbr-element>abbr</a></code> element with a <code id=the-abbr-element:attr-title><a href=#attr-title>title</a></code> attribute is an
- alternative to including the expansion inline (e.g. in parentheses).<li>Abbreviations that are likely to be unfamiliar to the document's readers, for which authors
- are encouraged to either mark up the abbreviation using an <code id=the-abbr-element:the-abbr-element-5><a href=#the-abbr-element>abbr</a></code> element with a <code id=the-abbr-element:attr-title-2><a href=#attr-title>title</a></code> attribute or include the expansion inline in the text the first
- time the abbreviation is used.<li>Abbreviations whose presence needs to be semantically annotated, e.g. so that they can be
- identified from a style sheet and given specific styles, for which the <code id=the-abbr-element:the-abbr-element-6><a href=#the-abbr-element>abbr</a></code> element
- can be used without a <code id=the-abbr-element:attr-title-3><a href=#attr-title>title</a></code> attribute.</ul>
- <p>Providing an expansion in a <code id=the-abbr-element:attr-title-4><a href=#attr-title>title</a></code> attribute once
- will not necessarily cause other <code id=the-abbr-element:the-abbr-element-7><a href=#the-abbr-element>abbr</a></code> elements in the same document with the same
- contents but without a <code id=the-abbr-element:attr-title-5><a href=#attr-title>title</a></code> attribute to behave as if they had
- the same expansion. Every <code id=the-abbr-element:the-abbr-element-8><a href=#the-abbr-element>abbr</a></code> element is independent.</p>
- <h4 id=the-ruby-element>4.5.10 The <dfn><code>ruby</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-ruby-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-ruby-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-ruby-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-ruby-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-ruby-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-ruby-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-ruby-element:concept-element-content-model>Content model</a>:<dd>See prose.<dt><a href=#concept-element-tag-omission id=the-ruby-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-ruby-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-ruby-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-ruby-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-ruby-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-ruby-element:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element allows one or more spans of phrasing content to be marked with
- ruby annotations. Ruby annotations are short runs of text presented alongside base text, primarily
- used in East Asian typography as a guide for pronunciation or to include other annotations. In
- Japanese, this form of typography is also known as <i>furigana</i>.</p>
- <p>The content model of <code id=the-ruby-element:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code> elements consists of one or more of the following
- sequences:</p>
- <ol class=brief><li>One or the other of the following:
- <ul class=brief><li><a href=#phrasing-content-2 id=the-ruby-element:phrasing-content-2-3>Phrasing content</a>, but with no <code id=the-ruby-element:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code> elements and with no <code id=the-ruby-element:the-ruby-element-4><a href=#the-ruby-element>ruby</a></code> element descendants
- <li>A single <code id=the-ruby-element:the-ruby-element-5><a href=#the-ruby-element>ruby</a></code> element that itself has no <code id=the-ruby-element:the-ruby-element-6><a href=#the-ruby-element>ruby</a></code> element descendants
- </ul>
- <li>One or the other of the following:
- <ul class=brief><li>One or more <code id=the-ruby-element:the-rt-element><a href=#the-rt-element>rt</a></code> elements
- <li>An <code id=the-ruby-element:the-rp-element><a href=#the-rp-element>rp</a></code> element followed by one or more <code id=the-ruby-element:the-rt-element-2><a href=#the-rt-element>rt</a></code> elements, each of which is itself followed by an <code id=the-ruby-element:the-rp-element-2><a href=#the-rp-element>rp</a></code> element
- </ul>
- </ol>
-
- <p>The <code id=the-ruby-element:the-ruby-element-7><a href=#the-ruby-element>ruby</a></code> and <code id=the-ruby-element:the-rt-element-3><a href=#the-rt-element>rt</a></code> elements can be used for a variety of kinds of
- annotations, including in particular (though by no means limited to) those described below. For
- more details on Japanese Ruby in particular, and how to render Ruby for Japanese, see
- <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
- <p class=note>At the time of writing, CSS does not yet provide a way to fully control the
- rendering of the HTML <code id=the-ruby-element:the-ruby-element-8><a href=#the-ruby-element>ruby</a></code> element. It is hoped that CSS will be extended to support
- the styles described below in due course.</p>
-
- <dl><dt>Mono-ruby for individual base characters in Japanese
- <dd>
- <p>One or more hiragana or katakana characters (the ruby annotation) are placed with each
- ideographic character (the base text). This is used to provide readings of kanji characters.
- <div class=example>
- <pre><ruby>B<rt>annotation</ruby></pre>
- </div>
- <div class=example>
- <p>In this example, notice how each annotation corresponds to a single base character.
- <pre><ruby>君<rt>くん</ruby><ruby>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。</pre>
- <p lang=ja><ruby>君<rt>くん</ruby><ruby>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。
- <p>This example can also be written as follows, using one <code id=the-ruby-element:the-ruby-element-9><a href=#the-ruby-element>ruby</a></code> element with two
- segments of base text and two annotations (one for each) rather than two back-to-back
- <code id=the-ruby-element:the-ruby-element-10><a href=#the-ruby-element>ruby</a></code> elements each with one base text segment and annotation (as in the markup
- above):
- <pre><ruby>君<rt>くん</rt>子<rt>し</ruby>は<ruby>和<rt>わ</ruby>して<ruby>同<rt>どう</ruby>ぜず。</pre>
- </div>
- <dt>Mono-ruby for compound words (jukugo)
- <dd>
- <p>This is similar to the previous case: each ideographic character in the compound word (the
- base text) has its reading given in hiragana or katakana characters (the ruby annotation). The
- difference is that the base text segments form a compound word rather than being separate from
- each other.
- <div class=example>
- <pre><ruby>B<rt>annotation</rt>B<rt>annotation</ruby></pre>
- </div>
- <div class=example>
- <p>In this example, notice again how each annotation corresponds to a single base character. In this example, each compound word (jukugo) corresponds to a single <code id=the-ruby-element:the-ruby-element-11><a href=#the-ruby-element>ruby</a></code> element.</p>
- <p>The rendering here is expected to be that each annotation be placed over (or next to, in vertical text) the corresponding base character, with the annotations not overhanging any of the adjacent characters.</p>
- <pre><ruby>鬼<rt>き</rt>門<rt>もん</rt></ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</rt></ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</rt></ruby>する</pre>
- <p lang=ja><ruby>鬼<rt>き</rt>門<rt>もん</ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</ruby>する
- </div>
- <dt>Jukugo-ruby
- <dd>
- <p>This is semantically identical to the previous case (each individual ideographic character in
- the base compound word has its reading given in an annotation in hiragana or katakana
- characters), but the rendering is the more complicated Jukugo Ruby rendering.
- <div class=example>
- <p>This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.</p>
- <pre><ruby>鬼<rt>き</rt>門<rt>もん</rt></ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</rt></ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</rt></ruby>する</pre>
-
-
- </div>
- <p class=note>For more details on <a href=http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby>Jukugo Ruby rendering</a>, see
- Appendix F in the <cite>Requirements for Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
- <dt>Group ruby for describing meanings
- <dd>
- <p>The annotation describes the meaning of the base text, rather than (or in addition to) the
- pronunciation. As such, both the base text and the annotation can be multiple characters long.
- <div class=example> <pre><ruby>BASE<rt>annotation</ruby></pre> </div>
- <div class=example>
- <p>Here a compound ideographic word has its corresponding katakana given as an annotation.
- <pre><ruby>境界面<rt>インターフェース</ruby></pre>
- <p lang=ja><ruby>境界面<rt>インターフェース</ruby>
- </div>
- <div class=example>
- <p>Here a compound ideographic word has its translation in English provided as an annotation.
- <pre><ruby lang="ja">編集者<rt lang="en">editor</ruby></pre>
- <p><ruby lang=ja>編集者<rt lang=en>editor</ruby>
- </div>
- <dt>Group ruby for Jukuji readings
- <dd>
- <p>A phonetic reading that corresponds to multiple base characters, because a one-to-one mapping
- would be difficult. (In English, the words "Colonel" and "Lieutenant" are examples of words
- where a direct mapping of pronunciation to individual letters is, in some dialects, rather
- unclear.)
- <div class=example>
- <p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby:
- <pre><ruby>紫陽花<rt>あじさい</ruby></pre>
- <p lang=ja><ruby>紫陽花<rt>あじさい</ruby>
- </div>
- <dt>Text with both phonetic and semantic annotations (double-sided ruby)
- <dd>
- <p>Sometimes, ruby styles described above are combined.
- <p>If this results in two annotations covering the same single base segment, then the
- annotations can just be placed back to back.
- <div class=example>
- <pre><ruby>BASE<rt>annotation 1<rt>annotation 2</ruby></pre>
- </div>
- <div class=example>
- <pre><ruby>B<rt>a<rt>a</ruby><ruby>A<rt>a<rt>a</ruby><ruby>S<rt>a<rt>a</ruby><ruby>E<rt>a<rt>a</ruby></pre>
- </div>
- <div class=example>
- <p>In this contrived example, some symbols are given names in English and French.
- <pre><ruby>
- ♥ <rt> Heart <rt lang=fr> Cœur
- ☘ <rt> Shamrock <rt lang=fr> Trèfle
- ✶ <rt> Star <rt lang=fr> Étoile
- </ruby></pre>
- </div>
- <p>In more complication situations such as following examples, a nested <code id=the-ruby-element:the-ruby-element-12><a href=#the-ruby-element>ruby</a></code>
- element is used to give the inner annotations, and then that whole <code id=the-ruby-element:the-ruby-element-13><a href=#the-ruby-element>ruby</a></code> is then
- given an annotation at the "outer" level.
- <div class=example>
- <pre><ruby><ruby>B<rt>a</rt>A<rt>n</rt>S<rt>t</rt>E<rt>n</rt></ruby><rt>annotation</ruby></pre>
- </div>
- <div class=example>
- <p>Here both a phonetic reading and the meaning are given in ruby annotations. The annotation on the nested <code id=the-ruby-element:the-ruby-element-14><a href=#the-ruby-element>ruby</a></code> element gives a mono-ruby phonetic annotation for each base character, while the annotation in the <code id=the-ruby-element:the-rt-element-4><a href=#the-rt-element>rt</a></code> element that is a child of the outer <code id=the-ruby-element:the-ruby-element-15><a href=#the-ruby-element>ruby</a></code> element gives the meaning using hiragana.
- <pre><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt>たつみ</rt></ruby>の方角</pre>
- <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</ruby><rt>たつみ</ruby>の方角
- </div>
- <div class=example>
- <p>This is the same example, but the meaning is given in English instead of Japanese:
- <pre><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt lang=en>Southeast</rt></ruby>の方角</pre>
- <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</ruby><rt lang=en>Southeast</ruby>の方角
- </div>
- </dl>
- <hr>
- <p>Within a <code id=the-ruby-element:the-ruby-element-16><a href=#the-ruby-element>ruby</a></code> element that does not have a <code id=the-ruby-element:the-ruby-element-17><a href=#the-ruby-element>ruby</a></code> element ancestor,
- content is segmented and segments are placed into three categories: base text segments, annotation
- segments, and ignored segments. Ignored segments do not form part of the document's semantics
- (they consist of some <a href=#inter-element-whitespace id=the-ruby-element:inter-element-whitespace>inter-element whitespace</a> and <code id=the-ruby-element:the-rp-element-3><a href=#the-rp-element>rp</a></code> elements, the
- latter of which are used for legacy user agents that do not support ruby at all). Base text
- segments can overlap (with a limit of two segments overlapping any one position in the DOM, and
- with any segment having an earlier start point than an overlapping segment also having an equal or
- later end point, and any segment have a later end point than an overlapping segment also having an
- equal or earlier start point). Annotation segments correspond to <code id=the-ruby-element:the-rt-element-5><a href=#the-rt-element>rt</a></code> elements. Each annotation
- segment can be associated with a base text segment, and each base text segment can have annotation
- segments associated with it. (In a conforming document, each base text segment is associated with
- at least one annotation segment, and each annotation segment is associated with one base text
- segment.) A <code id=the-ruby-element:the-ruby-element-18><a href=#the-ruby-element>ruby</a></code> element <a href=#represents id=the-ruby-element:represents>represents</a> the union of the segments of base
- text it contains, along with the mapping from those base text segments to annotation segments.
- Segments are described in terms of DOM ranges; annotation segment ranges always consist of exactly
- one element. <a href=#refsDOM>[DOM]</a></p>
- <p>At any particular time, the segmentation and categorisation of content of a <code id=the-ruby-element:the-ruby-element-19><a href=#the-ruby-element>ruby</a></code>
- element is the result that would be obtained from running the following algorithm:</p>
- <ol><li><p>Let <var>base text segments</var> be an empty list of base text segments, each
- potentially with a list of base text subsegments.<li><p>Let <var>annotation segments</var> be an empty list of annotation segments, each
- potentially being associated with a base text segment or subsegment.<li><p>Let <var>root</var> be the <code id=the-ruby-element:the-ruby-element-20><a href=#the-ruby-element>ruby</a></code> element for which the algorithm is
- being run.<li><p>If <var>root</var> has a <code id=the-ruby-element:the-ruby-element-21><a href=#the-ruby-element>ruby</a></code> element ancestor, then jump to the
- step labeled <i>end</i>.<li><p>Let <var>current parent</var> be <var>root</var>.<li><p>Let <var>index</var> be 0.<li><p>Let <var>start index</var> be null.<li><p>Let <var>parent start index</var> be null.<li><p>Let <var>current base text</var> be null.<li><p><i>Start mode</i>: If <var>index</var> is equal to or greater than the number of
- child nodes in <var>current parent</var>, then jump to the step labeled <i>end
- mode</i>.</p>
- <li><p>If the <var>index</var>th node in <var>current parent</var> is an
- <code id=the-ruby-element:the-rt-element-6><a href=#the-rt-element>rt</a></code> or <code id=the-ruby-element:the-rp-element-4><a href=#the-rp-element>rp</a></code> element, jump to the step labeled <i>annotation
- mode</i>.<li><p>Set <var>start index</var> to the value of <var>index</var>.<li><p><i>Base mode</i>: If the <var>index</var>th node in <var>current
- parent</var> is a <code id=the-ruby-element:the-ruby-element-22><a href=#the-ruby-element>ruby</a></code> element, and if <var>current parent</var> is the
- same element as <var>root</var>, then <a href=#push-a-ruby-level id=the-ruby-element:push-a-ruby-level>push a ruby level</a> and then jump to
- the step labeled <i>start mode</i>.<li><p>If the <var>index</var>th node in <var>current parent</var> is an
- <code id=the-ruby-element:the-rt-element-7><a href=#the-rt-element>rt</a></code> or <code id=the-ruby-element:the-rp-element-5><a href=#the-rp-element>rp</a></code> element, then <a href=#set-the-current-base-text id=the-ruby-element:set-the-current-base-text>set the current base text</a> and then
- jump to the step labeled <i>annotation mode</i>.<li><p>Increment <var>index</var> by one.<li><p><i>Base mode post-increment</i>: If <var>index</var> is equal to or greater than
- the number of child nodes in <var>current parent</var>, then jump to the step labeled
- <i>end mode</i>.<li><p>Jump back to the step labeled <i>base mode</i>.<li><p><i>Annotation mode</i>: If the <var>index</var>th node in <var>current
- parent</var> is an <code id=the-ruby-element:the-rt-element-8><a href=#the-rt-element>rt</a></code> element, then <a href=#push-a-ruby-annotation id=the-ruby-element:push-a-ruby-annotation>push a ruby annotation</a> and jump to
- the step labeled <i>annotation mode increment</i>.<li><p>If the <var>index</var>th node in <var>current parent</var> is an
- <code id=the-ruby-element:the-rp-element-6><a href=#the-rp-element>rp</a></code> element, jump to the step labeled <i>annotation mode increment</i>.<li><p>If the <var>index</var>th node in <var>current parent</var> is not a
- <code id=the-ruby-element:text><a href=#text>Text</a></code> node, or is a <code id=the-ruby-element:text-2><a href=#text>Text</a></code> node that is not <a href=#inter-element-whitespace id=the-ruby-element:inter-element-whitespace-2>inter-element
- whitespace</a>, then jump to the step labeled <i>base mode</i>.<li><p><i>Annotation mode increment</i>: Let <var>lookahead index</var> be <var>index</var> plus one.<li><p><i>Annotation mode white-space skipper</i>: If <var>lookahead index</var> is
- equal to the number of child nodes in <var>current parent</var> then jump to the step
- labeled <i>end mode</i>.<li><p>If the <var>lookahead index</var>th node in <var>current parent</var> is
- an <code id=the-ruby-element:the-rt-element-9><a href=#the-rt-element>rt</a></code> element or an <code id=the-ruby-element:the-rp-element-7><a href=#the-rp-element>rp</a></code> element, then set <var>index</var> to
- <var>lookahead index</var> and jump to the step labeled <i>annotation mode</i>.<li><p>If the <var>lookahead index</var>th node in <var>current parent</var> is
- not a <code id=the-ruby-element:text-3><a href=#text>Text</a></code> node, or is a <code id=the-ruby-element:text-4><a href=#text>Text</a></code> node that is not <a href=#inter-element-whitespace id=the-ruby-element:inter-element-whitespace-3>inter-element
- whitespace</a>, then jump to the step labeled <i>base mode</i> (without further incrementing
- <var>index</var>, so the <a href=#inter-element-whitespace id=the-ruby-element:inter-element-whitespace-4>inter-element whitespace</a> seen so far becomes part
- of the next base text segment).<li><p>Increment <var>lookahead index</var> by one.<li><p>Jump to the step labeled <i>annotation mode white-space skipper</i>.<li><p><i>End mode</i>: If <var>current parent</var> is not the same element as <var>root</var>, then <a href=#pop-a-ruby-level id=the-ruby-element:pop-a-ruby-level>pop a ruby level</a> and jump to the step labeled <i>base mode
- post-increment</i>.<li><p><i>End</i>: Return <var>base text segments</var> and <var>annotation
- segments</var>. Any content of the <code id=the-ruby-element:the-ruby-element-23><a href=#the-ruby-element>ruby</a></code> element not described by segments in either
- of those lists is implicitly in an <i>ignored segment</i>.</ol>
- <p>When the steps above say to <dfn id=set-the-current-base-text>set the current base text</dfn>, it means to run the following
- steps at that point in the algorithm:</p>
- <ol><li><p>Let <var>text range</var> be a DOM range whose <a href=#concept-range-start id=the-ruby-element:concept-range-start>start</a> is the <a href=#concept-range-bp id=the-ruby-element:concept-range-bp>boundary
- point</a> (<var>current parent</var>, <var>start index</var>) and whose
- <a href=#concept-range-end id=the-ruby-element:concept-range-end>end</a> is the <a href=#concept-range-bp id=the-ruby-element:concept-range-bp-2>boundary
- point</a> (<var>current parent</var>, <var>index</var>).<li><p>Let <var>new text segment</var> be a base text segment described by the range
- <var>annotation range</var>.</p>
- <li><p>Add <var>new text segment</var> to <var>base text
- segments</var>.<li><p>Let <var>current base text</var> be <var>new text
- segment</var>.<li><p>Let <var>start index</var> be null.</ol>
- <p>When the steps above say to <dfn id=push-a-ruby-level>push a ruby level</dfn>, it means to run the following steps
- at that point in the algorithm:</p>
- <ol><li><p>Let <var>current parent</var> be the <var>index</var>th node in <var>current parent</var>.<li><p>Let <var>index</var> be 0.<li><p>Set <var>saved start index</var> to the value of <var>start
- index</var>.<li><p>Let <var>start index</var> be null.</ol>
- <p>When the steps above say to <dfn id=pop-a-ruby-level>pop a ruby level</dfn>, it means to run the following steps at
- that point in the algorithm:</p>
- <ol><li><p>Let <var>index</var> be the position of <var>current parent</var> in
- <var>root</var>.<li><p>Let <var>current parent</var> be <var>root</var>.<li><p>Increment <var>index</var> by one.<li><p>Set <var>start index</var> to the value of <var>saved start
- index</var>.<li><p>Let <var>saved start index</var> be null.</ol>
- <p>When the steps above say to <dfn id=push-a-ruby-annotation>push a ruby annotation</dfn>, it means to run the following
- steps at that point in the algorithm:</p>
- <ol><li><p>Let <var>rt</var> be the <code id=the-ruby-element:the-rt-element-10><a href=#the-rt-element>rt</a></code> element that is the <var>index</var>th node of <var>current parent</var>.<li><p>Let <var>annotation range</var> be a DOM range whose <a href=#concept-range-start id=the-ruby-element:concept-range-start-2>start</a> is the <a href=#concept-range-bp id=the-ruby-element:concept-range-bp-3>boundary
- point</a> (<var>current parent</var>, <var>index</var>) and whose <a href=#concept-range-end id=the-ruby-element:concept-range-end-2>end</a> is the <a href=#concept-range-bp id=the-ruby-element:concept-range-bp-4>boundary point</a>
- (<var>current parent</var>, <var>index</var> plus one) (i.e. that contains only
- <var>rt</var>).<li><p>Let <var>new annotation segment</var> be an annotation segment described by the
- range <var>annotation range</var>.<li><p>If <var>current base text</var> is not null, associate <var>new
- annotation segment</var> with <var>current base text</var>.<li><p>Add <var>new annotation segment</var> to <var>annotation
- segments</var>.</ol>
- <div class=example>
-
-
- <p>In this example, each ideograph in the Japanese text <span lang=ja>漢字</span> is annotated with its reading in hiragana.</p>
- <pre lang=ja>...
- <ruby>漢<rt>かん</rt>字<rt>じ</rt></ruby>
- ...</pre>
- <p>This might be rendered as:</p>
- <p><img src=http://images.whatwg.org/sample-ruby-ja.png width=171 alt="The two main ideographs, each with its annotation in hiragana rendered in a smaller font above it." height=78></p>
- </div>
- <div class=example>
-
- <p>In this example, each ideograph in the traditional Chinese text <span lang=zh-TW>漢字</span> is annotated with its bopomofo reading.</p>
- <pre lang=zh-TW><ruby>漢<rt>ㄏㄢˋ</rt>字<rt>ㄗˋ</rt></ruby></pre>
- <p>This might be rendered as:</p>
- <p><img src=http://images.whatwg.org/sample-ruby-bopomofo.png width=78 alt="The two main ideographs, each with its bopomofo annotation rendered in a smaller font next to it." height=100></p>
- </div>
- <div class=example>
-
- <p>In this example, each ideograph in the simplified Chinese text <span lang=zh-CN>汉字</span> is annotated with its pinyin reading.</p>
- <pre lang=zh-CN>...<ruby>汉<rt>hàn</rt>字<rt>zì</rt></ruby>...</pre>
- <p>This might be rendered as:</p>
- <p><img src=http://images.whatwg.org/sample-ruby-pinyin.png width=173 alt="The two main ideographs, each with its pinyin annotation rendered in a smaller font above it." height=79></p>
- </div>
-
- <div class=example>
- <p>In this more contrived example, the acronym "HTML" has four annotations: one for the whole
- acronym, briefly describing what it is, one for the letters "HT" expanding them to "Hypertext",
- one for the letter "M" expanding it to "Markup", and one for the letter "L" expanding it to
- "Language".</p>
- <pre><ruby>
- <ruby>HT<rt>Hypertext</rt>M<rt>Markup</rt>L<rt>Language</rt></ruby>
- <rt>An abstract language for describing documents and applications
- </ruby></pre>
- </div>
- <h4 id=the-rt-element>4.5.11 The <dfn><code>rt</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-rt-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-rt-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-rt-element:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element.<dt><a href=#concept-element-content-model id=the-rt-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-rt-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-rt-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-rt-element:the-rt-element><a href=#the-rt-element>rt</a></code> element's <a href=#syntax-end-tag id=the-rt-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-rt-element:the-rt-element-2><a href=#the-rt-element>rt</a></code> element is immediately followed by an <code id=the-rt-element:the-rt-element-3><a href=#the-rt-element>rt</a></code> or <code id=the-rt-element:the-rp-element><a href=#the-rp-element>rp</a></code> element,
- or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-rt-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-rt-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-rt-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-rt-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-rt-element:the-rt-element-4><a href=#the-rt-element>rt</a></code> element marks the ruby text component of a ruby annotation. When it is the
- child of a <code id=the-rt-element:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code> element, it doesn't <a href=#represents id=the-rt-element:represents>represent</a>
- anything itself, but the <code id=the-rt-element:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code> element uses it as part of determining what <em>it</em>
- <a href=#represents id=the-rt-element:represents-2>represents</a>.</p>
-
- <p>An <code id=the-rt-element:the-rt-element-5><a href=#the-rt-element>rt</a></code> element that is not a child of a <code id=the-rt-element:the-ruby-element-4><a href=#the-ruby-element>ruby</a></code> element
- <a href=#represents id=the-rt-element:represents-3>represents</a> the same thing as its children.</p>
-
- <h4 id=the-rp-element>4.5.12 The <dfn><code>rp</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-rp-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-rp-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-rp-element:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element, either immediately before or immediately after an <code id=the-rp-element:the-rt-element><a href=#the-rt-element>rt</a></code> element.<dt><a href=#concept-element-content-model id=the-rp-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-rp-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-rp-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-rp-element:the-rp-element><a href=#the-rp-element>rp</a></code> element's <a href=#syntax-end-tag id=the-rp-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-rp-element:the-rp-element-2><a href=#the-rp-element>rp</a></code> element is immediately followed by an <code id=the-rp-element:the-rt-element-2><a href=#the-rt-element>rt</a></code> or <code id=the-rp-element:the-rp-element-3><a href=#the-rp-element>rp</a></code> element,
- or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-rp-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-rp-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-rp-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-rp-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-rp-element:the-rp-element-4><a href=#the-rp-element>rp</a></code> element can be used to provide parentheses or other content around a ruby
- text component of a ruby annotation, to be shown by user agents that don't support ruby
- annotations.</p>
- <p>An <code id=the-rp-element:the-rp-element-5><a href=#the-rp-element>rp</a></code> element that is a child of a <code id=the-rp-element:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code>
- element <a href=#represents id=the-rp-element:represents>represents</a> nothing. An <code id=the-rp-element:the-rp-element-6><a href=#the-rp-element>rp</a></code> element
- whose parent element is not a <code id=the-rp-element:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code> element <a href=#represents id=the-rp-element:represents-2>represents</a> its
- children.</p>
- <div class=example>
- <p>The example above, in which each ideograph in the text <span lang=ja>漢字</span> is annotated with its phonetic reading, could be expanded to
- use <code id=the-rp-element:the-rp-element-7><a href=#the-rp-element>rp</a></code> so that in legacy user agents the readings are in parentheses:</p>
- <pre lang=ja>...
- <ruby>漢<rp> (</rp><rt>かん</rt><rp>) </rp>字<rp> (</rp><rt>じ</rt><rp>) </rp></ruby>
- ...</pre>
- <p>In conforming user agents the rendering would be as above, but in user agents that do not
- support ruby, the rendering would be:</p>
- <pre lang=ja>... 漢 (かん) 字 (じ) ...</pre>
- </div>
- <div class=example>
- <p>When there are multiple annotations for a segment, <code id=the-rp-element:the-rp-element-8><a href=#the-rp-element>rp</a></code> elements can also be placed
- between the annotations. Here is another copy of an earlier contrived example showing some
- symbols with names given in English and French, but this time with <code id=the-rp-element:the-rp-element-9><a href=#the-rp-element>rp</a></code> elements as
- well:
- <pre><ruby>
- ♥<rp>: </rp><rt>Heart</rt><rp>, </rp><rt lang=fr>Cœur</rt><rp>.</rp>
- ☘<rp>: </rp><rt>Shamrock</rt><rp>, </rp><rt lang=fr>Trèfle</rt><rp>.</rp>
- ✶<rp>: </rp><rt>Star</rt><rp>, </rp><rt lang=fr>Étoile</rt><rp>.</rp>
- </ruby></pre>
- <p>This would make the example render as follows in non-ruby-capable user agents:
- <pre>♥: Heart, <span lang=fr>Cœur</span>. ☘: Shamrock, <span lang=fr>Trèfle</span>. ✶: Star, <span lang=fr>Étoile</span>.</pre>
- </div>
- <h4 id=the-data-element>4.5.13 The <dfn><code>data</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-data-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-data-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-data-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-data-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-data-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-data-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-data-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-data-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-data-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-data-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-data-element:global-attributes>Global attributes</a><dd><code id=the-data-element:attr-data-value><a href=#attr-data-value>value</a></code> — Machine-readable value<dt><a href=#concept-element-dom id=the-data-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldataelement>HTMLDataElement</dfn> : <a href=#htmlelement id=the-data-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-data-value id=the-data-element:dom-data-value>value</a>;
- };</pre>
- </dl>
- <p>The <code id=the-data-element:the-data-element><a href=#the-data-element>data</a></code> element <a href=#represents id=the-data-element:represents>represents</a> its contents, along with a
- machine-readable form of those contents in the <code id=the-data-element:attr-data-value-2><a href=#attr-data-value>value</a></code>
- attribute.</p>
- <p>The <dfn id=attr-data-value><code>value</code></dfn> attribute must be present. Its value
- must be a representation of the element's contents in a machine-readable format.</p>
- <p class=note>When the value is date- or time-related, the more specific <code id=the-data-element:the-time-element><a href=#the-time-element>time</a></code>
- element can be used instead.</p>
- <p>The element can be used for several purposes.</p>
- <p>When combined with microformats or the <a href=#microdata>microdata attributes</a> defined in
- this specification, the element serves to provide both a machine-readable value for the purposes
- of data processors, and a human-readable value for the purposes of rendering in a Web browser. In
- this case, the format to be used in the <code id=the-data-element:attr-data-value-3><a href=#attr-data-value>value</a></code> attribute is
- determined by the microformats or microdata vocabulary in use.</p>
- <p>The element can also, however, be used in conjunction with scripts in the page, for when a
- script has a literal value to store alongside a human-readable value. In such cases, the format to
- be used depends only on the needs of the script. (The <code id=the-data-element:attr-data-*><a href=#attr-data-*>data-*</a></code>
- attributes can also be useful in such situations.)</p>
-
- <p>The <dfn id=dom-data-value><code>value</code></dfn> IDL attribute must
- <a href=#reflect id=the-data-element:reflect>reflect</a> the content attribute of the same name.</p>
-
- <div class=example>
- <p>Here, a short table has its numeric values encoded using <code id=the-data-element:the-data-element-2><a href=#the-data-element>data</a></code> so that the
- <a href=#table-sorting-model id=the-data-element:table-sorting-model>table sorting model</a> can provide a sorting mechanism on each column, despite the
- numbers being presented in textual form in one column and in a decomposed form in another.</p>
- <pre><table sortable>
- <thead> <tr> <th> Game <th> Corporations <th> Map Size
- <tbody>
- <tr> <td> 1830 <td> <data value="8">Eight</data> <td> <data value="93">19+74 hexes (93 total)</data>
- <tr> <td> 1856 <td> <data value="11">Eleven</data> <td> <data value="99">12+87 hexes (99 total)</data>
- <tr> <td> 1870 <td> <data value="10">Ten</data> <td> <data value="149">4+145 hexes (149 total)</data>
- </table></pre>
- </div>
- <h4 id=the-time-element>4.5.14 The <dfn><code>time</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-time-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-time-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-time-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-time-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-time-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-time-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-time-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-time-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-time-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-time-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-time-element:global-attributes>Global attributes</a><dd><code id=the-time-element:attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> — Machine-readable value<dt><a href=#concept-element-dom id=the-time-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltimeelement>HTMLTimeElement</dfn> : <a href=#htmlelement id=the-time-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-time-datetime id=the-time-element:dom-time-datetime>dateTime</a>;
- };</pre>
- </dl>
- <p>The <code id=the-time-element:the-time-element><a href=#the-time-element>time</a></code> element <a href=#represents id=the-time-element:represents>represents</a> its contents, along with a
- machine-readable form of those contents in the <code id=the-time-element:attr-time-datetime-2><a href=#attr-time-datetime>datetime</a></code>
- attribute. The kind of content is limited to various kinds of dates, times, time-zone offsets, and
- durations, as described below.</p>
- <p>The <dfn id=attr-time-datetime><code>datetime</code></dfn> attribute may be present. If
- present, its value must be a representation of the element's contents in a machine-readable
- format.</p>
- <p>A <code id=the-time-element:the-time-element-2><a href=#the-time-element>time</a></code> element that does not have a <code id=the-time-element:attr-time-datetime-3><a href=#attr-time-datetime>datetime</a></code> content attribute must not have any element
- descendants.</p>
- <p>The <dfn id=datetime-value>datetime value</dfn> of a <code id=the-time-element:the-time-element-3><a href=#the-time-element>time</a></code> element is the value of the element's
- <code id=the-time-element:attr-time-datetime-4><a href=#attr-time-datetime>datetime</a></code> content attribute, if it has one, or the
- element's <code id=the-time-element:textcontent><a href=#textcontent>textContent</a></code>, if it does not.</p>
- <p>The <a href=#datetime-value id=the-time-element:datetime-value>datetime value</a> of a <code id=the-time-element:the-time-element-4><a href=#the-time-element>time</a></code> element must match one of the following
- syntaxes.</p>
- <dl><dt>A <a href=#valid-month-string id=the-time-element:valid-month-string>valid month string</a><dd>
- <pre class=example><time>2011-11</time></pre>
- <dt>A <a href=#valid-date-string id=the-time-element:valid-date-string>valid date string</a><dd>
- <pre class=example><time>2011-11-18</time></pre>
- <dt>A <a href=#valid-yearless-date-string id=the-time-element:valid-yearless-date-string>valid yearless date string</a><dd>
- <pre class=example><time>11-18</time></pre>
- <dt>A <a href=#valid-time-string id=the-time-element:valid-time-string>valid time string</a><dd>
- <pre class=example><time>14:54</time></pre>
- <pre class=example><time>14:54:39</time></pre>
- <pre class=example><time>14:54:39.929</time></pre>
- <dt>A <a href=#valid-local-date-and-time-string id=the-time-element:valid-local-date-and-time-string>valid local date and time string</a><dd>
- <pre class=example><time>2011-11-18T14:54</time></pre>
- <pre class=example><time>2011-11-18T14:54:39</time></pre>
- <pre class=example><time>2011-11-18T14:54:39.929</time></pre>
- <pre class=example><time>2011-11-18 14:54</time></pre>
- <pre class=example><time>2011-11-18 14:54:39</time></pre>
- <pre class=example><time>2011-11-18 14:54:39.929</time></pre>
- <p class=note>Times with dates but without a time zone offset are useful for specifying events
- that are observed at the same specific time in each time zone, throughout a day. For example,
- the 2020 new year is celebrated at 2020-01-01 00:00 in each time zone, not at the same precise
- moment across all time zones. For events that occur at the same time across all time zones, for
- example a videoconference meeting, a <a href=#valid-global-date-and-time-string id=the-time-element:valid-global-date-and-time-string>valid global date and time string</a> is likely
- more useful.</p>
- <dt>A <a href=#valid-time-zone-offset-string id=the-time-element:valid-time-zone-offset-string>valid time-zone offset string</a><dd>
- <pre class=example><time>Z</time></pre>
- <pre class=example><time>+0000</time></pre>
- <pre class=example><time>+00:00</time></pre>
- <pre class=example><time>-0800</time></pre>
- <pre class=example><time>-08:00</time></pre>
- <p class=note>For times without dates (or times referring to events that recur on multiple
- dates), specifying the geographic location that controls the time is usually more useful than
- specifying a time zone offset, because geographic locations change time zone offsets with
- daylight savings time. In some cases, geographic locations even change time zone, e.g. when the
- boundaries of those time zones are redrawn, as happened with Samoa at the end of 2011. There
- exists a time zone database that describes the boundaries of time zones and what rules apply
- within each such zone, known as the <i>time zone database</i>. <a href=#refsTZDATABASE>[TZDATABASE]</a></p>
- <dt>A <a href=#valid-global-date-and-time-string id=the-time-element:valid-global-date-and-time-string-2>valid global date and time string</a><dd>
- <pre class=example><time>2011-11-18T14:54Z</time></pre>
- <pre class=example><time>2011-11-18T14:54:39Z</time></pre>
- <pre class=example><time>2011-11-18T14:54:39.929Z</time></pre>
- <pre class=example><time>2011-11-18T14:54+0000</time></pre>
- <pre class=example><time>2011-11-18T14:54:39+0000</time></pre>
- <pre class=example><time>2011-11-18T14:54:39.929+0000</time></pre>
- <pre class=example><time>2011-11-18T14:54+00:00</time></pre>
- <pre class=example><time>2011-11-18T14:54:39+00:00</time></pre>
- <pre class=example><time>2011-11-18T14:54:39.929+00:00</time></pre>
- <pre class=example><time>2011-11-18T06:54-0800</time></pre>
- <pre class=example><time>2011-11-18T06:54:39-0800</time></pre>
- <pre class=example><time>2011-11-18T06:54:39.929-0800</time></pre>
- <pre class=example><time>2011-11-18T06:54-08:00</time></pre>
- <pre class=example><time>2011-11-18T06:54:39-08:00</time></pre>
- <pre class=example><time>2011-11-18T06:54:39.929-08:00</time></pre>
- <pre class=example><time>2011-11-18 14:54Z</time></pre>
- <pre class=example><time>2011-11-18 14:54:39Z</time></pre>
- <pre class=example><time>2011-11-18 14:54:39.929Z</time></pre>
- <pre class=example><time>2011-11-18 14:54+0000</time></pre>
- <pre class=example><time>2011-11-18 14:54:39+0000</time></pre>
- <pre class=example><time>2011-11-18 14:54:39.929+0000</time></pre>
- <pre class=example><time>2011-11-18 14:54+00:00</time></pre>
- <pre class=example><time>2011-11-18 14:54:39+00:00</time></pre>
- <pre class=example><time>2011-11-18 14:54:39.929+00:00</time></pre>
- <pre class=example><time>2011-11-18 06:54-0800</time></pre>
- <pre class=example><time>2011-11-18 06:54:39-0800</time></pre>
- <pre class=example><time>2011-11-18 06:54:39.929-0800</time></pre>
- <pre class=example><time>2011-11-18 06:54-08:00</time></pre>
- <pre class=example><time>2011-11-18 06:54:39-08:00</time></pre>
- <pre class=example><time>2011-11-18 06:54:39.929-08:00</time></pre>
- <p class=note>Times with dates and a time zone offset are useful for specifying specific
- events, or recurring virtual events where the time is not anchored to a specific geographic
- location. For example, the precise time of an asteroid impact, or a particular meeting in a
- series of meetings held at 1400 UTC every day, regardless of whether any particular part of the
- world is observing daylight savings time or not. For events where the precise time varies by the
- local time zone offset of a specific geographic location, a <a href=#valid-local-date-and-time-string id=the-time-element:valid-local-date-and-time-string-2>valid local date and time
- string</a> combined with that geographic location is likely more useful.</p>
- <dt>A <a href=#valid-week-string id=the-time-element:valid-week-string>valid week string</a><dd>
- <pre class=example><time>2011-W47</time></pre>
- <dt>Four or more <a href=#ascii-digits id=the-time-element:ascii-digits>ASCII digits</a>, at least one of which is not U+0030 DIGIT ZERO (0)<dd>
- <pre class=example><time>2011</time></pre>
- <pre class=example><time>0001</time></pre>
- <dt>A <a href=#valid-duration-string id=the-time-element:valid-duration-string>valid duration string</a><dd>
- <pre class=example><time>PT4H18M3S</time></pre>
- <pre class=example><time>4h 18m 3s</time></pre>
- </dl>
-
- <p>The <dfn id="machine-readable-equivalent-of-the-element's-contents">machine-readable equivalent of the element's contents</dfn> must be obtained from the
- element's <a href=#datetime-value id=the-time-element:datetime-value-2>datetime value</a> by using the following algorithm:</p>
- <ol><li><p>If <a href=#parse-a-month-string id=the-time-element:parse-a-month-string>parsing a month string</a> from the element's
- <a href=#datetime-value id=the-time-element:datetime-value-3>datetime value</a> returns a <a href=#concept-month id=the-time-element:concept-month>month</a>, that is the
- machine-readable equivalent; abort these steps.<li><p>If <a href=#parse-a-date-string id=the-time-element:parse-a-date-string>parsing a date string</a> from the element's
- <a href=#datetime-value id=the-time-element:datetime-value-4>datetime value</a> returns a <a href=#concept-date id=the-time-element:concept-date>date</a>, that is the
- machine-readable equivalent; abort these steps.<li><p>If <a href=#parse-a-yearless-date-string id=the-time-element:parse-a-yearless-date-string>parsing a yearless date string</a> from
- the element's <a href=#datetime-value id=the-time-element:datetime-value-5>datetime value</a> returns a <a href=#concept-yearless-date id=the-time-element:concept-yearless-date>yearless
- date</a>, that is the machine-readable equivalent; abort these steps.<li><p>If <a href=#parse-a-time-string id=the-time-element:parse-a-time-string>parsing a time string</a> from the element's
- <a href=#datetime-value id=the-time-element:datetime-value-6>datetime value</a> returns a <a href=#concept-time id=the-time-element:concept-time>time</a>, that is the
- machine-readable equivalent; abort these steps.<li><p>If <a href=#parse-a-local-date-and-time-string id=the-time-element:parse-a-local-date-and-time-string>parsing a local date and time
- string</a> from the element's <a href=#datetime-value id=the-time-element:datetime-value-7>datetime value</a> returns a <a href=#concept-datetime-local id=the-time-element:concept-datetime-local>local date and time</a>, that is the machine-readable
- equivalent; abort these steps.<li><p>If <a href=#parse-a-time-zone-offset-string id=the-time-element:parse-a-time-zone-offset-string>parsing a time-zone offset string</a>
- from the element's <a href=#datetime-value id=the-time-element:datetime-value-8>datetime value</a> returns a <a href=#concept-timezone id=the-time-element:concept-timezone>time-zone
- offset</a>, that is the machine-readable equivalent; abort these steps.<li><p>If <a href=#parse-a-global-date-and-time-string id=the-time-element:parse-a-global-date-and-time-string>parsing a global date and time
- string</a> from the element's <a href=#datetime-value id=the-time-element:datetime-value-9>datetime value</a> returns a <a href=#concept-datetime id=the-time-element:concept-datetime>global date and time</a>, that is the machine-readable equivalent;
- abort these steps.<li><p>If <a href=#parse-a-week-string id=the-time-element:parse-a-week-string>parsing a week string</a> from the element's
- <a href=#datetime-value id=the-time-element:datetime-value-10>datetime value</a> returns a <a href=#concept-week id=the-time-element:concept-week>week</a>, that is the
- machine-readable equivalent; abort these steps.<li><p>If the element's <a href=#datetime-value id=the-time-element:datetime-value-11>datetime value</a> consists of only <a href=#ascii-digits id=the-time-element:ascii-digits-2>ASCII digits</a>,
- at least one of which is not U+0030 DIGIT ZERO (0), then the machine-readable equivalent is the
- base-ten interpretation of those digits, representing a year; abort these steps.<li><p>If <a href=#parse-a-duration-string id=the-time-element:parse-a-duration-string>parsing a duration string</a> from the
- element's <a href=#datetime-value id=the-time-element:datetime-value-12>datetime value</a> returns a <a href=#concept-duration id=the-time-element:concept-duration>duration</a>,
- that is the machine-readable equivalent; abort these steps.<li><p>There is no machine-readable equivalent.</ol>
- <p class=note>The algorithms referenced above are intended to be designed such that for any
- arbitrary string <var>s</var>, only one of the algorithms returns a value. A more
- efficient approach might be to create a single algorithm that parses all these data types in one
- pass; developing such an algorithm is left as an exercise to the reader.</p>
- <p>The <dfn id=dom-time-datetime><code>dateTime</code></dfn> IDL attribute must
- <a href=#reflect id=the-time-element:reflect>reflect</a> the element's <code id=the-time-element:attr-time-datetime-5><a href=#attr-time-datetime>datetime</a></code> content
- attribute.</p>
-
- <div class=example>
- <p>The <code id=the-time-element:the-time-element-5><a href=#the-time-element>time</a></code> element can be used to encode dates, for example in microformats. The
- following shows a hypothetical way of encoding an event using a variant on hCalendar that uses
- the <code id=the-time-element:the-time-element-6><a href=#the-time-element>time</a></code> element:</p>
- <pre><div class="vevent">
- <a class="url" href="http://www.web2con.com/">http://www.web2con.com/</a>
- <span class="summary">Web 2.0 Conference</span>:
- <time class="dtstart" datetime="2005-10-05">October 5</time> -
- <time class="dtend" datetime="2005-10-07">7</time>,
- at the <span class="location">Argent Hotel, San Francisco, CA</span>
- </div></pre>
- </div>
- <div class=example>
- <p>Here, a fictional microdata vocabulary based on the Atom vocabulary is used with the
- <code id=the-time-element:the-time-element-7><a href=#the-time-element>time</a></code> element to mark up a blog post's publication date.</p>
- <pre><article itemscope itemtype="http://n.example.org/rfc4287">
- <h1 itemprop="title">Big tasks</h1>
- <footer>Published <time itemprop="published" datetime="2009-08-29">two days ago</time>.</footer>
- <p itemprop="content">Today, I went out and bought a bike for my kid.</p>
- </article></pre>
- </div>
- <div class=example>
- <p>In this example, another article's publication date is marked up using <code id=the-time-element:the-time-element-8><a href=#the-time-element>time</a></code>, this
- time using the schema.org microdata vocabulary:</p>
- <pre><article itemscope itemtype="http://schema.org/BlogPosting">
- <h1 itemprop="headline">Small tasks</h1>
- <footer>Published <time itemprop="datePublished" datetime="2009-08-30">yesterday</time>.</footer>
- <p itemprop="articleBody">I put a bike bell on his bike.</p>
- </article></pre>
- </div>
- <div class=example>
- <p>In the following snippet, the <code id=the-time-element:the-time-element-9><a href=#the-time-element>time</a></code> element is used to encode a date in the
- ISO8601 format, for later processing by a script:</p>
- <pre><p>Our first date was <time datetime="2006-09-23">a Saturday</time>.</p></pre>
- <p>In this second snippet, the value includes a time:</p>
- <pre><p>We stopped talking at <time datetime="2006-09-24T05:00-07:00">5am the next morning</time>.</p></pre>
- <p>A script loaded by the page (and thus privy to the page's internal convention of marking up
- dates and times using the <code id=the-time-element:the-time-element-10><a href=#the-time-element>time</a></code> element) could scan through the page and look at all
- the <code id=the-time-element:the-time-element-11><a href=#the-time-element>time</a></code> elements therein to create an index of dates and times.</p>
- </div>
- <div class=example>
- <p>For example, this element conveys the string "Tuesday" with the additional semantic that the
- 18th of November 2011 is the meaning that corresponds to "Tuesday":</p>
- <pre>Today is <time datetime="2011-11-18">Tuesday</time>.</pre>
- </div>
- <div class=example>
- <p>In this example, a specific time in the Pacific Standard Time timezone is specified:</p>
- <pre>Your next meeting is at <time datetime="2011-11-18T15:00-08:00">3pm</time>.</pre>
- </div>
- <h4 id=the-code-element>4.5.15 The <dfn><code>code</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-code-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-code-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-code-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-code-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-code-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-code-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-code-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-code-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-code-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-code-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-code-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-code-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-code-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-code-element:the-code-element><a href=#the-code-element>code</a></code> element <a href=#represents id=the-code-element:represents>represents</a> a fragment of computer code. This could
- be an XML element name, a file name, a computer program, or any other string that a computer would
- recognize.</p>
- <p>There is no formal way to indicate the language of computer code being marked up. Authors who
- wish to mark <code id=the-code-element:the-code-element-2><a href=#the-code-element>code</a></code> elements with the language used, e.g. so that syntax highlighting
- scripts can use the right rules, can use the <code id=the-code-element:classes><a href=#classes>class</a></code> attribute, e.g.
- by adding a class prefixed with "<code>language-</code>" to the element.</p>
- <div class=example>
- <p>The following example shows how the element can be used in a paragraph to mark up element
- names and computer code, including punctuation.</p>
- <pre><p>The <code>code</code> element represents a fragment of computer
- code.</p>
- <p>When you call the <code>activate()</code> method on the
- <code>robotSnowman</code> object, the eyes glow.</p>
- <p>The example below uses the <code>begin</code> keyword to indicate
- the start of a statement block. It is paired with an <code>end</code>
- keyword, which is followed by the <code>.</code> punctuation character
- (full stop) to indicate the end of the program.</p></pre>
- </div>
- <div class=example>
- <p>The following example shows how a block of code could be marked up using the <code id=the-code-element:the-pre-element><a href=#the-pre-element>pre</a></code>
- and <code id=the-code-element:the-code-element-3><a href=#the-code-element>code</a></code> elements.</p>
- <pre><pre><code class="language-pascal">var i: Integer;
- begin
- i := 1;
- end.</code></pre></pre>
- <p>A class is used in that example to indicate the language used.</p>
- </div>
- <p class=note>See the <code id=the-code-element:the-pre-element-2><a href=#the-pre-element>pre</a></code> element for more details.</p>
- <h4 id=the-var-element>4.5.16 The <dfn><code>var</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-var-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-var-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-var-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-var-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-var-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-var-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-var-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-var-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-var-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-var-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-var-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-var-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-var-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-var-element:the-var-element><a href=#the-var-element>var</a></code> element <a href=#represents id=the-var-element:represents>represents</a> a variable. This could be an actual
- variable in a mathematical expression or programming context, an identifier representing a
- constant, a symbol identifying a physical quantity, a function parameter, or just be a term used
- as a placeholder in prose.</p>
- <div class=example>
- <p>In the paragraph below, the letter "n" is being used as a
- variable in prose:</p>
- <pre><p>If there are <var>n</var> pipes leading to the ice
- cream factory then I expect at <em>least</em> <var>n</var>
- flavors of ice cream to be available for purchase!</p></pre>
- </div>
- <p>For mathematics, in particular for anything beyond the simplest of expressions, MathML is more
- appropriate. However, the <code id=the-var-element:the-var-element-2><a href=#the-var-element>var</a></code> element can still be used to refer to specific
- variables that are then mentioned in MathML expressions.</p>
- <div class=example>
- <p>In this example, an equation is shown, with a legend that references the variables in the
- equation. The expression itself is marked up with MathML, but the variables are mentioned in the
- figure's legend using <code id=the-var-element:the-var-element-3><a href=#the-var-element>var</a></code>.</p>
- <pre><figure>
- <math>
- <mi>a</mi>
- <mo>=</mo>
- <msqrt>
- <msup><mi>b</mi><mn>2</mn></msup>
- <mi>+</mi>
- <msup><mi>c</mi><mn>2</mn></msup>
- </msqrt>
- </math>
- <figcaption>
- Using Pythagoras' theorem to solve for the hypotenuse <var>a</var> of
- a triangle with sides <var>b</var> and <var>c</var>
- </figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>Here, the equation describing mass-energy equivalence is used in a sentence, and the
- <code id=the-var-element:the-var-element-4><a href=#the-var-element>var</a></code> element is used to mark the variables and constants in that equation:</p>
- <pre><p>Then he turned to the blackboard and picked up the chalk. After a few moment's
- thought, he wrote <var>E</var> = <var>m</var> <var>c</var><sup>2</sup>. The teacher
- looked pleased.</p></pre>
- </div>
- <h4 id=the-samp-element>4.5.17 The <dfn><code>samp</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-samp-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-samp-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-samp-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-samp-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-samp-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-samp-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-samp-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-samp-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-samp-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-samp-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-samp-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-samp-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-samp-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-samp-element:the-samp-element><a href=#the-samp-element>samp</a></code> element <a href=#represents id=the-samp-element:represents>represents</a> sample or quoted output from another
- program or computing system.</p>
- <p class=note>See the <code id=the-samp-element:the-pre-element><a href=#the-pre-element>pre</a></code> and <code id=the-samp-element:the-kbd-element><a href=#the-kbd-element>kbd</a></code> elements for more details.</p>
- <p class=note>This element can be contrasted with the <code id=the-samp-element:the-output-element><a href=#the-output-element>output</a></code> element, which can be
- used to provide immediate output in a Web application.</p>
- <div class=example>
- <p>This example shows the <code id=the-samp-element:the-samp-element-2><a href=#the-samp-element>samp</a></code> element being used
- inline:</p>
- <pre><p>The computer said <samp>Too much cheese in tray
- two</samp> but I didn't know what that meant.</p></pre>
- </div>
- <div class=example>
- <p>This second example shows a block of sample output. Nested <code id=the-samp-element:the-samp-element-3><a href=#the-samp-element>samp</a></code> and
- <code id=the-samp-element:the-kbd-element-2><a href=#the-kbd-element>kbd</a></code> elements allow for the styling of specific elements of the sample output using a
- style sheet. There's also a few parts of the <code id=the-samp-element:the-samp-element-4><a href=#the-samp-element>samp</a></code> that are annotated with even more
- detailed markup, to enable very precise styling. To achieve this, <code id=the-samp-element:the-span-element><a href=#the-span-element>span</a></code> elements are
- used.</p>
- <pre><pre><samp><span class="prompt">jdoe@mowmow:~$</span> <kbd>ssh demo.example.com</kbd>
- Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1
- Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown
- <span class="prompt">jdoe@demo:~$</span> <span class="cursor">_</span></samp></pre></pre>
- </div>
- <h4 id=the-kbd-element>4.5.18 The <dfn><code>kbd</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-kbd-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-kbd-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-kbd-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-kbd-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-kbd-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-kbd-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-kbd-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-kbd-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-kbd-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-kbd-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-kbd-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-kbd-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-kbd-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-kbd-element:the-kbd-element><a href=#the-kbd-element>kbd</a></code> element <a href=#represents id=the-kbd-element:represents>represents</a> user input (typically keyboard input,
- although it may also be used to represent other input, such as voice commands).</p>
- <p>When the <code id=the-kbd-element:the-kbd-element-2><a href=#the-kbd-element>kbd</a></code> element is nested inside a <code id=the-kbd-element:the-samp-element><a href=#the-samp-element>samp</a></code> element, it represents
- the input as it was echoed by the system.</p>
- <p>When the <code id=the-kbd-element:the-kbd-element-3><a href=#the-kbd-element>kbd</a></code> element <em>contains</em> a <code id=the-kbd-element:the-samp-element-2><a href=#the-samp-element>samp</a></code> element, it represents
- input based on system output, for example invoking a menu item.</p>
- <p>When the <code id=the-kbd-element:the-kbd-element-4><a href=#the-kbd-element>kbd</a></code> element is nested inside another <code id=the-kbd-element:the-kbd-element-5><a href=#the-kbd-element>kbd</a></code> element, it
- represents an actual key or other single unit of input as appropriate for the input mechanism.</p>
- <div class=example>
- <p>Here the <code id=the-kbd-element:the-kbd-element-6><a href=#the-kbd-element>kbd</a></code> element is used to indicate keys to press:</p>
- <pre><p>To make George eat an apple, press <kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd></p></pre>
- <p>In this second example, the user is told to pick a particular menu item. The outer
- <code id=the-kbd-element:the-kbd-element-7><a href=#the-kbd-element>kbd</a></code> element marks up a block of input, with the inner <code id=the-kbd-element:the-kbd-element-8><a href=#the-kbd-element>kbd</a></code> elements
- representing each individual step of the input, and the <code id=the-kbd-element:the-samp-element-3><a href=#the-samp-element>samp</a></code> elements inside them
- indicating that the steps are input based on something being displayed by the system, in this
- case menu labels:</p>
- <pre><p>To make George eat an apple, select
- <kbd><kbd><samp>File</samp></kbd>|<kbd><samp>Eat Apple...</samp></kbd></kbd>
- </p></pre>
- <p>Such precision isn't necessary; the following is equally fine:</p>
- <pre><p>To make George eat an apple, select <kbd>File | Eat Apple...</kbd></p></pre>
- </div>
- <h4 id=the-sub-and-sup-elements>4.5.19 The <dfn id=the-sub-element><code>sub</code></dfn> and <dfn id=the-sup-element><code>sup</code></dfn> elements</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-sub-and-sup-elements:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-sub-and-sup-elements:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-sub-and-sup-elements:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-sub-and-sup-elements:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-sub-and-sup-elements:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-sub-and-sup-elements:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-sub-and-sup-elements:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-sub-and-sup-elements:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-sub-and-sup-elements:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-sub-and-sup-elements:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-sub-and-sup-elements:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-sub-and-sup-elements:concept-element-dom>DOM interface</a>:<dd>Use <code id=the-sub-and-sup-elements:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-sub-and-sup-elements:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sup</a></code> element <a href=#represents id=the-sub-and-sup-elements:represents>represents</a> a superscript and the <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sub</a></code>
- element <a href=#represents id=the-sub-and-sup-elements:represents-2>represents</a> a subscript.</p>
- <p>These elements must be used only to mark up typographical conventions with specific meanings,
- not for typographical presentation for presentation's sake. For example, it would be inappropriate
- for the <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-3><a href=#the-sub-and-sup-elements>sub</a></code> and <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-4><a href=#the-sub-and-sup-elements>sup</a></code> elements to be used in the name of the LaTeX
- document preparation system. In general, authors should use these elements only if the
- <em>absence</em> of those elements would change the meaning of the content.</p>
- <p>In certain languages, superscripts are part of the typographical conventions for some
- abbreviations.</p>
- <div class=example>
- <pre><p>The most beautiful women are
- <span lang="fr"><abbr>M<sup>lle</sup></abbr> Gwendoline</span> and
- <span lang="fr"><abbr>M<sup>me</sup></abbr> Denise</span>.</p></pre>
- </div>
- <p>The <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-5><a href=#the-sub-and-sup-elements>sub</a></code> element can be used inside a <code id=the-sub-and-sup-elements:the-var-element><a href=#the-var-element>var</a></code> element, for variables that
- have subscripts.</p>
- <div class=example>
- <p>Here, the <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-6><a href=#the-sub-and-sup-elements>sub</a></code> element is used to represent the subscript that identifies the
- variable in a family of variables:</p>
- <pre><p>The coordinate of the <var>i</var>th point is
- (<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>).
- For example, the 10th point has coordinate
- (<var>x<sub>10</sub></var>, <var>y<sub>10</sub></var>).</p></pre>
- </div>
- <p>Mathematical expressions often use subscripts and superscripts. Authors are encouraged to use
- MathML for marking up mathematics, but authors may opt to use <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-7><a href=#the-sub-and-sup-elements>sub</a></code> and
- <code id=the-sub-and-sup-elements:the-sub-and-sup-elements-8><a href=#the-sub-and-sup-elements>sup</a></code> if detailed mathematical markup is not desired. <a href=#refsMATHML>[MATHML]</a></p>
- <div class=example>
- <pre><var>E</var>=<var>m</var><var>c</var><sup>2</sup></pre>
- <pre>f(<var>x</var>, <var>n</var>) = log<sub>4</sub><var>x</var><sup><var>n</var></sup></pre>
- </div>
- <h4 id=the-i-element>4.5.20 The <dfn><code>i</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-i-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-i-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-i-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-i-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-i-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-i-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-i-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-i-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-i-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-i-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-i-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-i-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-i-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-i-element:the-i-element><a href=#the-i-element>i</a></code> element <a href=#represents id=the-i-element:represents>represents</a> a span of text in an alternate voice or
- mood, or otherwise offset from the normal prose in a manner indicating a different quality of
- text, such as a taxonomic designation, a technical term, an idiomatic phrase from another
- language, transliteration, a thought, or a ship name in Western texts.</p>
- <p>Terms in languages different from the main text should be annotated with <code id=the-i-element:attr-lang><a href=#attr-lang>lang</a></code> attributes (or, in XML, <a href=#attr-xml-lang id=the-i-element:attr-xml-lang><code>lang</code> attributes in the <span>XML namespace</span></a>).</p>
- <div class=example>
- <p>The examples below show uses of the <code id=the-i-element:the-i-element-2><a href=#the-i-element>i</a></code> element:</p>
- <pre><p>The <i class="taxonomy">Felis silvestris catus</i> is cute.</p>
- <p>The term <i>prose content</i> is defined above.</p>
- <p>There is a certain <i lang="fr">je ne sais quoi</i> in the air.</p></pre>
- <p>In the following example, a dream sequence is marked up using
- <code id=the-i-element:the-i-element-3><a href=#the-i-element>i</a></code> elements.</p>
- <pre><p>Raymond tried to sleep.</p>
- <p><i>The ship sailed away on Thursday</i>, he
- dreamt. <i>The ship had many people aboard, including a beautiful
- princess called Carey. He watched her, day-in, day-out, hoping she
- would notice him, but she never did.</i></p>
- <p><i>Finally one night he picked up the courage to speak with
- her—</i></p>
- <p>Raymond woke with a start as the fire alarm rang out.</p></pre>
- </div>
- <p>Authors can use the <code id=the-i-element:classes><a href=#classes>class</a></code> attribute on the <code id=the-i-element:the-i-element-4><a href=#the-i-element>i</a></code>
- element to identify why the element is being used, so that if the style of a particular use (e.g.
- dream sequences as opposed to taxonomic terms) is to be changed at a later date, the author
- doesn't have to go through the entire document (or series of related documents) annotating each
- use.</p>
- <p>Authors are encouraged to consider whether other elements might be more applicable than the
- <code id=the-i-element:the-i-element-5><a href=#the-i-element>i</a></code> element, for instance the <code id=the-i-element:the-em-element><a href=#the-em-element>em</a></code> element for marking up stress emphasis,
- or the <code id=the-i-element:the-dfn-element><a href=#the-dfn-element>dfn</a></code> element to mark up the defining instance of a term.</p>
- <p class=note>Style sheets can be used to format <code id=the-i-element:the-i-element-6><a href=#the-i-element>i</a></code> elements, just like any other
- element can be restyled. Thus, it is not the case that content in <code id=the-i-element:the-i-element-7><a href=#the-i-element>i</a></code> elements will
- necessarily be italicized.</p>
- <h4 id=the-b-element>4.5.21 The <dfn><code>b</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-b-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-b-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-b-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-b-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-b-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-b-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-b-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-b-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-b-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-b-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-b-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-b-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-b-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-b-element:the-b-element><a href=#the-b-element>b</a></code> element <a href=#represents id=the-b-element:represents>represents</a> a span of text to which attention is being
- drawn for utilitarian purposes without conveying any extra importance and with no implication of
- an alternate voice or mood, such as key words in a document abstract, product names in a review,
- actionable words in interactive text-driven software, or an article lede.</p>
- <div class=example>
- <p>The following example shows a use of the <code id=the-b-element:the-b-element-2><a href=#the-b-element>b</a></code> element to highlight key words without
- marking them up as important:</p>
- <pre><p>The <b>frobonitor</b> and <b>barbinator</b> components are fried.</p></pre>
- </div>
- <div class=example>
- <p>In the following example, objects in a text adventure are highlighted as being special by use
- of the <code id=the-b-element:the-b-element-3><a href=#the-b-element>b</a></code> element.</p>
- <pre><p>You enter a small room. Your <b>sword</b> glows
- brighter. A <b>rat</b> scurries past the corner wall.</p></pre>
- </div>
- <div class=example>
- <p>Another case where the <code id=the-b-element:the-b-element-4><a href=#the-b-element>b</a></code> element is appropriate is in marking up the lede (or
- lead) sentence or paragraph. The following example shows how a <a href=http://news.bbc.co.uk/2/hi/uk_news/scotland/north_east/7101506.stm>BBC article about
- kittens adopting a rabbit as their own</a> could be marked up:</p>
- <pre><article>
- <h2>Kittens 'adopted' by pet rabbit</h2>
- <p><b class="lede">Six abandoned kittens have found an
- unexpected new mother figure — a pet rabbit.</b></p>
- <p>Veterinary nurse Melanie Humble took the three-week-old
- kittens to her Aberdeen home.</p>
- <i>[...]</i></pre>
- </div>
- <p>As with the <code id=the-b-element:the-i-element><a href=#the-i-element>i</a></code> element, authors can use the <code id=the-b-element:classes><a href=#classes>class</a></code>
- attribute on the <code id=the-b-element:the-b-element-5><a href=#the-b-element>b</a></code> element to identify why the element is being used, so that if the
- style of a particular use is to be changed at a later date, the author doesn't have to go through
- annotating each use.</p>
- <p>The <code id=the-b-element:the-b-element-6><a href=#the-b-element>b</a></code> element should be used as a last resort when no other element is more
- appropriate. In particular, headings should use the <code id=the-b-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> to <code id=the-b-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements,
- stress emphasis should use the <code id=the-b-element:the-em-element><a href=#the-em-element>em</a></code> element, importance should be denoted with the
- <code id=the-b-element:the-strong-element><a href=#the-strong-element>strong</a></code> element, and text marked or highlighted should use the <code id=the-b-element:the-mark-element><a href=#the-mark-element>mark</a></code>
- element.</p>
- <div class=example>
- <p>The following would be <em>incorrect</em> usage:</p>
- <pre class=bad><p><b>WARNING!</b> Do not frob the barbinator!</p></pre>
- <p>In the previous example, the correct element to use would have been <code id=the-b-element:the-strong-element-2><a href=#the-strong-element>strong</a></code>, not
- <code id=the-b-element:the-b-element-7><a href=#the-b-element>b</a></code>.</p>
- </div>
- <p class=note>Style sheets can be used to format <code id=the-b-element:the-b-element-8><a href=#the-b-element>b</a></code> elements, just like any other
- element can be restyled. Thus, it is not the case that content in <code id=the-b-element:the-b-element-9><a href=#the-b-element>b</a></code> elements will
- necessarily be boldened.</p>
- <h4 id=the-u-element>4.5.22 The <dfn><code>u</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-u-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-u-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-u-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-u-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-u-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-u-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-u-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-u-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-u-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-u-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-u-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-u-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-u-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-u-element:the-u-element><a href=#the-u-element>u</a></code> element <a href=#represents id=the-u-element:represents>represents</a> a span of text with an unarticulated, though
- explicitly rendered, non-textual annotation, such as labeling the text as being a proper name in
- Chinese text (a Chinese proper name mark), or labeling the text as being misspelt.</p>
- <p>In most cases, another element is likely to be more appropriate: for marking stress emphasis,
- the <code id=the-u-element:the-em-element><a href=#the-em-element>em</a></code> element should be used; for marking key words or phrases either the
- <code id=the-u-element:the-b-element><a href=#the-b-element>b</a></code> element or the <code id=the-u-element:the-mark-element><a href=#the-mark-element>mark</a></code> element should be used, depending on the context;
- for marking book titles, the <code id=the-u-element:the-cite-element><a href=#the-cite-element>cite</a></code> element should be used; for labeling text with explicit textual annotations, the
- <code id=the-u-element:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element should be used; for labeling ship names in Western texts, the
- <code id=the-u-element:the-i-element><a href=#the-i-element>i</a></code> element should be used.</p>
- <p class=note>The default rendering of the <code id=the-u-element:the-u-element-2><a href=#the-u-element>u</a></code> element in visual presentations
- clashes with the conventional rendering of hyperlinks (underlining). Authors are encouraged to
- avoid using the <code id=the-u-element:the-u-element-3><a href=#the-u-element>u</a></code> element where it could be confused for a hyperlink.</p>
- <h4 id=the-mark-element>4.5.23 The <dfn><code>mark</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-mark-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-mark-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-mark-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-mark-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-mark-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-mark-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-mark-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-mark-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-mark-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-mark-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-mark-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-mark-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-mark-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
-
- <p>The <code id=the-mark-element:the-mark-element><a href=#the-mark-element>mark</a></code> element <a href=#represents id=the-mark-element:represents>represents</a> a run of text in one document marked or
- highlighted for reference purposes, due to its relevance in another context. When used in a
- quotation or other block of text referred to from the prose, it indicates a highlight that was not
- originally present but which has been added to bring the reader's attention to a part of the text
- that might not have been considered important by the original author when the block was originally
- written, but which is now under previously unexpected scrutiny. When used in the main prose of a
- document, it indicates a part of the document that has been highlighted due to its likely
- relevance to the user's current activity.</p>
- <div class=example>
- <p>This example shows how the <code id=the-mark-element:the-mark-element-2><a href=#the-mark-element>mark</a></code> element can be used to bring attention to a
- particular part of a quotation:</p>
- <pre><p lang="en-US">Consider the following quote:</p>
- <blockquote lang="en-GB">
- <p>Look around and you will find, no-one's really
- <mark>colour</mark> blind.</p>
- </blockquote>
- <p lang="en-US">As we can tell from the <em>spelling</em> of the word,
- the person writing this quote is clearly not American.</p></pre>
- <p>(If the goal was to mark the element as misspelt, however, the <code id=the-mark-element:the-u-element><a href=#the-u-element>u</a></code> element,
- possibly with a class, would be more appropriate.)</p>
- </div>
- <div class=example>
- <p>Another example of the <code id=the-mark-element:the-mark-element-3><a href=#the-mark-element>mark</a></code> element is highlighting parts of a document that are
- matching some search string. If someone looked at a document, and the server knew that the user
- was searching for the word "kitten", then the server might return the document with one paragraph
- modified as follows:</p>
- <pre><p>I also have some <mark>kitten</mark>s who are visiting me
- these days. They're really cute. I think they like my garden! Maybe I
- should adopt a <mark>kitten</mark>.</p></pre>
- </div>
- <div class=example>
- <p>In the following snippet, a paragraph of text refers to a specific part of a code
- fragment.</p>
- <pre><p>The highlighted part below is where the error lies:</p>
- <pre><code>var i: Integer;
- begin
- i := <mark>1.1</mark>;
- end.</code></pre></pre>
- <p>This is separate from <em>syntax highlighting</em>, for which <code id=the-mark-element:the-span-element><a href=#the-span-element>span</a></code> is more
- appropriate. Combining both, one would get:</p>
- <pre><p>The highlighted part below is where the error lies:</p>
- <pre><code><span class=keyword>var</span> <span class=ident>i</span>: <span class=type>Integer</span>;
- <span class=keyword>begin</span>
- <span class=ident>i</span> := <span class=literal><mark>1.1</mark></span>;
- <span class=keyword>end</span>.</code></pre></pre>
- </div>
- <div class=example>
- <p>This is another example showing the use of <code id=the-mark-element:the-mark-element-4><a href=#the-mark-element>mark</a></code> to highlight a part of quoted
- text that was originally not emphasized. In this example, common typographic conventions have led
- the author to explicitly style <code id=the-mark-element:the-mark-element-5><a href=#the-mark-element>mark</a></code> elements in quotes to render in italics.</p>
- <pre><article>
- <style scoped>
- blockquote mark, q mark {
- font: inherit; font-style: italic;
- text-decoration: none;
- background: transparent; color: inherit;
- }
- .bubble em {
- font: inherit; font-size: larger;
- text-decoration: underline;
- }
- </style>
- <h1>She knew</h1>
- <p>Did you notice the subtle joke in the joke on panel 4?</p>
- <blockquote>
- <p class="bubble">I didn't <em>want</em> to believe. <mark>Of course
- on some level I realised it was a known-plaintext attack.</mark> But I
- couldn't admit it until I saw for myself.</p>
- </blockquote>
- <p>(Emphasis mine.) I thought that was great. It's so pedantic, yet it
- explains everything neatly.</p>
- </article></pre>
- <p>Note, incidentally, the distinction between the <code id=the-mark-element:the-em-element><a href=#the-em-element>em</a></code> element in this example, which
- is part of the original text being quoted, and the <code id=the-mark-element:the-mark-element-6><a href=#the-mark-element>mark</a></code> element, which is
- highlighting a part for comment.</p>
- </div>
- <div class=example>
- <p>The following example shows the difference between denoting the <em>importance</em> of a span
- of text (<code id=the-mark-element:the-strong-element><a href=#the-strong-element>strong</a></code>) as opposed to denoting the <em>relevance</em> of a span of text
- (<code id=the-mark-element:the-mark-element-7><a href=#the-mark-element>mark</a></code>). It is an extract from a textbook, where the extract has had the parts
- relevant to the exam highlighted. The safety warnings, important though they may be, are
- apparently not relevant to the exam.</p>
- <pre><h3>Wormhole Physics Introduction</h3>
- <p><mark>A wormhole in normal conditions can be held open for a
- maximum of just under 39 minutes.</mark> Conditions that can increase
- the time include a powerful energy source coupled to one or both of
- the gates connecting the wormhole, and a large gravity well (such as a
- black hole).</p>
- <p><mark>Momentum is preserved across the wormhole. Electromagnetic
- radiation can travel in both directions through a wormhole,
- but matter cannot.</mark></p>
- <p>When a wormhole is created, a vortex normally forms.
- <strong>Warning: The vortex caused by the wormhole opening will
- annihilate anything in its path.</strong> Vortexes can be avoided when
- using sufficiently advanced dialing technology.</p>
- <p><mark>An obstruction in a gate will prevent it from accepting a
- wormhole connection.</mark></p></pre>
- </div>
- <h4 id=the-bdi-element>4.5.24 The <dfn><code>bdi</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-bdi-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-bdi-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-bdi-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-bdi-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-bdi-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-bdi-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-bdi-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-bdi-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-bdi-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-bdi-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-bdi-element:global-attributes>Global attributes</a><dd>Also, the <code id=the-bdi-element:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.<dt><a href=#concept-element-dom id=the-bdi-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-bdi-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-bdi-element:the-bdi-element><a href=#the-bdi-element>bdi</a></code> element <a href=#represents id=the-bdi-element:represents>represents</a> a span of text that is to be isolated from
- its surroundings for the purposes of bidirectional text formatting. <a href=#refsBIDI>[BIDI]</a></p>
- <p class=note>The <code id=the-bdi-element:the-dir-attribute-2><a href=#the-dir-attribute>dir</a></code> global attribute defaults to <code id=the-bdi-element:attr-dir-auto><a href=#attr-dir-auto>auto</a></code> on this element (it never inherits from the parent element like
- with other elements).</p>
-
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <div class=example>
- <p>This element is especially useful when embedding user-generated content with an unknown
- directionality.</p>
- <p>In this example, usernames are shown along with the number of posts that the user has
- submitted. If the <code id=the-bdi-element:the-bdi-element-2><a href=#the-bdi-element>bdi</a></code> element were not used, the username of the Arabic user would
- end up confusing the text (the bidirectional algorithm would put the colon and the number "3"
- next to the word "User" rather than next to the word "posts").</p>
- <pre><ul>
- <li>User <bdi>jcranmer</bdi>: 12 posts.
- <li>User <bdi>hober</bdi>: 5 posts.
- <li>User <bdi><bdo dir=rtl>إيان</bdo></bdi>: 3 posts.
- </ul></pre>
- <figure>
- <img src=http://images.whatwg.org/sample-bdi.png>
- <figcaption>When using the <code id=the-bdi-element:the-bdi-element-3><a href=#the-bdi-element>bdi</a></code> element, the username acts as expected.</figcaption>
- </figure>
- <figure>
- <img src=http://images.whatwg.org/sample-not-bdi.png>
- <figcaption>If the <code id=the-bdi-element:the-bdi-element-4><a href=#the-bdi-element>bdi</a></code> element were to be replaced by a <code id=the-bdi-element:the-b-element><a href=#the-b-element>b</a></code> element, the username would confuse the bidirectional algorithm and the third bullet would end up saying "User 3 :", followed by the Arabic name (right-to-left), followed by "posts" and a period.</figcaption>
- </figure>
- </div>
- <h4 id=the-bdo-element>4.5.25 The <dfn><code>bdo</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-bdo-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-bdo-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-bdo-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-bdo-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-bdo-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-bdo-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-bdo-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-bdo-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-bdo-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-bdo-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-bdo-element:global-attributes>Global attributes</a><dd>Also, the <code id=the-bdo-element:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> global attribute has special semantics on this element.<dt><a href=#concept-element-dom id=the-bdo-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-bdo-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-bdo-element:the-bdo-element><a href=#the-bdo-element>bdo</a></code> element <a href=#represents id=the-bdo-element:represents>represents</a> explicit text directionality formatting
- control for its children. It allows authors to override the Unicode bidirectional algorithm by
- explicitly specifying a direction override. <a href=#refsBIDI>[BIDI]</a></p>
- <p>Authors must specify the <code id=the-bdo-element:the-dir-attribute-2><a href=#the-dir-attribute>dir</a></code> attribute on this element, with the
- value <code id=the-bdo-element:attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code> to specify a left-to-right override and with the value <code id=the-bdo-element:attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code> to
- specify a right-to-left override. The <code id=the-bdo-element:attr-dir-auto><a href=#attr-dir-auto>auto</a></code> value must not be specified.</p>
-
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <h4 id=the-span-element>4.5.26 The <dfn><code>span</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-span-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-span-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-span-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-span-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-span-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-span-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-span-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-span-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-span-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-span-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-span-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-span-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlspanelement>HTMLSpanElement</dfn> : <a href=#htmlelement id=the-span-element:htmlelement>HTMLElement</a> {};</pre>
- </dl>
- <p>The <code id=the-span-element:the-span-element><a href=#the-span-element>span</a></code> element doesn't mean anything on its own, but can be useful when used
- together with the <a href=#global-attributes id=the-span-element:global-attributes-2>global attributes</a>, e.g. <code id=the-span-element:classes><a href=#classes>class</a></code>,
- <code id=the-span-element:attr-lang><a href=#attr-lang>lang</a></code>, or <code id=the-span-element:the-dir-attribute><a href=#the-dir-attribute>dir</a></code>. It
- <a href=#represents id=the-span-element:represents>represents</a> its children.</p>
- <div class=example>
- <p>In this example, a code fragment is marked up using <code id=the-span-element:the-span-element-2><a href=#the-span-element>span</a></code> elements and <code id=the-span-element:classes-2><a href=#classes>class</a></code> attributes so that its keywords and identifiers can be
- colour-coded from CSS:</p>
-
- <pre><pre><code class="lang-c"><span class="keyword">for</span> (<span class="ident">j</span> = 0; <span class="ident">j</span> &lt; 256; <span class="ident">j</span>++) {
- <span class="ident">i_t3</span> = (<span class="ident">i_t3</span> & 0x1ffff) | (<span class="ident">j</span> &lt;&lt; 17);
- <span class="ident">i_t6</span> = (((((((<span class="ident">i_t3</span> >> 3) ^ <span class="ident">i_t3</span>) >> 1) ^ <span class="ident">i_t3</span>) >> 8) ^ <span class="ident">i_t3</span>) >> 5) & 0xff;
- <span class="keyword">if</span> (<span class="ident">i_t6</span> == <span class="ident">i_t1</span>)
- <span class="keyword">break</span>;
- }</code></pre></pre>
- </div>
- <h4 id=the-br-element>4.5.27 The <dfn><code>br</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-br-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-br-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-br-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-br-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-br-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-br-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-br-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-br-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-br-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-br-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-br-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-br-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlbrelement>HTMLBRElement</dfn> : <a href=#htmlelement id=the-br-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLBRElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-br-element:the-br-element><a href=#the-br-element>br</a></code> element <a href=#represents id=the-br-element:represents>represents</a> a line break.</p>
- <p class=note>While line breaks are usually represented in visual media by physically moving
- subsequent text to a new line, a style sheet or user agent would be equally justified in causing
- line breaks to be rendered in a different manner, for instance as green dots, or as extra
- spacing.</p>
- <p><code id=the-br-element:the-br-element-2><a href=#the-br-element>br</a></code> elements must be used only for line breaks that are actually part of the
- content, as in poems or addresses.</p>
- <div class=example>
- <p>The following example is correct usage of the <code id=the-br-element:the-br-element-3><a href=#the-br-element>br</a></code> element:</p>
- <pre><p>P. Sherman<br>
- 42 Wallaby Way<br>
- Sydney</p></pre>
- </div>
- <p><code id=the-br-element:the-br-element-4><a href=#the-br-element>br</a></code> elements must not be used for separating thematic groups in a paragraph.</p>
- <div class=example>
- <p>The following examples are non-conforming, as they abuse the <code id=the-br-element:the-br-element-5><a href=#the-br-element>br</a></code> element:</p>
- <pre><p><a ...>34 comments.</a><br>
- <a ...>Add a comment.</a></p></pre>
- <pre><p><label>Name: <input name="name"></label><br>
- <label>Address: <input name="address"></label></p></pre>
- <p>Here are alternatives to the above, which are correct:</p>
- <pre><p><a ...>34 comments.</a></p>
- <p><a ...>Add a comment.</a></p></pre>
- <pre><p><label>Name: <input name="name"></label></p>
- <p><label>Address: <input name="address"></label></p></pre>
- </div>
- <p>If a <a href=#paragraph id=the-br-element:paragraph>paragraph</a> consists of nothing but a single <code id=the-br-element:the-br-element-6><a href=#the-br-element>br</a></code> element, it
- represents a placeholder blank line (e.g. as in a template). Such blank lines must not be used for
- presentation purposes.</p>
-
- <p>Any content inside <code id=the-br-element:the-br-element-7><a href=#the-br-element>br</a></code> elements must not be considered part of the surrounding
- text.</p>
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <h4 id=the-wbr-element>4.5.28 The <dfn><code>wbr</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-wbr-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-wbr-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-wbr-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-wbr-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-wbr-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-wbr-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-wbr-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-wbr-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-wbr-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-wbr-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-wbr-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-wbr-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-wbr-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-wbr-element:the-wbr-element><a href=#the-wbr-element>wbr</a></code> element <a href=#represents id=the-wbr-element:represents>represents</a> a line break opportunity.</p>
- <div class=example>
- <p>In the following example, someone is quoted as saying something which, for effect, is written
- as one long word. However, to ensure that the text can be wrapped in a readable fashion, the
- individual words in the quote are separated using a <code id=the-wbr-element:the-wbr-element-2><a href=#the-wbr-element>wbr</a></code> element.</p>
- <pre><p>So then he pointed at the tiger and screamed
- "there<wbr>is<wbr>no<wbr>way<wbr>you<wbr>are<wbr>ever<wbr>going<wbr>to<wbr>catch<wbr>me"!</p></pre>
- </div>
- <div class=example>
- <p>Here, especially long lines of code in a program listing have suggested wrapping points given
- using <code id=the-wbr-element:the-wbr-element-3><a href=#the-wbr-element>wbr</a></code> elements.</p>
- <pre><pre>...
- Heading heading = Helm.HeadingFactory(HeadingCoordinates[1], <wbr>HeadingCoordinates[2], <wbr>HeadingCoordinates[3], <wbr>HeadingCoordinates[4]);
- Course course = Helm.CourseFactory(Heading, <wbr>Maps.MapFactoryFromHeading(heading), <wbr>Speeds.GetMaximumSpeed().ConvertToWarp());
- ...</pre></pre>
- </div>
-
- <p>Any content inside <code id=the-wbr-element:the-wbr-element-4><a href=#the-wbr-element>wbr</a></code> elements must not be considered part of the surrounding
- text.</p>
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <h4 id=usage-summary>4.5.29 Usage summary</h4>
- <p><i>This section is non-normative.</i></p>
- <table><thead><tr><th>Element
- <th>Purpose
- <th>Example
- <tbody><tr><td><code id=usage-summary:the-a-element><a href=#the-a-element>a</a></code>
- <td>Hyperlinks
- <td><pre class=example>Visit my <strong><a href="drinks.html">drinks</a></strong> page.</pre>
- <tr><td><code id=usage-summary:the-em-element><a href=#the-em-element>em</a></code>
- <td>Stress emphasis
- <td><pre class=example>I must say I <strong><em>adore</em></strong> lemonade.</pre>
- <tr><td><code id=usage-summary:the-strong-element><a href=#the-strong-element>strong</a></code>
- <td>Importance
- <td><pre class=example>This tea is <strong><strong>very hot</strong></strong>.</pre>
- <tr><td><code id=usage-summary:the-small-element><a href=#the-small-element>small</a></code>
- <td>Side comments
- <td><pre class=example>These grapes are made into wine. <strong><small>Alcohol is addictive.</small></strong></pre>
- <tr><td><code id=usage-summary:the-s-element><a href=#the-s-element>s</a></code>
- <td>Inaccurate text
- <td><pre class=example>Price: <strong><s>£4.50</s></strong> £2.00!</pre>
- <tr><td><code id=usage-summary:the-cite-element><a href=#the-cite-element>cite</a></code>
- <td>Titles of works
- <td><pre class=example>The case <strong><cite>Hugo v. Danielle</cite></strong> is relevant here.</pre>
- <tr><td><code id=usage-summary:the-q-element><a href=#the-q-element>q</a></code>
- <td>Quotations
- <td><pre class=example>The judge said <strong><q>You can drink water from the fish tank</q></strong> but advised against it.</pre>
- <tr><td><code id=usage-summary:the-dfn-element><a href=#the-dfn-element>dfn</a></code>
- <td>Defining instance
- <td><pre class=example>The term <strong><dfn>organic food</dfn></strong> refers to food produced without synthetic chemicals.</pre>
- <tr><td><code id=usage-summary:the-abbr-element><a href=#the-abbr-element>abbr</a></code>
- <td>Abbreviations
- <td><pre class=example>Organic food in Ireland is certified by the <strong><abbr title="Irish Organic Farmers and Growers Association">IOFGA</abbr></strong>.</pre>
- <tr><td><code id=usage-summary:the-ruby-element><a href=#the-ruby-element>ruby</a></code>, <code id=usage-summary:the-rt-element><a href=#the-rt-element>rt</a></code>, <code id=usage-summary:the-rp-element><a href=#the-rp-element>rp</a></code>
- <td>Ruby annotations
- <td><pre class=example><strong><ruby> OJ <rp>(<rt>Orange Juice<rp>)</ruby></strong></pre>
- <tr><td><code id=usage-summary:the-data-element><a href=#the-data-element>data</a></code>
- <td>Machine-readable equivalent
- <td><pre class=example>Available starting today! <strong><data value="UPC:022014640201">North Coast Organic Apple Cider</data></strong></pre>
- <tr><td><code id=usage-summary:the-time-element><a href=#the-time-element>time</a></code>
- <td>Machine-readable equivalent of date- or time-related data
- <td><pre class=example>Available starting on <strong><time datetime="2011-11-12">November 12th</time></strong>!</pre>
- <tr><td><code id=usage-summary:the-code-element><a href=#the-code-element>code</a></code>
- <td>Computer code
- <td><pre class=example>The <strong><code>fruitdb</code></strong> program can be used for tracking fruit production.</pre>
- <tr><td><code id=usage-summary:the-var-element><a href=#the-var-element>var</a></code>
- <td>Variables
- <td><pre class=example>If there are <strong><var>n</var></strong> fruit in the bowl, at least <strong><var>n</var></strong>÷2 will be ripe.</pre>
- <tr><td><code id=usage-summary:the-samp-element><a href=#the-samp-element>samp</a></code>
- <td>Computer output
- <td><pre class=example>The computer said <strong><samp>Unknown error -3</samp></strong>.</pre>
- <tr><td><code id=usage-summary:the-kbd-element><a href=#the-kbd-element>kbd</a></code>
- <td>User input
- <td><pre class=example>Hit <strong><kbd>F1</kbd></strong> to continue.</pre>
- <tr><td><code id=usage-summary:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>
- <td>Subscripts
- <td><pre class=example>Water is H<strong><sub>2</sub></strong>O.</pre>
- <tr><td><code id=usage-summary:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>
- <td>Superscripts
- <td><pre class=example>The Hydrogen in heavy water is usually <strong><sup>2</sup></strong>H.</pre>
- <tr><td><code id=usage-summary:the-i-element><a href=#the-i-element>i</a></code>
- <td>Alternative voice
- <td><pre class=example>Lemonade consists primarily of <strong><i>Citrus limon</i></strong>.</pre>
- <tr><td><code id=usage-summary:the-b-element><a href=#the-b-element>b</a></code>
- <td>Keywords
- <td><pre class=example>Take a <strong><b>lemon</b></strong> and squeeze it with a <strong><b>juicer</b></strong>.</pre>
- <tr><td><code id=usage-summary:the-u-element><a href=#the-u-element>u</a></code>
- <td>Annotations
- <td><pre class=example>The mixture of apple juice and <strong><u class="spelling">eldeflower</u></strong> juice is very pleasant.</pre>
- <tr><td><code id=usage-summary:the-mark-element><a href=#the-mark-element>mark</a></code>
- <td>Highlight
- <td><pre class=example>Elderflower cordial, with one <strong><mark>part</mark></strong> cordial to ten <strong><mark>part</mark></strong>s water, stands a<strong><mark>part</mark></strong> from the rest.</pre>
- <tr><td><code id=usage-summary:the-bdi-element><a href=#the-bdi-element>bdi</a></code>
- <td>Text directionality isolation
- <td><pre class=example>The recommended restaurant is <strong><bdi lang="">My Juice Café (At The Beach)</bdi></strong>.</pre>
- <tr><td><code id=usage-summary:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
- <td>Text directionality formatting
- <td><pre class=example>The proposal is to write English, but in reverse order. "Juice" would become "<strong><bdo dir=rtl>Juice</bdo></strong>"</pre>
- <tr><td><code id=usage-summary:the-span-element><a href=#the-span-element>span</a></code>
- <td>Other
- <td><pre class=example>In French we call it <strong><span lang="fr">sirop de sureau</span></strong>.</pre>
- <tr><td><code id=usage-summary:the-br-element><a href=#the-br-element>br</a></code>
- <td>Line break
- <td><pre class=example>Simply Orange Juice Company<strong><br></strong>Apopka, FL 32703<strong><br></strong>U.S.A.</pre>
- <tr><td><code id=usage-summary:the-wbr-element><a href=#the-wbr-element>wbr</a></code>
- <td>Line breaking opportunity
- <td><pre class=example>www.simply<strong><wbr></strong>orange<strong><wbr></strong>juice.com</pre>
- </table>
- <h3 id=links>4.6 Links</h3>
- <h4 id=introduction-2>4.6.1 Introduction</h4>
- <p>Links are a conceptual construct, created by <code id=introduction-2:the-a-element><a href=#the-a-element>a</a></code>, <code id=introduction-2:the-area-element><a href=#the-area-element>area</a></code>, and
- <code id=introduction-2:the-link-element><a href=#the-link-element>link</a></code> elements, that <a href=#represents id=introduction-2:represents>represent</a> a connection between
- two resources, one of which is the current <code id=introduction-2:document><a href=#document>Document</a></code>. There are two kinds of links in
- HTML:</p>
- <dl><dt><dfn id=external-resource-link>Links to external resources</dfn><dd><p>These are links to resources that are to be used to augment the current document,
- generally automatically processed by the user agent.<dt><dfn id=hyperlink>Hyperlinks</dfn><dd><p>These are links to other resources that are generally exposed to the user by the user
- agent so that the user can cause the user agent to <a href=#navigate id=introduction-2:navigate>navigate</a> to those resources, e.g.
- to visit them in a browser or download them.</dl>
- <p>For <code id=introduction-2:the-link-element-2><a href=#the-link-element>link</a></code> elements with an <code id=introduction-2:attr-link-href><a href=#attr-link-href>href</a></code> attribute and a
- <code id=introduction-2:attr-link-rel><a href=#attr-link-rel>rel</a></code> attribute, links must be created for the keywords of the
- <code id=introduction-2:attr-link-rel-2><a href=#attr-link-rel>rel</a></code> attribute, as defined for those keywords in the <a href=#linkTypes>link types</a> section.</p>
- <p>Similarly, for <code id=introduction-2:the-a-element-2><a href=#the-a-element>a</a></code> and <code id=introduction-2:the-area-element-2><a href=#the-area-element>area</a></code> elements with an <code id=introduction-2:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute and a <code id=introduction-2:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute, links must be created for the keywords of the
- <code id=introduction-2:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>rel</a></code> attribute as defined for those keywords in the <a href=#linkTypes>link types</a> section. Unlike <code id=introduction-2:the-link-element-3><a href=#the-link-element>link</a></code> elements, however,
- <code id=introduction-2:the-a-element-3><a href=#the-a-element>a</a></code> and <code id=introduction-2:the-area-element-3><a href=#the-area-element>area</a></code> element with an <code id=introduction-2:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code>
- attribute that either do not have a <code id=introduction-2:attr-hyperlink-rel-3><a href=#attr-hyperlink-rel>rel</a></code> attribute, or
- whose <code id=introduction-2:attr-hyperlink-rel-4><a href=#attr-hyperlink-rel>rel</a></code> attribute has no keywords that are defined as
- specifying <a href=#hyperlink id=introduction-2:hyperlink>hyperlinks</a>, must also create a <a href=#hyperlink id=introduction-2:hyperlink-2>hyperlink</a>.
- This implied hyperlink has no special meaning (it has no <a href=#linkTypes>link type</a>)
- beyond linking the element's <a id=introduction-2:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> to the resource given by the element's <code id=introduction-2:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code> attribute.</p>
- <p>A <a href=#hyperlink id=introduction-2:hyperlink-3>hyperlink</a> can have one or more <dfn id=hyperlink-annotation>hyperlink
- annotations</dfn> that modify the processing semantics of that hyperlink.</p>
- <h4 id=links-created-by-a-and-area-elements>4.6.2 Links created by <code id=links-created-by-a-and-area-elements:the-a-element><a href=#the-a-element>a</a></code> and <code id=links-created-by-a-and-area-elements:the-area-element><a href=#the-area-element>area</a></code> elements</h4>
- <p>The <dfn id=attr-hyperlink-href><code>href</code></dfn> attribute on <code id=links-created-by-a-and-area-elements:the-a-element-2><a href=#the-a-element>a</a></code> and
- <code id=links-created-by-a-and-area-elements:the-area-element-2><a href=#the-area-element>area</a></code> elements must have a value that is a <a href=#valid-url-potentially-surrounded-by-spaces id=links-created-by-a-and-area-elements:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by
- spaces</a>.</p>
- <p class=note>The <code id=links-created-by-a-and-area-elements:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute on <code id=links-created-by-a-and-area-elements:the-a-element-3><a href=#the-a-element>a</a></code> and
- <code id=links-created-by-a-and-area-elements:the-area-element-3><a href=#the-area-element>area</a></code> elements is not required; when those elements do not have <code id=links-created-by-a-and-area-elements:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attributes they do not create hyperlinks.</p>
- <p>The <dfn id=attr-hyperlink-target><code>target</code></dfn> attribute, if present, must be
- a <a href=#valid-browsing-context-name-or-keyword id=links-created-by-a-and-area-elements:valid-browsing-context-name-or-keyword>valid browsing context name or keyword</a>. It gives the name of the <a href=#browsing-context id=links-created-by-a-and-area-elements:browsing-context>browsing
- context</a> that will be used. User agents use this name when
- <a href=#following-hyperlinks-2 id=links-created-by-a-and-area-elements:following-hyperlinks-2>following hyperlinks</a>.</p>
- <p>When an <code id=links-created-by-a-and-area-elements:the-a-element-4><a href=#the-a-element>a</a></code> or <code id=links-created-by-a-and-area-elements:the-area-element-4><a href=#the-area-element>area</a></code> element's <a href=#activation-behavior id=links-created-by-a-and-area-elements:activation-behavior>activation behavior</a> is
- invoked, the user agent may allow the user to indicate a preference regarding whether the
- hyperlink is to be used for <a href=#navigate id=links-created-by-a-and-area-elements:navigate>navigation</a> or whether the resource it
- specifies is to be downloaded.</p>
- <p>In the absence of a user preference, the default should be navigation if the element has no
- <code id=links-created-by-a-and-area-elements:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute, and should be to download the
- specified resource if it does.</p>
- <p>Whether determined by the user's preferences or via the presence or absence of the attribute,
- if the decision is to use the hyperlink for <a href=#navigate id=links-created-by-a-and-area-elements:navigate-2>navigation</a> then the user
- agent must <a href=#following-hyperlinks-2 id=links-created-by-a-and-area-elements:following-hyperlinks-2-2>follow the hyperlink</a>, and if the decision is
- to use the hyperlink to download a resource, the user agent must <a href=#downloading-hyperlinks id=links-created-by-a-and-area-elements:downloading-hyperlinks>download the hyperlink</a>. These terms are defined in subsequent sections
- below.</p>
- <p>The <dfn id=attr-hyperlink-download><code>download</code></dfn> attribute, if present,
- indicates that the author intends the hyperlink to be used for downloading a resource. The
- attribute may have a value; the value, if any, specifies the default file name that the author
- recommends for use in labeling the resource in a local file system. There are no restrictions on
- allowed values, but authors are cautioned that most file systems have limitations with regard to
- what punctuation is supported in file names, and user agents are likely to adjust file names
- accordingly.</p>
- <p>The <dfn id=ping><code>ping</code></dfn> attribute, if present,
- gives the URLs of the resources that are interested in being notified if the user follows the
- hyperlink. The value must be a <a href=#set-of-space-separated-tokens id=links-created-by-a-and-area-elements:set-of-space-separated-tokens>set of space-separated tokens</a>, each of which must be a
- <a href=#valid-non-empty-url id=links-created-by-a-and-area-elements:valid-non-empty-url>valid non-empty URL</a>. The value is used by the user agent for
- <a href=#hyperlink-auditing id=links-created-by-a-and-area-elements:hyperlink-auditing>hyperlink auditing</a>.</p>
- <p>The <dfn id=attr-hyperlink-rel><code>rel</code></dfn> attribute on <code id=links-created-by-a-and-area-elements:the-a-element-5><a href=#the-a-element>a</a></code> and
- <code id=links-created-by-a-and-area-elements:the-area-element-5><a href=#the-area-element>area</a></code> elements controls what kinds of links the elements create. The attribute's value
- must be a <a href=#set-of-space-separated-tokens id=links-created-by-a-and-area-elements:set-of-space-separated-tokens-2>set of space-separated tokens</a>. The <a href=#linkTypes>allowed keywords
- and their meanings</a> are defined below.</p>
- <p>The <code id=links-created-by-a-and-area-elements:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute has no default value. If the
- attribute is omitted or if none of the values in the attribute are recognised by the user agent,
- then the document has no particular relationship with the destination resource other than there
- being a hyperlink between the two.</p>
- <p>The <dfn id=attr-hyperlink-hreflang><code>hreflang</code></dfn> attribute on
- <code id=links-created-by-a-and-area-elements:the-a-element-6><a href=#the-a-element>a</a></code> and <code id=links-created-by-a-and-area-elements:the-area-element-6><a href=#the-area-element>area</a></code> elements that create <a href=#hyperlink id=links-created-by-a-and-area-elements:hyperlink>hyperlinks</a>, if present, gives the language of the linked resource. It is
- purely advisory. The value must be a valid BCP 47 language tag. <a href=#refsBCP47>[BCP47]</a>
- User agents must not consider this attribute authoritative — upon
- fetching the resource, user agents must use only language information associated with the resource
- to determine its language, not metadata included in the link to the resource.</p>
- <p>The <dfn id=attr-hyperlink-type><code>type</code></dfn> attribute, if present, gives the
- <a href=#mime-type id=links-created-by-a-and-area-elements:mime-type>MIME type</a> of the linked resource. It is purely advisory. The value must be a
- <a href=#valid-mime-type id=links-created-by-a-and-area-elements:valid-mime-type>valid MIME type</a>. User agents must not consider the <code id=links-created-by-a-and-area-elements:attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attribute authoritative — upon fetching the
- resource, user agents must not use metadata included in the link to the resource to determine its
- type.</p>
-
- <h4 id=following-hyperlinks>4.6.3 Following hyperlinks</h4>
- <p>When a user <dfn id=following-hyperlinks-2>follows a hyperlink</dfn> created by an element
- <var>subject</var>, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>replace</var> be false.<li><p>Let <var>source</var> be the <a href=#browsing-context id=following-hyperlinks:browsing-context>browsing context</a> that contains the
- <code id=following-hyperlinks:document><a href=#document>Document</a></code> object with which <var>subject</var> in question is
- associated.<li>
- <p>If the user indicated a specific <a href=#browsing-context id=following-hyperlinks:browsing-context-2>browsing context</a> when following the hyperlink,
- or if the user agent is configured to follow hyperlinks by navigating a particular browsing
- context, then let <var>target</var> be that <a href=#browsing-context id=following-hyperlinks:browsing-context-3>browsing context</a>.</p>
- <p>Otherwise, if <var>subject</var> is an <code id=following-hyperlinks:the-a-element><a href=#the-a-element>a</a></code> or <code id=following-hyperlinks:the-area-element><a href=#the-area-element>area</a></code> element
- that has a <code id=following-hyperlinks:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, then let <var>target</var> be the <a href=#browsing-context id=following-hyperlinks:browsing-context-4>browsing context</a> that is chosen by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=following-hyperlinks:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the
- rules for choosing a browsing context given a browsing context name</a>, using the value of
- the <code id=following-hyperlinks:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name. If
- these rules result in the creation of a new <a href=#browsing-context id=following-hyperlinks:browsing-context-5>browsing context</a>, set <var>replace</var> to true.</p>
- <p>Otherwise, if the hyperlink is a <a href=#rel-sidebar-hyperlink id=following-hyperlinks:rel-sidebar-hyperlink>sidebar
- hyperlink</a>, the user agent implements a feature that can be considered a <a href=#secondary-browsing-context id=following-hyperlinks:secondary-browsing-context>secondary
- browsing context</a>, and the user agent intends to use this feature in this instance, let
- <var>target</var> be such a <a href=#secondary-browsing-context id=following-hyperlinks:secondary-browsing-context-2>secondary browsing context</a>.</p>
- <p>Otherwise, if <var>target</var> is an <code id=following-hyperlinks:the-a-element-2><a href=#the-a-element>a</a></code> or <code id=following-hyperlinks:the-area-element-2><a href=#the-area-element>area</a></code> element
- with no <code id=following-hyperlinks:attr-hyperlink-target-3><a href=#attr-hyperlink-target>target</a></code> attribute, but the
- <code id=following-hyperlinks:document-2><a href=#document>Document</a></code> contains a <code id=following-hyperlinks:the-base-element><a href=#the-base-element>base</a></code> element with a <code id=following-hyperlinks:attr-base-target><a href=#attr-base-target>target</a></code> attribute, then let <var>target</var> be the
- <a href=#browsing-context id=following-hyperlinks:browsing-context-6>browsing context</a> that is chosen by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=following-hyperlinks:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name-2>the rules for choosing a browsing
- context given a browsing context name</a>, using the value of the <code id=following-hyperlinks:attr-base-target-2><a href=#attr-base-target>target</a></code> attribute of the first such <code id=following-hyperlinks:the-base-element-2><a href=#the-base-element>base</a></code> element as
- the browsing context name. If these rules result in the creation of a new <a href=#browsing-context id=following-hyperlinks:browsing-context-7>browsing
- context</a>, set <var>replace</var> to true.</p>
- <p>Otherwise, let <var>target</var> be the <a href=#browsing-context id=following-hyperlinks:browsing-context-8>browsing context</a> that <var>subject</var> itself is in.</p>
- <li><p><a href=#resolve-a-url id=following-hyperlinks:resolve-a-url>Resolve</a> the <a href=#url id=following-hyperlinks:url>URL</a> given by the <code id=following-hyperlinks:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of that element, relative to that
- element.<li>
- <p>If that is successful, let <var>URL</var> be the <a href=#resulting-absolute-url id=following-hyperlinks:resulting-absolute-url>resulting absolute
- URL</a>.</p>
- <p>Otherwise, if <a href=#resolve-a-url id=following-hyperlinks:resolve-a-url-2>resolving</a> the <a href=#url id=following-hyperlinks:url-2>URL</a> failed, the
- user agent may report the error to the user in a user-agent-specific manner, may <a href=#queue-a-task id=following-hyperlinks:queue-a-task>queue a
- task</a> to <a href=#navigate id=following-hyperlinks:navigate>navigate</a> the <var>target</var>
- <a href=#browsing-context id=following-hyperlinks:browsing-context-9>browsing context</a> to an error page to report the error, or may ignore the error and
- do nothing. In any case, the user agent must then abort these steps.</p>
- <li><p>In the case of server-side image maps, append the <var id=following-hyperlinks:hyperlink-suffix><a href=#hyperlink-suffix>hyperlink
- suffix</a></var> to <var>URL</var>.<li>
- <p><a href=#queue-a-task id=following-hyperlinks:queue-a-task-2>Queue a task</a> to <a href=#navigate id=following-hyperlinks:navigate-2>navigate</a> the <var>target</var> <a href=#browsing-context id=following-hyperlinks:browsing-context-10>browsing context</a> to <var>URL</var>. If <var>replace</var> is true, the navigation must be performed with <a href=#replacement-enabled id=following-hyperlinks:replacement-enabled>replacement
- enabled</a>. The <a href=#source-browsing-context id=following-hyperlinks:source-browsing-context>source browsing context</a> must be <var>source</var>.</p>
- </ol>
- <p>The <a href=#task-source id=following-hyperlinks:task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source id=following-hyperlinks:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
-
- <h4 id=downloading-resources>4.6.4 Downloading resources</h4>
- <p>In some cases, resources are intended for later use rather than immediate viewing. To indicate
- that a resource is intended to be downloaded for use later, rather than immediately used, the
- <code id=downloading-resources:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> attribute can be specified on the
- <code id=downloading-resources:the-a-element><a href=#the-a-element>a</a></code> or <code id=downloading-resources:the-area-element><a href=#the-area-element>area</a></code> element that creates the <a href=#hyperlink id=downloading-resources:hyperlink>hyperlink</a> to that
- resource.</p>
- <p>The attribute can furthermore be given a value, to specify the file name that user agents are
- to use when storing the resource in a file system. This value can be overridden by the <code id=downloading-resources:http-content-disposition><a href=#http-content-disposition>Content-Disposition</a></code> HTTP header's filename parameters. <a href=#refsRFC6266>[RFC6266]</a></p>
- <p>In cross-origin situations, the <code id=downloading-resources:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code> attribute
- has to be combined with the <code id=downloading-resources:http-content-disposition-2><a href=#http-content-disposition>Content-Disposition</a></code> HTTP
- header, specifically with the <code>attachment</code> disposition type, to avoid the user
- being warned of possibly nefarious activity. (This is to protect users from being made to download
- sensitive personal or confidential information without their full understanding.)</p>
-
- <hr>
- <p>When a user <dfn id=downloading-hyperlinks>downloads a hyperlink</dfn> created by an
- element, the user agent must run the following steps:</p>
- <ol><li><p><a href=#resolve-a-url id=downloading-resources:resolve-a-url>Resolve</a> the <a href=#url id=downloading-resources:url>URL</a> given by the <code id=downloading-resources:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of that element, relative to that
- element.<li><p>If <a href=#resolve-a-url id=downloading-resources:resolve-a-url-2>resolving</a> the <a href=#url id=downloading-resources:url-2>URL</a> fails, the user agent
- may report the error to the user in a user-agent-specific manner, may
- <a href=#navigate id=downloading-resources:navigate>navigate</a> to an error page to report the error, or may
- ignore the error and do nothing. In either case, the user agent must abort these steps.</p>
- <li><p>Otherwise, let <var>URL</var> be the resulting <a href=#absolute-url id=downloading-resources:absolute-url>absolute
- URL</a>.<li><p>In the case of server-side image maps, append the <var id=downloading-resources:hyperlink-suffix><a href=#hyperlink-suffix>hyperlink
- suffix</a></var> to <var>URL</var>.<li><p>Return to whatever algorithm invoked these steps and continue
- these steps asynchronously.<li><p><a href=#fetch id=downloading-resources:fetch>Fetch</a> <var>URL</var> and handle the resulting resource
- <a href=#as-a-download id=downloading-resources:as-a-download>as a download</a>.</ol>
- <p>When a user agent is to handle a resource obtained from a <a href=#fetch id=downloading-resources:fetch-2>fetch</a> algorithm <dfn id=as-a-download>as
- a download</dfn>, it should provide the user with a way to save the resource for later use, if a
- resource is successfully obtained; or otherwise should report any problems downloading the file to
- the user.</p>
- <p>If the user agent needs a file name for a resource being handled <a href=#as-a-download id=downloading-resources:as-a-download-2>as a download</a>, it
- should select one using the following algorithm.</p>
- <p class=warning>This algorithm is intended to mitigate security dangers involved in downloading
- files from untrusted sites, and user agents are strongly urged to follow it.</p>
- <ol><li><p>Let <var>filename</var> be the void value.<li><p>If the resource has a <code id=downloading-resources:http-content-disposition-3><a href=#http-content-disposition>Content-Disposition</a></code>
- header, that header specifies the <code>attachment</code> disposition type, and the
- header includes file name information, then let <var>filename</var> have the value
- specified by the header, and jump to the step labeled <i>sanitize</i> below. <a href=#refsRFC6266>[RFC6266]</a><li><p>Let <var>interface origin</var> be the <a href=#origin-2 id=downloading-resources:origin-2>origin</a> of the
- <code id=downloading-resources:document><a href=#document>Document</a></code> in which the <a href=#downloading-hyperlinks id=downloading-resources:downloading-hyperlinks>download</a> or
- <a href=#navigate id=downloading-resources:navigate-2>navigate</a> action resulting in the download was initiated, if any.<li><p>Let <var>resource origin</var> be the <a href=#origin-2 id=downloading-resources:origin-2-2>origin</a> of the URL of the
- resource being downloaded, unless that URL's <a href=#concept-url-scheme id=downloading-resources:concept-url-scheme>scheme</a>
- component is <code>data</code>, in which case let <var>resource origin</var> be
- the same as the <var>interface origin</var>, if any.<li><p>If there is no <var>interface origin</var>, then let <var>trusted
- operation</var> be true. Otherwise, let <var>trusted operation</var> be true if <var>resource origin</var> is the <a href=#same-origin id=downloading-resources:same-origin>same origin</a> as <var>interface
- origin</var>, and false otherwise.<li><p>If <var>trusted operation</var> is true and the resource has a <code id=downloading-resources:http-content-disposition-4><a href=#http-content-disposition>Content-Disposition</a></code> header and that header includes file
- name information, then let <var>filename</var> have the value specified by the header,
- and jump to the step labeled <i>sanitize</i> below. <a href=#refsRFC6266>[RFC6266]</a><li><p>If the download was not initiated from a <a href=#hyperlink id=downloading-resources:hyperlink-2>hyperlink</a> created by an
- <code id=downloading-resources:the-a-element-2><a href=#the-a-element>a</a></code> or <code id=downloading-resources:the-area-element-2><a href=#the-area-element>area</a></code> element, or if the element of the <a href=#hyperlink id=downloading-resources:hyperlink-3>hyperlink</a> from
- which it was initiated did not have a <code id=downloading-resources:attr-hyperlink-download-3><a href=#attr-hyperlink-download>download</a></code>
- attribute when the download was initiated, or if there was such an attribute but its value when
- the download was initiated was the empty string, then jump to the step labeled <i>no proposed
- file name</i>.<li><p>Let <var>proposed filename</var> have the value of the <code id=downloading-resources:attr-hyperlink-download-4><a href=#attr-hyperlink-download>download</a></code> attribute of the element of the
- <a href=#hyperlink id=downloading-resources:hyperlink-4>hyperlink</a> that initiated the download at the time the download was
- initiated.<li><p>If <var>trusted operation</var> is true, let <var>filename</var> have
- the value of <var>proposed filename</var>, and jump to the step labeled <i>sanitize</i>
- below.<li><p>If the resource has a <code id=downloading-resources:http-content-disposition-5><a href=#http-content-disposition>Content-Disposition</a></code>
- header and that header specifies the <code>attachment</code> disposition type, let <var>filename</var> have the value of <var>proposed filename</var>, and jump to the
- step labeled <i>sanitize</i> below. <a href=#refsRFC6266>[RFC6266]</a><li><p><i>No proposed file name</i>: If <var>trusted operation</var> is true, or if the
- user indicated a preference for having the resource in question downloaded, let <var>filename</var> have a value derived from the <a href=#url id=downloading-resources:url-3>URL</a> of the resource in a
- user-agent-defined manner, and jump to the step labeled <i>sanitize</i> below.<li>
- <p>Act in a user-agent-defined manner to safeguard the user from a potentially hostile
- cross-origin download. If the download is not to be aborted, then let <var>filename</var> be set to the user's preferred file name or to a file name selected by
- the user agent, and jump to the step labeled <i>sanitize</i> below.</p>
- <div class=warning>
- <p>If the algorithm reaches this step, then a download was begun from a different origin than
- the resource being downloaded, and the origin did not mark the file as suitable for
- downloading, and the download was not initiated by the user. This could be because a <code id=downloading-resources:attr-hyperlink-download-5><a href=#attr-hyperlink-download>download</a></code> attribute was used to trigger the download, or
- because the resource in question is not of a type that the user agent supports.</p>
- <p>This could be dangerous, because, for instance, a hostile server could be trying to get a
- user to unknowingly download private information and then re-upload it to the hostile server,
- by tricking the user into thinking the data is from the hostile server.</p>
- <p>Thus, it is in the user's interests that the user be somehow notified that the resource in
- question comes from quite a different source, and to prevent confusion, any suggested file name
- from the potentially hostile <var>interface origin</var> should be ignored.</p>
- </div>
- <li><p><i>Sanitize</i>: Optionally, allow the user to influence <var>filename</var>. For
- example, a user agent could prompt the user for a file name, potentially providing the value of
- <var>filename</var> as determined above as a default value.<li>
- <p>Adjust <var>filename</var> to be suitable for the local file system.</p>
- <p class=example>For example, this could involve removing characters that are not legal in
- file names, or trimming leading and trailing whitespace.</p>
- <li><p>If the platform conventions do not in any way use <a href=#concept-extension id=downloading-resources:concept-extension>extensions</a> to determine the types of file on the file system,
- then return <var>filename</var> as the file name and abort these steps.<li><p>Let <var>claimed type</var> be the type given by the resource's <a href=#content-type id=downloading-resources:content-type>Content-Type metadata</a>, if any is known. Let <var>named
- type</var> be the type given by <var>filename</var>'s <a href=#concept-extension id=downloading-resources:concept-extension-2>extension</a>, if any is known. For the purposes of this step, a
- <i>type</i> is a mapping of a <a href=#mime-type id=downloading-resources:mime-type>MIME type</a> to an <a href=#concept-extension id=downloading-resources:concept-extension-3>extension</a>.<li><p>If <var>named type</var> is consistent with the user's preferences (e.g. because
- the value of <var>filename</var> was determined by prompting the user), then return <var>filename</var> as the file name and abort these steps.<li><p>If <var>claimed type</var> and <var>named type</var> are the same type
- (i.e. the type given by the resource's <a href=#content-type id=downloading-resources:content-type-2>Content-Type metadata</a> is
- consistent with the type given by <var>filename</var>'s <a href=#concept-extension id=downloading-resources:concept-extension-4>extension</a>), then return <var>filename</var> as the file
- name and abort these steps.<li>
- <p>If the <var>claimed type</var> is known, then alter <var>filename</var> to
- add an <a href=#concept-extension id=downloading-resources:concept-extension-5>extension</a> corresponding to <var>claimed
- type</var>.</p>
- <p>Otherwise, if <var>named type</var> is known to be potentially dangerous (e.g. it
- will be treated by the platform conventions as a native executable, shell script, HTML
- application, or executable-macro-capable document) then optionally alter <var>filename</var> to add a known-safe <a href=#concept-extension id=downloading-resources:concept-extension-6>extension</a>
- (e.g. "<code>.txt</code>").</p>
- <p class=note>This last step would make it impossible to download executables, which might not
- be desirable. As always, implementors are forced to balance security and usability in this
- matter.</p>
- <li><p>Return <var>filename</var> as the file name.</ol>
- <p>For the purposes of this algorithm, a file <dfn id=concept-extension>extension</dfn>
- consists of any part of the file name that platform conventions dictate will be used for
- identifying the type of the file. For example, many operating systems use the part of the file
- name following the last dot ("<code>.</code>") in the file name to determine the type of
- the file, and from that the manner in which the file is to be opened or executed.</p>
- <p>User agents should ignore any directory or path information provided by the resource itself,
- its <a href=#url id=downloading-resources:url-4>URL</a>, and any <code id=downloading-resources:attr-hyperlink-download-6><a href=#attr-hyperlink-download>download</a></code> attribute, in
- deciding where to store the resulting file in the user's file system.</p>
-
-
- <h5 id=hyperlink-auditing>4.6.4.1 <dfn>Hyperlink auditing</dfn></h5>
- <p>If a <a href=#hyperlink id=hyperlink-auditing:hyperlink>hyperlink</a> created by an <code id=hyperlink-auditing:the-a-element><a href=#the-a-element>a</a></code> or <code id=hyperlink-auditing:the-area-element><a href=#the-area-element>area</a></code> element has a
- <code id=hyperlink-auditing:ping><a href=#ping>ping</a></code> attribute, and the user follows the hyperlink, and
- the value of the element's <code id=hyperlink-auditing:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute can be <a href=#resolve-a-url id=hyperlink-auditing:resolve-a-url>resolved</a>, relative to the element, without failure, then the user
- agent must take the <code id=hyperlink-auditing:ping-2><a href=#ping>ping</a></code> attribute's value, <a href=#split-a-string-on-spaces id=hyperlink-auditing:split-a-string-on-spaces>split that string on spaces</a>, <a href=#resolve-a-url id=hyperlink-auditing:resolve-a-url-2>resolve</a> each resulting token relative to the element, and then each <a href=#resulting-absolute-url id=hyperlink-auditing:resulting-absolute-url>resulting absolute URL</a> <var>ping URL</var> should
- be <a href=#fetch id=hyperlink-auditing:fetch>fetched</a> from the <a href=#origin-2 id=hyperlink-auditing:origin-2>origin</a> of the
- <code id=hyperlink-auditing:document><a href=#document>Document</a></code> containing the <a href=#hyperlink id=hyperlink-auditing:hyperlink-2>hyperlink</a> (as described below). (Tokens that fail to resolve are ignored.) This may be done in parallel
- with the primary request, and is independent of the result of that request.</p>
- <p>User agents should allow the user to adjust this behavior, for example in conjunction with a
- setting that disables the sending of HTTP <code id=hyperlink-auditing:http-referer><a href=#http-referer>Referer</a></code> (sic)
- headers. Based on the user's preferences, UAs may either <a href=#ignore id=hyperlink-auditing:ignore>ignore</a> the <code id=hyperlink-auditing:ping-3><a href=#ping>ping</a></code> attribute altogether, or selectively ignore URLs in the
- list (e.g. ignoring any third-party URLs).</p>
- <p>For each <var>ping URL</var> that is an HTTP URL, the request must be performed using
- the POST method, with an entity body with the <a href=#mime-type id=hyperlink-auditing:mime-type>MIME type</a> <code id=hyperlink-auditing:text/ping><a href=#text/ping>text/ping</a></code>
- consisting of the four-character string "<code>PING</code>". All relevant cookie and
- HTTP authentication headers must be included in the request. Which other headers are required
- depends on the URLs involved, as follows. For the purposes of these requirements, <var>target URL</var> is the <a href=#resulting-absolute-url id=hyperlink-auditing:resulting-absolute-url-2>resulting absolute URL</a> obtained from <a href=#resolve-a-url id=hyperlink-auditing:resolve-a-url-3>resolving</a> the value of the element's <code id=hyperlink-auditing:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute.</p>
- <dl class=switch><dt>If both the <a href=http://dom.spec.whatwg.org/#concept-document-url id="hyperlink-auditing:the-document's-address" data-x-internal="the-document's-address">address</a> of the <code id=hyperlink-auditing:document-2><a href=#document>Document</a></code>
- object containing the hyperlink being audited and <var>ping URL</var> have the
- <a href=#same-origin id=hyperlink-auditing:same-origin>same origin</a><dd>The request must include a <code id=hyperlink-auditing:ping-from><a href=#ping-from>Ping-From</a></code> HTTP header with,
- as its value, the <a href=http://dom.spec.whatwg.org/#concept-document-url id="hyperlink-auditing:the-document's-address-2" data-x-internal="the-document's-address">address</a> of the document containing
- the hyperlink, and a <code id=hyperlink-auditing:ping-to><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value,
- the <var>target URL</var>. The request must not include a <code id=hyperlink-auditing:http-referer-2><a href=#http-referer>Referer</a></code> (sic) HTTP header. <dt>Otherwise, if the origins are different, but the document containing the hyperlink being
- audited was not retrieved over an encrypted connection<dd>The request must include a <code id=hyperlink-auditing:http-referer-3><a href=#http-referer>Referer</a></code> (sic) HTTP header with,
- as its value, the <a href=http://dom.spec.whatwg.org/#concept-document-url id="hyperlink-auditing:the-document's-address-3" data-x-internal="the-document's-address">address</a> of the document containing
- the hyperlink, a <code id=hyperlink-auditing:ping-from-2><a href=#ping-from>Ping-From</a></code> HTTP header with the same value,
- and a <code id=hyperlink-auditing:ping-to-2><a href=#ping-to>Ping-To</a></code> HTTP header with, as its value, <var>target URL</var>.<dt>Otherwise, the origins are different and the document containing the hyperlink being audited
- was retrieved over an encrypted connection<dd>The request must include a <code id=hyperlink-auditing:ping-to-3><a href=#ping-to>Ping-To</a></code> HTTP header with, as
- its value, <var>target URL</var>. The request must neither include a <code id=hyperlink-auditing:http-referer-4><a href=#http-referer>Referer</a></code> (sic) HTTP header nor include a <code id=hyperlink-auditing:ping-from-3><a href=#ping-from>Ping-From</a></code> HTTP header.</dl>
- <p class=note>To save bandwidth, implementors might also wish to consider omitting optional
- headers such as <code id=hyperlink-auditing:http-accept><a href=#http-accept>Accept</a></code> from these requests.</p>
- <p>User agents must, unless otherwise specified by the user, honor the HTTP headers (including, in
- particular, redirects and HTTP cookie headers), but must ignore any entity bodies returned in the
- responses. User agents may close the connection prematurely once they start receiving an entity
- body. <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p>When the <code id=hyperlink-auditing:ping-4><a href=#ping>ping</a></code> attribute is present, user agents
- should clearly indicate to the user that following the hyperlink will also cause secondary
- requests to be sent in the background, possibly including listing the actual target URLs.</p>
- <p class=example>For example, a visual user agent could include the hostnames of the target ping
- URLs along with the hyperlink's actual URL in a status bar or tooltip.</p>
-
- <div class=note>
- <p>The <code id=hyperlink-auditing:ping-5><a href=#ping>ping</a></code> attribute is redundant with pre-existing
- technologies like HTTP redirects and JavaScript in allowing Web pages to track which off-site
- links are most popular or allowing advertisers to track click-through rates.</p>
- <p>However, the <code id=hyperlink-auditing:ping-6><a href=#ping>ping</a></code> attribute provides these advantages
- to the user over those alternatives:</p>
- <ul><li>It allows the user to see the final target URL unobscured.<li>It allows the UA to inform the user about the out-of-band notifications.<li>It allows the user to disable the notifications without losing the underlying link
- functionality.<li>It allows the UA to optimise the use of available network bandwidth so that the target page
- loads faster.</ul>
- <p>Thus, while it is possible to track users without this feature, authors are encouraged to use
- the <code id=hyperlink-auditing:ping-7><a href=#ping>ping</a></code> attribute so that the user agent can make the
- user experience more transparent.</p>
- </div>
-
- <h4 id=linkTypes>4.6.5 Link types</h4>
- <p>The following table summarizes the link types that are defined by this specification. This
- table is non-normative; the actual definitions for the link types are given in the next few
- sections.</p>
- <p>In this section, the term <i>referenced document</i> refers to the resource identified by the
- element representing the link, and the term <i>current document</i> refers to the resource within
- which the element representing the link finds itself.</p>
-
- <p>To determine which link types apply to a <code id=linkTypes:the-link-element><a href=#the-link-element>link</a></code>, <code id=linkTypes:the-a-element><a href=#the-a-element>a</a></code>, or
- <code id=linkTypes:the-area-element><a href=#the-area-element>area</a></code> element, the element's <code>rel</code> attribute must be <a href=#split-a-string-on-spaces id=linkTypes:split-a-string-on-spaces>split on spaces</a>. The resulting tokens are the link types
- that apply to that element.</p>
-
- <p>Except where otherwise specified, a keyword must not be specified more than once per <code id=linkTypes:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute.</p>
- <p>Link types are always <a href=#ascii-case-insensitive id=linkTypes:ascii-case-insensitive>ASCII case-insensitive</a>, and must be
- compared as such.</p>
- <p class=example>Thus, <code>rel="next"</code> is the same as <code>rel="NEXT"</code>.</p>
- <table><thead><tr><th rowspan=2>Link type<th colspan=2>Effect on...<th rowspan=2>Brief description<tr><th><code id=linkTypes:the-link-element-2><a href=#the-link-element>link</a></code><th><code id=linkTypes:the-a-element-2><a href=#the-a-element>a</a></code> and <code id=linkTypes:the-area-element-2><a href=#the-area-element>area</a></code><tbody><tr><td><code id=linkTypes:rel-alternate><a href=#rel-alternate>alternate</a></code><td><a href=#hyperlink id=linkTypes:hyperlink>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-2>Hyperlink</a><td>Gives alternate representations of the current document.<tr><td><code id=linkTypes:link-type-author><a href=#link-type-author>author</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-3>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-4>Hyperlink</a><td>Gives a link to the author of the current document or article.<tr><td><code id=linkTypes:link-type-bookmark><a href=#link-type-bookmark>bookmark</a></code><td><em>not allowed</em><td><a href=#hyperlink id=linkTypes:hyperlink-5>Hyperlink</a><td>Gives the permalink for the nearest ancestor section.<tr><td><code id=linkTypes:link-type-external><a href=#link-type-external>external</a></code><td><em>not allowed</em><td><a href=#hyperlink-annotation id=linkTypes:hyperlink-annotation>Annotation</a><td>Indicates that the referenced document is not part of the same site as the current document.<tr><td><code id=linkTypes:link-type-help><a href=#link-type-help>help</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-6>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-7>Hyperlink</a><td>Provides a link to context-sensitive help.<tr><td><code id=linkTypes:rel-icon><a href=#rel-icon>icon</a></code><td><a href=#external-resource-link id=linkTypes:external-resource-link>External Resource</a><td><em>not allowed</em><td>Imports an icon to represent the current document.<tr><td><code id=linkTypes:link-type-license><a href=#link-type-license>license</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-8>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-9>Hyperlink</a><td>Indicates that the main content of the current document is covered by the copyright license described by the referenced document.<tr><td><code id=linkTypes:link-type-next><a href=#link-type-next>next</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-10>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-11>Hyperlink</a><td>Indicates that the current document is a part of a series, and that the next document in the series is the referenced document.<tr><td><code id=linkTypes:link-type-nofollow><a href=#link-type-nofollow>nofollow</a></code><td><em>not allowed</em><td><a href=#hyperlink-annotation id=linkTypes:hyperlink-annotation-2>Annotation</a><td>Indicates that the current document's original author or publisher does not endorse the referenced document.<tr><td><code id=linkTypes:link-type-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code><td><em>not allowed</em><td><a href=#hyperlink-annotation id=linkTypes:hyperlink-annotation-3>Annotation</a><td>Requires that the user agent not send an HTTP <code id=linkTypes:http-referer><a href=#http-referer>Referer</a></code> (sic) header if the user follows the hyperlink.<tr><td><code id=linkTypes:link-type-pingback><a href=#link-type-pingback>pingback</a></code><td><a href=#external-resource-link id=linkTypes:external-resource-link-2>External Resource</a><td><em>not allowed</em><td>Gives the address of the pingback server that handles pingbacks to the current document.<tr><td><code id=linkTypes:link-type-prefetch><a href=#link-type-prefetch>prefetch</a></code><td><a href=#external-resource-link id=linkTypes:external-resource-link-3>External Resource</a><td><a href=#external-resource-link id=linkTypes:external-resource-link-4>External Resource</a><td>Specifies that the target resource should be preemptively cached.<tr><td><code id=linkTypes:link-type-prev><a href=#link-type-prev>prev</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-12>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-13>Hyperlink</a><td>Indicates that the current document is a part of a series, and that the previous document in the series is the referenced document.<tr><td><code id=linkTypes:link-type-search><a href=#link-type-search>search</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-14>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-15>Hyperlink</a><td>Gives a link to a resource that can be used to search through the current document and its related pages.<tr><td><code id=linkTypes:link-type-sidebar><a href=#link-type-sidebar>sidebar</a></code><td><a href=#hyperlink id=linkTypes:hyperlink-16>Hyperlink</a><td><a href=#hyperlink id=linkTypes:hyperlink-17>Hyperlink</a><td>Specifies that the referenced document, if retrieved, is intended to be shown in the browser's sidebar (if it has one).<tr><td><code id=linkTypes:link-type-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code><td><a href=#external-resource-link id=linkTypes:external-resource-link-5>External Resource</a><td><em>not allowed</em><td>Imports a stylesheet.<tr><td><code id=linkTypes:link-type-tag><a href=#link-type-tag>tag</a></code><td><em>not allowed</em><td><a href=#hyperlink id=linkTypes:hyperlink-18>Hyperlink</a><td>Gives a tag (identified by the given address) that applies to the current document.</table>
-
- <p>Some of the types described below list synonyms for these values. These are to be handled as specified by user agents, but must not be used
- in documents.</p>
-
-
- <h5 id=rel-alternate>4.6.5.1 Link type "<dfn><code>alternate</code></dfn>"</h5>
- <p>The <code id=rel-alternate:rel-alternate><a href=#rel-alternate>alternate</a></code> keyword may be used with <code id=rel-alternate:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=rel-alternate:the-a-element><a href=#the-a-element>a</a></code>, and <code id=rel-alternate:the-area-element><a href=#the-area-element>area</a></code> elements.</p>
- <p>The meaning of this keyword depends on the values of the other attributes.</p>
- <dl class=switch><dt>If the element is a <code id=rel-alternate:the-link-element-2><a href=#the-link-element>link</a></code> element and the <code id=rel-alternate:attr-link-rel><a href=#attr-link-rel>rel</a></code>
- attribute also contains the keyword <code id=rel-alternate:link-type-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code><dd>
- <p>The <code id=rel-alternate:rel-alternate-2><a href=#rel-alternate>alternate</a></code> keyword modifies the meaning of the <code id=rel-alternate:link-type-stylesheet-2><a href=#link-type-stylesheet>stylesheet</a></code> keyword in the way described for that keyword. The
- <code id=rel-alternate:rel-alternate-3><a href=#rel-alternate>alternate</a></code> keyword does not create a link of its own.</p>
- <dt>If the <code id=rel-alternate:rel-alternate-4><a href=#rel-alternate>alternate</a></code> keyword is used with the <code id=rel-alternate:attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> attribute set to the value <code>application/rss+xml</code> or the value <code>application/atom+xml</code><dd>
- <p>The keyword creates a <a href=#hyperlink id=rel-alternate:hyperlink>hyperlink</a> referencing a syndication feed (though not
- necessarily syndicating exactly the same content as the current page).</p>
-
- <p>The first <code id=rel-alternate:the-link-element-3><a href=#the-link-element>link</a></code>, <code id=rel-alternate:the-a-element-2><a href=#the-a-element>a</a></code>, or <code id=rel-alternate:the-area-element-2><a href=#the-area-element>area</a></code> element in the document (in
- <a href=#tree-order id=rel-alternate:tree-order>tree order</a>) with the <code id=rel-alternate:rel-alternate-5><a href=#rel-alternate>alternate</a></code> keyword used with the <code id=rel-alternate:attr-hyperlink-type-2><a href=#attr-hyperlink-type>type</a></code> attribute set to the value <code>application/rss+xml</code> or the value <code>application/atom+xml</code> must
- be treated as the default syndication feed for the purposes of feed autodiscovery.</p>
- <div class=example>
- <p>The following <code id=rel-alternate:the-link-element-4><a href=#the-link-element>link</a></code> element gives the syndication
- feed for the current page:</p>
- <pre><link rel="alternate" type="application/atom+xml" href="data.xml"></pre>
- <p>The following extract offers various different syndication
- feeds:</p>
- <pre><p>You can access the planets database using Atom feeds:</p>
- <ul>
- <li><a href="recently-visited-planets.xml" rel="alternate" type="application/atom+xml">Recently Visited Planets</a></li>
- <li><a href="known-bad-planets.xml" rel="alternate" type="application/atom+xml">Known Bad Planets</a></li>
- <li><a href="unexplored-planets.xml" rel="alternate" type="application/atom+xml">Unexplored Planets</a></li>
- </ul></pre>
- </div>
-
- <dt>Otherwise<dd>
- <p>The keyword creates a <a href=#hyperlink id=rel-alternate:hyperlink-2>hyperlink</a> referencing an alternate representation of the
- current document.</p>
- <p>The nature of the referenced document is given by the <code id=rel-alternate:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code id=rel-alternate:attr-hyperlink-type-3><a href=#attr-hyperlink-type>type</a></code> attributes.</p>
- <p>If the <code id=rel-alternate:rel-alternate-6><a href=#rel-alternate>alternate</a></code> keyword is used with the <code id=rel-alternate:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>hreflang</a></code> attribute, and that attribute's value differs
- from the <a href=#root-element id=rel-alternate:root-element>root element</a>'s <a href=#language id=rel-alternate:language>language</a>, it indicates that the referenced
- document is a translation.</p>
- <p>If the <code id=rel-alternate:rel-alternate-7><a href=#rel-alternate>alternate</a></code> keyword is used with the <code id=rel-alternate:attr-hyperlink-type-4><a href=#attr-hyperlink-type>type</a></code> attribute, it indicates that the referenced document is
- a reformulation of the current document in the specified format.</p>
- <p>The <code id=rel-alternate:attr-hyperlink-hreflang-3><a href=#attr-hyperlink-hreflang>hreflang</a></code> and <code id=rel-alternate:attr-hyperlink-type-5><a href=#attr-hyperlink-type>type</a></code> attributes can be combined when specified with the <code id=rel-alternate:rel-alternate-8><a href=#rel-alternate>alternate</a></code> keyword.</p>
- <div class=example>
- <p>For example, the following link is a French translation that uses the PDF format:</p>
- <pre><link rel=alternate type=application/pdf hreflang=fr href=manual-fr></pre>
- </div>
- <p>This relationship is transitive — that is, if a document links to two other documents
- with the link type "<code id=rel-alternate:rel-alternate-9><a href=#rel-alternate>alternate</a></code>", then, in addition to implying
- that those documents are alternative representations of the first document, it is also implying
- that those two documents are alternative representations of each other.</p>
- </dl>
- <h5 id=link-type-author>4.6.5.2 Link type "<dfn><code>author</code></dfn>"</h5>
- <p>The <code id=link-type-author:link-type-author><a href=#link-type-author>author</a></code> keyword may be used with <code id=link-type-author:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-author:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-author:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-author:hyperlink>hyperlink</a>.</p>
- <p>For <code id=link-type-author:the-a-element-2><a href=#the-a-element>a</a></code> and <code id=link-type-author:the-area-element-2><a href=#the-area-element>area</a></code> elements, the <code id=link-type-author:link-type-author-2><a href=#link-type-author>author</a></code>
- keyword indicates that the referenced document provides further information about the author of
- the nearest <code id=link-type-author:the-article-element><a href=#the-article-element>article</a></code> element ancestor of the element defining the hyperlink, if there
- is one, or of the page as a whole, otherwise.</p>
- <p>For <code id=link-type-author:the-link-element-2><a href=#the-link-element>link</a></code> elements, the <code id=link-type-author:link-type-author-3><a href=#link-type-author>author</a></code> keyword indicates
- that the referenced document provides further information about the author for the page as a
- whole.</p>
- <p class=note>The "referenced document" can be, and often is, a <code id=link-type-author:mailto-protocol><a data-x-internal=mailto-protocol href=http://tools.ietf.org/html/rfc6068#section-2>mailto:</a></code> URL giving the e-mail address of the author. <a href=#refsMAILTO>[MAILTO]</a></p>
-
- <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat
- <code id=link-type-author:the-link-element-3><a href=#the-link-element>link</a></code>, <code id=link-type-author:the-a-element-3><a href=#the-a-element>a</a></code>, and <code id=link-type-author:the-area-element-3><a href=#the-area-element>area</a></code> elements that have a <code>rev</code> attribute with the value "<code>made</code>" as having the <code id=link-type-author:link-type-author-4><a href=#link-type-author>author</a></code> keyword specified as a link relationship.</p>
-
- <h5 id=link-type-bookmark>4.6.5.3 Link type "<dfn><code>bookmark</code></dfn>"</h5>
- <p>The <code id=link-type-bookmark:link-type-bookmark><a href=#link-type-bookmark>bookmark</a></code> keyword may be used with <code id=link-type-bookmark:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=link-type-bookmark:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-bookmark:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-bookmark:link-type-bookmark-2><a href=#link-type-bookmark>bookmark</a></code> keyword gives a permalink for the nearest
- ancestor <code id=link-type-bookmark:the-article-element><a href=#the-article-element>article</a></code> element of the linking element in question, or of <a href=#associatedSection>the section the linking element is most closely associated with</a>, if
- there are no ancestor <code id=link-type-bookmark:the-article-element-2><a href=#the-article-element>article</a></code> elements.</p>
- <div class=example>
- <p>The following snippet has three permalinks. A user agent could determine which permalink
- applies to which part of the spec by looking at where the permalinks are given.</p>
- <pre> ...
- <body>
- <h1>Example of permalinks</h1>
- <div id="a">
- <h2>First example</h2>
- <p><a href="a.html" rel="bookmark">This permalink applies to
- only the content from the first H2 to the second H2</a>. The DIV isn't
- exactly that section, but it roughly corresponds to it.</p>
- </div>
- <h2>Second example</h2>
- <article id="b">
- <p><a href="b.html" rel="bookmark">This permalink applies to
- the outer ARTICLE element</a> (which could be, e.g., a blog post).</p>
- <article id="c">
- <p><a href="c.html" rel="bookmark">This permalink applies to
- the inner ARTICLE element</a> (which could be, e.g., a blog comment).</p>
- </article>
- </article>
- </body>
- ...</pre>
- </div>
- <h5 id=link-type-external>4.6.5.4 Link type "<dfn><code>external</code></dfn>"</h5>
-
- <p>The <code id=link-type-external:link-type-external><a href=#link-type-external>external</a></code> keyword may be used with <code id=link-type-external:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=link-type-external:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword does not create a <a href=#hyperlink id=link-type-external:hyperlink>hyperlink</a>, but <a href=#hyperlink-annotation id=link-type-external:hyperlink-annotation>annotates</a> any other hyperlinks created by the element (the
- implied hyperlink, if no other keywords create one).</p>
- <p>The <code id=link-type-external:link-type-external-2><a href=#link-type-external>external</a></code> keyword indicates that the link is leading to a
- document that is not part of the site that the current document forms a part of.</p>
- <h5 id=link-type-help>4.6.5.5 Link type "<dfn><code>help</code></dfn>"</h5>
- <p>The <code id=link-type-help:link-type-help><a href=#link-type-help>help</a></code> keyword may be used with <code id=link-type-help:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-help:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-help:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-help:hyperlink>hyperlink</a>.</p>
- <p>For <code id=link-type-help:the-a-element-2><a href=#the-a-element>a</a></code> and <code id=link-type-help:the-area-element-2><a href=#the-area-element>area</a></code> elements, the <code id=link-type-help:link-type-help-2><a href=#link-type-help>help</a></code>
- keyword indicates that the referenced document provides further help information for the parent of
- the element defining the hyperlink, and its children.</p>
- <div class=example>
- <p>In the following example, the form control has associated context-sensitive help. The user
- agent could use this information, for example, displaying the referenced document if the user
- presses the "Help" or "F1" key.</p>
- <pre> <p><label> Topic: <input name=topic> <a href="help/topic.html" rel="help">(Help)</a></label></p></pre>
- </div>
- <p>For <code id=link-type-help:the-link-element-2><a href=#the-link-element>link</a></code> elements, the <code id=link-type-help:link-type-help-3><a href=#link-type-help>help</a></code> keyword indicates that
- the referenced document provides help for the page as a whole.</p>
- <p>For <code id=link-type-help:the-a-element-3><a href=#the-a-element>a</a></code> and <code id=link-type-help:the-area-element-3><a href=#the-area-element>area</a></code> elements, on some browsers, the <code id=link-type-help:link-type-help-4><a href=#link-type-help>help</a></code> keyword causes the link to use a different cursor.</p>
- <h5 id=rel-icon>4.6.5.6 Link type "<dfn><code>icon</code></dfn>"</h5>
- <p>The <code id=rel-icon:rel-icon><a href=#rel-icon>icon</a></code> keyword may be used with <code id=rel-icon:the-link-element><a href=#the-link-element>link</a></code> elements.
- This keyword creates an <a href=#external-resource-link id=rel-icon:external-resource-link>external resource link</a>.</p>
-
- <p>The specified resource is an icon representing the page or site, and should be used by the user
- agent when representing the page in the user interface.</p>
-
- <p>Icons could be auditory icons, visual icons, or other kinds of icons. If
- multiple icons are provided, the user agent must select the most appropriate icon according to the
- <code id=rel-icon:attr-link-type><a href=#attr-link-type>type</a></code>, <code id=rel-icon:attr-link-media><a href=#attr-link-media>media</a></code>, and <code id=rel-icon:attr-link-sizes><a href=#attr-link-sizes>sizes</a></code> attributes. If there are multiple equally appropriate icons,
- user agents must use the last one declared in <a href=#tree-order id=rel-icon:tree-order>tree order</a> at the time that the user
- agent collected the list of icons. If the user agent tries to use an icon but that icon is
- determined, upon closer examination, to in fact be inappropriate (e.g. because it uses an
- unsupported format), then the user agent must try the next-most-appropriate icon as determined by
- the attributes.</p>
-
- <p class=note>User agents are not required to update icons when the list of icons changes, but
- are encouraged to do so.</p>
- <p>There is no default type for resources given by the <code id=rel-icon:rel-icon-2><a href=#rel-icon>icon</a></code> keyword.
- However, for the purposes of <a href=#concept-link-type-sniffing>determining the type of the
- resource</a>, user agents must expect the resource to be an image.</p>
-
- <p>The <dfn id=attr-link-sizes><code>sizes</code></dfn> attribute gives the sizes of icons
- for visual media. Its value, if present, is merely advisory. User agents may use the value to
- decide which icon(s) to use if multiple icons are available.</p>
- <p>If specified, the attribute must have a value that is an <a href=#unordered-set-of-unique-space-separated-tokens id=rel-icon:unordered-set-of-unique-space-separated-tokens>unordered set of unique
- space-separated tokens</a> which are <a href=#ascii-case-insensitive id=rel-icon:ascii-case-insensitive>ASCII case-insensitive</a>. Each value must be
- either an <a href=#ascii-case-insensitive id=rel-icon:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code id=rel-icon:attr-link-sizes-any><a href=#attr-link-sizes-any>any</a></code>", or a value that consists of two <a href=#valid-non-negative-integer id=rel-icon:valid-non-negative-integer>valid non-negative integers</a> that do not have a leading U+0030 DIGIT
- ZERO (0) character and that are separated by a single U+0078 LATIN SMALL LETTER X or U+0058 LATIN
- CAPITAL LETTER X character.</p>
- <p>The keywords represent icon sizes in raw pixels (as opposed to CSS pixels).</p>
- <p class=note>An icon that is 50 CSS pixels wide intended for displays with a device pixel
- density of two device pixels per CSS pixel (2x, 192dpi) would have a width of 100 raw pixels. This
- feature does not support indicating that a different resource is to be used for small
- high-resolution icons vs large low-resolution icons (e.g. 50×50 2x vs 100×100 1x).</p>
-
- <p>To parse and process the attribute's value, the user agent must first <a href=#split-a-string-on-spaces id=rel-icon:split-a-string-on-spaces>split the attribute's value on spaces</a>, and must then parse each resulting
- keyword to determine what it represents.</p>
-
- <p>The <dfn id=attr-link-sizes-any><code>any</code></dfn> keyword represents that the
- resource contains a scalable icon, e.g. as provided by an SVG image.</p>
-
- <p>Other keywords must be further parsed as follows to determine what they represent:</p>
- <ul><li><p>If the keyword doesn't contain exactly one U+0078 LATIN SMALL LETTER X or U+0058 LATIN
- CAPITAL LETTER X character, then this keyword doesn't represent anything. Abort these steps for
- that keyword.<li><p>Let <var>width string</var> be the string before the "<code>x</code>" or
- "<code>X</code>".<li><p>Let <var>height string</var> be the string after the "<code>x</code>" or
- "<code>X</code>".<li><p>If either <var>width string</var> or <var>height string</var> start with
- a U+0030 DIGIT ZERO (0) character or contain any characters other than <a href=#ascii-digits id=rel-icon:ascii-digits>ASCII digits</a>,
- then this keyword doesn't represent anything. Abort these steps for that keyword.<li><p>Apply the <a href=#rules-for-parsing-non-negative-integers id=rel-icon:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to <var>width
- string</var> to obtain <var>width</var>.<li><p>Apply the <a href=#rules-for-parsing-non-negative-integers id=rel-icon:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> to <var>height
- string</var> to obtain <var>height</var>.<li><p>The keyword represents that the resource contains a bitmap icon with a width of <var>width</var> device pixels and a height of <var>height</var> device
- pixels.</ul>
-
- <p>The keywords specified on the <code id=rel-icon:attr-link-sizes-2><a href=#attr-link-sizes>sizes</a></code> attribute must not
- represent icon sizes that are not actually available in the linked resource.</p>
-
- <p>In the absence of a <code id=rel-icon:the-link-element-2><a href=#the-link-element>link</a></code> with the <code id=rel-icon:rel-icon-3><a href=#rel-icon>icon</a></code> keyword, for
- <code id=rel-icon:document><a href=#document>Document</a></code>s obtained over HTTP or HTTPS, user agents may instead attempt to
- <a href=#fetch id=rel-icon:fetch>fetch</a> and use an icon with the <a href=#absolute-url id=rel-icon:absolute-url>absolute URL</a> obtained by
- resolving the <a href=#url id=rel-icon:url>URL</a> "<code>/favicon.ico</code>" against <a id="rel-icon:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's
- address</a>, as if the page had declared that icon using the <code id=rel-icon:rel-icon-4><a href=#rel-icon>icon</a></code>
- keyword.</p>
-
- <div class=example>
- <p>The following snippet shows the top part of an application with several icons.</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>lsForums — Inbox</title>
- <link rel=icon href=favicon.png sizes="16x16" type="image/png">
- <link rel=icon href=windows.ico sizes="32x32 48x48" type="image/vnd.microsoft.icon">
- <link rel=icon href=mac.icns sizes="128x128 512x512 8192x8192 32768x32768">
- <link rel=icon href=iphone.png sizes="57x57" type="image/png">
- <link rel=icon href=gnome.svg sizes="any" type="image/svg+xml">
- <link rel=stylesheet href=lsforums.css>
- <script src=lsforums.js></script>
- <meta name=application-name content="lsForums">
- </head>
- <body>
- ...</pre>
- </div>
- <p>For historical reasons, the <code id=rel-icon:rel-icon-5><a href=#rel-icon>icon</a></code> keyword may be preceded by the
- keyword "<code>shortcut</code>". If the "<code>shortcut</code>" keyword is
- present, the <code id=rel-icon:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> attribute's entire value must be an
- <a href=#ascii-case-insensitive id=rel-icon:ascii-case-insensitive-3>ASCII case-insensitive</a> match for the string "<code>shortcut icon</code>" (with a single U+0020 SPACE character between the tokens and
- no other <a href=#space-character id=rel-icon:space-character>space characters</a>).</p>
- <h5 id=link-type-license>4.6.5.7 Link type "<dfn><code>license</code></dfn>"</h5>
- <p>The <code id=link-type-license:link-type-license><a href=#link-type-license>license</a></code> keyword may be used with <code id=link-type-license:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-license:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-license:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-license:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-license:link-type-license-2><a href=#link-type-license>license</a></code> keyword indicates that the referenced document
- provides the copyright license terms under which the main content of the current document is
- provided.</p>
- <p>This specification does not specify how to distinguish between the main content of a document
- and content that is not deemed to be part of that main content. The distinction should be made
- clear to the user.</p>
- <div class=example>
- <p>Consider a photo sharing site. A page on that site might describe and show a photograph, and
- the page might be marked up as follows:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Exampl Pictures: Kissat</title>
- <link rel="stylesheet" href="/style/default">
- </head>
- <body>
- <h1>Kissat</h1>
- <nav>
- <a href="../">Return to photo index</a>
- </nav>
- <figure>
- <img src="/pix/39627052_fd8dcd98b5.jpg">
- <figcaption>Kissat</figcaption>
- </figure>
- <p>One of them has six toes!</p>
- <p><small><a rel="license" href="http://www.opensource.org/licenses/mit-license.php">MIT Licensed</a></small></p>
- <footer>
- <a href="/">Home</a> | <a href="../">Photo index</a>
- <p><small>© copyright 2009 Exampl Pictures. All Rights Reserved.</small></p>
- </footer>
- </body>
- </html></pre>
- <p>In this case the <code id=link-type-license:link-type-license-3><a href=#link-type-license>license</a></code> applies to just the photo (the main
- content of the document), not the whole document. In particular not the design of the page
- itself, which is covered by the copyright given at the bottom of the document. This could be made
- clearer in the styling (e.g. making the license link prominently positioned near the photograph,
- while having the page copyright in light small text at the foot of the page.</p>
- </div>
-
- <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat the keyword
- "<code>copyright</code>" like the <code id=link-type-license:link-type-license-4><a href=#link-type-license>license</a></code> keyword.</p>
-
- <h5 id=link-type-nofollow>4.6.5.8 Link type "<dfn><code>nofollow</code></dfn>"</h5>
- <p>The <code id=link-type-nofollow:link-type-nofollow><a href=#link-type-nofollow>nofollow</a></code> keyword may be used with <code id=link-type-nofollow:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=link-type-nofollow:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword does not create a <a href=#hyperlink id=link-type-nofollow:hyperlink>hyperlink</a>, but <a href=#hyperlink-annotation id=link-type-nofollow:hyperlink-annotation>annotates</a> any other hyperlinks created by the element (the
- implied hyperlink, if no other keywords create one).</p>
- <p>The <code id=link-type-nofollow:link-type-nofollow-2><a href=#link-type-nofollow>nofollow</a></code> keyword indicates that the link is not endorsed
- by the original author or publisher of the page, or that the link to the referenced document was
- included primarily because of a commercial relationship between people affiliated with the two
- pages.</p>
- <h5 id=link-type-noreferrer>4.6.5.9 Link type "<dfn><code>noreferrer</code></dfn>"</h5>
- <p>The <code id=link-type-noreferrer:link-type-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword may be used with <code id=link-type-noreferrer:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=link-type-noreferrer:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword does not create a <a href=#hyperlink id=link-type-noreferrer:hyperlink>hyperlink</a>, but <a href=#hyperlink-annotation id=link-type-noreferrer:hyperlink-annotation>annotates</a> any other hyperlinks created by the element (the
- implied hyperlink, if no other keywords create one).</p>
- <p>It indicates that no referrer information is to be leaked when following the link.</p>
-
- <p>If a user agent follows a link defined by an <code id=link-type-noreferrer:the-a-element-2><a href=#the-a-element>a</a></code> or <code id=link-type-noreferrer:the-area-element-2><a href=#the-area-element>area</a></code> element that
- has the <code id=link-type-noreferrer:link-type-noreferrer-2><a href=#link-type-noreferrer>noreferrer</a></code> keyword, the user agent must not include a
- <code id=link-type-noreferrer:http-referer><a href=#http-referer>Referer</a></code> (sic) HTTP header (<a href=#concept-http-equivalent-headers id=link-type-noreferrer:concept-http-equivalent-headers>or equivalent</a> for other protocols) in the
- request.</p>
- <p>This keyword also <a href=#noopener>causes the <code>opener</code>
- attribute to remain null</a> if the hyperlink creates a new <a href=#browsing-context id=link-type-noreferrer:browsing-context>browsing context</a>.</p>
-
-
- <h5 id=link-type-pingback>4.6.5.10 Link type "<dfn><code>pingback</code></dfn>"</h5>
- <p>The <code id=link-type-pingback:link-type-pingback><a href=#link-type-pingback>pingback</a></code> keyword may be used with <code id=link-type-pingback:the-link-element><a href=#the-link-element>link</a></code>
- elements. This keyword creates an <a href=#external-resource-link id=link-type-pingback:external-resource-link>external resource
- link</a>.</p>
- <p>For the semantics of the <code id=link-type-pingback:link-type-pingback-2><a href=#link-type-pingback>pingback</a></code> keyword, see the Pingback
- 1.0 specification. <a href=#refsPINGBACK>[PINGBACK]</a></p>
- <h5 id=link-type-prefetch>4.6.5.11 Link type "<dfn><code>prefetch</code></dfn>"</h5>
- <p>The <code id=link-type-prefetch:link-type-prefetch><a href=#link-type-prefetch>prefetch</a></code> keyword may be used with <code id=link-type-prefetch:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-prefetch:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-prefetch:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates an <a href=#external-resource-link id=link-type-prefetch:external-resource-link>external resource link</a>.</p>
- <p>The <code id=link-type-prefetch:link-type-prefetch-2><a href=#link-type-prefetch>prefetch</a></code> keyword indicates that preemptively fetching and
- caching the specified resource is likely to be beneficial, as it is highly likely that the user
- will require this resource.</p>
- <p>There is no default type for resources given by the <code id=link-type-prefetch:link-type-prefetch-3><a href=#link-type-prefetch>prefetch</a></code>
- keyword.</p>
- <h5 id=link-type-search>4.6.5.12 Link type "<dfn><code>search</code></dfn>"</h5>
- <p>The <code id=link-type-search:link-type-search><a href=#link-type-search>search</a></code> keyword may be used with <code id=link-type-search:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-search:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-search:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-search:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-search:link-type-search-2><a href=#link-type-search>search</a></code> keyword indicates that the referenced document
- provides an interface specifically for searching the document and its related resources.</p>
- <p class=note>OpenSearch description documents can be used with <code id=link-type-search:the-link-element-2><a href=#the-link-element>link</a></code> elements and
- the <code id=link-type-search:link-type-search-3><a href=#link-type-search>search</a></code> link type to enable user agents to autodiscover search
- interfaces. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>
- <h5 id=link-type-sidebar>4.6.5.13 Link type "<dfn><code>sidebar</code></dfn>"</h5>
- <p>The <code id=link-type-sidebar:link-type-sidebar><a href=#link-type-sidebar>sidebar</a></code> keyword may be used with <code id=link-type-sidebar:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-sidebar:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-sidebar:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-sidebar:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-sidebar:link-type-sidebar-2><a href=#link-type-sidebar>sidebar</a></code> keyword indicates that the referenced document, if
- retrieved, is intended to be shown in a <a href=#secondary-browsing-context id=link-type-sidebar:secondary-browsing-context>secondary browsing context</a> (if possible),
- instead of in the current <a href=#browsing-context id=link-type-sidebar:browsing-context>browsing context</a>.</p>
- <p>A <a href=#hyperlink id=link-type-sidebar:hyperlink-2>hyperlink</a> with the <code id=link-type-sidebar:link-type-sidebar-3><a href=#link-type-sidebar>sidebar</a></code> keyword specified is
- a <dfn id=rel-sidebar-hyperlink>sidebar hyperlink</dfn>.</p>
- <h5 id=link-type-stylesheet>4.6.5.14 Link type "<dfn><code>stylesheet</code></dfn>"</h5>
- <p>The <code id=link-type-stylesheet:link-type-stylesheet><a href=#link-type-stylesheet>stylesheet</a></code> keyword may be used with <code id=link-type-stylesheet:the-link-element><a href=#the-link-element>link</a></code>
- elements. This keyword creates an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link>external resource
- link</a> that contributes to the styling processing model.</p>
- <p>The specified resource is a resource that describes how to present the document. Exactly how
- the resource is to be processed depends on the actual type of the resource.</p>
- <p>If the <code id=link-type-stylesheet:rel-alternate><a href=#rel-alternate>alternate</a></code> keyword is also specified on the
- <code id=link-type-stylesheet:the-link-element-2><a href=#the-link-element>link</a></code> element, then <dfn id=the-link-is-an-alternative-stylesheet>the link is an alternative stylesheet</dfn>; in this case,
- the <code id=link-type-stylesheet:attr-title><a href=#attr-title>title</a></code> attribute must be specified on the <code id=link-type-stylesheet:the-link-element-3><a href=#the-link-element>link</a></code>
- element, with a non-empty value.</p>
- <p>The default type for resources given by the <code id=link-type-stylesheet:link-type-stylesheet-2><a href=#link-type-stylesheet>stylesheet</a></code>
- keyword is <code>text/css</code>.</p>
-
- <p>The appropriate times to <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain>obtain</a> the resource are:
- <ul><li><p>When the <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-2>external resource link</a> is created on a <code id=link-type-stylesheet:the-link-element-4><a href=#the-link-element>link</a></code> element
- that is already <a href=#in-a-document id=link-type-stylesheet:in-a-document>in a <code>Document</code></a>.<li><p>When the <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-3>external resource link</a>'s <code id=link-type-stylesheet:the-link-element-5><a href=#the-link-element>link</a></code> element is <a href=#insert-an-element-into-a-document id=link-type-stylesheet:insert-an-element-into-a-document>inserted into a document</a>.<li><p>When the <code id=link-type-stylesheet:attr-link-href><a href=#attr-link-href>href</a></code> attribute of the <code id=link-type-stylesheet:the-link-element-6><a href=#the-link-element>link</a></code>
- element of an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-4>external resource link</a> that is already <a href=#in-a-document id=link-type-stylesheet:in-a-document-2>in a
- <code>Document</code></a> is changed.<li><p>When the <code id=link-type-stylesheet:attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code> attribute of the
- <code id=link-type-stylesheet:the-link-element-7><a href=#the-link-element>link</a></code> element of an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-5>external resource
- link</a> that is already <a href=#in-a-document id=link-type-stylesheet:in-a-document-3>in a <code>Document</code></a> is set, changed, or
- removed.<li><p>When the <code id=link-type-stylesheet:attr-link-type><a href=#attr-link-type>type</a></code> attribute of the <code id=link-type-stylesheet:the-link-element-8><a href=#the-link-element>link</a></code>
- element of an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-6>external resource link</a> that is already <a href=#in-a-document id=link-type-stylesheet:in-a-document-4>in a
- <code>Document</code></a> is set or changed to a value that does not or no longer matches the
- <a href=#content-type id=link-type-stylesheet:content-type>Content-Type metadata</a> of the previous obtained external
- resource, if any.<li><p>When the <code id=link-type-stylesheet:attr-link-type-2><a href=#attr-link-type>type</a></code> attribute of the <code id=link-type-stylesheet:the-link-element-9><a href=#the-link-element>link</a></code>
- element of an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-7>external resource link</a> that is already <a href=#in-a-document id=link-type-stylesheet:in-a-document-5>in a
- <code>Document</code></a> but was previously not obtained due to the <code id=link-type-stylesheet:attr-link-type-3><a href=#attr-link-type>type</a></code> attribute specifying an unsupported type is set, removed, or
- changed.<li><p>When the <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-8>external resource link</a> changes from being <a href=#the-link-is-an-alternative-stylesheet id=link-type-stylesheet:the-link-is-an-alternative-stylesheet>an alternative stylesheet</a> to not being one, or vice
- versa.</ul>
- <p><strong>Quirk</strong>: If the document has been set to <a href=#quirks-mode id=link-type-stylesheet:quirks-mode>quirks mode</a>, has the
- <a href=#same-origin id=link-type-stylesheet:same-origin>same origin</a> as the <a href=#url id=link-type-stylesheet:url>URL</a> of the external resource,
- and the <a href=#content-type id=link-type-stylesheet:content-type-2>Content-Type metadata</a> of the external resource is not a
- supported style sheet type, the user agent must instead assume it to be <code>text/css</code>.</p>
- <p>Once a resource has been <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain-2>obtained</a>, if its <a href=#content-type id=link-type-stylesheet:content-type-3>Content-Type metadata</a> is <code>text/css</code>, the user
- agent must run these steps:</p>
-
-
- <ol><li><p>Let <var>element</var> be the <code id=link-type-stylesheet:the-link-element-10><a href=#the-link-element>link</a></code> element that created the
- <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-9>external resource link</a>.<li><p>If <var>element</var> has an <a href=#associated-css-style-sheet id=link-type-stylesheet:associated-css-style-sheet>associated CSS style sheet</a>, <a href=#remove-a-css-style-sheet id=link-type-stylesheet:remove-a-css-style-sheet>remove the CSS style sheet</a> in question.<li><p>If <var>element</var> no longer creates an <a href=#external-resource-link id=link-type-stylesheet:external-resource-link-10>external resource link</a>
- that contributes to the styling processing model, or if, since the resource in question was <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain-3>obtained</a>, it has become appropriate to <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain-4>obtain</a> it again (meaning this algorithm is about to be
- invoked again for a newly obtained resource), then abort these steps.<li>
- <p><a href=#create-a-css-style-sheet id=link-type-stylesheet:create-a-css-style-sheet>Create a CSS style sheet</a> with the following properties:</p>
- <dl><dt><a href=#concept-css-style-sheet-type id=link-type-stylesheet:concept-css-style-sheet-type>type</a><dd><p><code>text/css</code><dt><a href=#concept-css-style-sheet-location id=link-type-stylesheet:concept-css-style-sheet-location>location</a><dd>
- <p>The <a href=#resulting-absolute-url id=link-type-stylesheet:resulting-absolute-url>resulting absolute URL</a> determined during the <a href=#concept-link-obtain id=link-type-stylesheet:concept-link-obtain-5>obtain</a> algorithm.</p>
- <p class=note>This is before any redirects get applied.</p>
- <dt><a href=#concept-css-style-sheet-owner-node id=link-type-stylesheet:concept-css-style-sheet-owner-node>owner node</a><dd><p><var>element</var><dt><a href=#concept-css-style-sheet-media id=link-type-stylesheet:concept-css-style-sheet-media>media</a><dd>
- <p>The <code id=link-type-stylesheet:attr-link-media><a href=#attr-link-media>media</a></code> attribute of <var>element</var>.</p>
- <p class=note>This is a reference to the (possibly absent at this time) attribute, rather
- than a copy of the attribute's current value. The CSSOM specification defines what happens
- when the attribute is dynamically set, changed, or removed.</p>
- <dt><a href=#concept-css-style-sheet-title id=link-type-stylesheet:concept-css-style-sheet-title>title</a><dd>
- <p>The <code id=link-type-stylesheet:attr-link-title><a href=#attr-link-title>title</a></code> attribute of <var>element</var>.</p>
- <p class=note>This is similarly a reference to the attribute, rather than a copy of the
- attribute's current value.</p>
- <dt><a href=#concept-css-style-sheet-alternate-flag id=link-type-stylesheet:concept-css-style-sheet-alternate-flag>alternate flag</a><dd><p>Set if <a href=#the-link-is-an-alternative-stylesheet id=link-type-stylesheet:the-link-is-an-alternative-stylesheet-2>the link is an alternative stylesheet</a>; unset otherwise.<dt><a href=#concept-css-style-sheet-origin-clean-flag id=link-type-stylesheet:concept-css-style-sheet-origin-clean-flag>origin-clean flag</a><dd><p>Set if the resource is <a href=#cors-same-origin id=link-type-stylesheet:cors-same-origin>CORS-same-origin</a>; unset otherwise.<dt><a href=#concept-css-style-sheet-parent-css-style-sheet id=link-type-stylesheet:concept-css-style-sheet-parent-css-style-sheet>parent CSS style sheet</a><dt><a href=#concept-css-style-sheet-owner-css-rule id=link-type-stylesheet:concept-css-style-sheet-owner-css-rule>owner CSS rule</a><dd><p>null<dt><a href=#concept-css-style-sheet-disabeld-flag id=link-type-stylesheet:concept-css-style-sheet-disabeld-flag>disabled flag</a><dd><p>Left at its default value.<dt><a href=#concept-css-style-sheet-css-rules id=link-type-stylesheet:concept-css-style-sheet-css-rules>CSS rules</a><dd><p>Left uninitialized.</dl>
- <p>The CSS <a href=#environment-encoding id=link-type-stylesheet:environment-encoding>environment encoding</a> is the result of running the following steps: <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a></p>
- <ol><li><p>If the element has a <code id=link-type-stylesheet:attr-link-charset><a href=#attr-link-charset>charset</a></code> attribute, <a href=http://encoding.spec.whatwg.org/#concept-encoding-get id=link-type-stylesheet:getting-an-encoding data-x-internal=getting-an-encoding>get an encoding</a> from that attribute's value. If that
- succeeds, return the resulting encoding and abort these steps. <a href=#refsENCODING>[ENCODING]</a><li><p>Otherwise, return the <a href="#document's-character-encoding" id="link-type-stylesheet:document's-character-encoding">document's character encoding</a>. <a href=#refsDOM>[DOM]</a></ol>
- </ol>
-
- <h5 id=link-type-tag>4.6.5.15 Link type "<dfn><code>tag</code></dfn>"</h5>
- <p>The <code id=link-type-tag:link-type-tag><a href=#link-type-tag>tag</a></code> keyword may be used with <code id=link-type-tag:the-a-element><a href=#the-a-element>a</a></code> and
- <code id=link-type-tag:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-tag:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-tag:link-type-tag-2><a href=#link-type-tag>tag</a></code> keyword indicates that the <em>tag</em> that the
- referenced document represents applies to the current document.</p>
- <p class=note>Since it indicates that the tag <em>applies to the current document</em>, it would
- be inappropriate to use this keyword in the markup of a <a href=#tag-cloud>tag cloud</a>, which
- lists the popular tags across a set of pages.</p>
- <div class=example>
- <p>This document is about some gems, and so it is <i>tagged</i> with "<code>http://en.wikipedia.org/wiki/Gemstone</code>" to unambiguously categorise it as applying
- to the "jewel" kind of gems, and not to, say, the towns in the US, the Ruby package format, or
- the Swiss locomotive class:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>My Precious</title>
- </head>
- <body>
- <header><h1>My precious</h1> <p>Summer 2012</p></header>
- <p>Recently I managed to dispose of a red gem that had been
- bothering me. I now have a much nicer blue sapphire.</p>
- <p>The red gem had been found in a bauxite stone while I was digging
- out the office level, but nobody was willing to haul it away. The
- same red gem stayed there for literally years.</p>
- <footer>
- Tags: <a rel=tag href="http://en.wikipedia.org/wiki/Gemstone">Gemstone</a>
- </footer>
- </body>
- </html></pre>
- </div>
- <div class=example>
- <p>In <em>this</em> document, there are two articles. The "<code id=link-type-tag:link-type-tag-3><a href=#link-type-tag>tag</a></code>"
- link, however, applies to the whole page (and would do so wherever it was placed, including if it
- was within the <code id=link-type-tag:the-article-element><a href=#the-article-element>article</a></code> elements).</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Gem 4/4</title>
- </head>
- <body>
- <article>
- <h1>801: Steinbock</h1>
- <p>The number 801 Gem 4/4 electro-diesel has an ibex and was rebuilt in 2002.</p>
- </article>
- <article>
- <h1>802: Murmeltier</h1>
- <figure>
- <img src="http://upload.wikimedia.org/wikipedia/commons/b/b0/Trains_de_la_Bernina_en_hiver_2.jpg"
- alt="The 802 was red with pantographs and tall vents on the side.">
- <figcaption>The 802 in the 1980s, above Lago Bianco.</figcaption>
- </figure>
- <p>The number 802 Gem 4/4 electro-diesel has a marmot and was rebuilt in 2003.</p>
- </article>
- <p class="topic"><a rel=tag href="http://en.wikipedia.org/wiki/Rhaetian_Railway_Gem_4/4">Gem 4/4</a></p>
- </body>
- </html></pre>
- </div>
- <h5 id=sequential-link-types>4.6.5.16 Sequential link types</h5>
- <p>Some documents form part of a sequence of documents.</p>
- <p>A sequence of documents is one where each document can have a <em>previous sibling</em> and a
- <em>next sibling</em>. A document with no previous sibling is the start of its sequence, a
- document with no next sibling is the end of its sequence.</p>
- <p>A document may be part of multiple sequences.</p>
- <h6 id=link-type-next>4.6.5.16.1 Link type "<dfn><code>next</code></dfn>"</h6>
- <p>The <code id=link-type-next:link-type-next><a href=#link-type-next>next</a></code> keyword may be used with <code id=link-type-next:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-next:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-next:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-next:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-next:link-type-next-2><a href=#link-type-next>next</a></code> keyword indicates that the document is part of a
- sequence, and that the link is leading to the document that is the next logical document in the
- sequence.</p>
- <h6 id=link-type-prev>4.6.5.16.2 Link type "<dfn><code>prev</code></dfn>"</h6>
- <p>The <code id=link-type-prev:link-type-prev><a href=#link-type-prev>prev</a></code> keyword may be used with <code id=link-type-prev:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=link-type-prev:the-a-element><a href=#the-a-element>a</a></code>, and <code id=link-type-prev:the-area-element><a href=#the-area-element>area</a></code> elements. This keyword creates a <a href=#hyperlink id=link-type-prev:hyperlink>hyperlink</a>.</p>
- <p>The <code id=link-type-prev:link-type-prev-2><a href=#link-type-prev>prev</a></code> keyword indicates that the document is part of a
- sequence, and that the link is leading to the document that is the previous logical document in
- the sequence.</p>
-
- <p><strong>Synonyms</strong>: For historical reasons, user agents must also treat the keyword
- "<code>previous</code>" like the <code id=link-type-prev:link-type-prev-3><a href=#link-type-prev>prev</a></code> keyword.</p>
-
- <h5 id=other-link-types>4.6.5.17 Other link types</h5>
- <p><dfn id=concept-rel-extensions>Extensions to the predefined set of link types</dfn> may be
- registered in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats
- wiki existing-rel-values page</a>. <a href=#refsMFREL>[MFREL]</a></p>
- <p>Anyone is free to edit the <span>microformats wiki existing-rel-values page</span> at
- any time to add a type. Extension types must be specified with the following information:</p>
- <dl><dt>Keyword<dd>
- <p>The actual value being defined. The value should not be confusingly similar to any other
- defined value (e.g. differing only in case).</p>
- <p>If the value contains a U+003A COLON character (:), it must also be an <a href=#absolute-url id=other-link-types:absolute-url>absolute
- URL</a>.</p>
- <dt>Effect on... <code id=other-link-types:the-link-element><a href=#the-link-element>link</a></code><dd>
- <p>One of the following:</p>
- <dl><dt>Not allowed<dd>The keyword must not be specified on <code id=other-link-types:the-link-element-2><a href=#the-link-element>link</a></code> elements.<dt>Hyperlink<dd>The keyword may be specified on a <code id=other-link-types:the-link-element-3><a href=#the-link-element>link</a></code> element; it creates a
- <a href=#hyperlink id=other-link-types:hyperlink>hyperlink</a>.<dt>External Resource<dd>The keyword may be specified on a <code id=other-link-types:the-link-element-4><a href=#the-link-element>link</a></code> element; it creates an <a href=#external-resource-link id=other-link-types:external-resource-link>external
- resource link</a>.</dl>
- <dt>Effect on... <code id=other-link-types:the-a-element><a href=#the-a-element>a</a></code> and <code id=other-link-types:the-area-element><a href=#the-area-element>area</a></code><dd>
- <p>One of the following:</p>
- <dl><dt>Not allowed<dd>The keyword must not be specified on <code id=other-link-types:the-a-element-2><a href=#the-a-element>a</a></code> and <code id=other-link-types:the-area-element-2><a href=#the-area-element>area</a></code> elements.<dt>Hyperlink<dd>The keyword may be specified on <code id=other-link-types:the-a-element-3><a href=#the-a-element>a</a></code> and <code id=other-link-types:the-area-element-3><a href=#the-area-element>area</a></code> elements; it creates a
- <a href=#hyperlink id=other-link-types:hyperlink-2>hyperlink</a>.<dt>External Resource<dd>The keyword may be specified on <code id=other-link-types:the-a-element-4><a href=#the-a-element>a</a></code> and <code id=other-link-types:the-area-element-4><a href=#the-area-element>area</a></code> elements; it creates
- an <a href=#external-resource-link id=other-link-types:external-resource-link-2>external resource link</a>.<dt>Hyperlink Annotation<dd>The keyword may be specified on <code id=other-link-types:the-a-element-5><a href=#the-a-element>a</a></code> and <code id=other-link-types:the-area-element-5><a href=#the-area-element>area</a></code> elements; it <a href=#hyperlink-annotation id=other-link-types:hyperlink-annotation>annotates</a> other <a href=#hyperlink id=other-link-types:hyperlink-3>hyperlinks</a>
- created by the element.</dl>
- <dt>Brief description<dd><p>A short non-normative description of what the keyword's meaning is.<dt>Specification<dd><p>A link to a more detailed description of the keyword's semantics and requirements. It
- could be another page on the Wiki, or a link to an external page.<dt>Synonyms<dd><p>A list of other keyword values that have exactly the same processing requirements. Authors
- should not use the values defined to be synonyms, they are only intended to allow user agents to
- support legacy content. Anyone may remove synonyms that are not used in practice; only names that
- need to be processed as synonyms for compatibility with legacy content are to be registered in
- this way.<dt>Status<dd>
- <p>One of the following:</p>
- <dl><dt>Proposed<dd>The keyword has not received wide peer review and approval. Someone has proposed it and is,
- or soon will be, using it.<dt>Ratified<dd>The keyword has received wide peer review and approval. It has a specification that
- unambiguously defines how to handle pages that use the keyword, including when they use it in
- incorrect ways.<dt>Discontinued<dd>The keyword has received wide peer review and it has been found wanting. Existing pages are
- using this keyword, but new pages should avoid it. The "brief description" and "specification"
- entries will give details of what authors should use instead, if anything.</dl>
- <p>If a keyword is found to be redundant with existing values, it should be removed and listed
- as a synonym for the existing value.</p>
- <p>If a keyword is registered in the "proposed" state for a period of a month or more without
- being used or specified, then it may be removed from the registry.</p>
- <p>If a keyword is added with the "proposed" status and found to be redundant with existing
- values, it should be removed and listed as a synonym for the existing value. If a keyword is
- added with the "proposed" status and found to be harmful, then it should be changed to
- "discontinued" status.</p>
- <p>Anyone can change the status at any time, but should only do so in accordance with the
- definitions above.</p>
- </dl>
-
- <p>Conformance checkers must use the information given on the <span>microformats wiki
- existing-rel-values page</span> to establish if a value is allowed or not: values defined in this
- specification or marked as "proposed" or "ratified" must be accepted when used on the elements for
- which they apply as described in the "Effect on..." field, whereas values marked as "discontinued"
- or not listed in either this specification or on the aforementioned page must be rejected as
- invalid. Conformance checkers may cache this information (e.g. for performance reasons or to avoid
- the use of unreliable network connectivity).</p>
- <p>When an author uses a new type not defined by either this specification or the Wiki page,
- conformance checkers should offer to add the value to the Wiki, with the details described above,
- with the "proposed" status.</p>
-
- <p>Types defined as extensions in the <a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>microformats
- wiki existing-rel-values page</a> with the status "proposed" or "ratified" may be used with the
- <code>rel</code> attribute on <code id=other-link-types:the-link-element-5><a href=#the-link-element>link</a></code>, <code id=other-link-types:the-a-element-6><a href=#the-a-element>a</a></code>, and <code id=other-link-types:the-area-element-6><a href=#the-area-element>area</a></code>
- elements in accordance to the "Effect on..." field. <a href=#refsMFREL>[MFREL]</a></p>
- <h3 id=edits>4.7 Edits</h3>
- <p>The <code id=edits:the-ins-element><a href=#the-ins-element>ins</a></code> and <code id=edits:the-del-element><a href=#the-del-element>del</a></code> elements represent edits to the document.</p>
- <h4 id=the-ins-element>4.7.1 The <dfn><code>ins</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-ins-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-ins-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-ins-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-ins-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-ins-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-ins-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-ins-element:concept-element-content-model>Content model</a>:<dd><a href=#transparent id=the-ins-element:transparent>Transparent</a>.<dt><a href=#concept-element-tag-omission id=the-ins-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-ins-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-ins-element:global-attributes>Global attributes</a><dd><code id=the-ins-element:attr-mod-cite><a href=#attr-mod-cite>cite</a></code> — Link to the source of the quotation or more information about the edit<dd><code id=the-ins-element:attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> — Date and (optionally) time of the change<dt><a href=#concept-element-dom id=the-ins-element:concept-element-dom>DOM interface</a>:<dd>Uses the <code id=the-ins-element:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dl>
- <p>The <code id=the-ins-element:the-ins-element><a href=#the-ins-element>ins</a></code> element <a href=#represents id=the-ins-element:represents>represents</a> an addition to the document.</p>
- <div class=example>
- <p>The following represents the addition of a single paragraph:</p>
- <pre><aside>
- <ins>
- <p> I like fruit. </p>
- </ins>
- </aside></pre>
- <p>As does the following, because everything in the <code id=the-ins-element:the-aside-element><a href=#the-aside-element>aside</a></code> element here counts as
- <a href=#phrasing-content-2 id=the-ins-element:phrasing-content-2-3>phrasing content</a> and therefore there is just one <a href=#paragraph id=the-ins-element:paragraph>paragraph</a>:</p>
- <pre><aside>
- <ins>
- Apples are <em>tasty</em>.
- </ins>
- <ins>
- So are pears.
- </ins>
- </aside></pre>
- </div>
- <p><code id=the-ins-element:the-ins-element-2><a href=#the-ins-element>ins</a></code> elements should not cross <a href=#paragraph id=the-ins-element:paragraph-2>implied paragraph</a>
- boundaries.</p>
- <div class=example>
- <p>The following example represents the addition of two paragraphs, the second of which was
- inserted in two parts. The first <code id=the-ins-element:the-ins-element-3><a href=#the-ins-element>ins</a></code> element in this example thus crosses a
- paragraph boundary, which is considered poor form.</p>
- <pre class=bad><aside>
- <!-- don't do this -->
- <ins datetime="2005-03-16 00:00Z">
- <p> I like fruit. </p>
- Apples are <em>tasty</em>.
- </ins>
- <ins datetime="2007-12-19 00:00Z">
- So are pears.
- </ins>
- </aside></pre>
- <p>Here is a better way of marking this up. It uses more elements, but none of the elements cross
- implied paragraph boundaries.</p>
- <pre><aside>
- <ins datetime="2005-03-16 00:00Z">
- <p> I like fruit. </p>
- </ins>
- <ins datetime="2005-03-16 00:00Z">
- Apples are <em>tasty</em>.
- </ins>
- <ins datetime="2007-12-19 00:00Z">
- So are pears.
- </ins>
- </aside></pre>
-
- </div>
- <h4 id=the-del-element>4.7.2 The <dfn><code>del</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-del-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-del-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-del-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-del-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-del-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-del-element:concept-element-content-model>Content model</a>:<dd><a href=#transparent id=the-del-element:transparent>Transparent</a>.<dt><a href=#concept-element-tag-omission id=the-del-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-del-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-del-element:global-attributes>Global attributes</a><dd><code id=the-del-element:attr-mod-cite><a href=#attr-mod-cite>cite</a></code> — Link to the source of the quotation or more information about the edit<dd><code id=the-del-element:attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> — Date and (optionally) time of the change<dt><a href=#concept-element-dom id=the-del-element:concept-element-dom>DOM interface</a>:<dd>Uses the <code id=the-del-element:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> interface.</dl>
- <p>The <code id=the-del-element:the-del-element><a href=#the-del-element>del</a></code> element <a href=#represents id=the-del-element:represents>represents</a> a removal from the document.</p>
- <p><code id=the-del-element:the-del-element-2><a href=#the-del-element>del</a></code> elements should not cross <a href=#paragraph id=the-del-element:paragraph>implied paragraph</a>
- boundaries.</p>
- <div class=example>
- <p>The following shows a "to do" list where items that have been done are crossed-off with the
- date and time of their completion.</p>
- <pre><h1>To Do</h1>
- <ul>
- <li>Empty the dishwasher</li>
- <li><del datetime="2009-10-11T01:25-07:00">Watch Walter Lewin's lectures</del></li>
- <li><del datetime="2009-10-10T23:38-07:00">Download more tracks</del></li>
- <li>Buy a printer</li>
- </ul></pre>
- </div>
- <h4 id=attributes-common-to-ins-and-del-elements>4.7.3 Attributes common to <code id=attributes-common-to-ins-and-del-elements:the-ins-element><a href=#the-ins-element>ins</a></code> and <code id=attributes-common-to-ins-and-del-elements:the-del-element><a href=#the-del-element>del</a></code> elements</h4>
- <p>The <dfn id=attr-mod-cite><code>cite</code></dfn> attribute may be used to specify the
- address of a document that explains the change. When that document is long, for instance the
- minutes of a meeting, authors are encouraged to include a fragment identifier pointing to the
- specific part of that document that discusses the change.</p>
- <p>If the <code id=attributes-common-to-ins-and-del-elements:attr-mod-cite><a href=#attr-mod-cite>cite</a></code> attribute is present, it must be a <a href=#valid-url-potentially-surrounded-by-spaces id=attributes-common-to-ins-and-del-elements:valid-url-potentially-surrounded-by-spaces>valid
- URL potentially surrounded by spaces</a> that explains the change. To obtain
- the corresponding citation link, the value of the attribute must be <a href=#resolve-a-url id=attributes-common-to-ins-and-del-elements:resolve-a-url>resolved</a> relative to the element. User agents may allow users to follow such
- citation links, but they are primarily intended for private use (e.g. by server-side scripts
- collecting statistics about a site's edits), not for readers.</p>
- <p>The <dfn id=attr-mod-datetime><code>datetime</code></dfn> attribute may be used to specify
- the time and date of the change.</p>
- <p>If present, the <code id=attributes-common-to-ins-and-del-elements:attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code> attribute's value must be a
- <a href=#valid-date-string-with-optional-time id=attributes-common-to-ins-and-del-elements:valid-date-string-with-optional-time>valid date string with optional time</a>.</p>
-
- <p>User agents must parse the <code id=attributes-common-to-ins-and-del-elements:attr-mod-datetime-2><a href=#attr-mod-datetime>datetime</a></code> attribute according
- to the <a href=#parse-a-date-or-time-string id=attributes-common-to-ins-and-del-elements:parse-a-date-or-time-string>parse a date or time string</a> algorithm. If that doesn't return a <a href=#concept-date id=attributes-common-to-ins-and-del-elements:concept-date>date</a> or a <a href=#concept-datetime id=attributes-common-to-ins-and-del-elements:concept-datetime>global date and time</a>,
- then the modification has no associated timestamp (the value is non-conforming; it is not a
- <a href=#valid-date-string-with-optional-time id=attributes-common-to-ins-and-del-elements:valid-date-string-with-optional-time-2>valid date string with optional time</a>). Otherwise, the modification is marked as
- having been made at the given <a href=#concept-date id=attributes-common-to-ins-and-del-elements:concept-date-2>date</a> or <a href=#concept-datetime id=attributes-common-to-ins-and-del-elements:concept-datetime-2>global date and time</a>. If the given value is a <a href=#concept-datetime id=attributes-common-to-ins-and-del-elements:concept-datetime-3>global date and time</a> then user agents should use the associated
- time-zone offset information to determine which time zone to present the given datetime in.</p>
-
- <p>This value may be shown to the user, but it is primarily intended for
- private use.</p>
- <p>The <code id=attributes-common-to-ins-and-del-elements:the-ins-element-2><a href=#the-ins-element>ins</a></code> and <code id=attributes-common-to-ins-and-del-elements:the-del-element-2><a href=#the-del-element>del</a></code> elements must implement the
- <code id=attributes-common-to-ins-and-del-elements:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> interface:</p>
- <pre class=idl>interface <dfn id=htmlmodelement>HTMLModElement</dfn> : <a href=#htmlelement id=attributes-common-to-ins-and-del-elements:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-mod-cite id=attributes-common-to-ins-and-del-elements:dom-mod-cite>cite</a>;
- attribute DOMString <a href=#dom-mod-datetime id=attributes-common-to-ins-and-del-elements:dom-mod-datetime>dateTime</a>;
- };</pre>
-
- <p>The <dfn id=dom-mod-cite><code>cite</code></dfn> IDL attribute must <a href=#reflect id=attributes-common-to-ins-and-del-elements:reflect>reflect</a>
- the element's <code id=attributes-common-to-ins-and-del-elements:attr-mod-cite-2><a href=#attr-mod-cite>cite</a></code> content attribute. The <dfn id=dom-mod-datetime><code>dateTime</code></dfn> IDL attribute must <a href=#reflect id=attributes-common-to-ins-and-del-elements:reflect-2>reflect</a> the
- element's <code id=attributes-common-to-ins-and-del-elements:attr-mod-datetime-3><a href=#attr-mod-datetime>datetime</a></code> content attribute.</p>
-
- <h4 id=edits-and-paragraphs>4.7.4 Edits and paragraphs</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Since the <code id=edits-and-paragraphs:the-ins-element><a href=#the-ins-element>ins</a></code> and <code id=edits-and-paragraphs:the-del-element><a href=#the-del-element>del</a></code> elements do not affect <a href=#paragraph id=edits-and-paragraphs:paragraph>paragraphing</a>, it is possible, in some cases where paragraphs are <a href=#paragraph id=edits-and-paragraphs:paragraph-2>implied</a> (without explicit <code id=edits-and-paragraphs:the-p-element><a href=#the-p-element>p</a></code> elements), for an
- <code id=edits-and-paragraphs:the-ins-element-2><a href=#the-ins-element>ins</a></code> or <code id=edits-and-paragraphs:the-del-element-2><a href=#the-del-element>del</a></code> element to span both an entire paragraph or other
- non-<a href=#phrasing-content-2 id=edits-and-paragraphs:phrasing-content-2>phrasing content</a> elements and part of another paragraph. For example:</p>
- <pre><section>
- <ins>
- <p>
- This is a paragraph that was inserted.
- </p>
- This is another paragraph whose first sentence was inserted
- at the same time as the paragraph above.
- </ins>
- This is a second sentence, which was there all along.
- </section></pre>
- <p>By only wrapping some paragraphs in <code id=edits-and-paragraphs:the-p-element-2><a href=#the-p-element>p</a></code> elements, one can even get the end of one
- paragraph, a whole second paragraph, and the start of a third paragraph to be covered by the same
- <code id=edits-and-paragraphs:the-ins-element-3><a href=#the-ins-element>ins</a></code> or <code id=edits-and-paragraphs:the-del-element-3><a href=#the-del-element>del</a></code> element (though this is very confusing, and not considered
- good practice):</p>
- <pre class=bad><section>
- This is the first paragraph. <ins>This sentence was
- inserted.
- <p>This second paragraph was inserted.</p>
- This sentence was inserted too.</ins> This is the
- third paragraph in this example.
- <!-- (don't do this) -->
- </section></pre>
- <p>However, due to the way <a href=#paragraph id=edits-and-paragraphs:paragraph-3>implied paragraphs</a> are defined, it is
- not possible to mark up the end of one paragraph and the start of the very next one using the same
- <code id=edits-and-paragraphs:the-ins-element-4><a href=#the-ins-element>ins</a></code> or <code id=edits-and-paragraphs:the-del-element-4><a href=#the-del-element>del</a></code> element. You instead have to use one (or two) <code id=edits-and-paragraphs:the-p-element-3><a href=#the-p-element>p</a></code>
- element(s) and two <code id=edits-and-paragraphs:the-ins-element-5><a href=#the-ins-element>ins</a></code> or <code id=edits-and-paragraphs:the-del-element-5><a href=#the-del-element>del</a></code> elements, as for example:</p>
- <pre><section>
- <p>This is the first paragraph. <del>This sentence was
- deleted.</del></p>
- <p><del>This sentence was deleted too.</del> That
- sentence needed a separate &lt;del&gt; element.</p>
- </section></pre>
- <p>Partly because of the confusion described above, authors are strongly encouraged to always mark
- up all paragraphs with the <code id=edits-and-paragraphs:the-p-element-4><a href=#the-p-element>p</a></code> element, instead of having <code id=edits-and-paragraphs:the-ins-element-6><a href=#the-ins-element>ins</a></code> or
- <code id=edits-and-paragraphs:the-del-element-6><a href=#the-del-element>del</a></code> elements that cross <a href=#paragraph id=edits-and-paragraphs:paragraph-4>implied paragraphs</a>
- boundaries.</p>
- <h4 id=edits-and-lists>4.7.5 Edits and lists</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The content models of the <code id=edits-and-lists:the-ol-element><a href=#the-ol-element>ol</a></code> and <code id=edits-and-lists:the-ul-element><a href=#the-ul-element>ul</a></code> elements do not allow
- <code id=edits-and-lists:the-ins-element><a href=#the-ins-element>ins</a></code> and <code id=edits-and-lists:the-del-element><a href=#the-del-element>del</a></code> elements as children. Lists always represent all their
- items, including items that would otherwise have been marked as deleted.</p>
- <p>To indicate that an item is inserted or deleted, an <code id=edits-and-lists:the-ins-element-2><a href=#the-ins-element>ins</a></code> or <code id=edits-and-lists:the-del-element-2><a href=#the-del-element>del</a></code>
- element can be wrapped around the contents of the <code id=edits-and-lists:the-li-element><a href=#the-li-element>li</a></code> element. To indicate that an
- item has been replaced by another, a single <code id=edits-and-lists:the-li-element-2><a href=#the-li-element>li</a></code> element can have one or more
- <code id=edits-and-lists:the-del-element-3><a href=#the-del-element>del</a></code> elements followed by one or more <code id=edits-and-lists:the-ins-element-3><a href=#the-ins-element>ins</a></code> elements.</p>
- <div class=example>
- <p>In the following example, a list that started empty had items added and removed from it over
- time. The bits in the example that have been emphasized show the parts that are the "current"
- state of the list. The list item numbers don't take into account the edits, though.</p>
- <pre><h1>Stop-ship bugs</h1>
- <ol>
- <li><ins datetime="2008-02-12T15:20Z"><em>Bug 225:
- Rain detector doesn't work in snow</em></ins></li>
- <li><del datetime="2008-03-01T20:22Z"><ins datetime="2008-02-14T12:02Z">Bug 228:
- Water buffer overflows in April</ins></del></li>
- <li><ins datetime="2008-02-16T13:50Z"><em>Bug 230:
- Water heater doesn't use renewable fuels</em></ins></li>
- <li><del datetime="2008-02-20T21:15Z"><ins datetime="2008-02-16T14:25Z">Bug 232:
- Carbon dioxide emissions detected after startup</ins></del></li>
- </ol></pre>
- </div>
- <div class=example>
- <p>In the following example, a list that started with just fruit was replaced by a list with just
- colours.</p>
- <pre><h1>List of <del>fruits</del><ins>colours</ins></h1>
- <ul>
- <li><del>Lime</del><ins>Green</ins></li>
- <li><del>Apple</del></li>
- <li>Orange</li>
- <li><del>Pear</del></li>
- <li><ins>Teal</ins></li>
- <li><del>Lemon</del><ins>Yellow</ins></li>
- <li>Olive</li>
- <li><ins>Purple</ins></li>
- </ul></pre>
- </div>
- <h4 id=edits-and-tables>4.7.6 Edits and tables</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The elements that form part of the table model have complicated content model requirements that
- do not allow for the <code id=edits-and-tables:the-ins-element><a href=#the-ins-element>ins</a></code> and <code id=edits-and-tables:the-del-element><a href=#the-del-element>del</a></code> elements, so indicating edits to a
- table can be difficult.</p>
- <p>To indicate that an entire row or an entire column has been added or removed, the entire
- contents of each cell in that row or column can be wrapped in <code id=edits-and-tables:the-ins-element-2><a href=#the-ins-element>ins</a></code> or <code id=edits-and-tables:the-del-element-2><a href=#the-del-element>del</a></code>
- elements (respectively).</p>
- <div class=example>
- <p>Here, a table's row has been added:</p>
- <pre><table>
- <thead>
- <tr> <th> Game name <th> Game publisher <th> Verdict
- <tbody>
- <tr> <td> Diablo 2 <td> Blizzard <td> 8/10
- <tr> <td> Portal <td> Valve <td> 10/10
- <strong> <tr> <td> <ins>Portal 2</ins> <td> <ins>Valve</ins> <td> <ins>10/10</ins></strong>
- </table></pre>
- <p>Here, a column has been removed (the time at which it was removed is given also, as is a link
- to the page explaining why):</p>
- <pre><table>
- <thead>
- <tr> <th> Game name <th> Game publisher <th> <strong><del cite="/edits/r192" datetime="2011-05-02 14:23Z">Verdict</del></strong>
- <tbody>
- <tr> <td> Diablo 2 <td> Blizzard <td> <strong><del cite="/edits/r192" datetime="2011-05-02 14:23Z">8/10</del></strong>
- <tr> <td> Portal <td> Valve <td> <strong><del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10</del></strong>
- <tr> <td> Portal 2 <td> Valve <td> <strong><del cite="/edits/r192" datetime="2011-05-02 14:23Z">10/10</del></strong>
- </table></pre>
- </div>
- <p>Generally speaking, there is no good way to indicate more complicated edits (e.g. that a cell
- was removed, moving all subsequent cells up or to the left).</p>
- <h3 id=embedded-content>4.8 Embedded content</h3>
-
- <h4 id=introduction-3>4.8.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To embed an image in HTML, when there is only a single image resource,
- use the <code id=introduction-3:the-img-element><a href=#the-img-element>img</a></code> element and its <code id=introduction-3:attr-img-src><a href=#attr-img-src>src</a></code> attribute.</p>
- <div class=example>
- <pre><h2>From today's featured article</h2>
- <strong><img src="/uploads/100-marie-lloyd.jpg" alt="" width="100" height="150"></strong>
- <p><b><a href="/wiki/Marie_Lloyd">Marie Lloyd</a></b> (1870–1922)
- was an English <a href="/wiki/Music_hall">music hall</a> singer, ...</pre>
- </div>
- <p>However, there are a number of situations for which the author might wish
- to use multiple image resources that the user agent can choose from:</p>
- <ul><li>
- <p>Different users might have different environmental characteristics:</p>
- <ul><li>
- <p>The users' physical screen size might be different from one another.</p>
- <p class=example>A mobile phone's screen might be 4 inches diagonally, while a laptop's screen might be 14 inches diagonally.</p>
- <p class=note>This is only relevant when an image's rendered size depends on the viewport size.</p>
- <li>
- <p>The users' screen pixel density might be different from one another.</p>
- <p class=example>A mobile phone's screen might have three times as many physical pixels per inch
- compared to another mobile phone's screen, regardless of their physical screen size.</p>
- <li>
- <p>The users' zoom level might be different from one another, or might change for a single user over time.</p>
- <p class=example>A user might zoom in to a particular image to be able to get a more detailed look.</p>
- <p>The zoom level and the screen pixel density (the previous point) can both affect the number of physical screen pixels per CSS pixel.
- This ratio is usually referred to as <dfn id=device-pixel-ratio>device-pixel-ratio</dfn>.</p>
- <li>
- <p>The users' screen orientation might be different from one another, or might change for a single user over time.</p>
- <p class=example>A tablet can be held upright or rotated 90 degrees, so that the screen is either "portrait" or "landscape".</p>
- <li>
- <p>The users' network speed, network latency and bandwidth cost might be different from one another, or might change for a single user over time.</p>
- <p class=example>A user might be on a fast, low-latency and constant-cost connection while at work,
- on a slow, low-latency and constant-cost connection while at home,
- and on a variable-speed, high-latency and variable-cost connection anywhere else.</p>
- </ul>
- <li>
- <p>Authors might want to show different image content depending on the rendered size of the image.
- This is usually referred to as <dfn id=art-direction>art direction</dfn>.</p>
- <p class=example>When a Web page is viewed on a screen with a large physical size (assuming a maximized browser window),
- the author might wish to include some less relevant parts surrounding the critical part of the image.
- When the same Web page is viewed on a screen with a small physical size,
- the author might wish to show only the critical part of the image.</p>
- <li>
- <p>Authors might want to show the same image content but with different rendered size depending on, usually, the width of the viewport.
- This is usually referred to as <dfn id=viewport-based-selection>viewport-based selection</dfn>.</p>
- <p class=example>A Web page might have a banner at the top that always spans the entire viewport width.
- In this case, the rendered size of the image depends on the physical size of the screen (assuming a maximized browser window).</p>
- <p class=example>Another Web page might have images in columns,
- with a single column for screens with a small physical size,
- two columns for screens with medium physical size,
- and three columns for screens with big physical size,
- with the images varying in rendered size in each case to fill up the viewport.
- In this case, the rendered size of an image might be <em>bigger</em> in the one-column layout compared to the two-column layout,
- despite the screen being smaller.</p>
- <li>
- <p>Authors might want to show the same image content but using different image formats, depending on which image formats the user agent supports.
- This is usually referred to as <dfn id=image-format-based-selection>image format-based selection</dfn>.</p>
- <p class=example>A Web page might have some images in the JPEG, WebP and JPEG XR image formats,
- with the latter two having better compression abilities compared to JPEG.
- Since different user agents can support different image formats,
- with some formats offering better compression ratios,
- the author would like to serve the better formats to user agenst that support them,
- while providing JPEG fallback for user agents that don't.</p>
- </ul>
- <p>The above situations are not mutually exclusive.
- For example, it is reasonable to combine different resources for different <a href=#device-pixel-ratio id=introduction-3:device-pixel-ratio>device-pixel-ratio</a>
- with different resources for <a href=#art-direction id=introduction-3:art-direction>art direction</a>.</p>
- <p>While it is possible to solve these problems using scripting, doing so introduces some other problems:</p>
- <ul><li><p>Some user agents agressively download images specified in the HTML markup,
- before scripts have had a chance to run,
- so that Web pages complete loading sooner.
- If a script changes which image to download,
- the user agent will potentially start two separate downloads,
- which can instead cause worse page loading performance.<li><p>If the author avoids specifying any image in the HTML markup
- and instead instantiates a single download from script,
- that avoids the double download problem above
- but instead it makes no image be downloaded at all for users with scripting disabled
- and it disables the agressive image downloading optimization.</ul>
- <p>With this in mind, this specification introduces a number of features to address the above problems in a declarative manner.</p>
- <dl><dt><a href=#device-pixel-ratio id=introduction-3:device-pixel-ratio-2>Device-pixel-ratio</a>-based selection when the rendered size of the image is fixed<dd>
- <p>The <code id=introduction-3:attr-img-src-2><a href=#attr-img-src>src</a></code> and <code id=introduction-3:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>
- attributes on the <code id=introduction-3:the-img-element-2><a href=#the-img-element>img</a></code> element can be used,
- using the <code>x</code> descriptor,
- to provide multiple images that only vary in their size
- (the smaller image is a scaled-down version of the bigger image).</p>
- <p class=note>The <code>x</code> descriptor is not appropriate when the
- rendered size of the image depends on the viewport width (<a href=#viewport-based-selection id=introduction-3:viewport-based-selection>viewport-based selection</a>),
- but can be used together with <a href=#art-direction id=introduction-3:art-direction-2>art direction</a>.</p>
- <div class=example>
- <pre><h2>From today's featured article</h2>
- <img <strong>src="/uploads/100-marie-lloyd.jpg"</strong>
- <strong>srcset="/uploads/150-marie-lloyd.jpg 1.5x, /uploads/200-marie-lloyd.jpg 2x"</strong>
- alt="" width="100" height="150">
- <p><b><a href="/wiki/Marie_Lloyd">Marie Lloyd</a></b> (1870–1922)
- was an English <a href="/wiki/Music_hall">music hall</a> singer, ...</pre>
- <p>The user agent can choose any of the given resources depending on
- the user's screen's pixel density, zoom level, and possibly other factors such as the user's network conditions.</p>
- <p>For backwards compatibility with older user agents that
- don't yet understand the <code id=introduction-3:attr-img-srcset-2><a href=#attr-img-srcset>srcset</a></code> attribute,
- one of the URLs is specified in the <code id=introduction-3:the-img-element-3><a href=#the-img-element>img</a></code> element's <code id=introduction-3:attr-img-src-3><a href=#attr-img-src>src</a></code> attribute.
- This will result in something useful (though perhaps lower-resolution than the user would like)
- being displayed even in older user agents.
- For new user agents, the <code id=introduction-3:attr-img-src-4><a href=#attr-img-src>src</a></code> attribute participates in the resource selection,
- as if it was specified in <code id=introduction-3:attr-img-srcset-3><a href=#attr-img-srcset>srcset</a></code> with a <code>1x</code> descriptor.</p>
- <p>The image's rendered size is given in the
- <code id=introduction-3:attr-dim-width><a href=#attr-dim-width>width</a></code> and <code id=introduction-3:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes,
- which allows the user agent to allocate space for the image before it is downloaded.</p>
- </div>
- <dt><a href=#art-direction id=introduction-3:art-direction-3>Art direction</a>-based selection<dd>
- <p>The <code id=introduction-3:the-picture-element><a href=#the-picture-element>picture</a></code> element and the <code id=introduction-3:the-source-element-when-used-with-the-picture-element><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element,
- together with the <code id=introduction-3:attr-picture-source-media><a href=#attr-picture-source-media>media</a></code> attribute,
- can be used, to provide multiple images that vary the image content
- (for intance the smaller image might be a cropped version of the bigger image).</p>
- <div class=example>
- <pre><picture>
- <source <strong>media="(min-width: 45em)"</strong> srcset="large.jpg">
- <source <strong>media="(min-width: 32em)"</strong> srcset="med.jpg">
- <img src="small.jpg" alt="The president giving an award.">
- </picture></pre>
- <p>The user agent will choose the first <code id=introduction-3:the-source-element-when-used-with-the-picture-element-2><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element
- for which the media query in the <code id=introduction-3:attr-picture-source-media-2><a href=#attr-picture-source-media>media</a></code> attribute matches,
- and then choose an appropriate URL from its <code id=introduction-3:attr-picture-source-srcset><a href=#attr-picture-source-srcset>srcset</a></code> attribute.</p>
- <p>The rendered size of the image varies depending on which resource is chosen.
- To specify dimensions that the user agent can use before having downloaded the image,
- CSS can be used.</p>
- <pre class=css>img { width: 300px; height: 300px }
- @media (min-width: 32em) { img { width: 500px; height:300px } }
- @media (min-width: 45em) { img { width: 700px; height:400px } }</pre>
- </div>
- <div class=example>
- <p>This example combines <a href=#art-direction id=introduction-3:art-direction-4>art direction</a>- and <a href=#device-pixel-ratio id=introduction-3:device-pixel-ratio-3>device-pixel-ratio</a>-based selection.
- A banner that takes half the viewport is provided in two versions,
- one for wide screens and one for narrow screens.</p>
- <pre><h1>
- <picture>
- <source media="(max-width: 500px)" srcset="banner-phone.jpeg, banner-phone-HD.jpeg 2x">
- <img src="banner.jpeg" srcset="banner-HD.jpeg 2x" alt="The Breakfast Combo">
- </picture>
- </h1></pre>
- </div>
- <dt><a href=#viewport-based-selection id=introduction-3:viewport-based-selection-2>Viewport-based selection</a><dd>
- <p>The <code id=introduction-3:attr-img-srcset-4><a href=#attr-img-srcset>srcset</a></code> and <code id=introduction-3:attr-img-sizes><a href=#attr-img-sizes>sizes</a></code> attributes can be used,
- using the <code>w</code> descriptor,
- to provide multiple images that only vary in their size
- (the smaller image is a scaled-down version of the bigger image).</p>
- <div class=example>
- <p>In this example, a banner image takes up the entire viewport width
- (using appropriate CSS).</p>
- <pre><h1><img <strong>sizes="100vw" srcset="wolf-400.jpg 400w, wolf-800.jpg 800w, wolf-1600.jpg 1600w"</strong>
- src="wolf-400.jpg" alt="The rad wolf"></h1></pre>
- <p>The user agent will calculate the effective pixel density of each image
- from the specified <code>w</code> descriptors and the specified rendered size in the <code id=introduction-3:attr-img-sizes-2><a href=#attr-img-sizes>sizes</a></code> attribute.
- It can then choose any of the given resources depending on
- the user's screen's pixel density, zoom level, and possibly other factors such as the user's network conditions.</p>
- <p>If the user's screen is 320 CSS pixels wide, this is equivalent to specifying
- <code>wolf-400.jpg 1.25x, wolf-800.jpg 2.5x, wolf-1600.jpg 5x</code>.
- On the other hand, if the user's screen is 1200 CSS pixels wide,
- this is equivalent to specifying
- <code>wolf-400.jpg 0.33x, wolf-800.jpg 0.67x, wolf-1600.jpg 1.33x</code>.
- By using the <code>w</code> descriptors and the <code id=introduction-3:attr-img-sizes-3><a href=#attr-img-sizes>sizes</a></code> attribute,
- the user agent can choose the correct image source to download regardless of how large the user's device is.</p>
- <p>For backwards compatibility,
- one of the URLs is specified in the <code id=introduction-3:the-img-element-4><a href=#the-img-element>img</a></code> element's <code id=introduction-3:attr-img-src-5><a href=#attr-img-src>src</a></code> attribute.
- In new user agents, the <code id=introduction-3:attr-img-src-6><a href=#attr-img-src>src</a></code> attribute is ignored
- when the <code id=introduction-3:attr-img-srcset-5><a href=#attr-img-srcset>srcset</a></code> attribute uses <code>w</code> descriptors.</p>
- <p>In this example, the <code id=introduction-3:attr-img-sizes-4><a href=#attr-img-sizes>sizes</a></code> attribute could be omitted
- because the default value is <code>100vw</code>.</p>
- </div>
- <div class=example>
- <p>In this example, the Web page has three layouts depending on the width of the viewport.
- The narrow layout has one column of images (the width of each image is about 100%),
- the middle layout has two columns of images (the width of each image is about 50%),
- and the widest layout has three columns of images, and some page margin (the width of each image is about 33%).
- It breaks between these layouts when the viewport is <code>30em</code> wide and <code>50em</code> wide, respectively.</p>
- <pre><img <strong>sizes="(max-width: 30em) 100vw, (max-width: 50em) 50vw, calc(33vw - 100px)"</strong>
- <strong>srcset="swing-200.jpg 200w, swing-400.jpg 400w, swing-800.jpg 800w, swing-1600.jpg 1600w"</strong>
- src="swing-400.jpg" alt="Kettlebell Swing"></pre>
- <p>The <code id=introduction-3:attr-img-sizes-5><a href=#attr-img-sizes>sizes</a></code> attribute sets up the
- layout breakpoints at <code>30em</code> and <code>50em</code>,
- and declares the image sizes between these breakpoints to be
- <code>100vw</code>, <code>50vw</code>, or <code>calc(33vw - 100px)</code>.
- These sizes do not necessarily have to match up exactly with the actual image width as specified in the CSS.</p>
- <p>The user agent will pick a width from the <code id=introduction-3:attr-img-sizes-6><a href=#attr-img-sizes>sizes</a></code> attribute,
- using the first item with a <a href=#media-condition id=introduction-3:media-condition><media-condition></a> (the part in parentheses) that evaluates to true,
- or using the last item (<code>calc(33vw - 100px)</code>) if they all evaluate to false.</p>
- <p>For example, if the viewport width is <code>29em</code>,
- then <code>(max-width: 30em)</code> evaluates to true and <code>100vw</code> is used,
- so the image size, for the purpose of resource selection, is <code>29em</code>.
- If the viewport width is instead <code>32em</code>,
- then <code>(max-width: 30em)</code> evaluates to false,
- but <code>(max-width: 50em)</code> evaluates to true and <code>50vw</code> is used,
- so the image size, for the purpose of resource selection, is <code>16em</code> (half the viewport width).
- Notice that the slightly wider viewport results in a smaller image because of the different layout.</p>
- <p>The user agent can then calculate the effective pixel density and choose an appropriate resource
- similarly to the previous example.</p>
- </div>
- <dt><a href=#image-format-based-selection id=introduction-3:image-format-based-selection>Image format-based selection</a><dd>
- <p>The <code id=introduction-3:attr-picture-source-type><a href=#attr-picture-source-type>type</a></code> attribute
- on the <code id=introduction-3:the-source-element-when-used-with-the-picture-element-3><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element can be used,
- to provide multiple images in different formats.</p>
- <div class=example>
- <pre><h2>From today's featured article</h2>
- <picture>
- <source srcset="/uploads/100-marie-lloyd.webp" <strong>type="image/webp"</strong>>
- <source srcset="/uploads/100-marie-lloyd.jxr" <strong>type="image/vnd.ms-photo"</strong>>
- <img src="/uploads/100-marie-lloyd.jpg" alt="" width="100" height="150">
- </picture>
- <p><b><a href="/wiki/Marie_Lloyd">Marie Lloyd</a></b> (1870–1922)
- was an English <a href="/wiki/Music_hall">music hall</a> singer, ...</pre>
- <p>In this example, the user agent will choose the first source that has
- a <code id=introduction-3:attr-picture-source-type-2><a href=#attr-picture-source-type>type</a></code> attribute with a supported MIME type.
- If the user agent supports WebP images,
- the first <code id=introduction-3:the-source-element-when-used-with-the-picture-element-4><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element will be chosen.
- If not, but the user agent does support JPEG XR images,
- the second <code id=introduction-3:the-source-element-when-used-with-the-picture-element-5><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element will be chosen.
- If neither of those formats are supported,
- the <code id=introduction-3:the-img-element-5><a href=#the-img-element>img</a></code> element will be chosen.</p>
- </div>
- </dl>
- <h5 id=adaptive-images>4.8.1.1 Adaptive images</h5>
- <p><i>This section is non-normative.</i></p>
- <p>CSS and media queries can be used to construct graphical page layouts that adapt dynamically to
- the user's environment, in particular to different viewport dimensions and pixel densities. For
- content, however, CSS does not help; instead, we have the <code id=adaptive-images:the-img-element><a href=#the-img-element>img</a></code> element's <code id=adaptive-images:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute and the <code id=adaptive-images:the-picture-element><a href=#the-picture-element>picture</a></code> element.
- This section walks through a sample case showing how to use these features.</p>
- <p>Consider a situation where on wide screens (wider than 600 CSS pixels) a 300×150 image
- named <code>a-rectangle.png</code> is to be used, but on smaller screens (600 CSS pixels
- and less), a smaller 100×100 image called <code>a-square.png</code> is to be used.
- The markup for this would look like this:</p>
- <pre><figure>
- <picture>
- <source srcset="a-square.png" media="(max-width: 600px)">
- <img src="a-rectangle.png" alt="Barney Frank wears a suit and glasses.">
- </picture>
- <figcaption>Barney Frank, 2011</figcaption>
- </figure></pre>
- <p class=note>For details on what to put in the <code id=adaptive-images:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute,
- see the <a href=#alt>Requirements for providing text to act as an alternative for images</a> section.</p>
- <p>The problem with this is that the user agent does not necessarily know what dimensions to use
- for the image when the image is loading. To avoid the layout having to be reflowed multiple times
- as the page is loading, CSS and CSS media queries can be used to provide the dimensions:</p>
- <pre><figure>
- <style scoped>
- #a { width: 300px; height: 150px; }
- @media (max-width: 600px) { #a { width: 100px; height: 100px; } }
- </style>
- <picture>
- <source srcset="a-square.png" media="(max-width: 600px)">
- <img src="a-rectangle.png" alt="Barney Frank wears a suit and glasses." id="a">
- </picture>
- <figcaption>Barney Frank, 2011</figcaption>
- </figure></pre>
- <p>Alternatively, the <code id=adaptive-images:attr-dim-width><a href=#attr-dim-width>width</a></code> and <code id=adaptive-images:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes can be used to provide the width for legacy user
- agents, using CSS just for the user agents that support <code id=adaptive-images:the-picture-element-2><a href=#the-picture-element>picture</a></code>:</p>
- <pre><figure>
- <style scoped media="(max-width: 600px)">
- #a { width: 100px; height: 100px; }
- </style>
- <picture>
- <source srcset="a-square.png" media="(max-width: 600px)">
- <img src="a-rectangle.png" width="300" height="150"
- alt="Barney Frank wears a suit and glasses." id="a">
- </picture>
- <figcaption>Barney Frank, 2011</figcaption>
- </figure></pre>
- <hr>
- <p>The <code id=adaptive-images:the-source-element-when-used-with-the-picture-element><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element is used with the <code id=adaptive-images:attr-img-src><a href=#attr-img-src>src</a></code> attribute, which gives the URL of the image to use for legacy user
- agents that do not support the <code id=adaptive-images:the-picture-element-3><a href=#the-picture-element>picture</a></code> element. This leads
- to a question of which image to provide in the <code id=adaptive-images:attr-img-src-2><a href=#attr-img-src>src</a></code>
- attribute.</p>
- <p>If the author wants the biggest image in legacy user agents, the markup could be as follows:</p>
- <pre><picture>
- <source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
- <source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
- <img src="pear-desktop.jpeg" alt="The pear is juicy.">
- </picture></pre>
- <p>However, if legacy mobile user agents are more important, one can list all three images in the
- <code id=adaptive-images:the-source-element-when-used-with-the-picture-element-2><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements, overriding the <code id=adaptive-images:attr-img-src-3><a href=#attr-img-src>src</a></code> attribute entirely.</p>
- <pre><picture>
- <source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
- <source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
- <source srcset="pear-desktop.jpeg">
- <img src="pear-mobile.jpeg" alt="The pear is juicy.">
- </picture></pre>
- <p>Since at this point the <code id=adaptive-images:attr-img-src-4><a href=#attr-img-src>src</a></code> attribute is actually being
- ignored entirely by <code id=adaptive-images:the-picture-element-4><a href=#the-picture-element>picture</a></code>-supporting user agents, the <code id=adaptive-images:attr-img-src-5><a href=#attr-img-src>src</a></code> attribute can default to any image, including one that is neither
- the smallest nor biggest:</p>
- <pre><picture>
- <source srcset="pear-mobile.jpeg" media="(max-width: 720px)">
- <source srcset="pear-tablet.jpeg" media="(max-width: 1280px)">
- <source srcset="pear-desktop.jpeg">
- <img src="pear-tablet.jpeg" alt="The pear is juicy.">
- </picture></pre>
- <hr>
- <p>Above the <code>max-width</code> media feature is used, giving the maximum
- (viewport) dimensions that an image is intended for.
- It is also possible to use <code>min-width</code> instead.</p>
- <pre><picture>
- <source srcset="pear-desktop.jpeg" media="(min-width: 1281px)">
- <source srcset="pear-tablet.jpeg" media="(min-width: 721px)">
- <img src="pear-mobile.jpeg" alt="The pear is juicy.">
- </picture></pre>
- <h4 id=dependencies-2>4.8.2 Dependencies</h4>
- <dl><dt>Media Queries <a href=#refsMQ>[MQ]</a><dd><dfn id=media-condition><media-condition></dfn><dt>CSS Values and Units <a href=#refsCSSVALUES>[CSSVALUES]</a><dd><dfn id=length><length></dfn><dt>CSS Syntax <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a><dd><dfn id=parse-a-comma-separated-list-of-component-values>Parse a comma-separated list of component values</dfn><dd><dfn id=component-value>component value</dfn><dd><dfn id=whitespace-token><whitespace-token></dfn><dt>Fetch <a href=#refsFETCH>[FETCH]</a><dd><dfn id=concept-request-context>context</dfn></dl>
- <h4 id=the-picture-element>4.8.3 The <dfn><code>picture</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-picture-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-picture-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-picture-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-picture-element:embedded-content-category>Embedded content</a>.<dt><a href=#concept-element-contexts id=the-picture-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-picture-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-picture-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-picture-element:the-source-element-when-used-with-the-picture-element><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements, followed by one <code id=the-picture-element:the-img-element><a href=#the-img-element>img</a></code> element, optionally intermixed with <a href=#script-supporting-elements-2 id=the-picture-element:script-supporting-elements-2>script-supporting elements</a>.<dt><a href=#concept-element-tag-omission id=the-picture-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-picture-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-picture-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-picture-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlpictureelement>HTMLPictureElement</dfn> : <a href=#htmlelement id=the-picture-element:htmlelement>HTMLElement</a> {};</pre>
- </dl>
- <p>The <code id=the-picture-element:the-picture-element><a href=#the-picture-element>picture</a></code> element is a container
- which provides multiples sources to its contained <code id=the-picture-element:the-img-element-2><a href=#the-img-element>img</a></code> element
- to allow authors to declaratively control or give hints to the user agent about which image resource to use,
- based on the screen pixel density, viewport size, image format, and other factors. It <a href=#represents id=the-picture-element:represents>represents</a> its children.</p>
- <p class=note>The <code id=the-picture-element:the-picture-element-2><a href=#the-picture-element>picture</a></code> element is somewhat different
- from the similar-looking <code id=the-picture-element:the-video-element><a href=#the-video-element>video</a></code> and <code id=the-picture-element:the-audio-element><a href=#the-audio-element>audio</a></code> elements.
- While all of them contain <code id=the-picture-element:the-source-element-when-used-with-the-picture-element-2><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements,
- the <code id=the-picture-element:the-source-element-when-used-with-the-picture-element-3><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element's <code id=the-picture-element:attr-source-src><a href=#attr-source-src>src</a></code> attribute has no meaning
- when the element is nested within a <code id=the-picture-element:the-picture-element-3><a href=#the-picture-element>picture</a></code> element,
- and the resource selection algorithm is different.
- As well, the <code id=the-picture-element:the-picture-element-4><a href=#the-picture-element>picture</a></code> element itself does not display anything;
- it merely provides a context for its contained <code id=the-picture-element:the-img-element-3><a href=#the-img-element>img</a></code> element
- that enables it to choose from multiple <a href=#url id=the-picture-element:url>URLs</a>.</p>
- <h4 id=the-source-element-when-used-with-the-picture-element>4.8.4 The <dfn><code>source</code></dfn> element when used with the <code id=the-source-element-when-used-with-the-picture-element:the-picture-element><a href=#the-picture-element>picture</a></code> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-source-element-when-used-with-the-picture-element:concept-element-categories>Categories</a>:<dd>Same as for the <code id=the-source-element-when-used-with-the-picture-element:the-source-element><a href=#the-source-element>source</a></code> element.<dt><a href=#concept-element-contexts id=the-source-element-when-used-with-the-picture-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-source-element-when-used-with-the-picture-element:the-picture-element-2><a href=#the-picture-element>picture</a></code> element, before the <code id=the-source-element-when-used-with-the-picture-element:the-img-element><a href=#the-img-element>img</a></code> element.<dt><a href=#concept-element-content-model id=the-source-element-when-used-with-the-picture-element:concept-element-content-model>Content model</a>:<dd>Same as for the <code id=the-source-element-when-used-with-the-picture-element:the-source-element-2><a href=#the-source-element>source</a></code> element.<dt><a href=#concept-element-attributes id=the-source-element-when-used-with-the-picture-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-source-element-when-used-with-the-picture-element:global-attributes>Global attributes</a><dd><code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-srcset><a href=#attr-picture-source-srcset>srcset</a></code><dd><code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-sizes><a href=#attr-picture-source-sizes>sizes</a></code><dd><code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-media><a href=#attr-picture-source-media>media</a></code><dd><code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-type><a href=#attr-picture-source-type>type</a></code><dt><a href=#concept-element-dom id=the-source-element-when-used-with-the-picture-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>partial interface <a href=#htmlsourceelement id=the-source-element-when-used-with-the-picture-element:htmlsourceelement>HTMLSourceElement</a> {
- attribute DOMString <a href=#dom-picture-source-srcset id=the-source-element-when-used-with-the-picture-element:dom-picture-source-srcset>srcset</a>;
- attribute DOMString <a href=#dom-picture-source-sizes id=the-source-element-when-used-with-the-picture-element:dom-picture-source-sizes>sizes</a>;
- attribute DOMString <a href=#dom-picture-source-media id=the-source-element-when-used-with-the-picture-element:dom-picture-source-media>media</a>;
- };</pre>
- </dl>
- <p>The authoring requirements in this section only apply if the <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element has
- a parent that is a <code id=the-source-element-when-used-with-the-picture-element:the-picture-element-3><a href=#the-picture-element>picture</a></code> element.</p>
- <p>The <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element-2><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element allows authors to specify multiple alternative
- <a href=#source-set id=the-source-element-when-used-with-the-picture-element:source-set>source sets</a> for <code id=the-source-element-when-used-with-the-picture-element:the-img-element-2><a href=#the-img-element>img</a></code> elements.
- It does not <a href=#represents id=the-source-element-when-used-with-the-picture-element:represents>represent</a> anything on its own.</p>
- <p>The <dfn id=attr-picture-source-srcset><code>srcset</code></dfn> attribute must be present,
- and must consist of one or more <a href=#image-candidate-string id=the-source-element-when-used-with-the-picture-element:image-candidate-string>image candidate strings</a>,
- each separated from the next by a U+002C COMMA character (,).
- If an <a href=#image-candidate-string id=the-source-element-when-used-with-the-picture-element:image-candidate-string-2>image candidate string</a> contains no descriptors
- and no <a href=#space-character id=the-source-element-when-used-with-the-picture-element:space-character>space characters</a> after the URL,
- the following <a href=#image-candidate-string id=the-source-element-when-used-with-the-picture-element:image-candidate-string-3>image candidate string</a>, if there is one,
- must begin with one or more <a href=#space-character id=the-source-element-when-used-with-the-picture-element:space-character-2>space characters</a>.</p>
- <p>The <dfn id=attr-picture-source-sizes><code>sizes</code></dfn> attribute may also be present.
- If present, the value must be a <a href=#valid-source-size-list id=the-source-element-when-used-with-the-picture-element:valid-source-size-list>valid source size list</a>.</p>
- <p>The <dfn id=attr-picture-source-media><code>media</code></dfn> attributes may also be present.
- If present, the value must contain a <a href=#valid-media-query-list id=the-source-element-when-used-with-the-picture-element:valid-media-query-list>valid media query list</a>.</p>
- <p>The <dfn id=attr-picture-source-type><code>type</code></dfn> attribute may also be present.
- If present, the value must be a <a href=#valid-mime-type id=the-source-element-when-used-with-the-picture-element:valid-mime-type>valid MIME type</a>.
- It gives the type of the images in the <a href=#source-set id=the-source-element-when-used-with-the-picture-element:source-set-2>source set</a>,
- to allow the user agent to skip to the next <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element-3><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element
- if it does not support the given type.</p>
- <p class=note>If the <code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-type-2><a href=#attr-picture-source-type>type</a></code> attribute
- is <em>not</em> specified, the user agent will not select a different
- <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element-4><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element if it finds that it does not support
- the image format after fetching it.</p>
- <p>When a <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element-5><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element has a following sibling
- <code id=the-source-element-when-used-with-the-picture-element:the-source-element-when-used-with-the-picture-element-6><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element or <code id=the-source-element-when-used-with-the-picture-element:the-img-element-3><a href=#the-img-element>img</a></code> element with a
- <code id=the-source-element-when-used-with-the-picture-element:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> attribute specified, it must have
- at least one of the following:</p>
- <ul><li><p>A <code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-media-2><a href=#attr-picture-source-media>media</a></code> attribute specified with a value that,
- after <a href=#strip-leading-and-trailing-whitespace id=the-source-element-when-used-with-the-picture-element:strip-leading-and-trailing-whitespace>stripping leading and trailing whitespace</a>,
- is not the empty string and is not an <a href=#ascii-case-insensitive id=the-source-element-when-used-with-the-picture-element:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>all</code>".<li><p>A <code id=the-source-element-when-used-with-the-picture-element:attr-picture-source-type-3><a href=#attr-picture-source-type>type</a></code> attribute specified.</ul>
- <p>The <code id=the-source-element-when-used-with-the-picture-element:attr-source-src><a href=#attr-source-src>src</a></code> attribute must not be present.</p>
-
- <p>The IDL attributes <dfn id=dom-picture-source-srcset><code>srcset</code></dfn>,
- <dfn id=dom-picture-source-sizes><code>sizes</code></dfn> and
- <dfn id=dom-picture-source-media><code>media</code></dfn> must <a href=#reflect id=the-source-element-when-used-with-the-picture-element:reflect>reflect</a> the
- respective content attributes of the same name.</p>
-
- <h4 id=the-img-element>4.8.5 The <dfn><code>img</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-img-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-img-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-img-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-img-element:embedded-content-category>Embedded content</a>.<dd><a href=#form-associated-element id=the-img-element:form-associated-element>Form-associated element</a>.<dd>If the element has a <code id=the-img-element:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content-2 id=the-img-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-img-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-img-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-img-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-img-element:concept-element-content-model>Content model</a>:<dd>Empty.<dt><a href=#concept-element-tag-omission id=the-img-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-img-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-img-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-img-element:global-attributes>Global attributes</a><dd><code id=the-img-element:attr-img-alt><a href=#attr-img-alt>alt</a></code> — Replacement text for use when images are not available<dd><code id=the-img-element:attr-img-src><a href=#attr-img-src>src</a></code> — Address of the resource<dd><code id=the-img-element:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code> — Images to use in different situations (e.g. high-resolution displays, small monitors, etc)<dd><code id=the-img-element:attr-img-sizes><a href=#attr-img-sizes>sizes</a></code><dd><code id=the-img-element:attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code> — How the element handles crossorigin requests<dd><code id=the-img-element:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code> — Name of <a href=#image-map id=the-img-element:image-map>image map</a> to use<dd><code id=the-img-element:attr-img-ismap><a href=#attr-img-ismap>ismap</a></code> — Whether the image is a server-side image map<dd><code id=the-img-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd><code id=the-img-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dt><a href=#concept-element-dom id=the-img-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>[NamedConstructor=<a href=#dom-image id=the-img-element:dom-image>Image</a>(optional unsigned long width, optional unsigned long height)]
- interface <dfn id=htmlimageelement>HTMLImageElement</dfn> : <a href=#htmlelement id=the-img-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-img-alt id=the-img-element:dom-img-alt>alt</a>;
- attribute DOMString <a href=#dom-img-src id=the-img-element:dom-img-src>src</a>;
- attribute DOMString <a href=#dom-img-srcset id=the-img-element:dom-img-srcset>srcset</a>;
- attribute DOMString <a href=#dom-img-sizes id=the-img-element:dom-img-sizes>sizes</a>;
- attribute DOMString? <a href=#dom-img-crossorigin id=the-img-element:dom-img-crossorigin>crossOrigin</a>;
- attribute DOMString <a href=#dom-img-usemap id=the-img-element:dom-img-usemap>useMap</a>;
- attribute boolean <a href=#dom-img-ismap id=the-img-element:dom-img-ismap>isMap</a>;
- attribute unsigned long <a href=#dom-img-width id=the-img-element:dom-img-width>width</a>;
- attribute unsigned long <a href=#dom-img-height id=the-img-element:dom-img-height>height</a>;
- readonly attribute unsigned long <a href=#dom-img-naturalwidth id=the-img-element:dom-img-naturalwidth>naturalWidth</a>;
- readonly attribute unsigned long <a href=#dom-img-naturalheight id=the-img-element:dom-img-naturalheight>naturalHeight</a>;
- readonly attribute boolean <a href=#dom-img-complete id=the-img-element:dom-img-complete>complete</a>;
- readonly attribute DOMString <a href=#dom-img-currentsrc id=the-img-element:dom-img-currentsrc>currentSrc</a>;
- // <a href="#HTMLImageElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>An <code id=the-img-element:the-img-element><a href=#the-img-element>img</a></code> element represents an image.</p>
-
- <p>The image given by the <dfn id=attr-img-src><code>src</code></dfn> and <dfn id=attr-img-srcset><code>srcset</code></dfn> attributes,
- and any previous sibling <code id=the-img-element:the-source-element-when-used-with-the-picture-element><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements'
- <code id=the-img-element:attr-picture-source-srcset><a href=#attr-picture-source-srcset>srcset</a></code> attributes if the parent is a <code id=the-img-element:the-picture-element><a href=#the-picture-element>picture</a></code> element,
- is the embedded content; the value of
- the <dfn id=attr-img-alt><code>alt</code></dfn> attribute provides equivalent content for
- those who cannot process images or who have image loading disabled (i.e. it is the
- <code id=the-img-element:the-img-element-2><a href=#the-img-element>img</a></code> element's <a href=#fallback-content id=the-img-element:fallback-content>fallback content</a>).</p>
- <p>The requirements on the <code id=the-img-element:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute's value are described
- <a href=#alt>in the next section</a>.</p>
- <p>The <code id=the-img-element:attr-img-src-2><a href=#attr-img-src>src</a></code> attribute must be present, and must contain a
- <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-img-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a> referencing a non-interactive,
- optionally animated, image resource that is neither paged nor scripted.</p>
- <p>The <code id=the-img-element:attr-img-srcset-2><a href=#attr-img-srcset>srcset</a></code> attribute may also be present.
- If present, its value must consist of one or more
- <a href=#image-candidate-string id=the-img-element:image-candidate-string>image candidate strings</a>,
- each separated from the next by a U+002C COMMA character (,).
- If an <a href=#image-candidate-string id=the-img-element:image-candidate-string-2>image candidate string</a> contains no descriptors
- and no <a href=#space-character id=the-img-element:space-character>space characters</a> after the URL,
- the following <a href=#image-candidate-string id=the-img-element:image-candidate-string-3>image candidate string</a>, if there is one,
- must begin with one or more <a href=#space-character id=the-img-element:space-character-2>space characters</a>.</p>
-
- <p>An <dfn id=image-candidate-string>image candidate string</dfn> consists of the following components, in order, with the
- further restrictions described below this list:</p>
- <ol><li><p>Zero or more <a href=#space-character id=the-img-element:space-character-3>space characters</a>.<li><p>A <a href=#valid-non-empty-url id=the-img-element:valid-non-empty-url>valid non-empty URL</a> that does not start or end with a U+002C COMMA character (,),
- referencing a non-interactive, optionally animated, image resource
- that is neither paged nor scripted.<li><p>Zero or more <a href=#space-character id=the-img-element:space-character-4>space characters</a>.<li>
- <p>Zero or one of the following:</p>
- <ul><li><p>A <i>width descriptor</i>, consisting of:
- a <a href=#space-character id=the-img-element:space-character-5>space character</a>,
- a <a href=#valid-non-negative-integer id=the-img-element:valid-non-negative-integer>valid non-negative integer</a> giving a number greater than zero
- representing the <i>width descriptor</i> value,
- and a U+0077 LATIN SMALL LETTER W character.<li><p>A <i>pixel density descriptor</i>, consisting of:
- a <a href=#space-character id=the-img-element:space-character-6>space character</a>,
- a <a href=#valid-floating-point-number id=the-img-element:valid-floating-point-number>valid floating-point number</a> giving a number greater than zero
- representing the <i>pixel density descriptor</i> value,
- and a U+0078 LATIN SMALL LETTER X character.</ul>
- <li><p>Zero or more <a href=#space-character id=the-img-element:space-character-7>space characters</a>.</ol>
- <p>There must not be an <a href=#image-candidate-string id=the-img-element:image-candidate-string-4>image candidate string</a> for an element that
- has the same <i>width descriptor</i> value as another
- <a href=#image-candidate-string id=the-img-element:image-candidate-string-5>image candidate string</a>'s <i>width descriptor</i> value for the same element.</p>
- <p>There must not be an <a href=#image-candidate-string id=the-img-element:image-candidate-string-6>image candidate string</a> for an element that
- has the same <i>pixel density descriptor</i> value as another
- <a href=#image-candidate-string id=the-img-element:image-candidate-string-7>image candidate string</a>'s <i>pixel density descriptor</i> value for the same element.
- For the purpose of this requirement,
- an <a href=#image-candidate-string id=the-img-element:image-candidate-string-8>image candidate string</a> with no descriptors is equivalent to
- an <a href=#image-candidate-string id=the-img-element:image-candidate-string-9>image candidate string</a> with a <code>1x</code> descriptor.</p>
- <p>If a <code id=the-img-element:the-source-element-when-used-with-the-picture-element-2><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element has a <code id=the-img-element:attr-picture-source-sizes><a href=#attr-picture-source-sizes>sizes</a></code> attribute present
- or an <code id=the-img-element:the-img-element-3><a href=#the-img-element>img</a></code> element has a <code id=the-img-element:attr-img-sizes-2><a href=#attr-img-sizes>sizes</a></code> attribute present,
- all <a href=#image-candidate-string id=the-img-element:image-candidate-string-10>image candidate strings</a> for that
- element must have the <i>width descriptor</i> specified.</p>
- <p>If an <a href=#image-candidate-string id=the-img-element:image-candidate-string-11>image candidate string</a> for an <code id=the-img-element:the-source-element-when-used-with-the-picture-element-3><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> or <code id=the-img-element:the-img-element-4><a href=#the-img-element>img</a></code> element
- has the <i>width descriptor</i> specified,
- all other <a href=#image-candidate-string id=the-img-element:image-candidate-string-12>image candidate strings</a> for that element
- must also have the <i>width descriptor</i> specified.</p>
- <p>The specified width in an <a href=#image-candidate-string id=the-img-element:image-candidate-string-13>image candidate string</a>'s <i>width descriptor</i>
- must match the intrinsic width in the resource given by the <a href=#image-candidate-string id=the-img-element:image-candidate-string-14>image candidate string</a>'s URL.</p>
- <p class=note>The requirements above imply that images can be static bitmaps (e.g. PNGs, GIFs,
- JPEGs), single-page vector documents (single-page PDFs, XML files with an SVG root element),
- animated bitmaps (APNGs, animated GIFs), animated vector graphics (XML files with an SVG root
- element that use declarative SMIL animation), and so forth. However, these definitions preclude
- SVG files with script, multipage PDF files, interactive MNG files, HTML documents, plain text
- documents, and so forth. <a href=#refsPNG>[PNG]</a> <a href=#refsGIF>[GIF]</a> <a href=#refsJPEG>[JPEG]</a> <a href=#refsPDF>[PDF]</a>
- <a href=#refsXML>[XML]</a> <a href=#refsAPNG>[APNG]</a> <a href=#refsSVG>[SVG]</a> <a href=#refsMNG>[MNG]</a> </p>
- <p>If the <code id=the-img-element:attr-img-srcset-3><a href=#attr-img-srcset>srcset</a></code> attribute is present,
- the <dfn id=attr-img-sizes><code>sizes</code></dfn> attribute may also be present.
- If present, its value must be a <a href=#valid-source-size-list id=the-img-element:valid-source-size-list>valid source size list</a>.</p>
- <p>A <dfn id=valid-source-size-list>valid source size list</dfn> is a string that matches the following grammar:
- <a href=#refsCSSVALUES>[CSSVALUES]</a> <a href=#refsMQ>[MQ]</a></p>
- <pre><dfn id=source-size-list><source-size-list></dfn> = <a href=#source-size id=the-img-element:source-size><source-size></a># [ , <a href=#source-size-value id=the-img-element:source-size-value><source-size-value></a> ]? | <a href=#source-size-value id=the-img-element:source-size-value-2><source-size-value></a>
- <dfn id=source-size><source-size></dfn> = <a href=#media-condition id=the-img-element:media-condition><media-condition></a> <a href=#source-size-value id=the-img-element:source-size-value-3><source-size-value></a>
- <dfn id=source-size-value><source-size-value></dfn> = <a href=#length id=the-img-element:length><length></a></pre>
- <p>A <a href=#source-size-value id=the-img-element:source-size-value-4><source-size-value></a> must not be negative.</p>
- <p class=note>Percentages are not allowed in a <a href=#source-size-value id=the-img-element:source-size-value-5><source-size-value></a>,
- to avoid confusion about what it would be relative to.
- The <code>vw</code> unit can be used for sizes relative to the viewport width.</p>
- <p>The <code id=the-img-element:the-img-element-5><a href=#the-img-element>img</a></code> element must not be used as a layout tool. In particular, <code id=the-img-element:the-img-element-6><a href=#the-img-element>img</a></code>
- elements should not be used to display transparent images, as such images rarely convey meaning and
- rarely add anything useful to the document.</p>
- <hr>
- <p>The <dfn id=attr-img-crossorigin><code>crossorigin</code></dfn> attribute is a <a href=#cors-settings-attribute id=the-img-element:cors-settings-attribute>CORS
- settings attribute</a>. Its purpose is to allow images from third-party sites that allow
- cross-origin access to be used with <code id=the-img-element:the-canvas-element><a href=#the-canvas-element>canvas</a></code>.</p>
-
- <hr>
- <p>An <code id=the-img-element:the-img-element-7><a href=#the-img-element>img</a></code> element has a <dfn id=current-request>current request</dfn> and a <dfn id=pending-request>pending request</dfn>.
- The <a href=#current-request id=the-img-element:current-request>current request</a> is initially set to a new <a href=#image-request id=the-img-element:image-request>image request</a>.
- The <a href=#pending-request id=the-img-element:pending-request>pending request</a> is initially set to null.
- The <a href=#current-request id=the-img-element:current-request-2>current request</a> is usually referred to as the <code id=the-img-element:the-img-element-8><a href=#the-img-element>img</a></code> element itself.</p>
- <p>An <dfn id=image-request>image request</dfn> has a <dfn id=img-req-state>state</dfn>, <dfn id=img-req-url>current URL</dfn> and <dfn id=img-req-data>image data</dfn>.</p>
- <p>An <a href=#image-request id=the-img-element:image-request-2>image request</a>'s <a href=#img-req-state id=the-img-element:img-req-state>state</a> is one of the following:</p>
- <dl><dt><dfn id=img-none>Unavailable</dfn><dd>The user agent hasn't obtained any image data,
- or has obtained some or all of the image data but
- hasn't yet decoded enough of the image to get the image dimensions.<dt><dfn id=img-inc>Partially available</dfn><dd>The user agent has obtained some of the image data and at least the image dimensions are
- available.<dt><dfn id=img-all>Completely available</dfn><dd>The user agent has obtained all of the image data and at least the image dimensions are
- available.<dt><dfn id=img-error>Broken</dfn><dd>The user agent has obtained all of the image data that it can, but it cannot even decode the
- image enough to get the image dimensions (e.g. the image is corrupted, or the format is not
- supported, or no data could be obtained).</dl>
- <p>An <a href=#image-request id=the-img-element:image-request-3>image request</a>'s <a href=#img-req-url id=the-img-element:img-req-url>current URL</a> is initially the empty string.</p>
- <p>An <a href=#image-request id=the-img-element:image-request-4>image request</a>'s <a href=#img-req-data id=the-img-element:img-req-data>image data</a> is the decoded image data.</p>
- <p>When an <a href=#image-request id=the-img-element:image-request-5>image request</a> is either in the <a href=#img-inc id=the-img-element:img-inc>partially
- available</a> state or in the <a href=#img-all id=the-img-element:img-all>completely available</a> state, it is
- said to be <dfn id=img-available>available</dfn>.</p>
- <p>An <a href=#image-request id=the-img-element:image-request-6>image request</a> is initially <a href=#img-none id=the-img-element:img-none>unavailable</a>.</p>
- <p>When an <code id=the-img-element:the-img-element-9><a href=#the-img-element>img</a></code> element is <a href=#img-available id=the-img-element:img-available>available</a>, it
- <a href=#provides-a-paint-source id=the-img-element:provides-a-paint-source>provides a paint source</a> whose width is the image's intrinsic width, whose height is
- the image's intrinsic height, and whose appearance is the intrinsic appearance of the image.</p>
- <p>In a <a href=#browsing-context id=the-img-element:browsing-context>browsing context</a> where <a href=#concept-bc-noscript id=the-img-element:concept-bc-noscript>scripting is
- disabled</a>, user agents may obtain images immediately or on demand. In a <a href=#browsing-context id=the-img-element:browsing-context-2>browsing
- context</a> where <a href=#concept-bc-noscript id=the-img-element:concept-bc-noscript-2>scripting is enabled</a>, user agents
- must obtain images immediately.</p>
- <p>A user agent that obtains images immediately must synchronously
- <a href=#update-the-image-data id=the-img-element:update-the-image-data>update the image data</a> of an <code id=the-img-element:the-img-element-10><a href=#the-img-element>img</a></code> element,
- with the <i>restart animation</i> flag set if so stated,
- whenever that element is created,
- or has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations>relevant mutations</a>,
- and whenever that element's <a href=#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext>adopting steps</a> are run.</p>
- <p>A user agent that obtains images on demand must <a href=#update-the-image-data id=the-img-element:update-the-image-data-2>update the image data</a> of an
- <code id=the-img-element:the-img-element-11><a href=#the-img-element>img</a></code> element whenever it needs the image data (i.e. on demand),
- but only if the <code id=the-img-element:the-img-element-12><a href=#the-img-element>img</a></code> element is in the
- <a href=#img-none id=the-img-element:img-none-2>unavailable</a> state. When an <code id=the-img-element:the-img-element-13><a href=#the-img-element>img</a></code> element
- has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations-2>relevant mutations</a>,
- and whenever that element's <a href=#concept-node-adopt-ext id=the-img-element:concept-node-adopt-ext-2>adopting steps</a> are run, if the user
- agent only obtains images on demand, the <code id=the-img-element:the-img-element-14><a href=#the-img-element>img</a></code> element must return to the <a href=#img-none id=the-img-element:img-none-3>unavailable</a> state.</p>
- <p>The <dfn id=relevant-mutations>relevant mutations</dfn> for an <code id=the-img-element:the-img-element-15><a href=#the-img-element>img</a></code> element are as follows:</p>
- <ul><li><p>The element's <code id=the-img-element:attr-img-src-3><a href=#attr-img-src>src</a></code>,
- <code id=the-img-element:attr-img-srcset-4><a href=#attr-img-srcset>srcset</a></code>
- or <code id=the-img-element:attr-img-sizes-3><a href=#attr-img-sizes>sizes</a></code> attributes are set, changed, or removed.<li><p>The element's <code id=the-img-element:attr-img-src-4><a href=#attr-img-src>src</a></code> attribute is set to the same value as the previous value.
- This must set the <i>restart animation</i> flag for the <a href=#update-the-image-data id=the-img-element:update-the-image-data-3>update the image data</a> algorithm.<li><p>The element's <code id=the-img-element:attr-img-crossorigin-2><a href=#attr-img-crossorigin>crossorigin</a></code> attribute's state is changed.<li><p>The element is inserted into or removed from a <code id=the-img-element:the-picture-element-2><a href=#the-picture-element>picture</a></code> parent element.<li><p>The element's parent is a <code id=the-img-element:the-picture-element-3><a href=#the-picture-element>picture</a></code> element and a
- <code id=the-img-element:the-source-element-when-used-with-the-picture-element-4><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element is inserted as a previous sibling.<li><p>The element's parent is a <code id=the-img-element:the-picture-element-4><a href=#the-picture-element>picture</a></code> element and a
- <code id=the-img-element:the-source-element-when-used-with-the-picture-element-5><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element that was a previous sibling is removed.<li><p>The element's parent is a <code id=the-img-element:the-picture-element-5><a href=#the-picture-element>picture</a></code> element and a
- <code id=the-img-element:the-source-element-when-used-with-the-picture-element-6><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element that is a previous sibling has its
- <code id=the-img-element:attr-picture-source-srcset-2><a href=#attr-picture-source-srcset>srcset</a></code>,
- <code id=the-img-element:attr-picture-source-sizes-2><a href=#attr-picture-source-sizes>sizes</a></code>,
- <code id=the-img-element:attr-picture-source-media><a href=#attr-picture-source-media>media</a></code>
- or <code id=the-img-element:attr-picture-source-type><a href=#attr-picture-source-type>type</a></code> attributes set, changed, or removed.</ul>
- <p>Each <code id=the-img-element:the-img-element-16><a href=#the-img-element>img</a></code> element has a <dfn id=last-selected-source>last selected source</dfn>, which must initially be
- null.</p>
- <p>Each <a href=#image-request id=the-img-element:image-request-7>image request</a> has a <dfn id=current-pixel-density>current pixel density</dfn>, which must initially be undefined.</p>
- <p>When an <code id=the-img-element:the-img-element-17><a href=#the-img-element>img</a></code> element has a <a href=#current-pixel-density id=the-img-element:current-pixel-density>current pixel density</a> that is not 1.0, the
- element's image data must be treated as if its resolution, in device pixels per CSS pixels, was
- the <a href=#current-pixel-density id=the-img-element:current-pixel-density-2>current pixel density</a>.</p>
- <p class=example>For example, if the <a href=#current-pixel-density id=the-img-element:current-pixel-density-3>current pixel density</a> is 3.125, that means
- that there are 300 device pixels per CSS inch, and thus if the image data is 300x600, it has an
- intrinsic dimension of 96 CSS pixels by 192 CSS pixels.</p>
- <p>Each <code id=the-img-element:document><a href=#document>Document</a></code> object must have a <dfn id=list-of-available-images>list of available images</dfn>. Each image
- in this list is identified by a tuple consisting of an <a href=#absolute-url id=the-img-element:absolute-url>absolute URL</a>, a <a href=#cors-settings-attribute id=the-img-element:cors-settings-attribute-2>CORS
- settings attribute</a> mode, and, if the mode is not <a href=#attr-crossorigin-none id=the-img-element:attr-crossorigin-none>No
- CORS</a>, an <a href=#origin-2 id=the-img-element:origin-2>origin</a>.
- Each image furthermore has an <dfn id=ignore-higher-layer-caching>ignore higher-layer caching</dfn> flag.
- User agents may copy entries from one <code id=the-img-element:document-2><a href=#document>Document</a></code>
- object's <a href=#list-of-available-images id=the-img-element:list-of-available-images>list of available images</a> to another at any time (e.g. when the
- <code id=the-img-element:document-3><a href=#document>Document</a></code> is created, user agents can add to it all the images that are loaded in
- other <code id=the-img-element:document-4><a href=#document>Document</a></code>s), but must not change the keys of entries copied in this way when
- doing so, and must unset the <a href=#ignore-higher-layer-caching id=the-img-element:ignore-higher-layer-caching>ignore higher-layer caching</a> flag for the copied entry.
- User agents may also remove images from such lists at any time (e.g. to save
- memory).
- User agents must remove entries in the <a href=#list-of-available-images id=the-img-element:list-of-available-images-2>list of available images</a> as appropriate
- given higher-layer caching semantics for the resource (e.g. the HTTP <code>Cache-Control</code>
- response header) when the <a href=#ignore-higher-layer-caching id=the-img-element:ignore-higher-layer-caching-2>ignore higher-layer caching</a> is unset.</p>
- <p class=note>The <a href=#list-of-available-images id=the-img-element:list-of-available-images-3>list of available images</a> is intended to enable synchronous switching
- when changing the <code id=the-img-element:attr-img-src-5><a href=#attr-img-src>src</a></code> attribute to a URL that has previously been loaded,
- and to avoid re-downloading images in the same document even when they don't allow caching per HTTP.
- It is not used to avoid re-downloading the same image while the previous image is still loading,
- but the <a href=#fetch id=the-img-element:fetch>fetch</a> algorithm allows the download to be reused in that case.</p>
- <p class=note>The user agent can also store the image data in a separately from the <a href=#list-of-available-images id=the-img-element:list-of-available-images-4>list of available images</a>.</p>
- <p class=example>For example, if a resource has the HTTP response header <code>Cache-Control: must-revalidate</code>,
- the user agent would remove it from the <a href=#list-of-available-images id=the-img-element:list-of-available-images-5>list of available images</a> but could keep the image data separately,
- and use that if the server responds with a <code>304 Not Modified</code> status.</p>
- <p>When the user agent is to <dfn id=update-the-image-data>update the image data</dfn> of an <code id=the-img-element:the-img-element-18><a href=#the-img-element>img</a></code> element,
- optionally with the <i>restart animations</i> flag set,
- it must run the following steps:</p>
- <ol><li><p>If the element's <a id=the-img-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not the <a href=#active-document id=the-img-element:active-document>active document</a>,
- abort these steps.<li><p>If the user agent cannot support images, or its support for images has been disabled, then
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-3>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-2>pending request</a>,
- set <a href=#current-request id=the-img-element:current-request-4>current request</a> to the <a href=#img-none id=the-img-element:img-none-4>unavailable</a> state,
- let <a href=#pending-request id=the-img-element:pending-request-3>pending request</a> be null,
- and abort these steps.<li>
- <p>If the element does not have a <code id=the-img-element:attr-img-srcset-5><a href=#attr-img-srcset>srcset</a></code> attribute specified and
- it does not have a parent or it has a parent but it is not a <code id=the-img-element:the-picture-element-6><a href=#the-picture-element>picture</a></code> element,
- and it has a <code id=the-img-element:attr-img-src-6><a href=#attr-img-src>src</a></code> attribute specified and
- its value is not the empty string, let <var>selected source</var> be the value of the
- element's <code id=the-img-element:attr-img-src-7><a href=#attr-img-src>src</a></code> attribute, and <var>selected pixel
- density</var> be 1.0. Otherwise, let <var>selected source</var> be null and <var>selected pixel density</var> be undefined.</p>
- <li><p>Let the <code id=the-img-element:the-img-element-19><a href=#the-img-element>img</a></code> element's <a href=#last-selected-source id=the-img-element:last-selected-source>last selected source</a> be <var>selected source</var>.<li>
- <p>If <var>selected source</var> is not null, run these substeps:</p>
- <ol><li><p><a href=#resolve-a-url id=the-img-element:resolve-a-url>Resolve</a> <var>selected source</var>, relative
- to the element, and let the result be <var>absolute URL</var>. If that is not successful, then
- abort these inner set of steps.<li><p>Let <var>key</var> be a tuple consisting of the resulting <a href=#absolute-url id=the-img-element:absolute-url-2>absolute
- URL</a>, the <code id=the-img-element:the-img-element-20><a href=#the-img-element>img</a></code> element's <code id=the-img-element:attr-img-crossorigin-3><a href=#attr-img-crossorigin>crossorigin</a></code>
- attribute's mode, and, if that mode is not <a href=#attr-crossorigin-none id=the-img-element:attr-crossorigin-none-2>No CORS</a>,
- the <a id=the-img-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#origin-2 id=the-img-element:origin-2-2>origin</a>.<li><p>If the <a href=#list-of-available-images id=the-img-element:list-of-available-images-6>list of available images</a> contains an entry for <var>key</var>, then
- set the <a href=#ignore-higher-layer-caching id=the-img-element:ignore-higher-layer-caching-3>ignore higher-layer caching</a> flag for that entry,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-2>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-5>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-4>pending request</a>,
- let <a href=#pending-request id=the-img-element:pending-request-5>pending request</a> be null,
- let <a href=#current-request id=the-img-element:current-request-6>current request</a> be a new <a href=#image-request id=the-img-element:image-request-8>image request</a> whose <a href=#img-req-data id=the-img-element:img-req-data-2>image data</a> is that of the entry
- and whose state is set to the <a href=#img-all id=the-img-element:img-all-2>completely available</a> state,
- update the presentation of the image appropriately,
- let the <a href=#current-request id=the-img-element:current-request-7>current request</a>'s <a href=#current-pixel-density id=the-img-element:current-pixel-density-4>current pixel density</a> be <var>selected pixel density</var>,
- <a href=#queue-a-task id=the-img-element:queue-a-task>queue a task</a> to <a href=#restart-the-animation id=the-img-element:restart-the-animation>restart the animation</a> if <i>restart animation</i> is set,
- change <a href=#current-request id=the-img-element:current-request-8>current request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-2>current URL</a> to <var>absolute URL</var>,
- and then <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event>fire a simple event</a> named <code id=the-img-element:event-load><a href=#event-load>load</a></code> at the <code id=the-img-element:the-img-element-21><a href=#the-img-element>img</a></code> element,
- and abort these steps.</ol>
- <li><p>Asynchronously <a href=#await-a-stable-state id=the-img-element:await-a-stable-state>await a stable state</a>, allowing the <a href=#concept-task id=the-img-element:concept-task>task</a> that invoked this algorithm to continue.
- The <a href=#synchronous-section id=the-img-element:synchronous-section>synchronous
- section</a> consists of all the remaining steps of this algorithm until the algorithm says the
- <a href=#synchronous-section id=the-img-element:synchronous-section-2>synchronous section</a> has ended. (Steps in <a href=#synchronous-section id=the-img-element:synchronous-section-3>synchronous sections</a> are marked with ⌛.)<li>
- <p>⌛ If another instance of this algorithm for this <code id=the-img-element:the-img-element-22><a href=#the-img-element>img</a></code> element was started
- after this instance (even if it aborted and is no longer running), then abort these steps.</p>
- <p class=note>Only the last instance takes effect, to avoid multiple requests when, for
- example, the <code id=the-img-element:attr-img-src-8><a href=#attr-img-src>src</a></code>, <code id=the-img-element:attr-img-srcset-6><a href=#attr-img-srcset>srcset</a></code>,
- and <code id=the-img-element:attr-img-crossorigin-4><a href=#attr-img-crossorigin>crossorigin</a></code> attributes are all set in
- succession.</p>
- <li>
- <p>⌛ Let <var>selected source</var> and <var>selected pixel density</var> be the
- URL and pixel density that results from <a href=#select-an-image-source id=the-img-element:select-an-image-source>selecting an image source</a>,
- respectively.</p>
- <li>
- <p>⌛ If <var>selected source</var> is null, run these substeps:</p>
- <ol><li><p>⌛ Set the <a href=#current-request id=the-img-element:current-request-9>current request</a> to the <a href=#img-error id=the-img-element:img-error>broken</a> state,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-3>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-10>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-6>pending request</a>,
- and let <a href=#pending-request id=the-img-element:pending-request-7>pending request</a> be null.<li><p>⌛ <a href=#queue-a-task id=the-img-element:queue-a-task-2>Queue a task</a> to change the <a href=#current-request id=the-img-element:current-request-11>current request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-3>current URL</a> to the empty string,
- and then, if the element has a <code id=the-img-element:attr-img-src-9><a href=#attr-img-src>src</a></code> attribute
- or a <code id=the-img-element:attr-img-srcset-7><a href=#attr-img-srcset>srcset</a></code> attribute
- or a parent that is a <code id=the-img-element:the-picture-element-7><a href=#the-picture-element>picture</a></code> element,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-2>fire a simple event</a> named <code id=the-img-element:event-error><a href=#event-error>error</a></code> at the <code id=the-img-element:the-img-element-23><a href=#the-img-element>img</a></code> element.<li><p>⌛ Abort this algorithm.</ol>
- <li>
- <p>⌛ <a href=#queue-a-task id=the-img-element:queue-a-task-3>Queue a task</a> to <a href=#fire-a-progress-event id=the-img-element:fire-a-progress-event>fire a progress event</a> named <code id=the-img-element:event-loadstart><a href=#event-loadstart>loadstart</a></code> at
- the <code id=the-img-element:the-img-element-24><a href=#the-img-element>img</a></code> element.</p>
- <li><p>⌛ <a href=#resolve-a-url id=the-img-element:resolve-a-url-2>Resolve</a> <var>selected source</var>, relative
- to the element, and let the result be <var>absolute URL</var>. If that is not successful, then
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-4>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-12>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-8>pending request</a>,
- set the <a href=#current-request id=the-img-element:current-request-13>current request</a> to the <a href=#img-error id=the-img-element:img-error-2>broken</a> state,
- let <a href=#pending-request id=the-img-element:pending-request-9>pending request</a> be null,
- <a href=#queue-a-task id=the-img-element:queue-a-task-4>queue a task</a> to
- change the <a href=#current-request id=the-img-element:current-request-14>current request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-4>current URL</a> to <var>absolute URL</var>,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-3>fire a simple event</a> named <code id=the-img-element:event-error-2><a href=#event-error>error</a></code> at the <code id=the-img-element:the-img-element-25><a href=#the-img-element>img</a></code> element
- and then <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-4>fire a simple event</a> named <code id=the-img-element:event-loadend><a href=#event-loadend>loadend</a></code> at the <code id=the-img-element:the-img-element-26><a href=#the-img-element>img</a></code> element,
- and abort these steps.<li>
- <p>⌛ If the <a href=#pending-request id=the-img-element:pending-request-10>pending request</a> is not null,
- and <var>absolute URL</var> is the same as the <a href=#pending-request id=the-img-element:pending-request-11>pending request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-5>current URL</a>,
- then abort these steps.</p>
- <p>⌛ If <var>absolute URL</var> is the same as the <a href=#current-request id=the-img-element:current-request-15>current request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-6>current URL</a>,
- and <a href=#current-request id=the-img-element:current-request-16>current request</a> is in the <a href=#img-inc id=the-img-element:img-inc-2>partially available</a> state,
- then <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-5>abort the image request</a> for the <a href=#pending-request id=the-img-element:pending-request-12>pending request</a>,
- <a href=#queue-a-task id=the-img-element:queue-a-task-5>queue a task</a> to <a href=#restart-the-animation id=the-img-element:restart-the-animation-2>restart the animation</a> if <i>restart animation</i> is set,
- and abort these steps.</p>
- <p>⌛ If the <a href=#pending-request id=the-img-element:pending-request-13>pending request</a> is not null,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-6>abort the image request</a> for the <a href=#pending-request id=the-img-element:pending-request-14>pending request</a>.</p>
- <p>⌛ Let <var>image request</var> be a new <a href=#image-request id=the-img-element:image-request-9>image request</a>
- whose <a href=#img-req-url id=the-img-element:img-req-url-7>current URL</a> is <var>absolute URL</var>.</p>
- <p>⌛ Let the <a href=#pending-request id=the-img-element:pending-request-15>pending request</a> be <var>image request</var>.</p>
- <p>⌛ Do a <a href=#potentially-cors-enabled-fetch id=the-img-element:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of <var>absolute URL</var>,
- with the <i>mode</i> being the current state of
- the element's <code id=the-img-element:attr-img-crossorigin-5><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute,
- the <i>origin</i> being the <a href=#origin-2 id=the-img-element:origin-2-3>origin</a> of the <code id=the-img-element:the-img-element-27><a href=#the-img-element>img</a></code> element's
- <a id=the-img-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the <i>default origin behaviour</i> set to <i>taint</i>.
- Let this instance of the <a href=#fetch id=the-img-element:fetch-2>fetching</a> algorithm be associated with <var>image request</var>.</p>
- <p>If the element has a <code id=the-img-element:attr-img-srcset-8><a href=#attr-img-srcset>srcset</a></code> attribute
- or a parent that is a <code id=the-img-element:the-picture-element-8><a href=#the-picture-element>picture</a></code> element,
- the fetching request's <a href=#concept-request-context id=the-img-element:concept-request-context>context</a> must be set to <i>imageset</i>.
- Otherwise it must be set to <i>image</i>. <a href=#refsFETCH>[FETCH]</a></p>
- <p class=critical>This specification does not yet use the "fetch" algorithm from the WHATWG Fetch specification.
- It will be updated to do so in due course.</p>
- <p>The resource obtained in this fashion, if any, is <var>image request</var>'s <a href=#img-req-data id=the-img-element:img-req-data-3>image data</a>.
- It can be either <a href=#cors-same-origin id=the-img-element:cors-same-origin>CORS-same-origin</a> or <a href=#cors-cross-origin id=the-img-element:cors-cross-origin>CORS-cross-origin</a>; this affects
- the <a href=#origin-2 id=the-img-element:origin-2-4>origin</a> of the image itself (e.g. when used on a <code id=the-img-element:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code>).</p>
-
- <p>Fetching the image must <a href=#delay-the-load-event id=the-img-element:delay-the-load-event>delay the load event</a> of the element's <a id=the-img-element:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> until the
- <a href=#concept-task id=the-img-element:concept-task-2>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-6>queued</a> by the
- <a href=#networking-task-source id=the-img-element:networking-task-source>networking task source</a> once the resource has been <a href=#fetch id=the-img-element:fetch-3>fetched</a> (<a href=#img-load>defined below</a>) has been run.
- </p>
- <p class=warning>This, unfortunately, can be used to perform a rudimentary port scan of the
- user's local network (especially in conjunction with scripting, though scripting isn't actually
- necessary to carry out such an attack). User agents may implement <a href=#origin-2 id=the-img-element:origin-2-5>cross-origin</a> access control policies that are stricter than those
- described above to mitigate this attack, but unfortunately such policies are typically not
- compatible with existing Web content.</p>
- <p>If the resource is <a href=#cors-same-origin id=the-img-element:cors-same-origin-2>CORS-same-origin</a>, each <a href=#concept-task id=the-img-element:concept-task-3>task</a>
- that is <a href=#queue-a-task id=the-img-element:queue-a-task-7>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-2>networking task source</a>
- while the image is being <a href=#fetch id=the-img-element:fetch-4>fetched</a>,
- if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-17>current request</a>,
- must <a href=#fire-a-progress-event id=the-img-element:fire-a-progress-event-2>fire a progress event</a> named <code id=the-img-element:event-progress><a href=#event-progress>progress</a></code> at the <code id=the-img-element:the-img-element-28><a href=#the-img-element>img</a></code> element.</p>
- <li><p>End the <a href=#synchronous-section id=the-img-element:synchronous-section-4>synchronous section</a>, continuing the remaining steps asynchronously,
- but without missing any data from the <a href=#fetch id=the-img-element:fetch-5>fetch</a> algorithm.<li>
- <p>As soon as possible, jump to the first applicable entry from the following list:</p>
- <dl class=switch><dt>If the resource type is <code id=the-img-element:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code><dd>
- <p>The next <a href=#concept-task id=the-img-element:concept-task-4>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-8>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-3>networking task source</a> while the image is being <a href=#fetch id=the-img-element:fetch-6>fetched</a> must run the following steps:</p>
- <ol><li>
- <p>If <var>image request</var> is the <a href=#pending-request id=the-img-element:pending-request-16>pending request</a>
- and the user agent is able to determine <var>image request</var>'s image's width and height,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-7>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-18>current request</a>,
- <a href=#upgrade-the-pending-request-to-the-current-request id=the-img-element:upgrade-the-pending-request-to-the-current-request>upgrade the pending request to the current request</a> and
- set the <a href=#current-request id=the-img-element:current-request-19>current request</a>'s state to <a href=#img-inc id=the-img-element:img-inc-3>partially available</a>.</p>
- <li>
- <p>Otherwise, if <var>image request</var> is the <a href=#pending-request id=the-img-element:pending-request-17>pending request</a>
- and the user agent is able to determine that <var>image request</var>'s image
- is corrupted in some fatal way such that the image dimensions cannot be obtained,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-8>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-20>current request</a>,
- <a href=#upgrade-the-pending-request-to-the-current-request id=the-img-element:upgrade-the-pending-request-to-the-current-request-2>upgrade the pending request to the current request</a>
- and set the <a href=#current-request id=the-img-element:current-request-21>current request</a>'s state to <a href=#img-error id=the-img-element:img-error-3>broken</a>.</p>
- <li>
- <p>Otherwise, if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-22>current request</a>,
- it is in the <a href=#img-none id=the-img-element:img-none-5>unavailable</a> state,
- and the user agent is able to determine <var>image request</var>'s image's width and height,
- set the <a href=#current-request id=the-img-element:current-request-23>current request</a>'s state to <a href=#img-inc id=the-img-element:img-inc-4>partially available</a>.</p>
- <li>
- <p>Otherwise, if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-24>current request</a>,
- it is in the <a href=#img-none id=the-img-element:img-none-6>unavailable</a> state,
- and the user agent is able to determine that <var>image request</var>'s image
- is corrupted in some fatal way such that the image dimensions cannot be obtained,
- set the <a href=#current-request id=the-img-element:current-request-25>current request</a>'s state to <a href=#img-error id=the-img-element:img-error-4>broken</a>.
- </p>
- </ol>
- <p>Each <a href=#concept-task id=the-img-element:concept-task-5>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-9>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-4>networking task source</a> while the image is being <a href=#fetch id=the-img-element:fetch-7>fetched</a> must update the presentation of the image, but as each new body
- part comes in, it must replace the previous image. Once one body part has been completely
- decoded, the user agent must set the <code id=the-img-element:the-img-element-29><a href=#the-img-element>img</a></code> element to the <a href=#img-all id=the-img-element:img-all-3>completely available</a> state and <a href=#queue-a-task id=the-img-element:queue-a-task-10>queue a task</a> to <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-5>fire
- a simple event</a> named <code id=the-img-element:event-load-2><a href=#event-load>load</a></code> at the <code id=the-img-element:the-img-element-30><a href=#the-img-element>img</a></code>
- element. </p>
- <p class=note>The <code id=the-img-element:event-progress-2><a href=#event-progress>progress</a></code> and <code id=the-img-element:event-loadend-2><a href=#event-loadend>loadend</a></code> events are not fired for
- <code id=the-img-element:multipart/x-mixed-replace-2><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> image streams.</p>
- <dt>If the resource type and data corresponds to a supported image format, <a href=#img-determine-type>as described below</a><dd>
- <p>The next <a href=#concept-task id=the-img-element:concept-task-6>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-11>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-5>networking task source</a> while the image is being <a href=#fetch id=the-img-element:fetch-8>fetched</a> must run the following steps:</p>
- <ol><li>
- <p>If the user agent is able to determine <var>image request</var>'s image's width and height,
- and <var>image request</var> is <a href=#pending-request id=the-img-element:pending-request-18>pending request</a>,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-9>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-26>current request</a>,
- <a href=#upgrade-the-pending-request-to-the-current-request id=the-img-element:upgrade-the-pending-request-to-the-current-request-3>upgrade the pending request to the current request</a>,
- update the <code id=the-img-element:the-img-element-31><a href=#the-img-element>img</a></code> element's presentation appropriately,
- and set <var>image request</var>'s state to <a href=#img-inc id=the-img-element:img-inc-5>partially available</a>.</p>
- <li>
- <p>Otherwise, if the user agent is able to determine <var>image request</var>'s image's width and height,
- and <var>image request</var> is <a href=#current-request id=the-img-element:current-request-27>current request</a>,
- update the <code id=the-img-element:the-img-element-32><a href=#the-img-element>img</a></code> element's presentation appropriately
- and set <var>image request</var>'s state to <a href=#img-inc id=the-img-element:img-inc-6>partially available</a>.</p>
- <li>
- <p>Otherwise, if the user agent is able to determine that <var>image request</var>'s image
- is corrupted in some fatal way such that the image dimensions cannot be obtained,
- and <var>image request</var> is <a href=#pending-request id=the-img-element:pending-request-19>pending request</a>,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-10>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-28>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-20>pending request</a>,
- <a href=#upgrade-the-pending-request-to-the-current-request id=the-img-element:upgrade-the-pending-request-to-the-current-request-4>upgrade the pending request to the current request</a>,
- set <a href=#current-request id=the-img-element:current-request-29>current request</a> to the <a href=#img-error id=the-img-element:img-error-5>broken</a> state,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-6>fire a simple event</a> named <code id=the-img-element:event-error-3><a href=#event-error>error</a></code> at the <code id=the-img-element:the-img-element-33><a href=#the-img-element>img</a></code> element,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-7>fire a simple event</a> named <code id=the-img-element:event-loadend-3><a href=#event-loadend>loadend</a></code> at the <code id=the-img-element:the-img-element-34><a href=#the-img-element>img</a></code> element,
- and abort these steps.</p>
- <li>
- <p>Otherwise, if the user agent is able to determine that <var>image request</var>'s image
- is corrupted in some fatal way such that the image dimensions cannot be obtained,
- and <var>image request</var> is <a href=#current-request id=the-img-element:current-request-30>current request</a>,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-11>abort the image request</a> for <var>image request</var>,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-8>fire a simple event</a> named <code id=the-img-element:event-error-4><a href=#event-error>error</a></code> at the <code id=the-img-element:the-img-element-35><a href=#the-img-element>img</a></code> element,
- <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-9>fire a simple event</a> named <code id=the-img-element:event-loadend-4><a href=#event-loadend>loadend</a></code> at the <code id=the-img-element:the-img-element-36><a href=#the-img-element>img</a></code> element,
- and abort these steps.</p>
- </ol>
- <p id=img-load>That <a href=#concept-task id=the-img-element:concept-task-7>task</a>, and each subsequent <a href=#concept-task id=the-img-element:concept-task-8>task</a>, that is <a href=#queue-a-task id=the-img-element:queue-a-task-12>queued</a> by the
- <a href=#networking-task-source id=the-img-element:networking-task-source-6>networking task source</a> while the image is being <a href=#fetch id=the-img-element:fetch-9>fetched</a>,
- if <var>image request</var> is the <a href=#current-request id=the-img-element:current-request-31>current request</a>,
- must update the presentation of the image appropriately (e.g. if
- the image is a progressive JPEG, each packet can improve the resolution of the image).</p>
- <p>Furthermore, the last <a href=#concept-task id=the-img-element:concept-task-9>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-13>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-7>networking task source</a> once the resource has been
- <a href=#fetch id=the-img-element:fetch-10>fetched</a> must additionally run these steps:</p>
- <ol><li><p>Set <var>image request</var> to the <a href=#img-all id=the-img-element:img-all-4>completely
- available</a> state.</p>
- <li><p>Add the image to the <a href=#list-of-available-images id=the-img-element:list-of-available-images-7>list of available images</a> using the key <var>key</var>, with the <a href=#ignore-higher-layer-caching id=the-img-element:ignore-higher-layer-caching-4>ignore higher-layer caching</a> flag set.<li><p><a href=#fire-a-progress-event-or-simple-event id=the-img-element:fire-a-progress-event-or-simple-event>Fire a progress event or simple event</a> named <code id=the-img-element:event-load-3><a href=#event-load>load</a></code>
- at the <code id=the-img-element:the-img-element-37><a href=#the-img-element>img</a></code> element, depending on the resource in <var>image request</var>.<li><p><a href=#fire-a-progress-event-or-simple-event id=the-img-element:fire-a-progress-event-or-simple-event-2>Fire a progress event or simple event</a> named <code id=the-img-element:event-loadend-5><a href=#event-loadend>loadend</a></code>
- at the <code id=the-img-element:the-img-element-38><a href=#the-img-element>img</a></code> element, depending on the resource in <var>image request</var>.</ol>
- <dt>Otherwise<dd>
- <p>The image data is not in a supported file format; the user agent must set
- <var>image request</var> to the <a href=#img-error id=the-img-element:img-error-6>broken</a> state,
- <a href=#abort-the-image-request id=the-img-element:abort-the-image-request-12>abort the image request</a> for the <a href=#current-request id=the-img-element:current-request-32>current request</a> and the <a href=#pending-request id=the-img-element:pending-request-21>pending request</a>,
- <a href=#upgrade-the-pending-request-to-the-current-request id=the-img-element:upgrade-the-pending-request-to-the-current-request-5>upgrade the pending request to the current request</a>,
- and then <a href=#queue-a-task id=the-img-element:queue-a-task-14>queue a task</a> to first <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-10>fire a simple event</a> named <code id=the-img-element:event-error-5><a href=#event-error>error</a></code> at the <code id=the-img-element:the-img-element-39><a href=#the-img-element>img</a></code> element and then <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-11>fire a simple
- event</a> named <code id=the-img-element:event-loadend-6><a href=#event-loadend>loadend</a></code> at the <code id=the-img-element:the-img-element-40><a href=#the-img-element>img</a></code>
- element.</p>
- </dl>
- </ol>
- <p>To <dfn id=abort-the-image-request>abort the image request</dfn> for an <a href=#image-request id=the-img-element:image-request-10>image request</a> <var>image request</var> means to run the following steps:</p>
- <ol><li><p>Forget <var>image request</var>'s <a href=#img-req-data id=the-img-element:img-req-data-4>image data</a>, if any.<li><p>Abort any instance of the <a href=#fetch id=the-img-element:fetch-11>fetching</a> algorithm for <var>image request</var>,
- discarding any pending tasks generated by that algorithm.</ol>
- <p>To <dfn id=upgrade-the-pending-request-to-the-current-request>upgrade the pending request to the current request</dfn> for an <code id=the-img-element:the-img-element-41><a href=#the-img-element>img</a></code> element means to run the following steps:</p>
- <ol><li><p>Let the <code id=the-img-element:the-img-element-42><a href=#the-img-element>img</a></code> element's <a href=#current-request id=the-img-element:current-request-33>current request</a> be the <a href=#pending-request id=the-img-element:pending-request-22>pending request</a>.<li><p>Let the <code id=the-img-element:the-img-element-43><a href=#the-img-element>img</a></code> element's <a href=#pending-request id=the-img-element:pending-request-23>pending request</a> be null.</ol>
- <p>To <dfn id=fire-a-progress-event-or-simple-event>fire a progress event or simple event</dfn> named <var>type</var> at an element <var>e</var>,
- depending on resource <var>r</var>, means to
- <a href=#fire-a-progress-event id=the-img-element:fire-a-progress-event-3>fire a progress event</a> named <var>type</var> at <var>e</var> if <var>r</var> is <a href=#cors-same-origin id=the-img-element:cors-same-origin-3>CORS-same-origin</a>,
- and otherwise <a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-12>fire a simple event</a> named <var>type</var> at <var>e</var>.</p>
- <p>While a user agent is running the above algorithm for an element <var>x</var>, there
- must be a strong reference from the element's <a id=the-img-element:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> to the element <var>x</var>,
- even if that element is not <a href=#in-a-document id=the-img-element:in-a-document>in its <code>Document</code></a>.</p>
- <p>When an <code id=the-img-element:the-img-element-44><a href=#the-img-element>img</a></code> element is in the <a href=#img-all id=the-img-element:img-all-5>completely available</a>
- state <em>and</em> the user agent can decode the media data without errors, then the
- <code id=the-img-element:the-img-element-45><a href=#the-img-element>img</a></code> element is said to be <dfn id=img-good>fully decodable</dfn>.</p>
- <p>Whether the image is fetched successfully or not (e.g. whether the response code was a 2xx code
- <a href=#concept-http-equivalent-codes id=the-img-element:concept-http-equivalent-codes>or equivalent</a>) must be ignored when determining
- the image's type and whether it is a valid image.</p>
- <p class=note>This allows servers to return images with error responses, and have them
- displayed.</p>
- <p id=img-determine-type>The user agent should apply the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id=the-img-element:content-type-sniffing:-image data-x-internal=content-type-sniffing:-image>image sniffing rules</a> to determine the type of the image, with the image's <a href=#content-type id=the-img-element:content-type>associated Content-Type headers</a> giving the <var>official
- type</var>. If these rules are not applied, then the type of the image must be the type given by
- the image's <a href=#content-type id=the-img-element:content-type-2>associated Content-Type headers</a>.</p>
- <p>User agents must not support non-image resources with the <code id=the-img-element:the-img-element-46><a href=#the-img-element>img</a></code> element (e.g. XML
- files whose root element is an HTML element). User agents must not run executable code (e.g.
- scripts) embedded in the image resource. User agents must only display the first page of a
- multipage resource (e.g. a PDF file). User agents must not allow the resource to act in an
- interactive fashion, but should honor any animation in the resource.</p>
- <p>This specification does not specify which image types are to be supported.</p>
- <hr>
- <p>An <code id=the-img-element:the-img-element-47><a href=#the-img-element>img</a></code> element is associated with a <a href=#source-set id=the-img-element:source-set>source set</a>.</p>
- <p>A <dfn id=source-set>source set</dfn> is a set of zero or more <a href=#image-source id=the-img-element:image-source>image sources</a>
- and a <a href=#source-size-2 id=the-img-element:source-size-2>source size</a>.</p>
- <p>An <dfn id=image-source>image source</dfn> is a <a href=#url id=the-img-element:url>URL</a>,
- and optionally either a density descriptor, or a width descriptor.</p>
- <p>A <dfn id=source-size-2>source size</dfn> is a <a href=#source-size-value id=the-img-element:source-size-value-6><source-size-value></a>.
- When a <a href=#source-size-2 id=the-img-element:source-size-2-2>source size</a> has a unit relative to the viewport,
- it must be interpreted relative to the <code id=the-img-element:the-img-element-48><a href=#the-img-element>img</a></code> element's <a id=the-img-element:node-document-6 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s viewport.
- Other units must be interpreted the same as in Media Queries. <a href=#refsMQ>[MQ]</a></p>
- <p>When asked to <dfn id=select-an-image-source>select an image source</dfn> for a given <code id=the-img-element:the-img-element-49><a href=#the-img-element>img</a></code> element <var>el</var>,
- user agents must do the following:</p>
- <ol><li><p><a href=#update-the-source-set id=the-img-element:update-the-source-set>Update the source set</a> for <var>el</var>.<li><p>If <var>el</var>'s <a href=#source-set id=the-img-element:source-set-2>source set</a> is empty,
- return null as the URL and undefined as the pixel density and abort these steps.<li><p>Otherwise, take <var>el</var>'s <a href=#source-set id=the-img-element:source-set-3>source set</a>
- and let it be <var>source set</var>.<li><p>If an entry <var>b</var> in <var>source set</var> has the same associated density descriptor
- as an earlier entry <var>a</var> in <var>source set</var>, then remove entry <var>b</var>.
- Repeat this step until none of the entries in <var>source set</var> have the same associated density descriptor as an earlier entry.<li><p>In a user agent-specific manner,
- choose one <a href=#image-source id=the-img-element:image-source-2>image source</a> from <var>source set</var>.
- Let this be <var>selected source</var>.<li><p>Return <var>selected source</var> and its associated pixel density.</ol>
- <p>When asked to <dfn id=update-the-source-set>update the source set</dfn> for a given <code id=the-img-element:the-img-element-50><a href=#the-img-element>img</a></code> element <var>el</var>,
- user agents must do the following:</p>
- <ol><li><p>Set <var>el</var>'s <a href=#source-set id=the-img-element:source-set-4>source set</a> to an empty <a href=#source-set id=the-img-element:source-set-5>source set</a>.<li><p>If <var>el</var> has a parent node and that is a <code id=the-img-element:the-picture-element-9><a href=#the-picture-element>picture</a></code> element,
- let <var>elements</var> be an array containing <var>el</var>'s parent node's child elements, retaining relative order.
- Otherwise, let <var>elements</var> be array containing only <var>el</var>.<li>
- <p>Iterate through <var>elements</var>,
- doing the following for each item <var>child</var>:</p>
- <ol><li>
- <p>If <var>child</var> is <var>el</var>:</p>
- <ol><li><p>If <var>child</var> has a <code id=the-img-element:attr-img-srcset-9><a href=#attr-img-srcset>srcset</a></code> attribute,
- <a href=#parse-a-srcset-attribute id=the-img-element:parse-a-srcset-attribute>parse <var>child</var>'s srcset attribute</a>
- and let the returned <a href=#source-set id=the-img-element:source-set-6>source set</a> be <var>source set</var>.
- Otherwise, let <var>source set</var> be an empty <a href=#source-set id=the-img-element:source-set-7>source set</a>.<li><p><a href=#parse-a-sizes-attribute id=the-img-element:parse-a-sizes-attribute>Parse <var>child</var>'s sizes attribute</a> and
- let <var>source set</var>'s <a href=#source-size-2 id=the-img-element:source-size-2-3>source size</a> be the returned value.<li><p>If <var>child</var> has a <code id=the-img-element:attr-img-src-10><a href=#attr-img-src>src</a></code> attribute
- whose value is not the empty string
- and <var>source set</var> does not contain an
- <a href=#image-source id=the-img-element:image-source-3>image source</a> with a density descriptor value of 1,
- and no <a href=#image-source id=the-img-element:image-source-4>image source</a> with a width descriptor,
- append <var>child</var>'s <code id=the-img-element:attr-img-src-11><a href=#attr-img-src>src</a></code> attribute value to <var>source set</var>.<li><p><a href=#normalize-the-source-densities id=the-img-element:normalize-the-source-densities>Normalize the source densities</a> of <var>source set</var>.<li><p>Let <var>el</var>'s <a href=#source-set id=the-img-element:source-set-8>source set</a> be <var>source set</var>.<li><p>Abort this algorithm.</ol>
- <li><p>If <var>child</var> is not a <code id=the-img-element:the-source-element-when-used-with-the-picture-element-7><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element,
- continue to the next child.
- Otherwise, <var>child</var> is a <code id=the-img-element:the-source-element-when-used-with-the-picture-element-8><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> element.<li><p>If <var>child</var> does not have a <code id=the-img-element:attr-picture-source-srcset-3><a href=#attr-picture-source-srcset>srcset</a></code> attribute,
- continue to the next child.<li><p><a href=#parse-a-srcset-attribute id=the-img-element:parse-a-srcset-attribute-2>Parse <var>child</var>'s srcset attribute</a> and
- let the returned <a href=#source-set id=the-img-element:source-set-9>source set</a> be <var>source set</var>.<li><p>If <var>source set</var> has zero <a href=#image-source id=the-img-element:image-source-5>image sources</a>,
- continue to the next child.<li><p>If <var>child</var> has a <code id=the-img-element:attr-picture-source-media-2><a href=#attr-picture-source-media>media</a></code> attribute,
- and its value is not a <a href=#valid-media-query-list id=the-img-element:valid-media-query-list>valid media query list</a>,
- or is a <a href=#valid-media-query-list id=the-img-element:valid-media-query-list-2>valid media query list</a> that evaluates to false,
- continue to the next child.<li><p><a href=#parse-a-sizes-attribute id=the-img-element:parse-a-sizes-attribute-2>Parse <var>child</var>'s sizes attribute</a>
- and let <var>source set</var>'s <a href=#source-size-2 id=the-img-element:source-size-2-4>source size</a> be the returned value.<li><p>If <var>child</var> has a <code id=the-img-element:attr-picture-source-type-2><a href=#attr-picture-source-type>type</a></code> attribute,
- and its value is an unknown or unsupported <a href=#mime-type id=the-img-element:mime-type>MIME type</a>,
- continue to the next child.<li><p><a href=#normalize-the-source-densities id=the-img-element:normalize-the-source-densities-2>Normalize the source densities</a> of <var>source set</var>.<li><p>Let <var>el</var>'s <a href=#source-set id=the-img-element:source-set-10>source set</a> be <var>source set</var>.<li><p>Abort this algorithm.</ol>
- </ol>
- <p class=note>Each <code id=the-img-element:the-img-element-51><a href=#the-img-element>img</a></code> element independently considers
- its previous sibling <code id=the-img-element:the-source-element-when-used-with-the-picture-element-9><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements
- plus the <code id=the-img-element:the-img-element-52><a href=#the-img-element>img</a></code> element itself
- for selecting an <a href=#image-source id=the-img-element:image-source-6>image source</a>, ignoring any other (invalid) elements,
- including other <code id=the-img-element:the-img-element-53><a href=#the-img-element>img</a></code> elements in the same <code id=the-img-element:the-picture-element-10><a href=#the-picture-element>picture</a></code> element,
- or <code id=the-img-element:the-source-element-when-used-with-the-picture-element-10><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements that are following siblings
- of the relevant <code id=the-img-element:the-img-element-54><a href=#the-img-element>img</a></code> element.</p>
- <p>When asked to <dfn id=parse-a-srcset-attribute>parse a srcset attribute</dfn> from an element,
- parse the value of the element's <code>srcset</code> attribute as follows:</p>
- <ol><li><p>Let <var>input</var> be the value passed to this algorithm.<li><p>Let <var>position</var> be a pointer into <var>input</var>,
- initially pointing at the start of the string.<li><p>Let <var>candidates</var> be an initially empty <a href=#source-set id=the-img-element:source-set-11>source set</a>.
- The order of entries in the list is the order in which entries are added to the list.<li><p><i>Splitting loop</i>: <a href=#collect-a-sequence-of-characters id=the-img-element:collect-a-sequence-of-characters>Collect a sequence of characters</a>
- that are <a href=#space-character id=the-img-element:space-character-8>space characters</a> or U+002C COMMA characters.
- If any U+002C COMMA characters were collected, that is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error>parse error</a>.<li><p>If <var>position</var> is past the end of <var>input</var>,
- return <var>candidates</var> and abort these steps.<li><p><a href=#collect-a-sequence-of-characters id=the-img-element:collect-a-sequence-of-characters-2>Collect a sequence of characters</a> that are not
- <a href=#space-character id=the-img-element:space-character-9>space characters</a>, and let that be <var>url</var>.<li><p>Let <var>descriptors</var> be a new empty list.<li>
- <p>If <var>url</var> ends with a U+002C COMMA character (,),
- remove all trailing U+002C COMMA characters from <var>url</var>;
- if this removed more than one character, that is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-2>parse error</a>.
- Otherwise, <a href=#skip-whitespace id=the-img-element:skip-whitespace>skip whitespace</a> and then follow these substeps:</p>
- <ol><li><p><i>Descriptor tokenizer</i>: Let <var>current descriptor</var> be the empty string.<li><p>Let <var>state</var> be <i>in descriptor</i>.<li>
- <p>Let <var>c</var> be the character at <var>position</var>.
- Do the following depending on the value of <var>state</var>.
- For the purpose of this step, "EOF" is a special character representing
- that <var>position</var> is past the end of <var>input</var>.</p>
- <dl class=switch><dt><i title="">In descriptor</i><dd>
- <p>Do the following, depending on the value of <var>c</var>:</p>
- <dl class=switch><dt><a href=#space-character id=the-img-element:space-character-10>Space character</a><dd><p>If <var>current descriptor</var> is not empty,
- append <var>current descriptor</var> to <var>descriptors</var>
- and let <var>current descriptor</var> be the empty string.
- Set <var>state</var> to <i>after descriptor</i>.<dt>U+002C COMMA (,)<dd><p>Advance <var>position</var> to the next character in <var>input</var>.
- If <var>current descriptor</var> is not empty,
- append <var>current descriptor</var> to <var>descriptors</var>.
- Jump to the step labeled <i>descriptor parser</i>.<dt>U+0028 LEFT PARANTHESIS (()<dd><p>Append <var>c</var> to <var>current descriptor</var>.
- Set <var>state</var> to <i>in parens</i>.<dt>EOF<dd><p>If <var>current descriptor</var> is not empty,
- append <var>current descriptor</var> to <var>descriptors</var>.
- Jump to the step labeled <i>descriptor parser</i>.<dt>Anything else<dd><p>Append <var>c</var> to <var>current descriptor</var>.</dl>
- <dt><i title="">In parens</i><dd>
- <p>Do the following, depending on the value of <var>c</var>:</p>
- <dl class=switch><dt>U+0029 RIGHT PARENTHESIS ())<dd><p>Append <var>c</var> to <var>current descriptor</var>.
- Set <var>state</var> to <i>in descriptor</i>.<dt>EOF<dd><p>Append <var>current descriptor</var> to <var>descriptors</var>.
- Jump to the step labeled <i>descriptor parser</i>.<dt>Anything else<dd><p>Append <var>c</var> to <var>current descriptor</var>.</dl>
- <dt><i title="">After descriptor</i><dd>
- <p>Do the following, depending on the value of <var>c</var>:</p>
- <dl class=switch><dt><a href=#space-character id=the-img-element:space-character-11>Space character</a><dd><p>Stay in this state.<dt>EOF<dd><p>Jump to the step labeled <i>descriptor parser</i>.<dt>Anything else<dd><p>Set <var>state</var> to <i>in descriptor</i>.
- Set <var>position</var> to the <em>previous</em> character in <var>input</var>.</dl>
- </dl>
- <p>Advance <var>position</var> to the next character in <var>input</var>.
- Repeat this step.</p>
- <p class=note>In order to be compatible with future additions,
- this algorithm supports multiple descriptors and descriptors with parens.</p>
- </ol>
- <li><p><i>Descriptor parser</i>: Let <var>error</var> be <i>no</i>.<li><p>Let <var>width</var> be <i>absent</i>.<li><p>Let <var>density</var> be <i>absent</i>.<li><p>Let <var>future-compat-h</var> be <i>absent</i>.<li>
- <p>For each descriptor in <var>descriptors</var>,
- run the appropriate set of steps from the following list:</p>
- <dl class=switch><dt>If the descriptor consists of a <a href=#valid-non-negative-integer id=the-img-element:valid-non-negative-integer-2>valid non-negative integer</a>
- followed by a U+0077 LATIN SMALL LETTER W character<dd>
- <ol><li><p>If <var>width</var> and <var>density</var>
- are not both <i>absent</i>,
- then let <var>error</var> be <i>yes</i>.<li><p>Apply the <a href=#rules-for-parsing-non-negative-integers id=the-img-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the descriptor.
- If the result is zero, let <var>error</var> be <i>yes</i>.
- Otherwise, let <var>width</var> be the result.</ol>
- <dt>If the descriptor consists of a <a href=#valid-floating-point-number id=the-img-element:valid-floating-point-number-2>valid floating-point number</a>
- followed by a U+0078 LATIN SMALL LETTER X character<dd>
- <ol><li><p>If <var>width</var>, <var>density</var> and <var>future-compat-h</var>
- are not all <i>absent</i>,
- then let <var>error</var> be <i>yes</i>.<li>
- <p>Apply the <a href=#rules-for-parsing-floating-point-number-values id=the-img-element:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a> to the descriptor.
- If the result is less than zero, let <var>error</var> be <i>yes</i>.
- Otherwise, let <var>density</var> be the result.</p>
- <p class=note>If <var>density</var> is zero,
- the intrinsic dimensions will be infinite.
- User agents are expected to have limits in how big images can be rendered,
- which is allowed by the <a href=#hardwareLimitations>hardware limitations</a> clause.</p>
- </ol>
- <dt>If the descriptor consists of a <a href=#valid-non-negative-integer id=the-img-element:valid-non-negative-integer-3>valid non-negative integer</a>
- followed by a U+0068 LATIN SMALL LETTER H character<dd>
- <p>This is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-3>parse error</a>.</p>
- <ol><li><p>If <var>future-compat-h</var> and <var>density</var>
- are not both <i>absent</i>,
- then let <var>error</var> be <i>yes</i>.<li><p>Apply the <a href=#rules-for-parsing-non-negative-integers id=the-img-element:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> to the descriptor.
- If the result is zero, let <var>error</var> be <i>yes</i>.
- Otherwise, let <var>future-compat-h</var> be the result.</ol>
- <dt>Anything else<dd><p>This is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-4>parse error</a>.</dl>
- <li><p>If <var>future-compat-h</var> is not <i>absent</i> and <var>width</var> is <i>absent</i>,
- let <var>error</var> be <i>yes</i>.<li><p>If <var>error</var> is still <i>no</i>,
- then add a new <a href=#image-source id=the-img-element:image-source-7>image source</a> to <var>candidates</var>
- whose URL is <var>url</var>,
- associated with a width <var>width</var> if not <i>absent</i>
- and a pixel density <var>density</var> if not <i>absent</i>.
- Otherwise, there is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-5>parse error</a>.<li><p>Return to the step labeled <i>splitting loop</i>.</ol>
- <p>When asked to <dfn id=parse-a-sizes-attribute>parse a sizes attribute</dfn> from an element,
- <a href=#parse-a-comma-separated-list-of-component-values id=the-img-element:parse-a-comma-separated-list-of-component-values>parse a comma-separated list of component values</a>
- from the value of the element's <code>sizes</code> attribute
- (or the empty string, if the attribute is absent),
- and let <var>unparsed sizes list</var> be the result. <a href=#refsCSSSYNTAX>[CSSSYNTAX]</a></p>
- <p>For each <var>unparsed size</var> in <var>unparsed sizes list</var>:</p>
- <ol><li><p>Remove all consecutive <a href=#whitespace-token id=the-img-element:whitespace-token><whitespace-token></a>s
- from the end of <var>unparsed size</var>.
- If <var>unparsed size</var> is now empty,
- that is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-6>parse error</a>;
- continue to the next iteration of this algorithm.<li><p>If the last <a href=#component-value id=the-img-element:component-value>component value</a> in <var>unparsed size</var>
- is a valid non-negative <a href=#source-size-value id=the-img-element:source-size-value-7><source-size-value></a>,
- let <var>size</var> be its value
- and remove the <a href=#component-value id=the-img-element:component-value-2>component value</a> from <var>unparsed size</var>.
- Otherwise, there is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-7>parse error</a>;
- continue to the next iteration of this algorithm.<li><p>Remove all consecutive <a href=#whitespace-token id=the-img-element:whitespace-token-2><whitespace-token></a>s
- from the end of <var>unparsed size</var>.
- If <var>unparsed size</var> is now empty,
- return <var>size</var> and exit this algorithm.
- If this was not the last item in <var>unparsed sizes list</var>,
- that is a <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-8>parse error</a>.<li><p>Parse the remaining <a href=#component-value id=the-img-element:component-value-3>component values</a> in <var>unparsed size</var>
- as a <a href=#media-condition id=the-img-element:media-condition-2><media-condition></a>.
- If it does not parse correctly,
- or it does parse correctly but the <a href=#media-condition id=the-img-element:media-condition-3><media-condition></a> evaluates to false,
- continue to the next iteration of this algorithm. <a href=#refsMQ>[MQ]</a><li><p>Return <var>size</var> and exit this algorithm.</ol>
- <p>If the above algorithm exhausts <var>unparsed sizes list</var> without returning a <var>size</var> value,
- return <code>100vw</code>.</p>
- <p>A <dfn id=concept-microsyntax-parse-error>parse error</dfn> for the algorithms above
- indicates a non-fatal mismatch between input and requirements.
- User agents are encouraged to expose <a href=#concept-microsyntax-parse-error id=the-img-element:concept-microsyntax-parse-error-9>parse error</a>s somehow.</p>
- <p class=note>While a <a href=#valid-source-size-list id=the-img-element:valid-source-size-list-2>valid source size list</a> only contains a bare <a href=#source-size-value id=the-img-element:source-size-value-8><source-size-value></a>
- (without an accompanying <a href=#media-condition id=the-img-element:media-condition-4><media-condition></a>)
- as the last entry in the <a href=#source-size-list id=the-img-element:source-size-list><source-size-list></a>,
- the parsing algorithm technically allows such at any point in the list,
- and will accept it immediately as the size
- if the preceding entries in the list weren't used.
- This is to enable future extensions,
- and protect against simple author errors such as a final trailing comma.</p>
- <p>An <a href=#image-source id=the-img-element:image-source-8>image source</a> can have a density descriptor,
- a width descriptor,
- or no descriptor at all accompanying its URL.
- Normalizing a <a href=#source-set id=the-img-element:source-set-12>source set</a> gives every <a href=#image-source id=the-img-element:image-source-9>image source</a> a density descriptor.</p>
- <p>When asked to <dfn id=normalize-the-source-densities>normalize the source densities</dfn> of a <a href=#source-set id=the-img-element:source-set-13>source set</a> <var>source set</var>,
- the user agent must do the following:</p>
- <ol><li><p>Let <var>source size</var> be <var>source set</var>'s <a href=#source-size-2 id=the-img-element:source-size-2-5>source size</a>.<li>
- <p>For each <a href=#image-source id=the-img-element:image-source-10>image source</a> in <var>source set</var>:</p>
- <ol><li><p>If the <a href=#image-source id=the-img-element:image-source-11>image source</a> has a density descriptor,
- continue to the next <a href=#image-source id=the-img-element:image-source-12>image source</a>.<li>
- <p>Otherwise, if the <a href=#image-source id=the-img-element:image-source-13>image source</a> has a width descriptor,
- replace the width descriptor with a density descriptor
- with a value of the width descriptor divided by the <a href=#source-size-2 id=the-img-element:source-size-2-6>source size</a>
- and a unit of <code>x</code>.</p>
- <p class=note>If the <a href=#source-size-2 id=the-img-element:source-size-2-7>source size</a> is zero,
- the density would be infinity,
- which results in the intrinsic dimensions being zero by zero.</p>
- <li><p>Otherwise, give the <a href=#image-source id=the-img-element:image-source-14>image source</a> a density descriptor of <code>1x</code>.</ol>
- </ol>
- <p>The user agent may at any time run the following algorithm to update an <code id=the-img-element:the-img-element-55><a href=#the-img-element>img</a></code>
- element's image in order to react to changes in the environment. (User agents are <em>not
- required</em> to ever run this algorithm; for example, if the user is not looking at the page any
- more, the user agent might want to wait until the user has returned to the page before determining
- which image to use, in case the environment changes again in the meantime.)</p>
- <ol><li><p>Asynchronously <a href=#await-a-stable-state id=the-img-element:await-a-stable-state-2>await a stable state</a>. The <a href=#synchronous-section id=the-img-element:synchronous-section-5>synchronous section</a>
- consists of all the remaining steps of this algorithm until the algorithm says the
- <a href=#synchronous-section id=the-img-element:synchronous-section-6>synchronous section</a> has ended. (Steps in <a href=#synchronous-section id=the-img-element:synchronous-section-7>synchronous sections</a> are marked with ⌛.)<li><p>⌛ If the <code id=the-img-element:the-img-element-56><a href=#the-img-element>img</a></code> element does not have a <code id=the-img-element:attr-img-srcset-10><a href=#attr-img-srcset>srcset</a></code> attribute specified and it either has no parent
- or it is not a <code id=the-img-element:the-picture-element-11><a href=#the-picture-element>picture</a></code> element, is not in the <a href=#img-all id=the-img-element:img-all-6>completely available</a> state, has image data whose resource type is
- <code id=the-img-element:multipart/x-mixed-replace-3><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>, or if its <a href=#update-the-image-data id=the-img-element:update-the-image-data-4>update the image data</a> algorithm is
- running, then abort this algorithm.<li><p>⌛ Let <var>selected source</var> and <var>selected pixel
- density</var> be the URL and pixel density that results from <a href=#select-an-image-source id=the-img-element:select-an-image-source-2>selecting an image source</a>, respectively.<li><p>⌛ If <var>selected source</var> is null, then abort these steps.<li><p>⌛ If <var>selected source</var> and <var>selected pixel
- density</var> are the same as the element's <a href=#last-selected-source id=the-img-element:last-selected-source-2>last selected source</a> and <a href=#current-pixel-density id=the-img-element:current-pixel-density-5>current
- pixel density</a>, then abort these steps.<li><p>⌛ <a href=#resolve-a-url id=the-img-element:resolve-a-url-3>Resolve</a> <var>selected source</var>,
- relative to the element.<li><p>⌛ Let <var>CORS mode</var> be the state of the element's <code id=the-img-element:attr-img-crossorigin-6><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute.<li><p>⌛ If the <a href=#resolve-a-url id=the-img-element:resolve-a-url-4>resolve a URL</a> algorithm is not successful, abort these
- steps.</p>
- <li><p>End the <a href=#synchronous-section id=the-img-element:synchronous-section-8>synchronous section</a>, continuing the remaining steps
- asynchronously.<li>
- <p>Do a <a href=#potentially-cors-enabled-fetch id=the-img-element:potentially-cors-enabled-fetch-2>potentially CORS-enabled fetch</a> of the resulting <a href=#absolute-url id=the-img-element:absolute-url-3>absolute
- URL</a>, with the <i>mode</i> being <var>CORS mode</var>, the <i>origin</i>
- being the <a href=#origin-2 id=the-img-element:origin-2-6>origin</a> of the <code id=the-img-element:the-img-element-57><a href=#the-img-element>img</a></code> element's <a id=the-img-element:node-document-7 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the
- <i>default origin behaviour</i> set to <i>taint</i>.</p>
- <p>If this download fails in any way (other than the response code not being a 2xx code, as
- mentioned earlier), or if the image format is unsupported (as determined by applying the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id=the-img-element:content-type-sniffing:-image-2 data-x-internal=content-type-sniffing:-image>image sniffing rules</a>, again as mentioned earlier),
- or if the resource type is <code id=the-img-element:multipart/x-mixed-replace-4><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>, then abort these steps.</p>
- <p>Otherwise, wait for the <a href=#fetch id=the-img-element:fetch-12>fetch</a> algorithm to queue its last task, and then
- continue with these steps. The data obtained in this way is used in the steps below.</p>
- <li>
- <p><a href=#queue-a-task id=the-img-element:queue-a-task-15>Queue a task</a> to run the following substeps:</p>
- <ol><li><p>If the <code id=the-img-element:the-img-element-58><a href=#the-img-element>img</a></code> element has experienced <a href=#relevant-mutations id=the-img-element:relevant-mutations-3>relevant mutations</a>
- since this algorithm started, then abort these steps.</p>
- <li><p>Let the <code id=the-img-element:the-img-element-59><a href=#the-img-element>img</a></code> element's <a href=#last-selected-source id=the-img-element:last-selected-source-3>last selected source</a> be <var>selected source</var> and the <code id=the-img-element:the-img-element-60><a href=#the-img-element>img</a></code> element's <a href=#current-pixel-density id=the-img-element:current-pixel-density-6>current pixel
- density</a> be <var>selected pixel density</var>.<li><p>Let the <code id=the-img-element:the-img-element-61><a href=#the-img-element>img</a></code> element's <a href=#current-request id=the-img-element:current-request-34>current request</a>'s
- <a href=#img-req-url id=the-img-element:img-req-url-8>current URL</a> be the resulting <a href=#absolute-url id=the-img-element:absolute-url-4>absolute URL</a> from the earlier step.<li><p>Replace the <code id=the-img-element:the-img-element-62><a href=#the-img-element>img</a></code> element's image data with the resource obtained by the
- earlier step of this algorithm. It can be either <a href=#cors-same-origin id=the-img-element:cors-same-origin-4>CORS-same-origin</a> or
- <a href=#cors-cross-origin id=the-img-element:cors-cross-origin-2>CORS-cross-origin</a>; this affects the <a href=#origin-2 id=the-img-element:origin-2-7>origin</a> of the image itself (e.g.
- when used on a <code id=the-img-element:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code>).<li><p><a href=#fire-a-simple-event id=the-img-element:fire-a-simple-event-13>Fire a simple event</a> named <code id=the-img-element:event-load-4><a href=#event-load>load</a></code> at the
- <code id=the-img-element:the-img-element-63><a href=#the-img-element>img</a></code> element.</ol>
- </ol>
- <hr>
- <p>The <a href=#task-source id=the-img-element:task-source>task source</a> for the <a href=#concept-task id=the-img-element:concept-task-10>tasks</a> <a href=#queue-a-task id=the-img-element:queue-a-task-16>queued</a> by algorithms in this section is the <a href=#dom-manipulation-task-source id=the-img-element:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <hr>
- <p>What an <code id=the-img-element:the-img-element-64><a href=#the-img-element>img</a></code> element represents depends on the <code id=the-img-element:attr-img-src-12><a href=#attr-img-src>src</a></code> attribute and the <code id=the-img-element:attr-img-alt-3><a href=#attr-img-alt>alt</a></code>
- attribute.</p>
- <dl class=switch><dt>If the <code id=the-img-element:attr-img-src-13><a href=#attr-img-src>src</a></code> attribute is set and the <code id=the-img-element:attr-img-alt-4><a href=#attr-img-alt>alt</a></code> attribute is set to the empty string<dd>
- <p>The image is either decorative or supplemental to the rest of the content, redundant with
- some other information in the document.</p>
- <p>If the image is <a href=#img-available id=the-img-element:img-available-2>available</a> and the user agent is configured
- to display that image, then the element <a href=#represents id=the-img-element:represents>represents</a> the element's image data.</p>
- <p>Otherwise, the element <a href=#represents id=the-img-element:represents-2>represents</a> nothing, and may be omitted completely from
- the rendering. User agents may provide the user with a notification that an image is present but
- has been omitted from the rendering.</p>
- <dt>If the <code id=the-img-element:attr-img-src-14><a href=#attr-img-src>src</a></code> attribute is set and the <code id=the-img-element:attr-img-alt-5><a href=#attr-img-alt>alt</a></code> attribute is set to a value that isn't empty<dd>
- <p>The image is a key part of the content; the <code id=the-img-element:attr-img-alt-6><a href=#attr-img-alt>alt</a></code> attribute
- gives a textual equivalent or replacement for the image.</p>
- <p>If the image is <a href=#img-available id=the-img-element:img-available-3>available</a> and the user agent is configured
- to display that image, then the element <a href=#represents id=the-img-element:represents-3>represents</a> the element's image data.</p>
- <p>Otherwise, the element <a href=#represents id=the-img-element:represents-4>represents</a> the text given by the <code id=the-img-element:attr-img-alt-7><a href=#attr-img-alt>alt</a></code> attribute. User agents may provide the user with a notification
- that an image is present but has been omitted from the rendering.</p>
- <dt>If the <code id=the-img-element:attr-img-src-15><a href=#attr-img-src>src</a></code> attribute is set and the <code id=the-img-element:attr-img-alt-8><a href=#attr-img-alt>alt</a></code> attribute is not<dd>
- <p>The image might be a key part of the content, and there is no textual equivalent of the image
- available.</p>
- <p class=note>In a conforming document, the absence of the <code id=the-img-element:attr-img-alt-9><a href=#attr-img-alt>alt</a></code> attribute indicates that the image is a key part of the content
- but that a textual replacement for the image was not available when the image was generated.</p>
- <p>If the image is <a href=#img-available id=the-img-element:img-available-4>available</a> and the user agent is configured
- to display that image, then the element <a href=#represents id=the-img-element:represents-5>represents</a> the element's image data.</p>
- <p>Otherwise, the user agent should display some sort of indicator that there is an image that
- is not being rendered, and may, if requested by the user, or if so configured, or when required
- to provide contextual information in response to navigation, provide caption information for the
- image, derived as follows:</p>
- <ol><li><p>If the image has a <code id=the-img-element:attr-title><a href=#attr-title>title</a></code> attribute whose value is not
- the empty string, then the value of that attribute is the caption information; abort these
- steps.<li><p>If the image is a descendant of a <code id=the-img-element:the-figure-element><a href=#the-figure-element>figure</a></code> element that has a child
- <code id=the-img-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> element, and, ignoring the <code id=the-img-element:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code> element and its
- descendants, the <code id=the-img-element:the-figure-element-2><a href=#the-figure-element>figure</a></code> element has no <a href=#flow-content-2 id=the-img-element:flow-content-2-2>flow content</a> descendants other
- than <a href=#inter-element-whitespace id=the-img-element:inter-element-whitespace>inter-element whitespace</a> and the <code id=the-img-element:the-img-element-65><a href=#the-img-element>img</a></code> element, then the contents of the first such
- <code id=the-img-element:the-figcaption-element-3><a href=#the-figcaption-element>figcaption</a></code> element are the caption information; abort these steps.<li><p>There is no caption information.</ol>
- <dt>If the <code id=the-img-element:attr-img-src-16><a href=#attr-img-src>src</a></code> attribute is not set and either the <code id=the-img-element:attr-img-alt-10><a href=#attr-img-alt>alt</a></code> attribute is set to the empty string or the <code id=the-img-element:attr-img-alt-11><a href=#attr-img-alt>alt</a></code> attribute is not set at all<dd>
- <p>The element <a href=#represents id=the-img-element:represents-6>represents</a> nothing.</p>
- <dt>Otherwise<dd>
- <p>The element <a href=#represents id=the-img-element:represents-7>represents</a> the text given by the <code id=the-img-element:attr-img-alt-12><a href=#attr-img-alt>alt</a></code> attribute.</p>
- </dl>
- <p>The <code id=the-img-element:attr-img-alt-13><a href=#attr-img-alt>alt</a></code> attribute does not represent advisory information.
- User agents must not present the contents of the <code id=the-img-element:attr-img-alt-14><a href=#attr-img-alt>alt</a></code> attribute
- in the same way as content of the <code id=the-img-element:attr-title-2><a href=#attr-title>title</a></code> attribute.</p>
- <p>User agents may always provide the user with the option to display any image, or to prevent any
- image from being displayed. User agents may also apply heuristics to help the user make use of the
- image when the user is unable to see it, e.g. due to a visual disability or because they are using
- a text terminal with no graphics capabilities. Such heuristics could include, for instance,
- optical character recognition (OCR) of text found within the image.</p>
- <p class=warning>While user agents are encouraged to repair cases of missing <code id=the-img-element:attr-img-alt-15><a href=#attr-img-alt>alt</a></code> attributes, authors must not rely on such behavior. <a href=#alt>Requirements for providing text to act as an alternative for images</a> are described
- in detail below.</p>
- <p>The <em>contents</em> of <code id=the-img-element:the-img-element-66><a href=#the-img-element>img</a></code> elements, if any, are ignored for the purposes of
- rendering.</p>
-
- <hr>
- <p>The <code id=the-img-element:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>usemap</a></code> attribute,
- if present, can indicate that the image has an associated
- <a href=#image-map id=the-img-element:image-map-2>image map</a>.</p>
- <p>The <dfn id=attr-img-ismap><code>ismap</code></dfn>
- attribute, when used on an element that is a descendant of an
- <code id=the-img-element:the-a-element><a href=#the-a-element>a</a></code> element with an <code id=the-img-element:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, indicates by its
- presence that the element provides access to a server-side image
- map. This affects how events are handled on the corresponding
- <code id=the-img-element:the-a-element-2><a href=#the-a-element>a</a></code> element.</p>
- <p>The <code id=the-img-element:attr-img-ismap-2><a href=#attr-img-ismap>ismap</a></code> attribute is a
- <a href=#boolean-attribute id=the-img-element:boolean-attribute>boolean attribute</a>. The attribute must not be specified
- on an element that does not have an ancestor <code id=the-img-element:the-a-element-3><a href=#the-a-element>a</a></code> element
- with an <code id=the-img-element:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute.</p>
- <p class=note>The <code id=the-img-element:attr-hyperlink-usemap-4><a href=#attr-hyperlink-usemap>usemap</a></code> and
- <code id=the-img-element:attr-img-ismap-3><a href=#attr-img-ismap>ismap</a></code> attributes
- can result in confusing behavior when used together with
- <code id=the-img-element:the-source-element-when-used-with-the-picture-element-11><a href=#the-source-element-when-used-with-the-picture-element>source</a></code> elements with the
- <code id=the-img-element:attr-picture-source-media-3><a href=#attr-picture-source-media>media</a></code> attribute specified
- in a <code id=the-img-element:the-picture-element-12><a href=#the-picture-element>picture</a></code> element.</p>
- <p>The <code id=the-img-element:the-img-element-67><a href=#the-img-element>img</a></code> element supports <a href=#dimension-attributes id=the-img-element:dimension-attributes>dimension
- attributes</a>.</p>
-
- <p>The <dfn id=dom-img-alt><code>alt</code></dfn>, <dfn id=dom-img-src><code>src</code></dfn>, <dfn id=dom-img-srcset><code>srcset</code></dfn> and <dfn id=dom-img-sizes><code>sizes</code></dfn> IDL attributes must <a href=#reflect id=the-img-element:reflect>reflect</a> the
- respective content attributes of the same name.</p>
- <p>The <dfn id=dom-img-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
- <a href=#reflect id=the-img-element:reflect-2>reflect</a> the <code id=the-img-element:attr-img-crossorigin-7><a href=#attr-img-crossorigin>crossorigin</a></code> content attribute.</p>
- <p>The <dfn id=dom-img-usemap><code>useMap</code></dfn> IDL attribute must
- <a href=#reflect id=the-img-element:reflect-3>reflect</a> the <code id=the-img-element:attr-hyperlink-usemap-5><a href=#attr-hyperlink-usemap>usemap</a></code> content attribute.</p>
- <p>The <dfn id=dom-img-ismap><code>isMap</code></dfn> IDL attribute must <a href=#reflect id=the-img-element:reflect-4>reflect</a>
- the <code id=the-img-element:attr-img-ismap-4><a href=#attr-img-ismap>ismap</a></code> content attribute.</p>
-
- <dl class=domintro><dt><var>image</var> . <code id=the-img-element:dom-img-width-2><a href=#dom-img-width>width</a></code> [ = <var>value</var> ]<dt><var>image</var> . <code id=the-img-element:dom-img-height-2><a href=#dom-img-height>height</a></code> [ = <var>value</var> ]<dd>
- <p>These attributes return the actual rendered dimensions of the
- image, or zero if the dimensions are not known.</p>
- <p>They can be set, to change the corresponding content
- attributes.</p>
- <dt><var>image</var> . <code id=the-img-element:dom-img-naturalwidth-2><a href=#dom-img-naturalwidth>naturalWidth</a></code><dt><var>image</var> . <code id=the-img-element:dom-img-naturalheight-2><a href=#dom-img-naturalheight>naturalHeight</a></code><dd>
- <p>These attributes return the intrinsic dimensions of the image,
- or zero if the dimensions are not known.</p>
- <dt><var>image</var> . <code id=the-img-element:dom-img-complete-2><a href=#dom-img-complete>complete</a></code><dd>
- <p>Returns true if the image has been completely downloaded or if
- no image is specified; otherwise, returns false.</p>
- <dt><var>image</var> . <code id=the-img-element:dom-img-currentsrc-2><a href=#dom-img-currentsrc>currentSrc</a></code><dd>
- <p>Returns the image's <a href=#absolute-url id=the-img-element:absolute-url-5>absolute URL</a>.</p>
- <dt><var>image</var> = new <code id=the-img-element:dom-image-2><a href=#dom-image>Image</a></code>( [ <var>width</var> [, <var>height</var> ] ] )<dd>
- <p>Returns a new <code id=the-img-element:the-img-element-68><a href=#the-img-element>img</a></code> element, with the <code id=the-img-element:attr-dim-width-2><a href=#attr-dim-width>width</a></code> and <code id=the-img-element:attr-dim-height-2><a href=#attr-dim-height>height</a></code> attributes set to the values
- passed in the relevant arguments, if applicable.</p>
- </dl>
-
- <p>The IDL attributes <dfn id=dom-img-width><code>width</code></dfn> and <dfn id=dom-img-height><code>height</code></dfn> must return the rendered width and height of the
- image, in CSS pixels, if the image is <a href=#being-rendered id=the-img-element:being-rendered>being rendered</a>, and is being rendered to a
- visual medium; or else the intrinsic width and height of the image, in CSS pixels, if the image is
- <i id=the-img-element:img-available-5><a href=#img-available>available</a></i> but not being rendered to a visual medium; or else 0, if
- the image is not <i id=the-img-element:img-available-6><a href=#img-available>available</a></i>. <a href=#refsCSS>[CSS]</a></p>
- <p>On setting, they must act as if they <a href=#reflect id=the-img-element:reflect-5>reflected</a> the respective
- content attributes of the same name.</p>
- <p>The IDL attributes <dfn id=dom-img-naturalwidth><code>naturalWidth</code></dfn> and <dfn id=dom-img-naturalheight><code>naturalHeight</code></dfn> must return the intrinsic width and
- height of the image, in CSS pixels, if the image is <i id=the-img-element:img-available-7><a href=#img-available>available</a></i>, or
- else 0. <a href=#refsCSS>[CSS]</a></p>
- <p>The IDL attribute <dfn id=dom-img-complete><code>complete</code></dfn> must return true if
- any of the following conditions is true:</p>
- <ul class=brief><li>Both the <code id=the-img-element:attr-img-src-17><a href=#attr-img-src>src</a></code> attribute and the <code id=the-img-element:attr-img-srcset-11><a href=#attr-img-srcset>srcset</a></code> attribute are omitted.
- <li>The <code id=the-img-element:attr-img-srcset-12><a href=#attr-img-srcset>srcset</a></code> attribute is omitted and the <code id=the-img-element:attr-img-src-18><a href=#attr-img-src>src</a></code> attribute's value is the empty string.
- <li>The final <a href=#concept-task id=the-img-element:concept-task-11>task</a> that is <a href=#queue-a-task id=the-img-element:queue-a-task-17>queued</a> by the <a href=#networking-task-source id=the-img-element:networking-task-source-8>networking task source</a> once the resource has been <a href=#fetch id=the-img-element:fetch-13>fetched</a> has been <a href=#queue-a-task id=the-img-element:queue-a-task-18>queued</a>.
- <li>The <code id=the-img-element:the-img-element-69><a href=#the-img-element>img</a></code> element is <a href=#img-all id=the-img-element:img-all-7>completely available</a>.
- <li>The <code id=the-img-element:the-img-element-70><a href=#the-img-element>img</a></code> element is <a href=#img-error id=the-img-element:img-error-7>broken</a>.
- </ul>
- <p>Otherwise, the attribute must return false.</p>
- <p class=note>The value of <code id=the-img-element:dom-img-complete-3><a href=#dom-img-complete>complete</a></code> can thus change while
- a <a href=#concept-script id=the-img-element:concept-script>script</a> is executing.</p>
- <p>The <dfn id=dom-img-currentsrc><code>currentSrc</code></dfn> IDL attribute
- must return the <code id=the-img-element:the-img-element-71><a href=#the-img-element>img</a></code> element's <a href=#current-request id=the-img-element:current-request-35>current request</a>'s <a href=#img-req-url id=the-img-element:img-req-url-9>current URL</a>.</p>
- <p>A constructor is provided for creating <code id=the-img-element:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code> objects (in addition to
- the factory methods from DOM such as <code>createElement()</code>): <dfn id=dom-image><code>Image(<var>width</var>, <var>height</var>)</code></dfn>.
- When invoked as a constructor, this must return a new <code id=the-img-element:htmlimageelement-2><a href=#htmlimageelement>HTMLImageElement</a></code> object (a new
- <code id=the-img-element:the-img-element-72><a href=#the-img-element>img</a></code> element). If the <var>width</var> argument is present, the new object's
- <code id=the-img-element:attr-dim-width-3><a href=#attr-dim-width>width</a></code> content attribute must be set to <var>width</var>. If the <var>height</var> argument is also present, the new object's
- <code id=the-img-element:attr-dim-height-3><a href=#attr-dim-height>height</a></code> content attribute must be set to <var>height</var>.
- The element's <a id=the-img-element:node-document-8 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> must be the <a href=#active-document id=the-img-element:active-document-2>active document</a> of the
- <a href=#browsing-context id=the-img-element:browsing-context-3>browsing context</a> of the <code id=the-img-element:window><a href=#window>Window</a></code> object on which the interface object of
- the invoked constructor is found.</p>
-
- <div class=example>
- <p>A single image can have different appropriate alternative text depending on the context.</p>
- <p>In each of the following cases, the same image is used, yet the <code id=the-img-element:attr-img-alt-16><a href=#attr-img-alt>alt</a></code> text is different each time. The image is the coat of arms of the
- Carouge municipality in the canton Geneva in Switzerland.</p>
- <p>Here it is used as a supplementary icon:</p>
- <pre><p>I lived in <img src="carouge.svg" alt=""> Carouge.</p></pre>
- <p>Here it is used as an icon representing the town:</p>
- <pre><p>Home town: <img src="carouge.svg" alt="Carouge"></p></pre>
- <p>Here it is used as part of a text on the town:</p>
- <pre><p>Carouge has a coat of arms.</p>
- <p><img src="carouge.svg" alt="The coat of arms depicts a lion, sitting in front of a tree."></p>
- <p>It is used as decoration all over the town.</p></pre>
- <p>Here it is used as a way to support a similar text where the description is given as well as,
- instead of as an alternative to, the image:</p>
- <pre><p>Carouge has a coat of arms.</p>
- <p><img src="carouge.svg" alt=""></p>
- <p>The coat of arms depicts a lion, sitting in front of a tree.
- It is used as decoration all over the town.</p></pre>
- <p>Here it is used as part of a story:</p>
- <pre><p>He picked up the folder and a piece of paper fell out.</p>
- <p><img src="carouge.svg" alt="Shaped like a shield, the paper had a
- red background, a green tree, and a yellow lion with its tongue
- hanging out and whose tail was shaped like an S."></p>
- <p>He stared at the folder. S! The answer he had been looking for all
- this time was simply the letter S! How had he not seen that before? It all
- came together now. The phone call where Hector had referred to a lion's tail,
- the time Marco had stuck his tongue out...</p></pre>
- <p>Here it is not known at the time of publication what the image will be, only that it will be a
- coat of arms of some kind, and thus no replacement text can be provided, and instead only a brief
- caption for the image is provided, in the <code id=the-img-element:attr-title-3><a href=#attr-title>title</a></code> attribute:</p>
- <pre><p>The last user to have uploaded a coat of arms uploaded this one:</p>
- <p><img src="last-uploaded-coat-of-arms.cgi" title="User-uploaded coat of arms."></p></pre>
- <p>Ideally, the author would find a way to provide real replacement text even in this case, e.g.
- by asking the previous user. Not providing replacement text makes the document more difficult to
- use for people who are unable to view images, e.g. blind users, or users or very low-bandwidth
- connections or who pay by the byte, or users who are forced to use a text-only Web browser.</p>
- </div>
- <div class=example>
- <p>Here are some more examples showing the same picture used in different contexts, with
- different appropriate alternate texts each time.</p>
- <pre><article>
- <h1>My cats</h1>
- <h2>Fluffy</h2>
- <p>Fluffy is my favorite.</p>
- <img src="fluffy.jpg" alt="She likes playing with a ball of yarn.">
- <p>She's just too cute.</p>
- <h2>Miles</h2>
- <p>My other cat, Miles just eats and sleeps.</p>
- </article></pre>
- <pre><article>
- <h1>Photography</h1>
- <h2>Shooting moving targets indoors</h2>
- <p>The trick here is to know how to anticipate; to know at what speed and
- what distance the subject will pass by.</p>
- <img src="fluffy.jpg" alt="A cat flying by, chasing a ball of yarn, can be
- photographed quite nicely using this technique.">
- <h2>Nature by night</h2>
- <p>To achieve this, you'll need either an extremely sensitive film, or
- immense flash lights.</p>
- </article></pre>
- <pre><article>
- <h1>About me</h1>
- <h2>My pets</h2>
- <p>I've got a cat named Fluffy and a dog named Miles.</p>
- <img src="fluffy.jpg" alt="Fluffy, my cat, tends to keep itself busy.">
- <p>My dog Miles and I like go on long walks together.</p>
- <h2>music</h2>
- <p>After our walks, having emptied my mind, I like listening to Bach.</p>
- </article></pre>
- <pre><article>
- <h1>Fluffy and the Yarn</h1>
- <p>Fluffy was a cat who liked to play with yarn. He also liked to jump.</p>
- <aside><img src="fluffy.jpg" alt="" title="Fluffy"></aside>
- <p>He would play in the morning, he would play in the evening.</p>
- </article></pre>
- </div>
-
- <h5 id=alt>4.8.5.1 Requirements for providing text to act as an alternative for images</h5>
- <h6 id=general-guidelines>4.8.5.1.1 General guidelines</h6>
- <p>Except where otherwise specified, the <code id=general-guidelines:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be
- specified and its value must not be empty; the value must be an appropriate replacement for the
- image. The specific requirements for the <code id=general-guidelines:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute depend on
- what the image is intended to represent, as described in the following sections.</p>
- <p>The most general rule to consider when writing alternative text is the following: <strong>the
- intent is that replacing every image with the text of its <code id=general-guidelines:attr-img-alt-3><a href=#attr-img-alt>alt</a></code>
- attribute not change the meaning of the page</strong>.</p>
- <p>So, in general, alternative text can be written by considering what one would have written had
- one not been able to include the image.</p>
- <p>A corollary to this is that the <code id=general-guidelines:attr-img-alt-4><a href=#attr-img-alt>alt</a></code> attribute's value should
- never contain text that could be considered the image's <em>caption</em>, <em>title</em>, or
- <em>legend</em>. It is supposed to contain replacement text that could be used by users
- <em>instead</em> of the image; it is not meant to supplement the image. The <code id=general-guidelines:attr-title><a href=#attr-title>title</a></code> attribute can be used for supplemental information.</p>
- <p>Another corollary is that the <code id=general-guidelines:attr-img-alt-5><a href=#attr-img-alt>alt</a></code> attribute's value should
- not repeat information that is already provided in the prose next to the image.</p>
- <p class=note>One way to think of alternative text is to think about how you would read the page
- containing the image to someone over the phone, without mentioning that there is an image present.
- Whatever you say instead of the image is typically a good start for writing the alternative
- text.</p>
- <h6 id=a-link-or-button-containing-nothing-but-the-image>4.8.5.1.2 A link or button containing nothing but the image</h6>
- <p>When an <a href=#the-a-element id=a-link-or-button-containing-nothing-but-the-image:the-a-element>a</a> element that creates a <a href=#hyperlink id=a-link-or-button-containing-nothing-but-the-image:hyperlink>hyperlink</a>, or a <code id=a-link-or-button-containing-nothing-but-the-image:the-button-element><a href=#the-button-element>button</a></code>
- element, has no textual content but contains one or more images, the <code id=a-link-or-button-containing-nothing-but-the-image:attr-img-alt><a href=#attr-img-alt>alt</a></code> attributes must contain text that together convey the purpose of
- the link or button.</p>
- <div class=example>
- <p>In this example, a user is asked to pick his preferred colour from a list of three. Each colour
- is given by an image, but for users who have configured their user agent not to display images,
- the colour names are used instead:</p>
- <pre><h1>Pick your colour</h1>
- <ul>
- <li><a href="green.html"><strong><img src="green.jpeg" alt="Green"></strong></a></li>
- <li><a href="blue.html"><strong><img src="blue.jpeg" alt="Blue"></strong></a></li>
- <li><a href="red.html"><strong><img src="red.jpeg" alt="Red"></strong></a></li>
- </ul></pre>
- </div>
- <div class=example>
- <p>In this example, each button has a set of images to indicate the kind of colour output desired
- by the user. The first image is used in each case to give the alternative text.</p>
- <pre><button name="rgb"><strong><img src="red" alt="RGB"><img src="green" alt=""><img src="blue" alt=""></strong></button>
- <button name="cmyk"><strong><img src="cyan" alt="CMYK"><img src="magenta" alt=""><img src="yellow" alt=""><img src="black" alt=""></strong></button></pre>
- <p>Since each image represents one part of the text, it could also be written like this:</p>
- <pre><button name="rgb"><strong><img src="red" alt="R"><img src="green" alt="G"><img src="blue" alt="B"></strong></button>
- <button name="cmyk"><strong><img src="cyan" alt="C"><img src="magenta" alt="M"><img src="yellow" alt="Y"><img src="black" alt="K"></strong></button></pre>
- <p>However, with other alternative text, this might not work, and putting all the alternative
- text into one image in each case might make more sense:</p>
- <pre><button name="rgb"><strong><img src="red" alt="sRGB profile"><img src="green" alt=""><img src="blue" alt=""></strong></button>
- <button name="cmyk"><strong><img src="cyan" alt="CMYK profile"><img src="magenta" alt=""><img src="yellow" alt=""><img src="black" alt=""></strong></button></pre>
- </div>
- <h6 id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations>4.8.5.1.3 A phrase or paragraph with an alternative graphical representation: charts, diagrams, graphs, maps, illustrations</h6>
- <p>Sometimes something can be more clearly stated in graphical form, for example as a flowchart, a
- diagram, a graph, or a simple map showing directions. In such cases, an image can be given using
- the <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:the-img-element><a href=#the-img-element>img</a></code> element, but the lesser textual version must still be given, so that users
- who are unable to view the image (e.g. because they have a very slow connection, or because they
- are using a text-only browser, or because they are listening to the page being read out by a
- hands-free automobile voice Web browser, or simply because they are blind) are still able to
- understand the message being conveyed.</p>
- <p>The text must be given in the <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute, and must convey
- the same message as the image specified in the <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-src><a href=#attr-img-src>src</a></code>
- attribute.</p>
- <p>It is important to realise that the alternative text is a <em>replacement</em> for the image,
- not a description of the image.</p>
- <div class=example>
- <p>In the following example we have <a href=images/parsing-model-overview.png>a flowchart</a>
- in image form, with text in the <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute rephrasing the
- flowchart in prose form:</p>
- <pre><p>In the common case, the data handled by the tokenization stage
- comes from the network, but it can also come from script.</p>
- <p><strong><img src="images/parsing-model-overview.png" alt="The Network
- passes data to the Input Stream Preprocessor, which passes it to the
- Tokenizer, which passes it to the Tree Construction stage. From there,
- data goes to both the DOM and to Script Execution. Script Execution is
- linked to the DOM, and, using document.write(), passes data to the
- Tokenizer."></strong></p></pre>
- </div>
- <div class=example>
- <p>Here's another example, showing a good solution and a bad solution to the problem of including
- an image in a description.</p>
- <p>First, here's the good solution. This sample shows how the alternative text should just be
- what you would have put in the prose if the image had never existed.</p>
- <pre><!-- This is the correct way to do things. -->
- <p>
- You are standing in an open field west of a house.
- <strong><img src="house.jpeg" alt="The house is white, with a boarded front door."></strong>
- There is a small mailbox here.
- </p></pre>
- <p>Second, here's the bad solution. In this incorrect way of doing things, the alternative text
- is simply a description of the image, instead of a textual replacement for the image. It's bad
- because when the image isn't shown, the text doesn't flow as well as in the first example.</p>
- <pre class=bad><!-- <em>This is the wrong way to do things.</em> -->
- <p>
- You are standing in an open field west of a house.
- <img src="house.jpeg" alt="A white house, with a boarded front door.">
- There is a small mailbox here.
- </p></pre>
- <p>Text such as "Photo of white house with boarded door" would be equally bad alternative text
- (though it could be suitable for the <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:attr-title><a href=#attr-title>title</a></code> attribute or in the
- <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> element of a <code id=a-phrase-or-paragraph-with-an-alternative-graphical-representation:-charts,-diagrams,-graphs,-maps,-illustrations:the-figure-element><a href=#the-figure-element>figure</a></code> with this image).</p>
- </div>
- <h6 id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos>4.8.5.1.4 A short phrase or label with an alternative graphical representation: icons, logos</h6>
- <p>A document can contain information in iconic form. The icon is intended to help users of visual
- browsers to recognise features at a glance.</p>
- <p>In some cases, the icon is supplemental to a text label conveying the same meaning. In those
- cases, the <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but must be empty.</p>
- <div class=example>
- <p>Here the icons are next to text that conveys the same meaning, so they have an empty <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute:</p>
- <pre><nav>
- <p><a href="/help/"><strong><img src="/icons/help.png" alt=""></strong> Help</a></p>
- <p><a href="/configure/"><strong><img src="/icons/configuration.png" alt=""></strong>
- Configuration Tools</a></p>
- </nav></pre>
- </div>
- <p>In other cases, the icon has no text next to it describing what it means; the icon is supposed
- to be self-explanatory. In those cases, an equivalent textual label must be given in the <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-3><a href=#attr-img-alt>alt</a></code> attribute.</p>
- <div class=example>
- <p>Here, posts on a news site are labeled with an icon indicating their topic.</p>
- <pre><body>
- <article>
- <header>
- <h1>Ratatouille wins <i>Best Movie of the Year</i> award</h1>
- <p><strong><img src="movies.png" alt="Movies"></strong></p>
- </header>
- <p>Pixar has won yet another <i>Best Movie of the Year</i> award,
- making this its 8th win in the last 12 years.</p>
- </article>
- <article>
- <header>
- <h1>Latest TWiT episode is online</h1>
- <p><strong><img src="podcasts.png" alt="Podcasts"></strong></p>
- </header>
- <p>The latest TWiT episode has been posted, in which we hear
- several tech news stories as well as learning much more about the
- iPhone. This week, the panelists compare how reflective their
- iPhones' Apple logos are.</p>
- </article>
- </body></pre>
- </div>
- <p>Many pages include logos, insignia, flags, or emblems, which stand for a particular entity such
- as a company, organization, project, band, software package, country, or some such.</p>
- <p>If the logo is being used to represent the entity, e.g. as a page heading, the <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-4><a href=#attr-img-alt>alt</a></code> attribute must contain the name of the entity being represented by
- the logo. The <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-5><a href=#attr-img-alt>alt</a></code> attribute must <em>not</em> contain text like
- the word "logo", as it is not the fact that it is a logo that is being conveyed, it's the entity
- itself.</p>
- <p>If the logo is being used next to the name of the entity that it represents, then the logo is
- supplemental, and its <code id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:attr-img-alt-6><a href=#attr-img-alt>alt</a></code> attribute must instead be empty.</p>
- <p>If the logo is merely used as decorative material (as branding, or, for example, as a side
- image in an article that mentions the entity to which the logo belongs), then the entry below on
- purely decorative images applies. If the logo is actually being discussed, then it is being used
- as a phrase or paragraph (the description of the logo) with an alternative graphical
- representation (the logo itself), and the first entry above applies.</p>
- <div class=example>
- <p>In the following snippets, all four of the above cases are present. First, we see a logo used
- to represent a company:</p>
- <pre><h1><strong><img src="XYZ.gif" alt="The XYZ company"></strong></h1></pre>
- <p>Next, we see a paragraph which uses a logo right next to the company name, and so doesn't have
- any alternative text:
- <pre><article>
- <h2>News</h2>
- <p>We have recently been looking at buying the <strong><img src="alpha.gif"
- alt=""> ΑΒΓ company</strong>, a small Greek company
- specializing in our type of product.</p></pre>
- <p>In this third snippet, we have a logo being used in an aside, as part of the larger article
- discussing the acquisition:</p>
- <pre> <strong><aside><p><img src="alpha-large.gif" alt=""></p></aside></strong>
- <p>The ΑΒΓ company has had a good quarter, and our
- pie chart studies of their accounts suggest a much bigger blue slice
- than its green and orange slices, which is always a good sign.</p>
- </article></pre>
- <p>Finally, we have an opinion piece talking about a logo, and the logo is therefore described in
- detail in the alternative text.</p>
- <pre><p>Consider for a moment their logo:</p>
- <strong><p><img src="/images/logo" alt="It consists of a green circle with a
- green question mark centered inside it."></p></strong>
- <p>How unoriginal can you get? I mean, oooooh, a question mark, how
- <em>revolutionary</em>, how utterly <em>ground-breaking</em>, I'm
- sure everyone will rush to adopt those specifications now! They could
- at least have tried for some sort of, I don't know, sequence of
- rounded squares with varying shades of green and bold white outlines,
- at least that would look good on the cover of a blue book.</p></pre>
- <p>This example shows how the alternative text should be written such that if the image isn't <i id=a-short-phrase-or-label-with-an-alternative-graphical-representation:-icons,-logos:img-available><a href=#img-available>available</a></i>, and the text is used instead, the text flows seamlessly into
- the surrounding text, as if the image had never been there in the first place.</p>
- </div>
- <h6 id=text-that-has-been-rendered-to-a-graphic-for-typographical-effect>4.8.5.1.5 Text that has been rendered to a graphic for typographical effect</h6>
- <p>Sometimes, an image just consists of text, and the purpose of the image is not to highlight the
- actual typographic effects used to render the text, but just to convey the text itself.</p>
- <p>In such cases, the <code id=text-that-has-been-rendered-to-a-graphic-for-typographical-effect:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be present but must
- consist of the same text as written in the image itself.</p>
- <div class=example>
- <p>Consider a graphic containing the text "Earth Day", but with the letters all decorated with
- flowers and plants. If the text is merely being used as a heading, to spice up the page for
- graphical users, then the correct alternative text is just the same text "Earth Day", and no
- mention need be made of the decorations:</p>
- <pre><h1><strong><img src="earthdayheading.png" alt="Earth Day"></strong></h1></pre>
- </div>
- <div class=example>
- <p>An illuminated manuscript might use graphics for some of its images. The alternative text in
- such a situation is just the character that the image represents.</p>
- <pre><p><img src="initials/o.svg" alt="O">nce upon a time and a long long time ago, late at
- night, when it was dark, over the hills, through the woods, across a great ocean, in a land far
- away, in a small house, on a hill, under a full moon...</pre>
- </div>
- <p>When an image is used to represent a character that cannot otherwise be represented in Unicode,
- for example gaiji, itaiji, or new characters such as novel currency symbols, the alternative text
- should be a more conventional way of writing the same thing, e.g. using the phonetic hiragana or
- katakana to give the character's pronunciation.</p>
- <div class=example>
- <p>In this example from 1997, a new-fangled currency symbol that looks like a curly E with two
- bars in the middle instead of one is represented using an image. The alternative text gives the
- character's pronunication.</p>
- <pre><p>Only <img src="euro.png" alt="euro ">5.99!</pre>
- </div>
- <p>An image should not be used if Unicode characters would serve an identical purpose. Only when
- the text cannot be directly represented using Unicode, e.g. because of decorations or because the
- character is not in the Unicode character set (as in the case of gaiji), would an image be
- appropriate.</p>
- <p class=note>If an author is tempted to use an image because their default system font does not
- support a given character, then Web Fonts are a better solution than images.</p>
- <h6 id=a-graphical-representation-of-some-of-the-surrounding-text>4.8.5.1.6 A graphical representation of some of the surrounding text</h6>
- <p>In many cases, the image is actually just supplementary, and its presence merely reinforces the
- surrounding text. In these cases, the <code id=a-graphical-representation-of-some-of-the-surrounding-text:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute must be
- present but its value must be the empty string.</p>
- <p>In general, an image falls into this category if removing the image doesn't make the page any
- less useful, but including the image makes it a lot easier for users of visual browsers to
- understand the concept.</p>
- <div class=example>
- <p>A flowchart that repeats the previous paragraph in graphical form:</p>
- <pre><p>The Network passes data to the Input Stream Preprocessor, which
- passes it to the Tokenizer, which passes it to the Tree Construction
- stage. From there, data goes to both the DOM and to Script Execution.
- Script Execution is linked to the DOM, and, using document.write(),
- passes data to the Tokenizer.</p>
- <strong><p><img src="images/parsing-model-overview.png" alt=""></p></strong></pre>
- <p>In these cases, it would be wrong to include alternative text that consists of just a caption.
- If a caption is to be included, then either the <code id=a-graphical-representation-of-some-of-the-surrounding-text:attr-title><a href=#attr-title>title</a></code> attribute
- can be used, or the <code id=a-graphical-representation-of-some-of-the-surrounding-text:the-figure-element><a href=#the-figure-element>figure</a></code> and <code id=a-graphical-representation-of-some-of-the-surrounding-text:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> elements can be used. In the
- latter case, the image would in fact be a phrase or paragraph with an alternative graphical
- representation, and would thus require alternative text.</p>
- <pre><!-- Using the title="" attribute -->
- <p>The Network passes data to the Input Stream Preprocessor, which
- passes it to the Tokenizer, which passes it to the Tree Construction
- stage. From there, data goes to both the DOM and to Script Execution.
- Script Execution is linked to the DOM, and, using document.write(),
- passes data to the Tokenizer.</p>
- <p><strong><img src="images/parsing-model-overview.png" alt=""
- title="Flowchart representation of the parsing model."></strong></p></pre>
- <pre><!-- Using <figure> and <figcaption> -->
- <p>The Network passes data to the Input Stream Preprocessor, which
- passes it to the Tokenizer, which passes it to the Tree Construction
- stage. From there, data goes to both the DOM and to Script Execution.
- Script Execution is linked to the DOM, and, using document.write(),
- passes data to the Tokenizer.</p>
- <figure>
- <strong><img src="images/parsing-model-overview.png" alt="The Network leads to
- the Input Stream Preprocessor, which leads to the Tokenizer, which
- leads to the Tree Construction stage. The Tree Construction stage
- leads to two items. The first is Script Execution, which leads via
- document.write() back to the Tokenizer. The second item from which
- Tree Construction leads is the DOM. The DOM is related to the Script
- Execution."></strong>
- <figcaption>Flowchart representation of the parsing model.</figcaption>
- </figure></pre>
- <pre class=bad><!-- This is WRONG. Do not do this. Instead, do what the above examples do. -->
- <p>The Network passes data to the Input Stream Preprocessor, which
- passes it to the Tokenizer, which passes it to the Tree Construction
- stage. From there, data goes to both the DOM and to Script Execution.
- Script Execution is linked to the DOM, and, using document.write(),
- passes data to the Tokenizer.</p>
- <p><img src="images/parsing-model-overview.png"
- alt="Flowchart representation of the parsing model."></p>
- <!-- Never put the image's caption in the alt="" attribute! --></pre>
- </div>
- <div class=example>
- <p>A graph that repeats the previous paragraph in graphical form:</p>
- <pre><p>According to a study covering several billion pages,
- about 62% of documents on the Web in 2007 triggered the Quirks
- rendering mode of Web browsers, about 30% triggered the Almost
- Standards mode, and about 9% triggered the Standards mode.</p>
- <strong><p><img src="rendering-mode-pie-chart.png" alt=""></p></strong></pre>
- </div>
- <h6 id="a-purely-decorative-image-that-doesn't-add-any-information">4.8.5.1.7 A purely decorative image that doesn't add any information</h6>
- <p>If an image is decorative but isn't especially page-specific — for example an image that
- forms part of a site-wide design scheme — the image should be specified in the site's CSS,
- not in the markup of the document.</p>
- <p>However, a decorative image that isn't discussed by the surrounding text but still has some
- relevance can be included in a page using the <code id="a-purely-decorative-image-that-doesn't-add-any-information:the-img-element"><a href=#the-img-element>img</a></code> element. Such images are
- decorative, but still form part of the content. In these cases, the <code id="a-purely-decorative-image-that-doesn't-add-any-information:attr-img-alt"><a href=#attr-img-alt>alt</a></code> attribute must be present but its value must be the empty
- string.</p>
- <div class=example>
- <p>Examples where the image is purely decorative despite being relevant would include things like
- a photo of the Black Rock City landscape in a blog post about an event at Burning Man, or an
- image of a painting inspired by a poem, on a page reciting that poem. The following snippet shows
- an example of the latter case (only the first verse is included in this snippet):</p>
- <pre><h1>The Lady of Shalott</h1>
- <strong><p><img src="shalott.jpeg" alt=""></p></strong>
- <p>On either side the river lie<br>
- Long fields of barley and of rye,<br>
- That clothe the wold and meet the sky;<br>
- And through the field the road run by<br>
- To many-tower'd Camelot;<br>
- And up and down the people go,<br>
- Gazing where the lilies blow<br>
- Round an island there below,<br>
- The island of Shalott.</p></pre>
- </div>
- <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-no-links>4.8.5.1.8 A group of images that form a single larger picture with no links</h6>
- <p>When a picture has been sliced into smaller image files that are then displayed together to
- form the complete picture again, one of the images must have its <code id=a-group-of-images-that-form-a-single-larger-picture-with-no-links:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute set as per the relevant rules that would be appropriate
- for the picture as a whole, and then all the remaining images must have their <code id=a-group-of-images-that-form-a-single-larger-picture-with-no-links:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute set to the empty string.</p>
- <div class=example>
- <p>In the following example, a picture representing a company logo for <span>XYZ
- Corp</span> has been split into two pieces, the first containing the letters "XYZ" and the second
- with the word "Corp". The alternative text ("XYZ Corp") is all in the first image.</p>
- <pre><h1><strong><img src="logo1.png" alt="XYZ Corp"><img src="logo2.png" alt=""></strong></h1></pre>
- </div>
- <div class=example>
- <p>In the following example, a rating is shown as three filled stars and two empty stars. While
- the alternative text could have been "★★★☆☆", the author has
- instead decided to more helpfully give the rating in the form "3 out of 5". That is the
- alternative text of the first image, and the rest have blank alternative text.</p>
- <pre><p>Rating: <meter max=5 value=3><strong><img src="1" alt="3 out of 5"
- ><img src="1" alt=""><img src="1" alt=""><img src="0" alt=""
- ><img src="0" alt=""></strong></meter></p></pre>
- </div>
- <h6 id=a-group-of-images-that-form-a-single-larger-picture-with-links>4.8.5.1.9 A group of images that form a single larger picture with links</h6>
- <p>Generally, <a href=#image-map id=a-group-of-images-that-form-a-single-larger-picture-with-links:image-map>image maps</a> should be used instead of slicing an image
- for links.</p>
- <p>However, if an image is indeed sliced and any of the components of the sliced picture are the
- sole contents of links, then one image per link must have alternative text in its <code id=a-group-of-images-that-form-a-single-larger-picture-with-links:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute representing the purpose of the link.</p>
- <div class=example>
- <p>In the following example, a picture representing the flying spaghetti monster emblem, with
- each of the left noodly appendages and the right noodly appendages in different images, so that
- the user can pick the left side or the right side in an adventure.</p>
- <pre><h1>The Church</h1>
- <p>You come across a flying spaghetti monster. Which side of His
- Noodliness do you wish to reach out for?</p>
- <strong><p><a href="?go=left" ><img src="fsm-left.png" alt="Left side. "></a
- ><img src="fsm-middle.png" alt=""
- ><a href="?go=right"><img src="fsm-right.png" alt="Right side."></a></p></strong></pre>
- </div>
- <h6 id=a-key-part-of-the-content>4.8.5.1.10 A key part of the content</h6>
- <p>In some cases, the image is a critical part of the content. This could be the case, for
- instance, on a page that is part of a photo gallery. The image is the whole <em>point</em> of the
- page containing it.</p>
- <p>How to provide alternative text for an image that is a key part of the content depends on the
- image's provenance.</p>
- <dl><dt>The general case<dd>
- <p>When it is possible for detailed alternative text to be provided, for example if the image is
- part of a series of screenshots in a magazine review, or part of a comic strip, or is a
- photograph in a blog entry about that photograph, text that can serve as a substitute for the
- image must be given as the contents of the <code id=a-key-part-of-the-content:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute.</p>
- <div class=example>
- <p>A screenshot in a gallery of screenshots for a new OS, with some alternative text:</p>
- <pre><figure>
- <strong><img src="KDE%20Light%20desktop.png"
- alt="The desktop is blue, with icons along the left hand side in
- two columns, reading System, Home, K-Mail, etc. A window is
- open showing that menus wrap to a second line if they
- cannot fit in the window. The window has a list of icons
- along the top, with an address bar below it, a list of
- icons for tabs along the left edge, a status bar on the
- bottom, and two panes in the middle. The desktop has a bar
- at the bottom of the screen with a few buttons, a pager, a
- list of open applications, and a clock."></strong>
- <figcaption>Screenshot of a KDE desktop.</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>A graph in a financial report:</p>
- <pre><strong><img src="sales.gif"
- title="Sales graph"
- alt="From 1998 to 2005, sales increased by the following percentages
- with each year: 624%, 75%, 138%, 40%, 35%, 9%, 21%"></strong></pre>
- <p>Note that "sales graph" would be inadequate alternative text for a sales graph. Text that
- would be a good <em>caption</em> is not generally suitable as replacement text.</p>
- </div>
- <dt>Images that defy a complete description<dd>
- <p>In certain cases, the nature of the image might be such that providing thorough alternative
- text is impractical. For example, the image could be indistinct, or could be a complex fractal,
- or could be a detailed topographical map.</p>
- <p>In these cases, the <code id=a-key-part-of-the-content:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute must contain some
- suitable alternative text, but it may be somewhat brief.</p>
- <div class=example>
- <p>Sometimes there simply is no text that can do justice to an image. For example, there is
- little that can be said to usefully describe a Rorschach inkblot test. However, a description,
- even if brief, is still better than nothing:</p>
- <pre><figure>
- <strong><img src="/commons/a/a7/Rorschach1.jpg" alt="A shape with left-right
- symmetry with indistinct edges, with a small gap in the center, two
- larger gaps offset slightly from the center, with two similar gaps
- under them. The outline is wider in the top half than the bottom
- half, with the sides extending upwards higher than the center, and
- the center extending below the sides."></strong>
- <figcaption>A black outline of the first of the ten cards
- in the Rorschach inkblot test.</figcaption>
- </figure></pre>
- <p>Note that the following would be a very bad use of alternative text:</p>
- <pre class=bad><!-- This example is wrong. Do not copy it. -->
- <figure>
- <img src="/commons/a/a7/Rorschach1.jpg" alt="A black outline
- of the first of the ten cards in the Rorschach inkblot test.">
- <figcaption>A black outline of the first of the ten cards
- in the Rorschach inkblot test.</figcaption>
- </figure></pre>
- <p>Including the caption in the alternative text like this isn't useful because it effectively
- duplicates the caption for users who don't have images, taunting them twice yet not helping
- them any more than if they had only read or heard the caption once.</p>
- </div>
- <div class=example>
- <p>Another example of an image that defies full description is a fractal, which, by definition,
- is infinite in detail.</p>
- <p>The following example shows one possible way of providing alternative text for the full view
- of an image of the Mandelbrot set.</p>
- <pre><strong><img src="ms1.jpeg" alt="The Mandelbrot set appears as a cardioid with
- its cusp on the real axis in the positive direction, with a smaller
- bulb aligned along the same center line, touching it in the negative
- direction, and with these two shapes being surrounded by smaller bulbs
- of various sizes."></strong></pre>
- </div>
- <div class=example>
- <p>Similarly, a photograph of a person's face, for example in a biography, can be considered
- quite relevant and key to the content, but it can be hard to fully substitute text for </p>
- <pre><section class="bio">
- <h1>A Biography of Isaac Asimov</h1>
- <p>Born <b>Isaak Yudovich Ozimov</b> in 1920, Isaac was a prolific author.</p>
- <p><img src="headpics/asimov.jpeg" alt="Isaac Asimov had dark hair, a tall forehead, and wore glasses.
- Later in life, he wore long white sideburns.">
- <p>Asimov was born in Russia, and moved to the US when he was three years old.</p>
- <p>...
- </section></pre>
- <p>In such cases it is unnecessary (and indeed discouraged) to include a reference to the
- presence of the image itself in the alternative text, since such text would be redundant with
- the browser itself reporting the presence of the image. For example, if the alternative text
- was "A photo of Isaac Asimov", then a conforming user agent might read that out as "(Image) A
- photo of Isaac Asimov" rather than the more useful "(Image) Isaac Asimov had dark hair, a tall
- forehead, and wore glasses...".</p>
- </div>
- <dt id=unknown-images>Images whose contents are not known<dd>
- <p>In some unfortunate cases, there might be no alternative text available at all, either
- because the image is obtained in some automated fashion without any associated alternative text
- (e.g. a Webcam), or because the page is being generated by a script using user-provided images
- where the user did not provide suitable or usable alternative text (e.g. photograph sharing
- sites), or because the author does not himself know what the images represent (e.g. a blind
- photographer sharing an image on his blog).</p>
- <p>In such cases, the <code id=a-key-part-of-the-content:attr-img-alt-3><a href=#attr-img-alt>alt</a></code> attribute may be omitted, but one of
- the following conditions must be met as well:</p>
- <ul><li id=figcaption-as-alt-condition><p>The <code id=a-key-part-of-the-content:the-img-element><a href=#the-img-element>img</a></code> element is in a
- <code id=a-key-part-of-the-content:the-figure-element><a href=#the-figure-element>figure</a></code> element that contains a <code id=a-key-part-of-the-content:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> element that contains
- content other than <a href=#inter-element-whitespace id=a-key-part-of-the-content:inter-element-whitespace>inter-element whitespace</a>, and, ignoring the
- <code id=a-key-part-of-the-content:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code> element and its descendants, the <code id=a-key-part-of-the-content:the-figure-element-2><a href=#the-figure-element>figure</a></code> element has no
- <a href=#flow-content-2 id=a-key-part-of-the-content:flow-content-2>flow content</a> descendants other than <a href=#inter-element-whitespace id=a-key-part-of-the-content:inter-element-whitespace-2>inter-element whitespace</a> and the
- <code id=a-key-part-of-the-content:the-img-element-2><a href=#the-img-element>img</a></code> element.<li>
- <p>The <code id=a-key-part-of-the-content:attr-title><a href=#attr-title>title</a></code> attribute is present and has a non-empty
- value.</p>
-
- <p class=note>Relying on the <code id=a-key-part-of-the-content:attr-title-2><a href=#attr-title>title</a></code> attribute is currently
- discouraged as many user agents do not expose the attribute in an accessible manner as
- required by this specification (e.g. requiring a pointing device such as a mouse to cause a
- tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone
- with a modern phone or tablet).</p>
- </ul>
- <p class=note>Such cases are to be kept to an absolute minimum. If there is even the slightest
- possibility of the author having the ability to provide real alternative text, then it would not
- be acceptable to omit the <code id=a-key-part-of-the-content:attr-img-alt-4><a href=#attr-img-alt>alt</a></code> attribute.</p>
- <div class=example>
- <p>A photo on a photo-sharing site, if the site received the image with no metadata other than
- the caption, could be marked up as follows:</p>
- <pre><figure>
- <strong><img src="1100670787_6a7c664aef.jpg"></strong>
- <figcaption>Bubbles traveled everywhere with us.</figcaption>
- </figure></pre>
- <p>It would be better, however, if a detailed description of the important parts of the image
- obtained from the user and included on the page.</p>
- </div>
- <div class=example>
- <p>A blind user's blog in which a photo taken by the user is shown. Initially, the user might
- not have any idea what the photo he took shows:</p>
- <pre><article>
- <h1>I took a photo</h1>
- <p>I went out today and took a photo!</p>
- <figure>
- <strong><img src="photo2.jpeg"></strong>
- <figcaption>A photograph taken blindly from my front porch.</figcaption>
- </figure>
- </article></pre>
- <p>Eventually though, the user might obtain a description of the image from his friends and
- could then include alternative text:</p>
- <pre><article>
- <h1>I took a photo</h1>
- <p>I went out today and took a photo!</p>
- <figure>
- <strong><img src="photo2.jpeg" alt="The photograph shows my squirrel
- feeder hanging from the edge of my roof. It is half full, but there
- are no squirrels around. In the background, out-of-focus trees fill the
- shot. The feeder is made of wood with a metal grate, and it contains
- peanuts. The edge of the roof is wooden too, and is painted white
- with light blue streaks."></strong>
- <figcaption>A photograph taken blindly from my front porch.</figcaption>
- </figure>
- </article></pre>
- </div>
- <div class=example>
- <p>Sometimes the entire point of the image is that a textual description is not available, and
- the user is to provide the description. For instance, the point of a CAPTCHA image is to see if
- the user can literally read the graphic. Here is one way to mark up a CAPTCHA (note the <code id=a-key-part-of-the-content:attr-title-3><a href=#attr-title>title</a></code> attribute):</p>
- <pre><p><label>What does this image say?
- <strong><img src="captcha.cgi?id=8934" title="CAPTCHA"></strong>
- <input type=text name=captcha></label>
- (If you cannot see the image, you can use an <a
- href="?audio">audio</a> test instead.)</p></pre>
- <p>Another example would be software that displays images and asks for alternative text
- precisely for the purpose of then writing a page with correct alternative text. Such a page
- could have a table of images, like this:</p>
- <pre><table>
- <thead>
- <tr> <th> Image <th> Description
- <tbody>
- <tr>
- <td> <strong><img src="2421.png" title="Image 640 by 100, filename 'banner.gif'"></strong>
- <td> <input name="alt2421">
- <tr>
- <td> <strong><img src="2422.png" title="Image 200 by 480, filename 'ad3.gif'"></strong>
- <td> <input name="alt2422">
- </table></pre>
- <p>Notice that even in this example, as much useful information as possible is still included
- in the <code id=a-key-part-of-the-content:attr-title-4><a href=#attr-title>title</a></code> attribute.</p>
- </div>
- <p class=note>Since some users cannot use images at all (e.g. because they have a very slow
- connection, or because they are using a text-only browser, or because they are listening to the
- page being read out by a hands-free automobile voice Web browser, or simply because they are
- blind), the <code id=a-key-part-of-the-content:attr-img-alt-5><a href=#attr-img-alt>alt</a></code> attribute is only allowed to be omitted rather
- than being provided with replacement text when no alternative text is available and none can be
- made available, as in the above examples. Lack of effort from the part of the author is not an
- acceptable reason for omitting the <code id=a-key-part-of-the-content:attr-img-alt-6><a href=#attr-img-alt>alt</a></code> attribute.</p>
- </dl>
- <h6 id=an-image-not-intended-for-the-user>4.8.5.1.11 An image not intended for the user</h6>
- <p>Generally authors should avoid using <code id=an-image-not-intended-for-the-user:the-img-element><a href=#the-img-element>img</a></code> elements for purposes other than showing
- images.</p>
- <p>If an <code id=an-image-not-intended-for-the-user:the-img-element-2><a href=#the-img-element>img</a></code> element is being used for purposes other than showing an image, e.g. as
- part of a service to count page views, then the <code id=an-image-not-intended-for-the-user:attr-img-alt><a href=#attr-img-alt>alt</a></code> attribute
- must be the empty string.</p>
- <p>In such cases, the <code id=an-image-not-intended-for-the-user:attr-dim-width><a href=#attr-dim-width>width</a></code> and <code id=an-image-not-intended-for-the-user:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes should both be set to zero.</p>
- <h6 id=an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images>4.8.5.1.12 An image in an e-mail or private document intended for a specific person who is known to be able to view images</h6>
- <p><i>This section does not apply to documents that are publicly accessible, or whose target
- audience is not necessarily personally known to the author, such as documents on a Web site,
- e-mails sent to public mailing lists, or software documentation.</i></p>
- <p>When an image is included in a private communication (such as an HTML e-mail) aimed at a
- specific person who is known to be able to view images, the <code id=an-image-in-an-e-mail-or-private-document-intended-for-a-specific-person-who-is-known-to-be-able-to-view-images:attr-img-alt><a href=#attr-img-alt>alt</a></code>
- attribute may be omitted. However, even in such cases authors are strongly urged to include
- alternative text (as appropriate according to the kind of image involved, as described in the
- above entries), so that the e-mail is still usable should the user use a mail client that does not
- support images, or should the document be forwarded on to other users whose abilities might not
- include easily seeing images.</p>
-
- <h6 id=guidance-for-markup-generators>4.8.5.1.13 Guidance for markup generators</h6>
- <p>Markup generators (such as WYSIWYG authoring tools) should, wherever possible, obtain
- alternative text from their users. However, it is recognised that in many cases, this will not be
- possible.</p>
- <p>For images that are the sole contents of links, markup generators should examine the link
- target to determine the title of the target, or the URL of the target, and use information
- obtained in this manner as the alternative text.</p>
- <p>For images that have captions, markup generators should use the <code id=guidance-for-markup-generators:the-figure-element><a href=#the-figure-element>figure</a></code> and
- <code id=guidance-for-markup-generators:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> elements, or the <code id=guidance-for-markup-generators:attr-title><a href=#attr-title>title</a></code> attribute, to
- provide the image's caption.</p>
- <p>As a last resort, implementors should either set the <code id=guidance-for-markup-generators:attr-img-alt><a href=#attr-img-alt>alt</a></code>
- attribute to the empty string, under the assumption that the image is a purely decorative image
- that doesn't add any information but is still specific to the surrounding content, or omit the
- <code id=guidance-for-markup-generators:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute altogether, under the assumption that the image is
- a key part of the content.</p>
- <p>Markup generators may specify a <dfn id=attr-img-generator-unable-to-provide-required-alt><code>generator-unable-to-provide-required-alt</code></dfn>
- attribute on <code id=guidance-for-markup-generators:the-img-element><a href=#the-img-element>img</a></code> elements for which they have been unable to obtain alternative text
- and for which they have therefore omitted the <code id=guidance-for-markup-generators:attr-img-alt-3><a href=#attr-img-alt>alt</a></code> attribute. The
- value of this attribute must be the empty string. Documents containing such attributes are not
- conforming, but conformance checkers will <a href=#guidance-for-conformance-checkers>silently
- ignore</a> this error.</p>
- <p class=note>This is intended to avoid markup generators from being pressured into replacing
- the error of omitting the <code id=guidance-for-markup-generators:attr-img-alt-4><a href=#attr-img-alt>alt</a></code> attribute with the even more
- egregious error of providing phony alternative text, because state-of-the-art automated
- conformance checkers cannot distinguish phony alternative text from correct alternative text.</p>
- <p>Markup generators should generally avoid using the image's own file name as the alternative
- text. Similarly, markup generators should avoid generating alternative text from any content that
- will be equally available to presentation user agents (e.g. Web browsers).</p>
- <p class=note>This is because once a page is generated, it will typically not be updated,
- whereas the browsers that later read the page can be updated by the user, therefore the browser is
- likely to have more up-to-date and finely-tuned heuristics than the markup generator did when
- generating the page.</p>
-
-
- <h6 id=guidance-for-conformance-checkers>4.8.5.1.14 Guidance for conformance checkers</h6>
- <p>A conformance checker must report the lack of an <code id=guidance-for-conformance-checkers:attr-img-alt><a href=#attr-img-alt>alt</a></code>
- attribute as an error unless one of the conditions listed below applies:</p>
- <ul><li><p>The <code id=guidance-for-conformance-checkers:the-img-element><a href=#the-img-element>img</a></code> element is in a <code id=guidance-for-conformance-checkers:the-figure-element><a href=#the-figure-element>figure</a></code> element that satisfies <a href=#figcaption-as-alt-condition>the conditions described above</a>.<li><p>The <code id=guidance-for-conformance-checkers:the-img-element-2><a href=#the-img-element>img</a></code> element has a <code id=guidance-for-conformance-checkers:attr-title><a href=#attr-title>title</a></code> attribute with a
- value that is not the empty string (also as <a href=#unknown-images>described
- above</a>).<li><p>The conformance checker has been configured to assume that the document is an e-mail or
- document intended for a specific person who is known to be able to view images.<li><p>The <code id=guidance-for-conformance-checkers:the-img-element-3><a href=#the-img-element>img</a></code> element has a (non-conforming) <code id=guidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt><a href=#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt</a></code>
- attribute whose value is the empty string. A conformance checker that is not reporting the lack
- of an <code id=guidance-for-conformance-checkers:attr-img-alt-2><a href=#attr-img-alt>alt</a></code> attribute as an error must also not report the
- presence of the empty <code id=guidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt-2><a href=#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt</a></code>
- attribute as an error. (This case does not represent a case where the document is conforming,
- only that the generator could not determine appropriate alternative text — validators are
- not required to show an error in this case, because such an error might encourage markup
- generators to include bogus alternative text purely in an attempt to silence validators.
- Naturally, conformance checkers <em>may</em> report the lack of an <code id=guidance-for-conformance-checkers:attr-img-alt-3><a href=#attr-img-alt>alt</a></code> attribute as an error even in the presence of the <code id=guidance-for-conformance-checkers:attr-img-generator-unable-to-provide-required-alt-3><a href=#attr-img-generator-unable-to-provide-required-alt>generator-unable-to-provide-required-alt</a></code>
- attribute; for example, there could be a user option to report <em>all</em> conformance errors
- even those that might be the more or less inevitable result of using a markup
- generator.)</ul>
-
- <h4 id=the-iframe-element>4.8.6 The <dfn><code>iframe</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-iframe-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-iframe-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-iframe-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-iframe-element:embedded-content-category>Embedded content</a>.<dd><a href=#interactive-content-2 id=the-iframe-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-iframe-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-iframe-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-iframe-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-iframe-element:concept-element-content-model>Content model</a>:<dd>Text that conforms to <a href=#iframe-content-model>the requirements given in the prose</a>.<dt><a href=#concept-element-tag-omission id=the-iframe-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-iframe-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-iframe-element:global-attributes>Global attributes</a><dd><code id=the-iframe-element:attr-iframe-src><a href=#attr-iframe-src>src</a></code> — Address of the resource<dd><code id=the-iframe-element:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code> — A document to render in the <code id=the-iframe-element:the-iframe-element><a href=#the-iframe-element>iframe</a></code><dd><code id=the-iframe-element:attr-iframe-name><a href=#attr-iframe-name>name</a></code> — Name of <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context>nested browsing context</a><dd><code id=the-iframe-element:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> — Security rules for nested content<dd><code id=the-iframe-element:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> — Whether to apply the document's styles to the nested content<dd><code id=the-iframe-element:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> — Whether to allow the <code id=the-iframe-element:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>'s contents to use <code id=the-iframe-element:dom-element-requestfullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code><dd><code id=the-iframe-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd><code id=the-iframe-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dt><a href=#concept-element-dom id=the-iframe-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmliframeelement>HTMLIFrameElement</dfn> : <a href=#htmlelement id=the-iframe-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-iframe-src id=the-iframe-element:dom-iframe-src>src</a>;
- attribute DOMString <a href=#dom-iframe-srcdoc id=the-iframe-element:dom-iframe-srcdoc>srcdoc</a>;
- attribute DOMString <a href=#dom-iframe-name id=the-iframe-element:dom-iframe-name>name</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=the-iframe-element:dom-domsettabletokenlist-value>value</a>] readonly attribute <a href=#domsettabletokenlist id=the-iframe-element:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-iframe-sandbox id=the-iframe-element:dom-iframe-sandbox>sandbox</a>;
- attribute boolean <a href=#dom-iframe-seamless id=the-iframe-element:dom-iframe-seamless>seamless</a>;
- attribute boolean <a href=#dom-iframe-allowfullscreen id=the-iframe-element:dom-iframe-allowfullscreen>allowFullscreen</a>;
- attribute DOMString <a href=#dom-dim-width id=the-iframe-element:dom-dim-width>width</a>;
- attribute DOMString <a href=#dom-dim-height id=the-iframe-element:dom-dim-height>height</a>;
- readonly attribute <a href=#document id=the-iframe-element:document>Document</a>? <a href=#dom-iframe-contentdocument id=the-iframe-element:dom-iframe-contentdocument>contentDocument</a>;
- readonly attribute <a href=#windowproxy id=the-iframe-element:windowproxy>WindowProxy</a>? <a href=#dom-iframe-contentwindow id=the-iframe-element:dom-iframe-contentwindow>contentWindow</a>;
- // <a href="#HTMLIFrameElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
-
- <p>The <code id=the-iframe-element:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code> element <a href=#represents id=the-iframe-element:represents>represents</a> a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-2>nested browsing
- context</a>.</p>
-
- <p>The <dfn id=attr-iframe-src><code>src</code></dfn> attribute gives the address of a page
- that the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-3>nested browsing context</a> is to contain. The attribute, if present, must be a
- <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-iframe-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. If the <code id=the-iframe-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> is specified on an <code id=the-iframe-element:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code> element, then the
- <code id=the-iframe-element:attr-iframe-src-2><a href=#attr-iframe-src>src</a></code> attribute must also be specified.</p>
- <p>The <dfn id=attr-iframe-srcdoc><code>srcdoc</code></dfn> attribute gives the content of
- the page that the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-4>nested browsing context</a> is to contain. The value of the attribute
- is the source of <dfn id=an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code>
- document</dfn>.</p>
- <p>For <code id=the-iframe-element:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code> elements in <a href=#html-documents id=the-iframe-element:html-documents>HTML documents</a>, the <code id=the-iframe-element:attr-iframe-srcdoc-2><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute, if present, must have a value using <a href=#syntax id=the-iframe-element:syntax>the
- HTML syntax</a> that consists of the following syntactic components, in the given order:</p>
- <ol><li>Any number of <a href=#syntax-comments id=the-iframe-element:syntax-comments>comments</a> and <a href=#space-character id=the-iframe-element:space-character>space characters</a>.<li>Optionally, a <a href=#syntax-doctype id=the-iframe-element:syntax-doctype>DOCTYPE</a>.
- <li>Any number of <a href=#syntax-comments id=the-iframe-element:syntax-comments-2>comments</a> and <a href=#space-character id=the-iframe-element:space-character-2>space characters</a>.<li>The root element, in the form of an <code id=the-iframe-element:the-html-element><a href=#the-html-element>html</a></code> <a href=#syntax-elements id=the-iframe-element:syntax-elements>element</a>.<li>Any number of <a href=#syntax-comments id=the-iframe-element:syntax-comments-3>comments</a> and <a href=#space-character id=the-iframe-element:space-character-3>space characters</a>.</ol>
- <p>For <code id=the-iframe-element:the-iframe-element-6><a href=#the-iframe-element>iframe</a></code> elements in <a href=#xml-documents id=the-iframe-element:xml-documents>XML documents</a>, the <code id=the-iframe-element:attr-iframe-srcdoc-3><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute, if present, must have a value that matches the
- production labeled <code>document</code> in the XML specification. <a href=#refsXML>[XML]</a></p>
- <div class=example>
- <p>Here a blog uses the <code id=the-iframe-element:attr-iframe-srcdoc-4><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute in conjunction
- with the <code id=the-iframe-element:attr-iframe-sandbox-2><a href=#attr-iframe-sandbox>sandbox</a></code> and <code id=the-iframe-element:attr-iframe-seamless-2><a href=#attr-iframe-seamless>seamless</a></code> attributes described below to provide users of user
- agents that support this feature with an extra layer of protection from script injection in the
- blog post comments:</p>
- <pre><article>
- <h1>I got my own magazine!</h1>
- <p>After much effort, I've finally found a publisher, and so now I
- have my own magazine! Isn't that awesome?! The first issue will come
- out in September, and we have articles about getting food, and about
- getting in boxes, it's going to be great!</p>
- <footer>
- <p>Written by <a href="/users/cap">cap</a>, 1 hour ago.
- </footer>
- <article>
- <footer> Thirteen minutes ago, <a href="/users/ch">ch</a> wrote: </footer>
- <iframe seamless sandbox srcdoc="<p>did you get a cover picture yet?"></iframe>
- </article>
- <article>
- <footer> Nine minutes ago, <a href="/users/cap">cap</a> wrote: </footer>
- <iframe seamless sandbox srcdoc="<p>Yeah, you can see it <a href=&quot;/gallery?mode=cover&amp;amp;page=1&quot;>in my gallery</a>."></iframe>
- </article>
- <article>
- <footer> Five minutes ago, <a href="/users/ch">ch</a> wrote: </footer>
- <iframe seamless sandbox srcdoc="<p>hey that's earl's table.
- <p>you should get earl&amp;amp;me on the next cover."></iframe>
- </article></pre>
- <p>Notice the way that quotes have to be escaped (otherwise the <code id=the-iframe-element:attr-iframe-srcdoc-5><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute would end prematurely), and the way raw
- ampersands (e.g. in URLs or in prose) mentioned in the sandboxed content have to be
- <em>doubly</em> escaped — once so that the ampersand is preserved when originally parsing
- the <code id=the-iframe-element:attr-iframe-srcdoc-6><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute, and once more to prevent the
- ampersand from being misinterpreted when parsing the sandboxed content.</p>
- <p>Furthermore, notice that since the <a href=#syntax-doctype id=the-iframe-element:syntax-doctype-2>DOCTYPE</a> is optional in
- <a href=#an-iframe-srcdoc-document id=the-iframe-element:an-iframe-srcdoc-document><code>iframe</code> <code>srcdoc</code> documents</a>, and the <code id=the-iframe-element:the-html-element-2><a href=#the-html-element>html</a></code>,
- <code id=the-iframe-element:the-head-element><a href=#the-head-element>head</a></code>, and <code id=the-iframe-element:the-body-element><a href=#the-body-element>body</a></code> elements have <a href=#syntax-tag-omission>optional
- start and end tags</a>, and the <code id=the-iframe-element:the-title-element><a href=#the-title-element>title</a></code> element is also optional in <a href=#an-iframe-srcdoc-document id=the-iframe-element:an-iframe-srcdoc-document-2><code>iframe</code> <code>srcdoc</code>
- documents</a>, the markup in a <code id=the-iframe-element:attr-iframe-srcdoc-7><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute can be
- relatively succint despite representing an entire document, since only the contents of the
- <code id=the-iframe-element:the-body-element-2><a href=#the-body-element>body</a></code> element need appear literally in the syntax. The other elements are still
- present, but only by implication.</p>
- </div>
- <p class=note>In <a href=#syntax id=the-iframe-element:syntax-2>the HTML syntax</a>, authors need only remember to use U+0022
- QUOTATION MARK characters (") to wrap the attribute contents and then to escape all U+0022
- QUOTATION MARK (") and U+0026 AMPERSAND (&) characters, and to specify the <code id=the-iframe-element:attr-iframe-sandbox-3><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, to ensure safe embedding of content.</p>
- <p class=note>Due to restrictions of <a href=#the-xhtml-syntax id=the-iframe-element:the-xhtml-syntax>the XHTML syntax</a>, in XML the U+003C LESS-THAN
- SIGN character (<) needs to be escaped as well. In order to prevent <a href=http://www.w3.org/TR/xml/#AVNormalize>attribute-value normalization</a>, some of XML's
- whitespace characters — specifically U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
- (LF), and U+000D CARRIAGE RETURN (CR) — also need to be escaped. <a href=#refsXML>[XML]</a></p>
- <p class=note>If the <code id=the-iframe-element:attr-iframe-src-3><a href=#attr-iframe-src>src</a></code> attribute and the <code id=the-iframe-element:attr-iframe-srcdoc-8><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute are both specified together, the <code id=the-iframe-element:attr-iframe-srcdoc-9><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute takes priority. This allows authors to provide
- a fallback <a href=#url id=the-iframe-element:url>URL</a> for legacy user agents that do not support the <code id=the-iframe-element:attr-iframe-srcdoc-10><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute.</p>
-
- <hr>
- <p>When an <code id=the-iframe-element:the-iframe-element-7><a href=#the-iframe-element>iframe</a></code> element is <a href=#insert-an-element-into-a-document id=the-iframe-element:insert-an-element-into-a-document>inserted
- into a document</a> that has a <a href=#browsing-context id=the-iframe-element:browsing-context>browsing context</a>, the user agent must create a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-5>nested browsing context</a>, and
- then <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes>process the <code>iframe</code> attributes</a> for the "first time".</p>
- <p>When an <code id=the-iframe-element:the-iframe-element-8><a href=#the-iframe-element>iframe</a></code> element is <a href=#remove-an-element-from-a-document id=the-iframe-element:remove-an-element-from-a-document>removed
- from a document</a>, the user agent must <a href=#a-browsing-context-is-discarded id=the-iframe-element:a-browsing-context-is-discarded>discard</a> the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-6>nested browsing context</a>, if any.</p>
- <p class=note>This happens without any <code id=the-iframe-element:event-unload><a href=#event-unload>unload</a></code> events firing
- (the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-7>nested browsing context</a> and its <code id=the-iframe-element:document-2><a href=#document>Document</a></code> are <em><a href=#a-browsing-context-is-discarded id=the-iframe-element:a-browsing-context-is-discarded-2>discarded</a></em>, not <em><span> data-x="unload a
- document">unloaded</span></em>).</p>
-
- <p>Whenever an <code id=the-iframe-element:the-iframe-element-9><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-8>nested browsing context</a> has its
- <code id=the-iframe-element:attr-iframe-srcdoc-11><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute set, changed, or removed, the user agent
- must <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-2>process the <code>iframe</code> attributes</a>.</p>
- <p>Similarly, whenever an <code id=the-iframe-element:the-iframe-element-10><a href=#the-iframe-element>iframe</a></code> element with a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-9>nested browsing context</a>
- but with no <code id=the-iframe-element:attr-iframe-srcdoc-12><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute specified has its <code id=the-iframe-element:attr-iframe-src-4><a href=#attr-iframe-src>src</a></code> attribute set, changed, or removed, the user agent must
- <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-3>process the <code>iframe</code> attributes</a>.</p>
- <p>When the user agent is to <dfn id=process-the-iframe-attributes>process the <code>iframe</code> attributes</dfn>, it must run
- the first appropriate steps from the following list:</p>
- <dl class=switch><dt>If the <code id=the-iframe-element:attr-iframe-srcdoc-13><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is specified<dd><p><a href=#navigate id=the-iframe-element:navigate>Navigate</a> the element's <a href=#child-browsing-context id=the-iframe-element:child-browsing-context>child browsing context</a>
- to a resource whose <a href=#content-type id=the-iframe-element:content-type>Content-Type</a> is <code id=the-iframe-element:text/html><a href=#text/html>text/html</a></code>, whose <a href=#url id=the-iframe-element:url-2>URL</a>
- is <code id=the-iframe-element:about:srcdoc><a href=#about:srcdoc>about:srcdoc</a></code>, and whose data consists of the value of the attribute. The
- resulting <code id=the-iframe-element:document-3><a href=#document>Document</a></code> must be considered <a href=#an-iframe-srcdoc-document id=the-iframe-element:an-iframe-srcdoc-document-3>an <code>iframe</code> <code>srcdoc</code> document</a>.<dt>Otherwise, if the element has no <code id=the-iframe-element:attr-iframe-src-5><a href=#attr-iframe-src>src</a></code> attribute
- specified, and the user agent is processing the <code id=the-iframe-element:the-iframe-element-11><a href=#the-iframe-element>iframe</a></code>'s attributes for the "first
- time"<dd>
- <p><a href=#queue-a-task id=the-iframe-element:queue-a-task>Queue a task</a> to run the <a href=#iframe-load-event-steps id=the-iframe-element:iframe-load-event-steps>iframe load event steps</a>.</p>
- <p>The <a href=#task-source id=the-iframe-element:task-source>task source</a> for this <a href=#concept-task id=the-iframe-element:concept-task>task</a> is the
- <a href=#dom-manipulation-task-source id=the-iframe-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- <dt>Otherwise<dd>
- <ol><li>
- <p>If the value of the <code id=the-iframe-element:attr-iframe-src-6><a href=#attr-iframe-src>src</a></code> attribute is missing, or its
- value is the empty string, let <var>url</var> be the string
- "<code id=the-iframe-element:about:blank><a href=#about:blank>about:blank</a></code>".</p>
-
- <p>Otherwise, <a href=#resolve-a-url id=the-iframe-element:resolve-a-url>resolve</a> the value of the <code id=the-iframe-element:attr-iframe-src-7><a href=#attr-iframe-src>src</a></code> attribute, relative to the <code id=the-iframe-element:the-iframe-element-12><a href=#the-iframe-element>iframe</a></code> element.</p>
- <p>If that is not successful, then let <var>url</var> be the string
- "<code id=the-iframe-element:about:blank-2><a href=#about:blank>about:blank</a></code>". Otherwise, let <var>url</var> be the resulting
- <a href=#absolute-url id=the-iframe-element:absolute-url>absolute URL</a>.</p>
- <li>
- <p>If there exists an <a href=#ancestor-browsing-context id=the-iframe-element:ancestor-browsing-context>ancestor browsing context</a> whose <a href=#active-document id=the-iframe-element:active-document>active
- document</a>'s <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-iframe-element:the-document's-address" data-x-internal="the-document's-address">address</a>, ignoring fragment
- identifiers, is equal to <var>url</var>, then abort these steps.</p>
-
-
-
- <li>
- <p><a href=#navigate id=the-iframe-element:navigate-2>Navigate</a> the element's <a href=#child-browsing-context id=the-iframe-element:child-browsing-context-2>child browsing context</a>
- to <var>url</var>.</p>
- </ol>
- </dl>
- <p>Any <a href=#navigate id=the-iframe-element:navigate-3>navigation</a> required of the user agent in the <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-4>process
- the <code>iframe</code> attributes</a> algorithm must be completed as an <a href=#explicit-self-navigation-override id=the-iframe-element:explicit-self-navigation-override>explicit
- self-navigation override</a> and with the <code id=the-iframe-element:the-iframe-element-13><a href=#the-iframe-element>iframe</a></code> element's <a id=the-iframe-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s
- <a href=#browsing-context id=the-iframe-element:browsing-context-2>browsing context</a> as the <a href=#source-browsing-context id=the-iframe-element:source-browsing-context>source browsing context</a>.</p>
- <p>Furthermore, if the <a href=#active-document id=the-iframe-element:active-document-2>active document</a> of the element's <a href=#child-browsing-context id=the-iframe-element:child-browsing-context-3>child browsing
- context</a> before such a <a href=#navigate id=the-iframe-element:navigate-4>navigation</a> was not <a href=#completely-loaded id=the-iframe-element:completely-loaded>completely
- loaded</a> at the time of the new <a href=#navigate id=the-iframe-element:navigate-5>navigation</a>, then the <a href=#navigate id=the-iframe-element:navigate-6>navigation</a> must be completed with <a href=#replacement-enabled id=the-iframe-element:replacement-enabled>replacement enabled</a>.</p>
- <p>Similarly, if the <a href=#child-browsing-context id=the-iframe-element:child-browsing-context-4>child browsing context</a>'s <a href=#session-history id=the-iframe-element:session-history>session history</a> contained
- only one <code id=the-iframe-element:document-4><a href=#document>Document</a></code> when the <a href=#process-the-iframe-attributes id=the-iframe-element:process-the-iframe-attributes-5>process the <code>iframe</code> attributes</a>
- algorithm was invoked, and that was the <code id=the-iframe-element:about:blank-3><a href=#about:blank>about:blank</a></code> <code id=the-iframe-element:document-5><a href=#document>Document</a></code> created
- when the <a href=#child-browsing-context id=the-iframe-element:child-browsing-context-5>child browsing context</a> was created, then any <a href=#navigate id=the-iframe-element:navigate-7>navigation</a> required of the user agent in that algorithm must be completed
- with <a href=#replacement-enabled id=the-iframe-element:replacement-enabled-2>replacement enabled</a>.</p>
- <p>When a <code id=the-iframe-element:document-6><a href=#document>Document</a></code> in an <code id=the-iframe-element:the-iframe-element-14><a href=#the-iframe-element>iframe</a></code> is marked as <a href=#completely-loaded id=the-iframe-element:completely-loaded-2>completely
- loaded</a>, the user agent must synchronously run the <a href=#iframe-load-event-steps id=the-iframe-element:iframe-load-event-steps-2>iframe load event steps</a>.</p>
- <p class=note>A <code id=the-iframe-element:event-load><a href=#event-load>load</a></code> event is also fired at the
- <code id=the-iframe-element:the-iframe-element-15><a href=#the-iframe-element>iframe</a></code> element when it is created if no other data is loaded in it.</p>
- <p>Each <code id=the-iframe-element:document-7><a href=#document>Document</a></code> has an <dfn id=iframe-load-in-progress>iframe load in progress</dfn> flag and a <dfn id=mute-iframe-load>mute
- iframe load</dfn> flag. When a <code id=the-iframe-element:document-8><a href=#document>Document</a></code> is created, these flags must be unset for
- that <code id=the-iframe-element:document-9><a href=#document>Document</a></code>.</p>
- <p>The <dfn id=iframe-load-event-steps>iframe load event steps</dfn> are as follows:</p>
- <ol><li><p>Let <var>child document</var> be the <a href=#active-document id=the-iframe-element:active-document-3>active document</a> of the
- <code id=the-iframe-element:the-iframe-element-16><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-10>nested browsing context</a>.<li><p>If <var>child document</var> has its <a href=#mute-iframe-load id=the-iframe-element:mute-iframe-load>mute iframe load</a> flag set,
- abort these steps.<li><p>Set <var>child document</var>'s <a href=#iframe-load-in-progress id=the-iframe-element:iframe-load-in-progress>iframe load in progress</a>
- flag.<li><p><a href=#fire-a-simple-event id=the-iframe-element:fire-a-simple-event>Fire a simple event</a> named <code id=the-iframe-element:event-load-2><a href=#event-load>load</a></code> at the
- <code id=the-iframe-element:the-iframe-element-17><a href=#the-iframe-element>iframe</a></code> element.<li><p>Unset <var>child document</var>'s <a href=#iframe-load-in-progress id=the-iframe-element:iframe-load-in-progress-2>iframe load in progress</a>
- flag.</ol>
- <p class=warning>This, in conjunction with scripting, can be used to probe the URL space of the
- local network's HTTP servers. User agents may implement <a href=#origin-2 id=the-iframe-element:origin-2>cross-origin</a>
- access control policies that are stricter than those described above to mitigate this attack, but
- unfortunately such policies are typically not compatible with existing Web content.</p>
- <p>When the <code id=the-iframe-element:the-iframe-element-18><a href=#the-iframe-element>iframe</a></code>'s <a href=#browsing-context id=the-iframe-element:browsing-context-3>browsing context</a>'s <a href=#active-document id=the-iframe-element:active-document-4>active document</a> is
- not <a href=#ready-for-post-load-tasks id=the-iframe-element:ready-for-post-load-tasks>ready for post-load tasks</a>, and when anything in the <code id=the-iframe-element:the-iframe-element-19><a href=#the-iframe-element>iframe</a></code> is <a href=#delay-the-load-event id=the-iframe-element:delay-the-load-event>delaying the load event</a> of the <code id=the-iframe-element:the-iframe-element-20><a href=#the-iframe-element>iframe</a></code>'s
- <a href=#browsing-context id=the-iframe-element:browsing-context-4>browsing context</a>'s <a href=#active-document id=the-iframe-element:active-document-5>active document</a>, and when the <code id=the-iframe-element:the-iframe-element-21><a href=#the-iframe-element>iframe</a></code>'s
- <a href=#browsing-context id=the-iframe-element:browsing-context-5>browsing context</a> is in the <a href=#delaying-load-events-mode id=the-iframe-element:delaying-load-events-mode>delaying <code>load</code> events
- mode</a>, the <code id=the-iframe-element:the-iframe-element-22><a href=#the-iframe-element>iframe</a></code> must <a href=#delay-the-load-event id=the-iframe-element:delay-the-load-event-2>delay the load event</a> of its document.</p>
- <p class=note>If, during the handling of the <code id=the-iframe-element:event-load-3><a href=#event-load>load</a></code> event, the
- <a href=#browsing-context id=the-iframe-element:browsing-context-6>browsing context</a> in the <code id=the-iframe-element:the-iframe-element-23><a href=#the-iframe-element>iframe</a></code> is again <a href=#navigate id=the-iframe-element:navigate-8>navigated</a>, that will further <a href=#delay-the-load-event id=the-iframe-element:delay-the-load-event-3>delay the load event</a>.</p>
-
-
- <p class=note>If, when the element is created, the <code id=the-iframe-element:attr-iframe-srcdoc-14><a href=#attr-iframe-srcdoc>srcdoc</a></code> attribute is not set, and the <code id=the-iframe-element:attr-iframe-src-8><a href=#attr-iframe-src>src</a></code> attribute is either also not set or set but its value cannot be
- <a href=#resolve-a-url id=the-iframe-element:resolve-a-url-2>resolved</a>, the browsing context will remain at the initial
- <code id=the-iframe-element:about:blank-4><a href=#about:blank>about:blank</a></code> page.</p>
- <p class=note>If the user <a href=#navigate id=the-iframe-element:navigate-9>navigates</a> away from this page, the
- <code id=the-iframe-element:the-iframe-element-24><a href=#the-iframe-element>iframe</a></code>'s corresponding <code id=the-iframe-element:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object will proxy new
- <code id=the-iframe-element:window><a href=#window>Window</a></code> objects for new <code id=the-iframe-element:document-10><a href=#document>Document</a></code> objects, but the <code id=the-iframe-element:attr-iframe-src-9><a href=#attr-iframe-src>src</a></code> attribute will not change.</p>
- <hr>
- <p>The <dfn id=attr-iframe-name><code>name</code></dfn> attribute, if present, must be a
- <a href=#valid-browsing-context-name id=the-iframe-element:valid-browsing-context-name>valid browsing context name</a>. The given value is used to name the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-11>nested
- browsing context</a>. When the browsing context is created, if the attribute
- is present, the <a href=#browsing-context-name id=the-iframe-element:browsing-context-name>browsing context name</a> must be set to the value of this attribute;
- otherwise, the <a href=#browsing-context-name id=the-iframe-element:browsing-context-name-2>browsing context name</a> must be set to the empty string.</p>
-
- <p>Whenever the <code id=the-iframe-element:attr-iframe-name-2><a href=#attr-iframe-name>name</a></code> attribute is set, the nested
- <a href=#browsing-context id=the-iframe-element:browsing-context-7>browsing context</a>'s <a href=#browsing-context-name id=the-iframe-element:browsing-context-name-3>name</a> must be changed to
- the new value. If the attribute is removed, the <a href=#browsing-context-name id=the-iframe-element:browsing-context-name-4>browsing context name</a> must be set to
- the empty string.</p>
-
- <hr>
- <p>The <dfn id=attr-iframe-sandbox><code>sandbox</code></dfn> attribute, when specified,
- enables a set of extra restrictions on any content hosted by the <code id=the-iframe-element:the-iframe-element-25><a href=#the-iframe-element>iframe</a></code>. Its value
- must be an <a href=#unordered-set-of-unique-space-separated-tokens id=the-iframe-element:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are <a href=#ascii-case-insensitive id=the-iframe-element:ascii-case-insensitive>ASCII
- case-insensitive</a>. The allowed values are <code id=the-iframe-element:attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code>, and <code id=the-iframe-element:attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>.</p>
- <p>When the attribute is set, the content is treated as being from a unique <a href=#origin-2 id=the-iframe-element:origin-2-2>origin</a>,
- forms, scripts, and various potentially annoying APIs are disabled, links are prevented from
- targeting other <a href=#browsing-context id=the-iframe-element:browsing-context-8>browsing contexts</a>, and plugins are secured.
- The <code id=the-iframe-element:attr-iframe-sandbox-allow-same-origin-2><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> keyword causes
- the content to be treated as being from its real origin instead of forcing it into a unique
- origin; the <code id=the-iframe-element:attr-iframe-sandbox-allow-top-navigation-2><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>
- keyword allows the content to <a href=#navigate id=the-iframe-element:navigate-10>navigate</a> its <a href=#top-level-browsing-context id=the-iframe-element:top-level-browsing-context>top-level browsing context</a>;
- and the <code id=the-iframe-element:attr-iframe-sandbox-allow-forms-2><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-pointer-lock-2><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>, <code id=the-iframe-element:attr-iframe-sandbox-allow-popups-2><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code> and <code id=the-iframe-element:attr-iframe-sandbox-allow-scripts-2><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keywords re-enable forms, the
- pointer lock API, popups, and scripts respectively. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>
- <p class=warning>Setting both the <code id=the-iframe-element:attr-iframe-sandbox-allow-scripts-3><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and <code id=the-iframe-element:attr-iframe-sandbox-allow-same-origin-3><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> keywords together when the
- embedded page has the <a href=#same-origin id=the-iframe-element:same-origin>same origin</a> as the page containing the <code id=the-iframe-element:the-iframe-element-26><a href=#the-iframe-element>iframe</a></code>
- allows the embedded page to simply remove the <code id=the-iframe-element:attr-iframe-sandbox-4><a href=#attr-iframe-sandbox>sandbox</a></code>
- attribute and then reload itself, effectively breaking out of the sandbox altogether.</p>
- <p class=warning>These flags only take effect when the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-12>nested browsing context</a> of
- the <code id=the-iframe-element:the-iframe-element-27><a href=#the-iframe-element>iframe</a></code> is <a href=#navigate id=the-iframe-element:navigate-11>navigated</a>. Removing them, or removing the
- entire <code id=the-iframe-element:attr-iframe-sandbox-5><a href=#attr-iframe-sandbox>sandbox</a></code> attribute, has no effect on an
- already-loaded page.</p>
- <p class=warning>Potentially hostile files should not be served from the same server as the file
- containing the <code id=the-iframe-element:the-iframe-element-28><a href=#the-iframe-element>iframe</a></code> element. Sandboxing hostile content is of minimal help if an
- attacker can convince the user to just visit the hostile content directly, rather than in the
- <code id=the-iframe-element:the-iframe-element-29><a href=#the-iframe-element>iframe</a></code>. To limit the damage that can be caused by hostile HTML content, it should be
- served from a separate dedicated domain. Using a different domain ensures that scripts in the
- files are unable to attack the site, even if the user is tricked into visiting those pages
- directly, without the protection of the <code id=the-iframe-element:attr-iframe-sandbox-6><a href=#attr-iframe-sandbox>sandbox</a></code>
- attribute.</p>
-
-
- <p>When an <code id=the-iframe-element:the-iframe-element-30><a href=#the-iframe-element>iframe</a></code> element with a <code id=the-iframe-element:attr-iframe-sandbox-7><a href=#attr-iframe-sandbox>sandbox</a></code>
- attribute has its <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-13>nested browsing context</a> created (before the initial
- <code id=the-iframe-element:about:blank-5><a href=#about:blank>about:blank</a></code> <code id=the-iframe-element:document-11><a href=#document>Document</a></code> is created), and when an <code id=the-iframe-element:the-iframe-element-31><a href=#the-iframe-element>iframe</a></code>
- element's <code id=the-iframe-element:attr-iframe-sandbox-8><a href=#attr-iframe-sandbox>sandbox</a></code> attribute is set or changed while it
- has a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-14>nested browsing context</a>, the user agent must <a href=#parse-a-sandboxing-directive id=the-iframe-element:parse-a-sandboxing-directive>parse the sandboxing directive</a> using the attribute's value as the <var>input</var>, the <code id=the-iframe-element:the-iframe-element-32><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-15>nested browsing context</a>'s
- <a href=#iframe-sandboxing-flag-set id=the-iframe-element:iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</a> as the output, and, if the
- <code id=the-iframe-element:the-iframe-element-33><a href=#the-iframe-element>iframe</a></code> has an <code id=the-iframe-element:attr-iframe-allowfullscreen-2><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>
- attribute, the <var>allow fullscreen flag</var>.</p>
- <p>When an <code id=the-iframe-element:the-iframe-element-34><a href=#the-iframe-element>iframe</a></code> element's <code id=the-iframe-element:attr-iframe-sandbox-9><a href=#attr-iframe-sandbox>sandbox</a></code>
- attribute is removed while it has a <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-16>nested browsing context</a>, the user agent must
- empty the <code id=the-iframe-element:the-iframe-element-35><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-17>nested browsing context</a>'s
- <a href=#iframe-sandboxing-flag-set id=the-iframe-element:iframe-sandboxing-flag-set-2><code>iframe</code> sandboxing flag set</a> as the output.</p>
-
- <div class=example>
- <p>In this example, some completely-unknown, potentially hostile, user-provided HTML content is
- embedded in a page. Because it is served from a separate domain, it is affected by all the normal
- cross-site restrictions. In addition, the embedded page has scripting disabled, plugins disabled,
- forms disabled, and it cannot navigate any frames or windows other than itself (or any frames or
- windows it itself embeds).</p>
- <pre><p>We're not scared of you! Here is your content, unedited:</p>
- <iframe sandbox src="http://usercontent.example.net/getusercontent.cgi?id=12193"></iframe></pre>
- <p class=warning>It is important to use a separate domain so that if the attacker convinces the
- user to visit that page directly, the page doesn't run in the context of the site's origin, which
- would make the user vulnerable to any attack found in the page.</p>
- </div>
- <div class=example>
- <p>In this example, a gadget from another site is embedded. The gadget has scripting and forms
- enabled, and the origin sandbox restrictions are lifted, allowing the gadget to communicate with
- its originating server. The sandbox is still useful, however, as it disables plugins and popups,
- thus reducing the risk of the user being exposed to malware and other annoyances.</p>
- <pre><iframe sandbox="allow-same-origin allow-forms allow-scripts"
- src="http://maps.example.com/embedded.html"></iframe></pre>
- </div>
- <div class=example>
- <p>Suppose a file A contained the following fragment:</p>
- <pre><iframe sandbox="allow-same-origin allow-forms" src=B></iframe></pre>
- <p>Suppose that file B contained an iframe also:</p>
- <pre><iframe sandbox="allow-scripts" src=C></iframe></pre>
- <p>Further, suppose that file C contained a link:</p>
- <pre><a href=D>Link</a></pre>
- <p>For this example, suppose all the files were served as <code id=the-iframe-element:text/html-2><a href=#text/html>text/html</a></code>.</p>
- <p>Page C in this scenario has all the sandboxing flags set. Scripts are disabled, because the
- <code id=the-iframe-element:the-iframe-element-36><a href=#the-iframe-element>iframe</a></code> in A has scripts disabled, and this overrides the <code id=the-iframe-element:attr-iframe-sandbox-allow-scripts-4><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keyword set on the
- <code id=the-iframe-element:the-iframe-element-37><a href=#the-iframe-element>iframe</a></code> in B. Forms are also disabled, because the inner <code id=the-iframe-element:the-iframe-element-38><a href=#the-iframe-element>iframe</a></code> (in B)
- does not have the <code id=the-iframe-element:attr-iframe-sandbox-allow-forms-3><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code> keyword
- set.</p>
- <p>Suppose now that a script in A removes all the <code id=the-iframe-element:attr-iframe-sandbox-10><a href=#attr-iframe-sandbox>sandbox</a></code> attributes in A and B.
- This would change nothing immediately. If the user clicked the link in C, loading page D into the
- <code id=the-iframe-element:the-iframe-element-39><a href=#the-iframe-element>iframe</a></code> in B, page D would now act as if the <code id=the-iframe-element:the-iframe-element-40><a href=#the-iframe-element>iframe</a></code> in B had the <code id=the-iframe-element:attr-iframe-sandbox-allow-same-origin-4><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> and <code id=the-iframe-element:attr-iframe-sandbox-allow-forms-4><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code> keywords set, because that was the
- state of the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-18>nested browsing context</a> in the <code id=the-iframe-element:the-iframe-element-41><a href=#the-iframe-element>iframe</a></code> in A when page B was
- loaded.</p>
- <p>Generally speaking, dynamically removing or changing the <code id=the-iframe-element:attr-iframe-sandbox-11><a href=#attr-iframe-sandbox>sandbox</a></code> attribute is ill-advised, because it can make it quite
- hard to reason about what will be allowed and what will not.</p>
- </div>
- <hr>
- <p>The <dfn id=attr-iframe-seamless><code>seamless</code></dfn> attribute is a <a href=#boolean-attribute id=the-iframe-element:boolean-attribute>boolean
- attribute</a>. When specified, it indicates that the <code id=the-iframe-element:the-iframe-element-42><a href=#the-iframe-element>iframe</a></code> element's
- <a href=#browsing-context id=the-iframe-element:browsing-context-9>browsing context</a> is to be rendered in a manner that makes it appear to be part of the
- containing document (seamlessly included in the parent document).</p>
- <div class=example>
- <p id=inclusion>An HTML inclusion is effected using this attribute as in the following example.
- In this case, the inclusion is of a site-wide navigation bar. Any links in the
- <code id=the-iframe-element:the-iframe-element-43><a href=#the-iframe-element>iframe</a></code> will, in new user agents, be automatically opened in the
- <code id=the-iframe-element:the-iframe-element-44><a href=#the-iframe-element>iframe</a></code>'s parent browsing context; for legacy user agents, the site could also
- include a <code id=the-iframe-element:the-base-element><a href=#the-base-element>base</a></code> element with a <code id=the-iframe-element:attr-base-target><a href=#attr-base-target>target</a></code>
- attribute with the value <code>_parent</code>. Similarly, in new user agents the styles
- of the parent page will be automatically applied to the contents of the frame, but to support
- legacy user agents authors might wish to include the styles explicitly.</p>
- <pre><!DOCTYPE HTML>
- <title>Mirror Mirror — MovieInfo™</title>
- <header>
- <hgroup>
- <h1>Mirror Mirror</h1>
- <h2>Part of the MovieInfo™ Database</h2>
- </hgroup>
- <nav>
- <strong><iframe seamless src="nav.inc"></iframe></strong>
- </nav>
- </header>
- ...</pre>
- </div>
-
- <p>An <code id=the-iframe-element:the-iframe-element-45><a href=#the-iframe-element>iframe</a></code> element is said to be <dfn id=in-seamless-mode>in seamless mode</dfn> when all of the
- following conditions are met:</p>
- <ul><li>The <code id=the-iframe-element:attr-iframe-seamless-3><a href=#attr-iframe-seamless>seamless</a></code> attribute is set on the
- <code id=the-iframe-element:the-iframe-element-46><a href=#the-iframe-element>iframe</a></code> element, and
- <li>The <code id=the-iframe-element:the-iframe-element-47><a href=#the-iframe-element>iframe</a></code> element's owner <code id=the-iframe-element:document-12><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=the-iframe-element:active-sandboxing-flag-set>active sandboxing flag
- set</a> does not have the <a href=#sandboxed-seamless-iframes-flag id=the-iframe-element:sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</a> set, and
- <li>Either:
- <ul><li>The <a href=#browsing-context id=the-iframe-element:browsing-context-10>browsing context</a>'s <a href=#active-document id=the-iframe-element:active-document-6>active document</a> has the <a href=#same-origin id=the-iframe-element:same-origin-2>same
- origin</a> as the <code id=the-iframe-element:the-iframe-element-48><a href=#the-iframe-element>iframe</a></code> element's <a id=the-iframe-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, or
- <li>The <a href=#browsing-context id=the-iframe-element:browsing-context-11>browsing context</a>'s <a href=#active-document id=the-iframe-element:active-document-7>active document</a>'s <em><a href=http://dom.spec.whatwg.org/#concept-document-url id="the-iframe-element:the-document's-address-2" data-x-internal="the-document's-address">address</a></em> has the <a href=#same-origin id=the-iframe-element:same-origin-3>same origin</a> as the
- <code id=the-iframe-element:the-iframe-element-49><a href=#the-iframe-element>iframe</a></code> element's <a id=the-iframe-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, or
- <li>The <a href=#browsing-context id=the-iframe-element:browsing-context-12>browsing context</a>'s <a href=#active-document id=the-iframe-element:active-document-8>active document</a> is <a href=#an-iframe-srcdoc-document id=the-iframe-element:an-iframe-srcdoc-document-4>an
- <code>iframe</code> <code>srcdoc</code> document</a>.
- </ul>
- </ul>
- <p>When an <code id=the-iframe-element:the-iframe-element-50><a href=#the-iframe-element>iframe</a></code> element is <a href=#in-seamless-mode id=the-iframe-element:in-seamless-mode>in seamless mode</a>, the following
- requirements apply:</p>
- <ul><li><p>The user agent must set the <dfn id=seamless-browsing-context-flag>seamless browsing context flag</dfn> to true for that
- <a href=#browsing-context id=the-iframe-element:browsing-context-13>browsing context</a>. This will <a href=#seamlessLinks>cause links to open in the
- parent browsing context</a> unless an <a href=#explicit-self-navigation-override id=the-iframe-element:explicit-self-navigation-override-2>explicit self-navigation override</a> is used
- (<code>target="_self"</code>).<li><p>Media queries in the context of the <code id=the-iframe-element:the-iframe-element-51><a href=#the-iframe-element>iframe</a></code>'s <a href=#browsing-context id=the-iframe-element:browsing-context-14>browsing context</a>
- (e.g. on <code id=the-iframe-element:attr-style-media><a href=#attr-style-media>media</a></code> attributes of <code id=the-iframe-element:the-style-element><a href=#the-style-element>style</a></code> elements in
- <code id=the-iframe-element:document-13><a href=#document>Document</a></code>s in that <code id=the-iframe-element:the-iframe-element-52><a href=#the-iframe-element>iframe</a></code>) must be evaluated with respect to the nearest
- <a href=#ancestor-browsing-context id=the-iframe-element:ancestor-browsing-context-2>ancestor browsing context</a> that is not itself being <a href=#browsing-context-nested-through id=the-iframe-element:browsing-context-nested-through>nested through</a> an <code id=the-iframe-element:the-iframe-element-53><a href=#the-iframe-element>iframe</a></code> that is <a href=#in-seamless-mode id=the-iframe-element:in-seamless-mode-2>in seamless
- mode</a>. <a href=#refsMQ>[MQ]</a><li><p>In a CSS-supporting user agent: the user agent must add all the style sheets that apply to
- the <code id=the-iframe-element:the-iframe-element-54><a href=#the-iframe-element>iframe</a></code> element to the cascade of the <a href=#active-document id=the-iframe-element:active-document-9>active document</a> of the
- <code id=the-iframe-element:the-iframe-element-55><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-19>nested browsing context</a>, at the appropriate cascade
- levels, before any style sheets specified by the document itself.<li><p>In a CSS-supporting user agent: the user agent must, for the purpose of CSS property
- inheritance only, treat the root element of the <a href=#active-document id=the-iframe-element:active-document-10>active document</a> of the
- <code id=the-iframe-element:the-iframe-element-56><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-20>nested browsing context</a> as being a child of the
- <code id=the-iframe-element:the-iframe-element-57><a href=#the-iframe-element>iframe</a></code> element. (Thus inherited properties on the root element of the document in
- the <code id=the-iframe-element:the-iframe-element-58><a href=#the-iframe-element>iframe</a></code> will inherit the computed values of those properties on the
- <code id=the-iframe-element:the-iframe-element-59><a href=#the-iframe-element>iframe</a></code> element instead of taking their initial values.)<li><p>In visual media, in a CSS-supporting user agent: the user agent should set the intrinsic
- width of the <code id=the-iframe-element:the-iframe-element-60><a href=#the-iframe-element>iframe</a></code> to the width that the element would have if it was a
- non-replaced block-level element with 'width: auto', unless that width would be zero (e.g. if the
- element is floating or absolutely positioned), in which case the user agent should set the
- intrinsic width of the <code id=the-iframe-element:the-iframe-element-61><a href=#the-iframe-element>iframe</a></code> to the shrink-to-fit width of the root element (if
- any) of the content rendered in the <code id=the-iframe-element:the-iframe-element-62><a href=#the-iframe-element>iframe</a></code>.<li><p>In visual media, in a CSS-supporting user agent: the user agent should set the intrinsic
- height of the <code id=the-iframe-element:the-iframe-element-63><a href=#the-iframe-element>iframe</a></code> to the shortest height that would make the content rendered in
- the <code id=the-iframe-element:the-iframe-element-64><a href=#the-iframe-element>iframe</a></code> at its current width (as given in the previous bullet point) have no
- scrollable overflow at its bottom edge. Scrollable overflow is any overflow that would increase the range to
- which a scrollbar or other scrolling mechanism can scroll.<li>
- <p>In visual media, in a CSS-supporting user agent: the user agent must force the height of the
- initial containing block of the <a href=#active-document id=the-iframe-element:active-document-11>active document</a> of the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-21>nested browsing
- context</a> of the <code id=the-iframe-element:the-iframe-element-65><a href=#the-iframe-element>iframe</a></code> to zero.</p>
- <p class=note>This is intended to get around the otherwise circular dependency of percentage
- dimensions that depend on the height of the containing block, thus affecting the height of the
- document's bounding box, thus affecting the height of the viewport, thus affecting the size of
- the initial containing block.</p>
- <li><p>In speech media, the user agent should render the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-22>nested browsing context</a>
- without announcing that it is a separate document.<li>
- <p>User agents should, in general, act as if the <a href=#active-document id=the-iframe-element:active-document-12>active document</a> of the
- <code id=the-iframe-element:the-iframe-element-66><a href=#the-iframe-element>iframe</a></code>'s <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-23>nested browsing context</a> was part of the document that the
- <code id=the-iframe-element:the-iframe-element-67><a href=#the-iframe-element>iframe</a></code> is in, if any.</p>
- <p class=example>For example if the user agent supports listing all the links in a document,
- links in "seamlessly" nested documents would be included in that list without being
- significantly distinguished from links in the document itself.</p>
- <li><p>The <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-24>nested browsing context</a>'s <code id=the-iframe-element:window-2><a href=#window>Window</a></code> object's
- <a href=#cross-boundary-event-parent id=the-iframe-element:cross-boundary-event-parent>cross-boundary event parent</a> is the <a href=#browsing-context-container id=the-iframe-element:browsing-context-container>browsing context container</a>. <a href=#refsDOM>[DOM]</a></ul>
- <p>If the attribute is not specified, or if the <a href=#origin-2 id=the-iframe-element:origin-2-3>origin</a> conditions listed above are
- not met, then the user agent should render the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-25>nested browsing context</a> in a manner
- that is clearly distinguishable as a separate <a href=#browsing-context id=the-iframe-element:browsing-context-15>browsing context</a>, and the
- <a href=#seamless-browsing-context-flag id=the-iframe-element:seamless-browsing-context-flag>seamless browsing context flag</a> must be set to false for that <a href=#browsing-context id=the-iframe-element:browsing-context-16>browsing
- context</a>.</p>
- <p class=warning>It is important that user agents recheck the above conditions whenever the
- <a href=#active-document id=the-iframe-element:active-document-13>active document</a> of the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-26>nested browsing context</a> of the
- <code id=the-iframe-element:the-iframe-element-68><a href=#the-iframe-element>iframe</a></code> changes, such that the <a href=#seamless-browsing-context-flag id=the-iframe-element:seamless-browsing-context-flag-2>seamless browsing context flag</a> gets unset
- if the <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-27>nested browsing context</a> is <a href=#navigate id=the-iframe-element:navigate-12>navigated</a> to another
- origin.</p>
-
- <p class=note>The attribute can be set or removed dynamically, with the rendering updating in
- tandem.</p>
- <p class=note>The <code id=the-iframe-element:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute does not
- propagate into <code id=the-iframe-element:attr-iframe-seamless-4><a href=#attr-iframe-seamless>seamless</a></code> <code id=the-iframe-element:the-iframe-element-69><a href=#the-iframe-element>iframe</a></code>s.</p>
- <hr>
- <p>The <dfn id=attr-iframe-allowfullscreen><code>allowfullscreen</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-iframe-element:boolean-attribute-2>boolean attribute</a>. When specified, it indicates that <code id=the-iframe-element:document-14><a href=#document>Document</a></code> objects in
- the <code id=the-iframe-element:the-iframe-element-70><a href=#the-iframe-element>iframe</a></code> element's <a href=#browsing-context id=the-iframe-element:browsing-context-17>browsing context</a> are to be allowed to use <code id=the-iframe-element:dom-element-requestfullscreen-2><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code> (if it's not blocked for other
- reasons, e.g. there is another ancestor <code id=the-iframe-element:the-iframe-element-71><a href=#the-iframe-element>iframe</a></code> without this attribute set).</p>
- <div class=example>
- <p>Here, an <code id=the-iframe-element:the-iframe-element-72><a href=#the-iframe-element>iframe</a></code> is used to embed a player from a video site. The <code id=the-iframe-element:attr-iframe-allowfullscreen-3><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> attribute is needed to enable the
- player to show its video full-screen.</p>
- <pre><article>
- <header>
- <p><img src="/usericons/1627591962735"> <b>Fred Flintstone</b></p>
- <p><a href="/posts/3095182851" rel=bookmark>12:44</a> — <a href="#acl-3095182851">Private Post</a></p>
- </header>
- <main>
- <p>Check out my new ride!</p>
- <strong><iframe src="https://video.example.com/embed?id=92469812" allowfullscreen></iframe></strong>
- </main>
- </article></pre>
- </div>
- <hr>
- <p>The <code id=the-iframe-element:the-iframe-element-73><a href=#the-iframe-element>iframe</a></code> element supports <a href=#dimension-attributes id=the-iframe-element:dimension-attributes>dimension attributes</a> for cases where the
- embedded content has specific dimensions (e.g. ad units have well-defined dimensions).</p>
- <p>An <code id=the-iframe-element:the-iframe-element-74><a href=#the-iframe-element>iframe</a></code> element never has <a href=#fallback-content id=the-iframe-element:fallback-content>fallback content</a>, as it will always
- create a nested <a href=#browsing-context id=the-iframe-element:browsing-context-18>browsing context</a>, regardless of whether the specified initial
- contents are successfully used.</p>
- <hr>
- <p>Descendants of <code id=the-iframe-element:the-iframe-element-75><a href=#the-iframe-element>iframe</a></code> elements represent nothing. (In legacy user agents that do
- not support <code id=the-iframe-element:the-iframe-element-76><a href=#the-iframe-element>iframe</a></code> elements, the contents would be parsed as markup that could act as
- fallback content.)</p>
- <p id=iframe-content-model>When used in <a href=#html-documents id=the-iframe-element:html-documents-2>HTML documents</a>, the allowed content model
- of <code id=the-iframe-element:the-iframe-element-77><a href=#the-iframe-element>iframe</a></code> elements is text, except that invoking the <a href=#html-fragment-parsing-algorithm id=the-iframe-element:html-fragment-parsing-algorithm>HTML fragment parsing
- algorithm</a> with the <code id=the-iframe-element:the-iframe-element-78><a href=#the-iframe-element>iframe</a></code> element as the <var id=the-iframe-element:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element and the text contents as the <var>input</var> must result in a list of nodes that are all <a href=#phrasing-content-2 id=the-iframe-element:phrasing-content-2-2>phrasing content</a>,
- with no <a href=#parse-error id=the-iframe-element:parse-error>parse errors</a> having occurred, with no <code id=the-iframe-element:the-script-element><a href=#the-script-element>script</a></code>
- elements being anywhere in the list or as descendants of elements in the list, and with all the
- elements in the list (including their descendants) being themselves conforming.</p>
- <p>The <code id=the-iframe-element:the-iframe-element-79><a href=#the-iframe-element>iframe</a></code> element must be empty in <a href=#xml-documents id=the-iframe-element:xml-documents-2>XML documents</a>.</p>
- <p class=note>The <a href=#html-parser id=the-iframe-element:html-parser>HTML parser</a> treats markup inside <code id=the-iframe-element:the-iframe-element-80><a href=#the-iframe-element>iframe</a></code> elements as
- text.</p>
-
- <hr>
- <p>The IDL attributes <dfn id=dom-iframe-src><code>src</code></dfn>, <dfn id=dom-iframe-srcdoc><code>srcdoc</code></dfn>, <dfn id=dom-iframe-name><code>name</code></dfn>, <dfn id=dom-iframe-sandbox><code>sandbox</code></dfn>, and <dfn id=dom-iframe-seamless><code>seamless</code></dfn> must <a href=#reflect id=the-iframe-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
- <p>The <dfn id=dom-iframe-allowfullscreen><code>allowFullscreen</code></dfn> IDL attribute
- must <a href=#reflect id=the-iframe-element:reflect-2>reflect</a> the <code id=the-iframe-element:attr-iframe-allowfullscreen-4><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>
- content attribute.</p>
- <p>The <dfn id=dom-iframe-contentdocument><code>contentDocument</code></dfn> IDL attribute
- must return the <code id=the-iframe-element:document-15><a href=#document>Document</a></code> object of the <a href=#active-document id=the-iframe-element:active-document-14>active document</a> of the
- <code id=the-iframe-element:the-iframe-element-81><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-28>nested browsing context</a>, if any and if its
- <a href=#effective-script-origin id=the-iframe-element:effective-script-origin>effective script origin</a> is the <a href=#same-origin id=the-iframe-element:same-origin-4>same origin</a> as the <a href=#effective-script-origin id=the-iframe-element:effective-script-origin-2>effective script
- origin</a> specified by the <a href=#incumbent-settings-object id=the-iframe-element:incumbent-settings-object>incumbent settings object</a>, or null otherwise.</p>
- <p>The <dfn id=dom-iframe-contentwindow><code>contentWindow</code></dfn> IDL attribute must
- return the <code id=the-iframe-element:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object of the <code id=the-iframe-element:the-iframe-element-82><a href=#the-iframe-element>iframe</a></code> element's <a href=#nested-browsing-context id=the-iframe-element:nested-browsing-context-29>nested
- browsing context</a>, if any, or null otherwise.</p>
-
- <div class=example>
- <p>Here is an example of a page using an <code id=the-iframe-element:the-iframe-element-83><a href=#the-iframe-element>iframe</a></code> to include advertising from an
- advertising broker:</p>
- <pre><iframe src="http://ads.example.com/?customerid=923513721&amp;format=banner"
- width="468" height="60"></iframe></pre>
- </div>
- <h4 id=the-embed-element>4.8.7 The <dfn><code>embed</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-embed-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-embed-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-embed-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-embed-element:embedded-content-category>Embedded content</a>.<dd><a href=#interactive-content-2 id=the-embed-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-embed-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-embed-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-embed-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-embed-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-embed-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-embed-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-embed-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-embed-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-embed-element:global-attributes>Global attributes</a><dd><code id=the-embed-element:attr-embed-src><a href=#attr-embed-src>src</a></code> — Address of the resource<dd><code id=the-embed-element:attr-embed-type><a href=#attr-embed-type>type</a></code> — Type of embedded resource<dd><code id=the-embed-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd><code id=the-embed-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dd>Any other attribute that has no namespace (see prose).<dt><a href=#concept-element-dom id=the-embed-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlembedelement>HTMLEmbedElement</dfn> : <a href=#htmlelement id=the-embed-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-embed-src id=the-embed-element:dom-embed-src>src</a>;
- attribute DOMString <a href=#dom-embed-type id=the-embed-element:dom-embed-type>type</a>;
- attribute DOMString <a href=#dom-dim-width id=the-embed-element:dom-dim-width>width</a>;
- attribute DOMString <a href=#dom-dim-height id=the-embed-element:dom-dim-height>height</a>;
- <a href=#document id=the-embed-element:document>Document</a> <a href=#dom-embed-getsvgdocument id=the-embed-element:dom-embed-getsvgdocument>getSVGDocument</a>();
- <a href=#dom-embed-caller id=the-embed-element:dom-embed-caller>legacycaller</a> any (any... arguments);
- // <a href="#HTMLEmbedElement-partial">also has obsolete members</a>
- };</pre>
-
- <p>Depending on the type of content instantiated by the
- <code id=the-embed-element:the-embed-element><a href=#the-embed-element>embed</a></code> element, the node may also support other
- interfaces.</p>
-
- </dl>
- <p>The <code id=the-embed-element:the-embed-element-2><a href=#the-embed-element>embed</a></code> element provides an integration point for an external (typically
- non-HTML) application or interactive content.</p>
- <p>The <dfn id=attr-embed-src><code>src</code></dfn> attribute gives the address of the
- resource being embedded. The attribute, if present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-embed-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL
- potentially surrounded by spaces</a>.</p>
- <p>If the <code id=the-embed-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an
- <code id=the-embed-element:the-embed-element-3><a href=#the-embed-element>embed</a></code> element, then the <code id=the-embed-element:attr-embed-src-2><a href=#attr-embed-src>src</a></code> attribute must also
- be specified.</p>
- <p>The <dfn id=attr-embed-type><code>type</code></dfn> attribute, if present, gives the
- <a href=#mime-type id=the-embed-element:mime-type>MIME type</a> by which the plugin to instantiate is selected. The value must be a
- <a href=#valid-mime-type id=the-embed-element:valid-mime-type>valid MIME type</a>. If both the <code id=the-embed-element:attr-embed-type-2><a href=#attr-embed-type>type</a></code> attribute and
- the <code id=the-embed-element:attr-embed-src-3><a href=#attr-embed-src>src</a></code> attribute are present, then the <code id=the-embed-element:attr-embed-type-3><a href=#attr-embed-type>type</a></code> attribute must specify the same type as the <a href=#content-type id=the-embed-element:content-type>explicit Content-Type metadata</a> of the resource given by the <code id=the-embed-element:attr-embed-src-4><a href=#attr-embed-src>src</a></code> attribute.</p>
-
- <p>While any of the following conditions are occurring, any <a href=#plugin id=the-embed-element:plugin>plugin</a> instantiated for
- the element must be removed, and the <code id=the-embed-element:the-embed-element-4><a href=#the-embed-element>embed</a></code> element <a href=#represents id=the-embed-element:represents>represents</a>
- nothing:</p>
- <ul class=brief><li><p>The element has neither a <code id=the-embed-element:attr-embed-src-5><a href=#attr-embed-src>src</a></code> attribute nor a <code id=the-embed-element:attr-embed-type-4><a href=#attr-embed-type>type</a></code> attribute.<li><p>The element has a <a href=#media-element id=the-embed-element:media-element>media element</a> ancestor.<li><p>The element has an ancestor <code id=the-embed-element:the-object-element><a href=#the-object-element>object</a></code> element that is <em>not</em> showing its
- <a href=#fallback-content id=the-embed-element:fallback-content>fallback content</a>.</ul>
- <p>An <code id=the-embed-element:the-embed-element-5><a href=#the-embed-element>embed</a></code> element is said to be <dfn id=concept-embed-active>potentially
- active</dfn> when the following conditions are all met simultaneously:</p>
- <ul class=brief><li>The element is <a href=#in-a-document id=the-embed-element:in-a-document>in a <code>Document</code></a> or was <a href=#in-a-document id=the-embed-element:in-a-document-2>in a <code>Document</code></a> the last time the <a href=#event-loop id=the-embed-element:event-loop>event loop</a>
- reached step 1.<li>The element's <a id=the-embed-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is <a href=#fully-active id=the-embed-element:fully-active>fully active</a>.<li>The element has either a <code id=the-embed-element:attr-embed-src-6><a href=#attr-embed-src>src</a></code> attribute set or a <code id=the-embed-element:attr-embed-type-5><a href=#attr-embed-type>type</a></code> attribute set (or both).<li>The element's <code id=the-embed-element:attr-embed-src-7><a href=#attr-embed-src>src</a></code> attribute is either absent or its value
- is not the empty string.<li>The element is not a descendant of a <a href=#media-element id=the-embed-element:media-element-2>media element</a>.<li>The element is not a descendant of an <code id=the-embed-element:the-object-element-2><a href=#the-object-element>object</a></code> element that is not showing its
- <a href=#fallback-content id=the-embed-element:fallback-content-2>fallback content</a>.<li>The element is <a href=#being-rendered id=the-embed-element:being-rendered>being rendered</a>, or was <a href=#being-rendered id=the-embed-element:being-rendered-2>being rendered</a> the last time
- the <a href=#event-loop id=the-embed-element:event-loop-2>event loop</a> reached step 1.</ul>
- <p>Whenever an <code id=the-embed-element:the-embed-element-6><a href=#the-embed-element>embed</a></code> element that was not <a href=#concept-embed-active id=the-embed-element:concept-embed-active>potentially active</a> becomes <a href=#concept-embed-active id=the-embed-element:concept-embed-active-2>potentially active</a>, and whenever a <a href=#concept-embed-active id=the-embed-element:concept-embed-active-3>potentially active</a> <code id=the-embed-element:the-embed-element-7><a href=#the-embed-element>embed</a></code> element that is
- remaining <a href=#concept-embed-active id=the-embed-element:concept-embed-active-4>potentially active</a> and has its <code id=the-embed-element:attr-embed-type-6><a href=#attr-embed-type>src</a></code> attribute set, changed, or removed or its <code id=the-embed-element:attr-embed-type-7><a href=#attr-embed-type>type</a></code> attribute set, changed, or removed, the user agent must
- <a href=#queue-a-task id=the-embed-element:queue-a-task>queue a task</a> using the <dfn id=embed-task-source>embed task source</dfn> to run <a href=#the-embed-element-setup-steps id=the-embed-element:the-embed-element-setup-steps>the
- <code>embed</code> element setup steps</a>.</p>
- <p><dfn id=the-embed-element-setup-steps>The <code>embed</code> element setup steps</dfn> are as follows:</p>
- <ol><li><p>If another <a href=#concept-task id=the-embed-element:concept-task>task</a> has since been queued to run <a href=#the-embed-element-setup-steps id=the-embed-element:the-embed-element-setup-steps-2>the
- <code>embed</code> element setup steps</a> for this element, then abort these steps.<li>
- <dl class=switch><dt>If the element has a <code id=the-embed-element:attr-embed-src-8><a href=#attr-embed-src>src</a></code> attribute set<dd>
- <p>The user agent must <a href=#resolve-a-url id=the-embed-element:resolve-a-url>resolve</a> the value of the element's
- <code id=the-embed-element:attr-embed-src-9><a href=#attr-embed-src>src</a></code> attribute, relative to the element. If that is
- successful, the user agent should <a href=#fetch id=the-embed-element:fetch>fetch</a> the resulting <a href=#absolute-url id=the-embed-element:absolute-url>absolute
- URL</a>, from the element's <a href=#browsing-context-scope-origin id=the-embed-element:browsing-context-scope-origin>browsing context scope origin</a> if it has one. The <a href=#concept-task id=the-embed-element:concept-task-2>task</a> that
- is <a href=#queue-a-task id=the-embed-element:queue-a-task-2>queued</a> by the <a href=#networking-task-source id=the-embed-element:networking-task-source>networking task source</a> once
- the resource has been <a href=#fetch id=the-embed-element:fetch-2>fetched</a> must run the following steps:</p>
-
- <ol><li><p>If another <a href=#concept-task id=the-embed-element:concept-task-3>task</a> has since been queued to run
- <a href=#the-embed-element-setup-steps id=the-embed-element:the-embed-element-setup-steps-3>the <code>embed</code> element setup steps</a> for this element, then abort these
- steps.<li>
- <p>Determine the <dfn id=concept-embed-type>type of the content</dfn> being embedded, as
- follows (stopping at the first substep that determines the type):</p>
- <ol><li><p>If the element has a <code id=the-embed-element:attr-embed-type-8><a href=#attr-embed-type>type</a></code> attribute, and that
- attribute's value is a type that a <a href=#plugin id=the-embed-element:plugin-2>plugin</a> supports, then the value of the
- <code id=the-embed-element:attr-embed-type-9><a href=#attr-embed-type>type</a></code> attribute is the <a href=#concept-embed-type id=the-embed-element:concept-embed-type>content's type</a>.<li>
-
- <p>Otherwise, if applying the <a href=#url-parser id=the-embed-element:url-parser>URL parser</a> algorithm to the <a href=#url id=the-embed-element:url>URL</a> of
- the specified resource (after any redirects) results in a <a href=#parsed-url id=the-embed-element:parsed-url>parsed URL</a> whose
- <a href=#concept-url-path id=the-embed-element:concept-url-path>path</a> component matches a pattern that a
- <a href=#plugin id=the-embed-element:plugin-3>plugin</a> supports, then the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-2>content's
- type</a> is the type that that plugin can handle.</p>
- <p class=example>For example, a plugin might say that it can handle resources with <a href=#concept-url-path id=the-embed-element:concept-url-path-2>path</a> components that end with the four character string
- "<code>.swf</code>".</p>
-
-
- <li><p>Otherwise, if the specified resource has <a href=#content-type id=the-embed-element:content-type-2>explicit
- Content-Type metadata</a>, then that is the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-3>content's
- type</a>.<li><p>Otherwise, the content has no <a href=#concept-embed-type id=the-embed-element:concept-embed-type-4>type</a> and there
- can be no appropriate <a href=#plugin id=the-embed-element:plugin-4>plugin</a> for it.</ol>
- <li>
- <p>If the previous step determined that the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-5>content's
- type</a> is <code>image/svg+xml</code>, then run the following substeps:</p>
- <ol><li><p>If the <code id=the-embed-element:the-embed-element-8><a href=#the-embed-element>embed</a></code> element is not associated with a <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context>nested browsing
- context</a>, associate the element with a newly created <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-2>nested browsing
- context</a>, and, if the element has a <code id=the-embed-element:attr-embed-name><a href=#attr-embed-name>name</a></code>
- attribute, set the <a href=#browsing-context-name id=the-embed-element:browsing-context-name>browsing context name</a> of the element's <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-3>nested
- browsing context</a> to the value of this attribute.</p>
-
- <li><p><a href=#navigate id=the-embed-element:navigate>Navigate</a> the <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-4>nested browsing context</a> to
- the fetched resource, with <a href=#replacement-enabled id=the-embed-element:replacement-enabled>replacement enabled</a>, and with the
- <code id=the-embed-element:the-embed-element-9><a href=#the-embed-element>embed</a></code> element's <a id=the-embed-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#browsing-context id=the-embed-element:browsing-context>browsing context</a> as the <a href=#source-browsing-context id=the-embed-element:source-browsing-context>source
- browsing context</a>. (The <code id=the-embed-element:attr-embed-src-10><a href=#attr-embed-src>src</a></code> attribute of the
- <code id=the-embed-element:the-embed-element-10><a href=#the-embed-element>embed</a></code> element doesn't get updated if the browsing context gets further
- navigated to other locations.)<li><p>The <code id=the-embed-element:the-embed-element-11><a href=#the-embed-element>embed</a></code> element now <a href=#represents id=the-embed-element:represents-2>represents</a> its associated
- <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-5>nested browsing context</a>.</ol>
- <li>
- <p>Otherwise, find and instantiate an appropriate <a href=#plugin id=the-embed-element:plugin-5>plugin</a> based on the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-6>content's type</a>, and hand that <a href=#plugin id=the-embed-element:plugin-6>plugin</a> the
- content of the resource, replacing any previously instantiated plugin for the element. The
- <code id=the-embed-element:the-embed-element-12><a href=#the-embed-element>embed</a></code> element now represents this <a href=#plugin id=the-embed-element:plugin-7>plugin</a> instance.</p>
- <li><p>Once the resource or plugin has completely loaded, <a href=#queue-a-task id=the-embed-element:queue-a-task-3>queue a task</a> to
- <a href=#fire-a-simple-event id=the-embed-element:fire-a-simple-event>fire a simple event</a> named <code id=the-embed-element:event-load><a href=#event-load>load</a></code> at the
- element.</ol>
- <p>Whether the resource is fetched successfully or not (e.g. whether the response code was a
- 2xx code <a href=#concept-http-equivalent-codes id=the-embed-element:concept-http-equivalent-codes>or equivalent</a>) must be ignored
- when determining the <a href=#concept-embed-type id=the-embed-element:concept-embed-type-7>content's type</a> and when handing
- the resource to the plugin.</p>
- <p class=note>This allows servers to return data for plugins even with error responses (e.g.
- HTTP 500 Internal Server Error codes can still contain plugin data).</p>
- <p>Fetching the resource must <a href=#delay-the-load-event id=the-embed-element:delay-the-load-event>delay the load event</a> of the element's <a id=the-embed-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
-
-
-
- <dt>If the element has no <code id=the-embed-element:attr-embed-src-11><a href=#attr-embed-src>src</a></code> attribute set<dd>
- <p>The user agent should find and instantiate an appropriate <a href=#plugin id=the-embed-element:plugin-8>plugin</a> based on the
- value of the <code id=the-embed-element:attr-embed-type-10><a href=#attr-embed-type>type</a></code> attribute. The <code id=the-embed-element:the-embed-element-13><a href=#the-embed-element>embed</a></code>
- element now represents this <a href=#plugin id=the-embed-element:plugin-9>plugin</a> instance.</p>
- <p>Once the plugin is completely loaded, <a href=#queue-a-task id=the-embed-element:queue-a-task-4>queue a task</a> to <a href=#fire-a-simple-event id=the-embed-element:fire-a-simple-event-2>fire a simple
- event</a> named <code id=the-embed-element:event-load-2><a href=#event-load>load</a></code> at the element.</p>
- </dl>
- </ol>
- <p>The <code id=the-embed-element:the-embed-element-14><a href=#the-embed-element>embed</a></code> element has no <a href=#fallback-content id=the-embed-element:fallback-content-3>fallback content</a>. If the user agent can't
- find a suitable plugin when attempting to find and instantiate one for the algorithm above, then
- the user agent must use a default plugin. This default could be as simple as saying "Unsupported
- Format".</p>
- <p>Whenever an <code id=the-embed-element:the-embed-element-15><a href=#the-embed-element>embed</a></code> element that was <a href=#concept-embed-active id=the-embed-element:concept-embed-active-5>potentially
- active</a> stops being <a href=#concept-embed-active id=the-embed-element:concept-embed-active-6>potentially active</a>, any
- <a href=#plugin id=the-embed-element:plugin-10>plugin</a> that had been instantiated for that element must be unloaded.</p>
- <p id=sandboxPluginEmbed>When a <a href=#plugin id=the-embed-element:plugin-11>plugin</a> is to be instantiated but it cannot be <a href=#concept-plugin-secure id=the-embed-element:concept-plugin-secure>secured</a> and the <a href=#sandboxed-plugins-browsing-context-flag id=the-embed-element:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context
- flag</a> is set on the <code id=the-embed-element:the-embed-element-16><a href=#the-embed-element>embed</a></code> element's <a id=the-embed-element:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=the-embed-element:active-sandboxing-flag-set>active
- sandboxing flag set</a>, then the user agent must not instantiate the <a href=#plugin id=the-embed-element:plugin-12>plugin</a>, and
- must instead render the <code id=the-embed-element:the-embed-element-17><a href=#the-embed-element>embed</a></code> element in a manner that conveys that the
- <a href=#plugin id=the-embed-element:plugin-13>plugin</a> was disabled. The user agent may offer the user the option to override the
- sandbox and instantiate the <a href=#plugin id=the-embed-element:plugin-14>plugin</a> anyway; if the user invokes such an option, the
- user agent must act as if the conditions above did not apply for the purposes of this element.</p>
- <p class=warning>Plugins that cannot be <a href=#concept-plugin-secure id=the-embed-element:concept-plugin-secure-2>secured</a> are
- disabled in sandboxed browsing contexts because they might not honor the restrictions imposed by
- the sandbox (e.g. they might allow scripting even when scripting in the sandbox is disabled). User
- agents should convey the danger of overriding the sandbox to the user if an option to do so is
- provided.</p>
- <p>When an <code id=the-embed-element:the-embed-element-18><a href=#the-embed-element>embed</a></code> element represents a <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-6>nested browsing context</a>: if the
- <code id=the-embed-element:the-embed-element-19><a href=#the-embed-element>embed</a></code> element's <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-7>nested browsing context</a>'s <a href=#active-document id=the-embed-element:active-document>active document</a>
- is not <a href=#ready-for-post-load-tasks id=the-embed-element:ready-for-post-load-tasks>ready for post-load tasks</a>, and when anything is <a href=#delay-the-load-event id=the-embed-element:delay-the-load-event-2>delaying the load event</a> of the <code id=the-embed-element:the-embed-element-20><a href=#the-embed-element>embed</a></code> element's <a href=#browsing-context id=the-embed-element:browsing-context-2>browsing
- context</a>'s <a href=#active-document id=the-embed-element:active-document-2>active document</a>, and when the <code id=the-embed-element:the-embed-element-21><a href=#the-embed-element>embed</a></code> element's
- <a href=#browsing-context id=the-embed-element:browsing-context-3>browsing context</a> is in the <a href=#delaying-load-events-mode id=the-embed-element:delaying-load-events-mode>delaying <code>load</code>
- events mode</a>, the <code id=the-embed-element:the-embed-element-22><a href=#the-embed-element>embed</a></code> must <a href=#delay-the-load-event id=the-embed-element:delay-the-load-event-3>delay the load event</a> of its
- document.</p>
- <p>The <a href=#task-source id=the-embed-element:task-source>task source</a> for the <a href=#concept-task id=the-embed-element:concept-task-4>tasks</a> mentioned in this
- section is the <a href=#dom-manipulation-task-source id=the-embed-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
-
- <p>Any namespace-less attribute other than <code id=the-embed-element:attr-embed-name-2><a href=#attr-embed-name>name</a></code>, <code id=the-embed-element:attr-embed-align><a href=#attr-embed-align>align</a></code>, <code id=the-embed-element:attr-embed-hspace><a href=#attr-embed-hspace>hspace</a></code>, and <code id=the-embed-element:attr-embed-vspace><a href=#attr-embed-vspace>vspace</a></code> may be
- specified on the <code id=the-embed-element:the-embed-element-23><a href=#the-embed-element>embed</a></code> element, so long as its name is <a href=#xml-compatible id=the-embed-element:xml-compatible>XML-compatible</a>
- and contains no <a href=#uppercase-ascii-letters id=the-embed-element:uppercase-ascii-letters>uppercase ASCII letters</a>. These attributes are then passed as
- parameters to the <a href=#plugin id=the-embed-element:plugin-15>plugin</a>.</p>
- <p class=note>All attributes in <a href=#html-documents id=the-embed-element:html-documents>HTML documents</a> get lowercased automatically, so the
- restriction on uppercase letters doesn't affect such documents.</p>
- <p class=note>The four exceptions are to exclude legacy attributes that have side-effects beyond
- just sending parameters to the <a href=#plugin id=the-embed-element:plugin-16>plugin</a>.</p>
-
- <p>The user agent should pass the names and values of all the attributes of the <code id=the-embed-element:the-embed-element-24><a href=#the-embed-element>embed</a></code>
- element that have no namespace to the <a href=#plugin id=the-embed-element:plugin-17>plugin</a> used, when one is instantiated.</p>
- <p>The <code id=the-embed-element:htmlembedelement><a href=#htmlembedelement>HTMLEmbedElement</a></code> object representing the element must expose the scriptable
- interface of the <a href=#plugin id=the-embed-element:plugin-18>plugin</a> instantiated for the <code id=the-embed-element:the-embed-element-25><a href=#the-embed-element>embed</a></code> element, if any. At a
- minimum, this interface must implement the <dfn id=dom-embed-caller>legacy caller
- operation</dfn>. (It is suggested that the default behavior of this legacy caller operation, e.g.
- the behavior of the default plugin's legacy caller operation, be to throw a
- <code id=the-embed-element:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception.)</p>
-
- <p>The <code id=the-embed-element:the-embed-element-26><a href=#the-embed-element>embed</a></code> element supports <a href=#dimension-attributes id=the-embed-element:dimension-attributes>dimension attributes</a>.</p>
- <dl class=domintro><dt><var>doc</var> = <var>embed</var> . <code id=the-embed-element:dom-embed-getsvgdocument-2><a href=#dom-embed-getsvgdocument>getSVGDocument</a></code>()<dd>
- <p>Returns the <code id=the-embed-element:document-2><a href=#document>Document</a></code> object, in the case of <code id=the-embed-element:the-embed-element-27><a href=#the-embed-element>embed</a></code> being used to embed SVG images.</p>
- </dl>
-
- <p>The <dfn id=dom-embed-getsvgdocument><code>getSVGDocument()</code></dfn> method must run
- the following steps:</p>
- <ol><li><p>If the element has no <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-8>nested browsing context</a>, then return null and abort
- these steps.<li><p>If the <a href=#active-document id=the-embed-element:active-document-3>active document</a> of the <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-9>nested browsing context</a> does not
- have the <a href=#same-origin id=the-embed-element:same-origin>same</a> <a href=#effective-script-origin id=the-embed-element:effective-script-origin>effective script origin</a> as the
- <code id=the-embed-element:the-embed-element-28><a href=#the-embed-element>embed</a></code> element's <a id=the-embed-element:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, then return null and abort these
- steps.<li><p>If the <a href=#nested-browsing-context id=the-embed-element:nested-browsing-context-10>nested browsing context</a>'s <a href=#active-document id=the-embed-element:active-document-4>active document</a> was created by
- the <a href=#read-xml id=the-embed-element:read-xml>page load processing model for XML files</a> section because
- <span>the sniffed type of the resource</span> in the <a href=#navigate id=the-embed-element:navigate-2>navigate</a> algorithm was
- <code id=the-embed-element:image/svg+xml><a href=#image/svg+xml>image/svg+xml</a></code>, then return that <code id=the-embed-element:document-3><a href=#document>Document</a></code> object and abort these
- steps.<li><p>Otherwise, return null.</ol>
- <p>The IDL attributes <dfn id=dom-embed-src><code>src</code></dfn> and <dfn id=dom-embed-type><code>type</code></dfn> each must <a href=#reflect id=the-embed-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
-
- <div class=example>
- <p>Here's a way to embed a resource that requires a proprietary plugin, like Flash:</p>
- <pre><embed src="catgame.swf"></pre>
- <p>If the user does not have the plugin (for example if the plugin vendor doesn't support the
- user's platform), then the user will be unable to use the resource.</p>
- <p>To pass the plugin a parameter "quality" with the value "high", an attribute can be
- specified:</p>
- <pre><embed src="catgame.swf" quality="high"></pre>
- <p>This would be equivalent to the following, when using an <code id=the-embed-element:the-object-element-3><a href=#the-object-element>object</a></code> element
- instead:</p>
- <pre><object data="catgame.swf">
- <param name="quality" value="high">
- </object></pre>
- </div>
- <h4 id=the-object-element>4.8.8 The <dfn><code>object</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-object-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-object-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-object-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-object-element:embedded-content-category>Embedded content</a>.<dd>If the element has a <code id=the-object-element:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute: <a href=#interactive-content-2 id=the-object-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-listed id=the-object-element:category-listed>Listed</a>, <a href=#category-submit id=the-object-element:category-submit>submittable</a>, and <a href=#category-form-attr id=the-object-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-object-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-object-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-object-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-object-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-object-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-object-element:the-param-element><a href=#the-param-element>param</a></code> elements, then, <a href=#transparent id=the-object-element:transparent>transparent</a>.<dt><a href=#concept-element-tag-omission id=the-object-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-object-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-object-element:global-attributes>Global attributes</a><dd><code id=the-object-element:attr-object-data><a href=#attr-object-data>data</a></code> — Address of the resource<dd><code id=the-object-element:attr-object-type><a href=#attr-object-type>type</a></code> — Type of embedded resource<dd><code id=the-object-element:attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code> — Whether the <code id=the-object-element:attr-object-type-2><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type id=the-object-element:content-type>Content-Type</a> value need to match for the resource to be used<dd><code id=the-object-element:attr-object-name><a href=#attr-object-name>name</a></code> — Name of <a href=#nested-browsing-context id=the-object-element:nested-browsing-context>nested browsing context</a><dd><code id=the-object-element:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code> — Name of <a href=#image-map id=the-object-element:image-map>image map</a> to use<dd><code id=the-object-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-object-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-object-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd><code id=the-object-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dt><a href=#concept-element-dom id=the-object-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlobjectelement>HTMLObjectElement</dfn> : <a href=#htmlelement id=the-object-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-object-data id=the-object-element:dom-object-data>data</a>;
- attribute DOMString <a href=#dom-object-type id=the-object-element:dom-object-type>type</a>;
- attribute boolean <a href=#dom-object-typemustmatch id=the-object-element:dom-object-typemustmatch>typeMustMatch</a>;
- attribute DOMString <a href=#dom-object-name id=the-object-element:dom-object-name>name</a>;
- attribute DOMString <a href=#dom-object-usemap id=the-object-element:dom-object-usemap>useMap</a>;
- readonly attribute <a href=#htmlformelement id=the-object-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-object-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-dim-width id=the-object-element:dom-dim-width>width</a>;
- attribute DOMString <a href=#dom-dim-height id=the-object-element:dom-dim-height>height</a>;
- readonly attribute <a href=#document id=the-object-element:document>Document</a>? <a href=#dom-object-contentdocument id=the-object-element:dom-object-contentdocument>contentDocument</a>;
- readonly attribute <a href=#windowproxy id=the-object-element:windowproxy>WindowProxy</a>? <a href=#dom-object-contentwindow id=the-object-element:dom-object-contentwindow>contentWindow</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-object-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-object-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-object-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-object-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-object-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-object-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-object-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- <a href=#dom-object-caller id=the-object-element:dom-object-caller>legacycaller</a> any (any... arguments);
- // <a href="#HTMLObjectElement-partial">also has obsolete members</a>
- };</pre>
-
- <p>Depending on the type of content instantiated by the
- <code id=the-object-element:the-object-element><a href=#the-object-element>object</a></code> element, the node also supports other
- interfaces.</p>
-
- </dl>
- <p>The <code id=the-object-element:the-object-element-2><a href=#the-object-element>object</a></code> element can represent an external resource, which, depending on the
- type of the resource, will either be treated as an image, as a <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-2>nested browsing
- context</a>, or as an external resource to be processed by a <a href=#plugin id=the-object-element:plugin>plugin</a>.</p>
- <p>The <dfn id=attr-object-data><code>data</code></dfn> attribute, if present, specifies the
- address of the resource. If present, the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-object-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially
- surrounded by spaces</a>.</p>
- <p class=warning>Authors who reference resources from other <a href=#origin-2 id=the-object-element:origin-2>origins</a>
- that they do not trust are urged to use the <code id=the-object-element:attr-object-typemustmatch-2><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute defined below. Without that
- attribute, it is possible in certain cases for an attacker on the remote host to use the plugin
- mechanism to run arbitrary scripts, even if the author has used features such as the Flash
- "allowScriptAccess" parameter.</p>
- <p>The <dfn id=attr-object-type><code>type</code></dfn> attribute, if present, specifies the
- type of the resource. If present, the attribute must be a <a href=#valid-mime-type id=the-object-element:valid-mime-type>valid MIME type</a>.</p>
- <p>At least one of either the <code id=the-object-element:attr-object-data-2><a href=#attr-object-data>data</a></code> attribute or the <code id=the-object-element:attr-object-type-3><a href=#attr-object-type>type</a></code> attribute must be present.</p>
- <p>If the <code id=the-object-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an <code id=the-object-element:the-object-element-3><a href=#the-object-element>object</a></code>
- element, then the <code id=the-object-element:attr-object-data-3><a href=#attr-object-data>data</a></code> attribute must also be specified.</p>
- <p>The <dfn id=attr-object-typemustmatch><code>typemustmatch</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-object-element:boolean-attribute>boolean attribute</a> whose presence indicates that the resource specified by the <code id=the-object-element:attr-object-data-4><a href=#attr-object-data>data</a></code> attribute is only to be used if the value of the <code id=the-object-element:attr-object-type-4><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type id=the-object-element:content-type-2>Content-Type</a> of the
- aforementioned resource match.</p>
- <p>The <code id=the-object-element:attr-object-typemustmatch-3><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute must not be
- specified unless both the <code id=the-object-element:attr-object-data-5><a href=#attr-object-data>data</a></code> attribute and the <code id=the-object-element:attr-object-type-5><a href=#attr-object-type>type</a></code> attribute are present.</p>
- <p>The <dfn id=attr-object-name><code>name</code></dfn> attribute, if present, must be a
- <a href=#valid-browsing-context-name id=the-object-element:valid-browsing-context-name>valid browsing context name</a>. The given value is used to name the <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-3>nested
- browsing context</a>, if applicable.</p>
-
- <p>Whenever one of the following conditions occur:</p>
- <ul><li>the element is created,
- <li>the element is popped off the <a href=#stack-of-open-elements id=the-object-element:stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser id=the-object-element:html-parser>HTML
- parser</a> or <a href=#xml-parser id=the-object-element:xml-parser>XML parser</a>,
- <li>the element is not on the <a href=#stack-of-open-elements id=the-object-element:stack-of-open-elements-2>stack of open elements</a> of an <a href=#html-parser id=the-object-element:html-parser-2>HTML parser</a>
- or <a href=#xml-parser id=the-object-element:xml-parser-2>XML parser</a>, and it is either <a href=#insert-an-element-into-a-document id=the-object-element:insert-an-element-into-a-document>inserted into a document</a> or <a href=#remove-an-element-from-a-document id=the-object-element:remove-an-element-from-a-document>removed from a document</a>,
- <li>the element's <a id=the-object-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> changes whether it is <a href=#fully-active id=the-object-element:fully-active>fully active</a>,
- <li>one of the element's ancestor <code id=the-object-element:the-object-element-4><a href=#the-object-element>object</a></code> elements changes to or from showing its
- <a href=#fallback-content id=the-object-element:fallback-content>fallback content</a>,
- <li>the element's <code id=the-object-element:attr-object-classid><a href=#attr-object-classid>classid</a></code> attribute is set, changed, or
- removed,
- <li>the element's <code id=the-object-element:attr-object-classid-2><a href=#attr-object-classid>classid</a></code> attribute is not present, and
- its <code id=the-object-element:attr-object-data-6><a href=#attr-object-data>data</a></code> attribute is set, changed, or removed,
- <li>neither the element's <code id=the-object-element:attr-object-classid-3><a href=#attr-object-classid>classid</a></code> attribute nor its
- <code id=the-object-element:attr-object-data-7><a href=#attr-object-data>data</a></code> attribute are present, and its <code id=the-object-element:attr-object-type-6><a href=#attr-object-type>type</a></code> attribute is set, changed, or removed,
- <li>the element changes from <a href=#being-rendered id=the-object-element:being-rendered>being rendered</a> to not being rendered, or vice versa,
- </ul>
- <p>...the user agent must <a href=#queue-a-task id=the-object-element:queue-a-task>queue a task</a> to run the following steps to (re)determine
- what the <code id=the-object-element:the-object-element-5><a href=#the-object-element>object</a></code> element represents. This <a href=#concept-task id=the-object-element:concept-task>task</a>
- being <a href=#queue-a-task id=the-object-element:queue-a-task-2>queued</a> or actively running must <a href=#delay-the-load-event id=the-object-element:delay-the-load-event>delay the load
- event</a> of the element's <a id=the-object-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>. </p>
- <ol><li>
- <p>If the user has indicated a preference that this <code id=the-object-element:the-object-element-6><a href=#the-object-element>object</a></code> element's <a href=#fallback-content id=the-object-element:fallback-content-2>fallback
- content</a> be shown instead of the element's usual behavior, then jump to the step below
- labeled <i>fallback</i>.</p>
- <p class=note>For example, a user could ask for the element's <a href=#fallback-content id=the-object-element:fallback-content-3>fallback content</a> to
- be shown because that content uses a format that the user finds more accessible.</p>
- <li>
- <p>If the element has an ancestor <a href=#media-element id=the-object-element:media-element>media element</a>, or has an ancestor
- <code id=the-object-element:the-object-element-7><a href=#the-object-element>object</a></code> element that is <em>not</em> showing its <a href=#fallback-content id=the-object-element:fallback-content-4>fallback content</a>, or
- if the element is not <a href=#in-a-document id=the-object-element:in-a-document>in a <code>Document</code></a> with a
- <a href=#browsing-context id=the-object-element:browsing-context>browsing context</a>, or if the element's <a id=the-object-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-object-element:fully-active-2>fully
- active</a>, or if the element is still in the <a href=#stack-of-open-elements id=the-object-element:stack-of-open-elements-3>stack of open elements</a> of an
- <a href=#html-parser id=the-object-element:html-parser-3>HTML parser</a> or <a href=#xml-parser id=the-object-element:xml-parser-3>XML parser</a>, or if the element is not <a href=#being-rendered id=the-object-element:being-rendered-2>being
- rendered</a>, then jump to the step below labeled <i>fallback</i>.</p>
- <li>
-
- <p>If the <code id=the-object-element:attr-object-classid-4><a href=#attr-object-classid>classid</a></code> attribute is present, and has a
- value that isn't the empty string, then: if the user agent can find a <a href=#plugin id=the-object-element:plugin-2>plugin</a>
- suitable according to the value of the <code id=the-object-element:attr-object-classid-5><a href=#attr-object-classid>classid</a></code>
- attribute, and either <a href=#sandboxPluginObject>plugins aren't being sandboxed</a> or that
- <a href=#plugin id=the-object-element:plugin-3>plugin</a> can be <a href=#concept-plugin-secure id=the-object-element:concept-plugin-secure>secured</a>, then that
- <a href=#plugin id=the-object-element:plugin-4>plugin</a> <a href=#object-plugin>should be used</a>, and the value of the <code id=the-object-element:attr-object-data-8><a href=#attr-object-data>data</a></code> attribute, if any, should be passed to the
- <a href=#plugin id=the-object-element:plugin-5>plugin</a>. If no suitable <a href=#plugin id=the-object-element:plugin-6>plugin</a> can be found, or if the
- <a href=#plugin id=the-object-element:plugin-7>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>.</p>
-
- <li><p>If the <code id=the-object-element:attr-object-data-9><a href=#attr-object-data>data</a></code> attribute is present and its value is
- not the empty string, then:</p>
- <ol><li><p>If the <code id=the-object-element:attr-object-type-7><a href=#attr-object-type>type</a></code> attribute is present and its value is
- not a type that the user agent supports, and is not a type that the user agent can find a
- <a href=#plugin id=the-object-element:plugin-8>plugin</a> for, then the user agent may jump to the step below labeled <i>fallback</i>
- without fetching the content to examine its real type.<li><p><a href=#resolve-a-url id=the-object-element:resolve-a-url>Resolve</a> the <a href=#url id=the-object-element:url>URL</a> specified by the <code id=the-object-element:attr-object-data-10><a href=#attr-object-data>data</a></code> attribute, relative to the element.<li><p>If that failed, <a href=#fire-a-simple-event id=the-object-element:fire-a-simple-event>fire a simple event</a> named <code id=the-object-element:event-error><a href=#event-error>error</a></code> at the element, then jump to the step below labeled
- <i>fallback</i>.<li>
- <p><a href=#fetch id=the-object-element:fetch>Fetch</a> the resulting <a href=#absolute-url id=the-object-element:absolute-url>absolute URL</a>, from the element's
- <a href=#browsing-context-scope-origin id=the-object-element:browsing-context-scope-origin>browsing context scope origin</a> if it has one.</p>
-
- <p>Fetching the resource must <a href=#delay-the-load-event id=the-object-element:delay-the-load-event-2>delay the load event</a> of the element's <a id=the-object-element:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>
- until the <a href=#concept-task id=the-object-element:concept-task-2>task</a> that is <a href=#queue-a-task id=the-object-element:queue-a-task-3>queued</a> by the <a href=#networking-task-source id=the-object-element:networking-task-source>networking task source</a> once the resource has been
- <a href=#fetch id=the-object-element:fetch-2>fetched</a> (defined next) has been run.</p>
- <p>For the purposes of the <a href=#application-cache id=the-object-element:application-cache>application cache</a> networking model, this
- <a href=#fetch id=the-object-element:fetch-3>fetch</a> operation is not for a <a href=#child-browsing-context id=the-object-element:child-browsing-context>child browsing context</a> (though it might
- end up being used for one after all, as defined below).</p>
- <li><p>If the resource is not yet available (e.g. because the resource was not available in the
- cache, so that loading the resource required making a request over the network), then jump to
- the step below labeled <i>fallback</i>. The <a href=#concept-task id=the-object-element:concept-task-3>task</a> that is
- <a href=#queue-a-task id=the-object-element:queue-a-task-4>queued</a> by the <a href=#networking-task-source id=the-object-element:networking-task-source-2>networking task source</a> once the
- resource is available must restart this algorithm from this step. Resources can load
- incrementally; user agents may opt to consider a resource "available" whenever enough data has
- been obtained to begin processing the resource.<li><p>If the load failed (e.g. there was an HTTP 404 error, there was a DNS error), <a href=#fire-a-simple-event id=the-object-element:fire-a-simple-event-2>fire
- a simple event</a> named <code id=the-object-element:event-error-2><a href=#event-error>error</a></code> at the element, then jump to
- the step below labeled <i>fallback</i>.<li id=object-type-detection>
- <p>Determine the <var>resource type</var>, as follows:</p>
- <ol><li>
- <p>Let the <var>resource type</var> be unknown.</p>
- <li>
- <p>If the <code id=the-object-element:the-object-element-8><a href=#the-object-element>object</a></code> element has a <code id=the-object-element:attr-object-type-8><a href=#attr-object-type>type</a></code>
- attribute and a <code id=the-object-element:attr-object-typemustmatch-4><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute, and
- the resource has <a href=#content-type id=the-object-element:content-type-3>associated Content-Type metadata</a>, and the
- type specified in <a href=#content-type id=the-object-element:content-type-4>the resource's Content-Type metadata</a> is
- an <a href=#ascii-case-insensitive id=the-object-element:ascii-case-insensitive>ASCII case-insensitive</a> match for the value of the element's <code id=the-object-element:attr-object-type-9><a href=#attr-object-type>type</a></code> attribute, then let <var>resource type</var>
- be that type and jump to the step below labeled <i>handler</i>.</p>
-
- <li>
- <p>If the <code id=the-object-element:the-object-element-9><a href=#the-object-element>object</a></code> element has a <code id=the-object-element:attr-object-typemustmatch-5><a href=#attr-object-typemustmatch>typemustmatch</a></code> attribute, jump to the step below
- labeled <i>handler</i>.</p>
- <li>
-
- <p>If the user agent is configured to strictly obey Content-Type headers for this resource,
- and the resource has <a href=#content-type id=the-object-element:content-type-5>associated Content-Type metadata</a>,
- then let the <var>resource type</var> be the type specified in <a href=#content-type id=the-object-element:content-type-6>the resource's Content-Type metadata</a>, and jump to the step below
- labeled <i>handler</i>.</p>
- <p class=warning>This can introduce a vulnerability, wherein a site is trying to embed a
- resource that uses a particular plugin, but the remote site overrides that and instead
- furnishes the user agent with a resource that triggers a different plugin with different
- security characteristics. </p>
- <li>
- <p>If there is a <code id=the-object-element:attr-object-type-10><a href=#attr-object-type>type</a></code> attribute present on the
- <code id=the-object-element:the-object-element-10><a href=#the-object-element>object</a></code> element, and that attribute's value is not a type that the user agent
- supports, but it <em>is</em> a type that a <a href=#plugin id=the-object-element:plugin-9>plugin</a> supports, then let the <var>resource type</var> be the type specified in that <code id=the-object-element:attr-object-type-11><a href=#attr-object-type>type</a></code> attribute, and jump to the step below labeled
- <i>handler</i>.</p>
- <li>
- <p>Run the appropriate set of steps from the following
- list:</p>
- <dl class=switch><dt>If the resource has <a href=#content-type id=the-object-element:content-type-7>associated Content-Type
- metadata</a><dd>
- <ol><li>
- <p>Let <var>binary</var> be false.</p>
- <li>
- <p>If the type specified in <a href=#content-type id=the-object-element:content-type-8>the resource's Content-Type
- metadata</a> is "<code id=the-object-element:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>", and the result of applying the <a href=http://mimesniff.spec.whatwg.org/#rules-for-text-or-binary id=the-object-element:content-type-sniffing:-text-or-binary data-x-internal=content-type-sniffing:-text-or-binary>rules for distinguishing if a resource is
- text or binary</a> to the resource is that the resource is not
- <code id=the-object-element:text/plain-2><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>, then set <var>binary</var> to true.</p>
- <li>
- <p>If the type specified in <a href=#content-type id=the-object-element:content-type-9>the resource's Content-Type
- metadata</a> is "<code id=the-object-element:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>", then set <var>binary</var> to true.</p>
- <li>
- <p>If <var>binary</var> is false, then let the <var>resource
- type</var> be the type specified in <a href=#content-type id=the-object-element:content-type-10>the resource's
- Content-Type metadata</a>, and jump to the step below labeled <i>handler</i>.</p>
- <li>
- <p>If there is a <code id=the-object-element:attr-object-type-12><a href=#attr-object-type>type</a></code> attribute present on the
- <code id=the-object-element:the-object-element-11><a href=#the-object-element>object</a></code> element, and its value is not <code id=the-object-element:application/octet-stream-2><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>,
- then run the following steps:</p>
- <ol><li>
- <p>If the attribute's value is a type that a <a href=#plugin id=the-object-element:plugin-10>plugin</a> supports, or the
- attribute's value is a type that starts with "<code>image/</code>" that is
- not also an <a href=#xml-mime-type id=the-object-element:xml-mime-type>XML MIME type</a>, then let the <var>resource type</var> be the
- type specified in that <code id=the-object-element:attr-object-type-13><a href=#attr-object-type>type</a></code> attribute.</p>
- <li>
- <p>Jump to the step below labeled <i>handler</i>.</p>
- </ol>
- </ol>
- <dt>Otherwise, if the resource does not have <a href=#content-type id=the-object-element:content-type-11>associated
- Content-Type metadata</a><dd>
- <ol><li>
- <p>If there is a <code id=the-object-element:attr-object-type-14><a href=#attr-object-type>type</a></code> attribute present on the
- <code id=the-object-element:the-object-element-12><a href=#the-object-element>object</a></code> element, then let the <var>tentative type</var> be the type
- specified in that <code id=the-object-element:attr-object-type-15><a href=#attr-object-type>type</a></code> attribute.</p>
- <p>Otherwise, let <var>tentative type</var> be the <a href=http://mimesniff.spec.whatwg.org/#sniffed-mime-type id=the-object-element:content-type-sniffing-2 data-x-internal=content-type-sniffing-2>sniffed type of the resource</a>.</p>
- <li>
- <p>If <var>tentative type</var> is <em>not</em>
- <code id=the-object-element:application/octet-stream-3><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>, then let <var>resource type</var> be
- <var>tentative type</var> and jump to the step below labeled
- <i>handler</i>.</p>
- </ol>
- </dl>
- <li>
-
- <p>If applying the <a href=#url-parser id=the-object-element:url-parser>URL parser</a> algorithm to the <a href=#url id=the-object-element:url-2>URL</a> of the
- specified resource (after any redirects) results in a <a href=#parsed-url id=the-object-element:parsed-url>parsed URL</a> whose <a href=#concept-url-path id=the-object-element:concept-url-path>path</a> component matches a pattern that a <a href=#plugin id=the-object-element:plugin-11>plugin</a>
- supports, then let <var>resource type</var> be the type that that plugin can
- handle.</p>
- <p class=example>For example, a plugin might say that it can handle resources with <a href=#concept-url-path id=the-object-element:concept-url-path-2>path</a> components that end with the four character string
- "<code>.swf</code>".</p>
-
-
- </ol>
- <p class=note>It is possible for this step to finish, or for one of the substeps above to
- jump straight to the next step, with <var>resource type</var> still being unknown. In
- both cases, the next step will trigger fallback.</p>
- <li><p><i>Handler</i>: Handle the content as given by the first of the following cases that
- matches:</p>
- <dl class=switch><dt>If the <var>resource type</var> is not a type that the user agent supports, but
- it <em>is</em> a type that a <a href=#plugin id=the-object-element:plugin-12>plugin</a> supports<dd>
- <p>If <a href=#sandboxPluginObject>plugins are being sandboxed</a> and the plugin that
- supports <var>resource type</var> cannot be <a href=#concept-plugin-secure id=the-object-element:concept-plugin-secure-2>secured</a>, jump to the step below labeled <i>fallback</i>.</p>
- <p>Otherwise, the user agent should <a href=#object-plugin>use the plugin that supports
- <var>resource type</var></a> and pass the content of the resource to that
- <a href=#plugin id=the-object-element:plugin-13>plugin</a>. If the <a href=#plugin id=the-object-element:plugin-14>plugin</a> reports an error, then jump to the step
- below labeled <i>fallback</i>.</p>
- <dt>If the <var>resource type</var> is an <a href=#xml-mime-type id=the-object-element:xml-mime-type-2>XML MIME type</a>, or if the <var>resource type</var>
- does not start with "<code>image/</code>"<dd>
- <p>The <code id=the-object-element:the-object-element-13><a href=#the-object-element>object</a></code> element must be associated with a newly created <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-4>nested
- browsing context</a>, if it does not already have one.</p>
- <p>If the <a href=#url id=the-object-element:url-3>URL</a> of the given resource is not <code id=the-object-element:about:blank><a href=#about:blank>about:blank</a></code>, the
- element's <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-5>nested browsing context</a> must then be <a href=#navigate id=the-object-element:navigate>navigated</a> to that resource, with
- <a href=#replacement-enabled id=the-object-element:replacement-enabled>replacement enabled</a>, and with the <code id=the-object-element:the-object-element-14><a href=#the-object-element>object</a></code> element's <a id=the-object-element:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s
- <a href=#browsing-context id=the-object-element:browsing-context-2>browsing context</a> as the <a href=#source-browsing-context id=the-object-element:source-browsing-context>source browsing context</a>. (The <code id=the-object-element:attr-object-data-11><a href=#attr-object-data>data</a></code> attribute of the <code id=the-object-element:the-object-element-15><a href=#the-object-element>object</a></code> element doesn't
- get updated if the browsing context gets further navigated to other locations.)</p>
- <p>If the <a href=#url id=the-object-element:url-4>URL</a> of the given resource <em>is</em> <code id=the-object-element:about:blank-2><a href=#about:blank>about:blank</a></code>, then,
- instead, the user agent must <a href=#queue-a-task id=the-object-element:queue-a-task-5>queue a task</a> to <a href=#fire-a-simple-event id=the-object-element:fire-a-simple-event-3>fire a simple event</a>
- named <code id=the-object-element:event-load><a href=#event-load>load</a></code> at the <code id=the-object-element:the-object-element-16><a href=#the-object-element>object</a></code> element. <span class=note>No <code id=the-object-element:event-load-2><a href=#event-load>load</a></code> event is fired at the
- <code id=the-object-element:about:blank-3><a href=#about:blank>about:blank</a></code> document itself.</span></p>
- <p>The <code id=the-object-element:the-object-element-17><a href=#the-object-element>object</a></code> element <a href=#represents id=the-object-element:represents>represents</a> the <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-6>nested browsing
- context</a>.</p>
- <p>If the <code id=the-object-element:attr-object-name-2><a href=#attr-object-name>name</a></code> attribute is present, the
- <a href=#browsing-context-name id=the-object-element:browsing-context-name>browsing context name</a> must be set to the value of this attribute; otherwise,
- the <a href=#browsing-context-name id=the-object-element:browsing-context-name-2>browsing context name</a> must be set to the empty string.</p>
- <p class=note>In certain situations, e.g. if the resource was <a href=#fetch id=the-object-element:fetch-4>fetched</a> from an <a href=#application-cache id=the-object-element:application-cache-2>application cache</a> but it is an HTML file
- with a <code id=the-object-element:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute that points to a different
- <a href=#concept-appcache-manifest id=the-object-element:concept-appcache-manifest>application cache manifest</a>, the <a href=#navigate id=the-object-element:navigate-2>navigation</a> of the <a href=#browsing-context id=the-object-element:browsing-context-3>browsing context</a> will be restarted so
- as to load the resource afresh from the network or a different <a href=#application-cache id=the-object-element:application-cache-3>application
- cache</a>. Even if the resource is then found to have a different type, it is still used
- as part of a <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-7>nested browsing context</a>: only the <a href=#navigate id=the-object-element:navigate-3>navigate</a> algorithm
- is restarted, not this <code id=the-object-element:the-object-element-18><a href=#the-object-element>object</a></code> algorithm.</p>
-
- <dt>If the <var>resource type</var> starts with "<code>image/</code>", and support
- for images has not been disabled<dd>
- <p>Apply the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id=the-object-element:content-type-sniffing:-image data-x-internal=content-type-sniffing:-image>image sniffing</a> rules to
- determine the type of the image.</p>
- <p>The <code id=the-object-element:the-object-element-19><a href=#the-object-element>object</a></code> element <a href=#represents id=the-object-element:represents-2>represents</a> the specified image. The image is
- not a <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-8>nested browsing context</a>.</p>
- <p>If the image cannot be rendered, e.g. because it is malformed or in an unsupported
- format, jump to the step below labeled <i>fallback</i>.</p>
- <dt>Otherwise<dd>
- <p>The given <var>resource type</var> is not supported. Jump to the step below
- labeled <i>fallback</i>.</p>
- <p class=note>If the previous step ended with the <var>resource type</var> being
- unknown, this is the case that is triggered.</p>
- </dl>
- <li><p>The element's contents are not part of what the <code id=the-object-element:the-object-element-20><a href=#the-object-element>object</a></code> element
- represents.</p>
- <li>
- <p>Abort these steps. Once the resource is completely loaded, <a href=#queue-a-task id=the-object-element:queue-a-task-6>queue a task</a> to
- <a href=#fire-a-simple-event id=the-object-element:fire-a-simple-event-4>fire a simple event</a> named <code id=the-object-element:event-load-3><a href=#event-load>load</a></code> at the
- element.</p>
- </ol>
- <li><p>If the <code id=the-object-element:attr-object-data-12><a href=#attr-object-data>data</a></code> attribute is absent but the <code id=the-object-element:attr-object-type-16><a href=#attr-object-type>type</a></code> attribute is present, and the user agent can find a
- <a href=#plugin id=the-object-element:plugin-15>plugin</a> suitable according to the value of the <code id=the-object-element:attr-object-type-17><a href=#attr-object-type>type</a></code> attribute, and either <a href=#sandboxPluginObject>plugins aren't being sandboxed</a> or the <a href=#plugin id=the-object-element:plugin-16>plugin</a> can be
- <a href=#concept-plugin-secure id=the-object-element:concept-plugin-secure-3>secured</a>, then that <a href=#plugin id=the-object-element:plugin-17>plugin</a> <a href=#object-plugin>should be used</a>. If these conditions cannot be met, or if the
- <a href=#plugin id=the-object-element:plugin-18>plugin</a> reports an error, jump to the step below labeled <i>fallback</i>. Otherwise
- abort these steps; once the plugin is completely loaded, <a href=#queue-a-task id=the-object-element:queue-a-task-7>queue a task</a> to <a href=#fire-a-simple-event id=the-object-element:fire-a-simple-event-5>fire
- a simple event</a> named <code id=the-object-element:event-load-4><a href=#event-load>load</a></code> at the element.<li><p><i>Fallback</i>: The <code id=the-object-element:the-object-element-21><a href=#the-object-element>object</a></code> element <a href=#represents id=the-object-element:represents-3>represents</a> the element's
- children, ignoring any leading <code id=the-object-element:the-param-element-2><a href=#the-param-element>param</a></code> element children. This is the element's
- <a href=#fallback-content id=the-object-element:fallback-content-5>fallback content</a>. If the element has an instantiated <a href=#plugin id=the-object-element:plugin-19>plugin</a>, then
- unload it.</ol>
- <p id=object-plugin>When the algorithm above instantiates a <a href=#plugin id=the-object-element:plugin-20>plugin</a>, the user agent
- should pass to the <a href=#plugin id=the-object-element:plugin-21>plugin</a> used the names and values of all the attributes on the
- element, in the order they were added to the element, with the attributes added by the parser
- being ordered in source order, followed by a parameter named "PARAM" whose value is null, followed
- by all the names and values of <a href=#concept-param-parameter id=the-object-element:concept-param-parameter>parameters</a> given by
- <code id=the-object-element:the-param-element-3><a href=#the-param-element>param</a></code> elements that are children of the <code id=the-object-element:the-object-element-22><a href=#the-object-element>object</a></code> element, in <a href=#tree-order id=the-object-element:tree-order>tree
- order</a>. If the <a href=#plugin id=the-object-element:plugin-22>plugin</a> supports a scriptable interface, the
- <code id=the-object-element:htmlobjectelement><a href=#htmlobjectelement>HTMLObjectElement</a></code> object representing the element should expose that interface. The
- <code id=the-object-element:the-object-element-23><a href=#the-object-element>object</a></code> element <a href=#represents id=the-object-element:represents-4>represents</a> the <a href=#plugin id=the-object-element:plugin-23>plugin</a>. The
- <a href=#plugin id=the-object-element:plugin-24>plugin</a> is not a nested <a href=#browsing-context id=the-object-element:browsing-context-4>browsing context</a>.</p>
- <p id=sandboxPluginObject>Plugins are considered sandboxed for the purpose of an
- <code id=the-object-element:the-object-element-24><a href=#the-object-element>object</a></code> element if the <a href=#sandboxed-plugins-browsing-context-flag id=the-object-element:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> is set on
- the <code id=the-object-element:the-object-element-25><a href=#the-object-element>object</a></code> element's <a id=the-object-element:node-document-6 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=the-object-element:active-sandboxing-flag-set>active sandboxing flag
- set</a>.</p>
- <p>Due to the algorithm above, the contents of <code id=the-object-element:the-object-element-26><a href=#the-object-element>object</a></code> elements act as <a href=#fallback-content id=the-object-element:fallback-content-6>fallback
- content</a>, used only when referenced resources can't be shown (e.g. because it returned a 404
- error). This allows multiple <code id=the-object-element:the-object-element-27><a href=#the-object-element>object</a></code> elements to be nested inside each other,
- targeting multiple user agents with different capabilities, with the user agent picking the first
- one it supports.</p>
- <p>When an <code id=the-object-element:the-object-element-28><a href=#the-object-element>object</a></code> element represents a <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-9>nested browsing context</a>: if the
- <code id=the-object-element:the-object-element-29><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-10>nested browsing context</a>'s <a href=#active-document id=the-object-element:active-document>active document</a>
- is not <a href=#ready-for-post-load-tasks id=the-object-element:ready-for-post-load-tasks>ready for post-load tasks</a>, and when anything is <a href=#delay-the-load-event id=the-object-element:delay-the-load-event-3>delaying the load event</a> of the <code id=the-object-element:the-object-element-30><a href=#the-object-element>object</a></code> element's <a href=#browsing-context id=the-object-element:browsing-context-5>browsing
- context</a>'s <a href=#active-document id=the-object-element:active-document-2>active document</a>, and when the <code id=the-object-element:the-object-element-31><a href=#the-object-element>object</a></code> element's
- <a href=#browsing-context id=the-object-element:browsing-context-6>browsing context</a> is in the <a href=#delaying-load-events-mode id=the-object-element:delaying-load-events-mode>delaying <code>load</code>
- events mode</a>, the <code id=the-object-element:the-object-element-32><a href=#the-object-element>object</a></code> must <a href=#delay-the-load-event id=the-object-element:delay-the-load-event-4>delay the load event</a> of its
- document.</p>
- <p>The <a href=#task-source id=the-object-element:task-source>task source</a> for the <a href=#concept-task id=the-object-element:concept-task-4>tasks</a> mentioned in this
- section is the <a href=#dom-manipulation-task-source id=the-object-element:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- <p>Whenever the <code id=the-object-element:attr-object-name-3><a href=#attr-object-name>name</a></code> attribute is set, if the
- <code id=the-object-element:the-object-element-33><a href=#the-object-element>object</a></code> element has a nested <a href=#browsing-context id=the-object-element:browsing-context-7>browsing context</a>, its <a href=#browsing-context-name id=the-object-element:browsing-context-name-3>name</a> must be changed to the new value. If the attribute is removed, if the
- <code id=the-object-element:the-object-element-34><a href=#the-object-element>object</a></code> element has a <a href=#browsing-context id=the-object-element:browsing-context-8>browsing context</a>, the <a href=#browsing-context-name id=the-object-element:browsing-context-name-4>browsing context
- name</a> must be set to the empty string.</p>
-
- <p>The <code id=the-object-element:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if present while the
- <code id=the-object-element:the-object-element-35><a href=#the-object-element>object</a></code> element represents an image, can indicate that the object has an associated
- <a href=#image-map id=the-object-element:image-map-2>image map</a>. The attribute must be ignored if the
- <code id=the-object-element:the-object-element-36><a href=#the-object-element>object</a></code> element doesn't represent an image.</p>
- <p>The <code id=the-object-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-object-element:the-object-element-37><a href=#the-object-element>object</a></code> element with its <a href=#form-owner id=the-object-element:form-owner>form owner</a>.</p>
-
- <p><strong>Constraint validation</strong>: <code id=the-object-element:the-object-element-38><a href=#the-object-element>object</a></code> elements are always <a href=#barred-from-constraint-validation id=the-object-element:barred-from-constraint-validation>barred
- from constraint validation</a>.</p>
-
- <p>The <code id=the-object-element:the-object-element-39><a href=#the-object-element>object</a></code> element supports <a href=#dimension-attributes id=the-object-element:dimension-attributes>dimension attributes</a>.</p>
-
- <p>The IDL attributes <dfn id=dom-object-data><code>data</code></dfn>, <dfn id=dom-object-type><code>type</code></dfn> and <dfn id=dom-object-name><code>name</code></dfn> each must <a href=#reflect id=the-object-element:reflect>reflect</a> the respective
- content attributes of the same name. The <dfn id=dom-object-typemustmatch><code>typeMustMatch</code></dfn> IDL attribute must
- <a href=#reflect id=the-object-element:reflect-2>reflect</a> the <code id=the-object-element:attr-object-typemustmatch-6><a href=#attr-object-typemustmatch>typemustmatch</a></code> content
- attribute. The <dfn id=dom-object-usemap><code>useMap</code></dfn> IDL attribute must
- <a href=#reflect id=the-object-element:reflect-3>reflect</a> the <code id=the-object-element:attr-hyperlink-usemap-4><a href=#attr-hyperlink-usemap>usemap</a></code> content attribute.</p>
- <p>The <dfn id=dom-object-contentdocument><code>contentDocument</code></dfn> IDL attribute
- must return the <code id=the-object-element:document-2><a href=#document>Document</a></code> object of the <a href=#active-document id=the-object-element:active-document-3>active document</a> of the
- <code id=the-object-element:the-object-element-40><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-11>nested browsing context</a>, if any and if its
- <a href=#effective-script-origin id=the-object-element:effective-script-origin>effective script origin</a> is the <a href=#same-origin id=the-object-element:same-origin>same origin</a> as the <a href=#effective-script-origin id=the-object-element:effective-script-origin-2>effective script
- origin</a> specified by the <a href=#incumbent-settings-object id=the-object-element:incumbent-settings-object>incumbent settings object</a>, or null otherwise.</p>
- <p>The <dfn id=dom-object-contentwindow><code>contentWindow</code></dfn> IDL attribute must
- return the <code id=the-object-element:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object of the <code id=the-object-element:the-object-element-41><a href=#the-object-element>object</a></code> element's <a href=#nested-browsing-context id=the-object-element:nested-browsing-context-12>nested
- browsing context</a>, if it has one; otherwise, it must return null.</p>
- <p>The <code id=the-object-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-object-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-object-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> attributes, and the <code id=the-object-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-object-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-object-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-object-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-object-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code> IDL attribute
- is part of the element's forms API.</p>
- <p>All <code id=the-object-element:the-object-element-42><a href=#the-object-element>object</a></code> elements have a <dfn id=dom-object-caller>legacy caller
- operation</dfn>. If the <code id=the-object-element:the-object-element-43><a href=#the-object-element>object</a></code> element has an instantiated <a href=#plugin id=the-object-element:plugin-25>plugin</a> that
- supports a scriptable interface that defines a legacy caller operation, then that must be the
- behavior of the object's legacy caller operation. Otherwise, the object's legacy caller operation
- must be to throw a <code id=the-object-element:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception.</p>
-
- <div class=example>
- <p>In the following example, a Java applet is embedded in a page using the <code id=the-object-element:the-object-element-44><a href=#the-object-element>object</a></code>
- element. (Generally speaking, it is better to avoid using applets like these and instead use
- native JavaScript and HTML to provide the functionality, since that way the application will work
- on all Web browsers without requiring a third-party plugin. Many devices, especially embedded
- devices, do not support third-party technologies like Java.)</p>
- <pre><figure>
- <object type="application/x-java-applet">
- <param name="code" value="MyJavaClass">
- <p>You do not have Java available, or it is disabled.</p>
- </object>
- <figcaption>My Java Clock</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>In this example, an HTML page is embedded in another using the <code id=the-object-element:the-object-element-45><a href=#the-object-element>object</a></code>
- element.</p>
- <pre><figure>
- <object data="clock.html"></object>
- <figcaption>My HTML Clock</figcaption>
- </figure></pre>
- </div>
- <div class=example>
- <p>The following example shows how a plugin can be used in HTML (in this case the Flash plugin,
- to show a video file). Fallback is provided for users who do not have Flash enabled, in this case
- using the <code id=the-object-element:the-video-element><a href=#the-video-element>video</a></code> element to show the video for those using user agents that support
- <code id=the-object-element:the-video-element-2><a href=#the-video-element>video</a></code>, and finally providing a link to the video for those who have neither Flash
- nor a <code id=the-object-element:the-video-element-3><a href=#the-video-element>video</a></code>-capable browser.</p>
- <pre><p>Look at my video:
- <object type="application/x-shockwave-flash">
- <param name=movie value="http://video.example.com/library/watch.swf">
- <param name=allowfullscreen value=true>
- <param name=flashvars value="http://video.example.com/vids/315981">
- <video controls src="http://video.example.com/vids/315981">
- <a href="http://video.example.com/vids/315981">View video</a>.
- </video>
- </object>
- </p></pre>
- </div>
- <h4 id=the-param-element>4.8.9 The <dfn><code>param</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-param-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-param-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of an <code id=the-param-element:the-object-element><a href=#the-object-element>object</a></code> element, before any <a href=#flow-content-2 id=the-param-element:flow-content-2>flow content</a>.<dt><a href=#concept-element-content-model id=the-param-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-param-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-param-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-param-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-param-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-param-element:global-attributes>Global attributes</a><dd><code id=the-param-element:attr-param-name><a href=#attr-param-name>name</a></code> — Name of parameter<dd><code id=the-param-element:attr-param-value><a href=#attr-param-value>value</a></code> — Value of parameter<dt><a href=#concept-element-dom id=the-param-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlparamelement>HTMLParamElement</dfn> : <a href=#htmlelement id=the-param-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-param-name id=the-param-element:dom-param-name>name</a>;
- attribute DOMString <a href=#dom-param-value id=the-param-element:dom-param-value>value</a>;
- // <a href="#HTMLParamElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-param-element:the-param-element><a href=#the-param-element>param</a></code> element defines parameters for plugins invoked by <code id=the-param-element:the-object-element-2><a href=#the-object-element>object</a></code>
- elements. It does not <a href=#represents id=the-param-element:represents>represent</a> anything on its own.</p>
- <p>The <dfn id=attr-param-name><code>name</code></dfn> attribute gives the name of the
- parameter.</p>
- <p>The <dfn id=attr-param-value><code>value</code></dfn> attribute gives the value of the
- parameter.</p>
- <p>Both attributes must be present. They may have any value.</p>
-
- <p>If both attributes are present, and if the parent element of the <code id=the-param-element:the-param-element-2><a href=#the-param-element>param</a></code> is an
- <code id=the-param-element:the-object-element-3><a href=#the-object-element>object</a></code> element, then the element defines a <dfn id=concept-param-parameter>parameter</dfn> with the given name-value pair.</p>
- <p>If either the name or value of a <a href=#concept-param-parameter id=the-param-element:concept-param-parameter>parameter</a> defined
- by a <code id=the-param-element:the-param-element-3><a href=#the-param-element>param</a></code> element that is the child of an <code id=the-param-element:the-object-element-4><a href=#the-object-element>object</a></code> element that
- <a href=#represents id=the-param-element:represents-2>represents</a> an instantiated <a href=#plugin id=the-param-element:plugin>plugin</a> changes, and if that
- <a href=#plugin id=the-param-element:plugin-2>plugin</a> is communicating with the user agent using an API that features the ability to
- update the <a href=#plugin id=the-param-element:plugin-3>plugin</a> when the name or value of a <a href=#concept-param-parameter id=the-param-element:concept-param-parameter-2>parameter</a> so changes, then the user agent must
- appropriately exercise that ability to notify the <a href=#plugin id=the-param-element:plugin-4>plugin</a> of the change.</p>
- <p>The IDL attributes <dfn id=dom-param-name><code>name</code></dfn> and <dfn id=dom-param-value><code>value</code></dfn> must both <a href=#reflect id=the-param-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
-
- <div class=example>
- <p>The following example shows how the <code id=the-param-element:the-param-element-4><a href=#the-param-element>param</a></code> element can be used to pass a parameter
- to a plugin, in this case the O3D plugin.</p>
- <pre><!DOCTYPE HTML>
- <html lang="en">
- <head>
- <title>O3D Utah Teapot</title>
- </head>
- <body>
- <p>
- <object type="application/vnd.o3d.auto">
- <strong><param name="o3d_features" value="FloatingPointTextures"></strong>
- <img src="o3d-teapot.png"
- title="3D Utah Teapot illustration rendered using O3D."
- alt="When O3D renders the Utah Teapot, it appears as a squat
- teapot with a shiny metallic finish on which the
- surroundings are reflected, with a faint shadow caused by
- the lighting.">
- <p>To see the teapot actually rendered by O3D on your
- computer, please download and install the <a
- href="http://code.google.com/apis/o3d/docs/gettingstarted.html#install">O3D plugin</a>.</p>
- </object>
- <script src="o3d-teapot.js"></script>
- </p>
- </body>
- </html></pre>
- </div>
- <h4 id=the-video-element>4.8.10 The <dfn id=video><code>video</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-video-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-video-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-video-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-video-element:embedded-content-category>Embedded content</a>.<dd>If the element has a <code id=the-video-element:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content-2 id=the-video-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-video-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-video-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-video-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-video-element:concept-element-content-model>Content model</a>:<dd>If the element has a <code id=the-video-element:attr-media-src><a href=#attr-media-src>src</a></code> attribute:
- zero or more <code id=the-video-element:the-track-element><a href=#the-track-element>track</a></code> elements, then
- <a href=#transparent id=the-video-element:transparent>transparent</a>, but with no <a href=#media-element id=the-video-element:media-element>media element</a> descendants.<dd>If the element does not have a <code id=the-video-element:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute: zero or more <code id=the-video-element:the-source-element><a href=#the-source-element>source</a></code> elements, then
- zero or more <code id=the-video-element:the-track-element-2><a href=#the-track-element>track</a></code> elements, then
- <a href=#transparent id=the-video-element:transparent-2>transparent</a>, but with no <a href=#media-element id=the-video-element:media-element-2>media element</a> descendants.<dt><a href=#concept-element-tag-omission id=the-video-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-video-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-video-element:global-attributes>Global attributes</a><dd><code id=the-video-element:attr-media-src-3><a href=#attr-media-src>src</a></code> — Address of the resource<dd><code id=the-video-element:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> — How the element handles crossorigin requests<dd><code id=the-video-element:attr-video-poster><a href=#attr-video-poster>poster</a></code> — Poster frame to show prior to video playback<dd><code id=the-video-element:attr-media-preload><a href=#attr-media-preload>preload</a></code> — Hints how much buffering the <a href=#media-resource id=the-video-element:media-resource>media resource</a> will likely need<dd><code id=the-video-element:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> — Hint that the <a href=#media-resource id=the-video-element:media-resource-2>media resource</a> can be started automatically when the page is loaded<dd><code id=the-video-element:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> — Groups <a href=#media-element id=the-video-element:media-element-3>media elements</a> together with an implicit <code id=the-video-element:mediacontroller><a href=#mediacontroller>MediaController</a></code><dd><code id=the-video-element:attr-media-loop><a href=#attr-media-loop>loop</a></code> — Whether to loop the <a href=#media-resource id=the-video-element:media-resource-3>media resource</a><dd><code id=the-video-element:attr-media-muted><a href=#attr-media-muted>muted</a></code> — Whether to mute the <a href=#media-resource id=the-video-element:media-resource-4>media resource</a> by default<dd><code id=the-video-element:attr-media-controls-2><a href=#attr-media-controls>controls</a></code> — Show user agent controls<dd><code id=the-video-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd><code id=the-video-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dt><a href=#concept-element-dom id=the-video-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlvideoelement>HTMLVideoElement</dfn> : <a href=#htmlmediaelement id=the-video-element:htmlmediaelement>HTMLMediaElement</a> {
- attribute unsigned long <a href=#dom-dim-width id=the-video-element:dom-dim-width>width</a>;
- attribute unsigned long <a href=#dom-dim-height id=the-video-element:dom-dim-height>height</a>;
- readonly attribute unsigned long <a href=#dom-video-videowidth id=the-video-element:dom-video-videowidth>videoWidth</a>;
- readonly attribute unsigned long <a href=#dom-video-videoheight id=the-video-element:dom-video-videoheight>videoHeight</a>;
- attribute DOMString <a href=#dom-video-poster id=the-video-element:dom-video-poster>poster</a>;
- };</pre>
- </dl>
- <p>A <code id=the-video-element:the-video-element><a href=#the-video-element>video</a></code> element is used for playing videos or movies, and audio files with
- captions.</p>
- <p>Content may be provided inside the <code id=the-video-element:the-video-element-2><a href=#the-video-element>video</a></code> element. User agents
- should not show this content to the user; it is intended for older Web browsers which do
- not support <code id=the-video-element:the-video-element-3><a href=#the-video-element>video</a></code>, so that legacy video plugins can be tried, or to show text to the
- users of these older browsers informing them of how to access the video contents.</p>
- <p class=note>In particular, this content is not intended to address accessibility concerns. To
- make video content accessible to the partially sighted, the blind, the hard-of-hearing, the deaf,
- and those with other physical or cognitive disabilities, a variety of features are available.
- Captions can be provided, either embedded in the video stream or as external files using the
- <code id=the-video-element:the-track-element-3><a href=#the-track-element>track</a></code> element. Sign-language tracks can be provided, again either embedded in the
- video stream or by synchronizing multiple <code id=the-video-element:the-video-element-4><a href=#the-video-element>video</a></code> elements using the <code id=the-video-element:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code> attribute or a <code id=the-video-element:mediacontroller-2><a href=#mediacontroller>MediaController</a></code>
- object. Audio descriptions can be provided, either as a separate track embedded in the video
- stream, or a separate audio track in an <code id=the-video-element:the-audio-element><a href=#the-audio-element>audio</a></code> element <a href=#slaved-media-elements id=the-video-element:slaved-media-elements>slaved</a> to the same controller as the <code id=the-video-element:the-video-element-5><a href=#the-video-element>video</a></code> element(s), or in text
- form using a <a href=#webvtt-file id=the-video-element:webvtt-file>WebVTT file</a> referenced using the <code id=the-video-element:the-track-element-4><a href=#the-track-element>track</a></code> element and
- synthesized into speech by the user agent. WebVTT can also be used to provide chapter titles. For
- users who would rather not use a media element at all, transcripts or other textual alternatives
- can be provided by simply linking to them in the prose near the <code id=the-video-element:the-video-element-6><a href=#the-video-element>video</a></code> element. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>The <code id=the-video-element:the-video-element-7><a href=#the-video-element>video</a></code> element is a <a href=#media-element id=the-video-element:media-element-4>media element</a> whose <a href=#media-data id=the-video-element:media-data>media data</a> is
- ostensibly video data, possibly with associated audio data.</p>
- <p>The <code id=the-video-element:attr-media-src-4><a href=#attr-media-src>src</a></code>, <code id=the-video-element:attr-media-preload-2><a href=#attr-media-preload>preload</a></code>,
- <code id=the-video-element:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code>, <code id=the-video-element:attr-media-mediagroup-3><a href=#attr-media-mediagroup>mediagroup</a></code>, <code id=the-video-element:attr-media-loop-2><a href=#attr-media-loop>loop</a></code>, <code id=the-video-element:attr-media-muted-2><a href=#attr-media-muted>muted</a></code>, and <code id=the-video-element:attr-media-controls-3><a href=#attr-media-controls>controls</a></code>
- attributes are <a href=#media-element-attributes id=the-video-element:media-element-attributes>the attributes common to all media
- elements</a>.</p>
- <p>The <dfn id=attr-video-poster><code>poster</code></dfn> attribute gives the address of an
- image file that the user agent can show while no video data is available. The attribute, if
- present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-video-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>.</p>
-
- <p>If the specified resource is to be used, then, when the element is created or when the <code id=the-video-element:attr-video-poster-2><a href=#attr-video-poster>poster</a></code> attribute is set, changed, or removed, the user agent must
- run the following steps to determine the element's <dfn id=poster-frame>poster frame</dfn> (regardless of the
- value of the element's <a href=#show-poster-flag id=the-video-element:show-poster-flag>show poster flag</a>):</p>
- <ol><li><p>If there is an existing instance of this algorithm running for this <code id=the-video-element:the-video-element-8><a href=#the-video-element>video</a></code>
- element, abort that instance of this algorithm without changing the <a href=#poster-frame id=the-video-element:poster-frame>poster
- frame</a>.<li><p>If the <code id=the-video-element:attr-video-poster-3><a href=#attr-video-poster>poster</a></code> attribute's value is the empty string
- or if the attribute is absent, then there is no <a href=#poster-frame id=the-video-element:poster-frame-2>poster frame</a>; abort these
- steps.<li><p><a href=#resolve-a-url id=the-video-element:resolve-a-url>Resolve</a> the <code id=the-video-element:attr-video-poster-4><a href=#attr-video-poster>poster</a></code> attribute's value relative to the element. If this fails,
- then there is no <a href=#poster-frame id=the-video-element:poster-frame-3>poster frame</a>; abort these steps.<li><p><a href=#fetch id=the-video-element:fetch>Fetch</a> the resulting <a href=#absolute-url id=the-video-element:absolute-url>absolute URL</a>, from the element's
- <a id=the-video-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#origin-2 id=the-video-element:origin-2>origin</a>. This must <a href=#delay-the-load-event id=the-video-element:delay-the-load-event>delay the load event</a> of the
- element's <a id=the-video-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.<li><p>If an image is thus obtained, the <a href=#poster-frame id=the-video-element:poster-frame-4>poster frame</a> is that image. Otherwise,
- there is no <a href=#poster-frame id=the-video-element:poster-frame-5>poster frame</a>.</ol>
-
- <p class=note>The image given by the <code id=the-video-element:attr-video-poster-5><a href=#attr-video-poster>poster</a></code> attribute,
- the <i id=the-video-element:poster-frame-6><a href=#poster-frame>poster frame</a></i>, is intended to be a representative frame of the
- video (typically one of the first non-blank frames) that gives the user an idea of what the video
- is like.</p>
-
- <hr>
- <p>A <code id=the-video-element:the-video-element-9><a href=#the-video-element>video</a></code> element represents what is given for the first matching condition in the
- list below:</p>
- <dl class=switch><dt>When no video data is available (the element's <code id=the-video-element:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> attribute is either <code id=the-video-element:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, or <code id=the-video-element:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> but no video data has yet been obtained at
- all, or the element's <code id=the-video-element:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute is any
- subsequent value but the <a href=#media-resource id=the-video-element:media-resource-5>media resource</a> does not have a video channel)<dd>The <code id=the-video-element:the-video-element-10><a href=#the-video-element>video</a></code> element <a href=#represents id=the-video-element:represents>represents</a> its <a href=#poster-frame id=the-video-element:poster-frame-7>poster frame</a>, if any,
- or else transparent black with no intrinsic dimensions.<dt>When the <code id=the-video-element:the-video-element-11><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused id=the-video-element:dom-media-paused>paused</a>, the <a href=#current-playback-position id=the-video-element:current-playback-position>current playback position</a> is the first frame of video,
- and the element's <a href=#show-poster-flag id=the-video-element:show-poster-flag-2>show poster flag</a> is set<dd>The <code id=the-video-element:the-video-element-12><a href=#the-video-element>video</a></code> element <a href=#represents id=the-video-element:represents-2>represents</a> its <a href=#poster-frame id=the-video-element:poster-frame-8>poster frame</a>, if any,
- or else the first frame of the video.<dt>When the <code id=the-video-element:the-video-element-13><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused id=the-video-element:dom-media-paused-2>paused</a>, and the
- frame of video corresponding to the <a href=#current-playback-position id=the-video-element:current-playback-position-2>current playback
- position</a> is not available (e.g. because the video is seeking or buffering)<dt>When the <code id=the-video-element:the-video-element-14><a href=#the-video-element>video</a></code> element is neither <a href=#potentially-playing id=the-video-element:potentially-playing>potentially playing</a> nor <a href=#dom-media-paused id=the-video-element:dom-media-paused-3>paused</a> (e.g. when seeking or stalled)<dd>The <code id=the-video-element:the-video-element-15><a href=#the-video-element>video</a></code> element <a href=#represents id=the-video-element:represents-3>represents</a> the last frame of the video to have
- been rendered.<dt>When the <code id=the-video-element:the-video-element-16><a href=#the-video-element>video</a></code> element is <a href=#dom-media-paused id=the-video-element:dom-media-paused-4>paused</a><dd>The <code id=the-video-element:the-video-element-17><a href=#the-video-element>video</a></code> element <a href=#represents id=the-video-element:represents-4>represents</a> the frame of video corresponding to
- the <a href=#current-playback-position id=the-video-element:current-playback-position-3>current playback position</a>.<dt>Otherwise (the <code id=the-video-element:the-video-element-18><a href=#the-video-element>video</a></code> element has a video channel and is <a href=#potentially-playing id=the-video-element:potentially-playing-2>potentially
- playing</a>)<dd>The <code id=the-video-element:the-video-element-19><a href=#the-video-element>video</a></code> element <a href=#represents id=the-video-element:represents-5>represents</a> the frame of video at the continuously
- increasing <a href=#current-playback-position id=the-video-element:current-playback-position-4>"current" position</a>. When the
- <a href=#current-playback-position id=the-video-element:current-playback-position-5>current playback position</a> changes such that the last frame rendered is no longer the
- frame corresponding to the <a href=#current-playback-position id=the-video-element:current-playback-position-6>current playback position</a> in the video, the new frame
- must be rendered.</dl>
- <p>Frames of video must be obtained from the video track that was <a href=#dom-videotrack-selected id=the-video-element:dom-videotrack-selected>selected</a> when the <a href=#event-loop id=the-video-element:event-loop>event loop</a> last reached
- step 1.</p>
- <p class=note>Which frame in a video stream corresponds to a particular playback position is
- defined by the video stream's format.</p>
- <p>The <code id=the-video-element:the-video-element-20><a href=#the-video-element>video</a></code> element also <a href=#represents id=the-video-element:represents-6>represents</a> any <a href=#text-track-cue id=the-video-element:text-track-cue>text track cues</a> whose <a href=#text-track-cue-active-flag id=the-video-element:text-track-cue-active-flag>text track cue active flag</a> is set and whose
- <a href=#text-track id=the-video-element:text-track>text track</a> is in the <a href=#text-track-showing id=the-video-element:text-track-showing>showing</a> mode, and any
- audio from the <a href=#media-resource id=the-video-element:media-resource-6>media resource</a>, at the <a href=#current-playback-position id=the-video-element:current-playback-position-7>current playback position</a>.</p>
- <p>Any audio associated with the <a href=#media-resource id=the-video-element:media-resource-7>media resource</a> must, if played, be played
- synchronised with the <a href=#current-playback-position id=the-video-element:current-playback-position-8>current playback position</a>, at the element's <a href=#effective-media-volume id=the-video-element:effective-media-volume>effective
- media volume</a>. The user agent must play the audio from audio tracks that were <a href=#dom-audiotrack-enabled id=the-video-element:dom-audiotrack-enabled>enabled</a> when the <a href=#event-loop id=the-video-element:event-loop-2>event loop</a> last reached step
- 1.</p>
- <p>In addition to the above, the user agent may provide messages to the user (such as "buffering",
- "no video loaded", "error", or more detailed information) by overlaying text or icons on the video
- or other areas of the element's playback area, or in another appropriate manner.</p>
- <p>User agents that cannot render the video may instead make the element <a href=#represents id=the-video-element:represents-7>represent</a> a link to an external video playback utility or to the video
- data itself.</p>
- <p>When a <code id=the-video-element:the-video-element-21><a href=#the-video-element>video</a></code> element's <a href=#media-resource id=the-video-element:media-resource-8>media resource</a> has a video channel, the
- element <a href=#provides-a-paint-source id=the-video-element:provides-a-paint-source>provides a paint source</a> whose width is the <a href=#media-resource id=the-video-element:media-resource-9>media resource</a>'s
- <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width>intrinsic width</a>, whose height is the
- <a href=#media-resource id=the-video-element:media-resource-10>media resource</a>'s <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height>intrinsic
- height</a>, and whose appearance is the frame of video corresponding to the <a href=#current-playback-position id=the-video-element:current-playback-position-9>current playback position</a>, if that is available, or else
- (e.g. when the video is seeking or buffering) its previous appearance, if any, or else (e.g.
- because the video is still loading the first frame) blackness.</p>
- <hr>
-
- <dl class=domintro><dt><var>video</var> . <code id=the-video-element:dom-video-videowidth-2><a href=#dom-video-videowidth>videoWidth</a></code><dt><var>video</var> . <code id=the-video-element:dom-video-videoheight-2><a href=#dom-video-videoheight>videoHeight</a></code><dd>
- <p>These attributes return the intrinsic dimensions of the video,
- or zero if the dimensions are not known.</p>
- </dl>
-
- <p>The <dfn id=concept-video-intrinsic-width>intrinsic width</dfn> and <dfn id=concept-video-intrinsic-height>intrinsic height</dfn> of the <a href=#media-resource id=the-video-element:media-resource-11>media resource</a>
- are the dimensions of the resource in CSS pixels after taking into account the resource's
- dimensions, aspect ratio, clean aperture, resolution, and so forth, as defined for the format used
- by the resource. If an anamorphic format does not define how to apply the aspect ratio to the
- video data's dimensions to obtain the "correct" dimensions, then the user agent must apply the
- ratio by increasing one dimension and leaving the other unchanged.</p>
- <p>The <dfn id=dom-video-videowidth><code>videoWidth</code></dfn> IDL attribute must return
- the <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width-2>intrinsic width</a> of the video in CSS pixels.
- The <dfn id=dom-video-videoheight><code>videoHeight</code></dfn> IDL attribute must return
- the <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height-2>intrinsic height</a> of the video in CSS
- pixels. If the element's <code id=the-video-element:dom-media-readystate-3><a href=#dom-media-readystate>readyState</a></code> attribute is <code id=the-video-element:dom-media-have_nothing-2><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then the attributes must return 0.</p>
- <p id=dimUpdate>Whenever the <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width-3>intrinsic width</a>
- or <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height-3>intrinsic height</a> of the video changes
- (including, for example, because the <a href=#dom-videotrack-selected id=the-video-element:dom-videotrack-selected-2>selected video
- track</a> was changed), if the element's <code id=the-video-element:dom-media-readystate-4><a href=#dom-media-readystate>readyState</a></code>
- attribute is not <code id=the-video-element:dom-media-have_nothing-3><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, the user agent must
- <a href=#queue-a-task id=the-video-element:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=the-video-element:fire-a-simple-event>fire a simple event</a> named <code id=the-video-element:event-media-resize><a href=#event-media-resize>resize</a></code> at the <a href=#media-element id=the-video-element:media-element-5>media element</a>.</p>
-
- <p>The <code id=the-video-element:the-video-element-22><a href=#the-video-element>video</a></code> element supports <a href=#dimension-attributes id=the-video-element:dimension-attributes>dimension attributes</a>.</p>
-
- <p>In the absence of style rules to the contrary, video content should be rendered inside the
- element's playback area such that the video content is shown centered in the playback area at the
- largest possible size that fits completely within it, with the video content's aspect ratio being
- preserved. Thus, if the aspect ratio of the playback area does not match the aspect ratio of the
- video, the video will be shown letterboxed or pillarboxed. Areas of the element's playback area
- that do not contain the video represent nothing.</p>
- <p class=note>In user agents that implement CSS, the above requirement can be implemented by
- using the <a href=#video-object-fit>style rule suggested in the rendering section</a>.</p>
- <p>The intrinsic width of a <code id=the-video-element:the-video-element-23><a href=#the-video-element>video</a></code> element's playback area is the intrinsic width of
- the <a href=#poster-frame id=the-video-element:poster-frame-9>poster frame</a>, if that is available and the element currently
- <a href=#represents id=the-video-element:represents-8>represents</a> its poster frame; otherwise, it is the <a href=#concept-video-intrinsic-width id=the-video-element:concept-video-intrinsic-width-4>intrinsic width</a> of the video resource, if that is
- available; otherwise the intrinsic width is missing.</p>
- <p>The intrinsic height of a <code id=the-video-element:the-video-element-24><a href=#the-video-element>video</a></code> element's playback area is the intrinsic height of
- the <a href=#poster-frame id=the-video-element:poster-frame-10>poster frame</a>, if that is available and the element currently
- <a href=#represents id=the-video-element:represents-9>represents</a> its poster frame; otherwise it is the <a href=#concept-video-intrinsic-height id=the-video-element:concept-video-intrinsic-height-4>intrinsic height</a> of the video resource, if that is
- available; otherwise the intrinsic height is missing.</p>
- <p>The <a href=#default-object-size id=the-video-element:default-object-size>default object size</a> is a width of 300 CSS pixels and a height of 150 CSS
- pixels. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <hr>
- <p>User agents should provide controls to enable or disable the display of closed captions, audio
- description tracks, and other additional data associated with the video stream, though such
- features should, again, not interfere with the page's normal rendering.</p>
- <p>User agents may allow users to view the video content in manners more suitable to the user
- (e.g. full-screen or in an independent resizable window). As for the other user interface
- features, controls to enable this should not interfere with the page's normal rendering unless the
- user agent is <a href=#expose-a-user-interface-to-the-user id=the-video-element:expose-a-user-interface-to-the-user>exposing a user interface</a>.
- In such an independent context, however, user agents may make full user interfaces visible, with,
- e.g., play, pause, seeking, and volume controls, even if the <code id=the-video-element:attr-media-controls-4><a href=#attr-media-controls>controls</a></code> attribute is absent.</p>
- <p>User agents may allow video playback to affect system features that could interfere with the
- user's experience; for example, user agents could disable screensavers while video playback is in
- progress.</p>
- <hr>
- <p>The <dfn id=dom-video-poster><code>poster</code></dfn> IDL attribute must
- <a href=#reflect id=the-video-element:reflect>reflect</a> the <code id=the-video-element:attr-video-poster-6><a href=#attr-video-poster>poster</a></code> content attribute.</p>
-
- <div class=example>
- <p>This example shows how to detect when a video has failed to play correctly:</p>
- <pre><script>
- function failed(e) {
- // video playback failed - show a message saying why
- switch (e.target.error.code) {
- case e.target.error.MEDIA_ERR_ABORTED:
- alert('You aborted the video playback.');
- break;
- case e.target.error.MEDIA_ERR_NETWORK:
- alert('A network error caused the video download to fail part-way.');
- break;
- case e.target.error.MEDIA_ERR_DECODE:
- alert('The video playback was aborted due to a corruption problem or because the video used features your browser did not support.');
- break;
- case e.target.error.MEDIA_ERR_SRC_NOT_SUPPORTED:
- alert('The video could not be loaded, either because the server or network failed or because the format is not supported.');
- break;
- default:
- alert('An unknown error occurred.');
- break;
- }
- }
- </script>
- <p><video src="tgif.vid" autoplay controls onerror="failed(event)"></video></p>
- <p><a href="tgif.vid">Download the video file</a>.</p></pre>
- </div>
-
- <h4 id=the-audio-element>4.8.11 The <dfn id=audio><code>audio</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-audio-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-audio-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-audio-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-audio-element:embedded-content-category>Embedded content</a>.<dd>If the element has a <code id=the-audio-element:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute: <a href=#interactive-content-2 id=the-audio-element:interactive-content-2>Interactive content</a>.<dd>If the element has a <code id=the-audio-element:attr-media-controls-2><a href=#attr-media-controls>controls</a></code> attribute: <a href=#palpable-content-2 id=the-audio-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-audio-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-audio-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-audio-element:concept-element-content-model>Content model</a>:<dd>If the element has a <code id=the-audio-element:attr-media-src><a href=#attr-media-src>src</a></code> attribute:
- zero or more <code id=the-audio-element:the-track-element><a href=#the-track-element>track</a></code> elements, then
- <a href=#transparent id=the-audio-element:transparent>transparent</a>, but with no <a href=#media-element id=the-audio-element:media-element>media element</a> descendants.<dd>If the element does not have a <code id=the-audio-element:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute: zero or more <code id=the-audio-element:the-source-element><a href=#the-source-element>source</a></code> elements, then
- zero or more <code id=the-audio-element:the-track-element-2><a href=#the-track-element>track</a></code> elements, then
- <a href=#transparent id=the-audio-element:transparent-2>transparent</a>, but with no <a href=#media-element id=the-audio-element:media-element-2>media element</a> descendants.<dt><a href=#concept-element-tag-omission id=the-audio-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-audio-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-audio-element:global-attributes>Global attributes</a><dd><code id=the-audio-element:attr-media-src-3><a href=#attr-media-src>src</a></code> — Address of the resource<dd><code id=the-audio-element:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> — How the element handles crossorigin requests<dd><code id=the-audio-element:attr-media-preload><a href=#attr-media-preload>preload</a></code> — Hints how much buffering the <a href=#media-resource id=the-audio-element:media-resource>media resource</a> will likely need<dd><code id=the-audio-element:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> — Hint that the <a href=#media-resource id=the-audio-element:media-resource-2>media resource</a> can be started automatically when the page is loaded<dd><code id=the-audio-element:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> — Groups <a href=#media-element id=the-audio-element:media-element-3>media elements</a> together with an implicit <code id=the-audio-element:mediacontroller><a href=#mediacontroller>MediaController</a></code><dd><code id=the-audio-element:attr-media-loop><a href=#attr-media-loop>loop</a></code> — Whether to loop the <a href=#media-resource id=the-audio-element:media-resource-3>media resource</a><dd><code id=the-audio-element:attr-media-muted><a href=#attr-media-muted>muted</a></code> — Whether to mute the <a href=#media-resource id=the-audio-element:media-resource-4>media resource</a> by default<dd><code id=the-audio-element:attr-media-controls-3><a href=#attr-media-controls>controls</a></code> — Show user agent controls<dt><a href=#concept-element-dom id=the-audio-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>[NamedConstructor=<a href=#dom-audio id=the-audio-element:dom-audio>Audio</a>(optional DOMString src)]
- interface <dfn id=htmlaudioelement>HTMLAudioElement</dfn> : <a href=#htmlmediaelement id=the-audio-element:htmlmediaelement>HTMLMediaElement</a> {};</pre>
- </dl>
- <p>An <code id=the-audio-element:the-audio-element><a href=#the-audio-element>audio</a></code> element <a href=#represents id=the-audio-element:represents>represents</a> a sound or audio stream.</p>
-
- <p>Content may be provided inside the <code id=the-audio-element:the-audio-element-2><a href=#the-audio-element>audio</a></code> element. User agents
- should not show this content to the user; it is intended for older Web browsers which do
- not support <code id=the-audio-element:the-audio-element-3><a href=#the-audio-element>audio</a></code>, so that legacy audio plugins can be tried, or to show text to the
- users of these older browsers informing them of how to access the audio contents.</p>
- <p class=note>In particular, this content is not intended to address accessibility concerns. To
- make audio content accessible to the deaf or to those with other physical or cognitive
- disabilities, a variety of features are available. If captions or a sign language video are
- available, the <code id=the-audio-element:the-video-element><a href=#the-video-element>video</a></code> element can be used instead of the <code id=the-audio-element:the-audio-element-4><a href=#the-audio-element>audio</a></code> element to
- play the audio, allowing users to enable the visual alternatives. Chapter titles can be provided
- to aid navigation, using the <code id=the-audio-element:the-track-element-3><a href=#the-track-element>track</a></code> element and a <a href=#webvtt-file id=the-audio-element:webvtt-file>WebVTT file</a>. And,
- naturally, transcripts or other textual alternatives can be provided by simply linking to them in
- the prose near the <code id=the-audio-element:the-audio-element-5><a href=#the-audio-element>audio</a></code> element. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>The <code id=the-audio-element:the-audio-element-6><a href=#the-audio-element>audio</a></code> element is a <a href=#media-element id=the-audio-element:media-element-4>media element</a> whose <a href=#media-data id=the-audio-element:media-data>media data</a> is
- ostensibly audio data.</p>
- <p>The <code id=the-audio-element:attr-media-src-4><a href=#attr-media-src>src</a></code>, <code id=the-audio-element:attr-media-preload-2><a href=#attr-media-preload>preload</a></code>,
- <code id=the-audio-element:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code>, <code id=the-audio-element:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code>, <code id=the-audio-element:attr-media-loop-2><a href=#attr-media-loop>loop</a></code>, <code id=the-audio-element:attr-media-muted-2><a href=#attr-media-muted>muted</a></code>, and <code id=the-audio-element:attr-media-controls-4><a href=#attr-media-controls>controls</a></code>
- attributes are <a href=#media-element-attributes id=the-audio-element:media-element-attributes>the attributes common to all media
- elements</a>.</p>
-
- <p>When an <code id=the-audio-element:the-audio-element-7><a href=#the-audio-element>audio</a></code> element is <a href=#potentially-playing id=the-audio-element:potentially-playing>potentially playing</a>, it must have its audio
- data played synchronised with the <a href=#current-playback-position id=the-audio-element:current-playback-position>current playback position</a>, at the element's
- <a href=#effective-media-volume id=the-audio-element:effective-media-volume>effective media volume</a>. The user agent must play the audio from audio tracks that
- were enabled when the <a href=#event-loop id=the-audio-element:event-loop>event loop</a> last reached step 1.</p>
- <p>When an <code id=the-audio-element:the-audio-element-8><a href=#the-audio-element>audio</a></code> element is not <a href=#potentially-playing id=the-audio-element:potentially-playing-2>potentially playing</a>, audio must not play
- for the element.</p>
-
- <dl class=domintro><dt><var>audio</var> = new <code id=the-audio-element:dom-audio-2><a href=#dom-audio>Audio</a></code>( [ <var>url</var> ] )<dd>
- <p>Returns a new <code id=the-audio-element:the-audio-element-9><a href=#the-audio-element>audio</a></code> element, with the <code id=the-audio-element:attr-media-src-5><a href=#attr-media-src>src</a></code>
- attribute set to the value passed in the argument, if applicable.</p>
- </dl>
-
- <p>A constructor is provided for creating <code id=the-audio-element:htmlaudioelement><a href=#htmlaudioelement>HTMLAudioElement</a></code> objects (in addition to
- the factory methods from DOM such as <code>createElement()</code>): <dfn id=dom-audio><code>Audio(<var>src</var>)</code></dfn>. When invoked as a
- constructor, it must return a new <code id=the-audio-element:htmlaudioelement-2><a href=#htmlaudioelement>HTMLAudioElement</a></code> object (a new <code id=the-audio-element:the-audio-element-10><a href=#the-audio-element>audio</a></code>
- element). The element must be created with its <code id=the-audio-element:attr-media-preload-3><a href=#attr-media-preload>preload</a></code>
- attribute set to the literal value "<code id=the-audio-element:attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>". If the
- <var>src</var> argument is present, the object created must be created with its <code id=the-audio-element:attr-media-src-6><a href=#attr-media-src>src</a></code> content attribute set to the provided value (this will <a href=#concept-media-load-algorithm-at-creation>cause the user agent to invoke</a> the object's
- <a href=#concept-media-load-algorithm id=the-audio-element:concept-media-load-algorithm>resource selection algorithm</a> before returning).
- The element's <a id=the-audio-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> must be the <a href=#active-document id=the-audio-element:active-document>active document</a> of the <a href=#browsing-context id=the-audio-element:browsing-context>browsing
- context</a> of the <code id=the-audio-element:window><a href=#window>Window</a></code> object on which the interface object of the invoked
- constructor is found.</p>
-
-
- <h4 id=the-source-element>4.8.12 The <dfn><code>source</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-source-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-source-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <a href=#media-element id=the-source-element:media-element>media element</a>, before any <a href=#flow-content-2 id=the-source-element:flow-content-2>flow content</a>
- or <code id=the-source-element:the-track-element><a href=#the-track-element>track</a></code> elements.<dt><a href=#concept-element-content-model id=the-source-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-source-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-source-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-source-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-source-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-source-element:global-attributes>Global attributes</a><dd><code id=the-source-element:attr-source-src><a href=#attr-source-src>src</a></code> — Address of the resource<dd><code id=the-source-element:attr-source-type><a href=#attr-source-type>type</a></code> — Type of embedded resource<dt><a href=#concept-element-dom id=the-source-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlsourceelement>HTMLSourceElement</dfn> : <a href=#htmlelement id=the-source-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-source-src id=the-source-element:dom-source-src>src</a>;
- attribute DOMString <a href=#dom-source-type id=the-source-element:dom-source-type>type</a>;
- // <a href="#the-source-element-when-used-with-the-picture-element:htmlsourceelement">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-source-element:the-source-element><a href=#the-source-element>source</a></code> element allows authors to specify multiple alternative <a href=#media-resource id=the-source-element:media-resource>media resources</a> for <a href=#media-element id=the-source-element:media-element-2>media
- elements</a>. It does not <a href=#represents id=the-source-element:represents>represent</a> anything on its own.</p>
- <p>The <dfn id=attr-source-src><code>src</code></dfn> attribute gives the address of the
- <a href=#media-resource id=the-source-element:media-resource-2>media resource</a>. The value must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-source-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded
- by spaces</a>. This attribute must be present.</p>
- <p class=note>Dynamically modifying a <code id=the-source-element:the-source-element-2><a href=#the-source-element>source</a></code> element and its attribute when the
- element is already inserted in a <code id=the-source-element:the-video-element><a href=#the-video-element>video</a></code> or <code id=the-source-element:the-audio-element><a href=#the-audio-element>audio</a></code> element will have no
- effect. To change what is playing, just use the <code id=the-source-element:attr-media-src><a href=#attr-media-src>src</a></code> attribute
- on the <a href=#media-element id=the-source-element:media-element-3>media element</a> directly, possibly making use of the <code id=the-source-element:dom-navigator-canplaytype><a href=#dom-navigator-canplaytype>canPlayType()</a></code> method to pick from amongst available
- resources. Generally, manipulating <code id=the-source-element:the-source-element-3><a href=#the-source-element>source</a></code> elements manually after the document has
- been parsed is an unnecessarily complicated approach.</p>
- <p>The <dfn id=attr-source-type><code>type</code></dfn> attribute gives the type of the
- <a href=#media-resource id=the-source-element:media-resource-3>media resource</a>, to help the user agent determine if it can play this <a href=#media-resource id=the-source-element:media-resource-4>media
- resource</a> before fetching it. If specified, its value must be a <a href=#valid-mime-type id=the-source-element:valid-mime-type>valid MIME
- type</a>. The <code>codecs</code> parameter, which certain MIME types define, might be
- necessary to specify exactly how the resource is encoded. <a href=#refsRFC4281>[RFC4281]</a></p>
- <div class=example>
- <p>The following list shows some examples of how to use the <code>codecs=</code> MIME
- parameter in the <code id=the-source-element:attr-source-type-2><a href=#attr-source-type>type</a></code> attribute.</p>
- <dl><dt>H.264 Constrained baseline profile video (main and extended video compatible) level 3 and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'></pre><dt>H.264 Extended profile video (baseline-compatible) level 3 and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="avc1.58A01E, mp4a.40.2"'></pre><dt>H.264 Main profile video level 3 and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'></pre><dt>H.264 'High' profile video (incompatible with main, baseline, or extended profiles) level 3 and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="avc1.64001E, mp4a.40.2"'></pre><dt>MPEG-4 Visual Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="mp4v.20.8, mp4a.40.2"'></pre><dt>MPEG-4 Advanced Simple Profile Level 0 video and Low-Complexity AAC audio in MP4 container<dd><pre><source src='video.mp4' type='video/mp4; codecs="mp4v.20.240, mp4a.40.2"'></pre><dt>MPEG-4 Visual Simple Profile Level 0 video and AMR audio in 3GPP container<dd><pre><source src='video.3gp' type='video/3gpp; codecs="mp4v.20.8, samr"'></pre><dt>Theora video and Vorbis audio in Ogg container<dd><pre><source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'></pre><dt>Theora video and Speex audio in Ogg container<dd><pre><source src='video.ogv' type='video/ogg; codecs="theora, speex"'></pre><dt>Vorbis audio alone in Ogg container<dd><pre><source src='audio.ogg' type='audio/ogg; codecs=vorbis'></pre><dt>Speex audio alone in Ogg container<dd><pre><source src='audio.spx' type='audio/ogg; codecs=speex'></pre><dt>FLAC audio alone in Ogg container<dd><pre><source src='audio.oga' type='audio/ogg; codecs=flac'></pre><dt>Dirac video and Vorbis audio in Ogg container<dd><pre><source src='video.ogv' type='video/ogg; codecs="dirac, vorbis"'></pre></dl>
- </div>
-
- <p>If a <code id=the-source-element:the-source-element-4><a href=#the-source-element>source</a></code> element is inserted as a child of a <a href=#media-element id=the-source-element:media-element-4>media element</a> that
- has no <code id=the-source-element:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute and whose <code id=the-source-element:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> has the value <code id=the-source-element:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, the user agent must invoke the <a href=#media-element id=the-source-element:media-element-5>media
- element</a>'s <a href=#concept-media-load-algorithm id=the-source-element:concept-media-load-algorithm>resource selection
- algorithm</a>.</p>
- <p>The IDL attributes <dfn id=dom-source-src><code>src</code></dfn> and <dfn id=dom-source-type><code>type</code></dfn> must <a href=#reflect id=the-source-element:reflect>reflect</a> the respective content
- attributes of the same name.</p>
-
- <div class=example>
- <p>If the author isn't sure if user agents will all be able to render the media resources
- provided, the author can listen to the <code id=the-source-element:event-error><a href=#event-error>error</a></code> event on the last
- <code id=the-source-element:the-source-element-5><a href=#the-source-element>source</a></code> element and trigger fallback behavior:</p>
- <pre><script>
- function fallback(video) {
- // replace <video> with its contents
- while (video.hasChildNodes()) {
- if (video.firstChild instanceof HTMLSourceElement)
- video.removeChild(video.firstChild);
- else
- video.parentNode.insertBefore(video.firstChild, video);
- }
- video.parentNode.removeChild(video);
- }
- </script>
- <video controls autoplay>
- <source src='video.mp4' type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"'>
- <source src='video.ogv' type='video/ogg; codecs="theora, vorbis"'
- onerror="fallback(parentNode)">
- ...
- </video></pre>
- </div>
- <h4 id=the-track-element>4.8.13 The <dfn><code>track</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-track-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-track-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <a href=#media-element id=the-track-element:media-element>media element</a>, before any <a href=#flow-content-2 id=the-track-element:flow-content-2>flow content</a>.<dt><a href=#concept-element-content-model id=the-track-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-track-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-track-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-track-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-track-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-track-element:global-attributes>Global attributes</a><dd><code id=the-track-element:attr-track-kind><a href=#attr-track-kind>kind</a></code> — The type of text track<dd><code id=the-track-element:attr-track-src><a href=#attr-track-src>src</a></code> — Address of the resource<dd><code id=the-track-element:attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> — Language of the text track<dd><code id=the-track-element:attr-track-label><a href=#attr-track-label>label</a></code> — User-visible label<dd><code id=the-track-element:attr-track-default><a href=#attr-track-default>default</a></code> — Enable the track if no other <a href=#text-track id=the-track-element:text-track>text track</a> is more suitable<dt><a href=#concept-element-dom id=the-track-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltrackelement>HTMLTrackElement</dfn> : <a href=#htmlelement id=the-track-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-track-kind id=the-track-element:dom-track-kind>kind</a>;
- attribute DOMString <a href=#dom-track-src id=the-track-element:dom-track-src>src</a>;
- attribute DOMString <a href=#dom-track-srclang id=the-track-element:dom-track-srclang>srclang</a>;
- attribute DOMString <a href=#dom-track-label id=the-track-element:dom-track-label>label</a>;
- attribute boolean <a href=#dom-track-default id=the-track-element:dom-track-default>default</a>;
- const unsigned short <a href=#dom-track-none id=the-track-element:dom-track-none>NONE</a> = 0;
- const unsigned short <a href=#dom-track-loading id=the-track-element:dom-track-loading>LOADING</a> = 1;
- const unsigned short <a href=#dom-track-loaded id=the-track-element:dom-track-loaded>LOADED</a> = 2;
- const unsigned short <a href=#dom-track-error id=the-track-element:dom-track-error>ERROR</a> = 3;
- readonly attribute unsigned short <a href=#dom-track-readystate id=the-track-element:dom-track-readystate>readyState</a>;
- readonly attribute <a href=#texttrack id=the-track-element:texttrack>TextTrack</a> <a href=#dom-track-track id=the-track-element:dom-track-track>track</a>;
- };</pre>
- </dl>
- <p>The <code id=the-track-element:the-track-element><a href=#the-track-element>track</a></code> element allows authors to specify explicit external timed <a href=#text-track id=the-track-element:text-track-2>text tracks</a> for <a href=#media-element id=the-track-element:media-element-2>media elements</a>. It
- does not <a href=#represents id=the-track-element:represents>represent</a> anything on its own.</p>
- <p>The <dfn id=attr-track-kind><code>kind</code></dfn> attribute is an <a href=#enumerated-attribute id=the-track-element:enumerated-attribute>enumerated
- attribute</a>. The following table lists the keywords defined for this attribute. The keyword
- given in the first cell of each row maps to the state given in the second cell.</p>
- <table><thead><tr><th>Keyword
- <th>State
- <th>Brief description
- <tbody><tr><td><dfn id=attr-track-kind-keyword-subtitles><code>subtitles</code></dfn>
- <td><dfn id=attr-track-kind-subtitles>Subtitles</dfn>
- <td>
- Transcription or translation of the dialogue, suitable for when the sound is available but not understood (e.g. because the user does not understand the language of the <a href=#media-resource id=the-track-element:media-resource>media resource</a>'s audio track).
- Overlaid on the video.
- <tr><td><dfn id=attr-track-kind-keyword-captions><code>captions</code></dfn>
- <td><dfn id=attr-track-kind-captions>Captions</dfn>
- <td>
- Transcription or translation of the dialogue, sound effects, relevant musical cues, and other relevant audio information, suitable for when sound is unavailable or not clearly audible (e.g. because it is muted, drowned-out by ambient noise, or because the user is deaf).
- Overlaid on the video; labeled as appropriate for the hard-of-hearing.
- <tr><td><dfn id=attr-track-kind-keyword-descriptions><code>descriptions</code></dfn>
- <td><dfn id=attr-track-kind-descriptions>Descriptions</dfn>
- <td>
- Textual descriptions of the video component of the <a href=#media-resource id=the-track-element:media-resource-2>media resource</a>, intended for audio synthesis when the visual component is obscured, unavailable, or not usable (e.g. because the user is interacting with the application without a screen while driving, or because the user is blind).
- Synthesized as audio.
- <tr><td><dfn id=attr-track-kind-keyword-chapters><code>chapters</code></dfn>
- <td><dfn id=attr-track-kind-chapters>Chapters</dfn>
- <td>
- Chapter titles, intended to be used for navigating the <a href=#media-resource id=the-track-element:media-resource-3>media resource</a>.
- Displayed as an interactive (potentially nested) list in the user agent's interface.
- <tr><td><dfn id=attr-track-kind-keyword-metadata><code>metadata</code></dfn>
- <td><dfn id=attr-track-kind-metadata>Metadata</dfn>
- <td>
- Tracks intended for use from script.
- Not displayed by the user agent.
- </table>
- <p>The attribute may be omitted. The <i id=the-track-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-track-kind-subtitles id=the-track-element:attr-track-kind-subtitles>subtitles</a> state.</p>
- <p>The <dfn id=attr-track-src><code>src</code></dfn> attribute gives the address of the text
- track data. The value must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-track-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>.
- This attribute must be present.</p>
-
- <p>If the element has a <code id=the-track-element:attr-track-src-2><a href=#attr-track-src>src</a></code> attribute whose value is not the
- empty string and whose value, when the attribute was set, could be successfully <a href=#resolve-a-url id=the-track-element:resolve-a-url>resolved</a> relative to the element, then the element's <dfn id=track-url>track
- URL</dfn> is the resulting <a href=#absolute-url id=the-track-element:absolute-url>absolute URL</a>. Otherwise, the element's <a href=#track-url id=the-track-element:track-url>track
- URL</a> is the empty string.</p>
-
- <p>If the element's <a href=#track-url id=the-track-element:track-url-2>track URL</a> identifies a WebVTT resource, and the element's <code id=the-track-element:attr-track-kind-2><a href=#attr-track-kind>kind</a></code> attribute is not in the <a href=#attr-track-kind-metadata id=the-track-element:attr-track-kind-metadata>metadata</a> state, then the WebVTT file must be a
- <a href=#webvtt-file-using-cue-text id=the-track-element:webvtt-file-using-cue-text>WebVTT file using cue text</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>Furthermore, if the element's <a href=#track-url id=the-track-element:track-url-3>track URL</a> identifies a WebVTT resource, and the
- element's <code id=the-track-element:attr-track-kind-3><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-chapters id=the-track-element:attr-track-kind-chapters>chapters</a> state, then the WebVTT file must be both a
- <a href=#webvtt-file-using-chapter-title-text id=the-track-element:webvtt-file-using-chapter-title-text>WebVTT file using chapter title text</a> and a <a href=#webvtt-file-using-only-nested-cues id=the-track-element:webvtt-file-using-only-nested-cues>WebVTT file using only nested
- cues</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>The <dfn id=attr-track-srclang><code>srclang</code></dfn> attribute gives the language of
- the text track data. The value must be a valid BCP 47 language tag. This attribute must be present
- if the element's <code id=the-track-element:attr-track-kind-4><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-subtitles id=the-track-element:attr-track-kind-subtitles-2>subtitles</a> state. <a href=#refsBCP47>[BCP47]</a></p>
-
- <p>If the element has a <code id=the-track-element:attr-track-srclang-2><a href=#attr-track-srclang>srclang</a></code> attribute whose value is
- not the empty string, then the element's <dfn id=track-language>track language</dfn> is the value of the attribute.
- Otherwise, the element has no <a href=#track-language id=the-track-element:track-language>track language</a>.</p>
-
- <p>The <dfn id=attr-track-label><code>label</code></dfn> attribute gives a user-readable
- title for the track. This title is used by user agents when listing <a href=#attr-track-kind-subtitles id=the-track-element:attr-track-kind-subtitles-3>subtitle</a>, <a href=#attr-track-kind-captions id=the-track-element:attr-track-kind-captions>caption</a>, and <a href=#attr-track-kind-descriptions id=the-track-element:attr-track-kind-descriptions>audio description</a> tracks in their user interface.</p>
- <p>The value of the <code id=the-track-element:attr-track-label-2><a href=#attr-track-label>label</a></code> attribute, if the attribute is
- present, must not be the empty string. Furthermore, there must not be two <code id=the-track-element:the-track-element-2><a href=#the-track-element>track</a></code>
- element children of the same <a href=#media-element id=the-track-element:media-element-3>media element</a> whose <code id=the-track-element:attr-track-kind-5><a href=#attr-track-kind>kind</a></code> attributes are in the same state, whose <code id=the-track-element:attr-track-srclang-3><a href=#attr-track-srclang>srclang</a></code> attributes are both missing or have values that
- represent the same language, and whose <code id=the-track-element:attr-track-label-3><a href=#attr-track-label>label</a></code> attributes are
- again both missing or both have the same value.</p>
-
- <p>If the element has a <code id=the-track-element:attr-track-label-4><a href=#attr-track-label>label</a></code> attribute whose value is not
- the empty string, then the element's <dfn id=track-label>track label</dfn> is the value of the attribute.
- Otherwise, the element's <a href=#track-label id=the-track-element:track-label>track label</a> is an empty string.</p>
-
- <p>The <dfn id=attr-track-default><code>default</code></dfn> attribute is a <a href=#boolean-attribute id=the-track-element:boolean-attribute>boolean
- attribute</a>, which, if specified, indicates that the track is to be enabled if the user's
- preferences do not indicate that another track would be more appropriate.</p>
- <p>Each <a href=#media-element id=the-track-element:media-element-4>media element</a> must have no more than one <code id=the-track-element:the-track-element-3><a href=#the-track-element>track</a></code> element child
- whose <code id=the-track-element:attr-track-kind-6><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-subtitles id=the-track-element:attr-track-kind-subtitles-4>subtitles</a> or <a href=#attr-track-kind-captions id=the-track-element:attr-track-kind-captions-2>captions</a> state and whose <code id=the-track-element:attr-track-default-2><a href=#attr-track-default>default</a></code> attribute is specified.</p>
- <p>Each <a href=#media-element id=the-track-element:media-element-5>media element</a> must have no more than one <code id=the-track-element:the-track-element-4><a href=#the-track-element>track</a></code> element child
- whose <code id=the-track-element:attr-track-kind-7><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-descriptions id=the-track-element:attr-track-kind-descriptions-2>description</a> state and whose <code id=the-track-element:attr-track-default-3><a href=#attr-track-default>default</a></code> attribute is specified.</p>
- <p>Each <a href=#media-element id=the-track-element:media-element-6>media element</a> must have no more than one <code id=the-track-element:the-track-element-5><a href=#the-track-element>track</a></code> element child
- whose <code id=the-track-element:attr-track-kind-8><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-chapters id=the-track-element:attr-track-kind-chapters-2>chapters</a> state and whose <code id=the-track-element:attr-track-default-4><a href=#attr-track-default>default</a></code> attribute is specified.</p>
- <p class=note>There is no limit on the number of <code id=the-track-element:the-track-element-6><a href=#the-track-element>track</a></code> elements whose <code id=the-track-element:attr-track-kind-9><a href=#attr-track-kind>kind</a></code> attribute is in the <a href=#attr-track-kind-metadata id=the-track-element:attr-track-kind-metadata-2>metadata</a> state and whose <code id=the-track-element:attr-track-default-5><a href=#attr-track-default>default</a></code> attribute is specified.</p>
- <dl class=domintro><dt><var>track</var> . <code id=the-track-element:dom-track-readystate-2><a href=#dom-track-readystate>readyState</a></code><dd>
- <p>Returns the <a href=#text-track-readiness-state id=the-track-element:text-track-readiness-state>text track readiness state</a>,
- represented by a number from the following list:</p>
- <dl><dt><var>track</var> . <code id=the-track-element:dom-track-none-2><a href=#dom-track-none>NONE</a></code> (0)<dd>
- <p>The <a href=#text-track-not-loaded id=the-track-element:text-track-not-loaded>text track not loaded</a> state.</p>
- <dt><var>track</var> . <code id=the-track-element:dom-track-loading-2><a href=#dom-track-loading>LOADING</a></code> (1)<dd>
- <p>The <a href=#text-track-loading id=the-track-element:text-track-loading>text track loading</a> state.</p>
- <dt><var>track</var> . <code id=the-track-element:dom-track-loaded-2><a href=#dom-track-loaded>LOADED</a></code> (2)<dd>
- <p>The <a href=#text-track-loaded id=the-track-element:text-track-loaded>text track loaded</a> state.</p>
- <dt><var>track</var> . <code id=the-track-element:dom-track-error-2><a href=#dom-track-error>ERROR</a></code> (3)<dd>
- <p>The <a href=#text-track-failed-to-load id=the-track-element:text-track-failed-to-load>text track failed to load</a> state.</p>
- </dl>
- <dt><var>track</var> . <code id=the-track-element:dom-track-track-2><a href=#dom-track-track>track</a></code><dd>
- <p>Returns the <code id=the-track-element:texttrack-2><a href=#texttrack>TextTrack</a></code> object corresponding to the <a href=#text-track id=the-track-element:text-track-3>text track</a> of the <code id=the-track-element:the-track-element-7><a href=#the-track-element>track</a></code> element.</p>
- </dl>
-
- <p>The <dfn id=dom-track-readystate><code>readyState</code></dfn> attribute must return the
- numeric value corresponding to the <a href=#text-track-readiness-state id=the-track-element:text-track-readiness-state-2>text track readiness state</a> of the
- <code id=the-track-element:the-track-element-8><a href=#the-track-element>track</a></code> element's <a href=#text-track id=the-track-element:text-track-4>text track</a>, as defined by the following list:</p>
- <dl><dt><dfn id=dom-track-none><code>NONE</code></dfn> (numeric value 0)<dd>The <a href=#text-track-not-loaded id=the-track-element:text-track-not-loaded-2>text track not loaded</a> state.<dt><dfn id=dom-track-loading><code>LOADING</code></dfn> (numeric value 1)<dd>The <a href=#text-track-loading id=the-track-element:text-track-loading-2>text track loading</a> state.<dt><dfn id=dom-track-loaded><code>LOADED</code></dfn> (numeric value 2)<dd>The <a href=#text-track-loaded id=the-track-element:text-track-loaded-2>text track loaded</a> state.<dt><dfn id=dom-track-error><code>ERROR</code></dfn> (numeric value 3)<dd>The <a href=#text-track-failed-to-load id=the-track-element:text-track-failed-to-load-2>text track failed to load</a> state.</dl>
- <p>The <dfn id=dom-track-track><code>track</code></dfn> IDL attribute must, on getting,
- return the <code id=the-track-element:the-track-element-9><a href=#the-track-element>track</a></code> element's <a href=#text-track id=the-track-element:text-track-5>text track</a>'s corresponding
- <code id=the-track-element:texttrack-3><a href=#texttrack>TextTrack</a></code> object.</p>
- <p>The <dfn id=dom-track-src><code>src</code></dfn>, <dfn id=dom-track-srclang><code>srclang</code></dfn>, <dfn id=dom-track-label><code>label</code></dfn>, and <dfn id=dom-track-default><code>default</code></dfn> IDL attributes must <a href=#reflect id=the-track-element:reflect>reflect</a> the
- respective content attributes of the same name. The <dfn id=dom-track-kind><code>kind</code></dfn> IDL attribute must <a href=#reflect id=the-track-element:reflect-2>reflect</a> the content
- attribute of the same name, <a href=#limited-to-only-known-values id=the-track-element:limited-to-only-known-values>limited to only known values</a>.</p>
-
- <div class=example>
- <p>This video has subtitles in several languages:</p>
- <pre><video src="brave.webm">
- <track kind=subtitles src=brave.en.vtt srclang=en label="English">
- <track kind=captions src=brave.en.hoh.vtt srclang=en label="English for the Hard of Hearing">
- <track kind=subtitles src=brave.fr.vtt srclang=fr lang=fr label="Français">
- <track kind=subtitles src=brave.de.vtt srclang=de lang=de label="Deutsch">
- </video></pre>
- <p>(The <code id=the-track-element:attr-lang><a href=#attr-lang>lang</a></code> attributes on the last two describe the language of
- the <code id=the-track-element:attr-track-label-5><a href=#attr-track-label>label</a></code> attribute, not the language of the subtitles
- themselves. The language of the subtitles is given by the <code id=the-track-element:attr-track-srclang-4><a href=#attr-track-srclang>srclang</a></code> attribute.)</p>
- </div>
- <h4 id=media-elements>4.8.14 Media elements</h4>
- <p><dfn id=media-element>Media elements</dfn> (<code id=media-elements:the-audio-element><a href=#the-audio-element>audio</a></code> and <code id=media-elements:the-video-element><a href=#the-video-element>video</a></code>, in
- this specification) implement the following interface:</p>
- <pre class=idl>enum <dfn id=canplaytyperesult>CanPlayTypeResult</dfn> { "" /* <a href=#dom-canplaytyperesult-nil id=media-elements:dom-canplaytyperesult-nil>empty string</a> */, "<a href=#dom-canplaytyperesult-maybe id=media-elements:dom-canplaytyperesult-maybe>maybe</a>", "<a href=#dom-canplaytyperesult-probably id=media-elements:dom-canplaytyperesult-probably>probably</a>" };
- typedef (<a href=#mediastream id=media-elements:mediastream>MediaStream</a> or <a href=#mediasource id=media-elements:mediasource>MediaSource</a> or <a href=#blob id=media-elements:blob>Blob</a>) <dfn id=mediaprovider>MediaProvider</dfn>;
- interface <dfn id=htmlmediaelement>HTMLMediaElement</dfn> : <a href=#htmlelement id=media-elements:htmlelement>HTMLElement</a> {
- // error state
- readonly attribute <a href=#mediaerror id=media-elements:mediaerror>MediaError</a>? <a href=#dom-media-error id=media-elements:dom-media-error>error</a>;
- // network state
- attribute DOMString <a href=#dom-media-src id=media-elements:dom-media-src>src</a>;
- attribute <a href=#mediaprovider id=media-elements:mediaprovider>MediaProvider</a>? <a href=#dom-media-srcobject id=media-elements:dom-media-srcobject>srcObject</a>;
- readonly attribute DOMString <a href=#dom-media-currentsrc id=media-elements:dom-media-currentsrc>currentSrc</a>;
- attribute DOMString? <a href=#dom-media-crossorigin id=media-elements:dom-media-crossorigin>crossOrigin</a>;
- const unsigned short <a href=#dom-media-network_empty id=media-elements:dom-media-network_empty>NETWORK_EMPTY</a> = 0;
- const unsigned short <a href=#dom-media-network_idle id=media-elements:dom-media-network_idle>NETWORK_IDLE</a> = 1;
- const unsigned short <a href=#dom-media-network_loading id=media-elements:dom-media-network_loading>NETWORK_LOADING</a> = 2;
- const unsigned short <a href=#dom-media-network_no_source id=media-elements:dom-media-network_no_source>NETWORK_NO_SOURCE</a> = 3;
- readonly attribute unsigned short <a href=#dom-media-networkstate id=media-elements:dom-media-networkstate>networkState</a>;
- attribute DOMString <a href=#dom-media-preload id=media-elements:dom-media-preload>preload</a>;
- readonly attribute <a href=#timeranges id=media-elements:timeranges>TimeRanges</a> <a href=#dom-media-buffered id=media-elements:dom-media-buffered>buffered</a>;
- void <a href=#dom-media-load id=media-elements:dom-media-load>load</a>();
- <a href=#canplaytyperesult id=media-elements:canplaytyperesult>CanPlayTypeResult</a> <a href=#dom-navigator-canplaytype id=media-elements:dom-navigator-canplaytype>canPlayType</a>(DOMString type);
- // ready state
- const unsigned short <a href=#dom-media-have_nothing id=media-elements:dom-media-have_nothing>HAVE_NOTHING</a> = 0;
- const unsigned short <a href=#dom-media-have_metadata id=media-elements:dom-media-have_metadata>HAVE_METADATA</a> = 1;
- const unsigned short <a href=#dom-media-have_current_data id=media-elements:dom-media-have_current_data>HAVE_CURRENT_DATA</a> = 2;
- const unsigned short <a href=#dom-media-have_future_data id=media-elements:dom-media-have_future_data>HAVE_FUTURE_DATA</a> = 3;
- const unsigned short <a href=#dom-media-have_enough_data id=media-elements:dom-media-have_enough_data>HAVE_ENOUGH_DATA</a> = 4;
- readonly attribute unsigned short <a href=#dom-media-readystate id=media-elements:dom-media-readystate>readyState</a>;
- readonly attribute boolean <a href=#dom-media-seeking id=media-elements:dom-media-seeking>seeking</a>;
- // playback state
- attribute double <a href=#dom-media-currenttime id=media-elements:dom-media-currenttime>currentTime</a>;
- void <a href=#dom-media-fastseek id=media-elements:dom-media-fastseek>fastSeek</a>(double time);
- readonly attribute unrestricted double <a href=#dom-media-duration id=media-elements:dom-media-duration>duration</a>;
- <a href=#idl-date id=media-elements:idl-date>Date</a> <a href=#dom-media-getstartdate id=media-elements:dom-media-getstartdate>getStartDate</a>();
- readonly attribute boolean <a href=#dom-media-paused id=media-elements:dom-media-paused>paused</a>;
- attribute double <a href=#dom-media-defaultplaybackrate id=media-elements:dom-media-defaultplaybackrate>defaultPlaybackRate</a>;
- attribute double <a href=#dom-media-playbackrate id=media-elements:dom-media-playbackrate>playbackRate</a>;
- readonly attribute <a href=#timeranges id=media-elements:timeranges-2>TimeRanges</a> <a href=#dom-media-played id=media-elements:dom-media-played>played</a>;
- readonly attribute <a href=#timeranges id=media-elements:timeranges-3>TimeRanges</a> <a href=#dom-media-seekable id=media-elements:dom-media-seekable>seekable</a>;
- readonly attribute boolean <a href=#dom-media-ended id=media-elements:dom-media-ended>ended</a>;
- attribute boolean <a href=#dom-media-autoplay id=media-elements:dom-media-autoplay>autoplay</a>;
- attribute boolean <a href=#dom-media-loop id=media-elements:dom-media-loop>loop</a>;
- void <a href=#dom-media-play id=media-elements:dom-media-play>play</a>();
- void <a href=#dom-media-pause id=media-elements:dom-media-pause>pause</a>();
- // media controller
- attribute DOMString <a href=#dom-media-mediagroup id=media-elements:dom-media-mediagroup>mediaGroup</a>;
- attribute <a href=#mediacontroller id=media-elements:mediacontroller>MediaController</a>? <a href=#dom-media-controller id=media-elements:dom-media-controller>controller</a>;
- // controls
- attribute boolean <a href=#dom-media-controls id=media-elements:dom-media-controls>controls</a>;
- attribute double <a href=#dom-media-volume id=media-elements:dom-media-volume>volume</a>;
- attribute boolean <a href=#dom-media-muted id=media-elements:dom-media-muted>muted</a>;
- attribute boolean <a href=#dom-media-defaultmuted id=media-elements:dom-media-defaultmuted>defaultMuted</a>;
- // tracks
- readonly attribute <a href=#audiotracklist id=media-elements:audiotracklist>AudioTrackList</a> <a href=#dom-media-audiotracks id=media-elements:dom-media-audiotracks>audioTracks</a>;
- readonly attribute <a href=#videotracklist id=media-elements:videotracklist>VideoTrackList</a> <a href=#dom-media-videotracks id=media-elements:dom-media-videotracks>videoTracks</a>;
- readonly attribute <a href=#texttracklist id=media-elements:texttracklist>TextTrackList</a> <a href=#dom-media-texttracks id=media-elements:dom-media-texttracks>textTracks</a>;
- <a href=#texttrack id=media-elements:texttrack>TextTrack</a> <a href=#dom-media-addtexttrack id=media-elements:dom-media-addtexttrack>addTextTrack</a>(<a href=#texttrackkind id=media-elements:texttrackkind>TextTrackKind</a> kind, optional DOMString label = "", optional DOMString language = "");
- };</pre>
- <p>The <dfn id=media-element-attributes>media element attributes</dfn>, <code id=media-elements:attr-media-src><a href=#attr-media-src>src</a></code>, <code id=media-elements:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>, <code id=media-elements:attr-media-preload><a href=#attr-media-preload>preload</a></code>, <code id=media-elements:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>,
- <code id=media-elements:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>, <code id=media-elements:attr-media-loop><a href=#attr-media-loop>loop</a></code>,
- <code id=media-elements:attr-media-muted><a href=#attr-media-muted>muted</a></code>, and <code id=media-elements:attr-media-controls><a href=#attr-media-controls>controls</a></code>, apply to all <a href=#media-element id=media-elements:media-element>media
- elements</a>. They are defined in this section.</p>
-
-
- <p><a href=#media-element id=media-elements:media-element-2>Media elements</a> are used to present audio data, or video and
- audio data, to the user. This is referred to as <dfn id=media-data>media data</dfn> in this section, since this
- section applies equally to <a href=#media-element id=media-elements:media-element-3>media elements</a> for audio or for
- video.
- The term <dfn id=media-resource>media resource</dfn> is used to refer to the complete set of media data, e.g. the
- complete video file, or complete audio file.
- </p>
- <p>A <a href=#media-resource id=media-elements:media-resource>media resource</a> can have multiple audio and video tracks. For the purposes of a
- <a href=#media-element id=media-elements:media-element-4>media element</a>, the video data of the <a href=#media-resource id=media-elements:media-resource-2>media resource</a> is only that of the
- currently selected track (if any) as given by the element's <code id=media-elements:dom-media-videotracks-2><a href=#dom-media-videotracks>videoTracks</a></code> attribute when the <a href=#event-loop id=media-elements:event-loop>event loop</a> last
- reached step 1, and the audio data of the <a href=#media-resource id=media-elements:media-resource-3>media resource</a> is the result of mixing all
- the currently enabled tracks (if any) given by the element's <code id=media-elements:dom-media-audiotracks-2><a href=#dom-media-audiotracks>audioTracks</a></code> attribute when the <a href=#event-loop id=media-elements:event-loop-2>event loop</a> last
- reached step 1.</p>
- <p class=note>Both <code id=media-elements:the-audio-element-2><a href=#the-audio-element>audio</a></code> and <code id=media-elements:the-video-element-2><a href=#the-video-element>video</a></code> elements can be used for both audio
- and video. The main difference between the two is simply that the <code id=media-elements:the-audio-element-3><a href=#the-audio-element>audio</a></code> element has
- no playback area for visual content (such as video or captions), whereas the <code id=media-elements:the-video-element-3><a href=#the-video-element>video</a></code>
- element does.</p>
-
- <p>Except where otherwise explicitly specified, the <a href=#task-source id=media-elements:task-source>task source</a> for all the tasks
- <a href=#queue-a-task id=media-elements:queue-a-task>queued</a> in this section and its subsections is the <dfn id=media-element-event-task-source>media
- element event task source</dfn> of the <a href=#media-element id=media-elements:media-element-5>media element</a> in question.</p>
-
- <h5 id=error-codes>4.8.14.1 Error codes</h5>
- <dl class=domintro><dt><var>media</var> . <code id=error-codes:dom-media-error><a href=#dom-media-error>error</a></code><dd>
- <p>Returns a <code id=error-codes:mediaerror><a href=#mediaerror>MediaError</a></code> object representing the current error state of the
- element.</p>
- <p>Returns null if there is no error.</p>
- </dl>
-
- <p>All <a href=#media-element id=error-codes:media-element>media elements</a> have an associated error status, which
- records the last error the element encountered since its <a href=#concept-media-load-algorithm id=error-codes:concept-media-load-algorithm>resource selection algorithm</a> was last invoked. The
- <dfn id=dom-media-error><code>error</code></dfn> attribute, on getting, must return the
- <code id=error-codes:mediaerror-2><a href=#mediaerror>MediaError</a></code> object created for this last error, or null if there has not been an
- error.</p>
-
- <pre class=idl>interface <dfn id=mediaerror>MediaError</dfn> {
- const unsigned short <a href=#dom-mediaerror-media_err_aborted id=error-codes:dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a> = 1;
- const unsigned short <a href=#dom-mediaerror-media_err_network id=error-codes:dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a> = 2;
- const unsigned short <a href=#dom-mediaerror-media_err_decode id=error-codes:dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a> = 3;
- const unsigned short <a href=#dom-mediaerror-media_err_src_not_supported id=error-codes:dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED</a> = 4;
- readonly attribute unsigned short <a href=#dom-mediaerror-code id=error-codes:dom-mediaerror-code>code</a>;
- };</pre>
- <dl class=domintro><dt><var>media</var> . <code id=error-codes:dom-media-error-2><a href=#dom-media-error>error</a></code> . <code id=error-codes:dom-mediaerror-code-2><a href=#dom-mediaerror-code>code</a></code><dd>
- <p>Returns the current error's error code, from the list below.</p>
- </dl>
-
- <p>The <dfn id=dom-mediaerror-code><code>code</code></dfn> attribute of a
- <code id=error-codes:mediaerror-3><a href=#mediaerror>MediaError</a></code> object must return the code for the error, which must be one of the
- following:</p>
-
- <dl><dt><dfn id=dom-mediaerror-media_err_aborted><code>MEDIA_ERR_ABORTED</code></dfn> (numeric value 1)<dd>The fetching process for the <a href=#media-resource id=error-codes:media-resource>media resource</a> was aborted by the user agent at the
- user's request.<dt><dfn id=dom-mediaerror-media_err_network><code>MEDIA_ERR_NETWORK</code></dfn> (numeric value 2)<dd>A network error of some description caused the user agent to stop fetching the <a href=#media-resource id=error-codes:media-resource-2>media
- resource</a>, after the resource was established to be usable.<dt><dfn id=dom-mediaerror-media_err_decode><code>MEDIA_ERR_DECODE</code></dfn> (numeric value 3)<dd>An error of some description occurred while decoding the <a href=#media-resource id=error-codes:media-resource-3>media resource</a>, after
- the resource was established to be usable.<dt><dfn id=dom-mediaerror-media_err_src_not_supported><code>MEDIA_ERR_SRC_NOT_SUPPORTED</code></dfn> (numeric value 4)<dd>The <a href=#media-resource id=error-codes:media-resource-4>media resource</a> indicated by the <code id=error-codes:attr-media-src><a href=#attr-media-src>src</a></code>
- attribute or <a href=#assigned-media-provider-object id=error-codes:assigned-media-provider-object>assigned media provider object</a> was not suitable.</dl>
- <h5 id=location-of-the-media-resource>4.8.14.2 Location of the media resource</h5>
- <p>The <dfn id=attr-media-src><code>src</code></dfn> content attribute on <a href=#media-element id=location-of-the-media-resource:media-element>media elements</a> gives the address of the media resource (video, audio) to show. The
- attribute, if present, must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=location-of-the-media-resource:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by
- spaces</a>.</p>
- <p>If the <code id=location-of-the-media-resource:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on the <a href=#media-element id=location-of-the-media-resource:media-element-2>media
- element</a>, then the <code id=location-of-the-media-resource:attr-media-src><a href=#attr-media-src>src</a></code> attribute must also be
- specified.</p>
- <p>The <dfn id=attr-media-crossorigin><code>crossorigin</code></dfn> content attribute on
- <a href=#media-element id=location-of-the-media-resource:media-element-3>media elements</a> is a <a href=#cors-settings-attribute id=location-of-the-media-resource:cors-settings-attribute>CORS settings attribute</a>.</p>
-
- <p id=concept-media-load-algorithm-at-creation>If a <a href=#media-element id=location-of-the-media-resource:media-element-4>media element</a> is created with a
- <code id=location-of-the-media-resource:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute, the user agent must synchronously invoke the
- <a href=#media-element id=location-of-the-media-resource:media-element-5>media element</a>'s <a href=#concept-media-load-algorithm id=location-of-the-media-resource:concept-media-load-algorithm>resource selection
- algorithm</a>.</p>
- <p>If a <code id=location-of-the-media-resource:attr-media-src-3><a href=#attr-media-src>src</a></code> attribute of a <a href=#media-element id=location-of-the-media-resource:media-element-6>media element</a> is set
- or changed, the user agent must invoke the <a href=#media-element id=location-of-the-media-resource:media-element-7>media element</a>'s <a href=#media-element-load-algorithm id=location-of-the-media-resource:media-element-load-algorithm>media element load
- algorithm</a>. (<em>Removing</em> the <code id=location-of-the-media-resource:attr-media-src-4><a href=#attr-media-src>src</a></code> attribute does
- not do this, even if there are <code id=location-of-the-media-resource:the-source-element><a href=#the-source-element>source</a></code> elements present.)</p>
- <p>The <dfn id=dom-media-src><code>src</code></dfn> IDL attribute on <a href=#media-element id=location-of-the-media-resource:media-element-8>media elements</a> must <a href=#reflect id=location-of-the-media-resource:reflect>reflect</a> the content attribute of the same
- name.</p>
- <p>The <dfn id=dom-media-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
- <a href=#reflect id=location-of-the-media-resource:reflect-2>reflect</a> the <code id=location-of-the-media-resource:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content attribute.</p>
-
-
- <p>A <dfn id=media-provider-object>media provider object</dfn> is an object that can represent a <a href=#media-resource id=location-of-the-media-resource:media-resource>media resource</a>,
- separate from a <a href=#url id=location-of-the-media-resource:url>URL</a>. <code id=location-of-the-media-resource:mediastream><a href=#mediastream>MediaStream</a></code> objects, <code id=location-of-the-media-resource:mediasource><a href=#mediasource>MediaSource</a></code>
- objects, <code id=location-of-the-media-resource:blob><a href=#blob>Blob</a></code> objects, and <code id=location-of-the-media-resource:file><a href=#file>File</a></code> objects are all <a href=#media-provider-object id=location-of-the-media-resource:media-provider-object>media provider objects</a>.</p>
-
- <p>Each <a href=#media-element id=location-of-the-media-resource:media-element-9>media element</a> can have an <dfn id=assigned-media-provider-object>assigned media provider object</dfn>, which is a
- <a href=#media-provider-object id=location-of-the-media-resource:media-provider-object-2>media provider object</a>. When a <a href=#media-element id=location-of-the-media-resource:media-element-10>media element</a> is created, it has no
- <a href=#assigned-media-provider-object id=location-of-the-media-resource:assigned-media-provider-object>assigned media provider object</a>.</p>
-
- <dl class=domintro><dt><var>media</var> . <code id=location-of-the-media-resource:dom-media-srcobject><a href=#dom-media-srcobject>srcObject</a></code> [ = <var>source</var> ]<dd>
- <p>Allows the <a href=#media-element id=location-of-the-media-resource:media-element-11>media element</a> to be assigned a <a href=#media-provider-object id=location-of-the-media-resource:media-provider-object-3>media provider object</a>.</p>
- <dt><var>media</var> . <code id=location-of-the-media-resource:dom-media-currentsrc><a href=#dom-media-currentsrc>currentSrc</a></code><dd>
- <p>Returns the address of the current <a href=#media-resource id=location-of-the-media-resource:media-resource-2>media resource</a>, if any.</p>
- <p>Returns the empty string when there is no <a href=#media-resource id=location-of-the-media-resource:media-resource-3>media resource</a>, or it doesn't have an address.</p>
- </dl>
-
- <p>The <dfn id=dom-media-currentsrc><code>currentSrc</code></dfn> IDL attribute must initially be set to
- the empty string. Its value is changed by the <a href=#concept-media-load-algorithm id=location-of-the-media-resource:concept-media-load-algorithm-2>resource
- selection algorithm</a> defined below.</p>
- <p>The <dfn id=dom-media-srcobject><code>srcObject</code></dfn> IDL attribute, on getting,
- must return the element's <a href=#assigned-media-provider-object id=location-of-the-media-resource:assigned-media-provider-object-2>assigned media provider object</a>, if any, or null otherwise.
- On setting, it must set the element's <a href=#assigned-media-provider-object id=location-of-the-media-resource:assigned-media-provider-object-3>assigned media provider object</a> to the new
- value, and then invoke the element's <a href=#media-element-load-algorithm id=location-of-the-media-resource:media-element-load-algorithm-2>media element load algorithm</a>.</p>
-
-
- <p class=note>There are three ways to specify a <a href=#media-resource id=location-of-the-media-resource:media-resource-4>media resource</a>: the <code id=location-of-the-media-resource:dom-media-srcobject-2><a href=#dom-media-srcobject>srcObject</a></code> IDL attribute, the <code id=location-of-the-media-resource:attr-media-src-5><a href=#attr-media-src>src</a></code> content attribute, and <code id=location-of-the-media-resource:the-source-element-2><a href=#the-source-element>source</a></code> elements. The IDL
- attribute takes priority, followed by the content attribute, followed by the elements.</p>
- <h5 id=mime-types>4.8.14.3 MIME types</h5>
- <p>A <a href=#media-resource id=mime-types:media-resource>media resource</a> can be described in terms of its <em>type</em>, specifically a
- <a href=#mime-type id=mime-types:mime-type>MIME type</a>, in some cases with a <code>codecs</code> parameter. (Whether the
- <code>codecs</code> parameter is allowed or not depends on the MIME type.) <a href=#refsRFC4281>[RFC4281]</a></p>
- <p>Types are usually somewhat incomplete descriptions; for example "<code>video/mpeg</code>" doesn't say anything except what the container type is, and even a
- type like "<code>video/mp4; codecs="avc1.42E01E, mp4a.40.2"</code>" doesn't
- include information like the actual bitrate (only the maximum bitrate). Thus, given a type, a user
- agent can often only know whether it <em>might</em> be able to play media of that type (with
- varying levels of confidence), or whether it definitely <em>cannot</em> play media of that
- type.</p>
- <p><dfn id=a-type-that-the-user-agent-knows-it-cannot-render>A type that the user agent knows it cannot render</dfn> is one that describes a resource
- that the user agent definitely does not support, for example because it doesn't recognise the
- container type, or it doesn't support the listed codecs.</p>
- <p>The <a href=#mime-type id=mime-types:mime-type-2>MIME type</a> "<code id=mime-types:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>" with no parameters is never
- <a href=#a-type-that-the-user-agent-knows-it-cannot-render id=mime-types:a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot render</a>. User agents must treat that type
- as equivalent to the lack of any explicit <a href=#content-type id=mime-types:content-type>Content-Type metadata</a>
- when it is used to label a potential <a href=#media-resource id=mime-types:media-resource-2>media resource</a>.</p>
- <p class=note>Only the <a href=#mime-type id=mime-types:mime-type-3>MIME type</a> "<code id=mime-types:application/octet-stream-2><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>" with no
- parameters is special-cased here; if any parameter appears with it, it will be treated just like
- any other <a href=#mime-type id=mime-types:mime-type-4>MIME type</a>. This is a deviation from the rule that unknown <a href=#mime-type id=mime-types:mime-type-5>MIME type</a> parameters should be ignored.</p>
- <dl class=domintro><dt><var>media</var> . <code id=mime-types:dom-navigator-canplaytype><a href=#dom-navigator-canplaytype>canPlayType</a></code>(<var>type</var>)<dd>
- <p>Returns the empty string (a negative response), "maybe", or "probably" based on how confident
- the user agent is that it can play media resources of the given type.</p>
- </dl>
-
- <p>The <dfn id=dom-navigator-canplaytype><code>canPlayType(<var>type</var>)</code></dfn> method must return <dfn id=dom-canplaytyperesult-nil>the
- empty string</dfn> if <var>type</var> is <a href=#a-type-that-the-user-agent-knows-it-cannot-render id=mime-types:a-type-that-the-user-agent-knows-it-cannot-render-2>a type that the user agent knows it cannot
- render</a> or is the type "<code id=mime-types:application/octet-stream-3><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>"; it must return "<dfn id=dom-canplaytyperesult-probably><code>probably</code></dfn>" if the user agent is confident
- that the type represents a <a href=#media-resource id=mime-types:media-resource-3>media resource</a> that it can render if used in with this
- <code id=mime-types:the-audio-element><a href=#the-audio-element>audio</a></code> or <code id=mime-types:the-video-element><a href=#the-video-element>video</a></code> element; and it must return "<dfn id=dom-canplaytyperesult-maybe><code>maybe</code></dfn>" otherwise. Implementors are encouraged
- to return "<code id=mime-types:dom-canplaytyperesult-maybe><a href=#dom-canplaytyperesult-maybe>maybe</a></code>" unless the type can be
- confidently established as being supported or not. Generally, a user agent should never return
- "<code id=mime-types:dom-canplaytyperesult-probably><a href=#dom-canplaytyperesult-probably>probably</a></code>" for a type that allows the <code>codecs</code> parameter if that parameter is not present.</p>
-
- <div class=example>
- <p>This script tests to see if the user agent supports a (fictional) new format to dynamically
- decide whether to use a <code id=mime-types:the-video-element-2><a href=#the-video-element>video</a></code> element or a plugin:</p>
- <pre><section id="video">
- <p><a href="playing-cats.nfv">Download video</a></p>
- </section>
- <script>
- var videoSection = document.getElementById('video');
- var videoElement = document.createElement('video');
- var support = videoElement.canPlayType('video/x-new-fictional-format;codecs="kittens,bunnies"');
- if (support != "probably" && "New Fictional Video Plugin" in navigator.plugins) {
- // not confident of browser support
- // but we have a plugin
- // so use plugin instead
- videoElement = document.createElement("embed");
- } else if (support == "") {
- // no support from browser and no plugin
- // do nothing
- videoElement = null;
- }
- if (videoElement) {
- while (videoSection.hasChildNodes())
- videoSection.removeChild(videoSection.firstChild);
- videoElement.setAttribute("src", "playing-cats.nfv");
- videoSection.appendChild(videoElement);
- }
- </script></pre>
- </div>
- <p class=note>The <code id=mime-types:attr-source-type><a href=#attr-source-type>type</a></code> attribute of the
- <code id=mime-types:the-source-element><a href=#the-source-element>source</a></code> element allows the user agent to avoid downloading resources that use formats
- it cannot render.</p>
- <h5 id=network-states>4.8.14.4 Network states</h5>
- <dl class=domintro><dt><var>media</var> . <code id=network-states:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code><dd>
- <p>Returns the current state of network activity for the element, from the codes in the list
- below.</p>
- </dl>
-
- <p>As <a href=#media-element id=network-states:media-element>media elements</a> interact with the network, their current
- network activity is represented by the <dfn id=dom-media-networkstate><code>networkState</code></dfn> attribute. On getting, it must
- return the current network state of the element, which must be one of the following values:</p>
-
- <dl><dt><dfn id=dom-media-network_empty><code>NETWORK_EMPTY</code></dfn> (numeric value 0)<dd>The element has not yet been initialized. All attributes are in their initial states.<dt><dfn id=dom-media-network_idle><code>NETWORK_IDLE</code></dfn> (numeric value 1)<dd>The element's <a href=#concept-media-load-algorithm id=network-states:concept-media-load-algorithm>resource
- selection algorithm</a> is active and has selected a <a href=#media-resource id=network-states:media-resource>resource</a>, but it is not actually using the network at this time.<dt><dfn id=dom-media-network_loading><code>NETWORK_LOADING</code></dfn> (numeric value 2)<dd>The user agent is actively trying to download data.<dt><dfn id=dom-media-network_no_source><code>NETWORK_NO_SOURCE</code></dfn> (numeric value 3)<dd>The element's <a href=#concept-media-load-algorithm id=network-states:concept-media-load-algorithm-2>resource
- selection algorithm</a> is active, but it has not yet found a <a href=#media-resource id=network-states:media-resource-2>resource</a> to use.</dl>
-
- <p>The <a href=#concept-media-load-algorithm id=network-states:concept-media-load-algorithm-3>resource selection algorithm</a> defined
- below describes exactly when the <code id=network-states:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code>
- attribute changes value and what events fire to indicate changes in this state.</p>
-
- <h5 id=loading-the-media-resource>4.8.14.5 Loading the media resource</h5>
- <dl class=domintro><dt><var>media</var> . <code id=loading-the-media-resource:dom-media-load><a href=#dom-media-load>load</a></code>()<dd>
- <p>Causes the element to reset and start selecting and loading a new <a href=#media-resource id=loading-the-media-resource:media-resource>media resource</a>
- from scratch.</p>
- </dl>
-
- <p>All <a href=#media-element id=loading-the-media-resource:media-element>media elements</a> have an <dfn id=autoplaying-flag>autoplaying flag</dfn>,
- which must begin in the true state, and a <dfn id=delaying-the-load-event-flag>delaying-the-load-event flag</dfn>, which must
- begin in the false state. While the <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag>delaying-the-load-event flag</a> is true, the element
- must <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event>delay the load event</a> of its document.</p>
- <p>When the <dfn id=dom-media-load><code>load()</code></dfn> method on a <a href=#media-element id=loading-the-media-resource:media-element-2>media
- element</a> is invoked, the user agent must run the <a href=#media-element-load-algorithm id=loading-the-media-resource:media-element-load-algorithm>media element load
- algorithm</a>.</p>
- <p>The <dfn id=media-element-load-algorithm>media element load algorithm</dfn> consists of the following steps.</p>
- <ol><li><p>Abort any already-running instance of the <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm>resource selection algorithm</a> for this
- element.<li>
- <p>If there are any <a href=#concept-task id=loading-the-media-resource:concept-task>tasks</a> from the <a href=#media-element id=loading-the-media-resource:media-element-3>media
- element</a>'s <a href=#media-element-event-task-source id=loading-the-media-resource:media-element-event-task-source>media element event task source</a> in one of the <a href=#task-queue id=loading-the-media-resource:task-queue>task queues</a>, then remove those tasks.</p>
- <p class=note>Basically, pending events and callbacks for the media element are discarded when
- the media element starts loading a new resource.</p>
- <li><p>If the <a href=#media-element id=loading-the-media-resource:media-element-4>media element</a>'s <code id=loading-the-media-resource:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> is set to <code id=loading-the-media-resource:dom-media-network_loading><a href=#dom-media-network_loading>NETWORK_LOADING</a></code> or <code id=loading-the-media-resource:dom-media-network_idle><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, <a href=#queue-a-task id=loading-the-media-resource:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event>fire a
- simple event</a> named <code id=loading-the-media-resource:event-media-abort><a href=#event-media-abort>abort</a></code> at the <a href=#media-element id=loading-the-media-resource:media-element-5>media
- element</a>.<li>
- <p>If the <a href=#media-element id=loading-the-media-resource:media-element-6>media element</a>'s <code id=loading-the-media-resource:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code>
- is not set to <code id=loading-the-media-resource:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then run these
- substeps:</p>
- <ol><li><p><a href=#queue-a-task id=loading-the-media-resource:queue-a-task-2>Queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-2>fire a simple event</a> named <code id=loading-the-media-resource:event-media-emptied><a href=#event-media-emptied>emptied</a></code> at the <a href=#media-element id=loading-the-media-resource:media-element-7>media element</a>.<li><p>If a fetching process is in progress for the <a href=#media-element id=loading-the-media-resource:media-element-8>media
- element</a>, the user agent should stop it.<li><p><a href="#forget-the-media-element's-media-resource-specific-tracks" id="loading-the-media-resource:forget-the-media-element's-media-resource-specific-tracks">Forget the media element's media-resource-specific tracks</a>.<li><p>If <code id=loading-the-media-resource:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> is not set to <code id=loading-the-media-resource:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then set it to that state.
-
- <li><p>If the <code id=loading-the-media-resource:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, then set it to
- true.<li><p>If <code id=loading-the-media-resource:dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, set it to false.<li>
- <p>Set the <a href=#current-playback-position id=loading-the-media-resource:current-playback-position>current playback position</a> to 0.</p>
- <p>Set the <a href=#official-playback-position id=loading-the-media-resource:official-playback-position>official playback position</a> to 0.</p>
- <p>If this changed the <a href=#official-playback-position id=loading-the-media-resource:official-playback-position-2>official playback position</a>, then <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-3>queue a task</a>
- to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-3>fire a simple event</a> named <code id=loading-the-media-resource:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element id=loading-the-media-resource:media-element-9>media element</a>.</p>
- <li><p>Set the <a href=#initial-playback-position id=loading-the-media-resource:initial-playback-position>initial playback position</a> to 0.<li><p>Set the <a href=#timeline-offset id=loading-the-media-resource:timeline-offset>timeline offset</a> to Not-a-Number (NaN).<li>
- <p>Update the <code id=loading-the-media-resource:dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute to Not-a-Number
- (NaN).</p>
- <p class=note>The user agent <a href=#durationChange>will not</a> fire a <code id=loading-the-media-resource:event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event for this particular change of
- the duration.</p>
- </ol>
- <li><p>Set the <code id=loading-the-media-resource:dom-media-playbackrate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute to the value of
- the <code id=loading-the-media-resource:dom-media-defaultplaybackrate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> attribute.<li><p>Set the <code id=loading-the-media-resource:dom-media-error><a href=#dom-media-error>error</a></code> attribute to null and the
- <a href=#autoplaying-flag id=loading-the-media-resource:autoplaying-flag>autoplaying flag</a> to true.<li><p>Invoke the <a href=#media-element id=loading-the-media-resource:media-element-10>media element</a>'s <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-2>resource selection algorithm</a>.<li>
- <p class=note>Playback of any previously playing <a href=#media-resource id=loading-the-media-resource:media-resource-2>media resource</a> for this element
- stops.</p>
- </ol>
- <p>The <dfn id=concept-media-load-algorithm>resource selection algorithm</dfn> for a
- <a href=#media-element id=loading-the-media-resource:media-element-11>media element</a> is as follows. This algorithm is always invoked synchronously, but one
- of the first steps in the algorithm is to return and continue running the remaining steps
- asynchronously, meaning that it runs in the background with scripts and other <a href=#concept-task id=loading-the-media-resource:concept-task-2>tasks</a> running in parallel. In addition, this algorithm interacts
- closely with the <a href=#event-loop id=loading-the-media-resource:event-loop>event loop</a> mechanism; in particular, it has <a href=#synchronous-section id=loading-the-media-resource:synchronous-section>synchronous sections</a> (which are triggered as part of the <a href=#event-loop id=loading-the-media-resource:event-loop-2>event loop</a>
- algorithm). Steps in such sections are marked with ⌛.</p>
- <ol><li><p>Set the element's <code id=loading-the-media-resource:dom-media-networkstate-3><a href=#dom-media-networkstate>networkState</a></code> attribute to
- the <code id=loading-the-media-resource:dom-media-network_no_source><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.<li><p>Set the element's <a href=#show-poster-flag id=loading-the-media-resource:show-poster-flag>show poster flag</a> to true.<li><p>Set the <a href=#media-element id=loading-the-media-resource:media-element-12>media element</a>'s <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-2>delaying-the-load-event flag</a> to true
- (this <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-2>delays the load event</a>).<li><p>Asynchronously <a href=#await-a-stable-state id=loading-the-media-resource:await-a-stable-state>await a stable state</a>, allowing the <a href=#concept-task id=loading-the-media-resource:concept-task-3>task</a> that invoked this algorithm to continue. The <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-2>synchronous
- section</a> consists of all the remaining steps of this algorithm until the algorithm says the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-3>synchronous section</a> has ended. (Steps in <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-4>synchronous sections</a> are marked with ⌛.)<li>
- <p>⌛ If the <a href=#media-element id=loading-the-media-resource:media-element-13>media element</a>'s <a href=#blocked-on-parser id=loading-the-media-resource:blocked-on-parser>blocked-on-parser</a> flag is false,
- then <a href=#populate-the-list-of-pending-text-tracks id=loading-the-media-resource:populate-the-list-of-pending-text-tracks>populate the list of pending text tracks</a>.</p>
- <li>
- <p>⌛ If the <a href=#media-element id=loading-the-media-resource:media-element-14>media element</a> has an <a href=#assigned-media-provider-object id=loading-the-media-resource:assigned-media-provider-object>assigned media provider
- object</a>, then let <var>mode</var> be <i>object</i>.</p>
- <p>⌛ Otherwise, if the <a href=#media-element id=loading-the-media-resource:media-element-15>media element</a> has no <a href=#assigned-media-provider-object id=loading-the-media-resource:assigned-media-provider-object-2>assigned media provider
- object</a> but has a <code id=loading-the-media-resource:attr-media-src><a href=#attr-media-src>src</a></code>
- attribute, then let <var>mode</var> be <i>attribute</i>.</p>
- <p>⌛ Otherwise, if the <a href=#media-element id=loading-the-media-resource:media-element-16>media element</a> does not have an <a href=#assigned-media-provider-object id=loading-the-media-resource:assigned-media-provider-object-3>assigned media provider
- object</a> and does not have a <code id=loading-the-media-resource:attr-media-src-2><a href=#attr-media-src>src</a></code> attribute, but does have a <code id=loading-the-media-resource:the-source-element><a href=#the-source-element>source</a></code> element child, then
- let <var>mode</var> be <i>children</i> and let <var>candidate</var>
- be the first such <code id=loading-the-media-resource:the-source-element-2><a href=#the-source-element>source</a></code> element child in <a href=#tree-order id=loading-the-media-resource:tree-order>tree order</a>.</p>
- <p>⌛ Otherwise the <a href=#media-element id=loading-the-media-resource:media-element-17>media element</a> has no <a href=#assigned-media-provider-object id=loading-the-media-resource:assigned-media-provider-object-4>assigned media provider
- object</a> and has neither a <code id=loading-the-media-resource:attr-media-src-3><a href=#attr-media-src>src</a></code> attribute nor a <code id=loading-the-media-resource:the-source-element-3><a href=#the-source-element>source</a></code> element child: set the
- <code id=loading-the-media-resource:dom-media-networkstate-4><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_empty-2><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, and abort these steps; the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-5>synchronous section</a> ends.</p>
- <li><p>⌛ Set the <a href=#media-element id=loading-the-media-resource:media-element-18>media element</a>'s <code id=loading-the-media-resource:dom-media-networkstate-5><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_loading-2><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.<li><p>⌛ <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-4>Queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-4>fire a simple event</a> named <code id=loading-the-media-resource:event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> at the <a href=#media-element id=loading-the-media-resource:media-element-19>media element</a>.<li>
- <p>Run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If <var>mode</var> is <i>object</i><dd>
- <ol><li><p>⌛ Set the <code id=loading-the-media-resource:dom-media-currentsrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to
- the empty string.<li><p>End the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-6>synchronous section</a>, continuing the remaining steps
- asynchronously.<li><p>Run the <a href=#concept-media-load-resource id=loading-the-media-resource:concept-media-load-resource>resource fetch algorithm</a>
- with the <a href=#assigned-media-provider-object id=loading-the-media-resource:assigned-media-provider-object-5>assigned media provider object</a>. If that algorithm returns without
- aborting <em>this</em> one, then the load failed.<li><p><i>Failed with media provider</i>: Reaching this step indicates that the media
- resource failed to load. <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-5>Queue a task</a> to run the <a href=#dedicated-media-source-failure-steps id=loading-the-media-resource:dedicated-media-source-failure-steps>dedicated media source
- failure steps</a>.<li><p>Wait for the <a href=#concept-task id=loading-the-media-resource:concept-task-4>task</a> queued by the previous step to have
- executed.<li><p>Abort these steps. The element won't attempt to load another resource until this
- algorithm is triggered again.</ol>
- <dt>If <var>mode</var> is <i>attribute</i><dd>
- <ol><li><p>⌛ If the <code id=loading-the-media-resource:attr-media-src-4><a href=#attr-media-src>src</a></code>
- attribute's value is the empty string, then end the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-7>synchronous section</a>, and jump
- down to the <i>failed with attribute</i> step below.<li><p>⌛ Let <var>absolute URL</var> be the <a href=#absolute-url id=loading-the-media-resource:absolute-url>absolute URL</a> that
- would have resulted from <a href=#resolve-a-url id=loading-the-media-resource:resolve-a-url>resolving</a> the <a href=#url id=loading-the-media-resource:url>URL</a>
- specified by the <code id=loading-the-media-resource:attr-media-src-5><a href=#attr-media-src>src</a></code> attribute's value relative to the
- <a href=#media-element id=loading-the-media-resource:media-element-20>media element</a> when the <code id=loading-the-media-resource:attr-media-src-6><a href=#attr-media-src>src</a></code> attribute was last
- changed.</p>
- <li><p>⌛ If <var>absolute URL</var> was obtained successfully, set the <code id=loading-the-media-resource:dom-media-currentsrc-2><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var>absolute
- URL</var>.<li><p>End the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-8>synchronous section</a>, continuing the remaining steps
- asynchronously.<li><p>If <var>absolute URL</var> was obtained successfully, run the <a href=#concept-media-load-resource id=loading-the-media-resource:concept-media-load-resource-2>resource fetch algorithm</a> with <var>absolute
- URL</var>. If that algorithm returns without aborting <em>this</em> one, then the load
- failed.<li><p><i>Failed with attribute</i>: Reaching this step indicates that the media resource
- failed to load or that the given <a href=#url id=loading-the-media-resource:url-2>URL</a> could not be <a href=#resolve-a-url id=loading-the-media-resource:resolve-a-url-2>resolved</a>. <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-6>Queue a task</a> to run the <a href=#dedicated-media-source-failure-steps id=loading-the-media-resource:dedicated-media-source-failure-steps-2>dedicated media source
- failure steps</a>.<li><p>Wait for the <a href=#concept-task id=loading-the-media-resource:concept-task-5>task</a> queued by the previous step to have
- executed.<li><p>Abort these steps. The element won't attempt to load another resource until this
- algorithm is triggered again.</ol>
- <dt>Otherwise (<var>mode</var> is <i>children</i>)<dd>
- <ol><li>
- <p>⌛ Let <var>pointer</var> be a position defined by two adjacent nodes in the
- <a href=#media-element id=loading-the-media-resource:media-element-21>media element</a>'s child list, treating the start of the list (before the first
- child in the list, if any) and end of the list (after the last child in the list, if any) as
- nodes in their own right. One node is the node before <var>pointer</var>, and the
- other node is the node after <var>pointer</var>. Initially, let <var>pointer</var> be the position between the <var>candidate</var> node and the
- next node, if there are any, or the end of the list, if it is the last node.</p>
- <p>As nodes are inserted and removed into the <a href=#media-element id=loading-the-media-resource:media-element-22>media element</a>, <var>pointer</var> must be updated as follows:</p>
- <dl><dt>If a new node is inserted between the two nodes that define <var>pointer</var><dd>Let <var>pointer</var> be the point between the node before <var>pointer</var> and the new node. In other words, insertions at <var>pointer</var> go after <var>pointer</var>.<dt>If the node before <var>pointer</var> is removed<dd>Let <var>pointer</var> be the point between the node after <var>pointer</var> and the node before the node after <var>pointer</var>. In
- other words, <var>pointer</var> doesn't move relative to the remaining nodes.<dt>If the node after <var>pointer</var> is removed<dd>Let <var>pointer</var> be the point between the node before <var>pointer</var> and the node after the node before <var>pointer</var>. Just
- as with the previous case, <var>pointer</var> doesn't move relative to the remaining
- nodes.</dl>
- <p>Other changes don't affect <var>pointer</var>.</p>
- <li><p>⌛ <i>Process candidate</i>: If <var>candidate</var> does not have a
- <code id=loading-the-media-resource:attr-source-src><a href=#attr-source-src>src</a></code> attribute, or if its <code id=loading-the-media-resource:attr-source-src-2><a href=#attr-source-src>src</a></code> attribute's value is the empty string, then end the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-9>synchronous section</a>, and jump down to the <i>failed with elements</i> step
- below.<li><p>⌛ Let <var>absolute URL</var> be the <a href=#absolute-url id=loading-the-media-resource:absolute-url-2>absolute URL</a> that
- would have resulted from <a href=#resolve-a-url id=loading-the-media-resource:resolve-a-url-3>resolving</a> the <a href=#url id=loading-the-media-resource:url-3>URL</a>
- specified by <var>candidate</var>'s <code id=loading-the-media-resource:attr-source-src-3><a href=#attr-source-src>src</a></code>
- attribute's value relative to the <var>candidate</var> when the <code id=loading-the-media-resource:attr-source-src-4><a href=#attr-source-src>src</a></code> attribute was last changed.</p>
- <li><p>⌛ If <var>absolute URL</var> was not obtained successfully, then end the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-10>synchronous section</a>, and jump down to the <i>failed with elements</i> step
- below.<li><p>⌛ If <var>candidate</var> has a <code id=loading-the-media-resource:attr-source-type><a href=#attr-source-type>type</a></code> attribute whose value, when parsed as a <a href=#mime-type id=loading-the-media-resource:mime-type>MIME
- type</a> (including any codecs described by the <code>codecs</code> parameter, for
- types that define that parameter), represents <a href=#a-type-that-the-user-agent-knows-it-cannot-render id=loading-the-media-resource:a-type-that-the-user-agent-knows-it-cannot-render>a type that the user agent knows it cannot
- render</a>, then end the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-11>synchronous section</a>, and jump down to the <i>failed with elements</i> step below.<li><p>⌛ Set the <code id=loading-the-media-resource:dom-media-currentsrc-3><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to <var>absolute URL</var>.<li><p>End the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-12>synchronous section</a>, continuing the remaining steps
- asynchronously.<li><p>Run the <a href=#concept-media-load-resource id=loading-the-media-resource:concept-media-load-resource-3>resource fetch algorithm</a> with
- <var>absolute URL</var>. If that algorithm returns without aborting <em>this</em> one,
- then the load failed.<li><p><i>Failed with elements</i>: <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-7>Queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-5>fire a simple
- event</a> named <code id=loading-the-media-resource:event-error><a href=#event-error>error</a></code> at the <var>candidate</var> element.<li><p>Asynchronously <a href=#await-a-stable-state id=loading-the-media-resource:await-a-stable-state-2>await a stable state</a>. The <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-13>synchronous section</a>
- consists of all the remaining steps of this algorithm until the algorithm says the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-14>synchronous section</a> has ended. (Steps in <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-15>synchronous sections</a> are marked with ⌛.)<li><p>⌛ <a href="#forget-the-media-element's-media-resource-specific-tracks" id="loading-the-media-resource:forget-the-media-element's-media-resource-specific-tracks-2">Forget the media element's media-resource-specific
- tracks</a>.<li><p>⌛ <i>Find next candidate</i>: Let <var>candidate</var> be
- null.<li><p>⌛ <i>Search loop</i>: If the node after <var>pointer</var> is
- the end of the list, then jump to the <i>waiting</i> step below.<li><p>⌛ If the node after <var>pointer</var> is a <code id=loading-the-media-resource:the-source-element-4><a href=#the-source-element>source</a></code> element,
- let <var>candidate</var> be that element.<li><p>⌛ Advance <var>pointer</var> so that the node before <var>pointer</var> is now the node that was after <var>pointer</var>, and the node
- after <var>pointer</var> is the node after the node that used to be after <var>pointer</var>, if any.<li><p>⌛ If <var>candidate</var> is null, jump back to the <i>search
- loop</i> step. Otherwise, jump back to the <i>process candidate</i> step.<li><p>⌛ <i>Waiting</i>: Set the element's <code id=loading-the-media-resource:dom-media-networkstate-6><a href=#dom-media-networkstate>networkState</a></code> attribute to the <code id=loading-the-media-resource:dom-media-network_no_source-2><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.<li><p>⌛ Set the element's <a href=#show-poster-flag id=loading-the-media-resource:show-poster-flag-2>show poster flag</a> to true.<li><p>⌛ <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-8>Queue a task</a> to set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-3>delaying-the-load-event
- flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-3>delaying the load
- event</a>.<li><p>End the <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-16>synchronous section</a>, continuing the remaining steps
- asynchronously.<li><p>Wait until the node after <var>pointer</var> is a node other than the end of
- the list. (This step might wait forever.)<li><p>Asynchronously <a href=#await-a-stable-state id=loading-the-media-resource:await-a-stable-state-3>await a stable state</a>. The <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-17>synchronous section</a>
- consists of all the remaining steps of this algorithm until the algorithm says the
- <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-18>synchronous section</a> has ended. (Steps in <a href=#synchronous-section id=loading-the-media-resource:synchronous-section-19>synchronous sections</a> are marked with ⌛.)<li><p>⌛ Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-4>delaying-the-load-event flag</a> back to true (this
- <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-4>delays the load event</a> again, in case it hasn't been
- fired yet).</p>
- <li><p>⌛ Set the <code id=loading-the-media-resource:dom-media-networkstate-7><a href=#dom-media-networkstate>networkState</a></code> back to <code id=loading-the-media-resource:dom-media-network_loading-3><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.<li><p>⌛ Jump back to the <i>find next candidate</i> step above.</ol>
- </dl>
- <p>The <dfn id=dedicated-media-source-failure-steps>dedicated media source failure steps</dfn> are the following steps:</p>
- <ol><li><p>Set the <code id=loading-the-media-resource:dom-media-error-2><a href=#dom-media-error>error</a></code> attribute to a new
- <code id=loading-the-media-resource:mediaerror><a href=#mediaerror>MediaError</a></code> object whose <code id=loading-the-media-resource:dom-mediaerror-code><a href=#dom-mediaerror-code>code</a></code> attribute
- is set to <code id=loading-the-media-resource:dom-mediaerror-media_err_src_not_supported><a href=#dom-mediaerror-media_err_src_not_supported>MEDIA_ERR_SRC_NOT_SUPPORTED</a></code>.<li><p><a href="#forget-the-media-element's-media-resource-specific-tracks" id="loading-the-media-resource:forget-the-media-element's-media-resource-specific-tracks-3">Forget the media element's media-resource-specific tracks</a>.<li><p>Set the element's <code id=loading-the-media-resource:dom-media-networkstate-8><a href=#dom-media-networkstate>networkState</a></code> attribute to
- the <code id=loading-the-media-resource:dom-media-network_no_source-3><a href=#dom-media-network_no_source>NETWORK_NO_SOURCE</a></code> value.<li><p>Set the element's <a href=#show-poster-flag id=loading-the-media-resource:show-poster-flag-3>show poster flag</a> to true.<li><p><a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-6>Fire a simple event</a> named <code id=loading-the-media-resource:event-media-error><a href=#event-media-error>error</a></code> at
- the <a href=#media-element id=loading-the-media-resource:media-element-23>media element</a>.<li><p>Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-5>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-5>delaying the load event</a>.</ol>
- </ol>
- <p>The <dfn id=concept-media-load-resource>resource fetch algorithm</dfn> for a <a href=#media-element id=loading-the-media-resource:media-element-24>media
- element</a> and a given <a href=#absolute-url id=loading-the-media-resource:absolute-url-3>absolute URL</a> or <a href=#media-provider-object id=loading-the-media-resource:media-provider-object>media provider object</a> is as
- follows:</p>
- <ol><li><p>If the algorithm was invoked with a <a href=#url id=loading-the-media-resource:url-4>URL</a>, then let <var>mode</var> be
- <i>remote</i>, otherwise let <var>mode</var> be <i>local</i>.<li><p>If <var>mode</var> is <i>local</i>, then let the <var>current media resource</var> be the
- resource given by the <a href=#absolute-url id=loading-the-media-resource:absolute-url-4>absolute URL</a> passed to this algorithm; otherwise, let the
- <var>current media resource</var> be the resource given by the <a href=#media-provider-object id=loading-the-media-resource:media-provider-object-2>media provider
- object</a>. Either way, the <var>current media resource</var> is now the element's <a href=#media-resource id=loading-the-media-resource:media-resource-3>media
- resource</a>.<li><p>Remove all <a href=#media-resource-specific-text-track id=loading-the-media-resource:media-resource-specific-text-track>media-resource-specific text
- tracks</a> from the <a href=#media-element id=loading-the-media-resource:media-element-25>media element</a>'s <a href=#list-of-pending-text-tracks id=loading-the-media-resource:list-of-pending-text-tracks>list of pending text tracks</a>, if
- any.</p>
- <li>
- <p>Run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If <var>mode</var> is remote<dd>
- <ol><li>
- <p>Optionally, run the following substeps. This is the expected behavior if the user agent
- intends to not attempt to fetch the resource until the user requests it explicitly (e.g. as
- a way to implement the <code id=loading-the-media-resource:attr-media-preload><a href=#attr-media-preload>preload</a></code> attribute's <code id=loading-the-media-resource:attr-media-preload-none><a href=#attr-media-preload-none>none</a></code> keyword).</p>
- <ol><li><p>Set the <code id=loading-the-media-resource:dom-media-networkstate-9><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_idle-2><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>.<li><p><a href=#queue-a-task id=loading-the-media-resource:queue-a-task-9>Queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-7>fire a simple event</a> named <code id=loading-the-media-resource:event-media-suspend><a href=#event-media-suspend>suspend</a></code> at the element.<li><p><a href=#queue-a-task id=loading-the-media-resource:queue-a-task-10>Queue a task</a> to set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-6>delaying-the-load-event flag</a>
- to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-6>delaying the load
- event</a>.<li><p>Wait for the task to be run.<li><p>Wait for an implementation-defined event (e.g. the user requesting that the media
- element begin playback).<li><p>Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-7>delaying-the-load-event flag</a> back to true (this <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-7>delays the load event</a> again, in case it hasn't been fired
- yet).</p>
- <li><p>Set the <code id=loading-the-media-resource:dom-media-networkstate-10><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_loading-4><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</ol>
- <li>
- <p>Perform a <a href=#potentially-cors-enabled-fetch id=loading-the-media-resource:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the <var>current media
- resource</var>'s <a href=#absolute-url id=loading-the-media-resource:absolute-url-5>absolute URL</a>, with the <i>mode</i> being the state of the
- <a href=#media-element id=loading-the-media-resource:media-element-26>media element</a>'s <code id=loading-the-media-resource:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content
- attribute, the <i>origin</i> being the <a href=#origin-2 id=loading-the-media-resource:origin-2>origin</a> of the <a href=#media-element id=loading-the-media-resource:media-element-27>media element</a>'s
- <a id=loading-the-media-resource:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the <i>default origin behaviour</i> set to <i>taint</i>.</p>
- <p>The resource obtained in this fashion, if any, contains the <a href=#media-data id=loading-the-media-resource:media-data>media data</a>. It can
- be <a href=#cors-same-origin id=loading-the-media-resource:cors-same-origin>CORS-same-origin</a> or <a href=#cors-cross-origin id=loading-the-media-resource:cors-cross-origin>CORS-cross-origin</a>; this affects whether
- subtitles referenced in the <a href=#media-data id=loading-the-media-resource:media-data-2>media data</a> are exposed in the API and, for
- <code id=loading-the-media-resource:the-video-element><a href=#the-video-element>video</a></code> elements, whether a <code id=loading-the-media-resource:the-canvas-element><a href=#the-canvas-element>canvas</a></code> gets tainted when the video is drawn
- on it.</p>
- <p>The <dfn id=stall-timeout>stall timeout</dfn> is a user-agent defined length of time, which should be about
- three seconds. When a <a href=#media-element id=loading-the-media-resource:media-element-28>media element</a> that is actively attempting to obtain
- <a href=#media-data id=loading-the-media-resource:media-data-3>media data</a> has failed to receive any data for a duration equal to the <a href=#stall-timeout id=loading-the-media-resource:stall-timeout>stall
- timeout</a>, the user agent must <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-11>queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-8>fire a simple
- event</a> named <code id=loading-the-media-resource:event-media-stalled><a href=#event-media-stalled>stalled</a></code> at the element.</p>
- <p>User agents may allow users to selectively block or slow <a href=#media-data id=loading-the-media-resource:media-data-4>media data</a> downloads.
- When a <a href=#media-element id=loading-the-media-resource:media-element-29>media element</a>'s download has been blocked altogether, the user agent must
- act as if it was stalled (as opposed to acting as if the connection was closed). The rate of the
- download may also be throttled automatically by the user agent, e.g. to balance the download
- with other connections sharing the same bandwidth.</p>
- <p id=resourceSuspend>User agents may decide to not download more content at any time, e.g.
- after buffering five minutes of a one hour media resource, while waiting for the user to decide
- whether to play the resource or not, while waiting for user input in an interactive resource, or
- when the user navigates away from the page. When a <a href=#media-element id=loading-the-media-resource:media-element-30>media element</a>'s download has
- been suspended, the user agent must <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-12>queue a task</a>, to set the <code id=loading-the-media-resource:dom-media-networkstate-11><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_idle-3><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-9>fire a simple event</a> named
- <code id=loading-the-media-resource:event-media-suspend-2><a href=#event-media-suspend>suspend</a></code> at the element. If and when downloading of the
- resource resumes, the user agent must <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-13>queue a task</a> to set the <code id=loading-the-media-resource:dom-media-networkstate-12><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_loading-5><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>. Between the queuing of these tasks,
- the load is suspended (so <code id=loading-the-media-resource:event-media-progress><a href=#event-media-progress>progress</a></code> events don't fire,
- as described above).</p>
- <p class=note>The <code id=loading-the-media-resource:attr-media-preload-2><a href=#attr-media-preload>preload</a></code> attribute provides a hint
- regarding how much buffering the author thinks is advisable, even in the absence of the <code id=loading-the-media-resource:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute.</p>
- <p>When a user agent decides to completely stall a download, e.g. if it is waiting until the
- user starts playback before downloading any further content, the user agent must <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-14>queue a
- task</a> to set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-8>delaying-the-load-event flag</a> to false. This stops
- <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-8>delaying the load event</a>.</p>
- <p>The user agent may use whatever means necessary to fetch the resource (within the constraints
- put forward by this and other specifications); for example, reconnecting to the server in the
- face of network errors, using HTTP range retrieval requests, or switching to a streaming
- protocol. The user agent must consider a resource erroneous only if it has given up trying to
- fetch it.</p>
- <p>To determine the format of the <a href=#media-resource id=loading-the-media-resource:media-resource-4>media resource</a>, the user agent must use the
- <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically id=loading-the-media-resource:content-type-sniffing:-video data-x-internal=content-type-sniffing:-video>rules for sniffing audio and video specifically</a>.</p>
- <p>While the load is not suspended (see below), every 350ms (±200ms) or for every byte
- received, whichever is <em>least</em> frequent, <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-15>queue a task</a> to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-10>fire a simple
- event</a> named <code id=loading-the-media-resource:event-media-progress-2><a href=#event-media-progress>progress</a></code> at the element.</p>
- <p>The <a href=#networking-task-source id=loading-the-media-resource:networking-task-source>networking task source</a> <a href=#concept-task id=loading-the-media-resource:concept-task-6>tasks</a> to
- process the data as it is being fetched must each immediately <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-16>queue a task</a> to
- run the first appropriate steps from the <a href=#media-data-processing-steps-list id=loading-the-media-resource:media-data-processing-steps-list>media data processing steps list</a>
- below. (A new task is used for this so that the work described below occurs relative to the
- <a href=#media-element-event-task-source id=loading-the-media-resource:media-element-event-task-source-2>media element event task source</a> rather than the <a href=#networking-task-source id=loading-the-media-resource:networking-task-source-2>networking task
- source</a>.)</p>
- <p>When the <a href=#networking-task-source id=loading-the-media-resource:networking-task-source-3>networking task source</a> has <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-17>queued</a> the
- last <a href=#concept-task id=loading-the-media-resource:concept-task-7>task</a> as part of <a href=#fetch id=loading-the-media-resource:fetch>fetching</a> the
- <a href=#media-resource id=loading-the-media-resource:media-resource-5>media resource</a> (i.e. once the download has completed), if the fetching process
- completes without errors, including decoding the media data, and if all of the data is available
- to the user agent without network access, then, the user agent must move on to the <i>final step</i> below.
- This might never happen, e.g. when streaming an infinite resource such as Web radio, or if the
- resource is longer than the user agent's ability to cache data.</p>
- <p>While the user agent might still need network access to obtain parts of the <a href=#media-resource id=loading-the-media-resource:media-resource-6>media
- resource</a>, the user agent must remain on this step.</p>
- <p class=example>For example, if the user agent has discarded the first half of a video, the
- user agent will remain at this step even once the <a href=#ended-playback id=loading-the-media-resource:ended-playback>playback has
- ended</a>, because there is always the chance the user will seek back to the start. In fact,
- in this situation, once <a href=#ended-playback id=loading-the-media-resource:ended-playback-2>playback has ended</a>, the user agent
- will end up firing a <code id=loading-the-media-resource:event-media-suspend-3><a href=#event-media-suspend>suspend</a></code> event, as described
- earlier.</p>
- </ol>
- <dt>Otherwise (<var>mode</var> is <i>local</i>)<dd>
- <p>The resource described by the <var>current media resource</var>, if any, contains the
- <a href=#media-data id=loading-the-media-resource:media-data-5>media data</a>. It is <a href=#cors-same-origin id=loading-the-media-resource:cors-same-origin-2>CORS-same-origin</a>. </p>
- <p>If the <var>current media resource</var> is a raw data stream (e.g. from a
- <code id=loading-the-media-resource:file><a href=#file>File</a></code> object), then to determine the format of the <a href=#media-resource id=loading-the-media-resource:media-resource-7>media resource</a>,
- the user agent must use the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-audio-and-video-specifically id=loading-the-media-resource:content-type-sniffing:-video-2 data-x-internal=content-type-sniffing:-video>rules for sniffing audio and video specifically</a>.
- Otherwise, if the data stream is pre-decoded, then the format is the format given by the
- relevant specification.</p>
- <p>Whenever new data for the <var>current media resource</var> becomes available, <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-18>queue
- a task</a> to run the first appropriate steps from the <a href=#media-data-processing-steps-list id=loading-the-media-resource:media-data-processing-steps-list-2>media data processing steps
- list</a> below.</p>
- <p>When the <var>current media resource</var> is permanently exhausted (e.g. all the bytes of
- a <code id=loading-the-media-resource:blob><a href=#blob>Blob</a></code> have been processed), if there were no decoding errors, then the user
- agent must move on to the <i>final step</i> below. This might never happen, e.g. if the
- <var>current media resource</var> is a <code id=loading-the-media-resource:mediastream><a href=#mediastream>MediaStream</a></code>.</p>
- </dl>
- <p>The <dfn id=media-data-processing-steps-list>media data processing steps list</dfn> is as follows:</p>
- <dl class=switch><dt>If the <a href=#media-data id=loading-the-media-resource:media-data-6>media data</a> cannot be fetched at all, due to network errors, causing the
- user agent to give up trying to fetch the resource<dt>If the <a href=#media-data id=loading-the-media-resource:media-data-7>media data</a> can be fetched but is found by inspection to be in an
- unsupported format, or can otherwise not be rendered at all<dd>
- <p>DNS errors, HTTP 4xx and 5xx errors (and equivalents in other protocols), and other fatal
- network errors that occur before the user agent has established whether the <var>current media resource</var> is usable, as well as the file using an unsupported
- container format, or using unsupported codecs for all the data, must cause the user agent to
- execute the following steps:</p>
- <ol><li><p>The user agent should cancel the fetching process.<li><p>Abort this subalgorithm, returning to the <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-3>resource selection algorithm</a>.</p>
- </ol>
- <dt id=found-another-audio-track>If the <a href=#media-resource id=loading-the-media-resource:media-resource-8>media resource</a> is found to have an audio
- track<dd>
- <ol><li><p>Create an <code id=loading-the-media-resource:audiotrack><a href=#audiotrack>AudioTrack</a></code> object to represent the audio track.<li><p>Update the <a href=#media-element id=loading-the-media-resource:media-element-31>media element</a>'s <code id=loading-the-media-resource:dom-media-audiotracks><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's <code id=loading-the-media-resource:audiotracklist><a href=#audiotracklist>AudioTrackList</a></code>
- object with the new <code id=loading-the-media-resource:audiotrack-2><a href=#audiotrack>AudioTrack</a></code> object.<li><p>Let <var>enable</var> be <i>unknown</i>.<li>
- <p>If either the <a href=#media-resource id=loading-the-media-resource:media-resource-9>media resource</a> or the address of the <var>current
- media resource</var> indicate a particular set of audio tracks to enable, or if the user
- agent has information that would facilitate the selection of specific audio tracks to
- improve the user's experience, then: if this audio track is one of the ones to enable, then
- set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var>
- to <i>false</i>.</p>
- <p class=example>This could be triggered by <cite>Media Fragments URI</cite> fragment
- identifier syntax, but it could also be triggered e.g. by the user agent selecting a 5.1
- surround sound audio track over a stereo audio track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <li><p>If <var>enable</var> is still <i>unknown</i>, then, if the <a href=#media-element id=loading-the-media-resource:media-element-32>media
- element</a> does not yet have an <a href=#dom-audiotrack-enabled id=loading-the-media-resource:dom-audiotrack-enabled>enabled</a>
- audio track, then set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var> to <i>false</i>.<li><p>If <var>enable</var> is <i>true</i>, then enable this audio track,
- otherwise, do not enable this audio track.<li><p><a href=#concept-event-fire id=loading-the-media-resource:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=loading-the-media-resource:concept-events-trusted>trusted</a> event with the name <code id=loading-the-media-resource:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable,
- and that uses the <code id=loading-the-media-resource:trackevent><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=loading-the-media-resource:dom-trackevent-track><a href=#dom-trackevent-track>track</a></code> attribute initialised to the new
- <code id=loading-the-media-resource:audiotrack-3><a href=#audiotrack>AudioTrack</a></code> object, at this <code id=loading-the-media-resource:audiotracklist-2><a href=#audiotracklist>AudioTrackList</a></code> object.</ol>
- <dt id=found-another-video-track>If the <a href=#media-resource id=loading-the-media-resource:media-resource-10>media resource</a> is found to have a video
- track<dd>
- <ol><li><p>Create a <code id=loading-the-media-resource:videotrack><a href=#videotrack>VideoTrack</a></code> object to represent the video track.<li><p>Update the <a href=#media-element id=loading-the-media-resource:media-element-33>media element</a>'s <code id=loading-the-media-resource:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's <code id=loading-the-media-resource:videotracklist><a href=#videotracklist>VideoTrackList</a></code>
- object with the new <code id=loading-the-media-resource:videotrack-2><a href=#videotrack>VideoTrack</a></code> object.<li><p>Let <var>enable</var> be <i>unknown</i>.<li>
- <p>If either the <a href=#media-resource id=loading-the-media-resource:media-resource-11>media resource</a> or the address of the <var>current
- media resource</var> indicate a particular set of video tracks to enable, or if the user
- agent has information that would facilitate the selection of specific video tracks to
- improve the user's experience, then: if this video track is the first such video track, then
- set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var>
- to <i>false</i>.</p>
- <p class=example>This could again be triggered by <cite>Media Fragments URI</cite>
- fragment identifier syntax.</p>
- <li><p>If <var>enable</var> is still <i>unknown</i>, then, if the <a href=#media-element id=loading-the-media-resource:media-element-34>media
- element</a> does not yet have a <a href=#dom-videotrack-selected id=loading-the-media-resource:dom-videotrack-selected>selected</a>
- video track, then set <var>enable</var> to <i>true</i>, otherwise, set <var>enable</var> to <i>false</i>.<li><p>If <var>enable</var> is <i>true</i>, then select this track and unselect any
- previously selected video tracks, otherwise, do not select this video track. If other tracks
- are unselected, then <a href=#toggle-video-track>a <code>change</code> event will be fired.</a><li><p><a href=#concept-event-fire id=loading-the-media-resource:concept-event-fire-2>Fire</a> a <a href=#concept-events-trusted id=loading-the-media-resource:concept-events-trusted-2>trusted</a> event with the name <code id=loading-the-media-resource:event-media-addtrack-2><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable,
- and that uses the <code id=loading-the-media-resource:trackevent-2><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=loading-the-media-resource:dom-trackevent-track-2><a href=#dom-trackevent-track>track</a></code> attribute initialised to the new
- <code id=loading-the-media-resource:videotrack-3><a href=#videotrack>VideoTrack</a></code> object, at this <code id=loading-the-media-resource:videotracklist-2><a href=#videotracklist>VideoTrackList</a></code> object.</ol>
- <dt id=getting-media-metadata>Once enough of the <a href=#media-data id=loading-the-media-resource:media-data-8>media data</a> has been fetched to
- determine the duration of the <a href=#media-resource id=loading-the-media-resource:media-resource-12>media resource</a>, its dimensions, and other
- metadata<dd>
- <p>This indicates that the resource is usable. The user agent must follow these substeps:</p>
- <ol><li>
- <p><a href=#defineTimeline id=loading-the-media-resource:defineTimeline>Establish the media timeline</a> for the purposes of the <a href=#current-playback-position id=loading-the-media-resource:current-playback-position-2>current playback
- position</a>, the <a href=#earliest-possible-position id=loading-the-media-resource:earliest-possible-position>earliest possible position</a>, and the <a href=#initial-playback-position id=loading-the-media-resource:initial-playback-position-2>initial playback
- position</a>, based on the <a href=#media-data id=loading-the-media-resource:media-data-9>media data</a>.</p>
- <li>
- <p>Update the <a href=#timeline-offset id=loading-the-media-resource:timeline-offset-2>timeline offset</a> to the date and time that corresponds to the zero
- time in the <a href=#media-timeline id=loading-the-media-resource:media-timeline>media timeline</a> established in the previous step, if any. If no
- explicit time and date is given by the <a href=#media-resource id=loading-the-media-resource:media-resource-13>media resource</a>, the <a href=#timeline-offset id=loading-the-media-resource:timeline-offset-3>timeline
- offset</a> must be set to Not-a-Number (NaN).</p>
- <li><p>Set the <a href=#current-playback-position id=loading-the-media-resource:current-playback-position-3>current playback position</a> and the <a href=#official-playback-position id=loading-the-media-resource:official-playback-position-3>official playback
- position</a> to the <a href=#earliest-possible-position id=loading-the-media-resource:earliest-possible-position-2>earliest possible position</a>.<li>
- <p>Update the <code id=loading-the-media-resource:dom-media-duration-2><a href=#dom-media-duration>duration</a></code> attribute with the time of
- the last frame of the resource, if known, on the <a href=#media-timeline id=loading-the-media-resource:media-timeline-2>media timeline</a> established
- above. If it is not known (e.g. a stream that is in principle infinite), update the <code id=loading-the-media-resource:dom-media-duration-3><a href=#dom-media-duration>duration</a></code> attribute to the value positive Infinity.</p>
- <p class=note>The user agent <a href=#durationChange>will</a> <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-19>queue a task</a>
- to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-11>fire a simple event</a> named <code id=loading-the-media-resource:event-media-durationchange-2><a href=#event-media-durationchange>durationchange</a></code> at the element at this point.</p>
- <li>
- <p>For <code id=loading-the-media-resource:the-video-element-2><a href=#the-video-element>video</a></code> elements, set the <code id=loading-the-media-resource:dom-video-videowidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code id=loading-the-media-resource:dom-video-videoheight><a href=#dom-video-videoheight>videoHeight</a></code> attributes, and <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-20>queue a task</a>
- to <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-12>fire a simple event</a> named <code id=loading-the-media-resource:event-media-resize><a href=#event-media-resize>resize</a></code> at
- the <a href=#media-element id=loading-the-media-resource:media-element-35>media element</a>.</p>
- <p class=note>Further <code id=loading-the-media-resource:event-media-resize-2><a href=#event-media-resize>resize</a></code> events will be fired
- if the dimensions subsequently change.</p>
- <li>
- <p>Set the <code id=loading-the-media-resource:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute to <code id=loading-the-media-resource:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>.</p>
- <p class=note>A <code id=loading-the-media-resource:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> DOM event
- <a href=#fire-loadedmetadata>will be fired</a> as part of setting the <code id=loading-the-media-resource:dom-media-readystate-3><a href=#dom-media-readystate>readyState</a></code> attribute to a new value.</p>
-
- <li><p>Let <var>jumped</var> be false.<li><p>If the <a href=#media-element id=loading-the-media-resource:media-element-36>media element</a>'s <a href=#default-playback-start-position id=loading-the-media-resource:default-playback-start-position>default playback start position</a> is
- greater than zero, then <a href=#dom-media-seek id=loading-the-media-resource:dom-media-seek>seek</a> to that time, and let <var>jumped</var> be true.<li><p>Let the <a href=#media-element id=loading-the-media-resource:media-element-37>media element</a>'s <a href=#default-playback-start-position id=loading-the-media-resource:default-playback-start-position-2>default playback
- start position</a> be zero.<li>
- <p>If either the <a href=#media-resource id=loading-the-media-resource:media-resource-14>media resource</a> or the address of the <var>current
- media resource</var> indicate a particular start time, then set the <a href=#initial-playback-position id=loading-the-media-resource:initial-playback-position-3>initial playback
- position</a> to that time and, if <var>jumped</var> is still false, <a href=#dom-media-seek id=loading-the-media-resource:dom-media-seek-2>seek</a> to that time and let <var>jumped</var> be
- true.</p>
- <p class=example>For example, with media formats that support the <cite>Media Fragments
- URI</cite> fragment identifier syntax, the fragment identifier can be used to indicate a
- start position. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <li><p>If there is no <a href=#dom-audiotrack-enabled id=loading-the-media-resource:dom-audiotrack-enabled-2>enabled</a> audio track, then
- enable an audio track. This <a href=#toggle-audio-track>will cause a <code>change</code> event to be fired</a>.<li><p>If there is no <a href=#dom-videotrack-selected id=loading-the-media-resource:dom-videotrack-selected-2>selected</a> video track,
- then select a video track. This <a href=#toggle-video-track>will cause a <code>change</code> event to be fired</a>.<li><p>If the <a href=#media-element id=loading-the-media-resource:media-element-38>media element</a> has a <a href=#current-media-controller id=loading-the-media-resource:current-media-controller>current media controller</a>, then:
- if <var>jumped</var> is true and the <a href=#initial-playback-position id=loading-the-media-resource:initial-playback-position-4>initial playback position</a>,
- relative to the <a href=#current-media-controller id=loading-the-media-resource:current-media-controller-2>current media controller</a>'s timeline, is greater than the
- <a href=#current-media-controller id=loading-the-media-resource:current-media-controller-3>current media controller</a>'s <a href=#media-controller-position id=loading-the-media-resource:media-controller-position>media controller position</a>, then
- <a href=#seek-the-media-controller id=loading-the-media-resource:seek-the-media-controller>seek the media controller</a> to the <a href=#media-element id=loading-the-media-resource:media-element-39>media element</a>'s <a href=#initial-playback-position id=loading-the-media-resource:initial-playback-position-5>initial
- playback position</a>, relative to the <a href=#current-media-controller id=loading-the-media-resource:current-media-controller-4>current media controller</a>'s timeline;
- otherwise, <a href=#dom-media-seek id=loading-the-media-resource:dom-media-seek-3>seek</a> the <a href=#media-element id=loading-the-media-resource:media-element-40>media element</a> to the
- <a href=#media-controller-position id=loading-the-media-resource:media-controller-position-2>media controller position</a>, relative to the <a href=#media-element id=loading-the-media-resource:media-element-41>media element</a>'s
- timeline.</ol>
- <p>Once the <code id=loading-the-media-resource:dom-media-readystate-4><a href=#dom-media-readystate>readyState</a></code> attribute reaches <code id=loading-the-media-resource:dom-media-have_current_data><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, <a href=#fire-loadeddata>after
- the <code>loadeddata</code> event has been fired</a>, set the
- element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-9>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-9>delaying the load event</a>.</p>
- <p class=note>A user agent that is attempting to reduce network usage while still fetching
- the metadata for each <a href=#media-resource id=loading-the-media-resource:media-resource-15>media resource</a> would also stop buffering at this point,
- following <a href=#resourceSuspend>the rules described previously</a>, which involve the
- <code id=loading-the-media-resource:dom-media-networkstate-13><a href=#dom-media-networkstate>networkState</a></code> attribute switching to the <code id=loading-the-media-resource:dom-media-network_idle-4><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value and a <code id=loading-the-media-resource:event-media-suspend-4><a href=#event-media-suspend>suspend</a></code> event firing.</p>
- <p class=note>The user agent is <em>required</em> to determine the duration of the
- <a href=#media-resource id=loading-the-media-resource:media-resource-16>media resource</a> and go through this step before playing.</p>
- <dt>Once the entire <a href=#media-resource id=loading-the-media-resource:media-resource-17>media resource</a> has been <a href=#fetch id=loading-the-media-resource:fetch-2>fetched</a>
- (but potentially before any of it has been decoded)<dd>
- <p><a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-13>Fire a simple event</a> named <code id=loading-the-media-resource:event-media-progress-3><a href=#event-media-progress>progress</a></code>
- at the <a href=#media-element id=loading-the-media-resource:media-element-42>media element</a>.</p>
- <p>Set the <code id=loading-the-media-resource:dom-media-networkstate-14><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_idle-5><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> and <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-14>fire a simple event</a> named
- <code id=loading-the-media-resource:event-media-suspend-5><a href=#event-media-suspend>suspend</a></code> at the <a href=#media-element id=loading-the-media-resource:media-element-43>media element</a>.</p>
- <p>If the user agent ever discards any <a href=#media-data id=loading-the-media-resource:media-data-10>media data</a> and then needs to resume the
- network activity to obtain it again, then it must <a href=#queue-a-task id=loading-the-media-resource:queue-a-task-21>queue a task</a> to set the <code id=loading-the-media-resource:dom-media-networkstate-15><a href=#dom-media-networkstate>networkState</a></code> to <code id=loading-the-media-resource:dom-media-network_loading-6><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.</p>
- <p class=note>If the user agent can keep the <a href=#media-resource id=loading-the-media-resource:media-resource-18>media resource</a> loaded, then the
- algorithm will continue to its <i>final step</i> below, which aborts the algorithm.</p>
- <dt>If the connection is interrupted after some <a href=#media-data id=loading-the-media-resource:media-data-11>media data</a> has been received,
- causing the user agent to give up trying to fetch the resource<dd>
- <p>Fatal network errors that occur after the user agent has established whether the <var>current media resource</var> is usable (i.e. once the <a href=#media-element id=loading-the-media-resource:media-element-44>media element</a>'s
- <code id=loading-the-media-resource:dom-media-readystate-5><a href=#dom-media-readystate>readyState</a></code> attribute is no longer <code id=loading-the-media-resource:dom-media-have_nothing-2><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>) must cause the user agent to execute the
- following steps:</p>
- <ol><li><p>The user agent should cancel the fetching process.<li><p>Set the <code id=loading-the-media-resource:dom-media-error-3><a href=#dom-media-error>error</a></code> attribute to a new
- <code id=loading-the-media-resource:mediaerror-2><a href=#mediaerror>MediaError</a></code> object whose <code id=loading-the-media-resource:dom-mediaerror-code-2><a href=#dom-mediaerror-code>code</a></code> attribute
- is set to <code id=loading-the-media-resource:dom-mediaerror-media_err_network><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code>.<li><p>Set the element's <code id=loading-the-media-resource:dom-media-networkstate-16><a href=#dom-media-networkstate>networkState</a></code> attribute
- to the <code id=loading-the-media-resource:dom-media-network_idle-6><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.<li><p>Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-10>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-10>delaying the load event</a>.<li><p><a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-15>Fire a simple event</a> named <code id=loading-the-media-resource:event-media-error-2><a href=#event-media-error>error</a></code> at
- the <a href=#media-element id=loading-the-media-resource:media-element-45>media element</a>.<li><p>Abort the overall <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-4>resource selection
- algorithm</a>.</ol>
- <dt id=fatal-decode-error>If the <a href=#media-data id=loading-the-media-resource:media-data-12>media data</a> is corrupted<dd>
- <p>Fatal errors in decoding the <a href=#media-data id=loading-the-media-resource:media-data-13>media data</a> that occur after the user agent has
- established whether the <var>current media resource</var> is usable (i.e. once the <a href=#media-element id=loading-the-media-resource:media-element-46>media element</a>'s
- <code id=loading-the-media-resource:dom-media-readystate-6><a href=#dom-media-readystate>readyState</a></code> attribute is no longer <code id=loading-the-media-resource:dom-media-have_nothing-3><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>) must cause the
- user agent to execute the following steps:</p>
-
- <ol><li><p>The user agent should cancel the fetching process.<li><p>Set the <code id=loading-the-media-resource:dom-media-error-4><a href=#dom-media-error>error</a></code> attribute to a new
- <code id=loading-the-media-resource:mediaerror-3><a href=#mediaerror>MediaError</a></code> object whose <code id=loading-the-media-resource:dom-mediaerror-code-3><a href=#dom-mediaerror-code>code</a></code> attribute
- is set to <code id=loading-the-media-resource:dom-mediaerror-media_err_decode><a href=#dom-mediaerror-media_err_decode>MEDIA_ERR_DECODE</a></code>.<li><p>Set the element's <code id=loading-the-media-resource:dom-media-networkstate-17><a href=#dom-media-networkstate>networkState</a></code> attribute
- to the <code id=loading-the-media-resource:dom-media-network_idle-7><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.<li><p>Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-11>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-11>delaying the load event</a>.<li><p><a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-16>Fire a simple event</a> named <code id=loading-the-media-resource:event-media-error-3><a href=#event-media-error>error</a></code> at
- the <a href=#media-element id=loading-the-media-resource:media-element-47>media element</a>.<li><p>Abort the overall <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-5>resource selection
- algorithm</a>.</ol>
- <dt>If the <a href=#media-data id=loading-the-media-resource:media-data-14>media data</a> fetching process is aborted by the user<dd>
- <p>The fetching process is aborted by the user, e.g. because the user
- pressed a "stop" button, the user agent must execute the following steps. These steps are not
- followed if the <code id=loading-the-media-resource:dom-media-load-2><a href=#dom-media-load>load()</a></code> method itself is invoked while
- these steps are running, as the steps above handle that particular kind of abort.</p>
- <ol><li><p>The user agent should cancel the fetching process.<li><p>Set the <code id=loading-the-media-resource:dom-media-error-5><a href=#dom-media-error>error</a></code> attribute to a new
- <code id=loading-the-media-resource:mediaerror-4><a href=#mediaerror>MediaError</a></code> object whose <code id=loading-the-media-resource:dom-mediaerror-code-4><a href=#dom-mediaerror-code>code</a></code> attribute
- is set to <code id=loading-the-media-resource:dom-mediaerror-media_err_aborted><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>.<li><p><a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-17>Fire a simple event</a> named <code id=loading-the-media-resource:event-media-abort-2><a href=#event-media-abort>abort</a></code> at
- the <a href=#media-element id=loading-the-media-resource:media-element-48>media element</a>.<li>
- <p>If the <a href=#media-element id=loading-the-media-resource:media-element-49>media element</a>'s <code id=loading-the-media-resource:dom-media-readystate-7><a href=#dom-media-readystate>readyState</a></code>
- attribute has a value equal to <code id=loading-the-media-resource:dom-media-have_nothing-4><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, set
- the element's <code id=loading-the-media-resource:dom-media-networkstate-18><a href=#dom-media-networkstate>networkState</a></code> attribute to the
- <code id=loading-the-media-resource:dom-media-network_empty-3><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> value, set the element's
- <a href=#show-poster-flag id=loading-the-media-resource:show-poster-flag-4>show poster flag</a> to true, and <a href=#fire-a-simple-event id=loading-the-media-resource:fire-a-simple-event-18>fire a simple event</a> named <code id=loading-the-media-resource:event-media-emptied-2><a href=#event-media-emptied>emptied</a></code> at the element.</p>
- <p>Otherwise, set the element's <code id=loading-the-media-resource:dom-media-networkstate-19><a href=#dom-media-networkstate>networkState</a></code>
- attribute to the <code id=loading-the-media-resource:dom-media-network_idle-8><a href=#dom-media-network_idle>NETWORK_IDLE</a></code> value.</p>
- <li><p>Set the element's <a href=#delaying-the-load-event-flag id=loading-the-media-resource:delaying-the-load-event-flag-12>delaying-the-load-event flag</a> to false. This stops <a href=#delay-the-load-event id=loading-the-media-resource:delay-the-load-event-12>delaying the load event</a>.<li><p>Abort the overall <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-6>resource selection
- algorithm</a>.</ol>
- <dt id=non-fatal-media-error>If the <a href=#media-data id=loading-the-media-resource:media-data-15>media data</a> can be fetched but has non-fatal
- errors or uses, in part, codecs that are unsupported, preventing the user agent from rendering
- the content completely correctly but not preventing playback altogether<dd>
- <p>The server returning data that is partially usable but cannot be optimally rendered must
- cause the user agent to render just the bits it can handle, and ignore the rest.</p>
-
- <dt id=found-a-media-resource-specific-timed-track>If the <a href=#media-resource id=loading-the-media-resource:media-resource-19>media resource</a> is
- found to declare a <a href=#media-resource-specific-text-track id=loading-the-media-resource:media-resource-specific-text-track-2>media-resource-specific text track</a> that the user agent
- supports<dd>
- <p>If the <a href=#media-data id=loading-the-media-resource:media-data-16>media data</a> is <a href=#cors-same-origin id=loading-the-media-resource:cors-same-origin-3>CORS-same-origin</a>, run the <a href=#steps-to-expose-a-media-resource-specific-text-track id=loading-the-media-resource:steps-to-expose-a-media-resource-specific-text-track>steps to
- expose a media-resource-specific text track</a> with the relevant data.</p>
- <p class=note>Cross-origin videos do not expose their subtitles, since that would allow
- attacks such as hostile sites reading subtitles from confidential videos on a user's
- intranet.</p>
- </dl>
- <li><p><i>Final step:</i> If the user agent ever reaches this step (which can only happen if the entire resource
- gets loaded and kept available): abort the overall <a href=#concept-media-load-algorithm id=loading-the-media-resource:concept-media-load-algorithm-7>resource selection algorithm</a>.</ol>
- <p>When a <a href=#media-element id=loading-the-media-resource:media-element-50>media element</a> is to <dfn id="forget-the-media-element's-media-resource-specific-tracks">forget the media element's media-resource-specific
- tracks</dfn>, the user agent must remove from the <a href=#media-element id=loading-the-media-resource:media-element-51>media element</a>'s <a href=#list-of-text-tracks id=loading-the-media-resource:list-of-text-tracks>list of text
- tracks</a> all the <a href=#media-resource-specific-text-track id=loading-the-media-resource:media-resource-specific-text-track-3>media-resource-specific
- text tracks</a>, then empty the <a href=#media-element id=loading-the-media-resource:media-element-52>media element</a>'s <code id=loading-the-media-resource:dom-media-audiotracks-2><a href=#dom-media-audiotracks>audioTracks</a></code> attribute's <code id=loading-the-media-resource:audiotracklist-3><a href=#audiotracklist>AudioTrackList</a></code> object,
- then empty the <a href=#media-element id=loading-the-media-resource:media-element-53>media element</a>'s <code id=loading-the-media-resource:dom-media-videotracks-2><a href=#dom-media-videotracks>videoTracks</a></code>
- attribute's <code id=loading-the-media-resource:videotracklist-3><a href=#videotracklist>VideoTrackList</a></code> object. No events (in particular, no <code id=loading-the-media-resource:event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code> events) are fired as part of this; the <code id=loading-the-media-resource:event-media-error-4><a href=#event-media-error>error</a></code> and <code id=loading-the-media-resource:event-media-emptied-3><a href=#event-media-emptied>emptied</a></code>
- events, fired by the algorithms that invoke this one, can be used instead.</p>
-
- <hr>
- <p>The <dfn id=attr-media-preload><code>preload</code></dfn> attribute is an <a href=#enumerated-attribute id=loading-the-media-resource:enumerated-attribute>enumerated
- attribute</a>. The following table lists the keywords and states for the attribute — the
- keywords in the left column map to the states in the cell in the second column on the same row as
- the keyword. The attribute can be changed even once the <a href=#media-resource id=loading-the-media-resource:media-resource-20>media resource</a> is being
- buffered or played; the descriptions in the table below are to be interpreted with that in
- mind.</p>
- <table><thead><tr><th> Keyword
- <th> State
- <th> Brief description
- <tbody><tr><td><dfn id=attr-media-preload-none><code>none</code></dfn>
- <td><dfn id=attr-media-preload-none-state>None</dfn>
- <td>Hints to the user agent that either the author does not expect the user to need the media resource, or that the server wants to minimise unnecessary traffic.
- This state does not provide a hint regarding how aggressively to actually download the media resource if buffering starts anyway (e.g. once the user hits "play").
- <tr><td><dfn id=attr-media-preload-metadata><code>metadata</code></dfn>
- <td><dfn id=attr-media-preload-metadata-state>Metadata</dfn>
- <td>Hints to the user agent that the author does not expect the user to need the media resource, but that fetching the resource metadata (dimensions, track list, duration, etc), and maybe even the first few frames, is reasonable. If the user agent precisely fetches no more than the metadata, then the <a href=#media-element id=loading-the-media-resource:media-element-54>media element</a> will end up with its <code id=loading-the-media-resource:dom-media-readystate-8><a href=#dom-media-readystate>readyState</a></code> attribute set to <code id=loading-the-media-resource:dom-media-have_metadata-2><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>; typically though, some frames will be obtained as well and it will probably be <code id=loading-the-media-resource:dom-media-have_current_data-2><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or <code id=loading-the-media-resource:dom-media-have_future_data><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>.
- When the media resource is playing, hints to the user agent that bandwidth is to be considered scarce, e.g. suggesting throttling the download so that the media data is obtained at the slowest possible rate that still maintains consistent playback.
- <tr><td><dfn id=attr-media-preload-auto><code>auto</code></dfn>
- <td><dfn id=attr-media-preload-auto-state>Automatic</dfn>
- <td>Hints to the user agent that the user agent can put the user's needs first without risk to the server, up to and including optimistically downloading the entire resource.
- </table>
- <p>The empty string is also a valid keyword, and maps to the <a href=#attr-media-preload-auto-state id=loading-the-media-resource:attr-media-preload-auto-state>Automatic</a> state. The attribute's <i id=loading-the-media-resource:missing-value-default><a href=#missing-value-default>missing value default</a></i> is user-agent defined, though the <a href=#attr-media-preload-metadata-state id=loading-the-media-resource:attr-media-preload-metadata-state>Metadata</a> state is suggested as a compromise
- between reducing server load and providing an optimal user experience.</p>
- <p class=note>Authors might switch the attribute from "<code id=loading-the-media-resource:attr-media-preload-none-2><a href=#attr-media-preload-none>none</a></code>" or "<code id=loading-the-media-resource:attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>" to "<code id=loading-the-media-resource:attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>" dynamically once the user begins playback. For
- example, on a page with many videos this might be used to indicate that the many videos are not to
- be downloaded unless requested, but that once one <em>is</em> requested it is to be downloaded
- aggressively.</p>
-
- <p>The <code id=loading-the-media-resource:attr-media-preload-3><a href=#attr-media-preload>preload</a></code> attribute is intended to provide a hint to
- the user agent about what the author thinks will lead to the best user experience. The attribute
- may be ignored altogether, for example based on explicit user preferences or based on the
- available connectivity.</p>
- <p>The <dfn id=dom-media-preload><code>preload</code></dfn> IDL attribute must
- <a href=#reflect id=loading-the-media-resource:reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values id=loading-the-media-resource:limited-to-only-known-values>limited to only known
- values</a>.</p>
-
- <p class=note>The <code id=loading-the-media-resource:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code> attribute can override the
- <code id=loading-the-media-resource:attr-media-preload-4><a href=#attr-media-preload>preload</a></code> attribute (since if the media plays, it naturally
- has to buffer first, regardless of the hint given by the <code id=loading-the-media-resource:attr-media-preload-5><a href=#attr-media-preload>preload</a></code> attribute). Including both is not an error, however.</p>
- <hr>
- <dl class=domintro><dt><var>media</var> . <code id=loading-the-media-resource:dom-media-buffered><a href=#dom-media-buffered>buffered</a></code><dd>
- <p>Returns a <code id=loading-the-media-resource:timeranges><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource id=loading-the-media-resource:media-resource-21>media
- resource</a> that the user agent has buffered.</p>
- </dl>
-
- <p>The <dfn id=dom-media-buffered><code>buffered</code></dfn> attribute must return a new
- static <a href=#normalised-timeranges-object id=loading-the-media-resource:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the ranges of the
- <a href=#media-resource id=loading-the-media-resource:media-resource-22>media resource</a>, if any, that the user agent has buffered, at the time the attribute
- is evaluated. Users agents must accurately determine the ranges available, even for media streams
- where this can only be determined by tedious inspection.</p>
- <p class=note>Typically this will be a single range anchored at the zero point, but if, e.g. the
- user agent uses HTTP range requests in response to seeking, then there could be multiple
- ranges.</p>
- <p>User agents may discard previously buffered data.</p>
- <p class=note>Thus, a time position included within a range of the objects return by the <code id=loading-the-media-resource:dom-media-buffered-2><a href=#dom-media-buffered>buffered</a></code> attribute at one time can end up being not included in
- the range(s) of objects returned by the same attribute at later times.</p>
-
- <h5 id=offsets-into-the-media-resource>4.8.14.6 Offsets into the media resource</h5>
- <dl class=domintro><dt><var>media</var> . <code id=offsets-into-the-media-resource:dom-media-duration><a href=#dom-media-duration>duration</a></code><dd>
- <p>Returns the length of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource>media resource</a>, in seconds, assuming that the start of
- the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-2>media resource</a> is at time zero.</p>
- <p>Returns NaN if the duration isn't available.</p>
- <p>Returns Infinity for unbounded streams.</p>
- <dt><var>media</var> . <code id=offsets-into-the-media-resource:dom-media-currenttime><a href=#dom-media-currenttime>currentTime</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#official-playback-position id=offsets-into-the-media-resource:official-playback-position>official playback position</a>, in seconds.</p>
- <p>Can be set, to seek to the given time.</p>
- <p>Will throw an <code id=offsets-into-the-media-resource:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if there is no selected <a href=#media-resource id=offsets-into-the-media-resource:media-resource-3>media
- resource</a> or if there is a <a href=#current-media-controller id=offsets-into-the-media-resource:current-media-controller>current media controller</a>.</p>
- </dl>
-
- <p>A <a href=#media-resource id=offsets-into-the-media-resource:media-resource-4>media resource</a> has a <dfn id=media-timeline>media timeline</dfn> that maps times (in seconds) to
- positions in the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-5>media resource</a>. The origin of a timeline is its earliest defined
- position. The duration of a timeline is its last defined position.</p>
- <p><dfn id=defineTimeline>Establishing the media
- timeline</dfn>: If the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-6>media resource</a> somehow specifies an explicit timeline whose
- origin is not negative (i.e. gives each frame a specific time offset and gives the first frame a
- zero or positive offset), then the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline>media timeline</a> should be that timeline. (Whether
- the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-7>media resource</a> can specify a timeline or not depends on the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-8>media resource's</a> format.) If the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-9>media resource</a> specifies an
- explicit start time <em>and date</em>, then that time and date should be considered the zero point
- in the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-2>media timeline</a>; the <a href=#timeline-offset id=offsets-into-the-media-resource:timeline-offset>timeline offset</a> will be the time and date,
- exposed using the <code id=offsets-into-the-media-resource:dom-media-getstartdate><a href=#dom-media-getstartdate>getStartDate()</a></code> method.</p>
- <p>If the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-10>media resource</a> has a discontinuous timeline, the user agent must extend the
- timeline used at the start of the resource across the entire resource, so that the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-3>media
- timeline</a> of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-11>media resource</a> increases linearly starting from the
- <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position>earliest possible position</a> (as defined below), even if the underlying <a href=#media-data id=offsets-into-the-media-resource:media-data>media
- data</a> has out-of-order or even overlapping time codes.</p>
- <p class=example>For example, if two clips have been concatenated into one video file, but the
- video format exposes the original times for the two clips, the video data might expose a timeline
- that goes, say, 00:15..00:29 and then 00:05..00:38. However, the user agent would not expose those
- times; it would instead expose the times as 00:15..00:29 and 00:29..01:02, as a single video.</p>
- <p>In the rare case of a <a href=#media-resource id=offsets-into-the-media-resource:media-resource-12>media resource</a> that does not have an explicit timeline, the
- zero time on the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-4>media timeline</a> should correspond to the first frame of the
- <a href=#media-resource id=offsets-into-the-media-resource:media-resource-13>media resource</a>. In the even rarer case of a <a href=#media-resource id=offsets-into-the-media-resource:media-resource-14>media resource</a> with no
- explicit timings of any kind, not even frame durations, the user agent must itself determine the
- time for each frame in a user-agent-defined manner.
- <a href=#fingerprinting-vector id=offsets-into-the-media-resource:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p class=note>An example of a file format with no explicit timeline but with explicit frame
- durations is the Animated GIF format. An example of a file format with no explicit timings at all
- is the JPEG-push format (<code id=offsets-into-the-media-resource:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> with JPEG frames, often
- used as the format for MJPEG streams).</p>
- <p>If, in the case of a resource with no timing information, the user agent will nonetheless be
- able to seek to an earlier point than the first frame originally provided by the server, then the
- zero time should correspond to the earliest seekable time of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-15>media resource</a>;
- otherwise, it should correspond to the first frame received from the server (the point in the
- <a href=#media-resource id=offsets-into-the-media-resource:media-resource-16>media resource</a> at which the user agent began receiving the stream).</p>
- <p class=note>At the time of writing, there is no known format that lacks explicit frame time
- offsets yet still supports seeking to a frame before the first frame sent by the server.</p>
- <div class=example>
- <p>Consider a stream from a TV broadcaster, which begins streaming on a sunny Friday afternoon in
- October, and always sends connecting user agents the media data on the same media timeline, with
- its zero time set to the start of this stream. Months later, user agents connecting to this
- stream will find that the first frame they receive has a time with millions of seconds. The <code id=offsets-into-the-media-resource:dom-media-getstartdate-2><a href=#dom-media-getstartdate>getStartDate()</a></code> method would always return the date that the
- broadcast started; this would allow controllers to display real times in their scrubber (e.g.
- "2:30pm") rather than a time relative to when the broadcast began ("8 months, 4 hours, 12
- minutes, and 23 seconds").</p>
- <p>Consider a stream that carries a video with several concatenated fragments, broadcast by a
- server that does not allow user agents to request specific times but instead just streams the
- video data in a predetermined order, with the first frame delivered always being identified as
- the frame with time zero. If a user agent connects to this stream and receives fragments defined
- as covering timestamps 2010-03-20 23:15:00 UTC to 2010-03-21 00:05:00 UTC and 2010-02-12 14:25:00
- UTC to 2010-02-12 14:35:00 UTC, it would expose this with a <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-5>media timeline</a> starting
- at 0s and extending to 3,600s (one hour). Assuming the streaming server disconnected at the end
- of the second clip, the <code id=offsets-into-the-media-resource:dom-media-duration-2><a href=#dom-media-duration>duration</a></code> attribute would then
- return 3,600. The <code id=offsets-into-the-media-resource:dom-media-getstartdate-3><a href=#dom-media-getstartdate>getStartDate()</a></code> method would return a
- <code id=offsets-into-the-media-resource:idl-date><a href=#idl-date>Date</a></code> object with a time corresponding to 2010-03-20 23:15:00 UTC. However, if a
- different user agent connected five minutes later, <em>it</em> would (presumably) receive
- fragments covering timestamps 2010-03-20 23:20:00 UTC to 2010-03-21 00:05:00 UTC and 2010-02-12
- 14:25:00 UTC to 2010-02-12 14:35:00 UTC, and would expose this with a <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-6>media timeline</a>
- starting at 0s and extending to 3,300s (fifty five minutes). In this case, the <code id=offsets-into-the-media-resource:dom-media-getstartdate-4><a href=#dom-media-getstartdate>getStartDate()</a></code> method would return a <code id=offsets-into-the-media-resource:idl-date-2><a href=#idl-date>Date</a></code> object
- with a time corresponding to 2010-03-20 23:20:00 UTC.</p>
- <p>In both of these examples, the <code id=offsets-into-the-media-resource:dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> attribute
- would give the ranges that the controller would want to actually display in its UI; typically, if
- the servers don't support seeking to arbitrary times, this would be the range of time from the
- moment the user agent connected to the stream up to the latest frame that the user agent has
- obtained; however, if the user agent starts discarding earlier information, the actual range
- might be shorter.</p>
- </div>
- <p>In any case, the user agent must ensure that the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-2>earliest possible position</a> (as
- defined below) using the established <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-7>media timeline</a>, is greater than or equal to
- zero.</p>
- <p>The <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-8>media timeline</a> also has an associated clock. Which clock is used is user-agent
- defined, and may be <a href=#media-resource id=offsets-into-the-media-resource:media-resource-17>media resource</a>-dependent, but it should approximate the user's
- wall clock.</p>
- <p class=note>All the <a href=#media-element id=offsets-into-the-media-resource:media-element>media elements</a> that share <a href=#current-media-controller id=offsets-into-the-media-resource:current-media-controller-2>current
- media controller</a> use the same clock for their <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-9>media timeline</a>.</p>
- <p><a href=#media-element id=offsets-into-the-media-resource:media-element-2>Media elements</a> have a <dfn id=current-playback-position>current playback position</dfn>,
- which must initially (i.e. in the absence of <a href=#media-data id=offsets-into-the-media-resource:media-data-2>media data</a>) be zero seconds. The
- <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position>current playback position</a> is a time on the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-10>media timeline</a>.</p>
- <p><a href=#media-element id=offsets-into-the-media-resource:media-element-3>Media elements</a> also have an <dfn id=official-playback-position>official playback
- position</dfn>, which must initially be set to zero seconds. The <a href=#official-playback-position id=offsets-into-the-media-resource:official-playback-position-2>official playback
- position</a> is an approximation of the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-2>current playback position</a> that is kept
- stable while scripts are running.</p>
- <p><a href=#media-element id=offsets-into-the-media-resource:media-element-4>Media elements</a> also have a <dfn id=default-playback-start-position>default playback start
- position</dfn>, which must initially be set to zero seconds. This time is used to allow the
- element to be seeked even before the media is loaded.</p>
- <p>Each <a href=#media-element id=offsets-into-the-media-resource:media-element-5>media element</a> has a <dfn id=show-poster-flag>show poster flag</dfn>. When a <a href=#media-element id=offsets-into-the-media-resource:media-element-6>media
- element</a> is created, this flag must be set to true. This flag is used to control when the
- user agent is to show a poster frame for a <code id=offsets-into-the-media-resource:the-video-element><a href=#the-video-element>video</a></code> element instead of showing the video
- contents.</p>
- <p>The <dfn id=dom-media-currenttime><code>currentTime</code></dfn> attribute must, on
- getting, return the <a href=#media-element id=offsets-into-the-media-resource:media-element-7>media element</a>'s <a href=#default-playback-start-position id=offsets-into-the-media-resource:default-playback-start-position>default playback start position</a>,
- unless that is zero, in which case it must return the element's <a href=#official-playback-position id=offsets-into-the-media-resource:official-playback-position-3>official playback
- position</a>. The returned value must be expressed in seconds. On setting, if the <a href=#media-element id=offsets-into-the-media-resource:media-element-8>media
- element</a> has a <a href=#current-media-controller id=offsets-into-the-media-resource:current-media-controller-3>current media controller</a>, then the user agent must throw an
- <code id=offsets-into-the-media-resource:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception; otherwise, if the <a href=#media-element id=offsets-into-the-media-resource:media-element-9>media element</a>'s <code id=offsets-into-the-media-resource:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> is <code id=offsets-into-the-media-resource:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, then it must set the <a href=#media-element id=offsets-into-the-media-resource:media-element-10>media
- element</a>'s <a href=#default-playback-start-position id=offsets-into-the-media-resource:default-playback-start-position-2>default playback start position</a> to the new value; otherwise, it must
- set the <a href=#official-playback-position id=offsets-into-the-media-resource:official-playback-position-4>official playback position</a> to the new value and then <a href=#dom-media-seek id=offsets-into-the-media-resource:dom-media-seek>seek</a> to the new value. The new value must be interpreted as being in
- seconds.</p>
- <p><a href=#media-element id=offsets-into-the-media-resource:media-element-11>Media elements</a> have an <dfn id=initial-playback-position>initial playback position</dfn>,
- which must initially (i.e. in the absence of <a href=#media-data id=offsets-into-the-media-resource:media-data-3>media data</a>) be zero seconds. The
- <a href=#initial-playback-position id=offsets-into-the-media-resource:initial-playback-position>initial playback position</a> is updated when a <a href=#media-resource id=offsets-into-the-media-resource:media-resource-18>media resource</a> is loaded.
- The <a href=#initial-playback-position id=offsets-into-the-media-resource:initial-playback-position-2>initial playback position</a> is a time on the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-11>media timeline</a>.</p>
- <p>If the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-19>media resource</a> is a streaming resource, then the user agent might be unable
- to obtain certain parts of the resource after it has expired from its buffer. Similarly, some
- <a href=#media-resource id=offsets-into-the-media-resource:media-resource-20>media resources</a> might have a <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-12>media timeline</a> that
- doesn't start at zero. The <dfn id=earliest-possible-position>earliest possible position</dfn> is the earliest position in the
- stream or resource that the user agent can ever obtain again. It is also a time on the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-13>media
- timeline</a>.</p>
- <p class=note>The <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-3>earliest possible position</a> is not explicitly exposed in the API;
- it corresponds to the start time of the first range in the <code id=offsets-into-the-media-resource:dom-media-seekable-2><a href=#dom-media-seekable>seekable</a></code> attribute's <code id=offsets-into-the-media-resource:timeranges><a href=#timeranges>TimeRanges</a></code> object, if any, or
- the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-3>current playback position</a> otherwise.</p>
- <p>When the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-4>earliest possible position</a> changes, then: if the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-4>current playback
- position</a> is before the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-5>earliest possible position</a>, the user agent must <a href=#dom-media-seek id=offsets-into-the-media-resource:dom-media-seek-2>seek</a> to the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-6>earliest possible position</a>; otherwise, if
- the user agent has not fired a <code id=offsets-into-the-media-resource:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event at the
- element in the past 15 to 250ms and is not still running event handlers for such an event, then
- the user agent must <a href=#queue-a-task id=offsets-into-the-media-resource:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=offsets-into-the-media-resource:fire-a-simple-event>fire a simple event</a> named <code id=offsets-into-the-media-resource:event-media-timeupdate-2><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>
- <p class=note>Because of the above requirement and the requirement in the <a href=#concept-media-load-resource id=offsets-into-the-media-resource:concept-media-load-resource>resource fetch algorithm</a> that kicks in <a href=#getting-media-metadata>when the metadata of the clip becomes known</a>, the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-5>current
- playback position</a> can never be less than the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-7>earliest possible position</a>.</p>
-
-
- <p>If at any time the user agent learns that an audio or video track has ended and all <a href=#media-data id=offsets-into-the-media-resource:media-data-4>media
- data</a> relating to that track corresponds to parts of the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-14>media timeline</a> that
- are <em>before</em> the <a href=#earliest-possible-position id=offsets-into-the-media-resource:earliest-possible-position-8>earliest possible position</a>, the user agent may <a href=#queue-a-task id=offsets-into-the-media-resource:queue-a-task-2>queue a
- task</a> to first remove the track from the <code id=offsets-into-the-media-resource:dom-media-audiotracks><a href=#dom-media-audiotracks>audioTracks</a></code>
- attribute's <code id=offsets-into-the-media-resource:audiotracklist><a href=#audiotracklist>AudioTrackList</a></code> object or the <code id=offsets-into-the-media-resource:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code> attribute's <code id=offsets-into-the-media-resource:videotracklist><a href=#videotracklist>VideoTrackList</a></code> object as
- appropriate and then <a href=#concept-event-fire id=offsets-into-the-media-resource:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=offsets-into-the-media-resource:concept-events-trusted>trusted</a> event with the name <code id=offsets-into-the-media-resource:event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>, that does not bubble and is not cancelable, and that
- uses the <code id=offsets-into-the-media-resource:trackevent><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=offsets-into-the-media-resource:dom-trackevent-track><a href=#dom-trackevent-track>track</a></code> attribute initialised to the <code id=offsets-into-the-media-resource:audiotrack><a href=#audiotrack>AudioTrack</a></code> or
- <code id=offsets-into-the-media-resource:videotrack><a href=#videotrack>VideoTrack</a></code> object representing the track, at the <a href=#media-element id=offsets-into-the-media-resource:media-element-12>media element</a>'s
- aforementioned <code id=offsets-into-the-media-resource:audiotracklist-2><a href=#audiotracklist>AudioTrackList</a></code> or <code id=offsets-into-the-media-resource:videotracklist-2><a href=#videotracklist>VideoTrackList</a></code> object.</p>
- <p>The <dfn id=dom-media-duration><code>duration</code></dfn> attribute must return the time
- of the end of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-21>media resource</a>, in seconds, on the <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-15>media timeline</a>. If
- no <a href=#media-data id=offsets-into-the-media-resource:media-data-5>media data</a> is available, then the attributes must return the Not-a-Number (NaN)
- value. If the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-22>media resource</a> is not known to be bounded (e.g. streaming radio, or a
- live event with no announced end time), then the attribute must return the positive Infinity
- value.</p>
- <p>The user agent must determine the duration of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-23>media resource</a> before playing
- any part of the <a href=#media-data id=offsets-into-the-media-resource:media-data-6>media data</a> and before setting <code id=offsets-into-the-media-resource:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> to a value equal to or greater than <code id=offsets-into-the-media-resource:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, even if doing so requires fetching multiple
- parts of the resource.</p>
- <p id=durationChange>When the length of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-24>media resource</a> changes to a known value
- (e.g. from being unknown to known, or from a previously established length to a new length) the
- user agent must <a href=#queue-a-task id=offsets-into-the-media-resource:queue-a-task-3>queue a task</a> to <a href=#fire-a-simple-event id=offsets-into-the-media-resource:fire-a-simple-event-2>fire a simple event</a> named <code id=offsets-into-the-media-resource:event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> at the <a href=#media-element id=offsets-into-the-media-resource:media-element-13>media element</a>. (The
- event is not fired when the duration is reset as part of loading a new media resource.) If the
- duration is changed such that the <a href=#current-playback-position id=offsets-into-the-media-resource:current-playback-position-6>current playback position</a> ends up being greater
- than the time of the end of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-25>media resource</a>, then the user agent must also <a href=#dom-media-seek id=offsets-into-the-media-resource:dom-media-seek-3>seek</a> to the time of the end of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-26>media resource</a>.</p>
- <p class=example>If an "infinite" stream ends for some reason, then the duration would change
- from positive Infinity to the time of the last frame or sample in the stream, and the <code id=offsets-into-the-media-resource:event-media-durationchange-2><a href=#event-media-durationchange>durationchange</a></code> event would be fired. Similarly, if the
- user agent initially estimated the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-27>media resource</a>'s duration instead of determining
- it precisely, and later revises the estimate based on new information, then the duration would
- change and the <code id=offsets-into-the-media-resource:event-media-durationchange-3><a href=#event-media-durationchange>durationchange</a></code> event would be
- fired.</p>
- <p>Some video files also have an explicit date and time corresponding to the zero time in the
- <a href=#media-timeline id=offsets-into-the-media-resource:media-timeline-16>media timeline</a>, known as the <dfn id=timeline-offset>timeline offset</dfn>. Initially, the
- <a href=#timeline-offset id=offsets-into-the-media-resource:timeline-offset-2>timeline offset</a> must be set to Not-a-Number (NaN).</p>
- <p>The <dfn id=dom-media-getstartdate><code>getStartDate()</code></dfn> method must return <a href=#create-a-date-object id=offsets-into-the-media-resource:create-a-date-object>a new <code>Date</code> object</a> representing the current
- <a href=#timeline-offset id=offsets-into-the-media-resource:timeline-offset-3>timeline offset</a>.</p>
-
- <hr>
- <p>The <dfn id=attr-media-loop><code>loop</code></dfn> attribute is a <a href=#boolean-attribute id=offsets-into-the-media-resource:boolean-attribute>boolean
- attribute</a> that, if specified, indicates that the <a href=#media-element id=offsets-into-the-media-resource:media-element-14>media element</a> is to seek back
- to the start of the <a href=#media-resource id=offsets-into-the-media-resource:media-resource-28>media resource</a> upon reaching the end.</p>
- <p>The <code id=offsets-into-the-media-resource:attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute has no effect while the element has a
- <a href=#current-media-controller id=offsets-into-the-media-resource:current-media-controller-4>current media controller</a>.</p>
-
- <p>The <dfn id=dom-media-loop><code>loop</code></dfn> IDL attribute must <a href=#reflect id=offsets-into-the-media-resource:reflect>reflect</a>
- the content attribute of the same name.</p>
-
- <h5 id=ready-states>4.8.14.7 Ready states</h5>
- <dl class=domintro><dt><var>media</var> . <code id=ready-states:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code><dd>
- <p>Returns a value that expresses the current state of the element with respect to rendering the
- <a href=#current-playback-position id=ready-states:current-playback-position>current playback position</a>, from the codes in the list below.</p>
- </dl>
-
- <p><a href=#media-element id=ready-states:media-element>Media elements</a> have a <i>ready state</i>, which describes to
- what degree they are ready to be rendered at the <a href=#current-playback-position id=ready-states:current-playback-position-2>current playback position</a>. The
- possible values are as follows; the ready state of a media element at any particular time is the
- greatest value describing the state of the element:</p>
-
- <dl><dt><dfn id=dom-media-have_nothing><code>HAVE_NOTHING</code></dfn> (numeric value 0)<dd><p>No information regarding the <a href=#media-resource id=ready-states:media-resource>media resource</a> is available. No data for the
- <a href=#current-playback-position id=ready-states:current-playback-position-3>current playback position</a> is available. <a href=#media-element id=ready-states:media-element-2>Media
- elements</a> whose <code id=ready-states:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> attribute are set
- to <code id=ready-states:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> are always in the <code id=ready-states:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> state.<dt><dfn id=dom-media-have_metadata><code>HAVE_METADATA</code></dfn> (numeric value 1)<dd><p>Enough of the resource has been obtained that the duration of the resource is available.
- In the case of a <code id=ready-states:the-video-element><a href=#the-video-element>video</a></code> element, the dimensions of the video are also available. The
- API will no longer throw an exception when seeking. No <a href=#media-data id=ready-states:media-data>media data</a> is available for
- the immediate <a href=#current-playback-position id=ready-states:current-playback-position-4>current playback position</a>.<dt><dfn id=dom-media-have_current_data><code>HAVE_CURRENT_DATA</code></dfn> (numeric value 2)<dd><p>Data for the immediate <a href=#current-playback-position id=ready-states:current-playback-position-5>current playback position</a> is available, but either not
- enough data is available that the user agent could successfully advance the <a href=#current-playback-position id=ready-states:current-playback-position-6>current
- playback position</a> in the <a href=#direction-of-playback id=ready-states:direction-of-playback>direction of playback</a> at all without immediately
- reverting to the <code id=ready-states:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, or there is no
- more data to obtain in the <a href=#direction-of-playback id=ready-states:direction-of-playback-2>direction of playback</a>. For example, in video this
- corresponds to the user agent having data from the current frame, but not the next frame, when
- the <a href=#current-playback-position id=ready-states:current-playback-position-7>current playback position</a> is at the end of the current frame; and to when <a href=#ended-playback id=ready-states:ended-playback>playback has ended</a>.<dt><dfn id=dom-media-have_future_data><code>HAVE_FUTURE_DATA</code></dfn> (numeric value 3)<dd><p>Data for the immediate <a href=#current-playback-position id=ready-states:current-playback-position-8>current playback position</a> is available, as well as
- enough data for the user agent to advance the <a href=#current-playback-position id=ready-states:current-playback-position-9>current playback position</a> in the
- <a href=#direction-of-playback id=ready-states:direction-of-playback-3>direction of playback</a> at least a little without immediately reverting to the <code id=ready-states:dom-media-have_metadata-2><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, and <a href=#the-text-tracks-are-ready id=ready-states:the-text-tracks-are-ready>the text tracks are
- ready</a>. For example, in video this corresponds to the user agent having data for at least
- the current frame and the next frame when the <a href=#current-playback-position id=ready-states:current-playback-position-10>current playback position</a> is at the
- instant in time between the two frames, or to the user agent having the video data for the
- current frame and audio data to keep playing at least a little when the <a href=#current-playback-position id=ready-states:current-playback-position-11>current playback
- position</a> is in the middle of a frame. The user agent cannot be in this state if <a href=#ended-playback id=ready-states:ended-playback-2>playback has ended</a>, as the <a href=#current-playback-position id=ready-states:current-playback-position-12>current playback position</a>
- can never advance in this case.<dt><dfn id=dom-media-have_enough_data><code>HAVE_ENOUGH_DATA</code></dfn> (numeric value 4)<dd>
- <p>All the conditions described for the <code id=ready-states:dom-media-have_future_data><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> state are met, and, in addition,
- either of the following conditions is also true:</p>
- <ul><li>The user agent estimates that data is being fetched at a rate where the <a href=#current-playback-position id=ready-states:current-playback-position-13>current
- playback position</a>, if it were to advance at the <a href=#effective-playback-rate id=ready-states:effective-playback-rate>effective playback rate</a>,
- would not overtake the available data before playback reaches the end of the <a href=#media-resource id=ready-states:media-resource-2>media
- resource</a>.<li>The user agent has entered a state where waiting longer will not result in further data
- being obtained, and therefore nothing would be gained by delaying playback any further. (For
- example, the buffer might be full.)</ul>
- </dl>
- <p class=note>In practice, the difference between <code id=ready-states:dom-media-have_metadata-3><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> and <code id=ready-states:dom-media-have_current_data><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> is negligible. Really the only time
- the difference is relevant is when painting a <code id=ready-states:the-video-element-2><a href=#the-video-element>video</a></code> element onto a
- <code id=ready-states:the-canvas-element><a href=#the-canvas-element>canvas</a></code>, where it distinguishes the case where something will be drawn (<code id=ready-states:dom-media-have_current_data-2><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater) from the case where
- nothing is drawn (<code id=ready-states:dom-media-have_metadata-4><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or less). Similarly,
- the difference between <code id=ready-states:dom-media-have_current_data-3><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> (only
- the current frame) and <code id=ready-states:dom-media-have_future_data-2><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> (at least
- this frame and the next) can be negligible (in the extreme, only one frame). The only time that
- distinction really matters is when a page provides an interface for "frame-by-frame"
- navigation.</p>
-
- <p>When the ready state of a <a href=#media-element id=ready-states:media-element-3>media element</a> whose <code id=ready-states:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code> is not <code id=ready-states:dom-media-network_empty-2><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> changes, the user agent must follow the steps
- given below:</p>
- <ol><li>
- <p>Apply the first applicable set of substeps from the following list:</p>
- <dl class=switch><dt>If the previous ready state was <code id=ready-states:dom-media-have_nothing-2><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>,
- and the new ready state is <code id=ready-states:dom-media-have_metadata-5><a href=#dom-media-have_metadata>HAVE_METADATA</a></code><dd id=fire-loadedmetadata>
- <p><a href=#queue-a-task id=ready-states:queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event>fire a simple event</a> named <code id=ready-states:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> at the element.</p>
- <p class=note>Before this task is run, as part of the <a href=#event-loop id=ready-states:event-loop>event loop</a> mechanism, the
- rendering will have been updated to resize the <code id=ready-states:the-video-element-3><a href=#the-video-element>video</a></code> element if appropriate.</p>
- <dt id=handling-first-frame-available>If the previous ready state was <code id=ready-states:dom-media-have_metadata-6><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> and the new ready state is <code id=ready-states:dom-media-have_current_data-4><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater<dd>
- <p id=fire-loadeddata>If this is the first time this occurs for this <a href=#media-element id=ready-states:media-element-4>media
- element</a> since the <code id=ready-states:dom-media-load><a href=#dom-media-load>load()</a></code> algorithm was last
- invoked, the user agent must <a href=#queue-a-task id=ready-states:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-2>fire a simple event</a>
- named <code id=ready-states:event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> at the element.</p>
- <p>If the new ready state is <code id=ready-states:dom-media-have_future_data-3><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>
- or <code id=ready-states:dom-media-have_enough_data><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>, then the relevant steps
- below must then be run also.</p>
- <dt>If the previous ready state was <code id=ready-states:dom-media-have_future_data-4><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or more, and the new ready state is
- <code id=ready-states:dom-media-have_current_data-5><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less<dd>
- <p id=fire-waiting-when-waiting>If the <a href=#media-element id=ready-states:media-element-5>media element</a> was <a href=#potentially-playing id=ready-states:potentially-playing>potentially
- playing</a> before its <code id=ready-states:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute
- changed to a value lower than <code id=ready-states:dom-media-have_future_data-5><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, and the element has not
- <a href=#ended-playback id=ready-states:ended-playback-3>ended playback</a>, and playback has not <a href=#stopped-due-to-errors id=ready-states:stopped-due-to-errors>stopped due to errors</a>,
- <a href=#paused-for-user-interaction id=ready-states:paused-for-user-interaction>paused for user interaction</a>, or <a href=#paused-for-in-band-content id=ready-states:paused-for-in-band-content>paused for in-band content</a>, the user
- agent must <a href=#queue-a-task id=ready-states:queue-a-task-3>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-3>fire a simple event</a> named <code id=ready-states:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element, and <a href=#queue-a-task id=ready-states:queue-a-task-4>queue a task</a>
- to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-4>fire a simple event</a> named <code id=ready-states:event-media-waiting><a href=#event-media-waiting>waiting</a></code> at
- the element.</p>
- <dt>If the previous ready state was <code id=ready-states:dom-media-have_current_data-6><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less, and the new ready state
- is <code id=ready-states:dom-media-have_future_data-6><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code><dd>
- <p>The user agent must <a href=#queue-a-task id=ready-states:queue-a-task-5>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-5>fire a simple event</a> named
- <code id=ready-states:event-media-canplay><a href=#event-media-canplay>canplay</a></code> at the element.</p>
- <p>If the element's <code id=ready-states:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is false, the user
- agent must <a href=#queue-a-task id=ready-states:queue-a-task-6>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-6>fire a simple event</a> named <code id=ready-states:event-media-playing><a href=#event-media-playing>playing</a></code> at the element.</p>
- <dt>If the new ready state is <code id=ready-states:dom-media-have_enough_data-2><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code><dd>
- <p>If the previous ready state was <code id=ready-states:dom-media-have_current_data-7><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or less, the user agent must
- <a href=#queue-a-task id=ready-states:queue-a-task-7>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-7>fire a simple event</a> named <code id=ready-states:event-media-canplay-2><a href=#event-media-canplay>canplay</a></code> at the element, and, if the element's <code id=ready-states:dom-media-paused-2><a href=#dom-media-paused>paused</a></code> attribute is false, <a href=#queue-a-task id=ready-states:queue-a-task-8>queue a task</a> to
- <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-8>fire a simple event</a> named <code id=ready-states:event-media-playing-2><a href=#event-media-playing>playing</a></code>
- at the element.</p>
- <p>If the <a href=#autoplaying-flag id=ready-states:autoplaying-flag>autoplaying flag</a> is true, and the <code id=ready-states:dom-media-paused-3><a href=#dom-media-paused>paused</a></code> attribute is true, and the <a href=#media-element id=ready-states:media-element-6>media element</a>
- has an <code id=ready-states:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute specified, and the
- <a href=#media-element id=ready-states:media-element-7>media element</a>'s <a id=ready-states:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=ready-states:active-sandboxing-flag-set>active sandboxing flag set</a>
- does not have the <a href=#sandboxed-automatic-features-browsing-context-flag id=ready-states:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a> set, then
- the user agent may also run the following substeps:</p>
- <ol><li>Set the <code id=ready-states:dom-media-paused-4><a href=#dom-media-paused>paused</a></code> attribute to false.<li>If the element's <a href=#show-poster-flag id=ready-states:show-poster-flag>show poster flag</a> is true, set it to false and run the
- <i id=ready-states:time-marches-on><a href=#time-marches-on>time marches on</a></i> steps.<li><a href=#queue-a-task id=ready-states:queue-a-task-9>Queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-9>fire a simple event</a> named <code id=ready-states:event-media-play><a href=#event-media-play>play</a></code> at the element.<li><a href=#queue-a-task id=ready-states:queue-a-task-10>Queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-10>fire a simple event</a> named <code id=ready-states:event-media-playing-3><a href=#event-media-playing>playing</a></code> at the element.</ol>
- <p class=note>User agents do not need to support autoplay, and it is suggested that user
- agents honor user preferences on the matter. Authors are urged to use the <code id=ready-states:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code> attribute rather than using script to force the
- video to play, so as to allow the user to override the behavior if so desired.</p>
- <p>In any case, the user agent must finally <a href=#queue-a-task id=ready-states:queue-a-task-11>queue a task</a> to <a href=#fire-a-simple-event id=ready-states:fire-a-simple-event-11>fire a simple
- event</a> named <code id=ready-states:event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> at the element.</p>
- </dl>
- <li><p>If the <a href=#media-element id=ready-states:media-element-8>media element</a> has a <a href=#current-media-controller id=ready-states:current-media-controller>current media controller</a>, then
- <a href=#report-the-controller-state id=ready-states:report-the-controller-state>report the controller state</a> for the <a href=#media-element id=ready-states:media-element-9>media element</a>'s <a href=#current-media-controller id=ready-states:current-media-controller-2>current media
- controller</a>.</ol>
-
- <p class=note>It is possible for the ready state of a media element to jump between these states
- discontinuously. For example, the state of a media element can jump straight from <code id=ready-states:dom-media-have_metadata-7><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> to <code id=ready-states:dom-media-have_enough_data-3><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> without passing through the <code id=ready-states:dom-media-have_current_data-8><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> and <code id=ready-states:dom-media-have_future_data-7><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> states.</p>
-
- <p>The <dfn id=dom-media-readystate><code>readyState</code></dfn> IDL attribute must, on
- getting, return the value described above that describes the current ready state of the
- <a href=#media-element id=ready-states:media-element-10>media element</a>.</p>
-
- <p>The <dfn id=attr-media-autoplay><code>autoplay</code></dfn> attribute is a <a href=#boolean-attribute id=ready-states:boolean-attribute>boolean
- attribute</a>. When present, the user agent (as described in the algorithm
- described herein) will automatically begin playback of the <a href=#media-resource id=ready-states:media-resource-3>media resource</a> as
- soon as it can do so without stopping.</p>
- <p class=note>Authors are urged to use the <code id=ready-states:attr-media-autoplay-3><a href=#attr-media-autoplay>autoplay</a></code>
- attribute rather than using script to trigger automatic playback, as this allows the user to
- override the automatic playback when it is not desired, e.g. when using a screen reader. Authors
- are also encouraged to consider not using the automatic playback behavior at all, and instead to
- let the user agent wait for the user to start playback explicitly.</p>
-
- <p>The <dfn id=dom-media-autoplay><code>autoplay</code></dfn> IDL attribute must
- <a href=#reflect id=ready-states:reflect>reflect</a> the content attribute of the same name.</p>
-
- <h5 id=playing-the-media-resource>4.8.14.8 Playing the media resource</h5>
- <dl class=domintro><dt><var>media</var> . <code id=playing-the-media-resource:dom-media-paused><a href=#dom-media-paused>paused</a></code><dd>
- <p>Returns true if playback is paused; false otherwise.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-ended><a href=#dom-media-ended>ended</a></code><dd>
- <p>Returns true if playback has reached the end of the <a href=#media-resource id=playing-the-media-resource:media-resource>media resource</a>.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-defaultplaybackrate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the default rate of playback, for when the user is not fast-forwarding or reversing
- through the <a href=#media-resource id=playing-the-media-resource:media-resource-2>media resource</a>.</p>
- <p>Can be set, to change the default rate of playback.</p>
- <p>The default rate has no direct effect on playback, but if the user switches to a fast-forward
- mode, when they return to the normal playback mode, it is expected that the rate of playback
- will be returned to the default rate of playback.</p>
- <p>When the element has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller>current media controller</a>, the <code id=playing-the-media-resource:dom-media-defaultplaybackrate-2><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> attribute is ignored and the
- <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-2>current media controller</a>'s <code id=playing-the-media-resource:dom-mediacontroller-defaultplaybackrate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> is used instead.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-playbackrate><a href=#dom-media-playbackrate>playbackRate</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current rate playback, where 1.0 is normal speed.</p>
- <p>Can be set, to change the rate of playback.</p>
- <p>When the element has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-3>current media controller</a>, the <code id=playing-the-media-resource:dom-media-playbackrate-2><a href=#dom-media-playbackrate>playbackRate</a></code> attribute is ignored and the <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-4>current
- media controller</a>'s <code id=playing-the-media-resource:dom-mediacontroller-playbackrate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> is
- used instead.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-played><a href=#dom-media-played>played</a></code><dd>
- <p>Returns a <code id=playing-the-media-resource:timeranges><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource id=playing-the-media-resource:media-resource-3>media
- resource</a> that the user agent has played.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-play><a href=#dom-media-play>play</a></code>()<dd>
- <p>Sets the <code id=playing-the-media-resource:dom-media-paused-2><a href=#dom-media-paused>paused</a></code> attribute to false, loading the
- <a href=#media-resource id=playing-the-media-resource:media-resource-4>media resource</a> and beginning playback if necessary. If the playback had ended, will
- restart it from the start.</p>
- <dt><var>media</var> . <code id=playing-the-media-resource:dom-media-pause><a href=#dom-media-pause>pause</a></code>()<dd>
- <p>Sets the <code id=playing-the-media-resource:dom-media-paused-3><a href=#dom-media-paused>paused</a></code> attribute to true, loading the
- <a href=#media-resource id=playing-the-media-resource:media-resource-5>media resource</a> if necessary.</p>
- </dl>
-
- <p>The <dfn id=dom-media-paused><code>paused</code></dfn> attribute represents whether the
- <a href=#media-element id=playing-the-media-resource:media-element>media element</a> is paused or not. The attribute must initially be true.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-2>media element</a> is a <dfn id=blocked-media-element>blocked media element</dfn> if its <code id=playing-the-media-resource:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> attribute is in the <code id=playing-the-media-resource:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> state, the <code id=playing-the-media-resource:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> state, or the <code id=playing-the-media-resource:dom-media-have_current_data><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> state, or if the element has
- <a href=#paused-for-user-interaction id=playing-the-media-resource:paused-for-user-interaction>paused for user interaction</a> or <a href=#paused-for-in-band-content id=playing-the-media-resource:paused-for-in-band-content>paused for in-band content</a>.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-3>media element</a> is said to be <dfn id=potentially-playing>potentially playing</dfn> when its <code id=playing-the-media-resource:dom-media-paused-4><a href=#dom-media-paused>paused</a></code> attribute is false, the element has not <a href=#ended-playback id=playing-the-media-resource:ended-playback>ended
- playback</a>, playback has not <a href=#stopped-due-to-errors id=playing-the-media-resource:stopped-due-to-errors>stopped due to errors</a>, the element either has no
- <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-5>current media controller</a> or has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-6>current media controller</a> but is not
- <a href=#blocked-on-its-media-controller id=playing-the-media-resource:blocked-on-its-media-controller>blocked on its media controller</a>, and the element is not a <a href=#blocked-media-element id=playing-the-media-resource:blocked-media-element>blocked media
- element</a>.</p>
- <p class=note>A <code id=playing-the-media-resource:event-media-waiting><a href=#event-media-waiting>waiting</a></code> DOM event <a href=#fire-waiting-when-waiting>can be fired</a> as a result of an element that is
- <a href=#potentially-playing id=playing-the-media-resource:potentially-playing>potentially playing</a> stopping playback due to its <code id=playing-the-media-resource:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute changing to a value lower than <code id=playing-the-media-resource:dom-media-have_future_data><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-4>media element</a> is said to have <dfn id=ended-playback>ended playback</dfn> when:</p>
- <ul><li>The element's <code id=playing-the-media-resource:dom-media-readystate-3><a href=#dom-media-readystate>readyState</a></code> attribute is <code id=playing-the-media-resource:dom-media-have_metadata-2><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and
- <li>
- <p>Either:
- <ul><li>The <a href=#current-playback-position id=playing-the-media-resource:current-playback-position>current playback position</a> is the end of the <a href=#media-resource id=playing-the-media-resource:media-resource-6>media resource</a>,
- and
- <li>The <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback>direction of playback</a> is forwards, and
- <li>Either the <a href=#media-element id=playing-the-media-resource:media-element-5>media element</a> does not have a <code id=playing-the-media-resource:attr-media-loop><a href=#attr-media-loop>loop</a></code> attribute specified, or the <a href=#media-element id=playing-the-media-resource:media-element-6>media element</a> has
- a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-7>current media controller</a>.
- </ul>
- <p>Or:
- <ul><li>The <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-2>current playback position</a> is the <a href=#earliest-possible-position id=playing-the-media-resource:earliest-possible-position>earliest possible position</a>,
- and
- <li>The <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-2>direction of playback</a> is backwards.
- </ul>
- </ul>
- <p>The <dfn id=dom-media-ended><code>ended</code></dfn> attribute must return true if, the
- last time the <a href=#event-loop id=playing-the-media-resource:event-loop>event loop</a> reached step 1, the <a href=#media-element id=playing-the-media-resource:media-element-7>media element</a> had
- <a href=#ended-playback id=playing-the-media-resource:ended-playback-2>ended playback</a> and the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-3>direction of playback</a> was forwards, and false
- otherwise.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-8>media element</a> is said to have <dfn id=stopped-due-to-errors>stopped due to errors</dfn> when the
- element's <code id=playing-the-media-resource:dom-media-readystate-4><a href=#dom-media-readystate>readyState</a></code> attribute is <code id=playing-the-media-resource:dom-media-have_metadata-3><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater, and the user agent <a href=#non-fatal-media-error>encounters a non-fatal error</a> during the processing of the
- <a href=#media-data id=playing-the-media-resource:media-data>media data</a>, and due to that error, is not able to play the content at the
- <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-3>current playback position</a>.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-9>media element</a> is said to have <dfn id=paused-for-user-interaction>paused for user interaction</dfn> when its
- <code id=playing-the-media-resource:dom-media-paused-5><a href=#dom-media-paused>paused</a></code> attribute is false, the <code id=playing-the-media-resource:dom-media-readystate-5><a href=#dom-media-readystate>readyState</a></code> attribute is either <code id=playing-the-media-resource:dom-media-have_future_data-2><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code id=playing-the-media-resource:dom-media-have_enough_data><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> and the user agent has reached a point
- in the <a href=#media-resource id=playing-the-media-resource:media-resource-7>media resource</a> where the user has to make a selection for the resource to
- continue. If the <a href=#media-element id=playing-the-media-resource:media-element-10>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-8>current media controller</a> when this
- happens, then the user agent must <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state>report the controller state</a> for the <a href=#media-element id=playing-the-media-resource:media-element-11>media
- element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-9>current media controller</a>. If the <a href=#media-element id=playing-the-media-resource:media-element-12>media element</a> has a
- <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-10>current media controller</a> when the user makes a selection, allowing playback to
- resume, the user agent must similarly <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-2>report the controller state</a> for the <a href=#media-element id=playing-the-media-resource:media-element-13>media
- element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-11>current media controller</a>.</p>
- <p>It is possible for a <a href=#media-element id=playing-the-media-resource:media-element-14>media element</a> to have both <a href=#ended-playback id=playing-the-media-resource:ended-playback-3>ended playback</a> and
- <a href=#paused-for-user-interaction id=playing-the-media-resource:paused-for-user-interaction-2>paused for user interaction</a> at the same time.</p>
- <p>When a <a href=#media-element id=playing-the-media-resource:media-element-15>media element</a> that is <a href=#potentially-playing id=playing-the-media-resource:potentially-playing-2>potentially playing</a> stops playing
- because it has <a href=#paused-for-user-interaction id=playing-the-media-resource:paused-for-user-interaction-3>paused for user interaction</a>, the user agent must <a href=#queue-a-task id=playing-the-media-resource:queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event>fire a simple event</a> named <code id=playing-the-media-resource:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>
- <p>A <a href=#media-element id=playing-the-media-resource:media-element-16>media element</a> is said to have <dfn id=paused-for-in-band-content>paused for in-band content</dfn> when its
- <code id=playing-the-media-resource:dom-media-paused-6><a href=#dom-media-paused>paused</a></code> attribute is false, the <code id=playing-the-media-resource:dom-media-readystate-6><a href=#dom-media-readystate>readyState</a></code> attribute is either <code id=playing-the-media-resource:dom-media-have_future_data-3><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code id=playing-the-media-resource:dom-media-have_enough_data-2><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code> and the user agent has suspended
- playback of the <a href=#media-resource id=playing-the-media-resource:media-resource-8>media resource</a> in order to play content that is temporally anchored
- to the <a href=#media-resource id=playing-the-media-resource:media-resource-9>media resource</a> and has a non-zero length, or to play content that is
- temporally anchored to a segment of the <a href=#media-resource id=playing-the-media-resource:media-resource-10>media resource</a> but has a length longer than
- that segment. If the <a href=#media-element id=playing-the-media-resource:media-element-17>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-12>current media controller</a> when
- this happens, then the user agent must <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-3>report the controller state</a> for the
- <a href=#media-element id=playing-the-media-resource:media-element-18>media element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-13>current media controller</a>. If the <a href=#media-element id=playing-the-media-resource:media-element-19>media
- element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-14>current media controller</a> when the user agent unsuspends
- playback, the user agent must similarly <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-4>report the controller state</a> for the
- <a href=#media-element id=playing-the-media-resource:media-element-20>media element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-15>current media controller</a>.</p>
- <p class=example>One example of when a <a href=#media-element id=playing-the-media-resource:media-element-21>media element</a> would be <a href=#paused-for-in-band-content id=playing-the-media-resource:paused-for-in-band-content-2>paused for
- in-band content</a> is when the user agent is playing <a href=#attr-track-kind-descriptions id=playing-the-media-resource:attr-track-kind-descriptions>audio descriptions</a> from an external WebVTT file, and
- the synthesized speech generated for a cue is longer than the time between the <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time>text track
- cue start time</a> and the <a href=#text-track-cue-end-time id=playing-the-media-resource:text-track-cue-end-time>text track cue end time</a>.</p>
- <hr>
- <p id=reaches-the-end>When the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-4>current playback position</a> reaches the end of the
- <a href=#media-resource id=playing-the-media-resource:media-resource-11>media resource</a> when the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-4>direction of playback</a> is forwards, then the user
- agent must follow these steps:</p>
- <ol><li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-22>media element</a> has a <code id=playing-the-media-resource:attr-media-loop-2><a href=#attr-media-loop>loop</a></code>
- attribute specified and does not have a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-16>current media controller</a>, then <a href=#dom-media-seek id=playing-the-media-resource:dom-media-seek>seek</a> to the <a href=#earliest-possible-position id=playing-the-media-resource:earliest-possible-position-2>earliest possible position</a> of the
- <a href=#media-resource id=playing-the-media-resource:media-resource-12>media resource</a> and abort these steps.<li><p>As defined above, the <code id=playing-the-media-resource:dom-media-ended-2><a href=#dom-media-ended>ended</a></code> IDL attribute starts
- returning true once the <a href=#event-loop id=playing-the-media-resource:event-loop-2>event loop</a> returns to step 1.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-2>Queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-2>fire a simple event</a> named <code id=playing-the-media-resource:event-media-timeupdate-2><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element id=playing-the-media-resource:media-element-23>media element</a>.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-3>Queue a task</a> that, if the <a href=#media-element id=playing-the-media-resource:media-element-24>media element</a> does not have a
- <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-17>current media controller</a>, and the <a href=#media-element id=playing-the-media-resource:media-element-25>media element</a> has still <a href=#ended-playback id=playing-the-media-resource:ended-playback-4>ended
- playback</a>, and the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-5>direction of playback</a> is still forwards, and <a href=#dom-media-paused id=playing-the-media-resource:dom-media-paused-7>paused</a> is false, changes <a href=#dom-media-paused id=playing-the-media-resource:dom-media-paused-8>paused</a> to true and <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-3>fires a
- simple event</a> named <code id=playing-the-media-resource:event-media-pause><a href=#event-media-pause>pause</a></code> at the <a href=#media-element id=playing-the-media-resource:media-element-26>media
- element</a>.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-4>Queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-4>fire a simple event</a> named <code id=playing-the-media-resource:event-media-ended><a href=#event-media-ended>ended</a></code> at the <a href=#media-element id=playing-the-media-resource:media-element-27>media element</a>.<li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-28>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-18>current media controller</a>, then
- <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-5>report the controller state</a> for the <a href=#media-element id=playing-the-media-resource:media-element-29>media element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-19>current media
- controller</a>.</ol>
- <p>When the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-5>current playback position</a> reaches the <a href=#earliest-possible-position id=playing-the-media-resource:earliest-possible-position-3>earliest possible
- position</a> of the <a href=#media-resource id=playing-the-media-resource:media-resource-13>media resource</a> when the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-6>direction of playback</a> is
- backwards, then the user agent must only <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-5>queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-5>fire a simple
- event</a> named <code id=playing-the-media-resource:event-media-timeupdate-3><a href=#event-media-timeupdate>timeupdate</a></code> at the element.</p>
- <p class=note>The word "reaches" here does not imply that the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-6>current playback
- position</a> needs to have changed during normal playback; it could be via <a href=#dom-media-seek id=playing-the-media-resource:dom-media-seek-2>seeking</a>, for instance.</p>
- <hr>
- <p>The <dfn id=dom-media-defaultplaybackrate><code>defaultPlaybackRate</code></dfn> attribute
- gives the desired speed at which the <a href=#media-resource id=playing-the-media-resource:media-resource-14>media resource</a> is to play, as a multiple of its
- intrinsic speed. The attribute is mutable: on getting it must return the last value it was set to,
- or 1.0 if it hasn't yet been set; on setting the attribute must be set to the new value.</p>
- <p class=note>The <code id=playing-the-media-resource:dom-media-defaultplaybackrate-3><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> is used
- by the user agent when it <a href=#expose-a-user-interface-to-the-user id=playing-the-media-resource:expose-a-user-interface-to-the-user>exposes a user
- interface to the user</a>.</p>
- <p>The <dfn id=dom-media-playbackrate><code>playbackRate</code></dfn> attribute gives the
- <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate>effective playback rate</a> (assuming there is no <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-20>current media controller</a>
- overriding it), which is the speed at which the <a href=#media-resource id=playing-the-media-resource:media-resource-15>media resource</a> plays, as a multiple
- of its intrinsic speed. If it is not equal to the <code id=playing-the-media-resource:dom-media-defaultplaybackrate-4><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>, then the implication is that the
- user is using a feature such as fast forward or slow motion playback. The attribute is mutable: on
- getting it must return the last value it was set to, or 1.0 if it hasn't yet been set; on setting
- the attribute must be set to the new value, and the playback will change speed (if the element is
- <a href=#potentially-playing id=playing-the-media-resource:potentially-playing-3>potentially playing</a> and there is no <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-21>current media controller</a>).</p>
- <p id=rateUpdate>When the <code id=playing-the-media-resource:dom-media-defaultplaybackrate-5><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code>
- or <code id=playing-the-media-resource:dom-media-playbackrate-3><a href=#dom-media-playbackrate>playbackRate</a></code> attributes change value (either by
- being set by script or by being changed directly by the user agent, e.g. in response to user
- control) the user agent must <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-6>queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-6>fire a simple event</a> named
- <code id=playing-the-media-resource:event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> at the <a href=#media-element id=playing-the-media-resource:media-element-30>media element</a>.</p>
- <p class=note>The <code id=playing-the-media-resource:dom-media-defaultplaybackrate-6><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> and
- <code id=playing-the-media-resource:dom-media-playbackrate-4><a href=#dom-media-playbackrate>playbackRate</a></code> attributes have no effect when the
- <a href=#media-element id=playing-the-media-resource:media-element-31>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-22>current media controller</a>; the namesake attributes on
- the <code id=playing-the-media-resource:mediacontroller><a href=#mediacontroller>MediaController</a></code> object are used instead in that situation.</p>
- <hr>
- <p>The <dfn id=dom-media-played><code>played</code></dfn> attribute must return a new static
- <a href=#normalised-timeranges-object id=playing-the-media-resource:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the ranges of points on the
- <a href=#media-timeline id=playing-the-media-resource:media-timeline>media timeline</a> of the <a href=#media-resource id=playing-the-media-resource:media-resource-16>media resource</a> reached through the usual monotonic
- increase of the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-7>current playback position</a> during normal playback, if any, at the time
- the attribute is evaluated.</p>
- <hr>
- <p>When the <dfn id=dom-media-play><code>play()</code></dfn> method on a <a href=#media-element id=playing-the-media-resource:media-element-32>media
- element</a> is invoked, the user agent must run the following steps.</p>
- <ol><li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-33>media element</a>'s <code id=playing-the-media-resource:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> attribute has the value <code id=playing-the-media-resource:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the <a href=#media-element id=playing-the-media-resource:media-element-34>media element</a>'s
- <a href=#concept-media-load-algorithm id=playing-the-media-resource:concept-media-load-algorithm>resource selection algorithm</a>.<li>
- <p>If the <a href=#ended-playback id=playing-the-media-resource:ended-playback-5>playback has ended</a> and the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-7>direction of
- playback</a> is forwards, and the <a href=#media-element id=playing-the-media-resource:media-element-35>media element</a> does not have a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-23>current
- media controller</a>, <a href=#dom-media-seek id=playing-the-media-resource:dom-media-seek-3>seek</a> to the <a href=#earliest-possible-position id=playing-the-media-resource:earliest-possible-position-4>earliest possible
- position</a> of the <a href=#media-resource id=playing-the-media-resource:media-resource-17>media resource</a>.</p>
- <p class=note>This <a href=#seekUpdate>will cause</a> the user agent to <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-7>queue a
- task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-7>fire a simple event</a> named <code id=playing-the-media-resource:event-media-timeupdate-4><a href=#event-media-timeupdate>timeupdate</a></code> at the <a href=#media-element id=playing-the-media-resource:media-element-36>media element</a>.</p>
-
- <li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-37>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-24>current media controller</a>, then
- <a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller id=playing-the-media-resource:bring-the-media-element-up-to-speed-with-its-new-media-controller>bring the media element up to speed with its new media controller</a>.</p>
- <li>
- <p>If the <a href=#media-element id=playing-the-media-resource:media-element-38>media element</a>'s <code id=playing-the-media-resource:dom-media-paused-9><a href=#dom-media-paused>paused</a></code> attribute is
- true, run the following substeps:</p>
- <ol><li><p>Change the value of <code id=playing-the-media-resource:dom-media-paused-10><a href=#dom-media-paused>paused</a></code> to false.<li><p>If the <a href=#show-poster-flag id=playing-the-media-resource:show-poster-flag>show poster flag</a> is true, set the element's <a href=#show-poster-flag id=playing-the-media-resource:show-poster-flag-2>show poster
- flag</a> to false and run the <i id=playing-the-media-resource:time-marches-on><a href=#time-marches-on>time marches on</a></i> steps.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-8>Queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-8>fire a simple event</a> named <code id=playing-the-media-resource:event-media-play><a href=#event-media-play>play</a></code> at the element.<li>
- <p>If the <a href=#media-element id=playing-the-media-resource:media-element-39>media element</a>'s <code id=playing-the-media-resource:dom-media-readystate-7><a href=#dom-media-readystate>readyState</a></code>
- attribute has the value <code id=playing-the-media-resource:dom-media-have_nothing-2><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, <code id=playing-the-media-resource:dom-media-have_metadata-4><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, or <code id=playing-the-media-resource:dom-media-have_current_data-2><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-9>queue a task</a> to
- <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-9>fire a simple event</a> named <code id=playing-the-media-resource:event-media-waiting-2><a href=#event-media-waiting>waiting</a></code> at the
- element.</p>
- <p>Otherwise, the <a href=#media-element id=playing-the-media-resource:media-element-40>media element</a>'s <code id=playing-the-media-resource:dom-media-readystate-8><a href=#dom-media-readystate>readyState</a></code> attribute has the value <code id=playing-the-media-resource:dom-media-have_future_data-4><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or <code id=playing-the-media-resource:dom-media-have_enough_data-3><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>: <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-10>queue a task</a> to
- <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-10>fire a simple event</a> named <code id=playing-the-media-resource:event-media-playing><a href=#event-media-playing>playing</a></code> at the
- element.</p>
- </ol>
- <li><p>Set the <a href=#media-element id=playing-the-media-resource:media-element-41>media element</a>'s <a href=#autoplaying-flag id=playing-the-media-resource:autoplaying-flag>autoplaying flag</a> to false.<li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-42>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-25>current media controller</a>, then
- <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-6>report the controller state</a> for the <a href=#media-element id=playing-the-media-resource:media-element-43>media element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-26>current media
- controller</a>.</ol>
- <hr>
- <p>When the <dfn id=dom-media-pause><code>pause()</code></dfn> method is invoked, and when
- the user agent is required to pause the <a href=#media-element id=playing-the-media-resource:media-element-44>media element</a>, the user agent must run the
- following steps:</p>
- <ol><li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-45>media element</a>'s <code id=playing-the-media-resource:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code> attribute has the value <code id=playing-the-media-resource:dom-media-network_empty-2><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, invoke the <a href=#media-element id=playing-the-media-resource:media-element-46>media element</a>'s
- <a href=#concept-media-load-algorithm id=playing-the-media-resource:concept-media-load-algorithm-2>resource selection algorithm</a>.<li><p>Run the <a href=#internal-pause-steps id=playing-the-media-resource:internal-pause-steps>internal pause steps</a> for the <a href=#media-element id=playing-the-media-resource:media-element-47>media element</a>.</ol>
- <p>The <dfn id=internal-pause-steps>internal pause steps</dfn> for a <a href=#media-element id=playing-the-media-resource:media-element-48>media element</a> are as follows:</p>
- <ol><li><p>Set the <a href=#media-element id=playing-the-media-resource:media-element-49>media element</a>'s <a href=#autoplaying-flag id=playing-the-media-resource:autoplaying-flag-2>autoplaying flag</a> to false.<li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-50>media element</a>'s <code id=playing-the-media-resource:dom-media-paused-11><a href=#dom-media-paused>paused</a></code> attribute
- is false, run the following steps:</p>
- <ol><li><p>Change the value of <code id=playing-the-media-resource:dom-media-paused-12><a href=#dom-media-paused>paused</a></code> to true.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-11>Queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-11>fire a simple
- event</a> named <code id=playing-the-media-resource:event-media-timeupdate-5><a href=#event-media-timeupdate>timeupdate</a></code> at the
- element.<li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-12>Queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-12>fire a simple
- event</a> named <code id=playing-the-media-resource:event-media-pause-2><a href=#event-media-pause>pause</a></code>
- at the element.<li><p>Set the <a href=#official-playback-position id=playing-the-media-resource:official-playback-position>official playback position</a> to the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-8>current playback
- position</a>.</ol>
- <li><p>If the <a href=#media-element id=playing-the-media-resource:media-element-51>media element</a> has a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-27>current media controller</a>, then
- <a href=#report-the-controller-state id=playing-the-media-resource:report-the-controller-state-7>report the controller state</a> for the <a href=#media-element id=playing-the-media-resource:media-element-52>media element</a>'s <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-28>current media
- controller</a>.</ol>
- <hr>
- <p>The <dfn id=effective-playback-rate>effective playback rate</dfn> is not necessarily the element's <code id=playing-the-media-resource:dom-media-playbackrate-5><a href=#dom-media-playbackrate>playbackRate</a></code>. When a <a href=#media-element id=playing-the-media-resource:media-element-53>media element</a> has a
- <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-29>current media controller</a>, its <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-2>effective playback rate</a> is the
- <code id=playing-the-media-resource:mediacontroller-2><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate id=playing-the-media-resource:media-controller-playback-rate>media controller playback rate</a>. Otherwise, the
- <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-3>effective playback rate</a> is just the element's <code id=playing-the-media-resource:dom-media-playbackrate-6><a href=#dom-media-playbackrate>playbackRate</a></code>. Thus, the <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-30>current media
- controller</a> overrides the <a href=#media-element id=playing-the-media-resource:media-element-54>media element</a>.</p>
- <p>If the <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-4>effective playback rate</a> is positive or zero, then the <dfn id=direction-of-playback>direction of
- playback</dfn> is forwards. Otherwise, it is backwards.</p>
- <p id=media-playback>When a <a href=#media-element id=playing-the-media-resource:media-element-55>media element</a> is <a href=#potentially-playing id=playing-the-media-resource:potentially-playing-4>potentially playing</a> and
- its <code id=playing-the-media-resource:document><a href=#document>Document</a></code> is a <a href=#fully-active id=playing-the-media-resource:fully-active>fully active</a> <code id=playing-the-media-resource:document-2><a href=#document>Document</a></code>, its <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-9>current
- playback position</a> must increase monotonically at <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-5>effective playback rate</a> units
- of media time per unit time of the <a href=#media-timeline id=playing-the-media-resource:media-timeline-2>media timeline</a>'s clock. (This specification always
- refers to this as an <i>increase</i>, but that increase could actually be a <em>de</em>crease if
- the <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-6>effective playback rate</a> is negative.)</p>
- <p class=note>The <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-7>effective playback rate</a> can be 0.0, in which case the
- <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-10>current playback position</a> doesn't move, despite playback not being paused (<code id=playing-the-media-resource:dom-media-paused-13><a href=#dom-media-paused>paused</a></code> doesn't become true, and the <code id=playing-the-media-resource:event-media-pause-3><a href=#event-media-pause>pause</a></code> event doesn't fire).</p>
- <p class=note>This specification doesn't define how the user agent achieves the appropriate
- playback rate — depending on the protocol and media available, it is plausible that the user
- agent could negotiate with the server to have the server provide the media data at the appropriate
- rate, so that (except for the period between when the rate is changed and when the server updates
- the stream's playback rate) the client doesn't actually have to drop or interpolate any
- frames.</p>
- <p>Any time the user agent <a href=#await-a-stable-state id=playing-the-media-resource:await-a-stable-state>provides a stable state</a>,
- the <a href=#official-playback-position id=playing-the-media-resource:official-playback-position-2>official playback position</a> must be set to the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-11>current playback
- position</a>.</p>
- <p>While the <a href=#direction-of-playback id=playing-the-media-resource:direction-of-playback-8>direction of playback</a> is backwards, any corresponding audio must be
- <a href=#concept-media-muted id=playing-the-media-resource:concept-media-muted>muted</a>. While the <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-8>effective playback rate</a> is
- so low or so high that the user agent cannot play audio usefully, the corresponding audio must
- also be <a href=#concept-media-muted id=playing-the-media-resource:concept-media-muted-2>muted</a>. If the <a href=#effective-playback-rate id=playing-the-media-resource:effective-playback-rate-9>effective playback
- rate</a> is not 1.0, the user agent may apply pitch adjustments to the audio as necessary to
- render it faithfully.</p>
- <p><a href=#media-element id=playing-the-media-resource:media-element-56>Media elements</a> that are <a href=#potentially-playing id=playing-the-media-resource:potentially-playing-5>potentially playing</a>
- while not <a href=#in-a-document id=playing-the-media-resource:in-a-document>in a <code>Document</code></a> must not play any video, but should play any
- audio component. Media elements must not stop playing just because all references to them have
- been removed; only once a media element is in a state where no further audio could ever be played
- by that element may the element be garbage collected.</p>
- <p class=note>It is possible for an element to which no explicit references exist to play audio,
- even if such an element is not still actively playing: for instance, it could have a <a href=#current-media-controller id=playing-the-media-resource:current-media-controller-31>current
- media controller</a> that still has references and can still be unpaused, or it could be
- unpaused but stalled waiting for content to buffer.</p>
- <hr>
- <p>Each <a href=#media-element id=playing-the-media-resource:media-element-57>media element</a> has a <dfn id=list-of-newly-introduced-cues>list of newly introduced cues</dfn>, which must be
- initially empty. Whenever a <a href=#text-track-cue id=playing-the-media-resource:text-track-cue>text track cue</a> is added to the <a href=#text-track-list-of-cues id=playing-the-media-resource:text-track-list-of-cues>list of cues</a> of a <a href=#text-track id=playing-the-media-resource:text-track>text track</a> that is in the <a href=#list-of-text-tracks id=playing-the-media-resource:list-of-text-tracks>list of text
- tracks</a> for a <a href=#media-element id=playing-the-media-resource:media-element-58>media element</a>, that <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-2>cue</a> must
- be added to the <a href=#media-element id=playing-the-media-resource:media-element-59>media element</a>'s <a href=#list-of-newly-introduced-cues id=playing-the-media-resource:list-of-newly-introduced-cues>list of newly introduced cues</a>. Whenever
- a <a href=#text-track id=playing-the-media-resource:text-track-2>text track</a> is added to the <a href=#list-of-text-tracks id=playing-the-media-resource:list-of-text-tracks-2>list of text tracks</a> for a <a href=#media-element id=playing-the-media-resource:media-element-60>media
- element</a>, all of the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-3>cues</a> in that <a href=#text-track id=playing-the-media-resource:text-track-3>text
- track</a>'s <a href=#text-track-list-of-cues id=playing-the-media-resource:text-track-list-of-cues-2>list of cues</a> must be added to the
- <a href=#media-element id=playing-the-media-resource:media-element-61>media element</a>'s <a href=#list-of-newly-introduced-cues id=playing-the-media-resource:list-of-newly-introduced-cues-2>list of newly introduced cues</a>. When a <a href=#media-element id=playing-the-media-resource:media-element-62>media
- element</a>'s <a href=#list-of-newly-introduced-cues id=playing-the-media-resource:list-of-newly-introduced-cues-3>list of newly introduced cues</a> has new cues added while the
- <a href=#media-element id=playing-the-media-resource:media-element-63>media element</a>'s <a href=#show-poster-flag id=playing-the-media-resource:show-poster-flag-3>show poster flag</a> is not set, then the user agent must
- run the <i id=playing-the-media-resource:time-marches-on-2><a href=#time-marches-on>time marches on</a></i> steps.</p>
- <p>When a <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-4>text track cue</a> is removed from the <a href=#text-track-list-of-cues id=playing-the-media-resource:text-track-list-of-cues-3>list of cues</a> of a <a href=#text-track id=playing-the-media-resource:text-track-4>text track</a> that is in the <a href=#list-of-text-tracks id=playing-the-media-resource:list-of-text-tracks-3>list of text
- tracks</a> for a <a href=#media-element id=playing-the-media-resource:media-element-64>media element</a>, and whenever a <a href=#text-track id=playing-the-media-resource:text-track-5>text track</a> is removed
- from the <a href=#list-of-text-tracks id=playing-the-media-resource:list-of-text-tracks-4>list of text tracks</a> of a <a href=#media-element id=playing-the-media-resource:media-element-65>media element</a>, if the <a href=#media-element id=playing-the-media-resource:media-element-66>media
- element</a>'s <a href=#show-poster-flag id=playing-the-media-resource:show-poster-flag-4>show poster flag</a> is not set, then the user agent must run the
- <i id=playing-the-media-resource:time-marches-on-3><a href=#time-marches-on>time marches on</a></i> steps.</p>
- <p>When the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-12>current playback position</a> of a <a href=#media-element id=playing-the-media-resource:media-element-67>media element</a> changes (e.g.
- due to playback or seeking), the user agent must run the <i id=playing-the-media-resource:time-marches-on-4><a href=#time-marches-on>time marches on</a></i> steps. If the
- <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-13>current playback position</a> changes while the steps are running, then the user agent
- must wait for the steps to complete, and then must immediately rerun the steps. (These steps are
- thus run as often as possible or needed — if one iteration takes a long time, this can cause
- certain <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-5>cues</a> to be skipped over as the user agent rushes ahead
- to "catch up".)</p>
- <p>The <dfn id=time-marches-on><i>time marches on</i></dfn> steps are as follows:</p>
- <ol><li><p>Let <var>current cues</var> be a list of <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-6>cues</a>, initialised to contain all the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-7>cues</a> of all
- the <a href=#text-track-hidden id=playing-the-media-resource:text-track-hidden>hidden</a> or <a href=#text-track-showing id=playing-the-media-resource:text-track-showing>showing</a> <a href=#text-track id=playing-the-media-resource:text-track-6>text tracks</a> of the <a href=#media-element id=playing-the-media-resource:media-element-68>media
- element</a> (not the <a href=#text-track-disabled id=playing-the-media-resource:text-track-disabled>disabled</a> ones) whose <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time-2>start times</a> are less than or equal to the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-14>current
- playback position</a> and whose <a href=#text-track-cue-end-time id=playing-the-media-resource:text-track-cue-end-time-2>end times</a> are
- greater than the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-15>current playback position</a>.<li><p>Let <var>other cues</var> be a list of <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-8>cues</a>,
- initialised to contain all the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-9>cues</a> of <a href=#text-track-hidden id=playing-the-media-resource:text-track-hidden-2>hidden</a> and <a href=#text-track-showing id=playing-the-media-resource:text-track-showing-2>showing</a> <a href=#text-track id=playing-the-media-resource:text-track-7>text tracks</a> of the <a href=#media-element id=playing-the-media-resource:media-element-69>media element</a> that are not present in <var>current cues</var>.<li><p>Let <var>last time</var> be the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-16>current playback position</a> at the
- time this algorithm was last run for this <a href=#media-element id=playing-the-media-resource:media-element-70>media element</a>, if this is not the first
- time it has run.<li><p>If the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-17>current playback position</a> has, since the last time this algorithm was
- run, only changed through its usual monotonic increase during normal playback, then let <var>missed cues</var> be the list of <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-10>cues</a> in <var>other cues</var> whose <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time-3>start times</a> are
- greater than or equal to <var>last time</var> and whose <a href=#text-track-cue-end-time id=playing-the-media-resource:text-track-cue-end-time-3>end times</a> are less than or equal to the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-18>current playback position</a>.
- Otherwise, let <var>missed cues</var> be an empty list.<li><p>Remove all the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-11>cues</a> in <var>missed cues</var>
- that are also in the <a href=#media-element id=playing-the-media-resource:media-element-71>media element</a>'s <a href=#list-of-newly-introduced-cues id=playing-the-media-resource:list-of-newly-introduced-cues-4>list of newly introduced cues</a>, and
- then empty the element's <a href=#list-of-newly-introduced-cues id=playing-the-media-resource:list-of-newly-introduced-cues-5>list of newly introduced cues</a>.<li><p>If the time was reached through the usual monotonic increase of the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-19>current playback
- position</a> during normal playback, and if the user agent has not fired a <code id=playing-the-media-resource:event-media-timeupdate-6><a href=#event-media-timeupdate>timeupdate</a></code> event at the element in the past 15 to 250ms and
- is not still running event handlers for such an event, then the user agent must <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-13>queue a
- task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-13>fire a simple event</a> named <code id=playing-the-media-resource:event-media-timeupdate-7><a href=#event-media-timeupdate>timeupdate</a></code> at the element. (In the other cases, such as
- explicit seeks, relevant events get fired as part of the overall process of changing the
- <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-20>current playback position</a>.)</p>
- <p class=note>The event thus is not to be fired faster than about 66Hz or slower than 4Hz
- (assuming the event handlers don't take longer than 250ms to run). User agents are encouraged to
- vary the frequency of the event based on the system load and the average cost of processing the
- event each time, so that the UI updates are not any more frequent than the user agent can
- comfortably handle while decoding the video.<li><p>If all of the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-12>cues</a> in <var>current cues</var>
- have their <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag>text track cue active flag</a> set, none of the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-13>cues</a> in <var>other cues</var> have their <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-2>text track cue active
- flag</a> set, and <var>missed cues</var> is empty, then abort these steps.<li>
- <p>If the time was reached through the usual monotonic increase of the <a href=#current-playback-position id=playing-the-media-resource:current-playback-position-21>current playback
- position</a> during normal playback, and there are <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-14>cues</a>
- in <var>other cues</var> that have their <a href=#text-track-cue-pause-on-exit-flag id=playing-the-media-resource:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a>
- set and that either have their <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-3>text track cue active flag</a> set or are also in <var>missed cues</var>, then immediately <a href=#dom-media-pause id=playing-the-media-resource:dom-media-pause-2>pause</a> the
- <a href=#media-element id=playing-the-media-resource:media-element-72>media element</a>. </p>
- <p class=note>In the other cases, such as explicit seeks, playback is not paused by going past
- the end time of a <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-15>cue</a>, even if that <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-16>cue</a> has its <a href=#text-track-cue-pause-on-exit-flag id=playing-the-media-resource:text-track-cue-pause-on-exit-flag-2>text track cue pause-on-exit flag</a> set.</p>
- <li>
- <p>Let <var>events</var> be a list of <a href=#concept-task id=playing-the-media-resource:concept-task>tasks</a>,
- initially empty. Each <a href=#concept-task id=playing-the-media-resource:concept-task-2>task</a> in this list will be associated
- with a <a href=#text-track id=playing-the-media-resource:text-track-8>text track</a>, a <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-17>text track cue</a>, and a time, which are used to
- sort the list before the <a href=#concept-task id=playing-the-media-resource:concept-task-3>tasks</a> are queued.</p>
- <p>Let <var>affected tracks</var> be a list of <a href=#text-track id=playing-the-media-resource:text-track-9>text
- tracks</a>, initially empty.</p>
- <p>When the steps below say to <dfn id=prepare-an-event>prepare an event</dfn> named <var>event</var> for a
- <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-18>text track cue</a> <var>target</var> with a time <var>time</var>, the
- user agent must run these substeps:</p>
- <ol><li><p>Let <var>track</var> be the <a href=#text-track id=playing-the-media-resource:text-track-10>text track</a> with which the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-19>text
- track cue</a> <var>target</var> is associated.<li><p>Create a <a href=#concept-task id=playing-the-media-resource:concept-task-4>task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-14>fire a simple event</a>
- named <var>event</var> at <var>target</var>.<li><p>Add the newly created <a href=#concept-task id=playing-the-media-resource:concept-task-5>task</a> to <var>events</var>, associated with the time <var>time</var>, the <a href=#text-track id=playing-the-media-resource:text-track-11>text
- track</a> <var>track</var>, and the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-20>text track cue</a> <var>target</var>.<li><p>Add <var>track</var> to <var>affected tracks</var>.</ol>
- <li><p>For each <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-21>text track cue</a> in <var>missed
- cues</var>, <a href=#prepare-an-event id=playing-the-media-resource:prepare-an-event>prepare an event</a> named <code id=playing-the-media-resource:event-media-enter><a href=#event-media-enter>enter</a></code> for the
- <code id=playing-the-media-resource:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> object with the <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time-4>text track cue start time</a>.<li><p>For each <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-22>text track cue</a> in <var>other
- cues</var> that either has its <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-4>text track cue active flag</a> set or is in <var>missed cues</var>, <a href=#prepare-an-event id=playing-the-media-resource:prepare-an-event-2>prepare an event</a> named <code id=playing-the-media-resource:event-media-exit><a href=#event-media-exit>exit</a></code> for the <code id=playing-the-media-resource:texttrackcue-2><a href=#texttrackcue>TextTrackCue</a></code> object with the later of the
- <a href=#text-track-cue-end-time id=playing-the-media-resource:text-track-cue-end-time-4>text track cue end time</a> and the <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time-5>text track cue start time</a>.<li><p>For each <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-23>text track cue</a> in <var>current
- cues</var> that does not have its <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-5>text track cue active flag</a> set, <a href=#prepare-an-event id=playing-the-media-resource:prepare-an-event-3>prepare an
- event</a> named <code id=playing-the-media-resource:event-media-enter-2><a href=#event-media-enter>enter</a></code> for the <code id=playing-the-media-resource:texttrackcue-3><a href=#texttrackcue>TextTrackCue</a></code>
- object with the <a href=#text-track-cue-start-time id=playing-the-media-resource:text-track-cue-start-time-6>text track cue start time</a>.<li>
- <p>Sort the <a href=#concept-task id=playing-the-media-resource:concept-task-6>tasks</a> in <var>events</var> in ascending
- time order (<a href=#concept-task id=playing-the-media-resource:concept-task-7>tasks</a> with earlier times first).</p>
- <p>Further sort <a href=#concept-task id=playing-the-media-resource:concept-task-8>tasks</a> in <var>events</var> that have
- the same time by the relative <a href=#text-track-cue-order id=playing-the-media-resource:text-track-cue-order>text track cue order</a> of the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-24>text track cues</a> associated with these <a href=#concept-task id=playing-the-media-resource:concept-task-9>tasks</a>.</p>
- <p>Finally, sort <a href=#concept-task id=playing-the-media-resource:concept-task-10>tasks</a> in <var>events</var> that have
- the same time and same <a href=#text-track-cue-order id=playing-the-media-resource:text-track-cue-order-2>text track cue order</a> by placing <a href=#concept-task id=playing-the-media-resource:concept-task-11>tasks</a> that fire <code id=playing-the-media-resource:event-media-enter-3><a href=#event-media-enter>enter</a></code> events before
- those that fire <code id=playing-the-media-resource:event-media-exit-2><a href=#event-media-exit>exit</a></code> events.</p>
- <li><p><a href=#queue-a-task id=playing-the-media-resource:queue-a-task-14>Queue</a> each <a href=#concept-task id=playing-the-media-resource:concept-task-12>task</a> in
- <var>events</var>, in list order.<li><p>Sort <var>affected tracks</var> in the same order as the <a href=#text-track id=playing-the-media-resource:text-track-12>text tracks</a> appear in the <a href=#media-element id=playing-the-media-resource:media-element-73>media element</a>'s <a href=#list-of-text-tracks id=playing-the-media-resource:list-of-text-tracks-5>list of text
- tracks</a>, and remove duplicates.</p>
- <li><p>For each <a href=#text-track id=playing-the-media-resource:text-track-13>text track</a> in <var>affected tracks</var>, in the list
- order, <a href=#queue-a-task id=playing-the-media-resource:queue-a-task-15>queue a task</a> to <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-15>fire a simple event</a> named <code id=playing-the-media-resource:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code> at the <code id=playing-the-media-resource:texttrack><a href=#texttrack>TextTrack</a></code> object, and, if the
- <a href=#text-track id=playing-the-media-resource:text-track-14>text track</a> has a corresponding <code id=playing-the-media-resource:the-track-element><a href=#the-track-element>track</a></code> element, to then <a href=#fire-a-simple-event id=playing-the-media-resource:fire-a-simple-event-16>fire a
- simple event</a> named <code id=playing-the-media-resource:event-media-cuechange-2><a href=#event-media-cuechange>cuechange</a></code> at the
- <code id=playing-the-media-resource:the-track-element-2><a href=#the-track-element>track</a></code> element as well.<li><p>Set the <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-6>text track cue active flag</a> of all the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-25>cues</a> in the <var>current cues</var>, and unset the <a href=#text-track-cue-active-flag id=playing-the-media-resource:text-track-cue-active-flag-7>text track cue
- active flag</a> of all the <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-26>cues</a> in the <var>other
- cues</var>.<li><p>Run the <a href=#rules-for-updating-the-text-track-rendering id=playing-the-media-resource:rules-for-updating-the-text-track-rendering>rules for updating the text track rendering</a> of each of the <a href=#text-track id=playing-the-media-resource:text-track-15>text tracks</a> in <var>affected tracks</var> that are <a href=#text-track-showing id=playing-the-media-resource:text-track-showing-3>showing</a>. For example, for <a href=#text-track id=playing-the-media-resource:text-track-16>text tracks</a>
- based on WebVTT, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=playing-the-media-resource:rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a> </ol>
- <p>For the purposes of the algorithm above, a <a href=#text-track-cue id=playing-the-media-resource:text-track-cue-27>text track cue</a> is considered to be part
- of a <a href=#text-track id=playing-the-media-resource:text-track-17>text track</a> only if it is listed in the <a href=#text-track-list-of-cues id=playing-the-media-resource:text-track-list-of-cues-4>text track list of cues</a>, not
- merely if it is associated with the <a href=#text-track id=playing-the-media-resource:text-track-18>text track</a>.</p>
- <p class=note>If the <a href=#media-element id=playing-the-media-resource:media-element-74>media element</a>'s <a id=playing-the-media-resource:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> stops being a
- <a href=#fully-active id=playing-the-media-resource:fully-active-2>fully active</a> document, then the playback will <a href=#media-playback>stop</a>
- until the document is active again.</p>
- <p>When a <a href=#media-element id=playing-the-media-resource:media-element-75>media element</a> is <a href=#remove-an-element-from-a-document id=playing-the-media-resource:remove-an-element-from-a-document>removed
- from a <code>Document</code></a>, the user agent must run the following steps:</p>
- <ol><li><p>Asynchronously <a href=#await-a-stable-state id=playing-the-media-resource:await-a-stable-state-2>await a stable state</a>, allowing the <a href=#concept-task id=playing-the-media-resource:concept-task-13>task</a> that removed the <a href=#media-element id=playing-the-media-resource:media-element-76>media element</a> from the
- <code id=playing-the-media-resource:document-3><a href=#document>Document</a></code> to continue. The <a href=#synchronous-section id=playing-the-media-resource:synchronous-section>synchronous section</a> consists of all the
- remaining steps of this algorithm. (Steps in the <a href=#synchronous-section id=playing-the-media-resource:synchronous-section-2>synchronous section</a> are marked with
- ⌛.)<li><p>⌛ If the <a href=#media-element id=playing-the-media-resource:media-element-77>media element</a> is <a href=#in-a-document id=playing-the-media-resource:in-a-document-2>in a <code>Document</code></a>,
- abort these steps.<li><p>⌛ Run the <a href=#internal-pause-steps id=playing-the-media-resource:internal-pause-steps-2>internal pause steps</a> for the <a href=#media-element id=playing-the-media-resource:media-element-78>media element</a>.</p>
- </ol>
-
- <h5 id=seeking>4.8.14.9 Seeking</h5>
- <dl class=domintro><dt><var>media</var> . <code id=seeking:dom-media-seeking><a href=#dom-media-seeking>seeking</a></code><dd>
- <p>Returns true if the user agent is currently seeking.</p>
- <dt><var>media</var> . <code id=seeking:dom-media-seekable><a href=#dom-media-seekable>seekable</a></code><dd>
- <p>Returns a <code id=seeking:timeranges><a href=#timeranges>TimeRanges</a></code> object that represents the ranges of the <a href=#media-resource id=seeking:media-resource>media
- resource</a> to which it is possible for the user agent to seek.</p>
- <dt><var>media</var> . <code id=seeking:dom-media-fastseek><a href=#dom-media-fastseek>fastSeek</a></code>( <var>time</var> )<dd>
- <p>Seeks to near the given <var>time</var> as fast as possible, trading precision for
- speed. (To seek to a precise time, use the <code id=seeking:dom-media-currenttime><a href=#dom-media-currenttime>currentTime</a></code> attribute.)</p>
- <p>This does nothing if the media resource has not been loaded.</p>
- </dl>
-
- <p>The <dfn id=dom-media-seeking><code>seeking</code></dfn> attribute must initially have the
- value false.</p>
- <p>The <dfn id=dom-media-fastseek><code>fastSeek()</code></dfn> method must <a href=#dom-media-seek id=seeking:dom-media-seek>seek</a> to the time given by the method's argument, with the
- <i>approximate-for-speed</i> flag set.</p>
- <p>When the user agent is required to <dfn id=dom-media-seek>seek</dfn> to a particular <var>new playback position</var> in the <a href=#media-resource id=seeking:media-resource-2>media resource</a>, optionally with the
- <i>approximate-for-speed</i> flag set, it means that the user agent must run the following steps.
- This algorithm interacts closely with the <a href=#event-loop id=seeking:event-loop>event loop</a> mechanism; in particular, it has
- a <a href=#synchronous-section id=seeking:synchronous-section>synchronous section</a> (which is triggered as part of the <a href=#event-loop id=seeking:event-loop-2>event loop</a>
- algorithm). Steps in that section are marked with ⌛.</p>
- <ol><li><p>Set the <a href=#media-element id=seeking:media-element>media element</a>'s <a href=#show-poster-flag id=seeking:show-poster-flag>show poster flag</a> to false.<li><p>If the <a href=#media-element id=seeking:media-element-2>media element</a>'s <code id=seeking:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code>
- is <code id=seeking:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>, abort these steps.<li><p>If the element's <code id=seeking:dom-media-seeking-2><a href=#dom-media-seeking>seeking</a></code> IDL attribute is true,
- then another instance of this algorithm is already running. Abort that other instance of the
- algorithm without waiting for the step that it is running to complete.<li><p>Set the <code id=seeking:dom-media-seeking-3><a href=#dom-media-seeking>seeking</a></code> IDL attribute to true.<li><p>If the seek was in response to a DOM method call or setting of an IDL attribute, then
- continue the script. The remainder of these steps must be run asynchronously. With the exception
- of the steps marked with ⌛, they could be aborted at any time by another instance of this
- algorithm being invoked.<li><p>If the <var>new playback position</var> is later than the end of the <a href=#media-resource id=seeking:media-resource-3>media
- resource</a>, then let it be the end of the <a href=#media-resource id=seeking:media-resource-4>media resource</a> instead.<li><p>If the <var>new playback position</var> is less than the <a href=#earliest-possible-position id=seeking:earliest-possible-position>earliest possible
- position</a>, let it be that position instead.<li><p>If the (possibly now changed) <var>new playback position</var> is not in one of
- the ranges given in the <code id=seeking:dom-media-seekable-2><a href=#dom-media-seekable>seekable</a></code> attribute, then let it
- be the position in one of the ranges given in the <code id=seeking:dom-media-seekable-3><a href=#dom-media-seekable>seekable</a></code> attribute that is the nearest to the <var>new
- playback position</var>. If two positions both satisfy that constraint (i.e. the <var>new playback position</var> is exactly in the middle between two ranges in the <code id=seeking:dom-media-seekable-4><a href=#dom-media-seekable>seekable</a></code> attribute) then use the position that is closest to
- the <a href=#current-playback-position id=seeking:current-playback-position>current playback position</a>. If there are no ranges given in the <code id=seeking:dom-media-seekable-5><a href=#dom-media-seekable>seekable</a></code> attribute then set the <code id=seeking:dom-media-seeking-4><a href=#dom-media-seeking>seeking</a></code> IDL attribute to false and abort these steps.<li>
- <p>If the <i>approximate-for-speed</i> flag is set, adjust the <var>new playback
- position</var> to a value that will allow for playback to resume promptly. If <var>new
- playback position</var> before this step is before <a href=#current-playback-position id=seeking:current-playback-position-2>current playback position</a>, then
- the adjusted <var>new playback position</var> must also be before the <a href=#current-playback-position id=seeking:current-playback-position-3>current
- playback position</a>. Similarly, if the <var>new playback position</var> before
- this step is after <a href=#current-playback-position id=seeking:current-playback-position-4>current playback position</a>, then the adjusted <var>new
- playback position</var> must also be after the <a href=#current-playback-position id=seeking:current-playback-position-5>current playback position</a>.</p>
- <p class=example>For example, the user agent could snap to a nearby key frame, so that it
- doesn't have to spend time decoding then discarding intermediate frames before resuming
- playback.</p>
- <li><p><a href=#queue-a-task id=seeking:queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event id=seeking:fire-a-simple-event>fire a simple event</a> named <code id=seeking:event-media-seeking><a href=#event-media-seeking>seeking</a></code> at the element.<li>
- <p>Set the <a href=#current-playback-position id=seeking:current-playback-position-6>current playback position</a> to the <var>new playback
- position</var>.</p>
- <p class=note>If the <a href=#media-element id=seeking:media-element-3>media element</a> was <a href=#potentially-playing id=seeking:potentially-playing>potentially playing</a>
- immediately before it started seeking, but seeking caused its <code id=seeking:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute to change to a value lower than <code id=seeking:dom-media-have_future_data><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>, then a <code id=seeking:event-media-waiting><a href=#event-media-waiting>waiting</a></code> event <a href=#fire-waiting-when-waiting>will be
- fired</a> at the element.</p>
-
- <p class=note>This step sets the <a href=#current-playback-position id=seeking:current-playback-position-7>current playback position</a>, and thus can
- immediately trigger other conditions, such as the rules regarding when playback "<a href=#reaches-the-end>reaches the end of the media resource</a>" (part of the logic that
- handles looping), even before the user agent is actually able to render the media data for that
- position (as determined in the next step).</p>
- <p class=note>The <code id=seeking:dom-media-currenttime-2><a href=#dom-media-currenttime>currentTime</a></code> attribute returns
- the <a href=#official-playback-position id=seeking:official-playback-position>official playback position</a>, not the <a href=#current-playback-position id=seeking:current-playback-position-8>current playback position</a>, and
- therefore gets updated before script execution, separate from this algorithm.</p>
- <li><p>Wait until the user agent has established whether or not the <a href=#media-data id=seeking:media-data>media data</a> for
- the <var>new playback position</var> is available, and, if it is, until it has decoded
- enough data to play back that position.</p>
-
- <li><p><a href=#await-a-stable-state id=seeking:await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section id=seeking:synchronous-section-2>synchronous section</a> consists of all
- the remaining steps of this algorithm. (Steps in the <a href=#synchronous-section id=seeking:synchronous-section-3>synchronous section</a> are marked
- with ⌛.)<li><p>⌛ Set the <code id=seeking:dom-media-seeking-5><a href=#dom-media-seeking>seeking</a></code> IDL attribute to
- false.<li><p>⌛ Run the <a href=#time-marches-on id=seeking:time-marches-on>time marches on</a> steps.<li id=seekUpdate><p>⌛ <a href=#queue-a-task id=seeking:queue-a-task-2>Queue a task</a> to <a href=#fire-a-simple-event id=seeking:fire-a-simple-event-2>fire a simple event</a>
- named <code id=seeking:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> at the element.<li><p>⌛ <a href=#queue-a-task id=seeking:queue-a-task-3>Queue a task</a> to <a href=#fire-a-simple-event id=seeking:fire-a-simple-event-3>fire a simple event</a> named <code id=seeking:event-media-seeked><a href=#event-media-seeked>seeked</a></code> at the element.</ol>
- <hr>
- <p>The <dfn id=dom-media-seekable><code>seekable</code></dfn> attribute must return a new
- static <a href=#normalised-timeranges-object id=seeking:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the ranges of the
- <a href=#media-resource id=seeking:media-resource-5>media resource</a>, if any, that the user agent is able to seek to, at the time the
- attribute is evaluated.</p>
- <p class=note>If the user agent can seek to anywhere in the <a href=#media-resource id=seeking:media-resource-6>media resource</a>, e.g.
- because it is a simple movie file and the user agent and the server support HTTP Range requests,
- then the attribute would return an object with one range, whose start is the time of the first
- frame (the <a href=#earliest-possible-position id=seeking:earliest-possible-position-2>earliest possible position</a>, typically zero), and whose end is the same as
- the time of the first frame plus the <code id=seeking:dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute's
- value (which would equal the time of the last frame, and might be positive Infinity).</p>
- <p class=note>The range might be continuously changing, e.g. if the user agent is buffering a
- sliding window on an infinite stream. This is the behavior seen with DVRs viewing live TV, for
- instance.</p>
- <p><a href=#media-resource id=seeking:media-resource-7>Media resources</a> might be internally scripted or
- interactive. Thus, a <a href=#media-element id=seeking:media-element-4>media element</a> could play in a non-linear fashion. If this
- happens, the user agent must act as if the algorithm for <a href=#dom-media-seek id=seeking:dom-media-seek-2>seeking</a> was used whenever the <a href=#current-playback-position id=seeking:current-playback-position-9>current playback position</a>
- changes in a discontinuous fashion (so that the relevant events fire). If the <a href=#media-element id=seeking:media-element-5>media
- element</a> has a <a href=#current-media-controller id=seeking:current-media-controller>current media controller</a>, then the user agent must <a href=#seek-the-media-controller id=seeking:seek-the-media-controller>seek
- the media controller</a> appropriately instead. </p>
-
- <h5 id=media-resources-with-multiple-media-tracks>4.8.14.10 Media resources with multiple media tracks</h5>
- <p>A <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource>media resource</a> can have multiple embedded audio and video tracks. For example,
- in addition to the primary video and audio tracks, a <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-2>media resource</a> could have
- foreign-language dubbed dialogues, director's commentaries, audio descriptions, alternative
- angles, or sign-language overlays.</p>
- <dl class=domintro><dt><var>media</var> . <code id=media-resources-with-multiple-media-tracks:dom-media-audiotracks><a href=#dom-media-audiotracks>audioTracks</a></code><dd>
- <p>Returns an <code id=media-resources-with-multiple-media-tracks:audiotracklist><a href=#audiotracklist>AudioTrackList</a></code> object representing the audio tracks available in the
- <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-3>media resource</a>.</p>
- <dt><var>media</var> . <code id=media-resources-with-multiple-media-tracks:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code><dd>
- <p>Returns a <code id=media-resources-with-multiple-media-tracks:videotracklist><a href=#videotracklist>VideoTrackList</a></code> object representing the video tracks available in the
- <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-4>media resource</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-media-audiotracks><code>audioTracks</code></dfn> attribute of a
- <a href=#media-element id=media-resources-with-multiple-media-tracks:media-element>media element</a> must return a <a href=#live id=media-resources-with-multiple-media-tracks:live>live</a> <code id=media-resources-with-multiple-media-tracks:audiotracklist-2><a href=#audiotracklist>AudioTrackList</a></code> object
- representing the audio tracks available in the <a href=#media-element id=media-resources-with-multiple-media-tracks:media-element-2>media element</a>'s <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-5>media
- resource</a>. The same object must be returned each time.</p>
- <p>The <dfn id=dom-media-videotracks><code>videoTracks</code></dfn> attribute of a
- <a href=#media-element id=media-resources-with-multiple-media-tracks:media-element-3>media element</a> must return a <a href=#live id=media-resources-with-multiple-media-tracks:live-2>live</a> <code id=media-resources-with-multiple-media-tracks:videotracklist-2><a href=#videotracklist>VideoTrackList</a></code> object
- representing the video tracks available in the <a href=#media-element id=media-resources-with-multiple-media-tracks:media-element-4>media element</a>'s <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-6>media
- resource</a>. The same object must be returned each time.</p>
- <p class=note>There are only ever one <code id=media-resources-with-multiple-media-tracks:audiotracklist-3><a href=#audiotracklist>AudioTrackList</a></code> object and one
- <code id=media-resources-with-multiple-media-tracks:videotracklist-3><a href=#videotracklist>VideoTrackList</a></code> object per <a href=#media-element id=media-resources-with-multiple-media-tracks:media-element-5>media element</a>, even if another <a href=#media-resource id=media-resources-with-multiple-media-tracks:media-resource-7>media
- resource</a> is loaded into the element: the objects are reused. (The <code id=media-resources-with-multiple-media-tracks:audiotrack><a href=#audiotrack>AudioTrack</a></code>
- and <code id=media-resources-with-multiple-media-tracks:videotrack><a href=#videotrack>VideoTrack</a></code> objects are not, though.)</p>
-
- <div class=example>
- <p>In this example, a script defines a function that takes a URL to a video and a reference to an
- element where the video is to be placed. That function then tries to load the video, and, once it
- is loaded, checks to see if there is a sign-language track available. If there is, it also
- displays that track. Both tracks are just placed in the given container; it's assumed that styles
- have been applied to make this work in a pretty way!</p>
- <pre><script>
- function loadVideo(url, container) {
- var controller = new MediaController();
- var video = document.createElement('video');
- video.src = url;
- video.autoplay = true;
- video.controls = true;
- video.controller = controller;
- container.appendChild(video);
- video.onloadedmetadata = function (event) {
- for (var i = 0; i < video.videoTracks.length; i += 1) {
- if (video.videoTracks[i].kind == 'sign') {
- var sign = document.createElement('video');
- sign.src = url + '#track=' + video.videoTracks[i].id;
- sign.autoplay = true;
- sign.controller = controller;
- container.appendChild(sign);
- return;
- }
- }
- };
- }
- </script></pre>
- </div>
- <h6 id=audiotracklist-and-videotracklist-objects>4.8.14.10.1 <code id=audiotracklist-and-videotracklist-objects:audiotracklist><a href=#audiotracklist>AudioTrackList</a></code> and <code id=audiotracklist-and-videotracklist-objects:videotracklist><a href=#videotracklist>VideoTrackList</a></code> objects</h6>
- <p>The <code id=audiotracklist-and-videotracklist-objects:audiotracklist-2><a href=#audiotracklist>AudioTrackList</a></code> and <code id=audiotracklist-and-videotracklist-objects:videotracklist-2><a href=#videotracklist>VideoTrackList</a></code> interfaces are used by
- attributes defined in the previous section.</p>
- <pre class=idl>interface <dfn id=audiotracklist>AudioTrackList</dfn> : <a href=#eventtarget id=audiotracklist-and-videotracklist-objects:eventtarget>EventTarget</a> {
- readonly attribute unsigned long <a href=#dom-audiotracklist-length id=audiotracklist-and-videotracklist-objects:dom-audiotracklist-length>length</a>;
- getter <a href=#audiotrack id=audiotracklist-and-videotracklist-objects:audiotrack>AudioTrack</a> (unsigned long index);
- <a href=#audiotrack id=audiotracklist-and-videotracklist-objects:audiotrack-2>AudioTrack</a>? <a href=#dom-audiotracklist-gettrackbyid id=audiotracklist-and-videotracklist-objects:dom-audiotracklist-gettrackbyid>getTrackById</a>(DOMString id);
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler>EventHandler</a> <a href=#handler-tracklist-onchange id=audiotracklist-and-videotracklist-objects:handler-tracklist-onchange>onchange</a>;
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler-2>EventHandler</a> <a href=#handler-tracklist-onaddtrack id=audiotracklist-and-videotracklist-objects:handler-tracklist-onaddtrack>onaddtrack</a>;
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler-3>EventHandler</a> <a href=#handler-tracklist-onremovetrack id=audiotracklist-and-videotracklist-objects:handler-tracklist-onremovetrack>onremovetrack</a>;
- };
- interface <dfn id=audiotrack>AudioTrack</dfn> {
- readonly attribute DOMString <a href=#dom-audiotrack-id id=audiotracklist-and-videotracklist-objects:dom-audiotrack-id>id</a>;
- readonly attribute DOMString <a href=#dom-audiotrack-kind id=audiotracklist-and-videotracklist-objects:dom-audiotrack-kind>kind</a>;
- readonly attribute DOMString <a href=#dom-audiotrack-label id=audiotracklist-and-videotracklist-objects:dom-audiotrack-label>label</a>;
- readonly attribute DOMString <a href=#dom-audiotrack-language id=audiotracklist-and-videotracklist-objects:dom-audiotrack-language>language</a>;
- attribute boolean <a href=#dom-audiotrack-enabled id=audiotracklist-and-videotracklist-objects:dom-audiotrack-enabled>enabled</a>;
- };
- interface <dfn id=videotracklist>VideoTrackList</dfn> : <a href=#eventtarget id=audiotracklist-and-videotracklist-objects:eventtarget-2>EventTarget</a> {
- readonly attribute unsigned long <a href=#dom-videotracklist-length id=audiotracklist-and-videotracklist-objects:dom-videotracklist-length>length</a>;
- getter <a href=#videotrack id=audiotracklist-and-videotracklist-objects:videotrack>VideoTrack</a> (unsigned long index);
- <a href=#videotrack id=audiotracklist-and-videotracklist-objects:videotrack-2>VideoTrack</a>? <a href=#dom-videotracklist-gettrackbyid id=audiotracklist-and-videotracklist-objects:dom-videotracklist-gettrackbyid>getTrackById</a>(DOMString id);
- readonly attribute long <a href=#dom-videotracklist-selectedindex id=audiotracklist-and-videotracklist-objects:dom-videotracklist-selectedindex>selectedIndex</a>;
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler-4>EventHandler</a> <a href=#handler-tracklist-onchange id=audiotracklist-and-videotracklist-objects:handler-tracklist-onchange-2>onchange</a>;
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler-5>EventHandler</a> <a href=#handler-tracklist-onaddtrack id=audiotracklist-and-videotracklist-objects:handler-tracklist-onaddtrack-2>onaddtrack</a>;
- attribute <a href=#eventhandler id=audiotracklist-and-videotracklist-objects:eventhandler-6>EventHandler</a> <a href=#handler-tracklist-onremovetrack id=audiotracklist-and-videotracklist-objects:handler-tracklist-onremovetrack-2>onremovetrack</a>;
- };
- interface <dfn id=videotrack>VideoTrack</dfn> {
- readonly attribute DOMString <a href=#dom-videotrack-id id=audiotracklist-and-videotracklist-objects:dom-videotrack-id>id</a>;
- readonly attribute DOMString <a href=#dom-videotrack-kind id=audiotracklist-and-videotracklist-objects:dom-videotrack-kind>kind</a>;
- readonly attribute DOMString <a href=#dom-videotrack-label id=audiotracklist-and-videotracklist-objects:dom-videotrack-label>label</a>;
- readonly attribute DOMString <a href=#dom-videotrack-language id=audiotracklist-and-videotracklist-objects:dom-videotrack-language>language</a>;
- attribute boolean <a href=#dom-videotrack-selected id=audiotracklist-and-videotracklist-objects:dom-videotrack-selected>selected</a>;
- };</pre>
- <dl class=domintro><dt><var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-audiotracks><a href=#dom-media-audiotracks>audioTracks</a></code> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotracklist-length-2><a href=#dom-audiotracklist-length>length</a></code><dt><var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code> . <code id=audiotracklist-and-videotracklist-objects:dom-videotracklist-length-2><a href=#dom-videotracklist-length>length</a></code><dd>
- <p>Returns the number of tracks in the list.</p>
- <dt><var>audioTrack</var> = <var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-audiotracks-2><a href=#dom-media-audiotracks>audioTracks</a></code>[<var>index</var>]<dt><var>videoTrack</var> = <var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-videotracks-2><a href=#dom-media-videotracks>videoTracks</a></code>[<var>index</var>]<dd>
- <p>Returns the specified <code id=audiotracklist-and-videotracklist-objects:audiotrack-3><a href=#audiotrack>AudioTrack</a></code> or <code id=audiotracklist-and-videotracklist-objects:videotrack-3><a href=#videotrack>VideoTrack</a></code> object.</p>
- <dt><var>audioTrack</var> = <var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-audiotracks-3><a href=#dom-media-audiotracks>audioTracks</a></code> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotracklist-gettrackbyid-2><a href=#dom-audiotracklist-gettrackbyid>getTrackById</a></code>( <var>id</var> )<dt><var>videoTrack</var> = <var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-videotracks-3><a href=#dom-media-videotracks>videoTracks</a></code> . <code id=audiotracklist-and-videotracklist-objects:dom-videotracklist-gettrackbyid-2><a href=#dom-videotracklist-gettrackbyid>getTrackById</a></code>( <var>id</var> )<dd>
- <p>Returns the <code id=audiotracklist-and-videotracklist-objects:audiotrack-4><a href=#audiotrack>AudioTrack</a></code> or <code id=audiotracklist-and-videotracklist-objects:videotrack-4><a href=#videotrack>VideoTrack</a></code> object with the given identifier, or null if no track has that identifier.</p>
- <dt><var>audioTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-id-2><a href=#dom-audiotrack-id>id</a></code><dt><var>videoTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-id-2><a href=#dom-videotrack-id>id</a></code><dd>
- <p>Returns the ID of the given track. This is the ID that can be used with a fragment identifier
- if the format supports the <cite>Media Fragments URI</cite> syntax, and that can be used with
- the <code>getTrackById()</code> method. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <dt><var>audioTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-kind-2><a href=#dom-audiotrack-kind>kind</a></code><dt><var>videoTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-kind-2><a href=#dom-videotrack-kind>kind</a></code><dd>
- <p>Returns the category the given track falls into. The <a href=#dom-TrackList-getKind-categories>possible track categories</a> are given below.</p>
- <dt><var>audioTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-label-2><a href=#dom-audiotrack-label>label</a></code><dt><var>videoTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-label-2><a href=#dom-videotrack-label>label</a></code><dd>
- <p>Returns the label of the given track, if known, or the empty string otherwise.</p>
- <dt><var>audioTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-language-2><a href=#dom-audiotrack-language>language</a></code><dt><var>videoTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-language-2><a href=#dom-videotrack-language>language</a></code><dd>
- <p>Returns the language of the given track, if known, or the empty string otherwise.</p>
- <dt><var>audioTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-enabled-2><a href=#dom-audiotrack-enabled>enabled</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if the given track is active, and false otherwise.</p>
- <p>Can be set, to change whether the track is enabled or not. If multiple audio tracks are
- enabled simultaneously, they are mixed.</p>
- <dt><var>media</var> . <code id=audiotracklist-and-videotracklist-objects:dom-media-videotracks-4><a href=#dom-media-videotracks>videoTracks</a></code> . <code id=audiotracklist-and-videotracklist-objects:dom-videotracklist-selectedindex-2><a href=#dom-videotracklist-selectedindex>selectedIndex</a></code><dd>
- <p>Returns the index of the currently selected track, if any, or −1 otherwise.</p>
- <dt><var>videoTrack</var> . <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-selected-2><a href=#dom-videotrack-selected>selected</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if the given track is active, and false otherwise.</p>
- <p>Can be set, to change whether the track is selected or not. Either zero or one video track is
- selected; selecting a new track while a previous one is selected will unselect the previous
- one.</p>
- </dl>
-
- <p>An <code id=audiotracklist-and-videotracklist-objects:audiotracklist-3><a href=#audiotracklist>AudioTrackList</a></code> object represents a dynamic list of zero or more audio tracks,
- of which zero or more can be enabled at a time. Each audio track is represented by an
- <code id=audiotracklist-and-videotracklist-objects:audiotrack-5><a href=#audiotrack>AudioTrack</a></code> object.</p>
- <p>A <code id=audiotracklist-and-videotracklist-objects:videotracklist-3><a href=#videotracklist>VideoTrackList</a></code> object represents a dynamic list of zero or more video tracks, of
- which zero or one can be selected at a time. Each video track is represented by a
- <code id=audiotracklist-and-videotracklist-objects:videotrack-5><a href=#videotrack>VideoTrack</a></code> object.</p>
- <p>Tracks in <code id=audiotracklist-and-videotracklist-objects:audiotracklist-4><a href=#audiotracklist>AudioTrackList</a></code> and <code id=audiotracklist-and-videotracklist-objects:videotracklist-4><a href=#videotracklist>VideoTrackList</a></code> objects must be
- consistently ordered. If the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource>media resource</a> is in a format that defines an order,
- then that order must be used; otherwise, the order must be the relative order in which the tracks
- are declared in the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-2>media resource</a>. The order used is called the <i>natural order</i>
- of the list.</p>
- <p class=note>Each track in one of these objects thus has an index; the first has the index
- 0, and each subsequent track is numbered one higher than the previous one. If a <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-3>media
- resource</a> dynamically adds or removes audio or video tracks, then the indices of the tracks
- will change dynamically. If the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-4>media resource</a> changes entirely, then all the
- previous tracks will be removed and replaced with new tracks.</p>
- <p>The <dfn id=dom-audiotracklist-length><code>AudioTrackList.length</code></dfn> and <dfn id=dom-videotracklist-length><code>VideoTrackList.length</code></dfn> attributes must return
- the number of tracks represented by their objects at the time of getting.</p>
- <p>The <a href=#supported-property-indices id=audiotracklist-and-videotracklist-objects:supported-property-indices>supported property indices</a> of <code id=audiotracklist-and-videotracklist-objects:audiotracklist-5><a href=#audiotracklist>AudioTrackList</a></code> and
- <code id=audiotracklist-and-videotracklist-objects:videotracklist-5><a href=#videotracklist>VideoTrackList</a></code> objects at any instant are the numbers from zero to the number of
- tracks represented by the respective object minus one, if any tracks are represented. If an
- <code id=audiotracklist-and-videotracklist-objects:audiotracklist-6><a href=#audiotracklist>AudioTrackList</a></code> or <code id=audiotracklist-and-videotracklist-objects:videotracklist-6><a href=#videotracklist>VideoTrackList</a></code> object represents no tracks, it has no
- <a href=#supported-property-indices id=audiotracklist-and-videotracklist-objects:supported-property-indices-2>supported property indices</a>.</p>
- <p>To <a href=#determine-the-value-of-an-indexed-property id=audiotracklist-and-videotracklist-objects:determine-the-value-of-an-indexed-property>determine the value of an indexed property</a> for a given index <var>index</var> in an <code id=audiotracklist-and-videotracklist-objects:audiotracklist-7><a href=#audiotracklist>AudioTrackList</a></code> or <code id=audiotracklist-and-videotracklist-objects:videotracklist-7><a href=#videotracklist>VideoTrackList</a></code> object <var>list</var>, the user agent must return the <code id=audiotracklist-and-videotracklist-objects:audiotrack-6><a href=#audiotrack>AudioTrack</a></code> or
- <code id=audiotracklist-and-videotracklist-objects:videotrack-6><a href=#videotrack>VideoTrack</a></code> object that represents the <var>index</var>th track in <var>list</var>.</p>
- <p>The <dfn id=dom-audiotracklist-gettrackbyid><code>AudioTrackList.getTrackById(<var>id</var>)</code></dfn> and <dfn id=dom-videotracklist-gettrackbyid><code>VideoTrackList.getTrackById(<var>id</var>)</code></dfn> methods must return the first <code id=audiotracklist-and-videotracklist-objects:audiotrack-7><a href=#audiotrack>AudioTrack</a></code> or
- <code id=audiotracklist-and-videotracklist-objects:videotrack-7><a href=#videotrack>VideoTrack</a></code> object (respectively) in the <code id=audiotracklist-and-videotracklist-objects:audiotracklist-8><a href=#audiotracklist>AudioTrackList</a></code> or
- <code id=audiotracklist-and-videotracklist-objects:videotracklist-8><a href=#videotracklist>VideoTrackList</a></code> object (respectively) whose identifier is equal to the value of the
- <var>id</var> argument (in the natural order of the list, as defined above). When no
- tracks match the given argument, the methods must return null.</p>
- <p>The <code id=audiotracklist-and-videotracklist-objects:audiotrack-8><a href=#audiotrack>AudioTrack</a></code> and <code id=audiotracklist-and-videotracklist-objects:videotrack-8><a href=#videotrack>VideoTrack</a></code> objects represent specific tracks of a
- <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-5>media resource</a>. Each track can have an identifier, category, label, and language.
- These aspects of a track are permanent for the lifetime of the track; even if a track is removed
- from a <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-6>media resource</a>'s <code id=audiotracklist-and-videotracklist-objects:audiotracklist-9><a href=#audiotracklist>AudioTrackList</a></code> or <code id=audiotracklist-and-videotracklist-objects:videotracklist-9><a href=#videotracklist>VideoTrackList</a></code>
- objects, those aspects do not change.</p>
- <p>In addition, <code id=audiotracklist-and-videotracklist-objects:audiotrack-9><a href=#audiotrack>AudioTrack</a></code> objects can each be enabled or disabled; this is the audio
- track's <i>enabled state</i>. When an <code id=audiotracklist-and-videotracklist-objects:audiotrack-10><a href=#audiotrack>AudioTrack</a></code> is created, its <i>enabled state</i>
- must be set to false (disabled). The <a href=#concept-media-load-resource id=audiotracklist-and-videotracklist-objects:concept-media-load-resource>resource fetch
- algorithm</a> can override this.</p>
- <p>Similarly, a single <code id=audiotracklist-and-videotracklist-objects:videotrack-9><a href=#videotrack>VideoTrack</a></code> object per <code id=audiotracklist-and-videotracklist-objects:videotracklist-10><a href=#videotracklist>VideoTrackList</a></code> object can
- be selected, this is the video track's <i>selection state</i>. When a <code id=audiotracklist-and-videotracklist-objects:videotrack-10><a href=#videotrack>VideoTrack</a></code> is
- created, its <i>selection state</i> must be set to false (not selected). The <a href=#concept-media-load-resource id=audiotracklist-and-videotracklist-objects:concept-media-load-resource-2>resource fetch algorithm</a> can override this.</p>
- <p>The <dfn id=dom-audiotrack-id><code>AudioTrack.id</code></dfn> and <dfn id=dom-videotrack-id><code>VideoTrack.id</code></dfn> attributes must return the identifier
- of the track, if it has one, or the empty string otherwise. If the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-7>media resource</a> is
- in a format that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the
- identifier returned for a particular track must be the same identifier that would enable the track
- if used as the name of a track in the track dimension of such a fragment identifier. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a> <a href=#refsINBAND>[INBAND]</a></p>
- <p class=example>For example, in Ogg files, this would be the Name header field of the track. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a></p>
- <p>The <dfn id=dom-audiotrack-kind><code>AudioTrack.kind</code></dfn> and <dfn id=dom-videotrack-kind><code>VideoTrack.kind</code></dfn> attributes must return the category
- of the track, if it has one, or the empty string otherwise.</p>
- <p>The category of a track is the string given in the first column of the table below that is the
- most appropriate for the track based on the definitions in the table's second and third columns,
- as determined by the metadata included in the track in the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-8>media resource</a>. The cell
- in the third column of a row says what the category given in the cell in the first column of that
- row applies to; a category is only appropriate for an audio track if it applies to audio tracks,
- and a category is only appropriate for video tracks if it applies to video tracks. Categories must
- only be returned for <code id=audiotracklist-and-videotracklist-objects:audiotrack-11><a href=#audiotrack>AudioTrack</a></code> objects if they are appropriate for audio, and must
- only be returned for <code id=audiotracklist-and-videotracklist-objects:videotrack-11><a href=#videotrack>VideoTrack</a></code> objects if they are appropriate for video.</p>
- <p>For Ogg files, the Role header field of the track gives the relevant metadata. For DASH media
- resources, the <code>Role</code> element conveys the information. For WebM, only the
- <code>FlagDefault</code> element currently maps to a value. The <cite>Sourcing In-band
- Media Resource Tracks from Media Containers into HTML</cite> specification has further details.
- <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a> <a href=#refsDASH>[DASH]</a> <a href=#refsWEBMCG>[WEBMCG]</a> <a href=#refsINBAND>[INBAND]</a></p>
-
- <table id=dom-TrackList-getKind-categories><caption>Return values for <code id=audiotracklist-and-videotracklist-objects:dom-audiotrack-kind-3><a href=#dom-audiotrack-kind>AudioTrack.kind</a></code> and <code id=audiotracklist-and-videotracklist-objects:dom-videotrack-kind-3><a href=#dom-videotrack-kind>VideoTrack.kind</a></code></caption><thead><tr><th>Category
- <th>Definition
- <th>Applies to...<th>Examples
- <tbody><tr><td>"<dfn id=value-track-kind-alternate><code>alternative</code></dfn>"
- <td>A possible alternative to the main track, e.g. a different take of a song (audio), or a different angle (video).
- <td>Audio and video.
- <td>Ogg: "audio/alternate" or "video/alternate"; DASH: "alternate" without "main" and "commentary" roles, and, for audio, without the "dub" role (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-caption><code>captions</code></dfn>"
- <td>A version of the main video track with captions burnt in. (For legacy content; new content would use text tracks.)
- <td>Video only.
- <td>DASH: "caption" and "main" roles together (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-descriptions><code>descriptions</code></dfn>"
- <td>An audio description of a video track.
- <td>Audio only.
- <td>Ogg: "audio/audiodesc".
- <tr><td>"<dfn id=value-track-kind-main><code>main</code></dfn>"
- <td>The primary audio or video track.
- <td>Audio and video.
- <td>Ogg: "audio/main" or "video/main"; WebM: the "FlagDefault" element is set; DASH: "main" role without "caption", "subtitle", and "dub" roles (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-main-desc><code>main-desc</code></dfn>"
- <td>The primary audio track, mixed with audio descriptions.
- <td>Audio only.
- <td>AC3 audio in MPEG-2 TS: bsmod=2 and full_svc=1.
- <tr><td>"<dfn id=value-track-kind-sign><code>sign</code></dfn>"
- <td>A sign-language interpretation of an audio track.
- <td>Video only.
- <td>Ogg: "video/sign".
- <tr><td>"<dfn id=value-track-kind-subtitle><code>subtitles</code></dfn>"
- <td>A version of the main video track with subtitles burnt in. (For legacy content; new content would use text tracks.)
- <td>Video only.
- <td>DASH: "subtitle" and "main" roles together (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-translation><code>translation</code></dfn>"
- <td>A translated version of the main audio track.
- <td>Audio only.
- <td>Ogg: "audio/dub". DASH: "dub" and "main" roles together (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-commentary><code>commentary</code></dfn>"
- <td>Commentary on the primary audio or video track, e.g. a director's commentary.
- <td>Audio and video.
- <td>DASH: "commentary" role without "main" role (other roles ignored).
- <tr><td>"<dfn id=value-track-kind-none><code></code></dfn>" (empty string)
- <td>No explicit kind, or the kind given by the track's metadata is not recognised by the user agent.
- <td>Audio and video.
- <td>Any other track type, track role, or combination of track roles not described above.
- </table>
-
- <p>The <dfn id=dom-audiotrack-label><code>AudioTrack.label</code></dfn> and <dfn id=dom-videotrack-label><code>VideoTrack.label</code></dfn> attributes must return the label
- of the track, if it has one, or the empty string otherwise. <a href=#refsINBAND>[INBAND]</a></p>
- <p>The <dfn id=dom-audiotrack-language><code>AudioTrack.language</code></dfn> and <dfn id=dom-videotrack-language><code>VideoTrack.language</code></dfn> attributes must return the
- BCP 47 language tag of the language of the track, if it has one, or the empty string otherwise. If
- the user agent is not able to express that language as a BCP 47 language tag (for example because
- the language information in the <a href=#media-resource id=audiotracklist-and-videotracklist-objects:media-resource-9>media resource</a>'s format is a free-form string without
- a defined interpretation), then the method must return the empty string, as if the track had no
- language. <a href=#refsINBAND>[INBAND]</a></p>
- <p>The <dfn id=dom-audiotrack-enabled><code>AudioTrack.enabled</code></dfn> attribute, on
- getting, must return true if the track is currently enabled, and false otherwise. On setting, it
- must enable the track if the new value is true, and disable it otherwise. (If the track is no
- longer in an <code id=audiotracklist-and-videotracklist-objects:audiotracklist-10><a href=#audiotracklist>AudioTrackList</a></code> object, then the track being enabled or disabled has no
- effect beyond changing the value of the attribute on the <code id=audiotracklist-and-videotracklist-objects:audiotrack-12><a href=#audiotrack>AudioTrack</a></code> object.)</p>
- <p id=toggle-audio-track>Whenever an audio track in an <code id=audiotracklist-and-videotracklist-objects:audiotracklist-11><a href=#audiotracklist>AudioTrackList</a></code> that was
- disabled is enabled, and whenever one that was enabled is disabled, the user agent must
- <a href=#queue-a-task id=audiotracklist-and-videotracklist-objects:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=audiotracklist-and-videotracklist-objects:fire-a-simple-event>fire a simple event</a> named <code id=audiotracklist-and-videotracklist-objects:event-media-change><a href=#event-media-change>change</a></code> at the <code id=audiotracklist-and-videotracklist-objects:audiotracklist-12><a href=#audiotracklist>AudioTrackList</a></code> object.</p>
- <p>The <dfn id=dom-videotracklist-selectedindex><code>VideoTrackList.selectedIndex</code></dfn> attribute
- must return the index of the currently selected track, if any. If the <code id=audiotracklist-and-videotracklist-objects:videotracklist-11><a href=#videotracklist>VideoTrackList</a></code>
- object does not currently represent any tracks, or if none of the tracks are selected, it must
- instead return −1.</p>
- <p>The <dfn id=dom-videotrack-selected><code>VideoTrack.selected</code></dfn> attribute, on
- getting, must return true if the track is currently selected, and false otherwise. On setting, it
- must select the track if the new value is true, and unselect it otherwise. If the track is in a
- <code id=audiotracklist-and-videotracklist-objects:videotracklist-12><a href=#videotracklist>VideoTrackList</a></code>, then all the other <code id=audiotracklist-and-videotracklist-objects:videotrack-12><a href=#videotrack>VideoTrack</a></code> objects in that list must
- be unselected. (If the track is no longer in a <code id=audiotracklist-and-videotracklist-objects:videotracklist-13><a href=#videotracklist>VideoTrackList</a></code> object, then the track
- being selected or unselected has no effect beyond changing the value of the attribute on the
- <code id=audiotracklist-and-videotracklist-objects:videotrack-13><a href=#videotrack>VideoTrack</a></code> object.)</p>
- <p id=toggle-video-track>Whenever a track in a <code id=audiotracklist-and-videotracklist-objects:videotracklist-14><a href=#videotracklist>VideoTrackList</a></code> that was previously
- not selected is selected, and whenever the selected track in a <code id=audiotracklist-and-videotracklist-objects:videotracklist-15><a href=#videotracklist>VideoTrackList</a></code> is
- unselected without a new track being selected in its stead, the user agent must <a href=#queue-a-task id=audiotracklist-and-videotracklist-objects:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=audiotracklist-and-videotracklist-objects:fire-a-simple-event-2>fire a simple
- event</a> named <code id=audiotracklist-and-videotracklist-objects:event-media-change-2><a href=#event-media-change>change</a></code> at the
- <code id=audiotracklist-and-videotracklist-objects:videotracklist-16><a href=#videotracklist>VideoTrackList</a></code> object. This <a href=#concept-task id=audiotracklist-and-videotracklist-objects:concept-task>task</a> must be <a href=#queue-a-task id=audiotracklist-and-videotracklist-objects:queue-a-task-3>queued</a> before the <a href=#concept-task id=audiotracklist-and-videotracklist-objects:concept-task-2>task</a> that fires
- the <code id=audiotracklist-and-videotracklist-objects:event-media-resize><a href=#event-media-resize>resize</a></code> event, if any.</p>
- <hr>
- <p>The following are the <a href=#event-handlers id=audiotracklist-and-videotracklist-objects:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=audiotracklist-and-videotracklist-objects:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=audiotracklist-and-videotracklist-objects:event-handler-idl-attributes>event handler IDL attributes</a>,
- by all objects implementing the <code id=audiotracklist-and-videotracklist-objects:audiotracklist-13><a href=#audiotracklist>AudioTrackList</a></code> and <code id=audiotracklist-and-videotracklist-objects:videotracklist-17><a href=#videotracklist>VideoTrackList</a></code>
- interfaces:</p>
- <table><thead><tr><th><a href=#event-handlers id=audiotracklist-and-videotracklist-objects:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=audiotracklist-and-videotracklist-objects:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-tracklist-onchange><code>onchange</code></dfn> <td> <code id=audiotracklist-and-videotracklist-objects:event-media-change-3><a href=#event-media-change>change</a></code>
- <tr><td><dfn id=handler-tracklist-onaddtrack><code>onaddtrack</code></dfn> <td> <code id=audiotracklist-and-videotracklist-objects:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>
- <tr><td><dfn id=handler-tracklist-onremovetrack><code>onremovetrack</code></dfn> <td> <code id=audiotracklist-and-videotracklist-objects:event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>
- </table>
-
-
- <h6 id=selecting-specific-audio-and-video-tracks-declaratively>4.8.14.10.2 Selecting specific audio and video tracks declaratively</h6>
- <p>The <code id=selecting-specific-audio-and-video-tracks-declaratively:dom-media-audiotracks><a href=#dom-media-audiotracks>audioTracks</a></code> and <code id=selecting-specific-audio-and-video-tracks-declaratively:dom-media-videotracks><a href=#dom-media-videotracks>videoTracks</a></code> attributes allow scripts to select which track
- should play, but it is also possible to select specific tracks declaratively, by specifying
- particular tracks in the fragment identifier of the <a href=#url id=selecting-specific-audio-and-video-tracks-declaratively:url>URL</a> of the <a href=#media-resource id=selecting-specific-audio-and-video-tracks-declaratively:media-resource>media
- resource</a>. The format of the fragment identifier depends on the <a href=#mime-type id=selecting-specific-audio-and-video-tracks-declaratively:mime-type>MIME type</a> of
- the <a href=#media-resource id=selecting-specific-audio-and-video-tracks-declaratively:media-resource-2>media resource</a>. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsURL>[URL]</a></p>
- <div class=example>
- <p>In this example, a video that uses a format that supports the <cite>Media Fragments URI</cite>
- fragment identifier syntax is embedded in such a way that the alternative angles labeled
- "Alternative" are enabled instead of the default video track. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <pre><video src="myvideo#track=Alternative"></video></pre>
- </div>
- <h5 id=synchronising-multiple-media-elements>4.8.14.11 Synchronising multiple media elements</h5>
- <h6 id=introduction-4>4.8.14.11.1 Introduction</h6>
- <p>Each <a href=#media-element id=introduction-4:media-element>media element</a> can have a <code id=introduction-4:mediacontroller><a href=#mediacontroller>MediaController</a></code>. A
- <code id=introduction-4:mediacontroller-2><a href=#mediacontroller>MediaController</a></code> is an object that coordinates the playback of multiple <a href=#media-element id=introduction-4:media-element-2>media elements</a>, for instance so that a sign-language interpreter
- track can be overlaid on a video track, with the two being kept in sync.</p>
- <p>By default, a <a href=#media-element id=introduction-4:media-element-3>media element</a> has no <code id=introduction-4:mediacontroller-3><a href=#mediacontroller>MediaController</a></code>. An implicit
- <code id=introduction-4:mediacontroller-4><a href=#mediacontroller>MediaController</a></code> can be assigned using the <code id=introduction-4:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> content attribute. An explicit
- <code id=introduction-4:mediacontroller-5><a href=#mediacontroller>MediaController</a></code> can be assigned directly using the <code id=introduction-4:dom-media-controller><a href=#dom-media-controller>controller</a></code> IDL attribute.</p>
- <p><a href=#media-element id=introduction-4:media-element-4>Media elements</a> with a <code id=introduction-4:mediacontroller-6><a href=#mediacontroller>MediaController</a></code> are said
- to be <i>slaved</i> to their controller. The <code id=introduction-4:mediacontroller-7><a href=#mediacontroller>MediaController</a></code> modifies the playback
- rate and the playback volume of each of the <a href=#media-element id=introduction-4:media-element-5>media elements</a>
- slaved to it, and ensures that when any of its slaved <a href=#media-element id=introduction-4:media-element-6>media
- elements</a> unexpectedly stall, the others are stopped at the same time.</p>
- <p>When a <a href=#media-element id=introduction-4:media-element-7>media element</a> is slaved to a <code id=introduction-4:mediacontroller-8><a href=#mediacontroller>MediaController</a></code>, its playback
- rate is fixed to that of the other tracks in the same <code id=introduction-4:mediacontroller-9><a href=#mediacontroller>MediaController</a></code>, and any
- looping is disabled.</p>
- <h6 id=media-controllers>4.8.14.11.2 Media controllers</h6>
- <pre class=idl>enum <dfn id=mediacontrollerplaybackstate>MediaControllerPlaybackState</dfn> { "<a href=#dom-mediacontroller-waiting id=media-controllers:dom-mediacontroller-waiting>waiting</a>", "<a href=#dom-mediacontroller-playing id=media-controllers:dom-mediacontroller-playing>playing</a>", "<a href=#dom-mediacontroller-ended id=media-controllers:dom-mediacontroller-ended>ended</a>" };
- [<a href=#dom-mediacontroller id=media-controllers:dom-mediacontroller>Constructor</a>]
- interface <dfn id=mediacontroller>MediaController</dfn> : <a href=#eventtarget id=media-controllers:eventtarget>EventTarget</a> {
- readonly attribute unsigned short <a href=#dom-mediacontroller-readystate id=media-controllers:dom-mediacontroller-readystate>readyState</a>; // uses <a href=#htmlmediaelement id=media-controllers:htmlmediaelement>HTMLMediaElement</a>.<a href=#dom-media-readystate id=media-controllers:dom-media-readystate>readyState</a>'s values
- readonly attribute <a href=#timeranges id=media-controllers:timeranges>TimeRanges</a> <a href=#dom-mediacontroller-buffered id=media-controllers:dom-mediacontroller-buffered>buffered</a>;
- readonly attribute <a href=#timeranges id=media-controllers:timeranges-2>TimeRanges</a> <a href=#dom-mediacontroller-seekable id=media-controllers:dom-mediacontroller-seekable>seekable</a>;
- readonly attribute unrestricted double <a href=#dom-mediacontroller-duration id=media-controllers:dom-mediacontroller-duration>duration</a>;
- attribute double <a href=#dom-mediacontroller-currenttime id=media-controllers:dom-mediacontroller-currenttime>currentTime</a>;
- readonly attribute boolean <a href=#dom-mediacontroller-paused id=media-controllers:dom-mediacontroller-paused>paused</a>;
- readonly attribute <a href=#mediacontrollerplaybackstate id=media-controllers:mediacontrollerplaybackstate>MediaControllerPlaybackState</a> <a href=#dom-mediacontroller-playbackstate id=media-controllers:dom-mediacontroller-playbackstate>playbackState</a>;
- readonly attribute <a href=#timeranges id=media-controllers:timeranges-3>TimeRanges</a> <a href=#dom-mediacontroller-played id=media-controllers:dom-mediacontroller-played>played</a>;
- void <a href=#dom-mediacontroller-pause id=media-controllers:dom-mediacontroller-pause>pause</a>();
- void <a href=#dom-mediacontroller-unpause id=media-controllers:dom-mediacontroller-unpause>unpause</a>();
- void <a href=#dom-mediacontroller-play id=media-controllers:dom-mediacontroller-play>play</a>(); // calls play() on all media elements as well
- attribute double <a href=#dom-mediacontroller-defaultplaybackrate id=media-controllers:dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a>;
- attribute double <a href=#dom-mediacontroller-playbackrate id=media-controllers:dom-mediacontroller-playbackrate>playbackRate</a>;
- attribute double <a href=#dom-mediacontroller-volume id=media-controllers:dom-mediacontroller-volume>volume</a>;
- attribute boolean <a href=#dom-mediacontroller-muted id=media-controllers:dom-mediacontroller-muted>muted</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler>EventHandler</a> <a href=#handler-mediacontroller-onemptied id=media-controllers:handler-mediacontroller-onemptied>onemptied</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-2>EventHandler</a> <a href=#handler-mediacontroller-onloadedmetadata id=media-controllers:handler-mediacontroller-onloadedmetadata>onloadedmetadata</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-3>EventHandler</a> <a href=#handler-mediacontroller-onloadeddata id=media-controllers:handler-mediacontroller-onloadeddata>onloadeddata</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-4>EventHandler</a> <a href=#handler-mediacontroller-oncanplay id=media-controllers:handler-mediacontroller-oncanplay>oncanplay</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-5>EventHandler</a> <a href=#handler-mediacontroller-oncanplaythrough id=media-controllers:handler-mediacontroller-oncanplaythrough>oncanplaythrough</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-6>EventHandler</a> <a href=#handler-mediacontroller-onplaying id=media-controllers:handler-mediacontroller-onplaying>onplaying</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-7>EventHandler</a> <a href=#handler-mediacontroller-onended id=media-controllers:handler-mediacontroller-onended>onended</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-8>EventHandler</a> <a href=#handler-mediacontroller-onwaiting id=media-controllers:handler-mediacontroller-onwaiting>onwaiting</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-9>EventHandler</a> <a href=#handler-mediacontroller-ondurationchange id=media-controllers:handler-mediacontroller-ondurationchange>ondurationchange</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-10>EventHandler</a> <a href=#handler-mediacontroller-ontimeupdate id=media-controllers:handler-mediacontroller-ontimeupdate>ontimeupdate</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-11>EventHandler</a> <a href=#handler-mediacontroller-onplay id=media-controllers:handler-mediacontroller-onplay>onplay</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-12>EventHandler</a> <a href=#handler-mediacontroller-onpause id=media-controllers:handler-mediacontroller-onpause>onpause</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-13>EventHandler</a> <a href=#handler-mediacontroller-onratechange id=media-controllers:handler-mediacontroller-onratechange>onratechange</a>;
- attribute <a href=#eventhandler id=media-controllers:eventhandler-14>EventHandler</a> <a href=#handler-mediacontroller-onvolumechange id=media-controllers:handler-mediacontroller-onvolumechange>onvolumechange</a>;
- };</pre>
- <dl class=domintro><dt><var>controller</var> = new <code id=media-controllers:dom-mediacontroller-2><a href=#dom-mediacontroller>MediaController</a></code>()<dd>
- <p>Returns a new <code id=media-controllers:mediacontroller><a href=#mediacontroller>MediaController</a></code> object.</p>
- <dt><var>media</var> . <code id=media-controllers:dom-media-controller><a href=#dom-media-controller>controller</a></code> [ = <var>controller</var> ]<dd>
- <p>Returns the current <code id=media-controllers:mediacontroller-2><a href=#mediacontroller>MediaController</a></code> for the <a href=#media-element id=media-controllers:media-element>media element</a>, if any;
- returns null otherwise.</p>
- <p>Can be set, to set an explicit <code id=media-controllers:mediacontroller-3><a href=#mediacontroller>MediaController</a></code>. Doing so removes the <code id=media-controllers:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, if any.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-readystate-2><a href=#dom-mediacontroller-readystate>readyState</a></code><dd>
- <p>Returns the state that the <code id=media-controllers:mediacontroller-4><a href=#mediacontroller>MediaController</a></code> was in the last time it fired events
- as a result of <a href=#report-the-controller-state id=media-controllers:report-the-controller-state>reporting the controller state</a>.
- The values of this attribute are the same as for the <code id=media-controllers:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> attribute of <a href=#media-element id=media-controllers:media-element-2>media
- elements</a>.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-buffered-2><a href=#dom-mediacontroller-buffered>buffered</a></code><dd>
- <p>Returns a <code id=media-controllers:timeranges-4><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
- for which the user agent has all relevant media data for all the slaved <a href=#media-element id=media-controllers:media-element-3>media elements</a>.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-seekable-2><a href=#dom-mediacontroller-seekable>seekable</a></code><dd>
- <p>Returns a <code id=media-controllers:timeranges-5><a href=#timeranges>TimeRanges</a></code> object that represents the intersection of the time ranges
- into which the user agent can seek for all the slaved <a href=#media-element id=media-controllers:media-element-4>media
- elements</a>.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-duration-2><a href=#dom-mediacontroller-duration>duration</a></code><dd>
- <p>Returns the difference between the earliest playable moment and the latest playable moment
- (not considering whether the data in question is actually buffered or directly seekable, but not
- including time in the future for infinite streams). Will return zero if there is no media.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-currenttime-2><a href=#dom-mediacontroller-currenttime>currentTime</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#current-playback-position id=media-controllers:current-playback-position>current playback position</a>, in seconds, as a position between zero
- time and the current <code id=media-controllers:dom-mediacontroller-duration-3><a href=#dom-mediacontroller-duration>duration</a></code>.</p>
- <p>Can be set, to seek to the given time.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-paused-2><a href=#dom-mediacontroller-paused>paused</a></code><dd>
- <p>Returns true if playback is paused; false otherwise. When this attribute is true, any
- <a href=#media-element id=media-controllers:media-element-5>media element</a> slaved to this controller will be stopped.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-playbackstate-2><a href=#dom-mediacontroller-playbackstate>playbackState</a></code><dd>
- <p>Returns the state that the <code id=media-controllers:mediacontroller-5><a href=#mediacontroller>MediaController</a></code> was in the last time it fired events
- as a result of <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-2>reporting the controller state</a>.
- The value of this attribute is either "<code id=media-controllers:dom-mediacontroller-playing-2><a href=#dom-mediacontroller-playing>playing</a></code>", indicating that the media is actively
- playing, "<code id=media-controllers:dom-mediacontroller-ended-2><a href=#dom-mediacontroller-ended>ended</a></code>", indicating that the media is
- not playing because playback has reached the end of all the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements>slaved media elements</a>,
- or "<code id=media-controllers:dom-mediacontroller-waiting-2><a href=#dom-mediacontroller-waiting>waiting</a></code>", indicating that the media is not
- playing for some other reason (e.g. the <code id=media-controllers:mediacontroller-6><a href=#mediacontroller>MediaController</a></code> is paused).</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-pause-2><a href=#dom-mediacontroller-pause>pause</a></code>()<dd>
- <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-3><a href=#dom-mediacontroller-paused>paused</a></code> attribute to true.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-unpause-2><a href=#dom-mediacontroller-unpause>unpause</a></code>()<dd>
- <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-4><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-play-2><a href=#dom-mediacontroller-play>play</a></code>()<dd>
- <p>Sets the <code id=media-controllers:dom-mediacontroller-paused-5><a href=#dom-mediacontroller-paused>paused</a></code> attribute to false and
- invokes the <code id=media-controllers:dom-media-play><a href=#dom-media-play>play()</a></code> method of each <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-2>slaved media element</a>.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-played-2><a href=#dom-mediacontroller-played>played</a></code><dd>
- <p>Returns a <code id=media-controllers:timeranges-6><a href=#timeranges>TimeRanges</a></code> object that represents the union of the time ranges in all
- the slaved <a href=#media-element id=media-controllers:media-element-6>media elements</a> that have been played.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-defaultplaybackrate-2><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the default rate of playback.</p>
- <p>Can be set, to change the default rate of playback.</p>
- <p>This default rate has no direct effect on playback, but if the user switches to a
- fast-forward mode, when they return to the normal playback mode, it is expected that rate of
- playback (<code id=media-controllers:dom-mediacontroller-playbackrate-2><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code>) will be returned
- to this default rate.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-playbackrate-3><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current rate of playback.</p>
- <p>Can be set, to change the rate of playback.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-volume-2><a href=#dom-mediacontroller-volume>volume</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current playback volume multiplier, as a number in the range 0.0 to 1.0, where
- 0.0 is the quietest and 1.0 the loudest.</p>
- <p>Can be set, to change the volume multiplier.</p>
- <p>Throws an <code id=media-controllers:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the new value is not in the range 0.0 .. 1.0.</p>
- <dt><var>controller</var> . <code id=media-controllers:dom-mediacontroller-muted-2><a href=#dom-mediacontroller-muted>muted</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if all audio is muted (regardless of other attributes either on the controller
- or on any <a href=#media-element id=media-controllers:media-element-7>media elements</a> slaved to this controller), and
- false otherwise.</p>
- <p>Can be set, to change whether the audio is muted or not.</p>
- </dl>
-
- <p>A <a href=#media-element id=media-controllers:media-element-8>media element</a> can have a <dfn id=current-media-controller>current media controller</dfn>, which is a
- <code id=media-controllers:mediacontroller-7><a href=#mediacontroller>MediaController</a></code> object. When a <a href=#media-element id=media-controllers:media-element-9>media element</a> is created without a <code id=media-controllers:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, it does not have a <a href=#current-media-controller id=media-controllers:current-media-controller>current media
- controller</a>. (If it is created <em>with</em> such an attribute, then that attribute
- initializes the <a href=#current-media-controller id=media-controllers:current-media-controller-2>current media controller</a>, as defined below.)</p>
- <p>The <dfn id=slaved-media-elements>slaved media elements</dfn> of a <code id=media-controllers:mediacontroller-8><a href=#mediacontroller>MediaController</a></code> are the <a href=#media-element id=media-controllers:media-element-10>media elements</a> whose <a href=#current-media-controller id=media-controllers:current-media-controller-3>current media controller</a> is that
- <code id=media-controllers:mediacontroller-9><a href=#mediacontroller>MediaController</a></code>. All the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-3>slaved media elements</a> of a
- <code id=media-controllers:mediacontroller-10><a href=#mediacontroller>MediaController</a></code> must use the same clock for their definition of their <a href=#media-timeline id=media-controllers:media-timeline>media
- timeline</a>'s unit time. When the user agent is required to act on each <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-4>slaved media element</a> in turn, they must be processed in the order that they
- were last associated with the <code id=media-controllers:mediacontroller-11><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr>
- <p>The <dfn id=dom-media-controller><code>controller</code></dfn> attribute on a <a href=#media-element id=media-controllers:media-element-11>media
- element</a>, on getting, must return the element's <a href=#current-media-controller id=media-controllers:current-media-controller-4>current media controller</a>, if
- any, or null otherwise. On setting, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>m</var> be the <a href=#media-element id=media-controllers:media-element-12>media element</a> in question.<li><p>Let <var>old controller</var> be <var>m</var>'s <a href=#current-media-controller id=media-controllers:current-media-controller-5>current media
- controller</a>, if it currently has one, and null otherwise.<li><p>Let <var>new controller</var> be null.<li><p>Let <var>m</var> have no <a href=#current-media-controller id=media-controllers:current-media-controller-6>current media controller</a>, if it currently
- has one.<li><p>Remove the element's <code id=media-controllers:attr-media-mediagroup-3><a href=#attr-media-mediagroup>mediagroup</a></code> content
- attribute, if any.<li><p>If the new value is null, then jump to the <i>update controllers</i> step below.<li><p>Let <var>m</var>'s <a href=#current-media-controller id=media-controllers:current-media-controller-7>current media controller</a> be the new
- value.<li><p>Let <var>new controller</var> be <var>m</var>'s <a href=#current-media-controller id=media-controllers:current-media-controller-8>current media
- controller</a>.<li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller id=media-controllers:bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media controller</a>.<li><p><i>Update controllers</i>: If <var>old controller</var> and <var>new
- controller</var> are the same (whether both null or both the same controller) then abort these
- steps.<li><p>If <var>old controller</var> is not null and still has one or more <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-5>slaved
- media elements</a>, then <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-3>report the controller state</a> for <var>old
- controller</var>.<li><p>If <var>new controller</var> is not null, then <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-4>report the controller
- state</a> for <var>new controller</var>.</ol>
- <hr>
- <p>The <dfn id=dom-mediacontroller><code>MediaController()</code></dfn> constructor, when
- invoked, must return a newly created <code id=media-controllers:mediacontroller-12><a href=#mediacontroller>MediaController</a></code> object.</p>
- <hr>
- <p>The <dfn id=dom-mediacontroller-readystate><code>readyState</code></dfn> attribute must
- return the value to which it was most recently set. When the <code id=media-controllers:mediacontroller-13><a href=#mediacontroller>MediaController</a></code> object
- is created, the attribute must be set to the value 0 (<code id=media-controllers:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>). The value is updated by the <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-5>report the
- controller state</a> algorithm below.</p>
- <p>The <dfn id=dom-mediacontroller-seekable><code>seekable</code></dfn> attribute must return
- a new static <a href=#normalised-timeranges-object id=media-controllers:normalised-timeranges-object>normalised <code>TimeRanges</code> object</a> that represents the
- intersection of the ranges of the <a href=#media-resource id=media-controllers:media-resource>media resources</a> of the
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-6>slaved media elements</a> that the user agent is able to seek to, at the time the
- attribute is evaluated.</p>
- <p>The <dfn id=dom-mediacontroller-buffered><code>buffered</code></dfn> attribute must return
- a new static <a href=#normalised-timeranges-object id=media-controllers:normalised-timeranges-object-2>normalised <code>TimeRanges</code> object</a> that represents the
- intersection of the ranges of the <a href=#media-resource id=media-controllers:media-resource-2>media resources</a> of the
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-7>slaved media elements</a> that the user agent has buffered, at the time the attribute is
- evaluated. Users agents must accurately determine the ranges available, even for media streams
- where this can only be determined by tedious inspection.</p>
- <p>The <dfn id=dom-mediacontroller-duration><code>duration</code></dfn> attribute must return
- the <a href=#media-controller-duration id=media-controllers:media-controller-duration>media controller duration</a>.</p>
- <p>Every 15 to 250ms, or whenever the <code id=media-controllers:mediacontroller-14><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-duration id=media-controllers:media-controller-duration-2>media controller
- duration</a> changes, whichever happens least often, the user agent must <a href=#queue-a-task id=media-controllers:queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-durationchange><a href=#event-mediacontroller-durationchange>durationchange</a></code> at the
- <code id=media-controllers:mediacontroller-15><a href=#mediacontroller>MediaController</a></code>. If the <code id=media-controllers:mediacontroller-16><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-duration id=media-controllers:media-controller-duration-3>media controller
- duration</a> decreases such that the <a href=#media-controller-position id=media-controllers:media-controller-position>media controller position</a> is greater than the
- <a href=#media-controller-duration id=media-controllers:media-controller-duration-4>media controller duration</a>, the user agent must immediately <a href=#seek-the-media-controller id=media-controllers:seek-the-media-controller>seek the media
- controller</a> to <a href=#media-controller-duration id=media-controllers:media-controller-duration-5>media controller duration</a>.</p>
- <p>The <dfn id=dom-mediacontroller-currenttime><code>currentTime</code></dfn> attribute must
- return the <a href=#media-controller-position id=media-controllers:media-controller-position-2>media controller position</a> on getting, and on setting must <a href=#seek-the-media-controller id=media-controllers:seek-the-media-controller-2>seek the
- media controller</a> to the new value.</p>
- <p>Every 15 to 250ms, or whenever the <code id=media-controllers:mediacontroller-17><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position id=media-controllers:media-controller-position-3>media controller
- position</a> changes, whichever happens least often, the user agent must <a href=#queue-a-task id=media-controllers:queue-a-task-2>queue a
- task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-2>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-timeupdate><a href=#event-mediacontroller-timeupdate>timeupdate</a></code> at the
- <code id=media-controllers:mediacontroller-18><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr>
- <p>When a <code id=media-controllers:mediacontroller-19><a href=#mediacontroller>MediaController</a></code> is created it is a <dfn id=playing-media-controller>playing media controller</dfn>. It
- can be changed into a <dfn id=paused-media-controller>paused media controller</dfn> and back either via the user agent's user
- interface (when the element is <a href=#expose-a-user-interface-to-the-user id=media-controllers:expose-a-user-interface-to-the-user>exposing a user
- interface to the user</a>) or by script using the APIs defined in this section (see below).</p>
- <p>The <dfn id=dom-mediacontroller-paused><code>paused</code></dfn> attribute must return
- true if the <code id=media-controllers:mediacontroller-20><a href=#mediacontroller>MediaController</a></code> object is a <a href=#paused-media-controller id=media-controllers:paused-media-controller>paused media controller</a>, and
- false otherwise.</p>
- <p>When the <dfn id=dom-mediacontroller-pause><code>pause()</code></dfn> method is invoked,
- if the <code id=media-controllers:mediacontroller-21><a href=#mediacontroller>MediaController</a></code> is a <a href=#playing-media-controller id=media-controllers:playing-media-controller>playing media controller</a> then the user agent
- must change the <code id=media-controllers:mediacontroller-22><a href=#mediacontroller>MediaController</a></code> into a <a href=#paused-media-controller id=media-controllers:paused-media-controller-2>paused media controller</a>,
- <a href=#queue-a-task id=media-controllers:queue-a-task-3>queue a task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-3>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-pause><a href=#event-mediacontroller-pause>pause</a></code> at the <code id=media-controllers:mediacontroller-23><a href=#mediacontroller>MediaController</a></code>, and then
- <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-6>report the controller state</a> of the <code id=media-controllers:mediacontroller-24><a href=#mediacontroller>MediaController</a></code>.</p>
- <p>When the <dfn id=dom-mediacontroller-unpause><code>unpause()</code></dfn> method is
- invoked, if the <code id=media-controllers:mediacontroller-25><a href=#mediacontroller>MediaController</a></code> is a <a href=#paused-media-controller id=media-controllers:paused-media-controller-3>paused media controller</a>, the user
- agent must change the <code id=media-controllers:mediacontroller-26><a href=#mediacontroller>MediaController</a></code> into a <a href=#playing-media-controller id=media-controllers:playing-media-controller-2>playing media controller</a>,
- <a href=#queue-a-task id=media-controllers:queue-a-task-4>queue a task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-4>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-play><a href=#event-mediacontroller-play>play</a></code> at the <code id=media-controllers:mediacontroller-27><a href=#mediacontroller>MediaController</a></code>, and then
- <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-7>report the controller state</a> of the <code id=media-controllers:mediacontroller-28><a href=#mediacontroller>MediaController</a></code>.</p>
- <p>When the <dfn id=dom-mediacontroller-play><code>play()</code></dfn> method is invoked, the
- user agent must invoke the <code id=media-controllers:dom-media-play-2><a href=#dom-media-play>play()</a></code> method of each <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-8>slaved media element</a> in turn, and then invoke the <code id=media-controllers:dom-mediacontroller-unpause-3><a href=#dom-mediacontroller-unpause>unpause</a></code> method of the <code id=media-controllers:mediacontroller-29><a href=#mediacontroller>MediaController</a></code>.</p>
- <p>The <dfn id=dom-mediacontroller-playbackstate><code>playbackState</code></dfn> attribute
- must return the value to which it was most recently set. When the <code id=media-controllers:mediacontroller-30><a href=#mediacontroller>MediaController</a></code>
- object is created, the attribute must be set to the value "<code id=media-controllers:dom-mediacontroller-waiting-3><a href=#dom-mediacontroller-waiting>waiting</a></code>". The value is updated by the <a href=#report-the-controller-state id=media-controllers:report-the-controller-state-8>report the
- controller state</a> algorithm below.</p>
- <p>The <dfn id=dom-mediacontroller-played><code>played</code></dfn> attribute must return a
- new static <a href=#normalised-timeranges-object id=media-controllers:normalised-timeranges-object-3>normalised <code>TimeRanges</code> object</a> that represents the union of the
- ranges of points on the <a href=#media-timeline id=media-controllers:media-timeline-2>media timelines</a> of the <a href=#media-resource id=media-controllers:media-resource-3>media resources</a> of the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-9>slaved media elements</a> that the
- user agent has so far reached through the usual monotonic increase of their <a href=#current-playback-position id=media-controllers:current-playback-position-2>current playback positions</a> during normal playback, at the time the
- attribute is evaluated.</p>
- <hr>
- <p>A <code id=media-controllers:mediacontroller-31><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-default-playback-rate>media controller default playback rate</dfn> and a
- <dfn id=media-controller-playback-rate>media controller playback rate</dfn>, which must both be set to 1.0 when the
- <code id=media-controllers:mediacontroller-32><a href=#mediacontroller>MediaController</a></code> object is created.</p>
- <p>The <dfn id=dom-mediacontroller-defaultplaybackrate><code>defaultPlaybackRate</code></dfn>
- attribute, on getting, must return the <code id=media-controllers:mediacontroller-33><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-default-playback-rate id=media-controllers:media-controller-default-playback-rate>media controller
- default playback rate</a>, and on setting, must set the <code id=media-controllers:mediacontroller-34><a href=#mediacontroller>MediaController</a></code>'s
- <a href=#media-controller-default-playback-rate id=media-controllers:media-controller-default-playback-rate-2>media controller default playback rate</a> to the new value, then <a href=#queue-a-task id=media-controllers:queue-a-task-5>queue a
- task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-5>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-ratechange><a href=#event-mediacontroller-ratechange>ratechange</a></code> at the
- <code id=media-controllers:mediacontroller-35><a href=#mediacontroller>MediaController</a></code>.</p>
- <p>The <dfn id=dom-mediacontroller-playbackrate><code>playbackRate</code></dfn> attribute, on
- getting, must return the <code id=media-controllers:mediacontroller-36><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate id=media-controllers:media-controller-playback-rate>media controller playback
- rate</a>, and on setting, must set the <code id=media-controllers:mediacontroller-37><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-playback-rate id=media-controllers:media-controller-playback-rate-2>media controller
- playback rate</a> to the new value, then <a href=#queue-a-task id=media-controllers:queue-a-task-6>queue a task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-6>fire a simple
- event</a> named <code id=media-controllers:event-mediacontroller-ratechange-2><a href=#event-mediacontroller-ratechange>ratechange</a></code> at the
- <code id=media-controllers:mediacontroller-38><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr>
- <p>A <code id=media-controllers:mediacontroller-39><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-volume-multiplier>media controller volume multiplier</dfn>, which must
- be set to 1.0 when the <code id=media-controllers:mediacontroller-40><a href=#mediacontroller>MediaController</a></code> object is created, and a <dfn id=media-controller-mute-override>media controller
- mute override</dfn>, much must initially be false.</p>
- <p>The <dfn id=dom-mediacontroller-volume><code>volume</code></dfn> attribute, on getting,
- must return the <code id=media-controllers:mediacontroller-41><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-volume-multiplier id=media-controllers:media-controller-volume-multiplier>media controller volume multiplier</a>,
- and on setting, if the new value is in the range 0.0 to 1.0 inclusive, must set the
- <code id=media-controllers:mediacontroller-42><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-volume-multiplier id=media-controllers:media-controller-volume-multiplier-2>media controller volume multiplier</a> to the new value
- and <a href=#queue-a-task id=media-controllers:queue-a-task-7>queue a task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-7>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-volumechange><a href=#event-mediacontroller-volumechange>volumechange</a></code> at the
- <code id=media-controllers:mediacontroller-43><a href=#mediacontroller>MediaController</a></code>. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
- setting, an <code id=media-controllers:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>
- <p>The <dfn id=dom-mediacontroller-muted><code>muted</code></dfn> attribute, on getting, must
- return the <code id=media-controllers:mediacontroller-44><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-mute-override id=media-controllers:media-controller-mute-override>media controller mute override</a>, and on
- setting, must set the <code id=media-controllers:mediacontroller-45><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-mute-override id=media-controllers:media-controller-mute-override-2>media controller mute override</a>
- to the new value and <a href=#queue-a-task id=media-controllers:queue-a-task-8>queue a task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-8>fire a simple event</a> named <code id=media-controllers:event-mediacontroller-volumechange-2><a href=#event-mediacontroller-volumechange>volumechange</a></code> at the
- <code id=media-controllers:mediacontroller-46><a href=#mediacontroller>MediaController</a></code>.</p>
- <hr>
- <p>The <a href=#media-resource id=media-controllers:media-resource-4>media resources</a> of all the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-10>slaved media
- elements</a> of a <code id=media-controllers:mediacontroller-47><a href=#mediacontroller>MediaController</a></code> have a defined temporal relationship which
- provides relative offsets between the zero time of each such <a href=#media-resource id=media-controllers:media-resource-5>media resource</a>: for
- <a href=#media-resource id=media-controllers:media-resource-6>media resources</a> with a <a href=#timeline-offset id=media-controllers:timeline-offset>timeline offset</a>, their
- relative offsets are the difference between their <a href=#timeline-offset id=media-controllers:timeline-offset-2>timeline offset</a>; the zero times of
- all the <a href=#media-resource id=media-controllers:media-resource-7>media resources</a> without a <a href=#timeline-offset id=media-controllers:timeline-offset-3>timeline offset</a>
- are not offset from each other (i.e. the origins of their timelines are cotemporal); and finally,
- the zero time of the <a href=#media-resource id=media-controllers:media-resource-8>media resource</a> with the earliest <a href=#timeline-offset id=media-controllers:timeline-offset-4>timeline offset</a>
- (if any) is not offset from the zero times of the <a href=#media-resource id=media-controllers:media-resource-9>media
- resources</a> without a <a href=#timeline-offset id=media-controllers:timeline-offset-5>timeline offset</a> (i.e. the origins of <a href=#media-resource id=media-controllers:media-resource-10>media resources</a> without a <a href=#timeline-offset id=media-controllers:timeline-offset-6>timeline offset</a> are further cotemporal
- with the earliest defined point on the timeline of the <a href=#media-resource id=media-controllers:media-resource-11>media resource</a> with the
- earliest <a href=#timeline-offset id=media-controllers:timeline-offset-7>timeline offset</a>).</p>
- <p>The <dfn id=media-resource-end-position>media resource end position</dfn> of a <a href=#media-resource id=media-controllers:media-resource-12>media resource</a> in a <a href=#media-element id=media-controllers:media-element-13>media
- element</a> is defined as follows: if the <a href=#media-resource id=media-controllers:media-resource-13>media resource</a> has a finite and known
- duration, the <a href=#media-resource-end-position id=media-controllers:media-resource-end-position>media resource end position</a> is the duration of the <a href=#media-resource id=media-controllers:media-resource-14>media
- resource</a>'s timeline (the last defined position on that timeline); otherwise, the
- <a href=#media-resource id=media-controllers:media-resource-15>media resource</a>'s duration is infinite or unknown, and the <a href=#media-resource-end-position id=media-controllers:media-resource-end-position-2>media resource end
- position</a> is the time of the last frame of <a href=#media-data id=media-controllers:media-data>media data</a> currently available for
- that <a href=#media-resource id=media-controllers:media-resource-16>media resource</a>.</p>
- <p>Each <code id=media-controllers:mediacontroller-48><a href=#mediacontroller>MediaController</a></code> also has its own defined timeline. On this timeline, all the
- <a href=#media-resource id=media-controllers:media-resource-17>media resources</a> of all the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-11>slaved media elements</a>
- of the <code id=media-controllers:mediacontroller-49><a href=#mediacontroller>MediaController</a></code> are temporally aligned according to their defined offsets. The
- <dfn id=media-controller-duration>media controller duration</dfn> of that <code id=media-controllers:mediacontroller-50><a href=#mediacontroller>MediaController</a></code> is the time from the
- earliest <a href=#earliest-possible-position id=media-controllers:earliest-possible-position>earliest possible position</a>, relative to this <code id=media-controllers:mediacontroller-51><a href=#mediacontroller>MediaController</a></code>
- timeline, of any of the <a href=#media-resource id=media-controllers:media-resource-18>media resources</a> of the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-12>slaved
- media elements</a> of the <code id=media-controllers:mediacontroller-52><a href=#mediacontroller>MediaController</a></code>, to the time of the latest <a href=#media-resource-end-position id=media-controllers:media-resource-end-position-3>media
- resource end position</a> of the <a href=#media-resource id=media-controllers:media-resource-19>media resources</a> of the
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-13>slaved media elements</a> of the <code id=media-controllers:mediacontroller-53><a href=#mediacontroller>MediaController</a></code>, again relative to this
- <code id=media-controllers:mediacontroller-54><a href=#mediacontroller>MediaController</a></code> timeline.</p>
- <p>Each <code id=media-controllers:mediacontroller-55><a href=#mediacontroller>MediaController</a></code> has a <dfn id=media-controller-position>media controller position</dfn>. This is the time
- on the <code id=media-controllers:mediacontroller-56><a href=#mediacontroller>MediaController</a></code>'s timeline at which the user agent is trying to play the
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-14>slaved media elements</a>. When a <code id=media-controllers:mediacontroller-57><a href=#mediacontroller>MediaController</a></code> is created, its
- <a href=#media-controller-position id=media-controllers:media-controller-position-4>media controller position</a> is initially zero.</p>
- <p>When the user agent is to <dfn id=bring-the-media-element-up-to-speed-with-its-new-media-controller>bring a media element up to speed with its new media controller</dfn>, it must <a href=#dom-media-seek id=media-controllers:dom-media-seek>seek</a> that <a href=#media-element id=media-controllers:media-element-14>media element</a> to the
- <code id=media-controllers:mediacontroller-58><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position id=media-controllers:media-controller-position-5>media controller position</a> relative to the <a href=#media-element id=media-controllers:media-element-15>media
- element</a>'s timeline.</p>
- <p>When the user agent is to <dfn id=seek-the-media-controller>seek the media controller</dfn> to a particular <var>new playback position</var>, it must follow these steps:</p>
- <ol><li><p>If the <var>new playback position</var> is less than zero, then set it to
- zero.<li><p>If the <var>new playback position</var> is greater than the <a href=#media-controller-duration id=media-controllers:media-controller-duration-6>media
- controller duration</a>, then set it to the <a href=#media-controller-duration id=media-controllers:media-controller-duration-7>media controller duration</a>.<li><p>Set the <a href=#media-controller-position id=media-controllers:media-controller-position-6>media controller position</a> to the <var>new playback
- position</var>.<li><p><a href=#dom-media-seek id=media-controllers:dom-media-seek-2>Seek</a> each <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-15>slaved
- media element</a> to the <var>new playback position</var> relative to the <a href=#media-element id=media-controllers:media-element-16>media
- element</a> timeline.</ol>
- <p>A <code id=media-controllers:mediacontroller-59><a href=#mediacontroller>MediaController</a></code> is a <dfn id=restrained-media-controller>restrained media controller</dfn> if the
- <code id=media-controllers:mediacontroller-60><a href=#mediacontroller>MediaController</a></code> is a <a href=#playing-media-controller id=media-controllers:playing-media-controller-3>playing media controller</a>, but either at least one
- of its <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-16>slaved media elements</a> whose <a href=#autoplaying-flag id=media-controllers:autoplaying-flag>autoplaying flag</a> is true still has
- its <code id=media-controllers:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute set to true, or, all of its
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-17>slaved media elements</a> have their <code id=media-controllers:dom-media-paused-2><a href=#dom-media-paused>paused</a></code>
- attribute set to true.</p>
- <p>A <code id=media-controllers:mediacontroller-61><a href=#mediacontroller>MediaController</a></code> is a <dfn id=blocked-media-controller>blocked media controller</dfn> if the
- <code id=media-controllers:mediacontroller-62><a href=#mediacontroller>MediaController</a></code> is a <a href=#paused-media-controller id=media-controllers:paused-media-controller-4>paused media controller</a>, or if any of its
- <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-18>slaved media elements</a> are <a href=#blocked-media-element id=media-controllers:blocked-media-element>blocked media
- elements</a>, or if any of its <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-19>slaved media elements</a> whose <a href=#autoplaying-flag id=media-controllers:autoplaying-flag-2>autoplaying
- flag</a> is true still have their <code id=media-controllers:dom-media-paused-3><a href=#dom-media-paused>paused</a></code> attribute set to
- true, or if all of its <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-20>slaved media elements</a> have their <code id=media-controllers:dom-media-paused-4><a href=#dom-media-paused>paused</a></code> attribute set to true.</p>
- <p>A <a href=#media-element id=media-controllers:media-element-17>media element</a> is <dfn id=blocked-on-its-media-controller>blocked on its media controller</dfn> if the
- <code id=media-controllers:mediacontroller-63><a href=#mediacontroller>MediaController</a></code> is a <a href=#blocked-media-controller id=media-controllers:blocked-media-controller>blocked media controller</a>, or if its <a href=#media-controller-position id=media-controllers:media-controller-position-7>media
- controller position</a> is either before the <a href=#media-resource id=media-controllers:media-resource-20>media resource</a>'s <a href=#earliest-possible-position id=media-controllers:earliest-possible-position-2>earliest
- possible position</a> relative to the <code id=media-controllers:mediacontroller-64><a href=#mediacontroller>MediaController</a></code>'s timeline or after the end
- of the <a href=#media-resource id=media-controllers:media-resource-21>media resource</a> relative to the <code id=media-controllers:mediacontroller-65><a href=#mediacontroller>MediaController</a></code>'s timeline.</p>
- <p id=controller-playback>When a <code id=media-controllers:mediacontroller-66><a href=#mediacontroller>MediaController</a></code> is not a <a href=#blocked-media-controller id=media-controllers:blocked-media-controller-2>blocked media
- controller</a> and it has at least one <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-21>slaved media
- element</a> whose <code id=media-controllers:document><a href=#document>Document</a></code> is a <a href=#fully-active id=media-controllers:fully-active>fully active</a> <code id=media-controllers:document-2><a href=#document>Document</a></code>,
- the <code id=media-controllers:mediacontroller-67><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position id=media-controllers:media-controller-position-8>media controller position</a> must increase
- monotonically at <a href=#media-controller-playback-rate id=media-controllers:media-controller-playback-rate-3>media controller playback rate</a> units of time on the
- <code id=media-controllers:mediacontroller-68><a href=#mediacontroller>MediaController</a></code>'s timeline per unit time of the clock used by its <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-22>slaved media
- elements</a>.</p>
- <p>When the zero point on the timeline of a <code id=media-controllers:mediacontroller-69><a href=#mediacontroller>MediaController</a></code> moves relative to the
- timelines of the <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-23>slaved media elements</a> by a time difference <var>ΔT</var>, the <code id=media-controllers:mediacontroller-70><a href=#mediacontroller>MediaController</a></code>'s <a href=#media-controller-position id=media-controllers:media-controller-position-9>media controller
- position</a> must be decremented by <var>ΔT</var>.</p>
- <p class=note>In some situations, e.g. when playing back a live stream without buffering
- anything, the <a href=#media-controller-position id=media-controllers:media-controller-position-10>media controller position</a> would increase monotonically as described
- above at the same rate as the <var>ΔT</var> described in the previous paragraph
- decreases it, with the end result that for all intents and purposes, the <a href=#media-controller-position id=media-controllers:media-controller-position-11>media controller
- position</a> would appear to remain constant (probably with the value 0).</p>
- <hr>
- <p>A <code id=media-controllers:mediacontroller-71><a href=#mediacontroller>MediaController</a></code> has a <dfn id=most-recently-reported-readiness-state>most recently reported readiness state</dfn>, which
- is a number from 0 to 4 derived from the numbers used for the <a href=#media-element id=media-controllers:media-element-18>media element</a> <code id=media-controllers:dom-media-readystate-3><a href=#dom-media-readystate>readyState</a></code> attribute, and a <dfn id=most-recently-reported-playback-state>most recently reported
- playback state</dfn>, which is either <i>playing</i>, <i>waiting</i>, or <i>ended</i>.</p>
- <p>When a <code id=media-controllers:mediacontroller-72><a href=#mediacontroller>MediaController</a></code> is created, its <a href=#most-recently-reported-readiness-state id=media-controllers:most-recently-reported-readiness-state>most recently reported readiness
- state</a> must be set to 0, and its <a href=#most-recently-reported-playback-state id=media-controllers:most-recently-reported-playback-state>most recently reported playback state</a> must be
- set to <i>waiting</i>.</p>
- <p>When a user agent is required to <dfn id=report-the-controller-state>report the controller state</dfn> for a
- <code id=media-controllers:mediacontroller-73><a href=#mediacontroller>MediaController</a></code>, the user agent must run the following steps:</p>
- <ol><li>
- <p>If the <code id=media-controllers:mediacontroller-74><a href=#mediacontroller>MediaController</a></code> has no <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-24>slaved media elements</a>, let <var>new readiness state</var> be 0.</p>
- <p>Otherwise, let it have the lowest value of the <code id=media-controllers:dom-media-readystate-4><a href=#dom-media-readystate>readyState</a></code> IDL attributes of all of its <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-25>slaved media
- elements</a>.</p>
- <li>
- <p>If the <code id=media-controllers:mediacontroller-75><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state id=media-controllers:most-recently-reported-readiness-state-2>most recently reported readiness state</a> is
- less than the <var>new readiness state</var>, then run these substeps:</p>
- <ol><li><p>Let <var>next state</var> be the <code id=media-controllers:mediacontroller-76><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state id=media-controllers:most-recently-reported-readiness-state-3>most
- recently reported readiness state</a>.<li><p><i>Loop</i>: Increment <var>next state</var> by one.<li>
- <p><a href=#queue-a-task id=media-controllers:queue-a-task-9>Queue a task</a> to run the following steps:</p>
- <ol><li><p>Set the <code id=media-controllers:mediacontroller-77><a href=#mediacontroller>MediaController</a></code>'s <code id=media-controllers:dom-mediacontroller-readystate-3><a href=#dom-mediacontroller-readystate>readyState</a></code> attribute to the value <var>next state</var>.<li><p><a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-9>Fire a simple event</a> at the <code id=media-controllers:mediacontroller-78><a href=#mediacontroller>MediaController</a></code> object, whose
- name is the event name corresponding to the value of <var>next state</var> given in
- the table below.</ol>
- <li><p>If <var>next state</var> is less than <var>new readiness state</var>,
- then return to the step labeled <i>loop</i>.</ol>
- <p>Otherwise, if the <code id=media-controllers:mediacontroller-79><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state id=media-controllers:most-recently-reported-readiness-state-4>most recently reported readiness
- state</a> is greater than <var>new readiness state</var> then <a href=#queue-a-task id=media-controllers:queue-a-task-10>queue a
- task</a> to <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-10>fire a simple event</a> at the <code id=media-controllers:mediacontroller-80><a href=#mediacontroller>MediaController</a></code> object,
- whose name is the event name corresponding to the value of <var>new readiness
- state</var> given in the table below.</p>
- <table><thead><tr><th>Value of <var>new readiness state</var>
- <th>Event name
- <tbody><tr><td> 0
- <td> <code id=media-controllers:event-mediacontroller-emptied><a href=#event-mediacontroller-emptied>emptied</a></code>
- <tr><td> 1
- <td> <code id=media-controllers:event-mediacontroller-loadedmetadata><a href=#event-mediacontroller-loadedmetadata>loadedmetadata</a></code>
- <tr><td> 2
- <td> <code id=media-controllers:event-mediacontroller-loadeddata><a href=#event-mediacontroller-loadeddata>loadeddata</a></code>
- <tr><td> 3
- <td> <code id=media-controllers:event-mediacontroller-canplay><a href=#event-mediacontroller-canplay>canplay</a></code>
- <tr><td> 4
- <td> <code id=media-controllers:event-mediacontroller-canplaythrough><a href=#event-mediacontroller-canplaythrough>canplaythrough</a></code>
- </table>
- <li><p>Let the <code id=media-controllers:mediacontroller-81><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-readiness-state id=media-controllers:most-recently-reported-readiness-state-5>most recently reported readiness state</a>
- be <var>new readiness state</var>.<li>
- <p>Initialise <var>new playback state</var> by setting it to the state given for the
- first matching condition from the following list:</p>
- <dl class=switch><dt>If the <code id=media-controllers:mediacontroller-82><a href=#mediacontroller>MediaController</a></code> has no <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-26>slaved media elements</a><dd>Let <var>new playback state</var> be <i>waiting</i>.<dt>If all of the <code id=media-controllers:mediacontroller-83><a href=#mediacontroller>MediaController</a></code>'s <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-27>slaved media elements</a> have
- <a href=#ended-playback id=media-controllers:ended-playback>ended playback</a> and the <a href=#media-controller-playback-rate id=media-controllers:media-controller-playback-rate-4>media controller playback rate</a> is positive or
- zero<dd>Let <var>new playback state</var> be <i>ended</i>.<dt>If the <code id=media-controllers:mediacontroller-84><a href=#mediacontroller>MediaController</a></code> is a <a href=#blocked-media-controller id=media-controllers:blocked-media-controller-3>blocked media controller</a><dd>Let <var>new playback state</var> be <i>waiting</i>.<dt>Otherwise<dd>Let <var>new playback state</var> be <i>playing</i>.</dl>
- <li><p>If the <code id=media-controllers:mediacontroller-85><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state id=media-controllers:most-recently-reported-playback-state-2>most recently reported playback state</a>
- is not equal to <var>new playback state</var> and the <var>new playback
- state</var> is <i>ended</i>, then <a href=#queue-a-task id=media-controllers:queue-a-task-11>queue a task</a> that, if the
- <code id=media-controllers:mediacontroller-86><a href=#mediacontroller>MediaController</a></code> object is a <a href=#playing-media-controller id=media-controllers:playing-media-controller-4>playing media controller</a>, and all of the
- <code id=media-controllers:mediacontroller-87><a href=#mediacontroller>MediaController</a></code>'s <a href=#slaved-media-elements id=media-controllers:slaved-media-elements-28>slaved media elements</a> have still <a href=#ended-playback id=media-controllers:ended-playback-2>ended
- playback</a>, and the <a href=#media-controller-playback-rate id=media-controllers:media-controller-playback-rate-5>media controller playback rate</a> is still positive or zero,
- changes the <code id=media-controllers:mediacontroller-88><a href=#mediacontroller>MediaController</a></code> object to a <a href=#paused-media-controller id=media-controllers:paused-media-controller-5>paused media controller</a> and
- then <a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-11>fires a simple event</a> named <code id=media-controllers:event-mediacontroller-pause-2><a href=#event-mediacontroller-pause>pause</a></code> at the <code id=media-controllers:mediacontroller-89><a href=#mediacontroller>MediaController</a></code>
- object.<li>
- <p>If the <code id=media-controllers:mediacontroller-90><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state id=media-controllers:most-recently-reported-playback-state-3>most recently reported playback state</a> is
- not equal to <var>new playback state</var> then <a href=#queue-a-task id=media-controllers:queue-a-task-12>queue a task</a> to run the
- following steps:</p>
- <ol><li><p>Set the <code id=media-controllers:mediacontroller-91><a href=#mediacontroller>MediaController</a></code>'s <code id=media-controllers:dom-mediacontroller-playbackstate-3><a href=#dom-mediacontroller-playbackstate>playbackState</a></code> attribute to the value given in
- the second column of the row of the following table whose first column contains the <var>new playback state</var>.<li><p><a href=#fire-a-simple-event id=media-controllers:fire-a-simple-event-12>Fire a simple event</a> at the <code id=media-controllers:mediacontroller-92><a href=#mediacontroller>MediaController</a></code> object, whose name
- is the value given in the third column of the row of the following table whose first column
- contains the <var>new playback state</var>.</ol>
- <table><thead><tr><th>New playback state
- <th>New value for <code id=media-controllers:dom-mediacontroller-playbackstate-4><a href=#dom-mediacontroller-playbackstate>playbackState</a></code>
- <th>Event name
- <tbody><tr><td><i>playing</i>
- <td>"<dfn id=dom-mediacontroller-playing><code>playing</code></dfn>"
- <td><code id=media-controllers:event-mediacontroller-playing><a href=#event-mediacontroller-playing>playing</a></code>
- <tr><td><i>waiting</i>
- <td>"<dfn id=dom-mediacontroller-waiting><code>waiting</code></dfn>"
- <td><code id=media-controllers:event-mediacontroller-waiting><a href=#event-mediacontroller-waiting>waiting</a></code>
- <tr><td><i>ended</i>
- <td>"<dfn id=dom-mediacontroller-ended><code>ended</code></dfn>"
- <td><code id=media-controllers:event-mediacontroller-ended><a href=#event-mediacontroller-ended>ended</a></code>
- </table>
- <li><p>Let the <code id=media-controllers:mediacontroller-93><a href=#mediacontroller>MediaController</a></code>'s <a href=#most-recently-reported-playback-state id=media-controllers:most-recently-reported-playback-state-4>most recently reported playback state</a>
- be <var>new playback state</var>.</ol>
- <hr>
- <p>The following are the <a href=#event-handlers id=media-controllers:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=media-controllers:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=media-controllers:event-handler-idl-attributes>event handler IDL attributes</a>,
- by all objects implementing the <code id=media-controllers:mediacontroller-94><a href=#mediacontroller>MediaController</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=media-controllers:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=media-controllers:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-mediacontroller-onemptied><code>onemptied</code></dfn> <td> <code id=media-controllers:event-mediacontroller-emptied-2><a href=#event-mediacontroller-emptied>emptied</a></code>
- <tr><td><dfn id=handler-mediacontroller-onloadedmetadata><code>onloadedmetadata</code></dfn> <td> <code id=media-controllers:event-mediacontroller-loadedmetadata-2><a href=#event-mediacontroller-loadedmetadata>loadedmetadata</a></code>
- <tr><td><dfn id=handler-mediacontroller-onloadeddata><code>onloadeddata</code></dfn> <td> <code id=media-controllers:event-mediacontroller-loadeddata-2><a href=#event-mediacontroller-loadeddata>loadeddata</a></code>
- <tr><td><dfn id=handler-mediacontroller-oncanplay><code>oncanplay</code></dfn> <td> <code id=media-controllers:event-mediacontroller-canplay-2><a href=#event-mediacontroller-canplay>canplay</a></code>
- <tr><td><dfn id=handler-mediacontroller-oncanplaythrough><code>oncanplaythrough</code></dfn> <td> <code id=media-controllers:event-mediacontroller-canplaythrough-2><a href=#event-mediacontroller-canplaythrough>canplaythrough</a></code>
- <tr><td><dfn id=handler-mediacontroller-onplaying><code>onplaying</code></dfn> <td> <code id=media-controllers:event-mediacontroller-playing-2><a href=#event-mediacontroller-playing>playing</a></code>
- <tr><td><dfn id=handler-mediacontroller-onended><code>onended</code></dfn> <td> <code id=media-controllers:event-mediacontroller-ended-2><a href=#event-mediacontroller-ended>ended</a></code>
- <tr><td><dfn id=handler-mediacontroller-onwaiting><code>onwaiting</code></dfn> <td> <code id=media-controllers:event-mediacontroller-waiting-2><a href=#event-mediacontroller-waiting>waiting</a></code>
- <tbody><tr><td><dfn id=handler-mediacontroller-ondurationchange><code>ondurationchange</code></dfn> <td> <code id=media-controllers:event-mediacontroller-durationchange-2><a href=#event-mediacontroller-durationchange>durationchange</a></code>
- <tr><td><dfn id=handler-mediacontroller-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code id=media-controllers:event-mediacontroller-timeupdate-2><a href=#event-mediacontroller-timeupdate>timeupdate</a></code>
- <tr><td><dfn id=handler-mediacontroller-onplay><code>onplay</code></dfn> <td> <code id=media-controllers:event-mediacontroller-play-2><a href=#event-mediacontroller-play>play</a></code>
- <tr><td><dfn id=handler-mediacontroller-onpause><code>onpause</code></dfn> <td> <code id=media-controllers:event-mediacontroller-pause-3><a href=#event-mediacontroller-pause>pause</a></code>
- <tr><td><dfn id=handler-mediacontroller-onratechange><code>onratechange</code></dfn> <td> <code id=media-controllers:event-mediacontroller-ratechange-3><a href=#event-mediacontroller-ratechange>ratechange</a></code>
- <tr><td><dfn id=handler-mediacontroller-onvolumechange><code>onvolumechange</code></dfn> <td> <code id=media-controllers:event-mediacontroller-volumechange-3><a href=#event-mediacontroller-volumechange>volumechange</a></code>
- </table>
- <hr>
- <p>The <a href=#task-source id=media-controllers:task-source>task source</a> for the <a href=#concept-task id=media-controllers:concept-task>tasks</a> listed in this
- section is the <a href=#dom-manipulation-task-source id=media-controllers:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
-
- <h6 id=assigning-a-media-controller-declaratively>4.8.14.11.3 Assigning a media controller declaratively</h6>
- <p>The <dfn id=attr-media-mediagroup><code>mediagroup</code></dfn> content attribute on <a href=#media-element id=assigning-a-media-controller-declaratively:media-element>media elements</a> can be used to link multiple <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-2>media elements</a> together by implicitly creating a <code id=assigning-a-media-controller-declaratively:mediacontroller><a href=#mediacontroller>MediaController</a></code>. The
- value is text; <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-3>media elements</a> with the same value are
- automatically linked by the user agent.</p>
-
- <p>When a <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-4>media element</a> is created with a <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, and when a <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-5>media element</a>'s
- <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code> attribute is set, changed, or removed, the
- user agent must run the following steps:</p>
- <ol><li><p>Let <var>m</var> be the <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-6>media element</a> in question.<li><p>Let <var>old controller</var> be <var>m</var>'s <a href=#current-media-controller id=assigning-a-media-controller-declaratively:current-media-controller>current media
- controller</a>, if it currently has one, and null otherwise.<li><p>Let <var>new controller</var> be null.<li><p>Let <var>m</var> have no <a href=#current-media-controller id=assigning-a-media-controller-declaratively:current-media-controller-2>current media controller</a>, if it currently
- has one.<li><p>If <var>m</var>'s <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-3><a href=#attr-media-mediagroup>mediagroup</a></code> attribute
- is being removed, then jump to the <i>update controllers</i> step below.<li>
- <p>If there is another <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-7>media element</a> whose <code id=assigning-a-media-controller-declaratively:document><a href=#document>Document</a></code> is the same as
- <var>m</var>'s <a id=assigning-a-media-controller-declaratively:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> (even if one or both of these elements are not
- actually <a href=#in-a-document id=assigning-a-media-controller-declaratively:in-a-document><em>in</em> the <code>Document</code></a>), and which
- also has a <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-4><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, and whose <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-5><a href=#attr-media-mediagroup>mediagroup</a></code> attribute has the same value as the new value of
- <var>m</var>'s <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-6><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, then
- let <var>controller</var> be that <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-8>media element</a>'s <a href=#current-media-controller id=assigning-a-media-controller-declaratively:current-media-controller-3>current media
- controller</a>.</p>
- <p>Otherwise, let <var>controller</var> be a newly created
- <code id=assigning-a-media-controller-declaratively:mediacontroller-2><a href=#mediacontroller>MediaController</a></code>.</p>
- <li><p>Let <var>m</var>'s <a href=#current-media-controller id=assigning-a-media-controller-declaratively:current-media-controller-4>current media controller</a> be <var>controller</var>.<li><p>Let <var>new controller</var> be <var>m</var>'s <a href=#current-media-controller id=assigning-a-media-controller-declaratively:current-media-controller-5>current media
- controller</a>.<li><p><a href=#bring-the-media-element-up-to-speed-with-its-new-media-controller id=assigning-a-media-controller-declaratively:bring-the-media-element-up-to-speed-with-its-new-media-controller>Bring the media element up to speed with its new media
- controller</a>.<li><p><i>Update controllers</i>: If <var>old
- controller</var> and <var>new controller</var> are the
- same (whether both null or both the same controller) then abort
- these steps.<li><p>If <var>old controller</var> is not null and still has one or more <a href=#slaved-media-elements id=assigning-a-media-controller-declaratively:slaved-media-elements>slaved
- media elements</a>, then <a href=#report-the-controller-state id=assigning-a-media-controller-declaratively:report-the-controller-state>report the controller state</a> for <var>old
- controller</var>.<li><p>If <var>new controller</var> is not null, then <a href=#report-the-controller-state id=assigning-a-media-controller-declaratively:report-the-controller-state-2>report the controller
- state</a> for <var>new controller</var>.</ol>
- <p>The <dfn id=dom-media-mediagroup><code>mediaGroup</code></dfn> IDL attribute on <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-9>media elements</a> must <a href=#reflect id=assigning-a-media-controller-declaratively:reflect>reflect</a> the <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-7><a href=#attr-media-mediagroup>mediagroup</a></code> content attribute.</p>
-
- <div class=example>
- <p>Multiple <a href=#media-element id=assigning-a-media-controller-declaratively:media-element-10>media elements</a> referencing the same <a href=#media-resource id=assigning-a-media-controller-declaratively:media-resource>media
- resource</a> will share a single network request. This can be used to efficiently play two
- (video) tracks from the same <a href=#media-resource id=assigning-a-media-controller-declaratively:media-resource-2>media resource</a> in two different places on the screen.
- Used with the <code id=assigning-a-media-controller-declaratively:attr-media-mediagroup-8><a href=#attr-media-mediagroup>mediagroup</a></code> attribute, these elements can
- also be kept synchronised.</p>
- <p>In this example, a sign-languge interpreter track from a movie file is overlaid on the primary
- video track of that same video file using two <code id=assigning-a-media-controller-declaratively:the-video-element><a href=#the-video-element>video</a></code> elements, some CSS, and an
- implicit <code id=assigning-a-media-controller-declaratively:mediacontroller-3><a href=#mediacontroller>MediaController</a></code>:</p>
- <pre><article>
- <style scoped>
- div { margin: 1em auto; position: relative; width: 400px; height: 300px; }
- video { position; absolute; bottom: 0; right: 0; }
- video:first-child { width: 100%; height: 100%; }
- video:last-child { width: 30%; }
- </style>
- <div>
- <video src="movie.vid#track=Video&amp;track=English" autoplay controls mediagroup=movie></video>
- <video src="movie.vid#track=sign" autoplay mediagroup=movie></video>
- </div>
- </article></pre>
- </div>
- <h5 id=timed-text-tracks>4.8.14.12 Timed text tracks</h5>
- <h6 id=text-track-model>4.8.14.12.1 Text track model</h6>
- <p>A <a href=#media-element id=text-track-model:media-element>media element</a> can have a group of associated <dfn id=text-track>text
- tracks</dfn>, known as the <a href=#media-element id=text-track-model:media-element-2>media element</a>'s <dfn id=list-of-text-tracks>list of text tracks</dfn>. The <a href=#text-track id=text-track-model:text-track>text tracks</a> are sorted as follows:</p>
- <ol class=brief><li>The <a href=#text-track id=text-track-model:text-track-2>text tracks</a> corresponding to <code id=text-track-model:the-track-element><a href=#the-track-element>track</a></code> element
- children of the <a href=#media-element id=text-track-model:media-element-3>media element</a>, in <a href=#tree-order id=text-track-model:tree-order>tree order</a>.<li>Any <a href=#text-track id=text-track-model:text-track-3>text tracks</a> added using the <code id=text-track-model:dom-media-addtexttrack><a href=#dom-media-addtexttrack>addTextTrack()</a></code> method, in the order they were added, oldest
- first.<li>Any <a href=#media-resource-specific-text-track id=text-track-model:media-resource-specific-text-track>media-resource-specific text
- tracks</a> (<a href=#text-track id=text-track-model:text-track-4>text tracks</a> corresponding to data in the
- <a href=#media-resource id=text-track-model:media-resource>media resource</a>), in the order defined by the <a href=#media-resource id=text-track-model:media-resource-2>media resource</a>'s format
- specification.</ol>
- <p>A <a href=#text-track id=text-track-model:text-track-5>text track</a> consists of:</p>
- <dl><dt><dfn id=text-track-kind>The kind of text track</dfn>
- <dd>
- <p>This decides how the track is handled by the user agent. The kind is represented by a string.
- The possible strings are:</p>
- <ul class=brief><li><dfn id=dom-texttrack-kind-subtitles><code>subtitles</code></dfn>
- <li><dfn id=dom-texttrack-kind-captions><code>captions</code></dfn>
- <li><dfn id=dom-texttrack-kind-descriptions><code>descriptions</code></dfn>
- <li><dfn id=dom-texttrack-kind-chapters><code>chapters</code></dfn>
- <li><dfn id=dom-texttrack-kind-metadata><code>metadata</code></dfn>
- </ul>
- <p>The <a href=#text-track-kind id=text-track-model:text-track-kind>kind of track</a> can change dynamically, in the case of
- a <a href=#text-track id=text-track-model:text-track-6>text track</a> corresponding to a <code id=text-track-model:the-track-element-2><a href=#the-track-element>track</a></code> element.</p>
- <dt><dfn id=text-track-label>A label</dfn>
- <dd>
- <p>This is a human-readable string intended to identify the track for the user.</p>
- <p>The <a href=#text-track-label id=text-track-model:text-track-label>label of a track</a> can change dynamically, in the
- case of a <a href=#text-track id=text-track-model:text-track-7>text track</a> corresponding to a <code id=text-track-model:the-track-element-3><a href=#the-track-element>track</a></code> element.</p>
- <p>When a <a href=#text-track-label id=text-track-model:text-track-label-2>text track label</a> is the empty string, the user agent should automatically
- generate an appropriate label from the text track's other properties (e.g. the kind of text
- track and the text track's language) for use in its user interface. This automatically-generated
- label is not exposed in the API.</p>
- <dt><dfn id=text-track-in-band-metadata-track-dispatch-type>An in-band metadata track dispatch type</dfn>
- <dd>
- <p>This is a string extracted from the <a href=#media-resource id=text-track-model:media-resource-3>media resource</a> specifically for in-band
- metadata tracks to enable such tracks to be dispatched to different scripts in the document.</p>
- <p class=example>For example, a traditional TV station broadcast streamed on the Web and
- augmented with Web-specific interactive features could include text tracks with metadata for ad
- targeting, trivia game data during game shows, player states during sports games, recipe
- information during food programs, and so forth. As each program starts and ends, new tracks
- might be added or removed from the stream, and as each one is added, the user agent could bind
- them to dedicated script modules using the value of this attribute.</p>
- <p>Other than for in-band metadata text tracks, the <a href=#text-track-in-band-metadata-track-dispatch-type id=text-track-model:text-track-in-band-metadata-track-dispatch-type>in-band metadata track dispatch type</a> is the empty string. How this
- value is populated for different media formats is described in <a href=#steps-to-expose-a-media-resource-specific-text-track id=text-track-model:steps-to-expose-a-media-resource-specific-text-track>steps to expose a
- media-resource-specific text track</a>.</p>
- <dt><dfn id=text-track-language>A language</dfn>
- <dd>
- <p>This is a string (a BCP 47 language tag) representing the language of the text track's cues.
- <a href=#refsBCP47>[BCP47]</a></p>
- <p>The <a href=#text-track-language id=text-track-model:text-track-language>language of a text track</a> can change dynamically,
- in the case of a <a href=#text-track id=text-track-model:text-track-8>text track</a> corresponding to a <code id=text-track-model:the-track-element-4><a href=#the-track-element>track</a></code> element.</p>
- <dt><dfn id=text-track-readiness-state>A readiness state</dfn>
- <dd>
- <p>One of the following:</p>
- <dl><dt><dfn id=text-track-not-loaded>Not loaded</dfn>
- <dd>
- <p>Indicates that the text track's cues have not been obtained.</p>
- <dt><dfn id=text-track-loading>Loading</dfn>
- <dd>
- <p>Indicates that the text track is loading and there have been no fatal errors encountered so
- far. Further cues might still be added to the track by the parser.</p>
- <dt><dfn id=text-track-loaded>Loaded</dfn>
- <dd>
- <p>Indicates that the text track has been loaded with no fatal errors.</p>
- <dt><dfn id=text-track-failed-to-load>Failed to load</dfn>
- <dd>
- <p>Indicates that the text track was enabled, but when the user agent attempted to obtain it,
- this failed in some way (e.g. <a href=#url id=text-track-model:url>URL</a> could not be <a href=#resolve-a-url id=text-track-model:resolve-a-url>resolved</a>, network error, unknown text track format). Some or all of the cues are
- likely missing and will not be obtained.</p>
- </dl>
- <p>The <a href=#text-track-readiness-state id=text-track-model:text-track-readiness-state>readiness state</a> of a <a href=#text-track id=text-track-model:text-track-9>text
- track</a> changes dynamically as the track is obtained.</p>
- <dt><dfn id=text-track-mode>A mode</dfn>
- <dd>
- <p>One of the following:</p>
- <dl><dt><dfn id=text-track-disabled>Disabled</dfn>
- <dd>
- <p>Indicates that the text track is not active. Other than for the purposes of exposing the
- track in the DOM, the user agent is ignoring the text track. No cues are active, no events are
- fired, and the user agent will not attempt to obtain the track's cues.</p>
- <dt><dfn id=text-track-hidden>Hidden</dfn>
- <dd>
- <p>Indicates that the text track is active, but that the user agent is not actively displaying
- the cues. If no attempt has yet been made to obtain the track's cues, the user agent will
- perform such an attempt momentarily. The user agent is maintaining a list of which cues are
- active, and events are being fired accordingly.</p>
- <dt><dfn id=text-track-showing>Showing</dfn>
- <dd>
- <p>Indicates that the text track is active. If no attempt has yet been made to obtain the
- track's cues, the user agent will perform such an attempt momentarily. The user agent is
- maintaining a list of which cues are active, and events are being fired accordingly. In
- addition, for text tracks whose <a href=#text-track-kind id=text-track-model:text-track-kind-2>kind</a> is <code id=text-track-model:dom-texttrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> or <code id=text-track-model:dom-texttrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code>, the cues are being overlaid on the video
- as appropriate; for text tracks whose <a href=#text-track-kind id=text-track-model:text-track-kind-3>kind</a> is <code id=text-track-model:dom-texttrack-kind-descriptions><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>, the user agent is making the
- cues available to the user in a non-visual fashion; and for text tracks whose <a href=#text-track-kind id=text-track-model:text-track-kind-4>kind</a> is <code id=text-track-model:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code>, the user agent is making available to
- the user a mechanism by which the user can navigate to any point in the <a href=#media-resource id=text-track-model:media-resource-4>media
- resource</a> by selecting a cue.</p>
- </dl>
- <dt><dfn id=text-track-list-of-cues>A list of zero or more cues</dfn>
- <dd>
- <p>A list of <a href=#text-track-cue id=text-track-model:text-track-cue>text track cues</a>, along with <dfn id=rules-for-updating-the-text-track-rendering>rules for
- updating the text track rendering</dfn>. For example, for WebVTT, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=text-track-model:rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating
- the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a> </p>
- <p>The <a href=#text-track-list-of-cues id=text-track-model:text-track-list-of-cues>list of cues of a text track</a> can change
- dynamically, either because the <a href=#text-track id=text-track-model:text-track-10>text track</a> has <a href=#text-track-not-loaded id=text-track-model:text-track-not-loaded>not yet been loaded</a> or is still <a href=#text-track-loading id=text-track-model:text-track-loading>loading</a>,
- or due to DOM manipulation.</p>
- </dl>
- <p>Each <a href=#text-track id=text-track-model:text-track-11>text track</a> has a corresponding <code id=text-track-model:texttrack><a href=#texttrack>TextTrack</a></code> object.</p>
- <hr>
- <p>Each <a href=#media-element id=text-track-model:media-element-4>media element</a> has a <dfn id=list-of-pending-text-tracks>list of pending text tracks</dfn>, which must
- initially be empty, a <dfn id=blocked-on-parser>blocked-on-parser</dfn> flag, which must initially be false, and a
- <dfn id=did-perform-automatic-track-selection>did-perform-automatic-track-selection</dfn> flag, which must also initially be false.</p>
- <p>When the user agent is required to <dfn id=populate-the-list-of-pending-text-tracks>populate the list of pending text tracks</dfn> of a
- <a href=#media-element id=text-track-model:media-element-5>media element</a>, the user agent must add to the element's <a href=#list-of-pending-text-tracks id=text-track-model:list-of-pending-text-tracks>list of pending text
- tracks</a> each <a href=#text-track id=text-track-model:text-track-12>text track</a> in the element's <a href=#list-of-text-tracks id=text-track-model:list-of-text-tracks>list of text tracks</a> whose
- <a href=#text-track-mode id=text-track-model:text-track-mode>text track mode</a> is not <a href=#text-track-disabled id=text-track-model:text-track-disabled>disabled</a> and whose
- <a href=#text-track-readiness-state id=text-track-model:text-track-readiness-state-2>text track readiness state</a> is <a href=#text-track-loading id=text-track-model:text-track-loading-2>loading</a>.</p>
- <p>Whenever a <code id=text-track-model:the-track-element-5><a href=#the-track-element>track</a></code> element's parent node changes, the user agent must remove the
- corresponding <a href=#text-track id=text-track-model:text-track-13>text track</a> from any <a href=#list-of-pending-text-tracks id=text-track-model:list-of-pending-text-tracks-2>list of pending text tracks</a> that it is
- in.</p>
- <p>Whenever a <a href=#text-track id=text-track-model:text-track-14>text track</a>'s <a href=#text-track-readiness-state id=text-track-model:text-track-readiness-state-3>text track readiness state</a> changes to either
- <a href=#text-track-loaded id=text-track-model:text-track-loaded>loaded</a> or <a href=#text-track-failed-to-load id=text-track-model:text-track-failed-to-load>failed to
- load</a>, the user agent must remove it from any <a href=#list-of-pending-text-tracks id=text-track-model:list-of-pending-text-tracks-3>list of pending text tracks</a> that
- it is in.</p>
- <p>When a <a href=#media-element id=text-track-model:media-element-6>media element</a> is created by an <a href=#html-parser id=text-track-model:html-parser>HTML parser</a> or <a href=#xml-parser id=text-track-model:xml-parser>XML
- parser</a>, the user agent must set the element's <a href=#blocked-on-parser id=text-track-model:blocked-on-parser>blocked-on-parser</a> flag to true.
- When a <a href=#media-element id=text-track-model:media-element-7>media element</a> is popped off the <a href=#stack-of-open-elements id=text-track-model:stack-of-open-elements>stack of open elements</a> of an
- <a href=#html-parser id=text-track-model:html-parser-2>HTML parser</a> or <a href=#xml-parser id=text-track-model:xml-parser-2>XML parser</a>, the user agent must <a href=#honor-user-preferences-for-automatic-text-track-selection id=text-track-model:honor-user-preferences-for-automatic-text-track-selection>honor user
- preferences for automatic text track selection</a>, <a href=#populate-the-list-of-pending-text-tracks id=text-track-model:populate-the-list-of-pending-text-tracks>populate the list of pending text
- tracks</a>, and set the element's <a href=#blocked-on-parser id=text-track-model:blocked-on-parser-2>blocked-on-parser</a> flag to false.</p>
- <p>The <a href=#text-track id=text-track-model:text-track-15>text tracks</a> of a <a href=#media-element id=text-track-model:media-element-8>media element</a> are <dfn id=the-text-tracks-are-ready>ready</dfn> when both the element's <a href=#list-of-pending-text-tracks id=text-track-model:list-of-pending-text-tracks-4>list of pending text
- tracks</a> is empty and the element's <a href=#blocked-on-parser id=text-track-model:blocked-on-parser-3>blocked-on-parser</a> flag is false.</p>
- <p>Each <a href=#media-element id=text-track-model:media-element-9>media element</a> has a <dfn id=pending-text-track-change-notification-flag>pending text track change notification flag</dfn>,
- which must initially be unset.</p>
- <p>Whenever a <a href=#text-track id=text-track-model:text-track-16>text track</a> that is in a <a href=#media-element id=text-track-model:media-element-10>media element</a>'s <a href=#list-of-text-tracks id=text-track-model:list-of-text-tracks-2>list of text
- tracks</a> has its <a href=#text-track-mode id=text-track-model:text-track-mode-2>text track mode</a> change value, the user agent must run the
- following steps for the <a href=#media-element id=text-track-model:media-element-11>media element</a>:</p>
- <ol><li><p>If the <a href=#media-element id=text-track-model:media-element-12>media element</a>'s <a href=#pending-text-track-change-notification-flag id=text-track-model:pending-text-track-change-notification-flag>pending text track change notification
- flag</a> is set, abort these steps.<li><p>Set the <a href=#media-element id=text-track-model:media-element-13>media element</a>'s <a href=#pending-text-track-change-notification-flag id=text-track-model:pending-text-track-change-notification-flag-2>pending text track change notification
- flag</a>.<li>
- <p><a href=#queue-a-task id=text-track-model:queue-a-task>Queue a task</a> that runs the following substeps:</p>
- <ol><li><p>Unset the <a href=#media-element id=text-track-model:media-element-14>media element</a>'s <a href=#pending-text-track-change-notification-flag id=text-track-model:pending-text-track-change-notification-flag-3>pending text track change notification
- flag</a>.<li><p><a href=#fire-a-simple-event id=text-track-model:fire-a-simple-event>Fire a simple event</a> named <code id=text-track-model:event-media-change><a href=#event-media-change>change</a></code> at
- the <a href=#media-element id=text-track-model:media-element-15>media element</a>'s <code id=text-track-model:dom-media-texttracks><a href=#dom-media-texttracks>textTracks</a></code>
- attribute's <code id=text-track-model:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</ol>
- <li><p>If the <a href=#media-element id=text-track-model:media-element-16>media element</a>'s <a href=#show-poster-flag id=text-track-model:show-poster-flag>show poster flag</a> is not set, run the
- <i id=text-track-model:time-marches-on><a href=#time-marches-on>time marches on</a></i> steps.</ol>
- <p>The <a href=#task-source id=text-track-model:task-source>task source</a> for the <a href=#concept-task id=text-track-model:concept-task>tasks</a> listed in this
- section is the <a href=#dom-manipulation-task-source id=text-track-model:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- <hr>
- <p>A <dfn id=text-track-cue>text track cue</dfn> is the unit of time-sensitive data in a <a href=#text-track id=text-track-model:text-track-17>text track</a>,
- corresponding for instance for subtitles and captions to the text that appears at a particular
- time and disappears at another time.</p>
- <p>Each <a href=#text-track-cue id=text-track-model:text-track-cue-2>text track cue</a> consists of:</p>
- <dl><dt><dfn id=text-track-cue-identifier>An identifier</dfn>
- <dd>
- <p>An arbitrary string.</p>
- <dt><dfn id=text-track-cue-start-time>A start time</dfn>
- <dd>
- <p>The time, in seconds and fractions of a second, that describes the beginning of the range of
- the <a href=#media-data id=text-track-model:media-data>media data</a> to which the cue applies.</p>
- <dt><dfn id=text-track-cue-end-time>An end time</dfn>
- <dd>
- <p>The time, in seconds and fractions of a second, that describes the end of the range of the
- <a href=#media-data id=text-track-model:media-data-2>media data</a> to which the cue applies.</p>
- <dt><dfn id=text-track-cue-pause-on-exit-flag>A pause-on-exit flag</dfn>
- <dd>
- <p>A boolean indicating whether playback of the <a href=#media-resource id=text-track-model:media-resource-5>media resource</a> is to pause when the
- end of the range to which the cue applies is reached.</p>
- <dt>Some additional format-specific data<dd>
- <p>Additional fields, as needed for the format. For example, WebVTT has a <a href=#text-track-cue-writing-direction id=text-track-model:text-track-cue-writing-direction>text track cue
- writing direction</a> and so forth. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <dt><dfn id=text-track-cue-data>The data of the cue</dfn>
- <dd>
- <p>The raw data of the cue, and <dfn id=rules-for-rendering-the-cue-in-isolation>rules for rendering the cue in isolation</dfn>.</p>
- <p>The precise nature of this data is defined by the format. For example, WebVTT uses text.</p>
- </dl>
- <p class=note>The <a href=#text-track-cue-start-time id=text-track-model:text-track-cue-start-time>text track cue start time</a> and <a href=#text-track-cue-end-time id=text-track-model:text-track-cue-end-time>text track cue end
- time</a> can be negative. (The <a href=#current-playback-position id=text-track-model:current-playback-position>current playback position</a> can never be negative,
- though, so cues entirely before time zero cannot be active.)</p>
- <p>Each <a href=#text-track-cue id=text-track-model:text-track-cue-3>text track cue</a> has a corresponding <code id=text-track-model:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> object (or more
- specifically, an object that inherits from <code id=text-track-model:texttrackcue-2><a href=#texttrackcue>TextTrackCue</a></code> — for example, WebVTT
- cues use the <code id=text-track-model:vttcue><a href=#vttcue>VTTCue</a></code> interface). A <a href=#text-track-cue id=text-track-model:text-track-cue-4>text track cue</a>'s in-memory
- representation can be dynamically changed through this <code id=text-track-model:texttrackcue-3><a href=#texttrackcue>TextTrackCue</a></code> API. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>A <a href=#text-track-cue id=text-track-model:text-track-cue-5>text track cue</a> is associated with <a href=#rules-for-updating-the-text-track-rendering id=text-track-model:rules-for-updating-the-text-track-rendering>rules for updating the text track
- rendering</a>, as defined by the specification for the specific kind of <a href=#text-track-cue id=text-track-model:text-track-cue-6>text track
- cue</a>. These rules are used specifically when the object representing the cue is added to a
- <code id=text-track-model:texttrack-2><a href=#texttrack>TextTrack</a></code> object using the <code id=text-track-model:dom-texttrack-addcue><a href=#dom-texttrack-addcue>addCue()</a></code>
- method.</p>
- <p>In addition, each <a href=#text-track-cue id=text-track-model:text-track-cue-7>text track cue</a> has two pieces of dynamic information:</p>
- <dl><dt>The <dfn id=text-track-cue-active-flag>active flag</dfn>
- <dd>
- <p>This flag must be initially unset. The flag is used to ensure events are fired appropriately
- when the cue becomes active or inactive, and to make sure the right cues are rendered.</p>
- <p>The user agent must synchronously unset this flag whenever the <a href=#text-track-cue id=text-track-model:text-track-cue-8>text track cue</a> is
- removed from its <a href=#text-track id=text-track-model:text-track-18>text track</a>'s <a href=#text-track-list-of-cues id=text-track-model:text-track-list-of-cues-2>text track list of cues</a>; whenever the
- <a href=#text-track id=text-track-model:text-track-19>text track</a> itself is removed from its <a href=#media-element id=text-track-model:media-element-17>media element</a>'s <a href=#list-of-text-tracks id=text-track-model:list-of-text-tracks-3>list of
- text tracks</a> or has its <a href=#text-track-mode id=text-track-model:text-track-mode-3>text track mode</a> changed to <a href=#text-track-disabled id=text-track-model:text-track-disabled-2>disabled</a>; and whenever the <a href=#media-element id=text-track-model:media-element-18>media element</a>'s <code id=text-track-model:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> is changed back to <code id=text-track-model:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>. When the flag is unset in this way for one
- or more cues in <a href=#text-track id=text-track-model:text-track-20>text tracks</a> that were <a href=#text-track-showing id=text-track-model:text-track-showing>showing</a> prior to the relevant incident, the user agent must, after having unset
- the flag for all the affected cues, apply the <a href=#rules-for-updating-the-text-track-rendering id=text-track-model:rules-for-updating-the-text-track-rendering-2>rules for updating the text track
- rendering</a> of those <a href=#text-track id=text-track-model:text-track-21>text tracks</a>. For example, for <a href=#text-track id=text-track-model:text-track-22>text tracks</a> based on WebVTT, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=text-track-model:rules-for-updating-the-display-of-webvtt-text-tracks-2>rules for updating the display
- of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p> <dt>The <dfn id=text-track-cue-display-state>display state</dfn>
- <dd>
- <p>This is used as part of the rendering model, to keep cues in a consistent position. It must
- initially be empty. Whenever the <a href=#text-track-cue-active-flag id=text-track-model:text-track-cue-active-flag>text track cue active flag</a> is unset, the user
- agent must empty the <a href=#text-track-cue-display-state id=text-track-model:text-track-cue-display-state>text track cue display state</a>.</p>
- </dl>
- <p>The <a href=#text-track-cue id=text-track-model:text-track-cue-9>text track cues</a> of a <a href=#media-element id=text-track-model:media-element-19>media element</a>'s
- <a href=#text-track id=text-track-model:text-track-23>text tracks</a> are ordered relative to each other in the <dfn id=text-track-cue-order>text
- track cue order</dfn>, which is determined as follows: first group the <a href=#text-track-cue id=text-track-model:text-track-cue-10>cues</a> by their <a href=#text-track id=text-track-model:text-track-24>text track</a>, with the groups being sorted in the same order
- as their <a href=#text-track id=text-track-model:text-track-25>text tracks</a> appear in the <a href=#media-element id=text-track-model:media-element-20>media element</a>'s
- <a href=#list-of-text-tracks id=text-track-model:list-of-text-tracks-4>list of text tracks</a>; then, within each group, <a href=#text-track-cue id=text-track-model:text-track-cue-11>cues</a> must be sorted by their <a href=#text-track-cue-start-time id=text-track-model:text-track-cue-start-time-2>start
- time</a>, earliest first; then, any <a href=#text-track-cue id=text-track-model:text-track-cue-12>cues</a> with the same
- <a href=#text-track-cue-start-time id=text-track-model:text-track-cue-start-time-3>start time</a> must be sorted by their <a href=#text-track-cue-end-time id=text-track-model:text-track-cue-end-time-2>end time</a>, latest first; and finally, any <a href=#text-track-cue id=text-track-model:text-track-cue-13>cues</a> with identical <a href=#text-track-cue-end-time id=text-track-model:text-track-cue-end-time-3>end
- times</a> must be sorted in the order they were last added to their respective <a href=#text-track-list-of-cues id=text-track-model:text-track-list-of-cues-3>text track
- list of cues</a>, oldest first (so e.g. for cues from a WebVTT file, that would initially be
- the order in which the cues were listed in the file). <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <h6 id=sourcing-in-band-text-tracks>4.8.14.12.2 Sourcing in-band text tracks</h6>
- <p>A <dfn id=media-resource-specific-text-track>media-resource-specific text track</dfn> is a <a href=#text-track id=sourcing-in-band-text-tracks:text-track>text track</a> that corresponds
- to data found in the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource>media resource</a>.</p>
-
- <p>Rules for processing and rendering such data are defined by the relevant specifications, e.g.
- the specification of the video format if the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-2>media resource</a> is a video. Details for
- some legacy formats can be found in the <cite>Sourcing In-band Media Resource Tracks from Media
- Containers into HTML</cite> specification. <a href=#refsINBAND>[INBAND]</a></p>
- <p>When a <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-3>media resource</a> contains data that the user agent recognises and supports as
- being equivalent to a <a href=#text-track id=sourcing-in-band-text-tracks:text-track-2>text track</a>, the user agent <a href=#found-a-media-resource-specific-timed-track>runs</a> the <dfn id=steps-to-expose-a-media-resource-specific-text-track>steps to expose a
- media-resource-specific text track</dfn> with the relevant data, as follows.</p>
-
- <ol><li><p>Associate the relevant data with a new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-3>text track</a> and its corresponding new
- <code id=sourcing-in-band-text-tracks:texttrack><a href=#texttrack>TextTrack</a></code> object. The <a href=#text-track id=sourcing-in-band-text-tracks:text-track-4>text track</a> is a <a href=#media-resource-specific-text-track id=sourcing-in-band-text-tracks:media-resource-specific-text-track>media-resource-specific
- text track</a>.<li><p>Set the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-5>text track</a>'s <a href=#text-track-kind id=sourcing-in-band-text-tracks:text-track-kind>kind</a>, <a href=#text-track-label id=sourcing-in-band-text-tracks:text-track-label>label</a>, and <a href=#text-track-language id=sourcing-in-band-text-tracks:text-track-language>language</a>
- based on the semantics of the relevant data, as defined by the relevant specification. If there
- is no label in that data, then the <a href=#text-track-label id=sourcing-in-band-text-tracks:text-track-label-2>label</a> must be set to the
- empty string.<li><p>Associate the <a href=#text-track-list-of-cues id=sourcing-in-band-text-tracks:text-track-list-of-cues>text track list of cues</a> with the <a href=#rules-for-updating-the-text-track-rendering id=sourcing-in-band-text-tracks:rules-for-updating-the-text-track-rendering>rules for updating the
- text track rendering</a> appropriate for the format in question.</p>
- <li>
- <p>If the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-6>text track</a>'s <a href=#text-track-kind id=sourcing-in-band-text-tracks:text-track-kind-2>kind</a> is <code id=sourcing-in-band-text-tracks:dom-texttrack-kind-metadata><a href=#dom-texttrack-kind-metadata>metadata</a></code>, then set the <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type>text track in-band
- metadata track dispatch type</a> as follows, based on the type of the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-4>media
- resource</a>:</p>
- <dl class=switch><dt>If the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-5>media resource</a> is an Ogg file<dd>The <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-2>text track in-band metadata track dispatch type</a> must be set to the value
- of the Name header field. <a href=#refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]</a><dt>If the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-6>media resource</a> is a WebM file<dd>The <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-3>text track in-band metadata track dispatch type</a> must be set to the value
- of the <code>CodecID</code> element. <a href=#refsWEBMCG>[WEBMCG]</a><dt>If the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-7>media resource</a> is an MPEG-2 file<dd>Let <var>stream type</var> be the value of the "stream_type" field describing the
- text track's type in the file's program map section, interpreted as an 8-bit unsigned integer.
- Let <var>length</var> be the value of the "ES_info_length" field for the track in the
- same part of the program map section, interpreted as an integer as defined by the MPEG-2
- specification. Let <var>descriptor bytes</var> be the <var>length</var> bytes
- following the "ES_info_length" field. The <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-4>text track in-band metadata track dispatch
- type</a> must be set to the concatenation of the <var>stream type</var> byte and
- the zero or more <var>descriptor bytes</var> bytes, expressed in hexadecimal using
- <a href=#uppercase-ascii-hex-digits id=sourcing-in-band-text-tracks:uppercase-ascii-hex-digits>uppercase ASCII hex digits</a>. <a href=#refsMPEG2>[MPEG2]</a>
- <dt>If the <a href=#media-resource id=sourcing-in-band-text-tracks:media-resource-8>media resource</a> is an MPEG-4 file<dd>Let the
- first <code>stsd</code> box of the
- first <code>stbl</code> box of the
- first <code>minf</code> box of the
- first <code>mdia</code> box of the
- <a href=#text-track id=sourcing-in-band-text-tracks:text-track-7>text track</a>'s <code>trak</code> box in the
- first <code>moov</code> box
- of the file be the <i>stsd box</i>, if any.
- If the file has no <i>stsd box</i>, or if the <i>stsd box</i> has neither a <code>mett</code> box nor a <code>metx</code> box, then the <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-5>text track
- in-band metadata track dispatch type</a> must be set to the empty string.
- Otherwise, if the <i>stsd box</i> has a <code>mett</code> box then the <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-6>text
- track in-band metadata track dispatch type</a> must be set to the concatenation of the
- string "<code>mett</code>", a U+0020 SPACE character, and the value of the first <code>mime_format</code> field of the first <code>mett</code> box of the <i>stsd
- box</i>, or the empty string if that field is absent in that box.
- Otherwise, if the <i>stsd box</i> has no <code>mett</code> box but has a <code>metx</code> box then the <a href=#text-track-in-band-metadata-track-dispatch-type id=sourcing-in-band-text-tracks:text-track-in-band-metadata-track-dispatch-type-7>text track in-band metadata track dispatch type</a>
- must be set to the concatenation of the string "<code>metx</code>", a U+0020 SPACE
- character, and the value of the first <code>namespace</code> field of the first <code>metx</code> box of the <i>stsd box</i>, or the empty string if that field is absent in
- that box.
- <a href=#refsMPEG4>[MPEG4]</a>
- </dl>
- <li><p>Populate the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-8>text track</a>'s <a href=#text-track-list-of-cues id=sourcing-in-band-text-tracks:text-track-list-of-cues-2>list of
- cues</a> with the cues parsed so far, following the <a href=#guidelines-for-exposing-cues-in-various-formats-as-text-track-cues id=sourcing-in-band-text-tracks:guidelines-for-exposing-cues-in-various-formats-as-text-track-cues>guidelines for exposing
- cues</a>, and begin updating it dynamically as necessary.<li><p>Set the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-9>text track</a>'s <a href=#text-track-readiness-state id=sourcing-in-band-text-tracks:text-track-readiness-state>readiness
- state</a> to <a href=#text-track-loaded id=sourcing-in-band-text-tracks:text-track-loaded>loaded</a>.<li><p>Set the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-10>text track</a>'s <a href=#text-track-mode id=sourcing-in-band-text-tracks:text-track-mode>mode</a> to the
- mode consistent with the user's preferences and the requirements of the relevant specification
- for the data.</p>
- <p class=note>For instance, if there are no other active subtitles, and this is a forced
- subtitle track (a subtitle track giving subtitles in the audio track's primary language, but
- only for audio that is actually in another language), then those subtitles might be activated
- here.</p>
- <li><p>Add the new <a href=#text-track id=sourcing-in-band-text-tracks:text-track-11>text track</a> to the <a href=#media-element id=sourcing-in-band-text-tracks:media-element>media element</a>'s <a href=#list-of-text-tracks id=sourcing-in-band-text-tracks:list-of-text-tracks>list of text
- tracks</a>.<li><p><a href=#concept-event-fire id=sourcing-in-band-text-tracks:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=sourcing-in-band-text-tracks:concept-events-trusted>trusted</a> event with the name <code id=sourcing-in-band-text-tracks:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that uses
- the <code id=sourcing-in-band-text-tracks:trackevent><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=sourcing-in-band-text-tracks:dom-trackevent-track><a href=#dom-trackevent-track>track</a></code>
- attribute initialised to the <a href=#text-track id=sourcing-in-band-text-tracks:text-track-12>text track</a>'s <code id=sourcing-in-band-text-tracks:texttrack-2><a href=#texttrack>TextTrack</a></code> object, at the
- <a href=#media-element id=sourcing-in-band-text-tracks:media-element-2>media element</a>'s <code id=sourcing-in-band-text-tracks:dom-media-texttracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
- <code id=sourcing-in-band-text-tracks:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</ol>
-
-
-
-
- <h6 id=sourcing-out-of-band-text-tracks>4.8.14.12.3 Sourcing out-of-band text tracks</h6>
- <p>When a <code id=sourcing-out-of-band-text-tracks:the-track-element><a href=#the-track-element>track</a></code> element is created, it must be associated with a new <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track>text
- track</a> (with its value set as defined below) and its corresponding new
- <code id=sourcing-out-of-band-text-tracks:texttrack><a href=#texttrack>TextTrack</a></code> object.</p>
- <p>The <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind>text track kind</a> is determined from the state of the element's <code id=sourcing-out-of-band-text-tracks:attr-track-kind><a href=#attr-track-kind>kind</a></code> attribute according to the following table; for a state given
- in a cell of the first column, the <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind-2>kind</a> is the string given
- in the second column:</p>
- <table><thead><tr><th>State
- <th>String
- <tbody><tr><td><a href=#attr-track-kind-subtitles id=sourcing-out-of-band-text-tracks:attr-track-kind-subtitles>Subtitles</a>
- <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code>
- <tr><td><a href=#attr-track-kind-captions id=sourcing-out-of-band-text-tracks:attr-track-kind-captions>Captions</a>
- <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code>
- <tr><td><a href=#attr-track-kind-descriptions id=sourcing-out-of-band-text-tracks:attr-track-kind-descriptions>Descriptions</a>
- <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-descriptions><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>
- <tr><td><a href=#attr-track-kind-chapters id=sourcing-out-of-band-text-tracks:attr-track-kind-chapters>Chapters</a>
- <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code>
- <tr><td><a href=#attr-track-kind-metadata id=sourcing-out-of-band-text-tracks:attr-track-kind-metadata>Metadata</a>
- <td><code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata><a href=#dom-texttrack-kind-metadata>metadata</a></code>
- </table>
- <p>The <a href=#text-track-label id=sourcing-out-of-band-text-tracks:text-track-label>text track label</a> is the element's <a href=#track-label id=sourcing-out-of-band-text-tracks:track-label>track label</a>.</p>
- <p>The <a href=#text-track-language id=sourcing-out-of-band-text-tracks:text-track-language>text track language</a> is the element's <a href=#track-language id=sourcing-out-of-band-text-tracks:track-language>track language</a>, if any, or
- the empty string otherwise.</p>
- <p>As the <code id=sourcing-out-of-band-text-tracks:attr-track-kind-2><a href=#attr-track-kind>kind</a></code>, <code id=sourcing-out-of-band-text-tracks:attr-track-label><a href=#attr-track-label>label</a></code>,
- and <code id=sourcing-out-of-band-text-tracks:attr-track-srclang><a href=#attr-track-srclang>srclang</a></code> attributes are set, changed, or removed, the
- <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-2>text track</a> must update accordingly, as per the definitions above.</p>
- <p class=note>Changes to the <a href=#track-url id=sourcing-out-of-band-text-tracks:track-url>track URL</a> are handled in the algorithm below.</p>
- <p>The <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state>text track readiness state</a> is initially <a href=#text-track-not-loaded id=sourcing-out-of-band-text-tracks:text-track-not-loaded>not loaded</a>, and the <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode>text track mode</a> is initially <a href=#text-track-disabled id=sourcing-out-of-band-text-tracks:text-track-disabled>disabled</a>.</p>
- <p>The <a href=#text-track-list-of-cues id=sourcing-out-of-band-text-tracks:text-track-list-of-cues>text track list of cues</a> is initially empty. It is dynamically modified when
- the referenced file is parsed. Associated with the list are the <a href=#rules-for-updating-the-text-track-rendering id=sourcing-out-of-band-text-tracks:rules-for-updating-the-text-track-rendering>rules for updating the text
- track rendering</a> appropriate for the format in question; for WebVTT, this is the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=sourcing-out-of-band-text-tracks:rules-for-updating-the-display-of-webvtt-text-tracks>rules
- for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>When a <code id=sourcing-out-of-band-text-tracks:the-track-element-2><a href=#the-track-element>track</a></code> element's parent element changes and the new parent is a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element>media
- element</a>, then the user agent must add the <code id=sourcing-out-of-band-text-tracks:the-track-element-3><a href=#the-track-element>track</a></code> element's corresponding
- <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-3>text track</a> to the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-2>media element</a>'s <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks>list of text tracks</a>, and
- then <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task>queue a task</a> to <a href=#concept-event-fire id=sourcing-out-of-band-text-tracks:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=sourcing-out-of-band-text-tracks:concept-events-trusted>trusted</a> event with the name <code id=sourcing-out-of-band-text-tracks:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and that uses
- the <code id=sourcing-out-of-band-text-tracks:trackevent><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=sourcing-out-of-band-text-tracks:dom-trackevent-track><a href=#dom-trackevent-track>track</a></code>
- attribute initialised to the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-4>text track</a>'s <code id=sourcing-out-of-band-text-tracks:texttrack-2><a href=#texttrack>TextTrack</a></code> object, at the
- <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-3>media element</a>'s <code id=sourcing-out-of-band-text-tracks:dom-media-texttracks><a href=#dom-media-texttracks>textTracks</a></code> attribute's
- <code id=sourcing-out-of-band-text-tracks:texttracklist><a href=#texttracklist>TextTrackList</a></code> object.</p>
- <p>When a <code id=sourcing-out-of-band-text-tracks:the-track-element-4><a href=#the-track-element>track</a></code> element's parent element changes and the old parent was a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-4>media
- element</a>, then the user agent must remove the <code id=sourcing-out-of-band-text-tracks:the-track-element-5><a href=#the-track-element>track</a></code> element's corresponding
- <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-5>text track</a> from the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-5>media element</a>'s <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks-2>list of text tracks</a>,
- and then <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-2>queue a task</a> to <a href=#concept-event-fire id=sourcing-out-of-band-text-tracks:concept-event-fire-2>fire</a> a <a href=#concept-events-trusted id=sourcing-out-of-band-text-tracks:concept-events-trusted-2>trusted</a> event with the name <code id=sourcing-out-of-band-text-tracks:event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>, that does not bubble and is not cancelable, and that
- uses the <code id=sourcing-out-of-band-text-tracks:trackevent-2><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=sourcing-out-of-band-text-tracks:dom-trackevent-track-2><a href=#dom-trackevent-track>track</a></code> attribute initialised to the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-6>text track</a>'s
- <code id=sourcing-out-of-band-text-tracks:texttrack-3><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-6>media element</a>'s <code id=sourcing-out-of-band-text-tracks:dom-media-texttracks-2><a href=#dom-media-texttracks>textTracks</a></code> attribute's <code id=sourcing-out-of-band-text-tracks:texttracklist-2><a href=#texttracklist>TextTrackList</a></code> object.</p>
-
- <hr>
- <p>When a <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-7>text track</a> corresponding to a <code id=sourcing-out-of-band-text-tracks:the-track-element-6><a href=#the-track-element>track</a></code> element is added to a
- <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-7>media element</a>'s <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks-3>list of text tracks</a>, the user agent must <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-3>queue a
- task</a> to run the following steps for the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-8>media element</a>:</p>
- <ol><li><p>If the element's <a href=#blocked-on-parser id=sourcing-out-of-band-text-tracks:blocked-on-parser>blocked-on-parser</a> flag is true, abort these steps.<li><p>If the element's <a href=#did-perform-automatic-track-selection id=sourcing-out-of-band-text-tracks:did-perform-automatic-track-selection>did-perform-automatic-track-selection</a> flag is true, abort
- these steps.<li><p><a href=#honor-user-preferences-for-automatic-text-track-selection id=sourcing-out-of-band-text-tracks:honor-user-preferences-for-automatic-text-track-selection>Honor user preferences for automatic text track selection</a> for this
- element.</ol>
- <p>When the user agent is required to <dfn id=honor-user-preferences-for-automatic-text-track-selection>honor user preferences for automatic text track
- selection</dfn> for a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-9>media element</a>, the user agent must run the following steps:</p>
- <ol><li><p><a href=#perform-automatic-text-track-selection id=sourcing-out-of-band-text-tracks:perform-automatic-text-track-selection>Perform automatic text track selection</a> for <code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-subtitles-2><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> and <code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-captions-2><a href=#dom-texttrack-kind-captions>captions</a></code>.<li><p><a href=#perform-automatic-text-track-selection id=sourcing-out-of-band-text-tracks:perform-automatic-text-track-selection-2>Perform automatic text track selection</a> for <code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-descriptions-2><a href=#dom-texttrack-kind-descriptions>descriptions</a></code>.<li><p><a href=#perform-automatic-text-track-selection id=sourcing-out-of-band-text-tracks:perform-automatic-text-track-selection-3>Perform automatic text track selection</a> for <code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-chapters-2><a href=#dom-texttrack-kind-chapters>chapters</a></code>.<li><p>If there are any <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-8>text tracks</a> in the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-10>media
- element</a>'s <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks-4>list of text tracks</a> whose <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind-3>text track kind</a> is <code id=sourcing-out-of-band-text-tracks:dom-texttrack-kind-metadata-2><a href=#dom-texttrack-kind-metadata>metadata</a></code> that correspond to <code id=sourcing-out-of-band-text-tracks:the-track-element-7><a href=#the-track-element>track</a></code>
- elements with a <code id=sourcing-out-of-band-text-tracks:attr-track-default><a href=#attr-track-default>default</a></code> attribute set whose <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-2>text
- track mode</a> is set to <a href=#text-track-disabled id=sourcing-out-of-band-text-tracks:text-track-disabled-2>disabled</a>, then set the
- <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-3>text track mode</a> of all such tracks to <a href=#text-track-hidden id=sourcing-out-of-band-text-tracks:text-track-hidden>hidden</a><li><p>Set the element's <a href=#did-perform-automatic-track-selection id=sourcing-out-of-band-text-tracks:did-perform-automatic-track-selection-2>did-perform-automatic-track-selection</a> flag to
- true.</ol>
- <p>When the steps above say to <dfn id=perform-automatic-text-track-selection>perform automatic text track selection</dfn> for one or more
- <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind-4>text track kinds</a>, it means to run the following steps:</p>
- <ol><li><p>Let <var>candidates</var> be a list consisting of the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-9>text tracks</a> in the <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-11>media element</a>'s <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks-5>list of text tracks</a>
- whose <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind-5>text track kind</a> is one of the kinds that were passed to the algorithm, if any,
- in the order given in the <a href=#list-of-text-tracks id=sourcing-out-of-band-text-tracks:list-of-text-tracks-6>list of text tracks</a>.<li><p>If <var>candidates</var> is empty, then abort these steps.<li><p>If any of the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-10>text tracks</a> in <var>candidates</var> have a <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-4>text track mode</a> set to <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing>showing</a>, abort these steps.<li>
- <p>If the user has expressed an interest in having a track from <var>candidates</var>
- enabled based on its <a href=#text-track-kind id=sourcing-out-of-band-text-tracks:text-track-kind-6>text track kind</a>, <a href=#text-track-language id=sourcing-out-of-band-text-tracks:text-track-language-2>text track language</a>, and
- <a href=#text-track-label id=sourcing-out-of-band-text-tracks:text-track-label-2>text track label</a>, then set its <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-5>text track mode</a> to <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-2>showing</a>.</p>
- <p class=note>For example, the user could have set a browser preference to the effect of "I
- want French captions whenever possible", or "If there is a subtitle track with 'Commentary' in
- the title, enable it", or "If there are audio description tracks available, enable one, ideally
- in Swiss German, but failing that in Standard Swiss German or Standard German".</p>
- <p>Otherwise, if there are any <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-11>text tracks</a> in <var>candidates</var> that correspond to <code id=sourcing-out-of-band-text-tracks:the-track-element-8><a href=#the-track-element>track</a></code> elements with a <code id=sourcing-out-of-band-text-tracks:attr-track-default-2><a href=#attr-track-default>default</a></code> attribute set whose <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-6>text track mode</a> is
- set to <a href=#text-track-disabled id=sourcing-out-of-band-text-tracks:text-track-disabled-3>disabled</a>, then set the <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-7>text track
- mode</a> of the first such track to <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-3>showing</a>.</p>
- </ol>
- <p>When a <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-12>text track</a> corresponding to a <code id=sourcing-out-of-band-text-tracks:the-track-element-9><a href=#the-track-element>track</a></code> element experiences any of
- the following circumstances, the user agent must <a href=#start-the-track-processing-model id=sourcing-out-of-band-text-tracks:start-the-track-processing-model>start the <code>track</code> processing
- model</a> for that <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-13>text track</a> and its <code id=sourcing-out-of-band-text-tracks:the-track-element-10><a href=#the-track-element>track</a></code> element:
- <ul><li>The <code id=sourcing-out-of-band-text-tracks:the-track-element-11><a href=#the-track-element>track</a></code> element is created.<li>The <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-14>text track</a> has its <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-8>text track mode</a> changed.<li>The <code id=sourcing-out-of-band-text-tracks:the-track-element-12><a href=#the-track-element>track</a></code> element's parent element changes and the new parent is a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-12>media
- element</a>.</ul>
- <p>When a user agent is to <dfn id=start-the-track-processing-model>start the <code>track</code> processing model</dfn> for a
- <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-15>text track</a> and its <code id=sourcing-out-of-band-text-tracks:the-track-element-13><a href=#the-track-element>track</a></code> element, it must run the following algorithm.
- This algorithm interacts closely with the <a href=#event-loop id=sourcing-out-of-band-text-tracks:event-loop>event loop</a> mechanism; in particular, it has
- a <a href=#synchronous-section id=sourcing-out-of-band-text-tracks:synchronous-section>synchronous section</a> (which is triggered as part of the <a href=#event-loop id=sourcing-out-of-band-text-tracks:event-loop-2>event loop</a>
- algorithm). The steps in that section are marked with ⌛.</p>
- <ol><li><p>If another occurrence of this algorithm is already running for this <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-16>text
- track</a> and its <code id=sourcing-out-of-band-text-tracks:the-track-element-14><a href=#the-track-element>track</a></code> element, abort these steps, letting that other algorithm
- take care of this element.<li><p>If the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-17>text track</a>'s <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-9>text track mode</a> is not set to one of <a href=#text-track-hidden id=sourcing-out-of-band-text-tracks:text-track-hidden-2>hidden</a> or <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-4>showing</a>, abort
- these steps.<li><p>If the <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-18>text track</a>'s <code id=sourcing-out-of-band-text-tracks:the-track-element-15><a href=#the-track-element>track</a></code> element does not have a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-13>media
- element</a> as a parent, abort these steps.<li><p>Run the remainder of these steps asynchronously, allowing whatever caused these steps to
- run to continue.<li><p><i>Top</i>: <a href=#await-a-stable-state id=sourcing-out-of-band-text-tracks:await-a-stable-state>Await a stable state</a>. The <a href=#synchronous-section id=sourcing-out-of-band-text-tracks:synchronous-section-2>synchronous section</a>
- consists of the following steps. (The steps in the <a href=#synchronous-section id=sourcing-out-of-band-text-tracks:synchronous-section-3>synchronous section</a> are marked
- with ⌛.)<li><p>⌛ Set the <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-2>text track readiness state</a> to <a href=#text-track-loading id=sourcing-out-of-band-text-tracks:text-track-loading>loading</a>.<li><p>⌛ Let <var>URL</var> be the <a href=#track-url id=sourcing-out-of-band-text-tracks:track-url-2>track URL</a> of the
- <code id=sourcing-out-of-band-text-tracks:the-track-element-16><a href=#the-track-element>track</a></code> element.<li><p>⌛ If the <code id=sourcing-out-of-band-text-tracks:the-track-element-17><a href=#the-track-element>track</a></code> element's parent is a <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-14>media element</a> then
- let <var>CORS mode</var> be the state of the parent <a href=#media-element id=sourcing-out-of-band-text-tracks:media-element-15>media element</a>'s <code id=sourcing-out-of-band-text-tracks:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> content attribute. Otherwise, let <var>CORS mode</var> be <a href=#attr-crossorigin-none id=sourcing-out-of-band-text-tracks:attr-crossorigin-none>No CORS</a>.<li><p>End the <a href=#synchronous-section id=sourcing-out-of-band-text-tracks:synchronous-section-4>synchronous section</a>, continuing the remaining steps
- asynchronously.<li>
- <p>If <var>URL</var> is not the empty string, perform a <a href=#potentially-cors-enabled-fetch id=sourcing-out-of-band-text-tracks:potentially-cors-enabled-fetch>potentially CORS-enabled
- fetch</a> of <var>URL</var>, with the <i>mode</i> being <var>CORS mode</var>, the <i>origin</i> being the <a href=#origin-2 id=sourcing-out-of-band-text-tracks:origin-2>origin</a> of the
- <code id=sourcing-out-of-band-text-tracks:the-track-element-18><a href=#the-track-element>track</a></code> element's <a id=sourcing-out-of-band-text-tracks:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the <i>default origin behaviour</i> set
- to <i>fail</i>.</p>
- <p>The resource obtained in this fashion, if any, contains the text track data. If any data is
- obtained, it is by definition <a href=#cors-same-origin id=sourcing-out-of-band-text-tracks:cors-same-origin>CORS-same-origin</a> (cross-origin resources that are not
- suitably CORS-enabled do not get this far).</p>
- <p>The <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task>tasks</a> <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-4>queued</a> by the
- <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch>fetching algorithm</a> on the <a href=#networking-task-source id=sourcing-out-of-band-text-tracks:networking-task-source>networking task source</a> to
- process the data as it is being fetched must determine the type of the resource. If the
- type of the resource is not a supported text track format, the load will fail, as
- described below. Otherwise, the resource's data must be passed to the appropriate parser (e.g.
- the <a href=#webvtt-parser id=sourcing-out-of-band-text-tracks:webvtt-parser>WebVTT parser</a>) as it is received, with the <a href=#text-track-list-of-cues id=sourcing-out-of-band-text-tracks:text-track-list-of-cues-2>text track list of cues</a> being used for
- that parser's output. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p class=note>The appropriate parser will synchronously (during these <a href=#networking-task-source id=sourcing-out-of-band-text-tracks:networking-task-source-2>networking task
- source</a> <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-2>tasks</a>) and incrementally (as each such task is
- run with whatever data has been received from the network) update the <a href=#text-track-list-of-cues id=sourcing-out-of-band-text-tracks:text-track-list-of-cues-3>text track list of
- cues</a>.</p>
- <p class=critical>This specification does not currently say whether or how to check the MIME
- types of text tracks, or whether or how to perform file type sniffing using the actual file
- data. Implementors differ in their intentions on this matter and it is therefore unclear what
- the right solution is. In the absence of any requirement here, the HTTP specification's strict
- requirement to follow the Content-Type header prevails ("Content-Type specifies the media type
- of the underlying data." ... "If and only if the media type is not given by a Content-Type
- field, the recipient MAY attempt to guess the media type via inspection of its content
- and/or the name extension(s) of the URI used to identify the resource.").</p>
- <p>If the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-2>fetching algorithm</a> fails for any reason (network error,
- the server returns an error code, a cross-origin check fails, etc), or if <var>URL</var> is the empty string, then <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-5>queue a task</a> to first change the
- <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-3>text track readiness state</a> to <a href=#text-track-failed-to-load id=sourcing-out-of-band-text-tracks:text-track-failed-to-load>failed to
- load</a> and then <a href=#fire-a-simple-event id=sourcing-out-of-band-text-tracks:fire-a-simple-event>fire a simple event</a> named <code id=sourcing-out-of-band-text-tracks:event-error><a href=#event-error>error</a></code> at the <code id=sourcing-out-of-band-text-tracks:the-track-element-19><a href=#the-track-element>track</a></code> element. This <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-3>task</a> must use the <a href=#dom-manipulation-task-source id=sourcing-out-of-band-text-tracks:dom-manipulation-task-source>DOM manipulation task source</a>. </p>
- <p>If the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-3>fetching algorithm</a> does not fail, but the
- type of the resource is not a supported text track format, or the file was not successfully
- processed (e.g. the format in question is an XML format and the file contained a well-formedness
- error that the XML specification requires be detected and reported to the application), then the
- <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-4>task</a> that is <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-6>queued</a> by the
- <a href=#networking-task-source id=sourcing-out-of-band-text-tracks:networking-task-source-3>networking task source</a> in which the aforementioned problem is found must change the
- <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-4>text track readiness state</a> to <a href=#text-track-failed-to-load id=sourcing-out-of-band-text-tracks:text-track-failed-to-load-2>failed to
- load</a> and <a href=#fire-a-simple-event id=sourcing-out-of-band-text-tracks:fire-a-simple-event-2>fire a simple event</a> named <code id=sourcing-out-of-band-text-tracks:event-error-2><a href=#event-error>error</a></code>
- at the <code id=sourcing-out-of-band-text-tracks:the-track-element-20><a href=#the-track-element>track</a></code> element.</p>
- <p>If the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-4>fetching algorithm</a> does not fail, and the file was
- successfully processed, then the final <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-5>task</a> that is <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-7>queued</a> by the <a href=#networking-task-source id=sourcing-out-of-band-text-tracks:networking-task-source-4>networking task source</a>, after it has
- finished parsing the data, must change the <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-5>text track readiness state</a> to <a href=#text-track-loaded id=sourcing-out-of-band-text-tracks:text-track-loaded>loaded</a>, and <a href=#fire-a-simple-event id=sourcing-out-of-band-text-tracks:fire-a-simple-event-3>fire a simple event</a> named <code id=sourcing-out-of-band-text-tracks:event-load><a href=#event-load>load</a></code> at the <code id=sourcing-out-of-band-text-tracks:the-track-element-21><a href=#the-track-element>track</a></code> element.</p>
- <p>If, while the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-5>fetching algorithm</a> is active, either:</p>
- <ul><li>the <a href=#track-url id=sourcing-out-of-band-text-tracks:track-url-3>track URL</a> changes so that it is no longer equal to <var>URL</var>, while the <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-10>text track mode</a> is set to <a href=#text-track-hidden id=sourcing-out-of-band-text-tracks:text-track-hidden-3>hidden</a> or <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-5>showing</a>; or<li>the <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-11>text track mode</a> changes to <a href=#text-track-hidden id=sourcing-out-of-band-text-tracks:text-track-hidden-4>hidden</a>
- or <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-6>showing</a>, while the <a href=#track-url id=sourcing-out-of-band-text-tracks:track-url-4>track URL</a> is not
- equal to <var>URL</var></ul>
- <p>...then the user agent must abort the <a href=#fetch id=sourcing-out-of-band-text-tracks:fetch-6>fetching algorithm</a>,
- discarding any pending <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-6>tasks</a> generated by that algorithm (and
- in particular, not adding any cues to the <a href=#text-track-list-of-cues id=sourcing-out-of-band-text-tracks:text-track-list-of-cues-4>text track list of cues</a> after the moment
- the URL changed), and then <a href=#queue-a-task id=sourcing-out-of-band-text-tracks:queue-a-task-8>queue a task</a> that first changes the <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-6>text track
- readiness state</a> to <a href=#text-track-failed-to-load id=sourcing-out-of-band-text-tracks:text-track-failed-to-load-3>failed to load</a> and
- then <a href=#fire-a-simple-event id=sourcing-out-of-band-text-tracks:fire-a-simple-event-4>fires a simple event</a> named <code id=sourcing-out-of-band-text-tracks:event-error-3><a href=#event-error>error</a></code> at the <code id=sourcing-out-of-band-text-tracks:the-track-element-22><a href=#the-track-element>track</a></code> element. This <a href=#concept-task id=sourcing-out-of-band-text-tracks:concept-task-7>task</a> must use the <a href=#dom-manipulation-task-source id=sourcing-out-of-band-text-tracks:dom-manipulation-task-source-2>DOM manipulation task source</a>. </p>
- <li><p>Wait until the <a href=#text-track-readiness-state id=sourcing-out-of-band-text-tracks:text-track-readiness-state-7>text track readiness state</a> is no longer set to <a href=#text-track-loading id=sourcing-out-of-band-text-tracks:text-track-loading-2>loading</a>.<li><p>Wait until the <a href=#track-url id=sourcing-out-of-band-text-tracks:track-url-5>track URL</a> is no longer equal to <var>URL</var>, at
- the same time as the <a href=#text-track-mode id=sourcing-out-of-band-text-tracks:text-track-mode-12>text track mode</a> is set to <a href=#text-track-hidden id=sourcing-out-of-band-text-tracks:text-track-hidden-5>hidden</a> or <a href=#text-track-showing id=sourcing-out-of-band-text-tracks:text-track-showing-7>showing</a>.<li><p>Jump to the step labeled <i>top</i>.</ol>
- <p>Whenever a <code id=sourcing-out-of-band-text-tracks:the-track-element-23><a href=#the-track-element>track</a></code> element has its <code id=sourcing-out-of-band-text-tracks:attr-track-src><a href=#attr-track-src>src</a></code> attribute
- set, changed, or removed, the user agent must synchronously empty the element's <a href=#text-track id=sourcing-out-of-band-text-tracks:text-track-19>text
- track</a>'s <a href=#text-track-list-of-cues id=sourcing-out-of-band-text-tracks:text-track-list-of-cues-5>text track list of cues</a>. (This also causes the algorithm above to stop
- adding cues from the resource being obtained using the previously given URL, if any.)</p>
-
-
- <h6 id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues>4.8.14.12.4 <dfn>Guidelines for exposing cues</dfn> in various formats as <a href=#text-track-cue id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue>text track cues</a></h6>
- <p>How a specific format's text track cues are to be interpreted for the purposes of processing by
- an HTML user agent is defined by that format. In the absence of such a specification, this section
- provides some constraints within which implementations can attempt to consistently expose such
- formats.</p>
- <p>To support the <a href=#text-track id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track>text track</a> model of HTML, each unit of timed data is converted to a
- <a href=#text-track-cue id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-2>text track cue</a>. Where the mapping of the format's features to the aspects of a
- <a href=#text-track-cue id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-3>text track cue</a> as defined in this specification are not defined, implementations must
- ensure that the mapping is consistent with the definitions of the aspects of a <a href=#text-track-cue id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-4>text track
- cue</a> as defined above, as well as with the following constraints:</p>
- <dl><dt>The <a href=#text-track-cue-identifier id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-identifier>text track cue identifier</a>
- <dd>
- <p>Should be set to the empty string if the format has no obvious analogue to a per-cue
- identifier.</p>
- <dt>The <a href=#text-track-cue-pause-on-exit-flag id=guidelines-for-exposing-cues-in-various-formats-as-text-track-cues:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a>
- <dd>
- <p>Should be set to false.</p>
- </dl>
-
- <h6 id=text-track-api>4.8.14.12.5 Text track API</h6>
- <pre class=idl>interface <dfn id=texttracklist>TextTrackList</dfn> : <a href=#eventtarget id=text-track-api:eventtarget>EventTarget</a> {
- readonly attribute unsigned long <a href=#dom-texttracklist-length id=text-track-api:dom-texttracklist-length>length</a>;
- getter <a href=#texttrack id=text-track-api:texttrack>TextTrack</a> (unsigned long index);
- <a href=#texttrack id=text-track-api:texttrack-2>TextTrack</a>? <a href=#dom-texttracklist-gettrackbyid id=text-track-api:dom-texttracklist-gettrackbyid>getTrackById</a>(DOMString id);
- attribute <a href=#eventhandler id=text-track-api:eventhandler>EventHandler</a> <a href=#handler-texttracklist-onchange id=text-track-api:handler-texttracklist-onchange>onchange</a>;
- attribute <a href=#eventhandler id=text-track-api:eventhandler-2>EventHandler</a> <a href=#handler-texttracklist-onaddtrack id=text-track-api:handler-texttracklist-onaddtrack>onaddtrack</a>;
- attribute <a href=#eventhandler id=text-track-api:eventhandler-3>EventHandler</a> <a href=#handler-texttracklist-onremovetrack id=text-track-api:handler-texttracklist-onremovetrack>onremovetrack</a>;
- };</pre>
- <dl class=domintro><dt><var>media</var> . <code id=text-track-api:dom-media-texttracks><a href=#dom-media-texttracks>textTracks</a></code> . <code>length</code><dd>
- <p>Returns the number of <a href=#text-track id=text-track-api:text-track>text tracks</a> associated with the <a href=#media-element id=text-track-api:media-element>media element</a> (e.g. from <code id=text-track-api:the-track-element><a href=#the-track-element>track</a></code> elements). This is the number of <a href=#text-track id=text-track-api:text-track-2>text tracks</a> in the <a href=#media-element id=text-track-api:media-element-2>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks>list of text tracks</a>.</p>
- <dt><var>media</var> . <code id=text-track-api:dom-media-texttracks-2><a href=#dom-media-texttracks>textTracks[</a></code> <var>n</var> <code>]</code><dd>
- <p>Returns the <code id=text-track-api:texttrack-3><a href=#texttrack>TextTrack</a></code> object representing the <var>n</var>th <a href=#text-track id=text-track-api:text-track-3>text track</a> in the <a href=#media-element id=text-track-api:media-element-3>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-2>list of text tracks</a>.</p>
- <dt><var>textTrack</var> = <var>media</var> . <code id=text-track-api:dom-media-texttracks-3><a href=#dom-media-texttracks>textTracks</a></code> . <code id=text-track-api:dom-texttracklist-gettrackbyid-2><a href=#dom-texttracklist-gettrackbyid>getTrackById</a></code>( <var>id</var> )<dd>
- <p>Returns the <code id=text-track-api:texttrack-4><a href=#texttrack>TextTrack</a></code> object with the given identifier, or null if no track has that identifier.</p>
- </dl>
-
- <p>A <code id=text-track-api:texttracklist><a href=#texttracklist>TextTrackList</a></code> object represents a dynamically updating list of <a href=#text-track id=text-track-api:text-track-4>text tracks</a> in a given order.</p>
- <p>The <dfn id=dom-media-texttracks><code>textTracks</code></dfn> attribute of <a href=#media-element id=text-track-api:media-element-4>media elements</a> must return a <code id=text-track-api:texttracklist-2><a href=#texttracklist>TextTrackList</a></code> object
- representing the <code id=text-track-api:texttrack-5><a href=#texttrack>TextTrack</a></code> objects of the <a href=#text-track id=text-track-api:text-track-5>text tracks</a>
- in the <a href=#media-element id=text-track-api:media-element-5>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-3>list of text tracks</a>, in the same order as in the
- <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-4>list of text tracks</a>. The same object must be returned each time the attribute is
- accessed. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p>The <dfn id=dom-texttracklist-length><code>length</code></dfn> attribute of a
- <code id=text-track-api:texttracklist-3><a href=#texttracklist>TextTrackList</a></code> object must return the number of <a href=#text-track id=text-track-api:text-track-6>text
- tracks</a> in the list represented by the <code id=text-track-api:texttracklist-4><a href=#texttracklist>TextTrackList</a></code> object.</p>
- <p>The <a href=#supported-property-indices id=text-track-api:supported-property-indices>supported property indices</a> of a <code id=text-track-api:texttracklist-5><a href=#texttracklist>TextTrackList</a></code> object at any
- instant are the numbers from zero to the number of <a href=#text-track id=text-track-api:text-track-7>text tracks</a> in
- the list represented by the <code id=text-track-api:texttracklist-6><a href=#texttracklist>TextTrackList</a></code> object minus one, if any. If there are no
- <a href=#text-track id=text-track-api:text-track-8>text tracks</a> in the list, there are no <a href=#supported-property-indices id=text-track-api:supported-property-indices-2>supported property
- indices</a>.</p>
- <p>To <a href=#determine-the-value-of-an-indexed-property id=text-track-api:determine-the-value-of-an-indexed-property>determine the value of an indexed property</a> of a <code id=text-track-api:texttracklist-7><a href=#texttracklist>TextTrackList</a></code>
- object for a given index <var>index</var>, the user agent must return the <var>index</var>th <a href=#text-track id=text-track-api:text-track-9>text track</a> in the list represented by the
- <code id=text-track-api:texttracklist-8><a href=#texttracklist>TextTrackList</a></code> object.</p>
- <p>The <dfn id=dom-texttracklist-gettrackbyid><code>getTrackById(<var>id</var>)</code></dfn> method must return the first <code id=text-track-api:texttrack-6><a href=#texttrack>TextTrack</a></code> in the
- <code id=text-track-api:texttracklist-9><a href=#texttracklist>TextTrackList</a></code> object whose <code id=text-track-api:dom-texttrack-id><a href=#dom-texttrack-id>id</a></code> IDL attribute
- would return a value equal to the value of the <var>id</var> argument. When no tracks
- match the given argument, the method must return null.</p>
-
- <hr>
- <pre class=idl>enum <dfn id=texttrackmode>TextTrackMode</dfn> { "<a href=#dom-texttrack-disabled id=text-track-api:dom-texttrack-disabled>disabled</a>", "<a href=#dom-texttrack-hidden id=text-track-api:dom-texttrack-hidden>hidden</a>", "<a href=#dom-texttrack-showing id=text-track-api:dom-texttrack-showing>showing</a>" };
- enum <dfn id=texttrackkind>TextTrackKind</dfn> { "<a href=#dom-texttrack-kind-subtitles id=text-track-api:dom-texttrack-kind-subtitles>subtitles</a>", "<a href=#dom-texttrack-kind-captions id=text-track-api:dom-texttrack-kind-captions>captions</a>", "<a href=#dom-texttrack-kind-descriptions id=text-track-api:dom-texttrack-kind-descriptions>descriptions</a>", "<a href=#dom-texttrack-kind-chapters id=text-track-api:dom-texttrack-kind-chapters>chapters</a>", "<a href=#dom-texttrack-kind-metadata id=text-track-api:dom-texttrack-kind-metadata>metadata</a>" };
- interface <dfn id=texttrack>TextTrack</dfn> : <a href=#eventtarget id=text-track-api:eventtarget-2>EventTarget</a> {
- readonly attribute <a href=#texttrackkind id=text-track-api:texttrackkind>TextTrackKind</a> <a href=#dom-texttrack-kind id=text-track-api:dom-texttrack-kind>kind</a>;
- readonly attribute DOMString <a href=#dom-texttrack-label id=text-track-api:dom-texttrack-label>label</a>;
- readonly attribute DOMString <a href=#dom-texttrack-language id=text-track-api:dom-texttrack-language>language</a>;
- readonly attribute DOMString <a href=#dom-texttrack-id id=text-track-api:dom-texttrack-id-2>id</a>;
- readonly attribute DOMString <a href=#dom-texttrack-inbandmetadatatrackdispatchtype id=text-track-api:dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType</a>;
- attribute <a href=#texttrackmode id=text-track-api:texttrackmode>TextTrackMode</a> <a href=#dom-texttrack-mode id=text-track-api:dom-texttrack-mode>mode</a>;
- readonly attribute <a href=#texttrackcuelist id=text-track-api:texttrackcuelist>TextTrackCueList</a>? <a href=#dom-texttrack-cues id=text-track-api:dom-texttrack-cues>cues</a>;
- readonly attribute <a href=#texttrackcuelist id=text-track-api:texttrackcuelist-2>TextTrackCueList</a>? <a href=#dom-texttrack-activecues id=text-track-api:dom-texttrack-activecues>activeCues</a>;
- void <a href=#dom-texttrack-addcue id=text-track-api:dom-texttrack-addcue>addCue</a>(<a href=#texttrackcue id=text-track-api:texttrackcue>TextTrackCue</a> cue);
- void <a href=#dom-texttrack-removecue id=text-track-api:dom-texttrack-removecue>removeCue</a>(<a href=#texttrackcue id=text-track-api:texttrackcue-2>TextTrackCue</a> cue);
- attribute <a href=#eventhandler id=text-track-api:eventhandler-4>EventHandler</a> <a href=#handler-texttrack-oncuechange id=text-track-api:handler-texttrack-oncuechange>oncuechange</a>;
- };</pre>
- <dl class=domintro><dt><var>textTrack</var> = <var>media</var> . <code id=text-track-api:dom-media-addtexttrack><a href=#dom-media-addtexttrack>addTextTrack</a></code>( <var>kind</var> [, <var>label</var> [, <var>language</var> ] ] )<dd>
- <p>Creates and returns a new <code id=text-track-api:texttrack-7><a href=#texttrack>TextTrack</a></code> object, which is also added to the
- <a href=#media-element id=text-track-api:media-element-6>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-5>list of text tracks</a>.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-kind-2><a href=#dom-texttrack-kind>kind</a></code><dd>
- <p>Returns the <a href=#text-track-kind id=text-track-api:text-track-kind>text track kind</a> string.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-label-2><a href=#dom-texttrack-label>label</a></code><dd>
- <p>Returns the <a href=#text-track-label id=text-track-api:text-track-label>text track label</a>, if there is one, or the empty string otherwise
- (indicating that a custom label probably needs to be generated from the other attributes of the
- object if the object is exposed to the user).</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-language-2><a href=#dom-texttrack-language>language</a></code><dd>
- <p>Returns the <a href=#text-track-language id=text-track-api:text-track-language>text track language</a> string.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-id-3><a href=#dom-texttrack-id>id</a></code><dd>
- <p>Returns the ID of the given track.</p>
- <p>For in-band tracks, this is the ID that can be used with a fragment identifier if the format
- supports the <cite>Media Fragments URI</cite> syntax, and that can be used with the <code id=text-track-api:dom-texttracklist-gettrackbyid-3><a href=#dom-texttracklist-gettrackbyid>getTrackById()</a></code> method. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <p>For <code id=text-track-api:texttrack-8><a href=#texttrack>TextTrack</a></code> objects corresponding to <code id=text-track-api:the-track-element-2><a href=#the-track-element>track</a></code> elements, this is the
- ID of the <code id=text-track-api:the-track-element-3><a href=#the-track-element>track</a></code> element.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-inbandmetadatatrackdispatchtype-2><a href=#dom-texttrack-inbandmetadatatrackdispatchtype>inBandMetadataTrackDispatchType</a></code><dd>
- <p>Returns the <a href=#text-track-in-band-metadata-track-dispatch-type id=text-track-api:text-track-in-band-metadata-track-dispatch-type>text track in-band metadata track dispatch type</a> string.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-mode-2><a href=#dom-texttrack-mode>mode</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#text-track-mode id=text-track-api:text-track-mode>text track mode</a>, represented by a string from the following
- list:</p>
- <dl><dt>"<code id=text-track-api:dom-texttrack-disabled-2><a href=#dom-texttrack-disabled>disabled</a></code>"<dd>
- <p>The <a href=#text-track-disabled id=text-track-api:text-track-disabled>text track disabled</a> mode.</p>
- <dt>"<code id=text-track-api:dom-texttrack-hidden-2><a href=#dom-texttrack-hidden>hidden</a></code>"<dd>
- <p>The <a href=#text-track-hidden id=text-track-api:text-track-hidden>text track hidden</a> mode.</p>
- <dt>"<code id=text-track-api:dom-texttrack-showing-2><a href=#dom-texttrack-showing>showing</a></code>"<dd>
- <p>The <a href=#text-track-showing id=text-track-api:text-track-showing>text track showing</a> mode.</p>
- </dl>
- <p>Can be set, to change the mode.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-cues-2><a href=#dom-texttrack-cues>cues</a></code><dd>
- <p>Returns the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues>text track list of cues</a>, as a <code id=text-track-api:texttrackcuelist-3><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-activecues-2><a href=#dom-texttrack-activecues>activeCues</a></code><dd>
- <p>Returns the <a href=#text-track-cue id=text-track-api:text-track-cue>text track cues</a> from the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-2>text track
- list of cues</a> that are currently active (i.e. that start before the <a href=#current-playback-position id=text-track-api:current-playback-position>current playback
- position</a> and end after it), as a <code id=text-track-api:texttrackcuelist-4><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-addcue-2><a href=#dom-texttrack-addcue>addCue</a></code>( <var>cue</var> )<dd>
- <p>Adds the given cue to <var>textTrack</var>'s <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-3>text track list of cues</a>.</p>
- <dt><var>textTrack</var> . <code id=text-track-api:dom-texttrack-removecue-2><a href=#dom-texttrack-removecue>removeCue</a></code>( <var>cue</var> )<dd>
- <p>Removes the given cue from <var>textTrack</var>'s <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-4>text track list of cues</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-media-addtexttrack><code>addTextTrack(<var>kind</var>, <var>label</var>, <var>language</var>)</code></dfn> method of <a href=#media-element id=text-track-api:media-element-7>media elements</a>, when invoked, must run the following steps:</p>
- <ol><li>
- <p>Create a new <code id=text-track-api:texttrack-9><a href=#texttrack>TextTrack</a></code> object.</p>
- <li>
- <p>Create a new <a href=#text-track id=text-track-api:text-track-10>text track</a> corresponding to the new object, and set its <a href=#text-track-kind id=text-track-api:text-track-kind-2>text
- track kind</a> to <var>kind</var>, its <a href=#text-track-label id=text-track-api:text-track-label-2>text track label</a> to <var>label</var>, its <a href=#text-track-language id=text-track-api:text-track-language-2>text track language</a> to <var>language</var>, its
- <a href=#text-track-readiness-state id=text-track-api:text-track-readiness-state>text track readiness state</a> to the <a href=#text-track-loaded id=text-track-api:text-track-loaded>text track loaded</a> state, its
- <a href=#text-track-mode id=text-track-api:text-track-mode-2>text track mode</a> to the <a href=#text-track-hidden id=text-track-api:text-track-hidden-2>text track hidden</a> mode, and its <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-5>text
- track list of cues</a> to an empty list.</p>
- <p>Initially, the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-6>text track list of cues</a> is not associated with any <a href=#rules-for-updating-the-text-track-rendering id=text-track-api:rules-for-updating-the-text-track-rendering>rules
- for updating the text track rendering</a>. When a <a href=#text-track-cue id=text-track-api:text-track-cue-2>text track cue</a> is added to it,
- the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-7>text track list of cues</a> has its rules permanently set accordingly.</p>
- <li>
- <p>Add the new <a href=#text-track id=text-track-api:text-track-11>text track</a> to the <a href=#media-element id=text-track-api:media-element-8>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-6>list of text
- tracks</a>.</p>
- <li>
- <p><a href=#queue-a-task id=text-track-api:queue-a-task>Queue a task</a> to <a href=#concept-event-fire id=text-track-api:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=text-track-api:concept-events-trusted>trusted</a> event with the name <code id=text-track-api:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>, that does not bubble and is not cancelable, and
- that uses the <code id=text-track-api:trackevent><a href=#trackevent>TrackEvent</a></code> interface, with the <code id=text-track-api:dom-trackevent-track><a href=#dom-trackevent-track>track</a></code> attribute initialised to the new <a href=#text-track id=text-track-api:text-track-12>text
- track</a>'s <code id=text-track-api:texttrack-10><a href=#texttrack>TextTrack</a></code> object, at the <a href=#media-element id=text-track-api:media-element-9>media element</a>'s <code id=text-track-api:dom-media-texttracks-4><a href=#dom-media-texttracks>textTracks</a></code> attribute's <code id=text-track-api:texttracklist-10><a href=#texttracklist>TextTrackList</a></code>
- object.</p>
- <li>
- <p>Return the new <code id=text-track-api:texttrack-11><a href=#texttrack>TextTrack</a></code> object.</p>
- </ol>
- <hr>
- <p>The <dfn id=dom-texttrack-kind><code>kind</code></dfn> attribute must return the
- <a href=#text-track-kind id=text-track-api:text-track-kind-3>text track kind</a> of the <a href=#text-track id=text-track-api:text-track-13>text track</a> that the <code id=text-track-api:texttrack-12><a href=#texttrack>TextTrack</a></code> object
- represents.</p>
- <p>The <dfn id=dom-texttrack-label><code>label</code></dfn> attribute must return the
- <a href=#text-track-label id=text-track-api:text-track-label-3>text track label</a> of the <a href=#text-track id=text-track-api:text-track-14>text track</a> that the <code id=text-track-api:texttrack-13><a href=#texttrack>TextTrack</a></code>
- object represents.</p>
- <p>The <dfn id=dom-texttrack-language><code>language</code></dfn> attribute must return the
- <a href=#text-track-language id=text-track-api:text-track-language-3>text track language</a> of the <a href=#text-track id=text-track-api:text-track-15>text track</a> that the <code id=text-track-api:texttrack-14><a href=#texttrack>TextTrack</a></code>
- object represents.</p>
- <p>The <dfn id=dom-texttrack-id><code>id</code></dfn> attribute returns the track's
- identifier, if it has one, or the empty string otherwise. For tracks that correspond to
- <code id=text-track-api:the-track-element-4><a href=#the-track-element>track</a></code> elements, the track's identifier is the value of the element's <code id=text-track-api:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute, if any. For in-band tracks, the track's identifier is
- specified by the <a href=#media-resource id=text-track-api:media-resource>media resource</a>. If the <a href=#media-resource id=text-track-api:media-resource-2>media resource</a> is in a format
- that supports the <cite>Media Fragments URI</cite> fragment identifier syntax, the identifier
- returned for a particular track must be the same identifier that would enable the track if used as
- the name of a track in the track dimension of such a fragment identifier. <a href=#refsMEDIAFRAG>[MEDIAFRAG]</a></p>
- <p>The <dfn id=dom-texttrack-inbandmetadatatrackdispatchtype><code>inBandMetadataTrackDispatchType</code></dfn>
- attribute must return the <a href=#text-track-in-band-metadata-track-dispatch-type id=text-track-api:text-track-in-band-metadata-track-dispatch-type-2>text track in-band metadata track dispatch type</a> of the
- <a href=#text-track id=text-track-api:text-track-16>text track</a> that the <code id=text-track-api:texttrack-15><a href=#texttrack>TextTrack</a></code> object represents.</p>
- <p>The <dfn id=dom-texttrack-mode><code>mode</code></dfn> attribute, on getting, must return
- the string corresponding to the <a href=#text-track-mode id=text-track-api:text-track-mode-3>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-17>text track</a> that
- the <code id=text-track-api:texttrack-16><a href=#texttrack>TextTrack</a></code> object represents, as defined by the following list:</p>
- <dl><dt>"<dfn id=dom-texttrack-disabled><code>disabled</code></dfn>"<dd>The <a href=#text-track-disabled id=text-track-api:text-track-disabled-2>text track disabled</a> mode.<dt>"<dfn id=dom-texttrack-hidden><code>hidden</code></dfn>"<dd>The <a href=#text-track-hidden id=text-track-api:text-track-hidden-3>text track hidden</a> mode.<dt>"<dfn id=dom-texttrack-showing><code>showing</code></dfn>"<dd>The <a href=#text-track-showing id=text-track-api:text-track-showing-2>text track showing</a> mode.</dl>
- <p>On setting, if the new value isn't equal to what the attribute would currently return, the new
- value must be processed as follows:</p>
- <dl class=switch><dt>If the new value is "<code id=text-track-api:dom-texttrack-disabled-3><a href=#dom-texttrack-disabled>disabled</a></code>"<dd>
- <p>Set the <a href=#text-track-mode id=text-track-api:text-track-mode-4>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-18>text track</a> that the
- <code id=text-track-api:texttrack-17><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-disabled id=text-track-api:text-track-disabled-3>text track disabled</a> mode.</p>
- <dt>If the new value is "<code id=text-track-api:dom-texttrack-hidden-3><a href=#dom-texttrack-hidden>hidden</a></code>"<dd>
- <p>Set the <a href=#text-track-mode id=text-track-api:text-track-mode-5>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-19>text track</a> that the
- <code id=text-track-api:texttrack-18><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-hidden id=text-track-api:text-track-hidden-4>text track hidden</a> mode.</p>
- <dt>If the new value is "<code id=text-track-api:dom-texttrack-showing-3><a href=#dom-texttrack-showing>showing</a></code>"<dd>
- <p>Set the <a href=#text-track-mode id=text-track-api:text-track-mode-6>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-20>text track</a> that the
- <code id=text-track-api:texttrack-19><a href=#texttrack>TextTrack</a></code> object represents to the <a href=#text-track-showing id=text-track-api:text-track-showing-3>text track showing</a> mode.</p>
- </dl>
- <p>If the <a href=#text-track-mode id=text-track-api:text-track-mode-7>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-21>text track</a> that the
- <code id=text-track-api:texttrack-20><a href=#texttrack>TextTrack</a></code> object represents is not the <a href=#text-track-disabled id=text-track-api:text-track-disabled-4>text track disabled</a> mode, then
- the <dfn id=dom-texttrack-cues><code>cues</code></dfn> attribute must return a
- <a href=#live id=text-track-api:live>live</a> <code id=text-track-api:texttrackcuelist-5><a href=#texttrackcuelist>TextTrackCueList</a></code> object that represents the subset of the
- <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-8>text track list of cues</a> of the <a href=#text-track id=text-track-api:text-track-22>text track</a> that the
- <code id=text-track-api:texttrack-21><a href=#texttrack>TextTrack</a></code> object represents whose <a href=#text-track-cue-end-time id=text-track-api:text-track-cue-end-time>end
- times</a> occur at or after the <a href=#earliest-possible-position-when-the-script-started id=text-track-api:earliest-possible-position-when-the-script-started>earliest possible position when the script
- started</a>, in <a href=#text-track-cue-order id=text-track-api:text-track-cue-order>text track cue order</a>. Otherwise, it must return null. When an
- object is returned, the same object must be returned each time.</p>
- <p>The <dfn id=earliest-possible-position-when-the-script-started>earliest possible position when the script started</dfn> is whatever the
- <a href=#earliest-possible-position id=text-track-api:earliest-possible-position>earliest possible position</a> was the last time the <a href=#event-loop id=text-track-api:event-loop>event loop</a> reached step
- 1.</p>
- <p>If the <a href=#text-track-mode id=text-track-api:text-track-mode-8>text track mode</a> of the <a href=#text-track id=text-track-api:text-track-23>text track</a> that the
- <code id=text-track-api:texttrack-22><a href=#texttrack>TextTrack</a></code> object represents is not the <a href=#text-track-disabled id=text-track-api:text-track-disabled-5>text track disabled</a> mode, then
- the <dfn id=dom-texttrack-activecues><code>activeCues</code></dfn> attribute must return a
- <a href=#live id=text-track-api:live-2>live</a> <code id=text-track-api:texttrackcuelist-6><a href=#texttrackcuelist>TextTrackCueList</a></code> object that represents the subset of the
- <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-9>text track list of cues</a> of the <a href=#text-track id=text-track-api:text-track-24>text track</a> that the
- <code id=text-track-api:texttrack-23><a href=#texttrack>TextTrack</a></code> object represents whose <a href=#active-flag-was-set-when-the-script-started id=text-track-api:active-flag-was-set-when-the-script-started>active flag was set when the script
- started</a>, in <a href=#text-track-cue-order id=text-track-api:text-track-cue-order-2>text track cue order</a>. Otherwise, it must return null. When an
- object is returned, the same object must be returned each time.</p>
- <p>A <a href=#text-track-cue id=text-track-api:text-track-cue-3>text track cue</a>'s <dfn id=active-flag-was-set-when-the-script-started>active flag was set when the script started</dfn> if its
- <a href=#text-track-cue-active-flag id=text-track-api:text-track-cue-active-flag>text track cue active flag</a> was set the last time the <a href=#event-loop id=text-track-api:event-loop-2>event loop</a> reached
- step 1.</p>
- <hr>
- <p>The <dfn id=dom-texttrack-addcue><code>addCue(<var>cue</var>)</code></dfn> method
- of <code id=text-track-api:texttrack-24><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the following steps:</p>
- <ol><li><p>If the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-10>text track list of cues</a> does not yet have any associated <a href=#rules-for-updating-the-text-track-rendering id=text-track-api:rules-for-updating-the-text-track-rendering-2>rules
- for updating the text track rendering</a>, then associate the <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-11>text track list of
- cues</a> with the <a href=#rules-for-updating-the-text-track-rendering id=text-track-api:rules-for-updating-the-text-track-rendering-3>rules for updating the text track rendering</a> appropriate to <var>cue</var>.</p>
- <li><p>If <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-12>text track list of cues</a>' associated <a href=#rules-for-updating-the-text-track-rendering id=text-track-api:rules-for-updating-the-text-track-rendering-4>rules for updating the text
- track rendering</a> are not the same <a href=#rules-for-updating-the-text-track-rendering id=text-track-api:rules-for-updating-the-text-track-rendering-5>rules for updating the text track rendering</a>
- as appropriate for <var>cue</var>, then throw an <code id=text-track-api:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.</p>
- <li><p>If the given <var>cue</var> is in a <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-13>text track list of cues</a>, then
- remove <var>cue</var> from that <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-14>text track list of cues</a>.<li><p>Add <var>cue</var> to the method's <code id=text-track-api:texttrack-25><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track id=text-track-api:text-track-25>text
- track</a>'s <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-15>text track list of cues</a>.</ol>
- <p>The <dfn id=dom-texttrack-removecue><code>removeCue(<var>cue</var>)</code></dfn>
- method of <code id=text-track-api:texttrack-26><a href=#texttrack>TextTrack</a></code> objects, when invoked, must run the following steps:</p>
- <ol><li><p>If the given <var>cue</var> is not currently listed in the method's
- <code id=text-track-api:texttrack-27><a href=#texttrack>TextTrack</a></code> object's <a href=#text-track id=text-track-api:text-track-26>text track</a>'s <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-16>text track list of cues</a>,
- then throw a <code id=text-track-api:notfounderror><a href=#notfounderror>NotFoundError</a></code> exception and abort these steps.<li><p>Remove <var>cue</var> from the method's <code id=text-track-api:texttrack-28><a href=#texttrack>TextTrack</a></code> object's
- <a href=#text-track id=text-track-api:text-track-27>text track</a>'s <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-17>text track list of cues</a>.</ol>
-
- <div class=example>
- <p>In this example, an <code id=text-track-api:the-audio-element><a href=#the-audio-element>audio</a></code> element is used to play a specific sound-effect from a
- sound file containing many sound effects. A cue is used to pause the audio, so that it ends
- exactly at the end of the clip, even if the browser is busy running some script. If the page had
- relied on script to pause the audio, then the start of the next clip might be heard if the
- browser was not able to run the script at the exact time specified.</p>
- <pre>var sfx = new Audio('sfx.wav');
- var sounds = sfx.addTextTrack('metadata');
- // add sounds we care about
- function addFX(start, end, name) {
- var cue = new VTTCue(start, end, '');
- cue.id = name;
- cue.pauseOnExit = true;
- sounds.addCue(cue);
- }
- addFX(12.783, 13.612, 'dog bark');
- addFX(13.612, 15.091, 'kitten mew'))
- function playSound(id) {
- sfx.currentTime = sounds.getCueById(id).startTime;
- sfx.play();
- }
- // play a bark as soon as we can
- sfx.oncanplaythrough = function () {
- playSound('dog bark');
- }
- // meow when the user tries to leave
- window.onbeforeunload = function () {
- playSound('kitten mew');
- return 'Are you sure you want to leave this awesome page?';
- }</pre>
- </div>
- <hr>
- <pre class=idl>interface <dfn id=texttrackcuelist>TextTrackCueList</dfn> {
- readonly attribute unsigned long <a href=#dom-texttrackcuelist-length id=text-track-api:dom-texttrackcuelist-length>length</a>;
- getter <a href=#texttrackcue id=text-track-api:texttrackcue-3>TextTrackCue</a> (unsigned long index);
- <a href=#texttrackcue id=text-track-api:texttrackcue-4>TextTrackCue</a>? <a href=#dom-texttrackcuelist-getcuebyid id=text-track-api:dom-texttrackcuelist-getcuebyid>getCueById</a>(DOMString id);
- };</pre>
- <dl class=domintro><dt><var>cuelist</var> . <code id=text-track-api:dom-texttrackcuelist-length-2><a href=#dom-texttrackcuelist-length>length</a></code><dd>
- <p>Returns the number of <a href=#text-track-cue id=text-track-api:text-track-cue-4>cues</a> in the list.</p>
- <dt><var>cuelist</var>[<var>index</var>]<dd>
- <p>Returns the <a href=#text-track-cue id=text-track-api:text-track-cue-5>text track cue</a> with index <var>index</var> in the list. The cues are sorted in <a href=#text-track-cue-order id=text-track-api:text-track-cue-order-3>text track cue order</a>.</p>
- <dt><var>cuelist</var> . <code id=text-track-api:dom-texttrackcuelist-getcuebyid-2><a href=#dom-texttrackcuelist-getcuebyid>getCueById</a></code>( <var>id</var> )<dd>
- <p>Returns the first <a href=#text-track-cue id=text-track-api:text-track-cue-6>text track cue</a> (in <a href=#text-track-cue-order id=text-track-api:text-track-cue-order-4>text track cue order</a>) with <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier>text track cue identifier</a> <var>id</var>.</p>
- <p>Returns null if none of the cues have the given identifier or if the argument is the empty string.</p>
- </dl>
-
- <p>A <code id=text-track-api:texttrackcuelist-7><a href=#texttrackcuelist>TextTrackCueList</a></code> object represents a dynamically updating list of <a href=#text-track-cue id=text-track-api:text-track-cue-7>text track cues</a> in a given order.</p>
- <p>The <dfn id=dom-texttrackcuelist-length><code>length</code></dfn> attribute must return
- the number of <a href=#text-track-cue id=text-track-api:text-track-cue-8>cues</a> in the list represented by the
- <code id=text-track-api:texttrackcuelist-8><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
- <p>The <a href=#supported-property-indices id=text-track-api:supported-property-indices-3>supported property indices</a> of a <code id=text-track-api:texttrackcuelist-9><a href=#texttrackcuelist>TextTrackCueList</a></code> object at any
- instant are the numbers from zero to the number of <a href=#text-track-cue id=text-track-api:text-track-cue-9>cues</a> in the
- list represented by the <code id=text-track-api:texttrackcuelist-10><a href=#texttrackcuelist>TextTrackCueList</a></code> object minus one, if any. If there are no
- <a href=#text-track-cue id=text-track-api:text-track-cue-10>cues</a> in the list, there are no <a href=#supported-property-indices id=text-track-api:supported-property-indices-4>supported property
- indices</a>.</p>
- <p>To <a href=#determine-the-value-of-an-indexed-property id=text-track-api:determine-the-value-of-an-indexed-property-2>determine the value of an indexed property</a> for a given index <var>index</var>, the user agent must return the <var>index</var>th <a href=#text-track-cue id=text-track-api:text-track-cue-11>text track
- cue</a> in the list represented by the <code id=text-track-api:texttrackcuelist-11><a href=#texttrackcuelist>TextTrackCueList</a></code> object.</p>
- <p>The <dfn id=dom-texttrackcuelist-getcuebyid><code>getCueById(<var>id</var>)</code></dfn> method, when called with an argument other than the empty string,
- must return the first <a href=#text-track-cue id=text-track-api:text-track-cue-12>text track cue</a> in the list represented by the
- <code id=text-track-api:texttrackcuelist-12><a href=#texttrackcuelist>TextTrackCueList</a></code> object whose <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier-2>text track cue identifier</a> is <var>id</var>, if any, or null otherwise. If the argument is the empty string, then the method
- must return null.</p>
-
- <hr>
- <pre class=idl>interface <dfn id=texttrackcue>TextTrackCue</dfn> : <a href=#eventtarget id=text-track-api:eventtarget-3>EventTarget</a> {
- readonly attribute <a href=#texttrack id=text-track-api:texttrack-29>TextTrack</a>? <a href=#dom-texttrackcue-track id=text-track-api:dom-texttrackcue-track>track</a>;
- attribute DOMString <a href=#dom-texttrackcue-id id=text-track-api:dom-texttrackcue-id>id</a>;
- attribute double <a href=#dom-texttrackcue-starttime id=text-track-api:dom-texttrackcue-starttime>startTime</a>;
- attribute double <a href=#dom-texttrackcue-endtime id=text-track-api:dom-texttrackcue-endtime>endTime</a>;
- attribute boolean <a href=#dom-texttrackcue-pauseonexit id=text-track-api:dom-texttrackcue-pauseonexit>pauseOnExit</a>;
- attribute <a href=#eventhandler id=text-track-api:eventhandler-5>EventHandler</a> <a href=#handler-texttrackcue-onenter id=text-track-api:handler-texttrackcue-onenter>onenter</a>;
- attribute <a href=#eventhandler id=text-track-api:eventhandler-6>EventHandler</a> <a href=#handler-texttrackcue-onexit id=text-track-api:handler-texttrackcue-onexit>onexit</a>;
- };</pre>
- <dl class=domintro><dt><var>cue</var> . <a href=#dom-texttrackcue-track id=text-track-api:dom-texttrackcue-track-2>track</a><dd>
- <p>Returns the <code id=text-track-api:texttrack-30><a href=#texttrack>TextTrack</a></code> object to which this
- <a href=#text-track-cue id=text-track-api:text-track-cue-13>text track cue</a> belongs, if any, or null
- otherwise.</p>
- <dt><var>cue</var> . <a href=#dom-texttrackcue-id id=text-track-api:dom-texttrackcue-id-2>id</a> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier-3>text track cue identifier</a>.</p>
- <p>Can be set.</p>
- <dt><var>cue</var> . <a href=#dom-texttrackcue-starttime id=text-track-api:dom-texttrackcue-starttime-2>startTime</a> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#text-track-cue-start-time id=text-track-api:text-track-cue-start-time>text track cue start time</a>, in seconds.</p>
- <p>Can be set.</p>
- <dt><var>cue</var> . <a href=#dom-texttrackcue-endtime id=text-track-api:dom-texttrackcue-endtime-2>endTime</a> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#text-track-cue-end-time id=text-track-api:text-track-cue-end-time-2>text track cue end time</a>, in seconds.</p>
- <p>Can be set.</p>
- <dt><var>cue</var> . <a href=#dom-texttrackcue-pauseonexit id=text-track-api:dom-texttrackcue-pauseonexit-2>pauseOnExit</a> [ = <var>value</var> ]<dd>
- <p>Returns true if the <a href=#text-track-cue-pause-on-exit-flag id=text-track-api:text-track-cue-pause-on-exit-flag>text track cue pause-on-exit flag</a> is set, false otherwise.</p>
- <p>Can be set.</p>
- </dl>
-
- <p>The <dfn id=dom-texttrackcue-track><code>track</code></dfn> attribute, on getting, must
- return the <code id=text-track-api:texttrack-31><a href=#texttrack>TextTrack</a></code> object of the <a href=#text-track id=text-track-api:text-track-28>text track</a> in whose <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-18>list of cues</a> the <a href=#text-track-cue id=text-track-api:text-track-cue-14>text track cue</a> that the
- <code id=text-track-api:texttrackcue-5><a href=#texttrackcue>TextTrackCue</a></code> object represents finds itself, if any; or null otherwise.</p>
- <p>The <dfn id=dom-texttrackcue-id><code>id</code></dfn> attribute, on getting, must return
- the <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier-4>text track cue identifier</a> of the <a href=#text-track-cue id=text-track-api:text-track-cue-15>text track cue</a> that the
- <code id=text-track-api:texttrackcue-6><a href=#texttrackcue>TextTrackCue</a></code> object represents. On setting, the <a href=#text-track-cue-identifier id=text-track-api:text-track-cue-identifier-5>text track cue
- identifier</a> must be set to the new value.</p>
- <p>The <dfn id=dom-texttrackcue-starttime><code>startTime</code></dfn> attribute, on
- getting, must return the <a href=#text-track-cue-start-time id=text-track-api:text-track-cue-start-time-2>text track cue start time</a> of the <a href=#text-track-cue id=text-track-api:text-track-cue-16>text track cue</a>
- that the <code id=text-track-api:texttrackcue-7><a href=#texttrackcue>TextTrackCue</a></code> object represents, in seconds. On setting, the <a href=#text-track-cue-start-time id=text-track-api:text-track-cue-start-time-3>text track
- cue start time</a> must be set to the new value, interpreted in seconds; then, if the
- <code id=text-track-api:texttrackcue-8><a href=#texttrackcue>TextTrackCue</a></code> object's <a href=#text-track-cue id=text-track-api:text-track-cue-17>text track cue</a> is in a <a href=#text-track id=text-track-api:text-track-29>text track</a>'s
- <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-19>list of cues</a>, and that <a href=#text-track id=text-track-api:text-track-30>text track</a> is in
- a <a href=#media-element id=text-track-api:media-element-10>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-7>list of text tracks</a>, and the <a href=#media-element id=text-track-api:media-element-11>media
- element</a>'s <a href=#show-poster-flag id=text-track-api:show-poster-flag>show poster flag</a> is not set, then run the <i id=text-track-api:time-marches-on><a href=#time-marches-on>time marches on</a></i> steps for that <a href=#media-element id=text-track-api:media-element-12>media element</a>.</p>
- <p>The <dfn id=dom-texttrackcue-endtime><code>endTime</code></dfn> attribute, on getting,
- must return the <a href=#text-track-cue-end-time id=text-track-api:text-track-cue-end-time-3>text track cue end time</a> of the <a href=#text-track-cue id=text-track-api:text-track-cue-18>text track cue</a> that the
- <code id=text-track-api:texttrackcue-9><a href=#texttrackcue>TextTrackCue</a></code> object represents, in seconds. On setting, the <a href=#text-track-cue-end-time id=text-track-api:text-track-cue-end-time-4>text track cue end
- time</a> must be set to the new value, interpreted in seconds; then, if the
- <code id=text-track-api:texttrackcue-10><a href=#texttrackcue>TextTrackCue</a></code> object's <a href=#text-track-cue id=text-track-api:text-track-cue-19>text track cue</a> is in a <a href=#text-track id=text-track-api:text-track-31>text track</a>'s
- <a href=#text-track-list-of-cues id=text-track-api:text-track-list-of-cues-20>list of cues</a>, and that <a href=#text-track id=text-track-api:text-track-32>text track</a> is in
- a <a href=#media-element id=text-track-api:media-element-13>media element</a>'s <a href=#list-of-text-tracks id=text-track-api:list-of-text-tracks-8>list of text tracks</a>, and the <a href=#media-element id=text-track-api:media-element-14>media
- element</a>'s <a href=#show-poster-flag id=text-track-api:show-poster-flag-2>show poster flag</a> is not set, then run the <i id=text-track-api:time-marches-on-2><a href=#time-marches-on>time marches on</a></i> steps for that <a href=#media-element id=text-track-api:media-element-15>media element</a>.</p>
- <p>The <dfn id=dom-texttrackcue-pauseonexit><code>pauseOnExit</code></dfn> attribute, on
- getting, must return true if the <a href=#text-track-cue-pause-on-exit-flag id=text-track-api:text-track-cue-pause-on-exit-flag-2>text track cue pause-on-exit flag</a> of the <a href=#text-track-cue id=text-track-api:text-track-cue-20>text
- track cue</a> that the <code id=text-track-api:texttrackcue-11><a href=#texttrackcue>TextTrackCue</a></code> object represents is set; or false otherwise.
- On setting, the <a href=#text-track-cue-pause-on-exit-flag id=text-track-api:text-track-cue-pause-on-exit-flag-3>text track cue pause-on-exit flag</a> must be set if the new value is
- true, and must be unset otherwise.</p>
-
- <h6 id=text-tracks-describing-chapters>4.8.14.12.6 Text tracks describing chapters</h6>
- <p>Chapters are segments of a <a href=#media-resource id=text-tracks-describing-chapters:media-resource>media resource</a> with a given title. Chapters can be
- nested, in the same way that sections in a document outline can have subsections.</p>
- <p>Each <a href=#text-track-cue id=text-tracks-describing-chapters:text-track-cue>text track cue</a> in a <a href=#text-track id=text-tracks-describing-chapters:text-track>text track</a> being used for describing
- chapters has three key features: the <a href=#text-track-cue-start-time id=text-tracks-describing-chapters:text-track-cue-start-time>text track cue start time</a>, giving the start time
- of the chapter, the <a href=#text-track-cue-end-time id=text-tracks-describing-chapters:text-track-cue-end-time>text track cue end time</a>, giving the end time of the chapter, and
- the <a href=#text-track-cue-data id=text-tracks-describing-chapters:text-track-cue-data>text track cue data</a> giving the chapter title.</p>
-
- <p>The <dfn id=rules-for-constructing-the-chapter-tree-from-a-text-track>rules for constructing the chapter tree from a text track</dfn> are as follows. They
- produce a potentially nested list of chapters, each of which have a start time, end time, title,
- and a list of nested chapters. This algorithm discards cues that do not correctly nest within each
- other, or that are out of order.</p>
- <ol><li><p>Let <var>list</var> be a copy of the <a href=#text-track-list-of-cues id=text-tracks-describing-chapters:text-track-list-of-cues>list
- of cues</a> of the <a href=#text-track id=text-tracks-describing-chapters:text-track-2>text track</a> being processed.<li><p>Remove from <var>list</var> any <a href=#text-track-cue id=text-tracks-describing-chapters:text-track-cue-2>text track cue</a> whose <a href=#text-track-cue-end-time id=text-tracks-describing-chapters:text-track-cue-end-time-2>text
- track cue end time</a> is before its <a href=#text-track-cue-start-time id=text-tracks-describing-chapters:text-track-cue-start-time-2>text track cue start time</a>.<li><p>Let <var>output</var> be an empty list of chapters, where a chapter is a record
- consisting of a start time, an end time, a title, and a (potentially empty) list of nested
- chapters. For the purpose of this algorithm, each chapter also has a parent chapter.<li><p>Let <var>current chapter</var> be a stand-in chapter whose start time is negative
- infinity, whose end time is positive infinity, and whose list of nested chapters is <var>output</var>. (This is just used to make the algorithm easier to describe.)<li><p><i>Loop</i>: If <var>list</var> is empty, jump to the step labeled
- <i>end</i>.<li><p>Let <var>current cue</var> be the first cue in <var>list</var>, and then
- remove it from <var>list</var>.<li><p>If <var>current cue</var>'s <a href=#text-track-cue-start-time id=text-tracks-describing-chapters:text-track-cue-start-time-3>text track cue start time</a> is less than
- the start time of <var>current chapter</var>, then return to the step labeled
- <i>loop</i>.</p>
- <li><p>While <var>current cue</var>'s <a href=#text-track-cue-start-time id=text-tracks-describing-chapters:text-track-cue-start-time-4>text track cue start time</a> is greater
- than or equal to <var>current chapter</var>'s end time, let <var>current
- chapter</var> be <var>current chapter</var>'s parent chapter.<li><p>If <var>current cue</var>'s <a href=#text-track-cue-end-time id=text-tracks-describing-chapters:text-track-cue-end-time-3>text track cue end time</a> is greater than
- the end time of <var>current chapter</var>, then return to the step labeled
- <i>loop</i>.</p>
- <li>
- <p>Create a new chapter <var>new chapter</var>, whose start time is <var>current cue</var>'s <a href=#text-track-cue-start-time id=text-tracks-describing-chapters:text-track-cue-start-time-5>text track cue start time</a>, whose end time is <var>current cue</var>'s <a href=#text-track-cue-end-time id=text-tracks-describing-chapters:text-track-cue-end-time-4>text track cue end time</a>, whose title is <var>current cue</var>'s <a href=#text-track-cue-data id=text-tracks-describing-chapters:text-track-cue-data-2>text track cue data</a> interpreted according to its
- <a href=#rules-for-rendering-the-cue-in-isolation id=text-tracks-describing-chapters:rules-for-rendering-the-cue-in-isolation>rules for rendering the cue in isolation</a>, and whose list of nested chapters is
- empty.</p>
- <p class=note>For WebVTT, the <a href=#rules-for-rendering-the-cue-in-isolation id=text-tracks-describing-chapters:rules-for-rendering-the-cue-in-isolation-2>rules for rendering the cue in isolation</a> are the
- <a href=#rules-for-interpreting-webvtt-cue-text id=text-tracks-describing-chapters:rules-for-interpreting-webvtt-cue-text>rules for interpreting WebVTT cue text</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <li><p>Append <var>new chapter</var> to <var>current chapter</var>'s list of
- nested chapters, and let <var>current chapter</var> be <var>new chapter</var>'s
- parent.<li><p>Let <var>current chapter</var> be <var>new chapter</var>.<li><p>Return to the step labeled <i>loop</i>.<li><p><i>End</i>: Return <var>output</var>.</ol>
-
- <div class=example>
- <p>The following snippet of a <a href=#webvtt-file id=text-tracks-describing-chapters:webvtt-file>WebVTT file</a> shows how nested chapters can be marked
- up. The file describes three 50-minute chapters, "Astrophysics", "Computational Physics", and
- "General Relativity". The first has three subchapters, the second has four, and the third has
- two. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <pre>WEBVTT
- 00:00:00.000 --> 00:50:00.000
- Astrophysics
- 00:00:00.000 --> 00:10:00.000
- Introduction to Astrophysics
- 00:10:00.000 --> 00:45:00.000
- The Solar System
- 00:00:00.000 --> 00:10:00.000
- Coursework Description
- 00:50:00.000 --> 01:40:00.000
- Computational Physics
- 00:50:00.000 --> 00:55:00.000
- Introduction to Programming
- 00:55:00.000 --> 01:30:00.000
- Data Structures
- 01:30:00.000 --> 01:35:00.000
- Answers to Last Exam
- 01:35:00.000 --> 01:40:00.000
- Coursework Description
- 01:40:00.000 --> 02:30:00.000
- General Relativity
- 01:40:00.000 --> 02:00:00.000
- Tensor Algebra
- 02:00:00.000 --> 02:30:00.000
- The General Relativistic Field Equations</pre>
- </div>
-
- <h6 id=cue-events>4.8.14.12.7 Event handlers for objects of the text track APIs</h6>
- <p>The following are the <a href=#event-handlers id=cue-events:event-handlers>event handlers</a> that (and their corresponding <a href=#event-handler-event-type id=cue-events:event-handler-event-type>event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes id=cue-events:event-handler-idl-attributes>event handler IDL
- attributes</a>, by all objects implementing the <code id=cue-events:texttracklist><a href=#texttracklist>TextTrackList</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=cue-events:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=cue-events:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-texttracklist-onchange><code>onchange</code></dfn> <td> <code id=cue-events:event-media-change><a href=#event-media-change>change</a></code>
- <tr><td><dfn id=handler-texttracklist-onaddtrack><code>onaddtrack</code></dfn> <td> <code id=cue-events:event-media-addtrack><a href=#event-media-addtrack>addtrack</a></code>
- <tr><td><dfn id=handler-texttracklist-onremovetrack><code>onremovetrack</code></dfn> <td> <code id=cue-events:event-media-removetrack><a href=#event-media-removetrack>removetrack</a></code>
- </table>
- <p>The following are the <a href=#event-handlers id=cue-events:event-handlers-3>event handlers</a> that (and their corresponding <a href=#event-handler-event-type id=cue-events:event-handler-event-type-3>event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes id=cue-events:event-handler-idl-attributes-2>event handler IDL
- attributes</a>, by all objects implementing the <code id=cue-events:texttrack><a href=#texttrack>TextTrack</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=cue-events:event-handlers-4>Event handler</a> <th><a href=#event-handler-event-type id=cue-events:event-handler-event-type-4>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-texttrack-oncuechange><code>oncuechange</code></dfn> <td> <code id=cue-events:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code>
- </table>
- <p>The following are the <a href=#event-handlers id=cue-events:event-handlers-5>event handlers</a> that (and their corresponding <a href=#event-handler-event-type id=cue-events:event-handler-event-type-5>event handler event types</a>) must be supported, as <a href=#event-handler-idl-attributes id=cue-events:event-handler-idl-attributes-3>event handler IDL
- attributes</a>, by all objects implementing the <code id=cue-events:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=cue-events:event-handlers-6>Event handler</a> <th><a href=#event-handler-event-type id=cue-events:event-handler-event-type-6>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-texttrackcue-onenter><code>onenter</code></dfn> <td> <code id=cue-events:event-media-enter><a href=#event-media-enter>enter</a></code>
- <tr><td><dfn id=handler-texttrackcue-onexit><code>onexit</code></dfn> <td> <code id=cue-events:event-media-exit><a href=#event-media-exit>exit</a></code>
- </table>
-
- <h6 id=best-practices-for-metadata-text-tracks>4.8.14.12.8 Best practices for metadata text tracks</h6>
- <p><i>This section is non-normative.</i></p>
- <p>Text tracks can be used for storing data relating to the media data, for interactive or
- augmented views.</p>
- <p>For example, a page showing a sports broadcast could include information about the current
- score. Suppose a robotics competition was being streamed live. The image could be overlayed with
- the scores, as follows:</p>
- <p><iframe src="data:text/html;charset=utf-8,<!DOCTYPE%20html>%0A<style>%0A%20body%2C%20html%20%7B%20margin%3A%200%3B%20padding%3A%200%3B%20overflow%3A%20hidden%3B%20%7D%0A%20div%20%7B%20width%3A%20600px%3B%20height%3A%20400px%3B%20position%3A%20relative%3B%20%7D%0A%20p%20%7B%20position%3A%20absolute%3B%20top%3A%200%3B%20margin%3A%200.25em%3B%20font%3A%20small-caps%20900%202em%20sans-serif%3B%20text-shadow%3A%20white%200%200%204px%3B%20%7D%0A%20span%20%7B%20display%3A%20block%3B%20%7D%0A%20.left%20%7B%20color%3A%20red%3B%20left%3A%200%3B%20text-align%3A%20left%3B%20%7D%0A%20.right%20%7B%20color%3A%20blue%3B%20right%3A%200%3B%20text-align%3A%20right%3B%20%7D%0A%20.middle%20%7B%20color%3A%20white%3B%20top%3A%20auto%3B%20bottom%3A%200%3B%20left%3A%200%3B%20right%3A%200%3B%20text-align%3A%20center%3B%20text-shadow%3A%20black%200%200%204px%3B%20%7D%0A%20.middle%20span%20%7B%20display%3A%20inline-block%3B%20margin%3A%200%201em%3B%20font-size%3A%200.75em%3B%20text-transform%3A%20uppercase%3B%20%7D%0A<%2Fstyle>%0A<div>%0A%20<img%20src%3D"http%3A%2F%2Fwww.whatwg.org%2Fspecs%2Fweb-apps%2Fcurrent-work%2Fimages%2Frobots.jpeg">%0A%20<p%20class%3D"score%20left"><span>Red%20Alliance<%2Fspan>%20<span>78<%2Fspan><%2Fp>%0A%20<p%20class%3D"score%20right"><span>Blue%20Alliance<%2Fspan>%20<span>66<%2Fspan><%2Fp>%0A%20<p%20class%3D"score%20middle"><span>Qual%20Match%2037<%2Fspan>%20<span>Friday%2014%3A21<%2Fspan>%0A<%2Fdiv>" width=600 height=400></iframe>
- <p>In order to make the score display render correctly whenever the user seeks to an arbitrary
- point in the video, the metadata text track cues need to be as long as is appropriate for the
- score. For example, in the frame above, there would be maybe one cue that lasts the length of the
- match that gives the match number, one cue that lasts until the blue alliance's score changes, and
- one cue that lasts until the red alliance's score changes. If the video is just a stream of the
- live event, the time in the bottom right would presumably be automatically derived from the
- current video time, rather than based on a cue. However, if the video was just the highlights,
- then that might be given in cues also.</p>
- <p>The following shows what fragments of this could look like in a WebVTT file:</p>
- <pre>WEBVTT
- ...
- 05:10:00.000 --> 05:12:15.000
- matchtype:qual
- matchnumber:37
- ...
- 05:11:02.251 --> 05:11:17.198
- red:78
- 05:11:03.672 --> 05:11:54.198
- blue:66
- 05:11:17.198 --> 05:11:25.912
- red:80
- 05:11:25.912 --> 05:11:26.522
- red:83
- 05:11:26.522 --> 05:11:26.982
- red:86
- 05:11:26.982 --> 05:11:27.499
- red:89
- ...</pre>
- <p>The key here is to notice that the information is given in cues that span the length of time to
- which the relevant event applies. If, instead, the scores were given as zero-length (or very
- brief, nearly zero-length) cues when the score changes, for example saying "red+2" at
- 05:11:17.198, "red+3" at 05:11:25.912, etc, problems arise: primarily, seeking is much harder to
- implement, as the script has to walk the entire list of cues to make sure that no notifications
- have been missed; but also, if the cues are short it's possible the script will never see that
- they are active unless it listens to them specifically.</p>
- <p>When using cues in this manner, authors are encouraged to use the <code id=best-practices-for-metadata-text-tracks:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code> event to update the current annotations. (In
- particular, using the <code id=best-practices-for-metadata-text-tracks:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event would be less
- appropriate as it would require doing work even when the cues haven't changed, and, more
- importantly, would introduce a higher latency between when the metatata cues become active and
- when the display is updated, since <code id=best-practices-for-metadata-text-tracks:event-media-timeupdate-2><a href=#event-media-timeupdate>timeupdate</a></code> events
- are rate-limited.)</p>
- <h5 id=user-interface>4.8.14.13 User interface</h5>
- <p>The <dfn id=attr-media-controls><code>controls</code></dfn> attribute is a <a href=#boolean-attribute id=user-interface:boolean-attribute>boolean
- attribute</a>. If present, it indicates that the author has not provided a scripted controller
- and would like the user agent to provide its own set of controls.</p>
-
- <p>If the attribute is present, or if <a href=#concept-n-noscript id=user-interface:concept-n-noscript>scripting is
- disabled</a> for the <a href=#media-element id=user-interface:media-element>media element</a>, then the user agent should <dfn id=expose-a-user-interface-to-the-user>expose a user
- interface to the user</dfn>. This user interface should include features to begin playback, pause
- playback, seek to an arbitrary position in the content (if the content supports arbitrary
- seeking), change the volume, change the display of closed captions or embedded sign-language
- tracks, select different audio tracks or turn on audio descriptions, and show the media content in
- manners more suitable to the user (e.g. full-screen video or in an independent resizable window).
- Other controls may also be made available.</p>
- <p>If the <a href=#media-element id=user-interface:media-element-2>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller>current media controller</a>, then the user
- agent should expose audio tracks from all the <a href=#slaved-media-elements id=user-interface:slaved-media-elements>slaved media elements</a> (although
- avoiding duplicates if the same <a href=#media-resource id=user-interface:media-resource>media resource</a> is being used several times). If a
- <a href=#media-resource id=user-interface:media-resource-2>media resource</a>'s audio track exposed in this way has no known name, and it is the
- only audio track for a particular <a href=#media-element id=user-interface:media-element-3>media element</a>, the user agent should use the
- element's <code id=user-interface:attr-title><a href=#attr-title>title</a></code> attribute, if any, as the name (or as part of the
- name) of that track.</p>
- <p>Even when the attribute is absent, however, user agents may provide controls to affect playback
- of the media resource (e.g. play, pause, seeking, and volume controls), but such features should
- not interfere with the page's normal rendering. For example, such features could be exposed in the
- <a href=#media-element id=user-interface:media-element-4>media element</a>'s context menu. The user agent may implement this simply by <a href=#expose-a-user-interface-to-the-user id=user-interface:expose-a-user-interface-to-the-user>exposing a user interface to the user</a> as
- described above (as if the <code id=user-interface:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute was
- present).</p>
- <p>If the user agent <a href=#expose-a-user-interface-to-the-user id=user-interface:expose-a-user-interface-to-the-user-2>exposes a user interface to
- the user</a> by displaying controls over the <a href=#media-element id=user-interface:media-element-5>media element</a>, then the user agent
- should suppress any user interaction events while the user agent is interacting with this
- interface. (For example, if the user clicks on a video's playback control, <code id=user-interface:event-mousedown><a href=#event-mousedown>mousedown</a></code> events and so forth would not simultaneously be fired at
- elements on the page.)</p>
- <p>Where possible (specifically, for starting, stopping, pausing, and unpausing playback, for
- seeking, for changing the rate of playback, for fast-forwarding or rewinding, for listing,
- enabling, and disabling text tracks, and for muting or changing the volume of the audio), user
- interface features exposed by the user agent must be implemented in terms of the DOM API described
- above, so that, e.g., all the same events fire.</p>
- <p>When a <a href=#media-element id=user-interface:media-element-6>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-2>current media controller</a>, the user agent's
- user interface for pausing and unpausing playback, for seeking, for changing the rate of playback,
- for fast-forwarding or rewinding, and for muting or changing the volume of audio of the entire
- group must be implemented in terms of the <code id=user-interface:mediacontroller><a href=#mediacontroller>MediaController</a></code> API exposed on that
- <a href=#current-media-controller id=user-interface:current-media-controller-3>current media controller</a>. When a <a href=#media-element id=user-interface:media-element-7>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-4>current media
- controller</a>, and all the <a href=#slaved-media-elements id=user-interface:slaved-media-elements-2>slaved media elements</a> of that
- <code id=user-interface:mediacontroller-2><a href=#mediacontroller>MediaController</a></code> are paused, the user agent should also unpause all the <a href=#slaved-media-elements id=user-interface:slaved-media-elements-3>slaved
- media elements</a> when the user invokes a user agent interface control for beginning
- playback.</p>
- <p>The "play" function in the user agent's interface must set the <code>playbackRate</code> attribute to the value of the <code>defaultPlaybackRate</code> attribute before invoking the <code>play()</code>
- method. When a <a href=#media-element id=user-interface:media-element-8>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-5>current media controller</a>, the
- attributes and method with those names on that <code id=user-interface:mediacontroller-3><a href=#mediacontroller>MediaController</a></code> object must be used.
- Otherwise, the attributes and method with those names on the <a href=#media-element id=user-interface:media-element-9>media element</a> itself
- must be used. </p>
- <p>Features such as fast-forward or rewind must be implemented by only changing the <code>playbackRate</code> attribute (and not the <code>defaultPlaybackRate</code>
- attribute). Again, when a <a href=#media-element id=user-interface:media-element-10>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-6>current media controller</a>,
- the attributes with those names on that <code id=user-interface:mediacontroller-4><a href=#mediacontroller>MediaController</a></code> object must be used;
- otherwise, the attributes with those names on the <a href=#media-element id=user-interface:media-element-11>media element</a> itself must be used.</p>
- <p>When a <a href=#media-element id=user-interface:media-element-12>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-7>current media controller</a>, seeking must be
- implemented in terms of the <code id=user-interface:dom-mediacontroller-currenttime><a href=#dom-mediacontroller-currenttime>currentTime</a></code>
- attribute on that <code id=user-interface:mediacontroller-5><a href=#mediacontroller>MediaController</a></code> object. Otherwise, the user agent must directly
- <a href=#dom-media-seek id=user-interface:dom-media-seek>seek</a> to the requested position in the <a href=#media-element id=user-interface:media-element-13>media
- element</a>'s <a href=#media-timeline id=user-interface:media-timeline>media timeline</a>. For media resources where seeking to an arbitrary
- position would be slow, user agents are encouraged to use the <i>approximate-for-speed</i> flag
- when seeking in response to the user manipulating an approximate position interface such as a seek
- bar.</p>
- <p>When a <a href=#media-element id=user-interface:media-element-14>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-8>current media controller</a>, user agents may
- additionally provide the user with controls that directly manipulate an individual <a href=#media-element id=user-interface:media-element-15>media
- element</a> without affecting the <code id=user-interface:mediacontroller-6><a href=#mediacontroller>MediaController</a></code>, but such features are
- considered relatively advanced and unlikely to be useful to most users.</p>
- <p>The <a href=#activation-behavior id=user-interface:activation-behavior>activation behavior</a> of a <a href=#media-element id=user-interface:media-element-16>media element</a> that is <a href=#expose-a-user-interface-to-the-user id=user-interface:expose-a-user-interface-to-the-user-3>exposing a user interface to the user</a> must be
- to run the following steps:</p>
- <ol><li><p>If the <a href=#media-element id=user-interface:media-element-17>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-9>current media controller</a>, and that
- <a href=#current-media-controller id=user-interface:current-media-controller-10>current media controller</a> is a <a href=#restrained-media-controller id=user-interface:restrained-media-controller>restrained media controller</a>, then invoke
- the <code id=user-interface:dom-mediacontroller-play><a href=#dom-mediacontroller-play>play()</a></code> method of the
- <code id=user-interface:mediacontroller-7><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, if the <a href=#media-element id=user-interface:media-element-18>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-11>current media controller</a>,
- and that <a href=#current-media-controller id=user-interface:current-media-controller-12>current media controller</a> is a <a href=#paused-media-controller id=user-interface:paused-media-controller>paused media controller</a>, then
- invoke the <code id=user-interface:dom-mediacontroller-unpause><a href=#dom-mediacontroller-unpause>unpause()</a></code> method of the
- <code id=user-interface:mediacontroller-8><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, if the <a href=#media-element id=user-interface:media-element-19>media element</a> has a <a href=#current-media-controller id=user-interface:current-media-controller-13>current media controller</a>,
- then that <a href=#current-media-controller id=user-interface:current-media-controller-14>current media controller</a> is a <a href=#playing-media-controller id=user-interface:playing-media-controller>playing media controller</a>;
- invoke the <code id=user-interface:dom-mediacontroller-pause><a href=#dom-mediacontroller-pause>pause()</a></code> method of the
- <code id=user-interface:mediacontroller-9><a href=#mediacontroller>MediaController</a></code>.<li><p>Otherwise, the <a href=#media-element id=user-interface:media-element-20>media element</a> has no <a href=#current-media-controller id=user-interface:current-media-controller-15>current media controller</a>; if
- the <a href=#media-element id=user-interface:media-element-21>media element</a>'s <code id=user-interface:dom-media-paused><a href=#dom-media-paused>paused</a></code> attribute is true,
- then invoke the <code id=user-interface:dom-media-play><a href=#dom-media-play>play()</a></code> method on the <a href=#media-element id=user-interface:media-element-22>media
- element</a>.<li><p>Otherwise, the <a href=#media-element id=user-interface:media-element-23>media element</a> has no <a href=#current-media-controller id=user-interface:current-media-controller-16>current media controller</a>,
- and the <a href=#media-element id=user-interface:media-element-24>media element</a>'s <code id=user-interface:dom-media-paused-2><a href=#dom-media-paused>paused</a></code> attribute is
- false; invoke the <code id=user-interface:dom-media-pause><a href=#dom-media-pause>pause()</a></code> method on the <a href=#media-element id=user-interface:media-element-25>media
- element</a>.</ol>
- <p>For the purposes of listing chapters in the <a href=#media-resource id=user-interface:media-resource-3>media resource</a>, only <a href=#text-track id=user-interface:text-track>text tracks</a> in the <a href=#media-element id=user-interface:media-element-26>media element</a>'s <a href=#list-of-text-tracks id=user-interface:list-of-text-tracks>list of text tracks</a>
- that are <a href=#text-track-showing id=user-interface:text-track-showing>showing</a> and whose <a href=#text-track-kind id=user-interface:text-track-kind>text track kind</a> is
- <code id=user-interface:dom-texttrack-kind-chapters><a href=#dom-texttrack-kind-chapters>chapters</a></code> should be used. Such tracks must be
- interpreted according to the <a href=#rules-for-constructing-the-chapter-tree-from-a-text-track id=user-interface:rules-for-constructing-the-chapter-tree-from-a-text-track>rules for constructing the chapter tree from a text
- track</a>. When seeking in response to a user maniplating a chapter selection interface, user
- agents should not use the <i>approximate-for-speed</i> flag.</p>
- <p>The <dfn id=dom-media-controls><code>controls</code></dfn> IDL attribute must
- <a href=#reflect id=user-interface:reflect>reflect</a> the content attribute of the same name.</p>
- <hr>
-
- <dl class=domintro><dt><var>media</var> . <code id=user-interface:dom-media-volume><a href=#dom-media-volume>volume</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current playback volume, as a number in the range 0.0 to 1.0, where 0.0 is the
- quietest and 1.0 the loudest.</p>
- <p>Can be set, to change the volume.</p>
- <p>Throws an <code id=user-interface:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the new value is not in the range 0.0 .. 1.0.</p>
- <dt><var>media</var> . <code id=user-interface:dom-media-muted><a href=#dom-media-muted>muted</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if audio is muted, overriding the <code id=user-interface:dom-media-volume-2><a href=#dom-media-volume>volume</a></code>
- attribute, and false if the <code id=user-interface:dom-media-volume-3><a href=#dom-media-volume>volume</a></code> attribute is being
- honored.</p>
- <p>Can be set, to change whether the audio is muted or not.</p>
- </dl>
-
- <p>A <a href=#media-element id=user-interface:media-element-27>media element</a> has a <dfn id=concept-media-volume>playback volume</dfn>, which is a fraction in the range 0.0 (silent) to 1.0 (loudest).
- Initially, the volume should be 1.0, but user agents may remember the last set value across
- sessions, on a per-site basis or otherwise, so the volume may start at other values.</p>
- <p>The <dfn id=dom-media-volume><code>volume</code></dfn> IDL attribute must return the
- <a href=#concept-media-volume id=user-interface:concept-media-volume>playback volume</a> of any audio portions of the
- <a href=#media-element id=user-interface:media-element-28>media element</a>. On setting, if the new value is in the range 0.0 to 1.0 inclusive, the
- <a href=#media-element id=user-interface:media-element-29>media element</a>'s <a href=#concept-media-volume id=user-interface:concept-media-volume-2>playback volume</a> must be
- set to the new value. If the new value is outside the range 0.0 to 1.0 inclusive, then, on
- setting, an <code id=user-interface:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown instead.</p>
- <p>A <a href=#media-element id=user-interface:media-element-30>media element</a> can also be <dfn id=concept-media-muted>muted</dfn>. If
- anything is muting the element, then it is muted. (For example, when the <a href=#direction-of-playback id=user-interface:direction-of-playback>direction of
- playback</a> is backwards, the element is muted.)</p>
- <p>The <dfn id=dom-media-muted><code>muted</code></dfn> IDL attribute must return the value
- to which it was last set. When a <a href=#media-element id=user-interface:media-element-31>media element</a> is created, if the element has a <code id=user-interface:attr-media-muted><a href=#attr-media-muted>muted</a></code> content attribute specified, then the <code id=user-interface:dom-media-muted-2><a href=#dom-media-muted>muted</a></code> IDL attribute should be set to true; otherwise, the user
- agents may set the value to the user's preferred value (e.g. remembering the last set value across
- sessions, on a per-site basis or otherwise). While the <code id=user-interface:dom-media-muted-3><a href=#dom-media-muted>muted</a></code>
- IDL attribute is set to true, the <a href=#media-element id=user-interface:media-element-32>media element</a> must be <a href=#concept-media-muted id=user-interface:concept-media-muted>muted</a>.</p>
- <p>Whenever either of the values that would be returned by the <code id=user-interface:dom-media-volume-4><a href=#dom-media-volume>volume</a></code> and <code id=user-interface:dom-media-muted-4><a href=#dom-media-muted>muted</a></code> IDL
- attributes change, the user agent must <a href=#queue-a-task id=user-interface:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=user-interface:fire-a-simple-event>fire a simple
- event</a> named <code id=user-interface:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> at the <a href=#media-element id=user-interface:media-element-33>media
- element</a>.</p>
- <p>An element's <dfn id=effective-media-volume>effective media volume</dfn> is determined as follows:</p>
- <ol><li><p>If the user has indicated that the user agent is to override the volume of the element,
- then the element's <a href=#effective-media-volume id=user-interface:effective-media-volume>effective media volume</a> is the volume desired by the user. Abort
- these steps.<li><p>If the element's audio output is <a href=#concept-media-muted id=user-interface:concept-media-muted-2>muted</a>, the
- element's <a href=#effective-media-volume id=user-interface:effective-media-volume-2>effective media volume</a> is zero. Abort these steps.<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-17>current media controller</a> and that
- <code id=user-interface:mediacontroller-10><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-mute-override id=user-interface:media-controller-mute-override>media controller mute override</a> is true, the
- element's <a href=#effective-media-volume id=user-interface:effective-media-volume-3>effective media volume</a> is zero. Abort these steps.<li><p>Let <var>volume</var> be the <a href=#concept-media-volume id=user-interface:concept-media-volume-3>playback
- volume</a> of the audio portions of the <a href=#media-element id=user-interface:media-element-34>media element</a>, in range 0.0 (silent) to
- 1.0 (loudest).<li><p>If the element has a <a href=#current-media-controller id=user-interface:current-media-controller-18>current media controller</a>, multiply <var>volume</var> by that <code id=user-interface:mediacontroller-11><a href=#mediacontroller>MediaController</a></code> object's <a href=#media-controller-volume-multiplier id=user-interface:media-controller-volume-multiplier>media controller
- volume multiplier</a>. (The <a href=#media-controller-volume-multiplier id=user-interface:media-controller-volume-multiplier-2>media controller volume multiplier</a> is in the range
- 0.0 to 1.0, so this can only reduce the value.)<li><p>The element's <a href=#effective-media-volume id=user-interface:effective-media-volume-4>effective media volume</a> is <var>volume</var>,
- interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest
- setting, values in between increasing in loudness. The range need not be linear. The loudest
- setting may be lower than the system's loudest possible setting; for example the user could have
- set a maximum volume.</ol>
-
- <p>The <dfn id=attr-media-muted><code>muted</code></dfn> content attribute on <a href=#media-element id=user-interface:media-element-35>media elements</a> is a <a href=#boolean-attribute id=user-interface:boolean-attribute-2>boolean attribute</a> that controls the
- default state of the audio output of the <a href=#media-resource id=user-interface:media-resource-4>media resource</a>, potentially overriding user
- preferences.</p>
-
- <p>The <dfn id=dom-media-defaultmuted><code>defaultMuted</code></dfn> IDL attribute must
- <a href=#reflect id=user-interface:reflect-2>reflect</a> the <code id=user-interface:attr-media-muted-2><a href=#attr-media-muted>muted</a></code> content attribute.</p>
-
- <p class=note>This attribute has no dynamic effect (it only controls the default state of the
- element).</p>
- <div class=example>
- <p>This video (an advertisement) autoplays, but to avoid annoying users, it does so without
- sound, and allows the user to turn the sound on.</p>
- <pre><video src="adverts.cgi?kind=video" controls autoplay loop muted></video></pre>
- </div>
- <h5 id=time-ranges>4.8.14.14 Time ranges</h5>
- <p>Objects implementing the <code id=time-ranges:timeranges><a href=#timeranges>TimeRanges</a></code> interface
- represent a list of ranges (periods) of time.</p>
- <pre class=idl>interface <dfn id=timeranges>TimeRanges</dfn> {
- readonly attribute unsigned long <a href=#dom-timeranges-length id=time-ranges:dom-timeranges-length>length</a>;
- double <a href=#dom-timeranges-start id=time-ranges:dom-timeranges-start>start</a>(unsigned long index);
- double <a href=#dom-timeranges-end id=time-ranges:dom-timeranges-end>end</a>(unsigned long index);
- };</pre>
- <dl class=domintro><dt><var>media</var> . <code id=time-ranges:dom-timeranges-length-2><a href=#dom-timeranges-length>length</a></code><dd>
- <p>Returns the number of ranges in the object.</p>
- <dt><var>time</var> = <var>media</var> . <code id=time-ranges:dom-timeranges-start-2><a href=#dom-timeranges-start>start</a></code>(<var>index</var>)<dd>
- <p>Returns the time for the start of the range with the given index.</p>
- <p>Throws an <code id=time-ranges:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>
- <dt><var>time</var> = <var>media</var> . <code id=time-ranges:dom-timeranges-end-2><a href=#dom-timeranges-end>end</a></code>(<var>index</var>)<dd>
- <p>Returns the time for the end of the range with the given index.</p>
- <p>Throws an <code id=time-ranges:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception if the index is out of range.</p>
- </dl>
-
- <p>The <dfn id=dom-timeranges-length><code>length</code></dfn> IDL attribute must return the
- number of ranges represented by the object.</p>
- <p>The <dfn id=dom-timeranges-start><code>start(<var>index</var>)</code></dfn>
- method must return the position of the start of the <var>index</var>th range represented
- by the object, in seconds measured from the start of the timeline that the object covers.</p>
- <p>The <dfn id=dom-timeranges-end><code>end(<var>index</var>)</code></dfn> method
- must return the position of the end of the <var>index</var>th range represented by the
- object, in seconds measured from the start of the timeline that the object covers.</p>
- <p>These methods must throw <code id=time-ranges:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exceptions if called with an <var>index</var> argument greater than or equal to the number of ranges represented by the
- object.</p>
- <p>When a <code id=time-ranges:timeranges-2><a href=#timeranges>TimeRanges</a></code> object is said to be a <dfn id=normalised-timeranges-object>normalised <code>TimeRanges</code>
- object</dfn>, the ranges it represents must obey the following criteria:</p>
- <ul><li>The start of a range must be greater than the end of all earlier ranges.<li>The start of a range must be less than the end of that same range.</ul>
- <p>In other words, the ranges in such an object are ordered, don't overlap, aren't empty, and
- don't touch (adjacent ranges are folded into one bigger range).</p>
- <p>Ranges in a <code id=time-ranges:timeranges-3><a href=#timeranges>TimeRanges</a></code> object must be inclusive.</p>
- <p class=example>Thus, the end of a range would be equal to the start of a following adjacent
- (touching but not overlapping) range. Similarly, a range covering a whole timeline anchored at
- zero would have a start equal to zero and an end equal to the duration of the timeline.</p>
- <p>The timelines used by the objects returned by the <code id=time-ranges:dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>, <code id=time-ranges:dom-media-seekable><a href=#dom-media-seekable>seekable</a></code> and
- <code id=time-ranges:dom-media-played><a href=#dom-media-played>played</a></code> IDL attributes of <a href=#media-element id=time-ranges:media-element>media
- elements</a> must be that element's <a href=#media-timeline id=time-ranges:media-timeline>media timeline</a>.</p>
-
- <h5 id=the-trackevent-interface>4.8.14.15 The <code id=the-trackevent-interface:trackevent><a href=#trackevent>TrackEvent</a></code> interface</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#trackeventinit id=the-trackevent-interface:trackeventinit>TrackEventInit</a> eventInitDict)]
- interface <dfn id=trackevent>TrackEvent</dfn> : <a href=#event id=the-trackevent-interface:event>Event</a> {
- readonly attribute (<a href=#videotrack id=the-trackevent-interface:videotrack>VideoTrack</a> or <a href=#audiotrack id=the-trackevent-interface:audiotrack>AudioTrack</a> or <a href=#texttrack id=the-trackevent-interface:texttrack>TextTrack</a>) <a href=#dom-trackevent-track id=the-trackevent-interface:dom-trackevent-track>track</a>;
- };
- dictionary <dfn id=trackeventinit>TrackEventInit</dfn> : <a href=#eventinit id=the-trackevent-interface:eventinit>EventInit</a> {
- (<a href=#videotrack id=the-trackevent-interface:videotrack-2>VideoTrack</a> or <a href=#audiotrack id=the-trackevent-interface:audiotrack-2>AudioTrack</a> or <a href=#texttrack id=the-trackevent-interface:texttrack-2>TextTrack</a>) track;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-trackevent-interface:dom-trackevent-track-2><a href=#dom-trackevent-track>track</a></code><dd>
- <p>Returns the track object (<code id=the-trackevent-interface:texttrack-3><a href=#texttrack>TextTrack</a></code>, <code id=the-trackevent-interface:audiotrack-3><a href=#audiotrack>AudioTrack</a></code>, or
- <code id=the-trackevent-interface:videotrack-3><a href=#videotrack>VideoTrack</a></code>) to which the event relates.</p>
- </dl>
-
- <p>The <dfn id=dom-trackevent-track><code>track</code></dfn> attribute must return the value
- it was initialised to. When the object is created, this attribute must be initialised to null. It
- represents the context information for the event.</p>
-
- <h5 id=mediaevents>4.8.14.16 Event summary</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The following events fire on <a href=#media-element id=mediaevents:media-element>media elements</a> as part of the
- processing model described above:</p>
- <table><thead><tr><th>Event name
- <th>Interface
- <th>Fired when...
- <th>Preconditions
- <tbody><tr><td><dfn id=event-media-loadstart><code>loadstart</code></dfn>
- <td><code id=mediaevents:event><a href=#event>Event</a></code>
- <td>The user agent begins looking for <a href=#media-data id=mediaevents:media-data>media data</a>, as part of the <a href=#concept-media-load-algorithm id=mediaevents:concept-media-load-algorithm>resource selection algorithm</a>.
- <td><code id=mediaevents:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> equals <code id=mediaevents:dom-media-network_loading><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
- <tr><td><dfn id=event-media-progress><code>progress</code></dfn>
- <td><code id=mediaevents:event-2><a href=#event>Event</a></code>
- <td>The user agent is fetching <a href=#media-data id=mediaevents:media-data-2>media data</a>.
- <td><code id=mediaevents:dom-media-networkstate-2><a href=#dom-media-networkstate>networkState</a></code> equals <code id=mediaevents:dom-media-network_loading-2><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>
- <tr><td><dfn id=event-media-suspend><code>suspend</code></dfn>
- <td><code id=mediaevents:event-3><a href=#event>Event</a></code>
- <td>The user agent is intentionally not currently fetching <a href=#media-data id=mediaevents:media-data-3>media data</a>.
- <td><code id=mediaevents:dom-media-networkstate-3><a href=#dom-media-networkstate>networkState</a></code> equals <code id=mediaevents:dom-media-network_idle><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>
- <tr><td><dfn id=event-media-abort><code>abort</code></dfn>
- <td><code id=mediaevents:event-4><a href=#event>Event</a></code>
- <td>The user agent stops fetching the <a href=#media-data id=mediaevents:media-data-4>media data</a> before it is completely
- downloaded, but not due to an error.
- <td><code id=mediaevents:dom-media-error><a href=#dom-media-error>error</a></code> is an object with the code <code id=mediaevents:dom-mediaerror-media_err_aborted><a href=#dom-mediaerror-media_err_aborted>MEDIA_ERR_ABORTED</a></code>. <code id=mediaevents:dom-media-networkstate-4><a href=#dom-media-networkstate>networkState</a></code> equals either <code id=mediaevents:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code id=mediaevents:dom-media-network_idle-2><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
- <tr><td><dfn id=event-media-error><code>error</code></dfn>
- <td><code id=mediaevents:event-5><a href=#event>Event</a></code>
- <td>An error occurs while fetching the <a href=#media-data id=mediaevents:media-data-5>media data</a>.
- <td><code id=mediaevents:dom-media-error-2><a href=#dom-media-error>error</a></code> is an object with the code <code id=mediaevents:dom-mediaerror-media_err_network><a href=#dom-mediaerror-media_err_network>MEDIA_ERR_NETWORK</a></code> or higher. <code id=mediaevents:dom-media-networkstate-5><a href=#dom-media-networkstate>networkState</a></code> equals either <code id=mediaevents:dom-media-network_empty-2><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> or <code id=mediaevents:dom-media-network_idle-3><a href=#dom-media-network_idle>NETWORK_IDLE</a></code>, depending on when the download was aborted.
- <tr><td><dfn id=event-media-emptied><code>emptied</code></dfn>
- <td><code id=mediaevents:event-6><a href=#event>Event</a></code>
- <td>A <a href=#media-element id=mediaevents:media-element-2>media element</a> whose <code id=mediaevents:dom-media-networkstate-6><a href=#dom-media-networkstate>networkState</a></code>
- was previously not in the <code id=mediaevents:dom-media-network_empty-3><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state has
- just switched to that state (either because of a fatal error during load that's about to be
- reported, or because the <code id=mediaevents:dom-media-load><a href=#dom-media-load>load()</a></code> method was invoked while
- the <a href=#concept-media-load-algorithm id=mediaevents:concept-media-load-algorithm-2>resource selection algorithm</a> was already
- running).
- <td><code id=mediaevents:dom-media-networkstate-7><a href=#dom-media-networkstate>networkState</a></code> is <code id=mediaevents:dom-media-network_empty-4><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>; all the IDL attributes are in their
- initial states.
- <tr><td><dfn id=event-media-stalled><code>stalled</code></dfn>
- <td><code id=mediaevents:event-7><a href=#event>Event</a></code>
- <td>The user agent is trying to fetch <a href=#media-data id=mediaevents:media-data-6>media data</a>, but data is unexpectedly not
- forthcoming.
- <td><code id=mediaevents:dom-media-networkstate-8><a href=#dom-media-networkstate>networkState</a></code> is <code id=mediaevents:dom-media-network_loading-3><a href=#dom-media-network_loading>NETWORK_LOADING</a></code>.
- <tbody><tr><td><dfn id=event-media-loadedmetadata><code>loadedmetadata</code></dfn>
- <td><code id=mediaevents:event-8><a href=#event>Event</a></code>
- <td>The user agent has just determined the duration and dimensions of the <a href=#media-resource id=mediaevents:media-resource>media
- resource</a> and <a href=#the-text-tracks-are-ready id=mediaevents:the-text-tracks-are-ready>the text tracks are ready</a>.
- <td><code id=mediaevents:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code id=mediaevents:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater for the first time.
- <tr><td><dfn id=event-media-loadeddata><code>loadeddata</code></dfn>
- <td><code id=mediaevents:event-9><a href=#event>Event</a></code>
- <td>The user agent can render the <a href=#media-data id=mediaevents:media-data-7>media data</a> at the <a href=#current-playback-position id=mediaevents:current-playback-position>current playback
- position</a> for the first time.
- <td><code id=mediaevents:dom-media-readystate-2><a href=#dom-media-readystate>readyState</a></code> newly increased to <code id=mediaevents:dom-media-have_current_data><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater for the first time.
- <tr><td><dfn id=event-media-canplay><code>canplay</code></dfn>
- <td><code id=mediaevents:event-10><a href=#event>Event</a></code>
- <td>The user agent can resume playback of the <a href=#media-data id=mediaevents:media-data-8>media data</a>, but estimates that if
- playback were to be started now, the <a href=#media-resource id=mediaevents:media-resource-2>media resource</a> could not be rendered at the
- current playback rate up to its end without having to stop for further buffering of content.
- <td><code id=mediaevents:dom-media-readystate-3><a href=#dom-media-readystate>readyState</a></code> newly increased to <code id=mediaevents:dom-media-have_future_data><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or greater.
- <tr><td><dfn id=event-media-canplaythrough><code>canplaythrough</code></dfn>
- <td><code id=mediaevents:event-11><a href=#event>Event</a></code>
- <td>The user agent estimates that if playback were to be started now, the <a href=#media-resource id=mediaevents:media-resource-3>media
- resource</a> could be rendered at the current playback rate all the way to its end without
- having to stop for further buffering.
- <td><code id=mediaevents:dom-media-readystate-4><a href=#dom-media-readystate>readyState</a></code> is newly equal to <code id=mediaevents:dom-media-have_enough_data><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>.
- <tr><td><dfn id=event-media-playing><code>playing</code></dfn>
- <td><code id=mediaevents:event-12><a href=#event>Event</a></code>
- <td>Playback is ready to start after having been paused or delayed due to lack of <a href=#media-data id=mediaevents:media-data-9>media
- data</a>.
- <td><code id=mediaevents:dom-media-readystate-5><a href=#dom-media-readystate>readyState</a></code> is newly equal to or greater than
- <code id=mediaevents:dom-media-have_future_data-2><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> and <code id=mediaevents:dom-media-paused><a href=#dom-media-paused>paused</a></code> is false, or <code id=mediaevents:dom-media-paused-2><a href=#dom-media-paused>paused</a></code> is newly false and <code id=mediaevents:dom-media-readystate-6><a href=#dom-media-readystate>readyState</a></code> is equal to or greater than <code id=mediaevents:dom-media-have_future_data-3><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code>. Even if this event fires, the
- element might still not be <a href=#potentially-playing id=mediaevents:potentially-playing>potentially playing</a>, e.g. if the element is
- <a href=#blocked-on-its-media-controller id=mediaevents:blocked-on-its-media-controller>blocked on its media controller</a> (e.g. because the <a href=#current-media-controller id=mediaevents:current-media-controller>current media
- controller</a> is paused, or another <a href=#slaved-media-elements id=mediaevents:slaved-media-elements>slaved media
- element</a> is stalled somehow, or because the <a href=#media-resource id=mediaevents:media-resource-4>media resource</a> has no data
- corresponding to the <a href=#media-controller-position id=mediaevents:media-controller-position>media controller position</a>), or the element is <a href=#paused-for-user-interaction id=mediaevents:paused-for-user-interaction>paused
- for user interaction</a> or <a href=#paused-for-in-band-content id=mediaevents:paused-for-in-band-content>paused for in-band content</a>.
- <tr><td><dfn id=event-media-waiting><code>waiting</code></dfn>
- <td><code id=mediaevents:event-13><a href=#event>Event</a></code>
- <td>Playback has stopped because the next frame is not available, but the user agent expects
- that frame to become available in due course.
- <td><code id=mediaevents:dom-media-readystate-7><a href=#dom-media-readystate>readyState</a></code> is equal to or less than <code id=mediaevents:dom-media-have_current_data-2><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code>, and <code id=mediaevents:dom-media-paused-3><a href=#dom-media-paused>paused</a></code> is false. Either <code id=mediaevents:dom-media-seeking><a href=#dom-media-seeking>seeking</a></code> is true, or the <a href=#current-playback-position id=mediaevents:current-playback-position-2>current playback position</a>
- is not contained in any of the ranges in <code id=mediaevents:dom-media-buffered><a href=#dom-media-buffered>buffered</a></code>. It
- is possible for playback to stop for other reasons without <code id=mediaevents:dom-media-paused-4><a href=#dom-media-paused>paused</a></code> being false, but those reasons do not fire this event
- (and when those situations resolve, a separate <code id=mediaevents:event-media-playing><a href=#event-media-playing>playing</a></code>
- event is not fired either): e.g. the element is newly <a href=#blocked-on-its-media-controller id=mediaevents:blocked-on-its-media-controller-2>blocked on its media
- controller</a>, or <a href=#ended-playback id=mediaevents:ended-playback>playback ended</a>, or playback
- <a href=#stopped-due-to-errors id=mediaevents:stopped-due-to-errors>stopped due to errors</a>, or the element has <a href=#paused-for-user-interaction id=mediaevents:paused-for-user-interaction-2>paused for user interaction</a>
- or <a href=#paused-for-in-band-content id=mediaevents:paused-for-in-band-content-2>paused for in-band content</a>.
- <tbody><tr><td><dfn id=event-media-seeking><code>seeking</code></dfn>
- <td><code id=mediaevents:event-14><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-media-seeking-2><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to true, and the user agent has started seeking to a new position.
- <td>
- <tr><td><dfn id=event-media-seeked><code>seeked</code></dfn>
- <td><code id=mediaevents:event-15><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-media-seeking-3><a href=#dom-media-seeking>seeking</a></code> IDL attribute changed to false after the <a href=#current-playback-position id=mediaevents:current-playback-position-3>current playback position</a> was changed.
- <td>
- <tr><td><dfn id=event-media-ended><code>ended</code></dfn>
- <td><code id=mediaevents:event-16><a href=#event>Event</a></code>
- <td>Playback has stopped because the end of the <a href=#media-resource id=mediaevents:media-resource-5>media resource</a> was reached.
- <td><code id=mediaevents:dom-media-currenttime><a href=#dom-media-currenttime>currentTime</a></code> equals the end of the <a href=#media-resource id=mediaevents:media-resource-6>media
- resource</a>; <code id=mediaevents:dom-media-ended><a href=#dom-media-ended>ended</a></code> is true.
- <tbody><tr><td><dfn id=event-media-durationchange><code>durationchange</code></dfn>
- <td><code id=mediaevents:event-17><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-media-duration><a href=#dom-media-duration>duration</a></code> attribute has just been updated.
- <td>
- <tr><td><dfn id=event-media-timeupdate><code>timeupdate</code></dfn>
- <td><code id=mediaevents:event-18><a href=#event>Event</a></code>
- <td>The <a href=#current-playback-position id=mediaevents:current-playback-position-4>current playback position</a> changed as part of normal playback or in an especially interesting way, for example discontinuously.
- <td>
- <tr><td><dfn id=event-media-play><code>play</code></dfn>
- <td><code id=mediaevents:event-19><a href=#event>Event</a></code>
- <td>The element is no longer paused. Fired after the <code id=mediaevents:dom-media-play><a href=#dom-media-play>play()</a></code>
- method has returned, or when the <code id=mediaevents:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code> attribute
- has caused playback to begin.
- <td><code id=mediaevents:dom-media-paused-5><a href=#dom-media-paused>paused</a></code> is newly false.
- <tr><td><dfn id=event-media-pause><code>pause</code></dfn>
- <td><code id=mediaevents:event-20><a href=#event>Event</a></code>
- <td>The element has been paused. Fired after the <code id=mediaevents:dom-media-pause><a href=#dom-media-pause>pause()</a></code>
- method has returned.
- <td><code id=mediaevents:dom-media-paused-6><a href=#dom-media-paused>paused</a></code> is newly true.
- <tr><td><dfn id=event-media-ratechange><code>ratechange</code></dfn>
- <td><code id=mediaevents:event-21><a href=#event>Event</a></code>
- <td>Either the <code id=mediaevents:dom-media-defaultplaybackrate><a href=#dom-media-defaultplaybackrate>defaultPlaybackRate</a></code> or the
- <code id=mediaevents:dom-media-playbackrate><a href=#dom-media-playbackrate>playbackRate</a></code> attribute has just been updated.
- <td>
- <tbody><tr><td><dfn id=event-media-resize><code>resize</code></dfn>
- <td><code id=mediaevents:event-22><a href=#event>Event</a></code>
- <td>One or both of the <code id=mediaevents:dom-video-videowidth><a href=#dom-video-videowidth>videoWidth</a></code> and <code id=mediaevents:dom-video-videoheight><a href=#dom-video-videoheight>videoHeight</a></code> attributes have just been updated.
- <td><a href=#media-element id=mediaevents:media-element-3>Media element</a> is a <code id=mediaevents:the-video-element><a href=#the-video-element>video</a></code> element; <code id=mediaevents:dom-media-readystate-8><a href=#dom-media-readystate>readyState</a></code> is not <code id=mediaevents:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code>
- <tr><td><dfn id=event-media-volumechange><code>volumechange</code></dfn>
- <td><code id=mediaevents:event-23><a href=#event>Event</a></code>
- <td>Either the <code id=mediaevents:dom-media-volume><a href=#dom-media-volume>volume</a></code> attribute or the <code id=mediaevents:dom-media-muted><a href=#dom-media-muted>muted</a></code> attribute has changed. Fired after the relevant
- attribute's setter has returned.
- <td>
- </table>
- <p>The following events fire on <code id=mediaevents:mediacontroller><a href=#mediacontroller>MediaController</a></code> objects:</p>
- <table><thead><tr><th>Event name
- <th>Interface
- <th>Fired when...
- <tbody><tr><td><dfn id=event-mediacontroller-emptied><code>emptied</code></dfn>
- <td><code id=mediaevents:event-24><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-2>slaved media elements</a> newly have <code id=mediaevents:dom-media-readystate-9><a href=#dom-media-readystate>readyState</a></code> set to <code id=mediaevents:dom-media-have_nothing-2><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or greater, or there are no longer any
- <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-3>slaved media elements</a>.
- <tr><td><dfn id=event-mediacontroller-loadedmetadata><code>loadedmetadata</code></dfn>
- <td><code id=mediaevents:event-25><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-4>slaved media elements</a> newly have <code id=mediaevents:dom-media-readystate-10><a href=#dom-media-readystate>readyState</a></code> set to <code id=mediaevents:dom-media-have_metadata-2><a href=#dom-media-have_metadata>HAVE_METADATA</a></code> or greater.
- <tr><td><dfn id=event-mediacontroller-loadeddata><code>loadeddata</code></dfn>
- <td><code id=mediaevents:event-26><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-5>slaved media elements</a> newly have <code id=mediaevents:dom-media-readystate-11><a href=#dom-media-readystate>readyState</a></code> set to <code id=mediaevents:dom-media-have_current_data-3><a href=#dom-media-have_current_data>HAVE_CURRENT_DATA</a></code> or greater.
- <tr><td><dfn id=event-mediacontroller-canplay><code>canplay</code></dfn>
- <td><code id=mediaevents:event-27><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-6>slaved media elements</a> newly have <code id=mediaevents:dom-media-readystate-12><a href=#dom-media-readystate>readyState</a></code> set to <code id=mediaevents:dom-media-have_future_data-4><a href=#dom-media-have_future_data>HAVE_FUTURE_DATA</a></code> or greater.
- <tr><td><dfn id=event-mediacontroller-canplaythrough><code>canplaythrough</code></dfn>
- <td><code id=mediaevents:event-28><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-7>slaved media elements</a> newly have <code id=mediaevents:dom-media-readystate-13><a href=#dom-media-readystate>readyState</a></code> set to <code id=mediaevents:dom-media-have_enough_data-2><a href=#dom-media-have_enough_data>HAVE_ENOUGH_DATA</a></code>.
- <tr><td><dfn id=event-mediacontroller-playing><code>playing</code></dfn>
- <td><code id=mediaevents:event-29><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:mediacontroller-2><a href=#mediacontroller>MediaController</a></code> is no longer a <a href=#blocked-media-controller id=mediaevents:blocked-media-controller>blocked media controller</a>.
- <tr><td><dfn id=event-mediacontroller-waiting><code>waiting</code></dfn>
- <td><code id=mediaevents:event-30><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:mediacontroller-3><a href=#mediacontroller>MediaController</a></code> is now a <a href=#blocked-media-controller id=mediaevents:blocked-media-controller-2>blocked media controller</a>.
- <tr><td><dfn id=event-mediacontroller-ended><code>ended</code></dfn>
- <td><code id=mediaevents:event-31><a href=#event>Event</a></code>
- <td>All the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-8>slaved media elements</a> have newly <a href=#ended-playback id=mediaevents:ended-playback-2>ended playback</a>; the
- <code id=mediaevents:mediacontroller-4><a href=#mediacontroller>MediaController</a></code> has reached the end of all the <a href=#slaved-media-elements id=mediaevents:slaved-media-elements-9>slaved media elements</a>.
- <tbody><tr><td><dfn id=event-mediacontroller-durationchange><code>durationchange</code></dfn>
- <td><code id=mediaevents:event-32><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-mediacontroller-duration><a href=#dom-mediacontroller-duration>duration</a></code> attribute has just been
- updated.
- <tr><td><dfn id=event-mediacontroller-timeupdate><code>timeupdate</code></dfn>
- <td><code id=mediaevents:event-33><a href=#event>Event</a></code>
- <td>The <a href=#media-controller-position id=mediaevents:media-controller-position-2>media controller position</a> changed.
- <tr><td><dfn id=event-mediacontroller-play><code>play</code></dfn>
- <td><code id=mediaevents:event-34><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-mediacontroller-paused><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly false.
- <tr><td><dfn id=event-mediacontroller-pause><code>pause</code></dfn>
- <td><code id=mediaevents:event-35><a href=#event>Event</a></code>
- <td>The <code id=mediaevents:dom-mediacontroller-paused-2><a href=#dom-mediacontroller-paused>paused</a></code> attribute is newly true.
- <tr><td><dfn id=event-mediacontroller-ratechange><code>ratechange</code></dfn>
- <td><code id=mediaevents:event-36><a href=#event>Event</a></code>
- <td>Either the <code id=mediaevents:dom-mediacontroller-defaultplaybackrate><a href=#dom-mediacontroller-defaultplaybackrate>defaultPlaybackRate</a></code>
- attribute or the <code id=mediaevents:dom-mediacontroller-playbackrate><a href=#dom-mediacontroller-playbackrate>playbackRate</a></code> attribute
- has just been updated.
- <tr><td><dfn id=event-mediacontroller-volumechange><code>volumechange</code></dfn>
- <td><code id=mediaevents:event-37><a href=#event>Event</a></code>
- <td>Either the <code id=mediaevents:dom-mediacontroller-volume><a href=#dom-mediacontroller-volume>volume</a></code> attribute or the <code id=mediaevents:dom-mediacontroller-muted><a href=#dom-mediacontroller-muted>muted</a></code> attribute has just been updated.
- </table>
- <p>The following events fire on <code id=mediaevents:audiotracklist><a href=#audiotracklist>AudioTrackList</a></code>, <code id=mediaevents:videotracklist><a href=#videotracklist>VideoTrackList</a></code>, and
- <code id=mediaevents:texttracklist><a href=#texttracklist>TextTrackList</a></code> objects:</p>
- <table><thead><tr><th>Event name
- <th>Interface
- <th>Fired when...
- <tbody><tr><td><dfn id=event-media-change><code>change</code></dfn>
- <td><code id=mediaevents:event-38><a href=#event>Event</a></code>
- <td>One or more tracks in the track list have been enabled or disabled.
- <tr><td><dfn id=event-media-addtrack><code>addtrack</code></dfn>
- <td><code id=mediaevents:trackevent><a href=#trackevent>TrackEvent</a></code>
- <td>A track has been added to the track list.
- <tr><td><dfn id=event-media-removetrack><code>removetrack</code></dfn>
- <td><code id=mediaevents:trackevent-2><a href=#trackevent>TrackEvent</a></code>
- <td>A track has been removed from the track list.
- </table>
- <p>The following event fires on <code id=mediaevents:texttrack><a href=#texttrack>TextTrack</a></code> objects and <code id=mediaevents:the-track-element><a href=#the-track-element>track</a></code> elements:</p>
- <table><thead><tr><th>Event name
- <th>Interface
- <th>Fired when...
- <tbody><tr><td><dfn id=event-media-cuechange><code>cuechange</code></dfn>
- <td><code id=mediaevents:event-39><a href=#event>Event</a></code>
- <td>One or more cues in the track have become active or stopped being active.
- </table>
- <p>The following events fire on <code id=mediaevents:texttrackcue><a href=#texttrackcue>TextTrackCue</a></code> objects:</p>
- <table><thead><tr><th>Event name
- <th>Interface
- <th>Fired when...
- <tbody><tr><td><dfn id=event-media-enter><code>enter</code></dfn>
- <td><code id=mediaevents:event-40><a href=#event>Event</a></code>
- <td>The cue has become active.
- <tr><td><dfn id=event-media-exit><code>exit</code></dfn>
- <td><code id=mediaevents:event-41><a href=#event>Event</a></code>
- <td>The cue has stopped being active.
- </table>
-
- <h5 id=security-and-privacy-considerations>4.8.14.17 Security and privacy considerations</h5>
- <p>The main security and privacy implications of the <code id=security-and-privacy-considerations:the-video-element><a href=#the-video-element>video</a></code> and <code id=security-and-privacy-considerations:the-audio-element><a href=#the-audio-element>audio</a></code>
- elements come from the ability to embed media cross-origin. There are two directions that threats
- can flow: from hostile content to a victim page, and from a hostile page to victim content.</p>
- <hr>
- <p>If a victim page embeds hostile content, the threat is that the content might contain scripted
- code that attempts to interact with the <code id=security-and-privacy-considerations:document><a href=#document>Document</a></code> that embeds the content. To avoid
- this, user agents must ensure that there is no access from the content to the embedding page. In
- the case of media content that uses DOM concepts, the embedded content must be treated as if it
- was in its own unrelated <a href=#top-level-browsing-context id=security-and-privacy-considerations:top-level-browsing-context>top-level browsing context</a>.</p>
- <p class=example>For instance, if an SVG animation was embedded in a <code id=security-and-privacy-considerations:the-video-element-2><a href=#the-video-element>video</a></code> element,
- the user agent would not give it access to the DOM of the outer page. From the perspective of
- scripts in the SVG resource, the SVG file would appear to be in a lone top-level browsing context
- with no parent.</p>
- <hr>
- <p>If a hostile page embeds victim content, the threat is that the embedding page could obtain
- information from the content that it would not otherwise have access to. The API does expose some
- information: the existence of the media, its type, its duration, its size, and the performance
- characteristics of its host. Such information is already potentially problematic, but in practice
- the same information can more or less be obtained using the <code id=security-and-privacy-considerations:the-img-element><a href=#the-img-element>img</a></code> element, and so it
- has been deemed acceptable.</p>
- <p>However, significantly more sensitive information could be obtained if the user agent further
- exposes metadata within the content such as subtitles or chapter titles. Such information is
- therefore only exposed if the video resource passes a CORS <a href=#resource-sharing-check id=security-and-privacy-considerations:resource-sharing-check>resource sharing check</a>.
- The <code id=security-and-privacy-considerations:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code> attribute allows authors to control
- how this check is performed. <a href=#refsFETCH>[FETCH]</a></p>
- <p class=example>Without this restriction, an attacker could trick a user running within a
- corporate network into visiting a site that attempts to load a video from a previously leaked
- location on the corporation's intranet. If such a video included confidential plans for a new
- product, then being able to read the subtitles would present a serious confidentiality breach.</p>
-
- <h5 id=best-practices-for-authors-using-media-elements>4.8.14.18 Best practices for authors using media elements</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Playing audio and video resources on small devices such as set-top boxes or mobile phones is
- often constrained by limited hardware resources in the device. For example, a device might only
- support three simultaneous videos. For this reason, it is a good practice to release resources
- held by <a href=#media-element id=best-practices-for-authors-using-media-elements:media-element>media elements</a> when they are done playing, either by
- being very careful about removing all references to the element and allowing it to be garbage
- collected, or, even better, by removing the element's <code id=best-practices-for-authors-using-media-elements:attr-media-src><a href=#attr-media-src>src</a></code>
- attribute and any <code id=best-practices-for-authors-using-media-elements:the-source-element><a href=#the-source-element>source</a></code> element descendants, and invoking the element's <code id=best-practices-for-authors-using-media-elements:dom-media-load><a href=#dom-media-load>load()</a></code> method.</p>
- <p>Similarly, when the playback rate is not exactly 1.0, hardware, software, or format limitations
- can cause video frames to be dropped and audio to be choppy or muted.</p>
-
- <h5 id=best-practices-for-implementors-of-media-elements>4.8.14.19 Best practices for implementors of media elements</h5>
- <p><i>This section is non-normative.</i></p>
- <p>How accurately various aspects of the <a href=#media-element id=best-practices-for-implementors-of-media-elements:media-element>media element</a> API are implemented is
- considered a quality-of-implementation issue.</p>
- <p>For example, when implementing the <code id=best-practices-for-implementors-of-media-elements:dom-media-buffered><a href=#dom-media-buffered>buffered</a></code> attribute,
- how precise an implementation reports the ranges that have been buffered depends on how carefully
- the user agent inspects the data. Since the API reports ranges as times, but the data is obtained
- in byte streams, a user agent receiving a variable-bit-rate stream might only be able to determine
- precise times by actually decoding all of the data. User agents aren't required to do this,
- however; they can instead return estimates (e.g. based on the average bit rate seen so far) which
- get revised as more information becomes available.</p>
- <p>As a general rule, user agents are urged to be conservative rather than optimistic. For
- example, it would be bad to report that everything had been buffered when it had not.</p>
- <p>Another quality-of-implementation issue would be playing a video backwards when the codec is
- designed only for forward playback (e.g. there aren't many key frames, and they are far apart, and
- the intervening frames only have deltas from the previous frame). User agents could do a poor job,
- e.g. only showing key frames; however, better implementations would do more work and thus do a
- better job, e.g. actually decoding parts of the video forwards, storing the complete frames, and
- then playing the frames backwards.</p>
- <p>Similarly, while implementations are allowed to drop buffered data at any time (there is no
- requirement that a user agent keep all the media data obtained for the lifetime of the media
- element), it is again a quality of implementation issue: user agents with sufficient resources to
- keep all the data around are encouraged to do so, as this allows for a better user experience. For
- example, if the user is watching a live stream, a user agent could allow the user only to view the
- live video; however, a better user agent would buffer everything and allow the user to seek
- through the earlier material, pause it, play it forwards and backwards, etc.</p>
- <p>When multiple tracks are synchronised with a <code id=best-practices-for-implementors-of-media-elements:mediacontroller><a href=#mediacontroller>MediaController</a></code>, it is possible for
- scripts to add and remove media elements from the <code id=best-practices-for-implementors-of-media-elements:mediacontroller-2><a href=#mediacontroller>MediaController</a></code>'s list of
- <a href=#slaved-media-elements id=best-practices-for-implementors-of-media-elements:slaved-media-elements>slaved media elements</a>, even while these tracks are playing. How smoothly the media
- plays back in such situations is another quality-of-implementation issue.</p>
- <hr>
- <p>When a <a href=#media-element id=best-practices-for-implementors-of-media-elements:media-element-2>media element</a> that is paused is <a href=#remove-an-element-from-a-document id=best-practices-for-implementors-of-media-elements:remove-an-element-from-a-document>removed from a document</a> and not reinserted before the next time the <a href=#event-loop id=best-practices-for-implementors-of-media-elements:event-loop>event
- loop</a> reaches step 1, implementations that are resource constrained are encouraged to take
- that opportunity to release all hardware resources (like video planes, networking resources, and
- data buffers) used by the <a href=#media-element id=best-practices-for-implementors-of-media-elements:media-element-3>media element</a>. (User agents still have to keep track of the
- playback position and so forth, though, in case playback is later restarted.)</p>
-
- <h4 id=the-map-element>4.8.15 The <dfn><code>map</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-map-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-map-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-map-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#palpable-content-2 id=the-map-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-map-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-map-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-map-element:concept-element-content-model>Content model</a>:<dd><a href=#transparent id=the-map-element:transparent>Transparent</a>.<dt><a href=#concept-element-tag-omission id=the-map-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-map-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-map-element:global-attributes>Global attributes</a><dd><code id=the-map-element:attr-map-name><a href=#attr-map-name>name</a></code> — Name of <a href=#image-map id=the-map-element:image-map>image map</a> to reference from the <code id=the-map-element:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute<dt><a href=#concept-element-dom id=the-map-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlmapelement>HTMLMapElement</dfn> : <a href=#htmlelement id=the-map-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-map-name id=the-map-element:dom-map-name>name</a>;
- readonly attribute <a href=#htmlcollection id=the-map-element:htmlcollection>HTMLCollection</a> <a href=#dom-map-areas id=the-map-element:dom-map-areas>areas</a>;
- readonly attribute <a href=#htmlcollection id=the-map-element:htmlcollection-2>HTMLCollection</a> <a href=#dom-map-images id=the-map-element:dom-map-images>images</a>;
- };</pre>
- </dl>
- <p>The <code id=the-map-element:the-map-element><a href=#the-map-element>map</a></code> element, in conjunction with an <code id=the-map-element:the-img-element><a href=#the-img-element>img</a></code> element and any
- <code id=the-map-element:the-area-element><a href=#the-area-element>area</a></code> element descendants, defines an <a href=#image-map id=the-map-element:image-map-2>image map</a>. The element
- <a href=#represents id=the-map-element:represents>represents</a> its children.</p>
- <p>The <dfn id=attr-map-name><code>name</code></dfn> attribute gives the map a name so that
- it can be referenced. The attribute must be present and must have a non-empty value with no <a href=#space-character id=the-map-element:space-character>space characters</a>. The value of the <code id=the-map-element:attr-map-name-2><a href=#attr-map-name>name</a></code> attribute must not be a <a href=#compatibility-caseless id=the-map-element:compatibility-caseless>compatibility-caseless</a> match for the value of the <code id=the-map-element:attr-map-name-3><a href=#attr-map-name>name</a></code> attribute of another <code id=the-map-element:the-map-element-2><a href=#the-map-element>map</a></code> element in the same
- document. If the <code id=the-map-element:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute is also specified, both attributes must
- have the same value.</p>
- <dl class=domintro><dt><var>map</var> . <code id=the-map-element:dom-map-areas-2><a href=#dom-map-areas>areas</a></code><dd>
- <p>Returns an <code id=the-map-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-map-element:the-area-element-2><a href=#the-area-element>area</a></code> elements in the
- <code id=the-map-element:the-map-element-3><a href=#the-map-element>map</a></code>.</p>
- <dt><var>map</var> . <code id=the-map-element:dom-map-images-2><a href=#dom-map-images>images</a></code><dd>
- <p>Returns an <code id=the-map-element:htmlcollection-4><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-map-element:the-img-element-2><a href=#the-img-element>img</a></code> and <code id=the-map-element:the-object-element><a href=#the-object-element>object</a></code>
- elements that use the <code id=the-map-element:the-map-element-4><a href=#the-map-element>map</a></code>.</p>
- </dl>
-
- <p>The <dfn id=dom-map-areas><code>areas</code></dfn> attribute must return an
- <code id=the-map-element:htmlcollection-5><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-map-element:the-map-element-5><a href=#the-map-element>map</a></code> element, whose filter matches only
- <code id=the-map-element:the-area-element-3><a href=#the-area-element>area</a></code> elements.</p>
- <p>The <dfn id=dom-map-images><code>images</code></dfn> attribute must return an
- <code id=the-map-element:htmlcollection-6><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-map-element:document><a href=#document>Document</a></code> node, whose filter matches only
- <code id=the-map-element:the-img-element-3><a href=#the-img-element>img</a></code> and <code id=the-map-element:the-object-element-2><a href=#the-object-element>object</a></code> elements that are associated with this <code id=the-map-element:the-map-element-6><a href=#the-map-element>map</a></code>
- element according to the <a href=#image-map id=the-map-element:image-map-3>image map</a> processing model.</p>
- <p>The IDL attribute <dfn id=dom-map-name><code>name</code></dfn> must <a href=#reflect id=the-map-element:reflect>reflect</a>
- the content attribute of the same name.</p>
-
- <div class=example>
- <p>Image maps can be defined in conjunction with other content on the page, to ease maintenance.
- This example is of a page with an image map at the top of the page and a corresponding set of
- text links at the bottom.</p>
- <pre><!DOCTYPE HTML>
- <TITLE>Babies™: Toys</TITLE>
- <HEADER>
- <H1>Toys</H1>
- <IMG SRC="/images/menu.gif"
- ALT="Babies™ navigation menu. Select a department to go to its page."
- USEMAP="#NAV">
- </HEADER>
- ...
- <FOOTER>
- <MAP NAME="NAV">
- <P>
- <A HREF="/clothes/">Clothes</A>
- <AREA ALT="Clothes" COORDS="0,0,100,50" HREF="/clothes/"> |
- <A HREF="/toys/">Toys</A>
- <AREA ALT="Toys" COORDS="100,0,200,50" HREF="/toys/"> |
- <A HREF="/food/">Food</A>
- <AREA ALT="Food" COORDS="200,0,300,50" HREF="/food/"> |
- <A HREF="/books/">Books</A>
- <AREA ALT="Books" COORDS="300,0,400,50" HREF="/books/">
- </MAP>
- </FOOTER></pre>
- </div>
- <h4 id=the-area-element>4.8.16 The <dfn><code>area</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-area-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-area-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-area-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-area-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-area-element:phrasing-content-2-2>phrasing content</a> is expected, but only if there is a <code id=the-area-element:the-map-element><a href=#the-map-element>map</a></code> element ancestor or a <code id=the-area-element:the-template-element><a href=#the-template-element>template</a></code> element ancestor.<dt><a href=#concept-element-content-model id=the-area-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-area-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-area-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-area-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-area-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-area-element:global-attributes>Global attributes</a><dd><code id=the-area-element:attr-area-alt><a href=#attr-area-alt>alt</a></code> — Replacement text for use when images are not available<dd><code id=the-area-element:attr-area-coords><a href=#attr-area-coords>coords</a></code> — Coordinates for the shape to be created in an <a href=#image-map id=the-area-element:image-map>image map</a><dd><code id=the-area-element:attr-area-shape><a href=#attr-area-shape>shape</a></code> — The kind of shape to be created in an <a href=#image-map id=the-area-element:image-map-2>image map</a><dd><code id=the-area-element:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> — Address of the <a href=#hyperlink id=the-area-element:hyperlink>hyperlink</a><dd><code id=the-area-element:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> — <a href=#browsing-context id=the-area-element:browsing-context>Browsing context</a> for <a href=#hyperlink id=the-area-element:hyperlink-2>hyperlink</a> <a href=#navigate id=the-area-element:navigate>navigation</a><dd><code id=the-area-element:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code> — Whether to download the resource instead of navigating to it, and its file name if so<dd><code id=the-area-element:ping><a href=#ping>ping</a></code> — <a href=#url id=the-area-element:url>URLs</a> to ping<dd><code id=the-area-element:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code> — Relationship between the document containing the hyperlink and the destination resource<dd><code id=the-area-element:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code> — Language of the linked resource<dd><code id=the-area-element:attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code> — Hint for the type of the referenced resource<dt><a href=#concept-element-dom id=the-area-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlareaelement>HTMLAreaElement</dfn> : <a href=#htmlelement id=the-area-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-area-alt id=the-area-element:dom-area-alt>alt</a>;
- attribute DOMString <a href=#dom-area-coords id=the-area-element:dom-area-coords>coords</a>;
- attribute DOMString <a href=#dom-area-shape id=the-area-element:dom-area-shape>shape</a>;
- attribute DOMString <a href=#dom-area-target id=the-area-element:dom-area-target>target</a>;
- attribute DOMString <a href=#dom-area-download id=the-area-element:dom-area-download>download</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=the-area-element:dom-domsettabletokenlist-value>value</a>] attribute <a href=#domsettabletokenlist id=the-area-element:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-area-ping id=the-area-element:dom-area-ping>ping</a>;
- attribute DOMString <a href=#dom-area-rel id=the-area-element:dom-area-rel>rel</a>;
- readonly attribute <a href=#domtokenlist id=the-area-element:domtokenlist>DOMTokenList</a> <a href=#dom-area-rellist id=the-area-element:dom-area-rellist>relList</a>;
- attribute DOMString <a href=#dom-area-hreflang id=the-area-element:dom-area-hreflang>hreflang</a>;
- attribute DOMString <a href=#dom-area-type id=the-area-element:dom-area-type>type</a>;
- // <a href="#HTMLAreaElement-partial">also has obsolete members</a>
- };
- <a href=#htmlareaelement id=the-area-element:htmlareaelement>HTMLAreaElement</a> implements <a href=#urlutils id=the-area-element:urlutils>URLUtils</a>;</pre>
- </dl>
- <p>The <code id=the-area-element:the-area-element><a href=#the-area-element>area</a></code> element <a href=#represents id=the-area-element:represents>represents</a> either a hyperlink with some text and a
- corresponding area on an <a href=#image-map id=the-area-element:image-map-3>image map</a>, or a dead area on an image map.</p>
- <p>An <code id=the-area-element:the-area-element-2><a href=#the-area-element>area</a></code> element with a parent node must have a <code id=the-area-element:the-map-element-2><a href=#the-map-element>map</a></code> element ancestor
- or a <code id=the-area-element:the-template-element-2><a href=#the-template-element>template</a></code> element ancestor.</p>
- <p>If the <code id=the-area-element:the-area-element-3><a href=#the-area-element>area</a></code> element has an <code id=the-area-element:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code>
- attribute, then the <code id=the-area-element:the-area-element-4><a href=#the-area-element>area</a></code> element represents a <a href=#hyperlink id=the-area-element:hyperlink-3>hyperlink</a>. In this case,
- the <dfn id=attr-area-alt><code>alt</code></dfn> attribute must be present. It specifies the
- text of the hyperlink. Its value must be text that, when presented with the texts specified for
- the other hyperlinks of the <a href=#image-map id=the-area-element:image-map-4>image map</a>, and with the alternative text of the image,
- but without the image itself, provides the user with the same kind of choice as the hyperlink
- would when used without its text but with its shape applied to the image. The <code id=the-area-element:attr-area-alt-2><a href=#attr-area-alt>alt</a></code> attribute may be left blank if there is another <code id=the-area-element:the-area-element-5><a href=#the-area-element>area</a></code>
- element in the same <a href=#image-map id=the-area-element:image-map-5>image map</a> that points to the same resource and has a non-blank
- <code id=the-area-element:attr-area-alt-3><a href=#attr-area-alt>alt</a></code> attribute.</p>
- <p>If the <code id=the-area-element:the-area-element-6><a href=#the-area-element>area</a></code> element has no <code id=the-area-element:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code>
- attribute, then the area represented by the element cannot be selected, and the <code id=the-area-element:attr-area-alt-4><a href=#attr-area-alt>alt</a></code> attribute must be omitted.</p>
- <p>In both cases, the <code id=the-area-element:attr-area-shape-2><a href=#attr-area-shape>shape</a></code> and <code id=the-area-element:attr-area-coords-2><a href=#attr-area-coords>coords</a></code> attributes specify the area.</p>
- <p>The <dfn id=attr-area-shape><code>shape</code></dfn> attribute is an <a href=#enumerated-attribute id=the-area-element:enumerated-attribute>enumerated
- attribute</a>. The following table lists the keywords defined for this attribute. The states
- given in the first cell of the rows with keywords give the states to which those keywords map.
- Some of the keywords are non-conforming, as noted in the last
- column.</p>
- <table><thead><tr><th>State
- <th>Keywords
- <th>Notes
- <tbody><tr><td rowspan=2><a href=#attr-area-shape-circle id=the-area-element:attr-area-shape-circle>Circle state</a>
- <td><dfn id=attr-area-shape-keyword-circle><code>circle</code></dfn>
- <td>
- <tr><td><dfn id=attr-area-shape-keyword-circ><code>circ</code></dfn>
- <td>Non-conforming
- <tr><td><a href=#attr-area-shape-default id=the-area-element:attr-area-shape-default>Default state</a>
- <td><dfn id=attr-area-shape-keyword-default><code>default</code></dfn>
- <td>
- <tr><td rowspan=2><a href=#attr-area-shape-poly id=the-area-element:attr-area-shape-poly>Polygon state</a>
- <td><dfn id=attr-area-shape-keyword-poly><code>poly</code></dfn>
- <td>
- <tr><td><dfn id=attr-area-shape-keyword-polygon><code>polygon</code></dfn>
- <td>Non-conforming
- <tr><td rowspan=2><a href=#attr-area-shape-rect id=the-area-element:attr-area-shape-rect>Rectangle state</a>
- <td><dfn id=attr-area-shape-keyword-rect><code>rect</code></dfn>
- <td>
- <tr><td><dfn id=attr-area-shape-keyword-rectangle><code>rectangle</code></dfn>
- <td>Non-conforming
- </table>
- <p>The attribute may be omitted. The <i id=the-area-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-area-shape-rect id=the-area-element:attr-area-shape-rect-2>rectangle</a> state.</p>
- <p>The <dfn id=attr-area-coords><code>coords</code></dfn> attribute must, if specified,
- contain a <a href=#valid-list-of-integers id=the-area-element:valid-list-of-integers>valid list of integers</a>. This attribute gives the coordinates for the shape
- described by the <code id=the-area-element:attr-area-shape-3><a href=#attr-area-shape>shape</a></code> attribute. The
- processing for this attribute is described as part of the <a href=#image-map id=the-area-element:image-map-6>image map</a> processing
- model.</p>
-
- <p>In the <dfn id=attr-area-shape-circle>circle state</dfn>, <code id=the-area-element:the-area-element-7><a href=#the-area-element>area</a></code> elements must
- have a <code id=the-area-element:attr-area-coords-3><a href=#attr-area-coords>coords</a></code> attribute present, with three integers, the
- last of which must be non-negative. The first integer must be the distance in CSS pixels from the
- left edge of the image to the center of the circle, the second integer must be the distance in CSS
- pixels from the top edge of the image to the center of the circle, and the third integer must be
- the radius of the circle, again in CSS pixels.</p>
- <p>In the <dfn id=attr-area-shape-default>default state</dfn> state, <code id=the-area-element:the-area-element-8><a href=#the-area-element>area</a></code>
- elements must not have a <code id=the-area-element:attr-area-coords-4><a href=#attr-area-coords>coords</a></code> attribute. (The area is the
- whole image.)</p>
- <p>In the <dfn id=attr-area-shape-poly>polygon state</dfn>, <code id=the-area-element:the-area-element-9><a href=#the-area-element>area</a></code> elements must
- have a <code id=the-area-element:attr-area-coords-5><a href=#attr-area-coords>coords</a></code> attribute with at least six integers, and the
- number of integers must be even. Each pair of integers must represent a coordinate given as the
- distances from the left and the top of the image in CSS pixels respectively, and all the
- coordinates together must represent the points of the polygon, in order.</p>
- <p>In the <dfn id=attr-area-shape-rect>rectangle state</dfn>, <code id=the-area-element:the-area-element-10><a href=#the-area-element>area</a></code> elements must
- have a <code id=the-area-element:attr-area-coords-6><a href=#attr-area-coords>coords</a></code> attribute with exactly four integers, the
- first of which must be less than the third, and the second of which must be less than the fourth.
- The four points must represent, respectively, the distance from the left edge of the image to the
- left side of the rectangle, the distance from the top edge to the top side, the distance from the
- left edge to the right side, and the distance from the top edge to the bottom side, all in CSS
- pixels.</p>
-
- <p>When user agents allow users to <a href=#following-hyperlinks-2 id=the-area-element:following-hyperlinks-2>follow hyperlinks</a> or
- <a href=#downloading-hyperlinks id=the-area-element:downloading-hyperlinks>download hyperlinks</a> created using the
- <code id=the-area-element:the-area-element-11><a href=#the-area-element>area</a></code> element, as described in the next section, the <code id=the-area-element:attr-hyperlink-href-4><a href=#attr-hyperlink-href>href</a></code>, <code id=the-area-element:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code>, <code id=the-area-element:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code>, and <code id=the-area-element:ping-2><a href=#ping>ping</a></code>
- attributes decide how the link is followed. The <code id=the-area-element:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>rel</a></code>, <code id=the-area-element:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code id=the-area-element:attr-hyperlink-type-2><a href=#attr-hyperlink-type>type</a></code>
- attributes may be used to indicate to the user the likely nature of the target resource before the
- user follows the link.</p>
-
- <p>The <code id=the-area-element:attr-hyperlink-target-3><a href=#attr-hyperlink-target>target</a></code>, <code id=the-area-element:attr-hyperlink-download-3><a href=#attr-hyperlink-download>download</a></code>, <code id=the-area-element:ping-3><a href=#ping>ping</a></code>,
- <code id=the-area-element:attr-hyperlink-rel-3><a href=#attr-hyperlink-rel>rel</a></code>, <code id=the-area-element:attr-hyperlink-hreflang-3><a href=#attr-hyperlink-hreflang>hreflang</a></code>, and <code id=the-area-element:attr-hyperlink-type-3><a href=#attr-hyperlink-type>type</a></code>
- attributes must be omitted if the <code id=the-area-element:attr-hyperlink-href-5><a href=#attr-hyperlink-href>href</a></code> attribute is not
- present.</p>
- <p>If the <code id=the-area-element:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is specified on an
- <code id=the-area-element:the-area-element-12><a href=#the-area-element>area</a></code> element, then the <code id=the-area-element:attr-hyperlink-href-6><a href=#attr-hyperlink-href>href</a></code> attribute must
- also be specified.</p>
-
- <p>The <a href=#activation-behavior id=the-area-element:activation-behavior>activation behavior</a> of <code id=the-area-element:the-area-element-13><a href=#the-area-element>area</a></code> elements is to run the following
- steps:</p>
- <ol><li><p>If the <code id=the-area-element:the-area-element-14><a href=#the-area-element>area</a></code> element's <a id=the-area-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-area-element:fully-active>fully active</a>,
- then abort these steps.<li>
- <p>If the <code id=the-area-element:the-area-element-15><a href=#the-area-element>area</a></code> element has a <code id=the-area-element:attr-hyperlink-download-4><a href=#attr-hyperlink-download>download</a></code>
- attribute and the algorithm is not <a href=#allowed-to-show-a-popup id=the-area-element:allowed-to-show-a-popup>allowed to show a popup</a>, or the element's <code id=the-area-element:attr-hyperlink-target-4><a href=#attr-hyperlink-target>target</a></code> attribute is present and applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=the-area-element:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules
- for choosing a browsing context given a browsing context name</a>, using the value of the
- <code id=the-area-element:attr-hyperlink-target-5><a href=#attr-hyperlink-target>target</a></code> attribute as the browsing context name, would
- result in there not being a chosen browsing context, then run these substeps:</p>
- <ol><li><p>If there is an <a href=#entry-settings-object id=the-area-element:entry-settings-object>entry settings object</a>, throw an
- <code id=the-area-element:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.<li><p>Abort these steps without following the hyperlink.</ol>
- <li><p>Otherwise, the user agent must <a href=#following-hyperlinks-2 id=the-area-element:following-hyperlinks-2-2>follow the
- hyperlink</a> or <a href=#downloading-hyperlinks id=the-area-element:downloading-hyperlinks-2>download the hyperlink</a> created
- by the <code id=the-area-element:the-area-element-16><a href=#the-area-element>area</a></code> element, if any, and as determined by the <code id=the-area-element:attr-hyperlink-download-5><a href=#attr-hyperlink-download>download</a></code> attribute and any expressed user
- preference.</ol>
- <p>The IDL attributes <dfn id=dom-area-alt><code>alt</code></dfn>, <dfn id=dom-area-coords><code>coords</code></dfn>, <dfn id=dom-area-target><code>target</code></dfn>, <dfn id=dom-area-download><code>download</code></dfn>, <dfn id=dom-area-ping><code>ping</code></dfn>, <dfn id=dom-area-rel><code>rel</code></dfn>,
- <dfn id=dom-area-hreflang><code>hreflang</code></dfn>, and <dfn id=dom-area-type><code>type</code></dfn>, each must <a href=#reflect id=the-area-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
- <p>The IDL attribute <dfn id=dom-area-shape><code>shape</code></dfn> must
- <a href=#reflect id=the-area-element:reflect-2>reflect</a> the <code id=the-area-element:attr-area-shape-4><a href=#attr-area-shape>shape</a></code> content attribute.</p>
- <p>The IDL attribute <dfn id=dom-area-rellist><code>relList</code></dfn> must
- <a href=#reflect id=the-area-element:reflect-3>reflect</a> the <code id=the-area-element:attr-hyperlink-rel-4><a href=#attr-hyperlink-rel>rel</a></code> content attribute.</p>
- <hr>
- <p>The <code id=the-area-element:the-area-element-17><a href=#the-area-element>area</a></code> element also supports the <code id=the-area-element:urlutils-2><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>
- <p>When the element is created, and whenever the element's <code id=the-area-element:attr-hyperlink-href-7><a href=#attr-hyperlink-href>href</a></code> content attribute is set, changed, or removed, the user
- agent must invoke the element's <code id=the-area-element:urlutils-3><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input id=the-area-element:concept-uu-set-the-input>set the input</a> algorithm with the value of the <code id=the-area-element:attr-hyperlink-href-8><a href=#attr-hyperlink-href>href</a></code> content attribute, if any, or the empty string otherwise,
- as the given value.</p>
- <p>The element's <code id=the-area-element:urlutils-4><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base id=the-area-element:concept-uu-get-the-base>get the
- base</a> algorithm must simply return <a href="#the-element's-base-url" id="the-area-element:the-element's-base-url">the element's base URL</a>.</p>
- <p>The element's <code id=the-area-element:urlutils-5><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding id=the-area-element:concept-uu-query-encoding>query
- encoding</a> is the <a href="#document's-character-encoding" id="the-area-element:document's-character-encoding">document's character encoding</a>.</p>
- <p>When the element's <code id=the-area-element:urlutils-6><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update id=the-area-element:concept-uu-update>update steps</a> with a string <var>value</var>, the user
- agent must set the element's <code id=the-area-element:attr-hyperlink-href-9><a href=#attr-hyperlink-href>href</a></code> content attribute to
- the string <var>value</var>.</p>
-
- <h4 id=image-maps>4.8.17 Image maps</h4>
-
-
- <h5 id=authoring>4.8.17.1 Authoring</h5>
-
- <p>An <dfn id=image-map>image map</dfn> allows geometric areas on an image to be associated with <a href=#hyperlink id=authoring:hyperlink>hyperlinks</a>.</p>
- <p>An image, in the form of an <code id=authoring:the-img-element><a href=#the-img-element>img</a></code> element or an <code id=authoring:the-object-element><a href=#the-object-element>object</a></code> element
- representing an image, may be associated with an image map (in the form of a <code id=authoring:the-map-element><a href=#the-map-element>map</a></code>
- element) by specifying a <dfn id=attr-hyperlink-usemap><code>usemap</code></dfn> attribute on
- the <code id=authoring:the-img-element-2><a href=#the-img-element>img</a></code> or <code id=authoring:the-object-element-2><a href=#the-object-element>object</a></code> element. The <code id=authoring:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute, if specified, must be a <a href=#valid-hash-name-reference id=authoring:valid-hash-name-reference>valid
- hash-name reference</a> to a <code id=authoring:the-map-element-2><a href=#the-map-element>map</a></code> element.</p>
- <div class=example>
- <p>Consider an image that looks as follows:</p>
- <p><img src=http://images.whatwg.org/sample-usemap.png width=600 alt="A line with four shapes in it, equally spaced: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star." height=150></p>
- <p>If we wanted just the coloured areas to be clickable, we could do it as follows:</p>
- <pre><p>
- Please select a shape:
- <img src="shapes.png" usemap="#shapes"
- alt="Four shapes are available: a red hollow box, a green circle, a blue triangle, and a yellow four-pointed star.">
- <map name="shapes">
- <area shape=rect coords="50,50,100,100"> <!-- the hole in the red box -->
- <area shape=rect coords="25,25,125,125" href="red.html" alt="Red box.">
- <area shape=circle coords="200,75,50" href="green.html" alt="Green circle.">
- <area shape=poly coords="325,25,262,125,388,125" href="blue.html" alt="Blue triangle.">
- <area shape=poly coords="450,25,435,60,400,75,435,90,450,125,465,90,500,75,465,60"
- href="yellow.html" alt="Yellow star.">
- </map>
- </p></pre>
- </div>
-
- <h5 id=processing-model-2>4.8.17.2 Processing model</h5>
- <p>If an <code id=processing-model-2:the-img-element><a href=#the-img-element>img</a></code> element or an <code id=processing-model-2:the-object-element><a href=#the-object-element>object</a></code> element representing an image has a
- <code id=processing-model-2:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute specified, user agents must process it
- as follows:</p>
- <ol><li><p>Parse the attribute's value using the <a href=#rules-for-parsing-a-hash-name-reference id=processing-model-2:rules-for-parsing-a-hash-name-reference>rules for parsing a hash-name reference</a> to a <code id=processing-model-2:the-map-element><a href=#the-map-element>map</a></code> element, with the element's <a id=processing-model-2:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> as the context node.
- This will return either an element (the <var>map</var>) or
- null.<li><p>If that returned null, then abort these steps. The image is not associated with an image
- map after all.<li><p>Otherwise, the user agent must collect all the <code id=processing-model-2:the-area-element><a href=#the-area-element>area</a></code> elements that are
- descendants of the <var>map</var>. Let those be the <var>areas</var>.</ol>
- <p>Having obtained the list of <code id=processing-model-2:the-area-element-2><a href=#the-area-element>area</a></code> elements that form the image map (the <var>areas</var>), interactive user agents must process the list in one of two ways.</p>
- <p>If the user agent intends to show the text that the <code id=processing-model-2:the-img-element-2><a href=#the-img-element>img</a></code> element represents, then
- it must use the following steps.</p>
- <p class=note>In user agents that do not support images, or that have images disabled,
- <code id=processing-model-2:the-object-element-2><a href=#the-object-element>object</a></code> elements cannot represent images, and thus this section never applies (the
- <a href=#fallback-content id=processing-model-2:fallback-content>fallback content</a> is shown instead). The following steps therefore only apply to
- <code id=processing-model-2:the-img-element-3><a href=#the-img-element>img</a></code> elements.</p>
- <ol><li><p>Remove all the <code id=processing-model-2:the-area-element-3><a href=#the-area-element>area</a></code> elements in <var>areas</var> that have no <code id=processing-model-2:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute.<li><p>Remove all the <code id=processing-model-2:the-area-element-4><a href=#the-area-element>area</a></code> elements in <var>areas</var> that have no <code id=processing-model-2:attr-area-alt><a href=#attr-area-alt>alt</a></code> attribute, or whose <code id=processing-model-2:attr-area-alt-2><a href=#attr-area-alt>alt</a></code>
- attribute's value is the empty string, <em>if</em> there is another <code id=processing-model-2:the-area-element-5><a href=#the-area-element>area</a></code> element in
- <var>areas</var> with the same value in the <code id=processing-model-2:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute and with a non-empty <code id=processing-model-2:attr-area-alt-3><a href=#attr-area-alt>alt</a></code> attribute.<li><p>Each remaining <code id=processing-model-2:the-area-element-6><a href=#the-area-element>area</a></code> element in <var>areas</var> represents a
- <a href=#hyperlink id=processing-model-2:hyperlink>hyperlink</a>. Those hyperlinks should all be made available to the user in a manner
- associated with the text of the <code id=processing-model-2:the-img-element-4><a href=#the-img-element>img</a></code>.</p>
- <p>In this context, user agents may represent <code id=processing-model-2:the-area-element-7><a href=#the-area-element>area</a></code> and <code id=processing-model-2:the-img-element-5><a href=#the-img-element>img</a></code> elements
- with no specified <code>alt</code> attributes, or whose <code>alt</code>
- attributes are the empty string or some other non-visible text, in a user-agent-defined fashion
- intended to indicate the lack of suitable author-provided text.</ol>
- <p>If the user agent intends to show the image and allow interaction with the image to select
- hyperlinks, then the image must be associated with a set of layered shapes, taken from the
- <code id=processing-model-2:the-area-element-8><a href=#the-area-element>area</a></code> elements in <var>areas</var>, in reverse <a href=#tree-order id=processing-model-2:tree-order>tree order</a> (so the last
- specified <code id=processing-model-2:the-area-element-9><a href=#the-area-element>area</a></code> element in the <var>map</var> is the bottom-most shape, and
- the first element in the <var>map</var>, in <a href=#tree-order id=processing-model-2:tree-order-2>tree order</a>, is the top-most shape).</p>
- <p>Each <code id=processing-model-2:the-area-element-10><a href=#the-area-element>area</a></code> element in <var>areas</var> must be processed as follows to
- obtain a shape to layer onto the image:</p>
- <ol><li><p>Find the state that the element's <code id=processing-model-2:attr-area-shape><a href=#attr-area-shape>shape</a></code> attribute
- represents.<li><p>Use the <a href=#rules-for-parsing-a-list-of-integers id=processing-model-2:rules-for-parsing-a-list-of-integers>rules for parsing a list of integers</a> to parse the element's <code id=processing-model-2:attr-area-coords><a href=#attr-area-coords>coords</a></code> attribute, if it is present, and let the result be the
- <var>coords</var> list. If the attribute is absent, let the <var>coords</var>
- list be the empty list.<li>
- <p>If the number of items in the <var>coords</var> list is less than the minimum number
- given for the <code id=processing-model-2:the-area-element-11><a href=#the-area-element>area</a></code> element's current state, as per the following table, then the
- shape is empty; abort these steps.</p>
- <table><thead><tr><th>State
- <th>Minimum number of items
- <tbody><tr><td><a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle>Circle state</a>
- <td>3
- <tr><td><a href=#attr-area-shape-default id=processing-model-2:attr-area-shape-default>Default state</a>
- <td>0
- <tr><td><a href=#attr-area-shape-poly id=processing-model-2:attr-area-shape-poly>Polygon state</a>
- <td>6
- <tr><td><a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect>Rectangle state</a>
- <td>4
- </table>
- <li>
- <p>Check for excess items in the <var>coords</var> list as per the entry in the
- following list corresponding to the <code id=processing-model-2:attr-area-shape-2><a href=#attr-area-shape>shape</a></code> attribute's
- state:</p>
- <dl class=switch><dt><a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle-2>Circle state</a><dd>Drop any items in the list beyond the third.<dt><a href=#attr-area-shape-default id=processing-model-2:attr-area-shape-default-2>Default state</a><dd>Drop all items in the list.<dt><a href=#attr-area-shape-poly id=processing-model-2:attr-area-shape-poly-2>Polygon state</a><dd>Drop the last item if there's an odd number of items.<dt><a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect-2>Rectangle state</a><dd>Drop any items in the list beyond the fourth.</dl>
- <li><p>If the <code id=processing-model-2:attr-area-shape-3><a href=#attr-area-shape>shape</a></code> attribute represents the <a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect-3>rectangle state</a>, and the first number in the list is
- numerically less than the third number in the list, then swap those two numbers around.<li><p>If the <code id=processing-model-2:attr-area-shape-4><a href=#attr-area-shape>shape</a></code> attribute represents the <a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect-4>rectangle state</a>, and the second number in the list is
- numerically greater than the fourth number in the list, then swap those two numbers around.<li><p>If the <code id=processing-model-2:attr-area-shape-5><a href=#attr-area-shape>shape</a></code> attribute represents the <a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle-3>circle state</a>, and the third number in the list is less than
- or equal to zero, then the shape is empty; abort these steps.<li><p>Now, the shape represented by the element is the one described for the entry in the list
- below corresponding to the state of the <code id=processing-model-2:attr-area-shape-6><a href=#attr-area-shape>shape</a></code> attribute:</p>
- <dl class=switch><dt><a href=#attr-area-shape-circle id=processing-model-2:attr-area-shape-circle-4>Circle state</a><dd>
- <p>Let <var>x</var> be the first number in <var>coords</var>, <var>y</var> be the second number, and <var>r</var> be the third number.</p>
- <p>The shape is a circle whose center is <var>x</var> CSS pixels from the left edge
- of the image and <var>y</var> CSS pixels from the top edge of the image, and whose
- radius is <var>r</var> pixels.</p>
- <dt><a href=#attr-area-shape-default id=processing-model-2:attr-area-shape-default-3>Default state</a><dd>
- <p>The shape is a rectangle that exactly covers the entire image.</p>
- <dt><a href=#attr-area-shape-poly id=processing-model-2:attr-area-shape-poly-3>Polygon state</a><dd>
- <p>Let <var>x<sub><var>i</var></sub></var> be the <span>(2<var>i</var>)</span>th entry in <var>coords</var>, and <var>y<sub><var>i</var></sub></var> be the <span>(2<var>i</var>+1)</span>th entry in <var>coords</var> (the first entry in <var>coords</var> being the one with index 0).</p>
- <p>Let <var>the coordinates</var> be (<var>x<sub><var>i</var></sub></var>, <var>y<sub><var>i</var></sub></var>),
- interpreted in CSS pixels measured from the top left of the image, for all integer values of
- <var>i</var> from 0 to <span>(<var>N</var>/2)-1</span>, where <var>N</var> is the number of items in <var>coords</var>.</p>
- <p>The shape is a polygon whose vertices are given by <var>the coordinates</var>, and
- whose interior is established using the even-odd rule. <a href=#refsGRAPHICS>[GRAPHICS]</a></p>
-
- <dt><a href=#attr-area-shape-rect id=processing-model-2:attr-area-shape-rect-5>Rectangle state</a><dd>
- <p>Let <var>x<sub>1</sub></var> be the first number in <var>coords</var>, <var>y<sub>1</sub></var> be the second number, <var>x<sub>2</sub></var> be the third number, and <var>y<sub>2</sub></var> be the fourth number.</p>
- <p>The shape is a rectangle whose top-left corner is given by the coordinate (<var>x<sub>1</sub></var>, <var>y<sub>1</sub></var>) and whose
- bottom right corner is given by the coordinate (<var>x<sub>2</sub></var>,
- <var>y<sub>2</sub></var>), those coordinates being interpreted as CSS pixels
- from the top left corner of the image.</p>
- </dl>
- <p>For historical reasons, the coordinates must be interpreted relative to the
- <em>displayed</em> image after any stretching caused by the CSS 'width' and 'height' properties
- (or, for non-CSS browsers, the image element's <code>width</code> and <code>height</code> attributes — CSS browsers map those attributes to the
- aforementioned CSS properties).</p>
- <p class=note>Browser zoom features and transforms applied using CSS or SVG do not affect the
- coordinates.</p>
- </ol>
- <p>Pointing device interaction with an image associated with a set of layered shapes per the above
- algorithm must result in the relevant user interaction events being first fired to the top-most
- shape covering the point that the pointing device indicated, if any, or to the image element
- itself, if there is no shape covering that point. User agents may also allow individual
- <code id=processing-model-2:the-area-element-12><a href=#the-area-element>area</a></code> elements representing <a href=#hyperlink id=processing-model-2:hyperlink-2>hyperlinks</a> to be selected
- and activated (e.g. using a keyboard).</p>
- <p class=note>Because a <code id=processing-model-2:the-map-element-2><a href=#the-map-element>map</a></code> element (and its <code id=processing-model-2:the-area-element-13><a href=#the-area-element>area</a></code> elements) can be
- associated with multiple <code id=processing-model-2:the-img-element-6><a href=#the-img-element>img</a></code> and <code id=processing-model-2:the-object-element-3><a href=#the-object-element>object</a></code> elements, it is possible for an
- <code id=processing-model-2:the-area-element-14><a href=#the-area-element>area</a></code> element to correspond to multiple <i id=processing-model-2:focusable-area><a href=#focusable-area>focusable areas</a></i>
- of the document.</p>
- <p>Image maps are <a href=#live id=processing-model-2:live>live</a>; if the DOM is mutated, then the user agent must act as if it
- had rerun the algorithms for image maps.</p>
-
- <h4 id=mathml>4.8.18 MathML</h4>
- <p>The <dfn id=math><code>math</code></dfn> element from the <a href=#mathml-namespace id=mathml:mathml-namespace>MathML namespace</a>
- falls into the <a href=#embedded-content-category id=mathml:embedded-content-category>embedded content</a>, <a href=#phrasing-content-2 id=mathml:phrasing-content-2>phrasing content</a>, and <a href=#flow-content-2 id=mathml:flow-content-2>flow
- content</a> categories for the purposes of the content models in this specification.</p>
- <p>This specification refers to several specific MathML elements, in particular:
- <dfn id=math:annotation-xml><code>annotation-xml</code></dfn>,
- <dfn id=math:merror><code>merror</code></dfn>,
- <dfn id=math:mi><code>mi</code></dfn>,
- <dfn id=math:mn><code>mn</code></dfn>,
- <dfn id=math:mo><code>mo</code></dfn>,
- <dfn id=math:ms><code>ms</code></dfn>, and
- <dfn id=math:mtext><code>mtext</code></dfn>.
- </p>
- <p>When the MathML <code id=mathml:math:annotation-xml><a href=#math:annotation-xml>annotation-xml</a></code> element contains
- elements from the <a href=#html-namespace-2 id=mathml:html-namespace-2>HTML namespace</a>, such elements must all be <a href=#flow-content-2 id=mathml:flow-content-2-2>flow
- content</a>. <a href=#refsMATHML>[MATHML]</a></p>
- <p>When the MathML token elements (<code id=mathml:math:mi><a href=#math:mi>mi</a></code>, <code id=mathml:math:mo><a href=#math:mo>mo</a></code>, <code id=mathml:math:mn><a href=#math:mn>mn</a></code>, <code id=mathml:math:ms><a href=#math:ms>ms</a></code>,
- and <code id=mathml:math:mtext><a href=#math:mtext>mtext</a></code>) are descendants of HTML elements, they may contain
- <a href=#phrasing-content-2 id=mathml:phrasing-content-2-2>phrasing content</a> elements from the <a href=#html-namespace-2 id=mathml:html-namespace-2-2>HTML namespace</a>. <a href=#refsMATHML>[MATHML]</a></p>
-
-
-
- <p>User agents must handle text other than <a href=#inter-element-whitespace id=mathml:inter-element-whitespace>inter-element whitespace</a> found in MathML
- elements whose content models do not allow straight text by pretending for the purposes of MathML
- content models, layout, and rendering that that text is actually wrapped in an <code id=mathml:math:mtext-2><a href=#math:mtext>mtext</a></code> element in the <a href=#mathml-namespace id=mathml:mathml-namespace-2>MathML namespace</a>. (Such text is not,
- however, conforming.)</p>
- <p>User agents must act as if any MathML element whose contents does not match the element's
- content model was replaced, for the purposes of MathML layout and rendering, by an <code id=mathml:math:merror><a href=#math:merror>merror</a></code> element in the <a href=#mathml-namespace id=mathml:mathml-namespace-3>MathML namespace</a> containing some
- appropriate error message.</p>
- <p>To enable authors to use MathML tools that only accept MathML in its XML form, interactive HTML
- user agents are encouraged to provide a way to export any MathML fragment as an XML
- namespace-well-formed XML fragment.</p>
-
- <p>The semantics of MathML elements are defined by the MathML specification and <a href=#other-applicable-specifications id=mathml:other-applicable-specifications>other
- applicable specifications</a>. <a href=#refsMATHML>[MATHML]</a></p>
- <div class=example>
- <p>Here is an example of the use of MathML in an HTML document:</p>
- <pre><!DOCTYPE html>
- <html>
- <head>
- <title>The quadratic formula</title>
- </head>
- <body>
- <h1>The quadratic formula</h1>
- <p>
- <math>
- <mi>x</mi>
- <mo>=</mo>
- <mfrac>
- <mrow>
- <mo form="prefix">−</mo> <mi>b</mi>
- <mo>±</mo>
- <msqrt>
- <msup> <mi>b</mi> <mn>2</mn> </msup>
- <mo>−</mo>
- <mn>4</mn> <mo></mo> <mi>a</mi> <mo></mo> <mi>c</mi>
- </msqrt>
- </mrow>
- <mrow>
- <mn>2</mn> <mo></mo> <mi>a</mi>
- </mrow>
- </mfrac>
- </math>
- </p>
- </body>
- </html></pre>
- </div>
- <h4 id=svg>4.8.19 SVG</h4>
- <p>The <dfn id=svg-2><code>svg</code></dfn> element from the <a href=#svg-namespace id=svg:svg-namespace>SVG namespace</a> falls into the
- <a href=#embedded-content-category id=svg:embedded-content-category>embedded content</a>, <a href=#phrasing-content-2 id=svg:phrasing-content-2>phrasing content</a>, and <a href=#flow-content-2 id=svg:flow-content-2>flow content</a>
- categories for the purposes of the content models in this specification.</p>
-
- <p>To enable authors to use SVG tools that only accept SVG in its XML form, interactive HTML user
- agents are encouraged to provide a way to export any SVG fragment as an XML namespace-well-formed
- XML fragment.</p>
-
- <p>When the SVG <code>foreignObject</code> element contains elements from the <a href=#html-namespace-2 id=svg:html-namespace-2>HTML
- namespace</a>, such elements must all be <a href=#flow-content-2 id=svg:flow-content-2-2>flow content</a>. <a href=#refsSVG>[SVG]</a></p>
- <p>The content model for <code>title</code> elements in the <a href=#svg-namespace id=svg:svg-namespace-2>SVG namespace</a>
- inside <a href=#html-documents id=svg:html-documents>HTML documents</a> is <a href=#phrasing-content-2 id=svg:phrasing-content-2-2>phrasing content</a>. (This further constrains the
- requirements given in the SVG specification.)</p>
- <p>The semantics of SVG elements are defined by the SVG specification and <a href=#other-applicable-specifications id=svg:other-applicable-specifications>other applicable
- specifications</a>. <a href=#refsSVG>[SVG]</a></p>
- <h4 id=dimension-attributes>4.8.20 <dfn>Dimension attributes</dfn></h4>
- <p><strong>Author requirements</strong>: The <dfn id=attr-dim-width><code>width</code></dfn> and <dfn id=attr-dim-height><code>height</code></dfn> attributes on <code id=dimension-attributes:the-img-element><a href=#the-img-element>img</a></code>, <code id=dimension-attributes:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=dimension-attributes:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=dimension-attributes:the-object-element><a href=#the-object-element>object</a></code>, <code id=dimension-attributes:the-video-element><a href=#the-video-element>video</a></code>, and, when their <code id=dimension-attributes:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="dimension-attributes:image-button-state-(type=image)">Image Button</a> state, <code id=dimension-attributes:the-input-element><a href=#the-input-element>input</a></code> elements may be
- specified to give the dimensions of the visual content of the element (the width and height
- respectively, relative to the nominal direction of the output medium), in CSS pixels. The
- attributes, if specified, must have values that are <a href=#valid-non-negative-integer id=dimension-attributes:valid-non-negative-integer>valid non-negative integers</a>.</p>
- <p>The specified dimensions given may differ from the dimensions specified in the resource itself,
- since the resource may have a resolution that differs from the CSS pixel resolution. (On screens,
- CSS pixels have a resolution of 96ppi, but in general the CSS pixel resolution depends on the
- reading distance.) If both attributes are specified, then one of the following statements must be
- true:</p>
- <ul><li><span><var>specified width</var> - 0.5 ≤
- <var>specified height</var> * <var>target ratio</var> ≤
- <var>specified width</var> + 0.5</span><li><span><var>specified height</var> - 0.5 ≤
- <var>specified width</var> / <var>target ratio</var> ≤
- <var>specified height</var> + 0.5</span><li><span><var>specified height</var> = <var>specified width</var> = 0</span></ul>
- <p>The <var>target ratio</var> is the ratio of the intrinsic width to the intrinsic
- height in the resource. The <var>specified width</var> and <var>specified
- height</var> are the values of the <code id=dimension-attributes:attr-dim-width><a href=#attr-dim-width>width</a></code> and <code id=dimension-attributes:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.</p>
- <p>The two attributes must be omitted if the resource in question does not have both an intrinsic
- width and an intrinsic height.</p>
- <p>If the two attributes are both zero, it indicates that the element is not intended for the user
- (e.g. it might be a part of a service to count page views).</p>
- <p class=note>The dimension attributes are not intended to be used to stretch the image.</p>
-
- <p><strong>User agent requirements</strong>: User agents are expected to use these attributes <a href=#dimRendering>as hints for the rendering</a>.</p>
- <p>The <dfn id=dom-dim-width><code>width</code></dfn> and <dfn id=dom-dim-height><code>height</code></dfn> IDL attributes on the <code id=dimension-attributes:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>,
- <code id=dimension-attributes:the-embed-element-2><a href=#the-embed-element>embed</a></code>, <code id=dimension-attributes:the-object-element-2><a href=#the-object-element>object</a></code>, and <code id=dimension-attributes:the-video-element-2><a href=#the-video-element>video</a></code> elements must <a href=#reflect id=dimension-attributes:reflect>reflect</a>
- the respective content attributes of the same name.</p>
- <p class=note>For <code id=dimension-attributes:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>, <code id=dimension-attributes:the-embed-element-3><a href=#the-embed-element>embed</a></code>, and <code id=dimension-attributes:the-object-element-3><a href=#the-object-element>object</a></code> the IDL
- attributes are <code id=dimension-attributes:idl-domstring><a href=#idl-domstring>DOMString</a></code>; for <code id=dimension-attributes:the-video-element-3><a href=#the-video-element>video</a></code> the IDL attributes are <code id=dimension-attributes:idl-unsigned-long><a href=#idl-unsigned-long>unsigned long</a></code>.</p>
- <p class=note>The corresponding IDL attributes for <code id=dimension-attributes:dom-img-height><a href=#dom-img-height>img</a></code> and
- <code id=dimension-attributes:dom-input-height><a href=#dom-input-height>input</a></code> elements are defined in those respective elements'
- sections, as they are slightly more specific to those elements' other behaviors.</p>
-
- <h3 id=tables>4.9 Tabular data</h3>
- <h4 id=the-table-element>4.9.1 The <dfn><code>table</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-table-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-table-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-table-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-table-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-table-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-table-element:concept-element-content-model>Content model</a>:<dd>In this order: optionally a <code id=the-table-element:the-caption-element><a href=#the-caption-element>caption</a></code> element,
- followed by zero or more <code id=the-table-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> elements, followed
- optionally by a <code id=the-table-element:the-thead-element><a href=#the-thead-element>thead</a></code> element, followed optionally by
- a <code id=the-table-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element, followed by either zero or more
- <code id=the-table-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code> elements or one or more <code id=the-table-element:the-tr-element><a href=#the-tr-element>tr</a></code>
- elements, followed optionally by a <code id=the-table-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element (but
- there can only be one <code id=the-table-element:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> element child in
- total), optionally intermixed with one or more <a href=#script-supporting-elements-2 id=the-table-element:script-supporting-elements-2>script-supporting elements</a>.<dt><a href=#concept-element-tag-omission id=the-table-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-table-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-table-element:global-attributes>Global attributes</a><dd><code id=the-table-element:attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> — Enables a sorting interface for the table<dt><a href=#concept-element-dom id=the-table-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltableelement>HTMLTableElement</dfn> : <a href=#htmlelement id=the-table-element:htmlelement>HTMLElement</a> {
- attribute <a href=#htmltablecaptionelement id=the-table-element:htmltablecaptionelement>HTMLTableCaptionElement</a>? <a href=#dom-table-caption id=the-table-element:dom-table-caption>caption</a>;
- <a href=#htmlelement id=the-table-element:htmlelement-2>HTMLElement</a> <a href=#dom-table-createcaption id=the-table-element:dom-table-createcaption>createCaption</a>();
- void <a href=#dom-table-deletecaption id=the-table-element:dom-table-deletecaption>deleteCaption</a>();
- attribute <a href=#htmltablesectionelement id=the-table-element:htmltablesectionelement>HTMLTableSectionElement</a>? <a href=#dom-table-thead id=the-table-element:dom-table-thead>tHead</a>;
- <a href=#htmlelement id=the-table-element:htmlelement-3>HTMLElement</a> <a href=#dom-table-createthead id=the-table-element:dom-table-createthead>createTHead</a>();
- void <a href=#dom-table-deletethead id=the-table-element:dom-table-deletethead>deleteTHead</a>();
- attribute <a href=#htmltablesectionelement id=the-table-element:htmltablesectionelement-2>HTMLTableSectionElement</a>? <a href=#dom-table-tfoot id=the-table-element:dom-table-tfoot>tFoot</a>;
- <a href=#htmlelement id=the-table-element:htmlelement-4>HTMLElement</a> <a href=#dom-table-createtfoot id=the-table-element:dom-table-createtfoot>createTFoot</a>();
- void <a href=#dom-table-deletetfoot id=the-table-element:dom-table-deletetfoot>deleteTFoot</a>();
- readonly attribute <a href=#htmlcollection id=the-table-element:htmlcollection>HTMLCollection</a> <a href=#dom-table-tbodies id=the-table-element:dom-table-tbodies>tBodies</a>;
- <a href=#htmlelement id=the-table-element:htmlelement-5>HTMLElement</a> <a href=#dom-table-createtbody id=the-table-element:dom-table-createtbody>createTBody</a>();
- readonly attribute <a href=#htmlcollection id=the-table-element:htmlcollection-2>HTMLCollection</a> <a href=#dom-table-rows id=the-table-element:dom-table-rows>rows</a>;
- <a href=#htmlelement id=the-table-element:htmlelement-6>HTMLElement</a> <a href=#dom-table-insertrow id=the-table-element:dom-table-insertrow>insertRow</a>(optional long index = -1);
- void <a href=#dom-table-deleterow id=the-table-element:dom-table-deleterow>deleteRow</a>(long index);
- attribute boolean <a href=#dom-table-sortable id=the-table-element:dom-table-sortable>sortable</a>;
- void <a href=#dom-table-stopsorting id=the-table-element:dom-table-stopsorting>stopSorting</a>();
- // <a href="#HTMLTableElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-table-element:the-table-element><a href=#the-table-element>table</a></code> element <a href=#represents id=the-table-element:represents>represents</a> data with more than one dimension, in
- the form of a <a href=#concept-table id=the-table-element:concept-table>table</a>.</p>
- <p>The <code id=the-table-element:the-table-element-2><a href=#the-table-element>table</a></code> element takes part in the <a href=#table-model id=the-table-element:table-model>table
- model</a>. Tables have rows, columns, and cells given by their descendants. The rows and
- columns form a grid; a table's cells must completely cover that grid without overlap.</p>
-
- <p class=note>Precise rules for determining whether this conformance requirement is met are
- described in the description of the <a href=#table-model id=the-table-element:table-model-2>table model</a>.</p>
-
- <p>Authors are encouraged to provide information describing how to interpret complex tables.
- Guidance on how to <a href=#table-descriptions-techniques>provide such information</a> is given
- below.</p>
- <p>Tables must not be used as layout aids. Historically, some Web authors have misused tables in
- HTML as a way to control their page layout. This usage is non-conforming, because tools attempting
- to extract tabular data from such documents would obtain very confusing results. In particular,
- users of accessibility tools like screen readers are likely to find it very difficult to navigate
- pages with tables used for layout.</p>
- <p class=note>There are a variety of alternatives to using HTML tables for layout, primarily
- using CSS positioning and the CSS table model. <a href=#refsCSS>[CSS]</a></p>
-
- <hr>
- <p>Tables can be complicated to understand and navigate. To help users with this, user agents
- should clearly delineate cells in a table from each other, unless the user agent has classified
- the table as a (non-conforming) layout table.</p>
-
- <p class=note>Authors and implementors are encouraged to consider
- using some of the <a href=#table-layout-techniques>table design techniques</a> described below
- to make tables easier to navigate for users.</p>
-
- <p>User agents, especially those that do table analysis on arbitrary content, are encouraged to
- find heuristics to determine which tables actually contain data and which are merely being used
- for layout. This specification does not define a precise heuristic, but the following are
- suggested as possible indicators:</p>
- <table><thead><tr><th>Feature
- <th>Indication
- <tbody><tr><td>The use of the <code id=the-table-element:attr-aria-role><a href=#attr-aria-role>role</a></code> attribute with the value <code id=the-table-element:attr-aria-role-presentation><a data-x-internal=attr-aria-role-presentation href=http://www.w3.org/TR/wai-aria/roles#presentation>presentation</a></code>
- <td>Probably a layout table
- <tr><td>The use of the non-conforming <code id=the-table-element:attr-table-border><a href=#attr-table-border>border</a></code> attribute with the non-conforming value 0
- <td>Probably a layout table
- <tr><td>The use of the non-conforming <code id=the-table-element:attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> and
- <code id=the-table-element:attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> attributes with the value 0
- <td>Probably a layout table
- <tbody><tr><td>The use of <code id=the-table-element:the-caption-element-2><a href=#the-caption-element>caption</a></code>, <code id=the-table-element:the-thead-element-2><a href=#the-thead-element>thead</a></code>, or <code id=the-table-element:the-th-element><a href=#the-th-element>th</a></code> elements
- <td>Probably a non-layout table
- <tr><td>The use of the <code id=the-table-element:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> and <code id=the-table-element:attr-th-scope><a href=#attr-th-scope>scope</a></code> attributes
- <td>Probably a non-layout table
- <tr><td>The use of the non-conforming <code id=the-table-element:attr-table-border-2><a href=#attr-table-border>border</a></code> attribute with a value other than 0
- <td>Probably a non-layout table
- <tr><td>Explicit visible borders set using CSS
- <td>Probably a non-layout table
- <tbody><tr><td>The use of the <code id=the-table-element:attr-table-summary><a href=#attr-table-summary>summary</a></code> attribute
- <td>Not a good indicator (both layout and non-layout tables have historically been given this attribute)
- </table>
- <p class=note>It is quite possible that the above suggestions are wrong. Implementors are urged
- to provide feedback elaborating on their experiences with trying to create a layout table
- detection heuristic.</p>
- <p>If a <code id=the-table-element:the-table-element-3><a href=#the-table-element>table</a></code> element has a (non-conforming) <code id=the-table-element:attr-table-summary-2><a href=#attr-table-summary>summary</a></code> attribute, and the user agent has not classified the
- table as a layout table, the user agent may report the contents of that attribute to the user.</p>
-
- <hr>
- <p>The <code id=the-table-element:attr-table-sortable-2><a href=#attr-table-sortable>sortable</a></code> attribute is used in the <a href=#table-sorting-model id=the-table-element:table-sorting-model>table
- sorting model</a>.</p>
- <hr>
- <dl class=domintro><dt><var>table</var> . <code id=the-table-element:dom-table-caption-2><a href=#dom-table-caption>caption</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the table's <code id=the-table-element:the-caption-element-3><a href=#the-caption-element>caption</a></code> element.</p>
- <p>Can be set, to replace the <code id=the-table-element:the-caption-element-4><a href=#the-caption-element>caption</a></code> element.</p>
- <dt><var>caption</var> = <var>table</var> . <code id=the-table-element:dom-table-createcaption-2><a href=#dom-table-createcaption>createCaption</a></code>()<dd>
- <p>Ensures the table has a <code id=the-table-element:the-caption-element-5><a href=#the-caption-element>caption</a></code> element, and returns it.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-deletecaption-2><a href=#dom-table-deletecaption>deleteCaption</a></code>()<dd>
- <p>Ensures the table does not have a <code id=the-table-element:the-caption-element-6><a href=#the-caption-element>caption</a></code> element.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-thead-2><a href=#dom-table-thead>tHead</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the table's <code id=the-table-element:the-thead-element-3><a href=#the-thead-element>thead</a></code> element.</p>
- <p>Can be set, to replace the <code id=the-table-element:the-thead-element-4><a href=#the-thead-element>thead</a></code> element. If the new value is not a
- <code id=the-table-element:the-thead-element-5><a href=#the-thead-element>thead</a></code> element, throws a <code id=the-table-element:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
- <dt><var>thead</var> = <var>table</var> . <code id=the-table-element:dom-table-createthead-2><a href=#dom-table-createthead>createTHead</a></code>()<dd>
- <p>Ensures the table has a <code id=the-table-element:the-thead-element-6><a href=#the-thead-element>thead</a></code> element, and returns it.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-deletethead-2><a href=#dom-table-deletethead>deleteTHead</a></code>()<dd>
- <p>Ensures the table does not have a <code id=the-table-element:the-thead-element-7><a href=#the-thead-element>thead</a></code> element.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-tfoot-2><a href=#dom-table-tfoot>tFoot</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the table's <code id=the-table-element:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> element.</p>
- <p>Can be set, to replace the <code id=the-table-element:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code> element. If the new value is not a
- <code id=the-table-element:the-tfoot-element-6><a href=#the-tfoot-element>tfoot</a></code> element, throws a <code id=the-table-element:hierarchyrequesterror-2><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
- <dt><var>tfoot</var> = <var>table</var> . <code id=the-table-element:dom-table-createtfoot-2><a href=#dom-table-createtfoot>createTFoot</a></code>()<dd>
- <p>Ensures the table has a <code id=the-table-element:the-tfoot-element-7><a href=#the-tfoot-element>tfoot</a></code> element, and returns it.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-deletetfoot-2><a href=#dom-table-deletetfoot>deleteTFoot</a></code>()<dd>
- <p>Ensures the table does not have a <code id=the-table-element:the-tfoot-element-8><a href=#the-tfoot-element>tfoot</a></code> element.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-tbodies-2><a href=#dom-table-tbodies>tBodies</a></code><dd>
- <p>Returns an <code id=the-table-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-table-element:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> elements of the table.</p>
- <dt><var>tbody</var> = <var>table</var> . <code id=the-table-element:dom-table-createtbody-2><a href=#dom-table-createtbody>createTBody</a></code>()<dd>
- <p>Creates a <code id=the-table-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> element, inserts it into the table, and returns it.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-rows-2><a href=#dom-table-rows>rows</a></code><dd>
- <p>Returns an <code id=the-table-element:htmlcollection-4><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-table-element:the-tr-element-2><a href=#the-tr-element>tr</a></code> elements of the table.</p>
- <dt><var>tr</var> = <var>table</var> . <code id=the-table-element:dom-table-insertrow-2><a href=#dom-table-insertrow>insertRow</a></code>( [ <var>index</var> ] )<dd>
- <p>Creates a <code id=the-table-element:the-tr-element-3><a href=#the-tr-element>tr</a></code> element, along with a <code id=the-table-element:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code> if required, inserts them
- into the table at the position given by the argument, and returns the <code id=the-table-element:the-tr-element-4><a href=#the-tr-element>tr</a></code>.</p>
- <p>The position is relative to the rows in the table. The index −1, which is the default
- if the argument is omitted, is equivalent to inserting at the end of the table.</p>
- <p>If the given position is less than −1 or greater than the number of rows, throws an
- <code id=the-table-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <dt><var>table</var> . <code id=the-table-element:dom-table-deleterow-2><a href=#dom-table-deleterow>deleteRow</a></code>(<var>index</var>)<dd>
- <p>Removes the <code id=the-table-element:the-tr-element-5><a href=#the-tr-element>tr</a></code> element with the given position in the table.</p>
- <p>The position is relative to the rows in the table. The index −1 is equivalent to
- deleting the last row of the table.</p>
- <p>If the given position is less than −1 or greater than the index of the last row, or if
- there are no rows, throws an <code id=the-table-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- </dl>
-
- <p>The <dfn id=dom-table-caption><code>caption</code></dfn> IDL attribute must return, on
- getting, the first <code id=the-table-element:the-caption-element-7><a href=#the-caption-element>caption</a></code> element child of the <code id=the-table-element:the-table-element-4><a href=#the-table-element>table</a></code> element, if any,
- or null otherwise. On setting, the first <code id=the-table-element:the-caption-element-8><a href=#the-caption-element>caption</a></code> element child of the
- <code id=the-table-element:the-table-element-5><a href=#the-table-element>table</a></code> element, if any, must be removed, and the new value, if not null, must be
- inserted as the first node of the <code id=the-table-element:the-table-element-6><a href=#the-table-element>table</a></code> element.</p>
- <p>The <dfn id=dom-table-createcaption><code>createCaption()</code></dfn> method must return
- the first <code id=the-table-element:the-caption-element-9><a href=#the-caption-element>caption</a></code> element child of the <code id=the-table-element:the-table-element-7><a href=#the-table-element>table</a></code> element, if any; otherwise
- a new <code id=the-table-element:the-caption-element-10><a href=#the-caption-element>caption</a></code> element must be created, inserted as the first node of the
- <code id=the-table-element:the-table-element-8><a href=#the-table-element>table</a></code> element, and then returned.</p>
- <p>The <dfn id=dom-table-deletecaption><code>deleteCaption()</code></dfn> method must remove
- the first <code id=the-table-element:the-caption-element-11><a href=#the-caption-element>caption</a></code> element child of the <code id=the-table-element:the-table-element-9><a href=#the-table-element>table</a></code> element, if any.</p>
- <p>The <dfn id=dom-table-thead><code>tHead</code></dfn> IDL attribute must return, on
- getting, the first <code id=the-table-element:the-thead-element-8><a href=#the-thead-element>thead</a></code> element child of the <code id=the-table-element:the-table-element-10><a href=#the-table-element>table</a></code> element, if any, or
- null otherwise. On setting, if the new value is null or a <code id=the-table-element:the-thead-element-9><a href=#the-thead-element>thead</a></code> element, the first
- <code id=the-table-element:the-thead-element-10><a href=#the-thead-element>thead</a></code> element child of the <code id=the-table-element:the-table-element-11><a href=#the-table-element>table</a></code> element, if any, must be removed, and
- the new value, if not null, must be inserted immediately before the first element in the
- <code id=the-table-element:the-table-element-12><a href=#the-table-element>table</a></code> element that is neither a <code id=the-table-element:the-caption-element-12><a href=#the-caption-element>caption</a></code> element nor a
- <code id=the-table-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> element, if any, or at the end of the table if there are no such elements.
- If the new value is neither null nor a <code id=the-table-element:the-thead-element-11><a href=#the-thead-element>thead</a></code> element, then a
- <code id=the-table-element:hierarchyrequesterror-3><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown instead.</p>
- <p>The <dfn id=dom-table-createthead><code>createTHead()</code></dfn> method must return the
- first <code id=the-table-element:the-thead-element-12><a href=#the-thead-element>thead</a></code> element child of the <code id=the-table-element:the-table-element-13><a href=#the-table-element>table</a></code> element, if any; otherwise a new
- <code id=the-table-element:the-thead-element-13><a href=#the-thead-element>thead</a></code> element must be created and inserted immediately before the first element in
- the <code id=the-table-element:the-table-element-14><a href=#the-table-element>table</a></code> element that is neither a <code id=the-table-element:the-caption-element-13><a href=#the-caption-element>caption</a></code> element nor a
- <code id=the-table-element:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element, if any, or at the end of the table if there are no such elements,
- and then that new element must be returned.</p>
- <p>The <dfn id=dom-table-deletethead><code>deleteTHead()</code></dfn> method must remove the
- first <code id=the-table-element:the-thead-element-14><a href=#the-thead-element>thead</a></code> element child of the <code id=the-table-element:the-table-element-15><a href=#the-table-element>table</a></code> element, if any.</p>
- <p>The <dfn id=dom-table-tfoot><code>tFoot</code></dfn> IDL attribute must return, on
- getting, the first <code id=the-table-element:the-tfoot-element-9><a href=#the-tfoot-element>tfoot</a></code> element child of the <code id=the-table-element:the-table-element-16><a href=#the-table-element>table</a></code> element, if any, or
- null otherwise. On setting, if the new value is null or a <code id=the-table-element:the-tfoot-element-10><a href=#the-tfoot-element>tfoot</a></code> element, the first
- <code id=the-table-element:the-tfoot-element-11><a href=#the-tfoot-element>tfoot</a></code> element child of the <code id=the-table-element:the-table-element-17><a href=#the-table-element>table</a></code> element, if any, must be removed, and
- the new value, if not null, must be inserted immediately before the first element in the
- <code id=the-table-element:the-table-element-18><a href=#the-table-element>table</a></code> element that is neither a <code id=the-table-element:the-caption-element-14><a href=#the-caption-element>caption</a></code> element, a <code id=the-table-element:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code>
- element, nor a <code id=the-table-element:the-thead-element-15><a href=#the-thead-element>thead</a></code> element, if any, or at the end of the table if there are no such
- elements. If the new value is neither null nor a <code id=the-table-element:the-tfoot-element-12><a href=#the-tfoot-element>tfoot</a></code> element, then a
- <code id=the-table-element:hierarchyrequesterror-4><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> DOM exception must be thrown instead.</p>
- <p>The <dfn id=dom-table-createtfoot><code>createTFoot()</code></dfn> method must return the
- first <code id=the-table-element:the-tfoot-element-13><a href=#the-tfoot-element>tfoot</a></code> element child of the <code id=the-table-element:the-table-element-19><a href=#the-table-element>table</a></code> element, if any; otherwise a new
- <code id=the-table-element:the-tfoot-element-14><a href=#the-tfoot-element>tfoot</a></code> element must be created and inserted immediately before the first element in
- the <code id=the-table-element:the-table-element-20><a href=#the-table-element>table</a></code> element that is neither a <code id=the-table-element:the-caption-element-15><a href=#the-caption-element>caption</a></code> element, a
- <code id=the-table-element:the-colgroup-element-5><a href=#the-colgroup-element>colgroup</a></code> element, nor a <code id=the-table-element:the-thead-element-16><a href=#the-thead-element>thead</a></code> element, if any, or at the end of the
- table if there are no such elements, and then that new element must be returned.</p>
- <p>The <dfn id=dom-table-deletetfoot><code>deleteTFoot()</code></dfn> method must remove the
- first <code id=the-table-element:the-tfoot-element-15><a href=#the-tfoot-element>tfoot</a></code> element child of the <code id=the-table-element:the-table-element-21><a href=#the-table-element>table</a></code> element, if any.</p>
- <p>The <dfn id=dom-table-tbodies><code>tBodies</code></dfn> attribute must return an
- <code id=the-table-element:htmlcollection-5><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-table-element:the-table-element-22><a href=#the-table-element>table</a></code> node, whose filter matches only
- <code id=the-table-element:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code> elements that are children of the <code id=the-table-element:the-table-element-23><a href=#the-table-element>table</a></code> element.</p>
- <p>The <dfn id=dom-table-createtbody><code>createTBody()</code></dfn> method must create a
- new <code id=the-table-element:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code> element, insert it immediately after the last <code id=the-table-element:the-tbody-element-7><a href=#the-tbody-element>tbody</a></code> element
- child in the <code id=the-table-element:the-table-element-24><a href=#the-table-element>table</a></code> element, if any, or at the end of the <code id=the-table-element:the-table-element-25><a href=#the-table-element>table</a></code> element
- if the <code id=the-table-element:the-table-element-26><a href=#the-table-element>table</a></code> element has no <code id=the-table-element:the-tbody-element-8><a href=#the-tbody-element>tbody</a></code> element children, and then must return
- the new <code id=the-table-element:the-tbody-element-9><a href=#the-tbody-element>tbody</a></code> element.</p>
- <p>The <dfn id=dom-table-rows><code>rows</code></dfn> attribute must return an
- <code id=the-table-element:htmlcollection-6><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-table-element:the-table-element-27><a href=#the-table-element>table</a></code> node, whose filter matches only
- <code id=the-table-element:the-tr-element-6><a href=#the-tr-element>tr</a></code> elements that are either children of the <code id=the-table-element:the-table-element-28><a href=#the-table-element>table</a></code> element, or children
- of <code id=the-table-element:the-thead-element-17><a href=#the-thead-element>thead</a></code>, <code id=the-table-element:the-tbody-element-10><a href=#the-tbody-element>tbody</a></code>, or <code id=the-table-element:the-tfoot-element-16><a href=#the-tfoot-element>tfoot</a></code> elements that are themselves
- children of the <code id=the-table-element:the-table-element-29><a href=#the-table-element>table</a></code> element. The elements in the collection must be ordered such
- that those elements whose parent is a <code id=the-table-element:the-thead-element-18><a href=#the-thead-element>thead</a></code> are included first, in <a href=#tree-order id=the-table-element:tree-order>tree order</a>,
- followed by those elements whose parent is either a <code id=the-table-element:the-table-element-30><a href=#the-table-element>table</a></code> or <code id=the-table-element:the-tbody-element-11><a href=#the-tbody-element>tbody</a></code>
- element, again in <a href=#tree-order id=the-table-element:tree-order-2>tree order</a>, followed finally by those elements whose parent is a
- <code id=the-table-element:the-tfoot-element-17><a href=#the-tfoot-element>tfoot</a></code> element, still in <a href=#tree-order id=the-table-element:tree-order-3>tree order</a>.</p>
- <p>The behavior of the <dfn id=dom-table-insertrow><code>insertRow(<var>index</var>)</code></dfn> method depends on the state of the table. When it is called,
- the method must act as required by the first item in the following list of conditions that
- describes the state of the table and the <var>index</var> argument:</p>
- <dl class=switch><dt>If <var>index</var> is less than −1 or greater than the number of elements
- in <code id=the-table-element:dom-table-rows-3><a href=#dom-table-rows>rows</a></code> collection:<dd>The method must throw an <code id=the-table-element:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception.<dt>If the <code id=the-table-element:dom-table-rows-4><a href=#dom-table-rows>rows</a></code> collection has zero elements in it, and the
- <code id=the-table-element:the-table-element-31><a href=#the-table-element>table</a></code> has no <code id=the-table-element:the-tbody-element-12><a href=#the-tbody-element>tbody</a></code> elements in it:<dd>The method must create a <code id=the-table-element:the-tbody-element-13><a href=#the-tbody-element>tbody</a></code> element, then create a <code id=the-table-element:the-tr-element-7><a href=#the-tr-element>tr</a></code> element,
- then append the <code id=the-table-element:the-tr-element-8><a href=#the-tr-element>tr</a></code> element to the <code id=the-table-element:the-tbody-element-14><a href=#the-tbody-element>tbody</a></code> element, then append the
- <code id=the-table-element:the-tbody-element-15><a href=#the-tbody-element>tbody</a></code> element to the <code id=the-table-element:the-table-element-32><a href=#the-table-element>table</a></code> element, and finally return the
- <code id=the-table-element:the-tr-element-9><a href=#the-tr-element>tr</a></code> element.<dt>If the <code id=the-table-element:dom-table-rows-5><a href=#dom-table-rows>rows</a></code> collection has zero elements in it:<dd>The method must create a <code id=the-table-element:the-tr-element-10><a href=#the-tr-element>tr</a></code> element, append it to the last <code id=the-table-element:the-tbody-element-16><a href=#the-tbody-element>tbody</a></code>
- element in the table, and return the <code id=the-table-element:the-tr-element-11><a href=#the-tr-element>tr</a></code> element.<dt>If <var>index</var> is −1 or equal to the number of items in <code id=the-table-element:dom-table-rows-6><a href=#dom-table-rows>rows</a></code> collection:<dd>The method must create a <code id=the-table-element:the-tr-element-12><a href=#the-tr-element>tr</a></code> element, and append it to the parent of the last
- <code id=the-table-element:the-tr-element-13><a href=#the-tr-element>tr</a></code> element in the <code id=the-table-element:dom-table-rows-7><a href=#dom-table-rows>rows</a></code> collection. Then, the
- newly created <code id=the-table-element:the-tr-element-14><a href=#the-tr-element>tr</a></code> element must be returned.<dt>Otherwise:<dd>The method must create a <code id=the-table-element:the-tr-element-15><a href=#the-tr-element>tr</a></code> element, insert it immediately before the <var>index</var>th <code id=the-table-element:the-tr-element-16><a href=#the-tr-element>tr</a></code> element in the <code id=the-table-element:dom-table-rows-8><a href=#dom-table-rows>rows</a></code>
- collection, in the same parent, and finally must return the newly created <code id=the-table-element:the-tr-element-17><a href=#the-tr-element>tr</a></code>
- element.</dl>
- <p>When the <dfn id=dom-table-deleterow><code>deleteRow(<var>index</var>)</code></dfn> method is called, the user agent must run the following
- steps:</p>
- <ol><li><p>If <var>index</var> is equal to −1, then <var>index</var> must be
- set to the number of items in the <code id=the-table-element:dom-table-rows-9><a href=#dom-table-rows>rows</a></code> collection, minus
- one.<li><p>Now, if <var>index</var> is less than zero, or greater than or equal to the
- number of elements in the <code id=the-table-element:dom-table-rows-10><a href=#dom-table-rows>rows</a></code> collection, the method must
- instead throw an <code id=the-table-element:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception, and these steps must be aborted.<li><p>Otherwise, the method must remove the <var>index</var>th element in the <code id=the-table-element:dom-table-rows-11><a href=#dom-table-rows>rows</a></code> collection from its parent.</p>
- </ol>
- <p>The <code id=the-table-element:dom-table-stopsorting-2><a href=#dom-table-stopsorting>stopSorting()</a></code> method is used in the <a href=#table-sorting-model id=the-table-element:table-sorting-model-2>table
- sorting model</a>.</p>
- <p>The IDL attribute <dfn id=dom-table-sortable><code>sortable</code></dfn> must
- <a href=#reflect id=the-table-element:reflect>reflect</a> the <code id=the-table-element:attr-table-sortable-3><a href=#attr-table-sortable>sortable</a></code> content attribute.</p>
-
- <div class=example>
- <p>Here is an example of a table being used to mark up a Sudoku puzzle. Observe the lack of
- headers, which are not necessary in such a table.</p>
- <pre><section>
- <style scoped>
- table { border-collapse: collapse; border: solid thick; }
- colgroup, tbody { border: solid medium; }
- td { border: solid thin; height: 1.4em; width: 1.4em; text-align: center; padding: 0; }
- </style>
- <h1>Today's Sudoku</h1>
- <table>
- <colgroup><col><col><col>
- <colgroup><col><col><col>
- <colgroup><col><col><col>
- <tbody>
- <tr> <td> 1 <td> <td> 3 <td> 6 <td> <td> 4 <td> 7 <td> <td> 9
- <tr> <td> <td> 2 <td> <td> <td> 9 <td> <td> <td> 1 <td>
- <tr> <td> 7 <td> <td> <td> <td> <td> <td> <td> <td> 6
- <tbody>
- <tr> <td> 2 <td> <td> 4 <td> <td> 3 <td> <td> 9 <td> <td> 8
- <tr> <td> <td> <td> <td> <td> <td> <td> <td> <td>
- <tr> <td> 5 <td> <td> <td> 9 <td> <td> 7 <td> <td> <td> 1
- <tbody>
- <tr> <td> 6 <td> <td> <td> <td> 5 <td> <td> <td> <td> 2
- <tr> <td> <td> <td> <td> <td> 7 <td> <td> <td> <td>
- <tr> <td> 9 <td> <td> <td> 8 <td> <td> 2 <td> <td> <td> 5
- </table>
- </section></pre>
- </div>
- <h5 id=table-descriptions-techniques>4.9.1.1 Techniques for describing tables</h5>
- <p id=table-descriptions>For tables that consist of more than just a grid of cells with headers
- in the first row and headers in the first column, and for any table in general where the reader
- might have difficulty understanding the content, authors should include explanatory information
- introducing the table. This information is useful for all users, but is especially useful for
- users who cannot see the table, e.g. users of screen readers.</p>
- <p>Such explanatory information should introduce the purpose of the table, outline its basic cell
- structure, highlight any trends or patterns, and generally teach the user how to use the
- table.</p>
-
- <p>For instance, the following table:</p>
- <table><caption>Characteristics with positive and negative sides</caption><thead><tr><th id=n> Negative
- <th> Characteristic
- <th> Positive
- <tbody><tr><td headers="n r1"> Sad
- <th id=r1> Mood
- <td> Happy
- <tr><td headers="n r2"> Failing
- <th id=r2> Grade
- <td> Passing
- </table>
- <p>...might benefit from a description explaining the way the table is laid out, something like
- "Characteristics are given in the second column, with the negative side in the left column and the
- positive side in the right column".</p>
- <p>There are a variety of ways to include this information, such as:</p>
- <dl><dt>In prose, surrounding the table<dd>
- <div class=example><pre><p>In the following table, characteristics are given in the second
- column, with the negative side in the left column and the positive
- side in the right column.</p>
- <table>
- <caption>Characteristics with positive and negative sides</caption>
- <thead>
- <tr>
- <th id="n"> Negative
- <th> Characteristic
- <th> Positive
- <tbody>
- <tr>
- <td headers="n r1"> Sad
- <th id="r1"> Mood
- <td> Happy
- <tr>
- <td headers="n r2"> Failing
- <th id="r2"> Grade
- <td> Passing
- </table></pre></div>
- <dt>In the table's <code id=table-descriptions-techniques:the-caption-element><a href=#the-caption-element>caption</a></code><dd>
- <div class=example><pre><table>
- <caption>
- <strong>Characteristics with positive and negative sides.</strong>
- <p>Characteristics are given in the second column, with the
- negative side in the left column and the positive side in the right
- column.</p>
- </caption>
- <thead>
- <tr>
- <th id="n"> Negative
- <th> Characteristic
- <th> Positive
- <tbody>
- <tr>
- <td headers="n r1"> Sad
- <th id="r1"> Mood
- <td> Happy
- <tr>
- <td headers="n r2"> Failing
- <th id="r2"> Grade
- <td> Passing
- </table></pre></div>
- <dt>In the table's <code id=table-descriptions-techniques:the-caption-element-2><a href=#the-caption-element>caption</a></code>, in a <code id=table-descriptions-techniques:the-details-element><a href=#the-details-element>details</a></code> element<dd>
- <div class=example><pre><table>
- <caption>
- <strong>Characteristics with positive and negative sides.</strong>
- <details>
- <summary>Help</summary>
- <p>Characteristics are given in the second column, with the
- negative side in the left column and the positive side in the right
- column.</p>
- </details>
- </caption>
- <thead>
- <tr>
- <th id="n"> Negative
- <th> Characteristic
- <th> Positive
- <tbody>
- <tr>
- <td headers="n r1"> Sad
- <th id="r1"> Mood
- <td> Happy
- <tr>
- <td headers="n r2"> Failing
- <th id="r2"> Grade
- <td> Passing
- </table></pre></div>
- <dt>Next to the table, in the same <code id=table-descriptions-techniques:the-figure-element><a href=#the-figure-element>figure</a></code><dd>
- <div class=example><pre><figure>
- <figcaption>Characteristics with positive and negative sides</figcaption>
- <p>Characteristics are given in the second column, with the
- negative side in the left column and the positive side in the right
- column.</p>
- <table>
- <thead>
- <tr>
- <th id="n"> Negative
- <th> Characteristic
- <th> Positive
- <tbody>
- <tr>
- <td headers="n r1"> Sad
- <th id="r1"> Mood
- <td> Happy
- <tr>
- <td headers="n r2"> Failing
- <th id="r2"> Grade
- <td> Passing
- </table>
- </figure></pre></div>
- <dt>Next to the table, in a <code id=table-descriptions-techniques:the-figure-element-2><a href=#the-figure-element>figure</a></code>'s <code id=table-descriptions-techniques:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code><dd>
- <div class=example><pre><figure>
- <figcaption>
- <strong>Characteristics with positive and negative sides</strong>
- <p>Characteristics are given in the second column, with the
- negative side in the left column and the positive side in the right
- column.</p>
- </figcaption>
- <table>
- <thead>
- <tr>
- <th id="n"> Negative
- <th> Characteristic
- <th> Positive
- <tbody>
- <tr>
- <td headers="n r1"> Sad
- <th id="r1"> Mood
- <td> Happy
- <tr>
- <td headers="n r2"> Failing
- <th id="r2"> Grade
- <td> Passing
- </table>
- </figure></pre></div>
- </dl>
- <p>Authors may also use other techniques, or combinations of the above techniques, as
- appropriate.</p>
- <p>The best option, of course, rather than writing a description explaining the way the table is
- laid out, is to adjust the table such that no explanation is needed.</p>
- <div class=example>
- <p>In the case of the table used in the examples above, a simple rearrangement of the table so
- that the headers are on the top and left sides removes the need for an explanation as well as
- removing the need for the use of <code id=table-descriptions-techniques:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attributes:</p>
- <pre><table>
- <caption>Characteristics with positive and negative sides</caption>
- <thead>
- <tr>
- <th> Characteristic
- <th> Negative
- <th> Positive
- <tbody>
- <tr>
- <th> Mood
- <td> Sad
- <td> Happy
- <tr>
- <th> Grade
- <td> Failing
- <td> Passing
- </table></pre>
- </div>
- <h5 id=table-layout-techniques>4.9.1.2 Techniques for table design</h5>
- <p>Good table design is key to making tables more readable and usable.</p>
- <p>In visual media, providing column and row borders and alternating row backgrounds can be very
- effective to make complicated tables more readable.</p>
- <p>For tables with large volumes of numeric content, using monospaced fonts can help users see
- patterns, especially in situations where a user agent does not render the borders. (Unfortunately,
- for historical reasons, not rendering borders on tables is a common default.)</p>
- <p>In speech media, table cells can be distinguished by reporting the corresponding headers before
- reading the cell's contents, and by allowing users to navigate the table in a grid fashion, rather
- than serialising the entire contents of the table in source order.</p>
- <p>Authors are encouraged to use CSS to achieve these effects.</p>
-
- <p>User agents are encouraged to render tables using these techniques whenever the page does not
- use CSS and the table is not classified as a layout table.</p>
-
- <h4 id=the-caption-element>4.9.2 The <dfn><code>caption</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-caption-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-caption-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the first element child of a <code id=the-caption-element:the-table-element><a href=#the-table-element>table</a></code> element.<dt><a href=#concept-element-content-model id=the-caption-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-caption-element:flow-content-2>Flow content</a>, but with no descendant <code id=the-caption-element:the-table-element-2><a href=#the-table-element>table</a></code> elements.<dt><a href=#concept-element-tag-omission id=the-caption-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-caption-element:the-caption-element><a href=#the-caption-element>caption</a></code> element's <a href=#syntax-end-tag id=the-caption-element:syntax-end-tag>end tag</a> can be omitted if
- the <code id=the-caption-element:the-caption-element-2><a href=#the-caption-element>caption</a></code> element is not immediately followed by a <a href=#space-character id=the-caption-element:space-character>space character</a> or
- a <a href=#syntax-comments id=the-caption-element:syntax-comments>comment</a>.<dt><a href=#concept-element-attributes id=the-caption-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-caption-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-caption-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltablecaptionelement>HTMLTableCaptionElement</dfn> : <a href=#htmlelement id=the-caption-element:htmlelement>HTMLElement</a> {
- // <a href="#HTMLTableCaptionElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-caption-element:the-caption-element-3><a href=#the-caption-element>caption</a></code> element <a href=#represents id=the-caption-element:represents>represents</a> the title of the <code id=the-caption-element:the-table-element-3><a href=#the-table-element>table</a></code>
- that is its parent, if it has a parent and that is a <code id=the-caption-element:the-table-element-4><a href=#the-table-element>table</a></code> element.</p>
-
- <p>The <code id=the-caption-element:the-caption-element-4><a href=#the-caption-element>caption</a></code> element takes part in the <a href=#table-model id=the-caption-element:table-model>table model</a>.</p>
-
- <p>When a <code id=the-caption-element:the-table-element-5><a href=#the-table-element>table</a></code> element is the only content in a <code id=the-caption-element:the-figure-element><a href=#the-figure-element>figure</a></code> element other
- than the <code id=the-caption-element:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code>, the <code id=the-caption-element:the-caption-element-5><a href=#the-caption-element>caption</a></code> element should be omitted in favor of
- the <code id=the-caption-element:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code>.</p>
- <p>A caption can introduce context for a table, making it significantly easier to understand.</p>
- <div class=example>
- <p>Consider, for instance, the following table:</p>
- <table class=dice-example><tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
- <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
- <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
- <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
- <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
- <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
- <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
- </table>
- <p>In the abstract, this table is not clear. However, with a caption giving the table's number
- (for reference in the main prose) and explaining its use, it makes more sense:</p>
- <pre><caption>
- <p>Table 1.
- <p>This table shows the total score obtained from rolling two
- six-sided dice. The first row represents the value of the first die,
- the first column the value of the second die. The total is given in
- the cell that corresponds to the values of the two dice.
- </caption></pre>
- <p>This provides the user with more context:</p>
- <table class=dice-example><caption>
- <p>Table 1.
- <p>This table shows the total score obtained from rolling two
- six-sided dice. The first row represents the value of the first
- die, the first column the value of the second die. The total is
- given in the cell that corresponds to the values of the two dice.
- </caption><tr><th> <th> 1 <th> 2 <th> 3 <th> 4 <th> 5 <th> 6
- <tr><th> 1 <td> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7
- <tr><th> 2 <td> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8
- <tr><th> 3 <td> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9
- <tr><th> 4 <td> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10
- <tr><th> 5 <td> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11
- <tr><th> 6 <td> 7 <td> 8 <td> 9 <td> 10 <td> 11 <td> 12
- </table>
- </div>
- <h4 id=the-colgroup-element>4.9.3 The <dfn><code>colgroup</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-colgroup-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-colgroup-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-colgroup-element:the-table-element><a href=#the-table-element>table</a></code> element, after any
- <code id=the-colgroup-element:the-caption-element><a href=#the-caption-element>caption</a></code> elements and before any <code id=the-colgroup-element:the-thead-element><a href=#the-thead-element>thead</a></code>,
- <code id=the-colgroup-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=the-colgroup-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>, and <code id=the-colgroup-element:the-tr-element><a href=#the-tr-element>tr</a></code>
- elements.<dt><a href=#concept-element-content-model id=the-colgroup-element:concept-element-content-model>Content model</a>:<dd>If the <code id=the-colgroup-element:attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute is present: <a href=#concept-content-nothing id=the-colgroup-element:concept-content-nothing>Nothing</a>.<dd>If the <code id=the-colgroup-element:attr-colgroup-span-2><a href=#attr-colgroup-span>span</a></code> attribute is absent: Zero or more <code id=the-colgroup-element:the-col-element><a href=#the-col-element>col</a></code> and <code id=the-colgroup-element:the-template-element><a href=#the-template-element>template</a></code> elements.<dt><a href=#concept-element-tag-omission id=the-colgroup-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-colgroup-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-start-tag id=the-colgroup-element:syntax-start-tag>start tag</a> can be
- omitted if the first thing inside the <code id=the-colgroup-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> element is a <code id=the-colgroup-element:the-col-element-2><a href=#the-col-element>col</a></code> element,
- and if the element is not immediately preceded by another <code id=the-colgroup-element:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element whose
- <a href=#syntax-end-tag id=the-colgroup-element:syntax-end-tag>end tag</a> has been omitted. (It can't be omitted if the element
- is empty.)<dd>A <code id=the-colgroup-element:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-end-tag id=the-colgroup-element:syntax-end-tag-2>end tag</a> can be omitted if
- the <code id=the-colgroup-element:the-colgroup-element-5><a href=#the-colgroup-element>colgroup</a></code> element is not immediately followed by a <a href=#space-character id=the-colgroup-element:space-character>space character</a> or
- a <a href=#syntax-comments id=the-colgroup-element:syntax-comments>comment</a>.<dt><a href=#concept-element-attributes id=the-colgroup-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-colgroup-element:global-attributes>Global attributes</a><dd><code id=the-colgroup-element:attr-colgroup-span-3><a href=#attr-colgroup-span>span</a></code> — Number of columns spanned by the element<dt><a href=#concept-element-dom id=the-colgroup-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltablecolelement>HTMLTableColElement</dfn> : <a href=#htmlelement id=the-colgroup-element:htmlelement>HTMLElement</a> {
- attribute unsigned long <a href=#dom-colgroup-span id=the-colgroup-element:dom-colgroup-span>span</a>;
- // <a href="#HTMLTableColElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-colgroup-element:the-colgroup-element-6><a href=#the-colgroup-element>colgroup</a></code> element <a href=#represents id=the-colgroup-element:represents>represents</a> a <a href=#concept-column-group id=the-colgroup-element:concept-column-group>group</a> of one or more <a href=#concept-column id=the-colgroup-element:concept-column>columns</a> in the <code id=the-colgroup-element:the-table-element-2><a href=#the-table-element>table</a></code> that is its parent, if it has a
- parent and that is a <code id=the-colgroup-element:the-table-element-3><a href=#the-table-element>table</a></code> element.</p>
- <p>If the <code id=the-colgroup-element:the-colgroup-element-7><a href=#the-colgroup-element>colgroup</a></code> element contains no <code id=the-colgroup-element:the-col-element-3><a href=#the-col-element>col</a></code> elements, then the element
- may have a <dfn id=attr-colgroup-span><code>span</code></dfn> content attribute specified,
- whose value must be a <a href=#valid-non-negative-integer id=the-colgroup-element:valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>
-
- <p>The <code id=the-colgroup-element:the-colgroup-element-8><a href=#the-colgroup-element>colgroup</a></code> element and its <code id=the-colgroup-element:attr-colgroup-span-4><a href=#attr-colgroup-span>span</a></code>
- attribute take part in the <a href=#table-model id=the-colgroup-element:table-model>table model</a>.</p>
- <p>The <dfn id=dom-colgroup-span><code>span</code></dfn> IDL attribute must
- <a href=#reflect id=the-colgroup-element:reflect>reflect</a> the content attribute of the same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero id=the-colgroup-element:limited-to-only-non-negative-numbers-greater-than-zero>limited to
- only non-negative numbers greater than zero</a>.</p>
-
- <h4 id=the-col-element>4.9.4 The <dfn><code>col</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-col-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-col-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-col-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element that doesn't have
- a <code id=the-col-element:attr-col-span><a href=#attr-col-span>span</a></code> attribute.<dt><a href=#concept-element-content-model id=the-col-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-col-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-col-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-col-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-col-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-col-element:global-attributes>Global attributes</a><dd><code id=the-col-element:attr-col-span-2><a href=#attr-col-span>span</a></code> — Number of columns spanned by the element<dt><a href=#concept-element-dom id=the-col-element:concept-element-dom>DOM interface</a>:<dd>
- <p><code id=the-col-element:htmltablecolelement><a href=#htmltablecolelement>HTMLTableColElement</a></code>, same as for
- <code id=the-col-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> elements. This interface defines one member,
- <code id=the-col-element:dom-col-span><a href=#dom-col-span>span</a></code>.</p>
- </dl>
- <p>If a <code id=the-col-element:the-col-element><a href=#the-col-element>col</a></code> element has a parent and that is a <code id=the-col-element:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element that
- itself has a parent that is a <code id=the-col-element:the-table-element><a href=#the-table-element>table</a></code> element, then the <code id=the-col-element:the-col-element-2><a href=#the-col-element>col</a></code> element
- <a href=#represents id=the-col-element:represents>represents</a> one or more <a href=#concept-column id=the-col-element:concept-column>columns</a> in the <a href=#concept-column-group id=the-col-element:concept-column-group>column group</a> represented by that <code id=the-col-element:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code>.</p>
- <p>The element may have a <dfn id=attr-col-span><code>span</code></dfn> content attribute
- specified, whose value must be a <a href=#valid-non-negative-integer id=the-col-element:valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>
-
- <p>The <code id=the-col-element:the-col-element-3><a href=#the-col-element>col</a></code> element and its <code id=the-col-element:attr-col-span-3><a href=#attr-col-span>span</a></code> attribute take
- part in the <a href=#table-model id=the-col-element:table-model>table model</a>.</p>
- <p>The <dfn id=dom-col-span><code>span</code></dfn> IDL attribute must <a href=#reflect id=the-col-element:reflect>reflect</a>
- the content attribute of the same name. The value must be <a href=#limited-to-only-non-negative-numbers-greater-than-zero id=the-col-element:limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
- numbers greater than zero</a>.</p>
-
- <h4 id=the-tbody-element>4.9.5 The <dfn><code>tbody</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-tbody-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-tbody-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-tbody-element:the-table-element><a href=#the-table-element>table</a></code> element, after any
- <code id=the-tbody-element:the-caption-element><a href=#the-caption-element>caption</a></code>, <code id=the-tbody-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>, and
- <code id=the-tbody-element:the-thead-element><a href=#the-thead-element>thead</a></code> elements, but only if there are no
- <code id=the-tbody-element:the-tr-element><a href=#the-tr-element>tr</a></code> elements that are children of the
- <code id=the-tbody-element:the-table-element-2><a href=#the-table-element>table</a></code> element.<dt><a href=#concept-element-content-model id=the-tbody-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-tbody-element:the-tr-element-2><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements-2 id=the-tbody-element:script-supporting-elements-2>script-supporting</a> elements<dt><a href=#concept-element-tag-omission id=the-tbody-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-tbody-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-start-tag id=the-tbody-element:syntax-start-tag>start tag</a> can be omitted
- if the first thing inside the <code id=the-tbody-element:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> element is a <code id=the-tbody-element:the-tr-element-3><a href=#the-tr-element>tr</a></code> element, and if the
- element is not immediately preceded by a <code id=the-tbody-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>, <code id=the-tbody-element:the-thead-element-2><a href=#the-thead-element>thead</a></code>, or
- <code id=the-tbody-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element whose <a href=#syntax-end-tag id=the-tbody-element:syntax-end-tag>end tag</a> has been omitted. (It
- can't be omitted if the element is empty.)<dd>A <code id=the-tbody-element:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-end-tag id=the-tbody-element:syntax-end-tag-2>end tag</a> can be omitted if
- the <code id=the-tbody-element:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code> element is immediately followed by a <code id=the-tbody-element:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code> or
- <code id=the-tbody-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element, or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-tbody-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-tbody-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-tbody-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltablesectionelement>HTMLTableSectionElement</dfn> : <a href=#htmlelement id=the-tbody-element:htmlelement>HTMLElement</a> {
- readonly attribute <a href=#htmlcollection id=the-tbody-element:htmlcollection>HTMLCollection</a> <a href=#dom-tbody-rows id=the-tbody-element:dom-tbody-rows>rows</a>;
- <a href=#htmlelement id=the-tbody-element:htmlelement-2>HTMLElement</a> <a href=#dom-tbody-insertrow id=the-tbody-element:dom-tbody-insertrow>insertRow</a>(optional long index = -1);
- void <a href=#dom-tbody-deleterow id=the-tbody-element:dom-tbody-deleterow>deleteRow</a>(long index);
- // <a href="#HTMLTableSectionElement-partial">also has obsolete members</a>
- };</pre>
- <p>The <code id=the-tbody-element:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> interface is also
- used for <code id=the-tbody-element:the-thead-element-3><a href=#the-thead-element>thead</a></code> and <code id=the-tbody-element:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> elements.</p>
- </dl>
- <p>The <code id=the-tbody-element:the-tbody-element-7><a href=#the-tbody-element>tbody</a></code> element <a href=#represents id=the-tbody-element:represents>represents</a> a <a href=#concept-row-group id=the-tbody-element:concept-row-group>block</a> of <a href=#concept-row id=the-tbody-element:concept-row>rows</a> that consist of a
- body of data for the parent <code id=the-tbody-element:the-table-element-3><a href=#the-table-element>table</a></code> element, if the <code id=the-tbody-element:the-tbody-element-8><a href=#the-tbody-element>tbody</a></code> element has a
- parent and it is a <code id=the-tbody-element:the-table-element-4><a href=#the-table-element>table</a></code>.</p>
-
- <p>The <code id=the-tbody-element:the-tbody-element-9><a href=#the-tbody-element>tbody</a></code> element takes part in the <a href=#table-model id=the-tbody-element:table-model>table model</a>.</p>
-
- <dl class=domintro><dt><var>tbody</var> . <code id=the-tbody-element:dom-tbody-rows-2><a href=#dom-tbody-rows>rows</a></code><dd>
- <p>Returns an <code id=the-tbody-element:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-tbody-element:the-tr-element-4><a href=#the-tr-element>tr</a></code> elements of the table
- section.</p>
- <dt><var>tr</var> = <var>tbody</var> . <code id=the-tbody-element:dom-tbody-insertrow-2><a href=#dom-tbody-insertrow>insertRow</a></code>( [ <var>index</var> ] )<dd>
- <p>Creates a <code id=the-tbody-element:the-tr-element-5><a href=#the-tr-element>tr</a></code> element, inserts it into the table section at the position given by
- the argument, and returns the <code id=the-tbody-element:the-tr-element-6><a href=#the-tr-element>tr</a></code>.</p>
- <p>The position is relative to the rows in the table section. The index −1, which is the
- default if the argument is omitted, is equivalent to inserting at the end of the table
- section.</p>
- <p>If the given position is less than −1 or greater than the number of rows, throws an
- <code id=the-tbody-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <dt><var>tbody</var> . <code id=the-tbody-element:dom-tbody-deleterow-2><a href=#dom-tbody-deleterow>deleteRow</a></code>(<var>index</var>)<dd>
- <p>Removes the <code id=the-tbody-element:the-tr-element-7><a href=#the-tr-element>tr</a></code> element with the given position in the table section.</p>
- <p>The position is relative to the rows in the table section. The index −1 is equivalent
- to deleting the last row of the table section.</p>
- <p>If the given position is less than −1 or greater than the index of the last row, or if
- there are no rows, throws an <code id=the-tbody-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- </dl>
-
- <p>The <dfn id=dom-tbody-rows><code>rows</code></dfn> attribute must return an
- <code id=the-tbody-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> rooted at the element, whose filter matches only <code id=the-tbody-element:the-tr-element-8><a href=#the-tr-element>tr</a></code>
- elements that are children of the element.</p>
- <p>The <dfn id=dom-tbody-insertrow><code>insertRow(<var>index</var>)</code></dfn>
- method must, when invoked on an element <var>table section</var>, act as follows:</p>
- <p>If <var>index</var> is less than −1 or greater than the number of elements in
- the <code id=the-tbody-element:dom-tbody-rows-3><a href=#dom-tbody-rows>rows</a></code> collection, the method must throw an
- <code id=the-tbody-element:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <p>If <var>index</var> is −1 or equal to the number of items in the <code id=the-tbody-element:dom-tbody-rows-4><a href=#dom-tbody-rows>rows</a></code> collection, the method must create a <code id=the-tbody-element:the-tr-element-9><a href=#the-tr-element>tr</a></code> element,
- append it to the element <var>table section</var>, and return the newly created
- <code id=the-tbody-element:the-tr-element-10><a href=#the-tr-element>tr</a></code> element.</p>
- <p>Otherwise, the method must create a <code id=the-tbody-element:the-tr-element-11><a href=#the-tr-element>tr</a></code> element, insert it as a child of the <var>table section</var> element, immediately before the <var>index</var>th
- <code id=the-tbody-element:the-tr-element-12><a href=#the-tr-element>tr</a></code> element in the <code id=the-tbody-element:dom-tbody-rows-5><a href=#dom-tbody-rows>rows</a></code> collection, and finally
- must return the newly created <code id=the-tbody-element:the-tr-element-13><a href=#the-tr-element>tr</a></code> element.</p>
- <p>The <dfn id=dom-tbody-deleterow><code>deleteRow(<var>index</var>)</code></dfn>
- method must remove the <var>index</var>th element in the <code id=the-tbody-element:dom-tbody-rows-6><a href=#dom-tbody-rows>rows</a></code> collection from its parent. If <var>index</var> is
- less than zero or greater than or equal to the number of elements in the <code id=the-tbody-element:dom-tbody-rows-7><a href=#dom-tbody-rows>rows</a></code> collection, the method must instead throw an
- <code id=the-tbody-element:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
-
- <h4 id=the-thead-element>4.9.6 The <dfn><code>thead</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-thead-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-thead-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-thead-element:the-table-element><a href=#the-table-element>table</a></code> element, after any
- <code id=the-thead-element:the-caption-element><a href=#the-caption-element>caption</a></code>, and <code id=the-thead-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>
- elements and before any <code id=the-thead-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=the-thead-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>, and
- <code id=the-thead-element:the-tr-element><a href=#the-tr-element>tr</a></code> elements, but only if there are no other
- <code id=the-thead-element:the-thead-element><a href=#the-thead-element>thead</a></code> elements that are children of the
- <code id=the-thead-element:the-table-element-2><a href=#the-table-element>table</a></code> element.<dt><a href=#concept-element-content-model id=the-thead-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-thead-element:the-tr-element-2><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements-2 id=the-thead-element:script-supporting-elements-2>script-supporting</a> elements<dt><a href=#concept-element-tag-omission id=the-thead-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-thead-element:the-thead-element-2><a href=#the-thead-element>thead</a></code> element's <a href=#syntax-end-tag id=the-thead-element:syntax-end-tag>end tag</a> can be omitted if
- the <code id=the-thead-element:the-thead-element-3><a href=#the-thead-element>thead</a></code> element is immediately followed by a <code id=the-thead-element:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> or
- <code id=the-thead-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element.<dt><a href=#concept-element-attributes id=the-thead-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-thead-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-thead-element:concept-element-dom>DOM interface</a>:<dd><code id=the-thead-element:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
- <code id=the-thead-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> elements.</dl>
- <p>The <code id=the-thead-element:the-thead-element-4><a href=#the-thead-element>thead</a></code> element <a href=#represents id=the-thead-element:represents>represents</a> the <a href=#concept-row-group id=the-thead-element:concept-row-group>block</a> of <a href=#concept-row id=the-thead-element:concept-row>rows</a> that consist of
- the column labels (headers) for the parent <code id=the-thead-element:the-table-element-3><a href=#the-table-element>table</a></code> element, if the <code id=the-thead-element:the-thead-element-5><a href=#the-thead-element>thead</a></code>
- element has a parent and it is a <code id=the-thead-element:the-table-element-4><a href=#the-table-element>table</a></code>.</p>
-
- <p>The <code id=the-thead-element:the-thead-element-6><a href=#the-thead-element>thead</a></code> element takes part in the <a href=#table-model id=the-thead-element:table-model>table model</a>.</p>
-
- <div class=example>
- <p>This example shows a <code id=the-thead-element:the-thead-element-7><a href=#the-thead-element>thead</a></code> element being used. Notice the use of both
- <code id=the-thead-element:the-th-element><a href=#the-th-element>th</a></code> and <code id=the-thead-element:the-td-element><a href=#the-td-element>td</a></code> elements in the <code id=the-thead-element:the-thead-element-8><a href=#the-thead-element>thead</a></code> element: the first row is
- the headers, and the second row is an explanation of how to fill in the table.</p>
- <pre><table>
- <caption> School auction sign-up sheet </caption>
- <strong> <thead>
- <tr>
- <th><label for=e1>Name</label>
- <th><label for=e2>Product</label>
- <th><label for=e3>Picture</label>
- <th><label for=e4>Price</label>
- <tr>
- <td>Your name here
- <td>What are you selling?
- <td>Link to a picture
- <td>Your reserve price
- </strong> <tbody>
- <tr>
- <td>Ms Danus
- <td>Doughnuts
- <td><img src="http://example.com/mydoughnuts.png" title="Doughnuts from Ms Danus">
- <td>$45
- <tr>
- <td><input id=e1 type=text name=who required form=f>
- <td><input id=e2 type=text name=what required form=f>
- <td><input id=e3 type=url name=pic form=f>
- <td><input id=e4 type=number step=0.01 min=0 value=0 required form=f>
- </table>
- <form id=f action="/auction.cgi">
- <input type=button name=add value="Submit">
- </form></pre>
- </div>
- <h4 id=the-tfoot-element>4.9.7 The <dfn><code>tfoot</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-tfoot-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-tfoot-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-tfoot-element:the-table-element><a href=#the-table-element>table</a></code> element, after any
- <code id=the-tfoot-element:the-caption-element><a href=#the-caption-element>caption</a></code>, <code id=the-tfoot-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>, and <code id=the-tfoot-element:the-thead-element><a href=#the-thead-element>thead</a></code>
- elements and before any <code id=the-tfoot-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code> and <code id=the-tfoot-element:the-tr-element><a href=#the-tr-element>tr</a></code>
- elements, but only if there are no other <code id=the-tfoot-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>
- elements that are children of the <code id=the-tfoot-element:the-table-element-2><a href=#the-table-element>table</a></code> element.<dd>As a child of a <code id=the-tfoot-element:the-table-element-3><a href=#the-table-element>table</a></code> element, after any
- <code id=the-tfoot-element:the-caption-element-2><a href=#the-caption-element>caption</a></code>, <code id=the-tfoot-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code>, <code id=the-tfoot-element:the-thead-element-2><a href=#the-thead-element>thead</a></code>,
- <code id=the-tfoot-element:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code>, and <code id=the-tfoot-element:the-tr-element-2><a href=#the-tr-element>tr</a></code> elements, but only if there
- are no other <code id=the-tfoot-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> elements that are children of the
- <code id=the-tfoot-element:the-table-element-4><a href=#the-table-element>table</a></code> element.<dt><a href=#concept-element-content-model id=the-tfoot-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-tfoot-element:the-tr-element-3><a href=#the-tr-element>tr</a></code> and <a href=#script-supporting-elements-2 id=the-tfoot-element:script-supporting-elements-2>script-supporting</a> elements<dt><a href=#concept-element-tag-omission id=the-tfoot-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-tfoot-element:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> element's <a href=#syntax-end-tag id=the-tfoot-element:syntax-end-tag>end tag</a> can be omitted if
- the <code id=the-tfoot-element:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> element is immediately followed by a <code id=the-tfoot-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> element, or if
- there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-tfoot-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-tfoot-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-tfoot-element:concept-element-dom>DOM interface</a>:<dd><code id=the-tfoot-element:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, as defined for
- <code id=the-tfoot-element:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code> elements.</dl>
- <p>The <code id=the-tfoot-element:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code> element <a href=#represents id=the-tfoot-element:represents>represents</a> the <a href=#concept-row-group id=the-tfoot-element:concept-row-group>block</a> of <a href=#concept-row id=the-tfoot-element:concept-row>rows</a> that consist of
- the column summaries (footers) for the parent <code id=the-tfoot-element:the-table-element-5><a href=#the-table-element>table</a></code> element, if the
- <code id=the-tfoot-element:the-tfoot-element-6><a href=#the-tfoot-element>tfoot</a></code> element has a parent and it is a <code id=the-tfoot-element:the-table-element-6><a href=#the-table-element>table</a></code>.</p>
-
- <p>The <code id=the-tfoot-element:the-tfoot-element-7><a href=#the-tfoot-element>tfoot</a></code> element takes part in the <a href=#table-model id=the-tfoot-element:table-model>table
- model</a>.</p>
-
- <h4 id=the-tr-element>4.9.8 The <dfn><code>tr</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-tr-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-tr-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-tr-element:the-thead-element><a href=#the-thead-element>thead</a></code> element.<dd>As a child of a <code id=the-tr-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element.<dd>As a child of a <code id=the-tr-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element.<dd>As a child of a <code id=the-tr-element:the-table-element><a href=#the-table-element>table</a></code> element, after any
- <code id=the-tr-element:the-caption-element><a href=#the-caption-element>caption</a></code>, <code id=the-tr-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>, and <code id=the-tr-element:the-thead-element-2><a href=#the-thead-element>thead</a></code>
- elements, but only if there are no <code id=the-tr-element:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> elements that
- are children of the <code id=the-tr-element:the-table-element-2><a href=#the-table-element>table</a></code> element.<dt><a href=#concept-element-content-model id=the-tr-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-tr-element:the-td-element><a href=#the-td-element>td</a></code>, <code id=the-tr-element:the-th-element><a href=#the-th-element>th</a></code>, and <a href=#script-supporting-elements-2 id=the-tr-element:script-supporting-elements-2>script-supporting</a> elements<dt><a href=#concept-element-tag-omission id=the-tr-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-tr-element:the-tr-element><a href=#the-tr-element>tr</a></code> element's <a href=#syntax-end-tag id=the-tr-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-tr-element:the-tr-element-2><a href=#the-tr-element>tr</a></code> element is immediately followed by another <code id=the-tr-element:the-tr-element-3><a href=#the-tr-element>tr</a></code> element, or if there is
- no more content in the parent element.<dt><a href=#concept-element-attributes id=the-tr-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-tr-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-tr-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltablerowelement>HTMLTableRowElement</dfn> : <a href=#htmlelement id=the-tr-element:htmlelement>HTMLElement</a> {
- readonly attribute long <a href=#dom-tr-rowindex id=the-tr-element:dom-tr-rowindex>rowIndex</a>;
- readonly attribute long <a href=#dom-tr-sectionrowindex id=the-tr-element:dom-tr-sectionrowindex>sectionRowIndex</a>;
- readonly attribute <a href=#htmlcollection id=the-tr-element:htmlcollection>HTMLCollection</a> <a href=#dom-tr-cells id=the-tr-element:dom-tr-cells>cells</a>;
- <a href=#htmlelement id=the-tr-element:htmlelement-2>HTMLElement</a> <a href=#dom-tr-insertcell id=the-tr-element:dom-tr-insertcell>insertCell</a>(optional long index = -1);
- void <a href=#dom-tr-deletecell id=the-tr-element:dom-tr-deletecell>deleteCell</a>(long index);
- // <a href="#HTMLTableRowElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-tr-element:the-tr-element-4><a href=#the-tr-element>tr</a></code> element <a href=#represents id=the-tr-element:represents>represents</a> a <a href=#concept-row id=the-tr-element:concept-row>row</a> of
- <a href=#concept-cell id=the-tr-element:concept-cell>cells</a> in a <a href=#concept-table id=the-tr-element:concept-table>table</a>.</p>
-
- <p>The <code id=the-tr-element:the-tr-element-5><a href=#the-tr-element>tr</a></code> element takes part in the <a href=#table-model id=the-tr-element:table-model>table model</a>.</p>
-
- <dl class=domintro><dt><var>tr</var> . <code id=the-tr-element:dom-tr-rowindex-2><a href=#dom-tr-rowindex>rowIndex</a></code><dd>
- <p>Returns the position of the row in the table's <code id=the-tr-element:dom-table-rows><a href=#dom-table-rows>rows</a></code>
- list.</p>
- <p>Returns −1 if the element isn't in a table.</p>
- <dt><var>tr</var> . <code id=the-tr-element:dom-tr-sectionrowindex-2><a href=#dom-tr-sectionrowindex>sectionRowIndex</a></code><dd>
- <p>Returns the position of the row in the table section's <code id=the-tr-element:dom-tbody-rows><a href=#dom-tbody-rows>rows</a></code> list.</p>
- <p>Returns −1 if the element isn't in a table section.</p>
- <dt><var>tr</var> . <code id=the-tr-element:dom-tr-cells-2><a href=#dom-tr-cells>cells</a></code><dd>
- <p>Returns an <code id=the-tr-element:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-tr-element:the-td-element-2><a href=#the-td-element>td</a></code> and <code id=the-tr-element:the-th-element-2><a href=#the-th-element>th</a></code> elements of
- the row.</p>
- <dt><var>cell</var> = <var>tr</var> . <code id=the-tr-element:dom-tr-insertcell-2><a href=#dom-tr-insertcell>insertCell</a></code>( [ <var>index</var> ] )<dd>
- <p>Creates a <code id=the-tr-element:the-td-element-3><a href=#the-td-element>td</a></code> element, inserts it into the table row at the position given by the
- argument, and returns the <code id=the-tr-element:the-td-element-4><a href=#the-td-element>td</a></code>.</p>
- <p>The position is relative to the cells in the row. The index −1, which is the default
- if the argument is omitted, is equivalent to inserting at the end of the row.</p>
- <p>If the given position is less than −1 or greater than the number of cells, throws an
- <code id=the-tr-element:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <dt><var>tr</var> . <code id=the-tr-element:dom-tr-deletecell-2><a href=#dom-tr-deletecell>deleteCell</a></code>(<var>index</var>)<dd>
- <p>Removes the <code id=the-tr-element:the-td-element-5><a href=#the-td-element>td</a></code> or <code id=the-tr-element:the-th-element-3><a href=#the-th-element>th</a></code> element with the given position in the
- row.</p>
- <p>The position is relative to the cells in the row. The index −1 is equivalent to
- deleting the last cell of the row.</p>
- <p>If the given position is less than −1 or greater than the index of the last cell, or
- if there are no cells, throws an <code id=the-tr-element:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- </dl>
-
- <p>The <dfn id=dom-tr-rowindex><code>rowIndex</code></dfn> attribute must, if the element has
- a parent <code id=the-tr-element:the-table-element-3><a href=#the-table-element>table</a></code> element, or a parent <code id=the-tr-element:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>, <code id=the-tr-element:the-thead-element-3><a href=#the-thead-element>thead</a></code>, or
- <code id=the-tr-element:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element and a <em>grandparent</em> <code id=the-tr-element:the-table-element-4><a href=#the-table-element>table</a></code> element, return the index
- of the <code id=the-tr-element:the-tr-element-6><a href=#the-tr-element>tr</a></code> element in that <code id=the-tr-element:the-table-element-5><a href=#the-table-element>table</a></code> element's <code id=the-tr-element:dom-table-rows-2><a href=#dom-table-rows>rows</a></code> collection. If there is no such <code id=the-tr-element:the-table-element-6><a href=#the-table-element>table</a></code> element,
- then the attribute must return −1.</p>
- <p>The <dfn id=dom-tr-sectionrowindex><code>sectionRowIndex</code></dfn> attribute must, if
- the element has a parent <code id=the-tr-element:the-table-element-7><a href=#the-table-element>table</a></code>, <code id=the-tr-element:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, <code id=the-tr-element:the-thead-element-4><a href=#the-thead-element>thead</a></code>, or
- <code id=the-tr-element:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> element, return the index of the <code id=the-tr-element:the-tr-element-7><a href=#the-tr-element>tr</a></code> element in the parent
- element's <code>rows</code> collection (for tables, that's the <code id=the-tr-element:dom-table-rows-3><a href=#dom-table-rows>HTMLTableElement.rows</a></code> collection; for table sections, that's the
- <code id=the-tr-element:dom-tbody-rows-2><a href=#dom-tbody-rows>HTMLTableRowElement.rows</a></code> collection). If there is no such
- parent element, then the attribute must return −1.</p>
- <p>The <dfn id=dom-tr-cells><code>cells</code></dfn> attribute must return an
- <code id=the-tr-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-tr-element:the-tr-element-8><a href=#the-tr-element>tr</a></code> element, whose filter matches only
- <code id=the-tr-element:the-td-element-6><a href=#the-td-element>td</a></code> and <code id=the-tr-element:the-th-element-4><a href=#the-th-element>th</a></code> elements that are children of the <code id=the-tr-element:the-tr-element-9><a href=#the-tr-element>tr</a></code> element.</p>
- <p>The <dfn id=dom-tr-insertcell><code>insertCell(<var>index</var>)</code></dfn>
- method must act as follows:</p>
- <p>If <var>index</var> is less than −1 or greater than the number of elements in
- the <code id=the-tr-element:dom-tr-cells-3><a href=#dom-tr-cells>cells</a></code> collection, the method must throw an
- <code id=the-tr-element:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <p>If <var>index</var> is equal to −1 or equal to the number of items in <code id=the-tr-element:dom-tr-cells-4><a href=#dom-tr-cells>cells</a></code> collection, the method must create a <code id=the-tr-element:the-td-element-7><a href=#the-td-element>td</a></code> element,
- append it to the <code id=the-tr-element:the-tr-element-10><a href=#the-tr-element>tr</a></code> element, and return the newly created <code id=the-tr-element:the-td-element-8><a href=#the-td-element>td</a></code>
- element.</p>
- <p>Otherwise, the method must create a <code id=the-tr-element:the-td-element-9><a href=#the-td-element>td</a></code> element, insert it as a child of the
- <code id=the-tr-element:the-tr-element-11><a href=#the-tr-element>tr</a></code> element, immediately before the <var>index</var>th <code id=the-tr-element:the-td-element-10><a href=#the-td-element>td</a></code> or
- <code id=the-tr-element:the-th-element-5><a href=#the-th-element>th</a></code> element in the <code id=the-tr-element:dom-tr-cells-5><a href=#dom-tr-cells>cells</a></code> collection, and finally
- must return the newly created <code id=the-tr-element:the-td-element-11><a href=#the-td-element>td</a></code> element.</p>
- <p>The <dfn id=dom-tr-deletecell><code>deleteCell(<var>index</var>)</code></dfn>
- method must remove the <var>index</var>th element in the <code id=the-tr-element:dom-tr-cells-6><a href=#dom-tr-cells>cells</a></code> collection from its parent. If <var>index</var> is less
- than zero or greater than or equal to the number of elements in the <code id=the-tr-element:dom-tr-cells-7><a href=#dom-tr-cells>cells</a></code> collection, the method must instead throw an
- <code id=the-tr-element:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
-
- <h4 id=the-td-element>4.9.9 The <dfn><code>td</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-td-element:concept-element-categories>Categories</a>:<dd><a href=#sectioning-root id=the-td-element:sectioning-root>Sectioning root</a>.<dt><a href=#concept-element-contexts id=the-td-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-td-element:the-tr-element><a href=#the-tr-element>tr</a></code> element.<dt><a href=#concept-element-content-model id=the-td-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-td-element:flow-content-2>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-td-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-td-element:the-td-element><a href=#the-td-element>td</a></code> element's <a href=#syntax-end-tag id=the-td-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-td-element:the-td-element-2><a href=#the-td-element>td</a></code> element is immediately followed by a <code id=the-td-element:the-td-element-3><a href=#the-td-element>td</a></code> or <code id=the-td-element:the-th-element><a href=#the-th-element>th</a></code> element,
- or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-td-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-td-element:global-attributes>Global attributes</a><dd><code id=the-td-element:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> — Number of columns that the cell is to span<dd><code id=the-td-element:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> — Number of rows that the cell is to span<dd><code id=the-td-element:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> — The header cells for this cell<dt><a href=#concept-element-dom id=the-td-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltabledatacellelement>HTMLTableDataCellElement</dfn> : <a href=#htmltablecellelement id=the-td-element:htmltablecellelement>HTMLTableCellElement</a> {
- // <a href="#HTMLTableDataCellElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-td-element:the-td-element-4><a href=#the-td-element>td</a></code> element <a href=#represents id=the-td-element:represents>represents</a> a data <a href=#concept-cell id=the-td-element:concept-cell>cell</a> in a table.</p>
-
- <p>The <code id=the-td-element:the-td-element-5><a href=#the-td-element>td</a></code> element and its <code id=the-td-element:attr-tdth-colspan-2><a href=#attr-tdth-colspan>colspan</a></code>, <code id=the-td-element:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code id=the-td-element:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code>
- attributes take part in the <a href=#table-model id=the-td-element:table-model>table model</a>.</p>
- <p>User agents, especially in non-visual environments or where displaying the table as a 2D grid
- is impractical, may give the user context for the cell when rendering the contents of a cell; for
- instance, giving its position in the <a href=#table-model id=the-td-element:table-model-2>table model</a>, or listing the cell's header cells
- (as determined by the <a href=#algorithm-for-assigning-header-cells id=the-td-element:algorithm-for-assigning-header-cells>algorithm for assigning header cells</a>). When a cell's header
- cells are being listed, user agents may use the value of <code id=the-td-element:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code>
- attributes on those header cells, if any, instead of the contents of the header cells
- themselves.</p>
-
- <h4 id=the-th-element>4.9.10 The <dfn><code>th</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-th-element:concept-element-categories>Categories</a>:<dd>If the <code id=the-th-element:the-th-element><a href=#the-th-element>th</a></code> element is a <a href=#sorting-interface-th-element id=the-th-element:sorting-interface-th-element>sorting interface <code>th</code> element</a>: <a href=#interactive-content-2 id=the-th-element:interactive-content-2>Interactive content</a>.<dd>Otherwise: None.<dt><a href=#concept-element-contexts id=the-th-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-th-element:the-tr-element><a href=#the-tr-element>tr</a></code> element.<dt><a href=#concept-element-content-model id=the-th-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-th-element:flow-content-2>Flow content</a>, but with no <code id=the-th-element:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-th-element:the-footer-element><a href=#the-footer-element>footer</a></code>, <a href=#sectioning-content-2 id=the-th-element:sectioning-content-2>sectioning content</a>, or <a href=#heading-content-2 id=the-th-element:heading-content-2>heading content</a> descendants, and if the <code id=the-th-element:the-th-element-2><a href=#the-th-element>th</a></code> element is a <a href=#sorting-interface-th-element id=the-th-element:sorting-interface-th-element-2>sorting interface <code>th</code> element</a>, no <a href=#interactive-content-2 id=the-th-element:interactive-content-2-2>interactive content</a> descendants.<dt><a href=#concept-element-tag-omission id=the-th-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>A <code id=the-th-element:the-th-element-3><a href=#the-th-element>th</a></code> element's <a href=#syntax-end-tag id=the-th-element:syntax-end-tag>end tag</a> can be omitted if the
- <code id=the-th-element:the-th-element-4><a href=#the-th-element>th</a></code> element is immediately followed by a <code id=the-th-element:the-td-element><a href=#the-td-element>td</a></code> or <code id=the-th-element:the-th-element-5><a href=#the-th-element>th</a></code> element,
- or if there is no more content in the parent element.<dt><a href=#concept-element-attributes id=the-th-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-th-element:global-attributes>Global attributes</a><dd><code id=the-th-element:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> — Number of columns that the cell is to span<dd><code id=the-th-element:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> — Number of rows that the cell is to span<dd><code id=the-th-element:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> — The header cells for this cell<dd><code id=the-th-element:attr-th-scope><a href=#attr-th-scope>scope</a></code> — Specifies which cells the header cell applies to<dd><code id=the-th-element:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> — Alternative label to use for the header cell when referencing the cell in other contexts<dd><code id=the-th-element:attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> — <a href=#column-sort-direction id=the-th-element:column-sort-direction>Column sort direction</a> and <a href=#column-key-ordinality id=the-th-element:column-key-ordinality>ordinality</a><dt><a href=#concept-element-dom id=the-th-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltableheadercellelement>HTMLTableHeaderCellElement</dfn> : <a href=#htmltablecellelement id=the-th-element:htmltablecellelement>HTMLTableCellElement</a> {
- attribute DOMString <a href=#dom-th-scope id=the-th-element:dom-th-scope>scope</a>;
- attribute DOMString <a href=#dom-th-abbr id=the-th-element:dom-th-abbr>abbr</a>;
- attribute DOMString <a href=#dom-th-sorted id=the-th-element:dom-th-sorted>sorted</a>;
- void <a href=#dom-th-sort id=the-th-element:dom-th-sort>sort</a>();
- };</pre>
- </dl>
- <p>The <code id=the-th-element:the-th-element-6><a href=#the-th-element>th</a></code> element <a href=#represents id=the-th-element:represents>represents</a> a header <a href=#concept-cell id=the-th-element:concept-cell>cell</a> in a table.</p>
- <p>The <code id=the-th-element:the-th-element-7><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-th-scope><code>scope</code></dfn>
- content attribute specified. The <code id=the-th-element:attr-th-scope-2><a href=#attr-th-scope>scope</a></code> attribute is an
- <a href=#enumerated-attribute id=the-th-element:enumerated-attribute>enumerated attribute</a> with five states, four of which have explicit keywords:</p>
- <dl><dt>The <dfn id=attr-th-scope-row><code>row</code></dfn> keyword, which maps to the
- <i>row</i> state<dd>The <i>row</i> state means the header cell applies to some of the subsequent cells in the
- same row(s).<dt>The <dfn id=attr-th-scope-col><code>col</code></dfn> keyword, which maps to the
- <i>column</i> state<dd>The <i>column</i> state means the header cell applies to some of the subsequent cells in the
- same column(s).<dt>The <dfn id=attr-th-scope-rowgroup><code>rowgroup</code></dfn> keyword, which maps to
- the <i>row group</i> state<dd>The <i>row group</i> state means the header cell applies to all the remaining cells in the
- row group. A <code id=the-th-element:the-th-element-8><a href=#the-th-element>th</a></code> element's <code id=the-th-element:attr-th-scope-3><a href=#attr-th-scope>scope</a></code> attribute must
- not be in the <a href=#attr-th-scope-rowgroup id=the-th-element:attr-th-scope-rowgroup>row group</a> state if the element is not
- anchored in a <a href=#concept-row-group id=the-th-element:concept-row-group>row group</a>.<dt>The <dfn id=attr-th-scope-colgroup><code>colgroup</code></dfn> keyword, which maps to
- the <i>column group</i> state<dd>The <i>column group</i> state means the header cell applies to all the remaining cells in the
- column group. A <code id=the-th-element:the-th-element-9><a href=#the-th-element>th</a></code> element's <code id=the-th-element:attr-th-scope-4><a href=#attr-th-scope>scope</a></code> attribute must
- not be in the <a href=#attr-th-scope-colgroup id=the-th-element:attr-th-scope-colgroup>column group</a> state if the element is
- not anchored in a <a href=#concept-column-group id=the-th-element:concept-column-group>column group</a>.<dt>The <dfn id=attr-th-scope-auto>auto</dfn> state<dd>The <i>auto</i> state makes the header cell apply to a set of cells selected based on
- context.</dl>
- <p>The <code id=the-th-element:attr-th-scope-5><a href=#attr-th-scope>scope</a></code> attribute's <i id=the-th-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the
- <i>auto</i> state.</p>
- <p>The <code id=the-th-element:the-th-element-10><a href=#the-th-element>th</a></code> element may have an <dfn id=attr-th-abbr><code>abbr</code></dfn>
- content attribute specified. Its value must be an alternative label for the header cell, to be
- used when referencing the cell in other contexts (e.g. when describing the header cells that apply
- to a data cell). It is typically an abbreviated form of the full header cell, but can also be an
- expansion, or merely a different phrasing.</p>
- <p>The <code id=the-th-element:attr-th-sorted-2><a href=#attr-th-sorted>sorted</a></code> attribute is used in the <a href=#table-sorting-model id=the-th-element:table-sorting-model>table
- sorting model</a>.</p>
-
- <p>The <code id=the-th-element:the-th-element-11><a href=#the-th-element>th</a></code> element and its <code id=the-th-element:attr-tdth-colspan-2><a href=#attr-tdth-colspan>colspan</a></code>, <code id=the-th-element:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>rowspan</a></code>, <code id=the-th-element:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code>, and
- <code id=the-th-element:attr-th-scope-6><a href=#attr-th-scope>scope</a></code> attributes take part in the <a href=#table-model id=the-th-element:table-model>table model</a>.</p>
- <p>The <code id=the-th-element:dom-th-sort-2><a href=#dom-th-sort>sort()</a></code> method is used in the <a href=#table-sorting-model id=the-th-element:table-sorting-model-2>table sorting
- model</a>.</p>
- <p>The <dfn id=dom-th-scope><code>scope</code></dfn> IDL attribute must <a href=#reflect id=the-th-element:reflect>reflect</a>
- the content attribute of the same name, <a href=#limited-to-only-known-values id=the-th-element:limited-to-only-known-values>limited to only known values</a>.</p>
- <p>The <dfn id=dom-th-abbr><code>abbr</code></dfn> and <dfn id=dom-th-sorted><code>sorted</code></dfn> IDL attributes must <a href=#reflect id=the-th-element:reflect-2>reflect</a> the
- content attributes of the same name.</p>
-
- <div class=example>
- <p>The following example shows how the <code id=the-th-element:attr-th-scope-7><a href=#attr-th-scope>scope</a></code> attribute's <code id=the-th-element:attr-th-scope-rowgroup-2><a href=#attr-th-scope-rowgroup>rowgroup</a></code> value affects which data cells a header cell
- applies to.</p>
- <p>Here is a markup fragment showing a table:</p>
- <pre><table>
- <thead>
- <tr> <th> ID <th> Measurement <th> Average <th> Maximum
- <tbody>
- <tr> <td> <th scope=rowgroup> Cats <td> <td>
- <tr> <td> 93 <th scope=row> Legs <td> 3.5 <td> 4
- <tr> <td> 10 <th scope=row> Tails <td> 1 <td> 1
- <tbody>
- <tr> <td> <th scope=rowgroup> English speakers <td> <td>
- <tr> <td> 32 <th scope=row> Legs <td> 2.67 <td> 4
- <tr> <td> 35 <th scope=row> Tails <td> 0.33 <td> 1
- </table></pre>
- <p>This would result in the following table:</p>
- <table><thead><tr><th> ID <th> Measurement <th> Average <th> Maximum
- <tbody><tr><td> <th scope=rowgroup> Cats <td> <td>
- <tr><td> 93 <th scope=row> Legs <td> 3.5 <td> 4
- <tr><td> 10 <th scope=row> Tails <td> 1 <td> 1
- <tbody><tr><td> <th scope=rowgroup> English speakers <td> <td>
- <tr><td> 32 <th scope=row> Legs <td> 2.67 <td> 4
- <tr><td> 35 <th scope=row> Tails <td> 0.33 <td> 1
- </table>
- <p>The headers in the first row all apply directly down to the rows in their column.</p>
- <p>The headers with the explicit <code id=the-th-element:attr-th-scope-8><a href=#attr-th-scope>scope</a></code> attributes apply to all
- the cells in their row group other than the cells in the first column.</p>
- <p>The remaining headers apply just to the cells to the right of them.</p>
-
- <img src=http://images.whatwg.org/table-scope-diagram.png width=459 alt="" height=256>
- </div>
- <h4 id=attributes-common-to-td-and-th-elements>4.9.11 Attributes common to <code id=attributes-common-to-td-and-th-elements:the-td-element><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element><a href=#the-th-element>th</a></code> elements</h4>
- <p>The <code id=attributes-common-to-td-and-th-elements:the-td-element-2><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element-2><a href=#the-th-element>th</a></code> elements may have a <dfn id=attr-tdth-colspan><code>colspan</code></dfn> content attribute specified, whose value must
- be a <a href=#valid-non-negative-integer id=attributes-common-to-td-and-th-elements:valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>
- <p>The <code id=attributes-common-to-td-and-th-elements:the-td-element-3><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element-3><a href=#the-th-element>th</a></code> elements may also have a <dfn id=attr-tdth-rowspan><code>rowspan</code></dfn> content attribute specified, whose value must
- be a <a href=#valid-non-negative-integer id=attributes-common-to-td-and-th-elements:valid-non-negative-integer-2>valid non-negative integer</a>. For this attribute, the value zero means that the
- cell is to span all the remaining rows in the row group.</p>
- <p>These attributes give the number of columns and rows respectively that the cell is to span.
- These attributes must not be used to overlap cells, as described in the
- description of the <a href=#table-model id=attributes-common-to-td-and-th-elements:table-model>table model</a>.</p>
- <hr>
- <p>The <code id=attributes-common-to-td-and-th-elements:the-td-element-4><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element-4><a href=#the-th-element>th</a></code> element may have a <dfn id=attr-tdth-headers><code>headers</code></dfn> content attribute specified. The <code id=attributes-common-to-td-and-th-elements:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute, if specified, must contain a string consisting
- of an <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-common-to-td-and-th-elements:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are
- <a href=#case-sensitive id=attributes-common-to-td-and-th-elements:case-sensitive>case-sensitive</a>, each of which must have the value of an <a href=#concept-id id=attributes-common-to-td-and-th-elements:concept-id>ID</a> of a <code id=attributes-common-to-td-and-th-elements:the-th-element-5><a href=#the-th-element>th</a></code> element taking part in the same <a href=#concept-table id=attributes-common-to-td-and-th-elements:concept-table>table</a> as the <code id=attributes-common-to-td-and-th-elements:the-td-element-5><a href=#the-td-element>td</a></code> or <code id=attributes-common-to-td-and-th-elements:the-th-element-6><a href=#the-th-element>th</a></code> element (as defined by the <a href=#table-model id=attributes-common-to-td-and-th-elements:table-model-2>table model</a>).</p>
- <p>A <code id=attributes-common-to-td-and-th-elements:the-th-element-7><a href=#the-th-element>th</a></code> element with <a href=#concept-id id=attributes-common-to-td-and-th-elements:concept-id-2>ID</a> <var>id</var> is
- said to be <i>directly targeted</i> by all <code id=attributes-common-to-td-and-th-elements:the-td-element-6><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element-8><a href=#the-th-element>th</a></code> elements in the
- same <a href=#concept-table id=attributes-common-to-td-and-th-elements:concept-table-2>table</a> that have <code id=attributes-common-to-td-and-th-elements:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code> attributes whose values include as one of their tokens
- the <a href=#concept-id id=attributes-common-to-td-and-th-elements:concept-id-3>ID</a> <var>id</var>. A <code id=attributes-common-to-td-and-th-elements:the-th-element-9><a href=#the-th-element>th</a></code> element <var>A</var> is said to be <i>targeted</i> by a <code id=attributes-common-to-td-and-th-elements:the-th-element-10><a href=#the-th-element>th</a></code> or <code id=attributes-common-to-td-and-th-elements:the-td-element-7><a href=#the-td-element>td</a></code> element
- <var>B</var> if either <var>A</var> is <i>directly targeted</i> by <var>B</var> or if there exists an element <var>C</var> that is itself
- <i>targeted</i> by the element <var>B</var> and <var>A</var> is <i>directly
- targeted</i> by <var>C</var>.</p>
- <p>A <code id=attributes-common-to-td-and-th-elements:the-th-element-11><a href=#the-th-element>th</a></code> element must not be <i>targeted</i> by itself.</p>
-
- <p>The <code id=attributes-common-to-td-and-th-elements:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>, <code id=attributes-common-to-td-and-th-elements:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>, and <code id=attributes-common-to-td-and-th-elements:attr-tdth-headers-3><a href=#attr-tdth-headers>headers</a></code>
- attributes take part in the <a href=#table-model id=attributes-common-to-td-and-th-elements:table-model-3>table model</a>.</p>
-
- <hr>
- <p>The <code id=attributes-common-to-td-and-th-elements:the-td-element-8><a href=#the-td-element>td</a></code> and <code id=attributes-common-to-td-and-th-elements:the-th-element-12><a href=#the-th-element>th</a></code> elements implement interfaces that inherit from the
- <code id=attributes-common-to-td-and-th-elements:htmltablecellelement><a href=#htmltablecellelement>HTMLTableCellElement</a></code> interface:</p>
- <pre class=idl>interface <dfn id=htmltablecellelement>HTMLTableCellElement</dfn> : <a href=#htmlelement id=attributes-common-to-td-and-th-elements:htmlelement>HTMLElement</a> {
- attribute unsigned long <a href=#dom-tdth-colspan id=attributes-common-to-td-and-th-elements:dom-tdth-colspan>colSpan</a>;
- attribute unsigned long <a href=#dom-tdth-rowspan id=attributes-common-to-td-and-th-elements:dom-tdth-rowspan>rowSpan</a>;
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=attributes-common-to-td-and-th-elements:dom-domsettabletokenlist-value>value</a>] readonly attribute <a href=#domsettabletokenlist id=attributes-common-to-td-and-th-elements:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-tdth-headers id=attributes-common-to-td-and-th-elements:dom-tdth-headers>headers</a>;
- readonly attribute long <a href=#dom-tdth-cellindex id=attributes-common-to-td-and-th-elements:dom-tdth-cellindex>cellIndex</a>;
- // <a href="#HTMLTableCellElement-partial">also has obsolete members</a>
- };</pre>
- <dl class=domintro><dt><var>cell</var> . <code id=attributes-common-to-td-and-th-elements:dom-tdth-cellindex-2><a href=#dom-tdth-cellindex>cellIndex</a></code><dd>
- <p>Returns the position of the cell in the row's <code id=attributes-common-to-td-and-th-elements:dom-tr-cells><a href=#dom-tr-cells>cells</a></code> list.
- This does not necessarily correspond to the <var>x</var>-position of the cell in the
- table, since earlier cells might cover multiple rows or columns.</p>
- <p>Returns −1 if the element isn't in a row.</p>
- </dl>
-
- <p>The <dfn id=dom-tdth-colspan><code>colSpan</code></dfn> IDL attribute must
- <a href=#reflect id=attributes-common-to-td-and-th-elements:reflect>reflect</a> the <code id=attributes-common-to-td-and-th-elements:attr-tdth-colspan-2><a href=#attr-tdth-colspan>colspan</a></code> content attribute. Its
- default value is 1.</p>
-
- <p>The <dfn id=dom-tdth-rowspan><code>rowSpan</code></dfn> IDL attribute must
- <a href=#reflect id=attributes-common-to-td-and-th-elements:reflect-2>reflect</a> the <code id=attributes-common-to-td-and-th-elements:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>rowspan</a></code> content attribute. Its
- default value is 1.</p>
- <p>The <dfn id=dom-tdth-headers><code>headers</code></dfn> IDL attribute must
- <a href=#reflect id=attributes-common-to-td-and-th-elements:reflect-3>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-tdth-cellindex><code>cellIndex</code></dfn> IDL attribute must, if the
- element has a parent <code id=attributes-common-to-td-and-th-elements:the-tr-element><a href=#the-tr-element>tr</a></code> element, return the index of the cell's element in the parent
- element's <code id=attributes-common-to-td-and-th-elements:dom-tr-cells-2><a href=#dom-tr-cells>cells</a></code> collection. If there is no such parent element,
- then the attribute must return −1.</p>
-
-
- <h4 id=processing-model-3>4.9.12 Processing model</h4>
- <p>The various table elements and their content attributes together define the <dfn id=table-model>table
- model</dfn>.</p>
- <p>A <dfn id=concept-table>table</dfn> consists of cells aligned on a two-dimensional grid of
- <dfn id=concept-slots>slots</dfn> with coordinates (<var>x</var>, <var>y</var>). The grid is finite, and is either empty or has one or more slots. If the grid
- has one or more slots, then the <var>x</var> coordinates are always in the range <span>0 ≤ <var>x</var> < <var>x<sub>width</sub></var></span>, and the <var>y</var> coordinates are always in the
- range <span>0 ≤ <var>y</var> < <var>y<sub>height</sub></var></span>. If one or both of <var>x<sub>width</sub></var> and <var>y<sub>height</sub></var> are zero, then the
- table is empty (has no slots). Tables correspond to <code id=processing-model-3:the-table-element><a href=#the-table-element>table</a></code> elements.</p>
- <p>A <dfn id=concept-cell>cell</dfn> is a set of slots anchored at a slot (<var>cell<sub>x</sub></var>, <var>cell<sub>y</sub></var>), and with
- a particular <var>width</var> and <var>height</var> such that the cell covers
- all the slots with coordinates (<var>x</var>, <var>y</var>) where <span><var>cell<sub>x</sub></var> ≤ <var>x</var> < <var>cell<sub>x</sub></var>+<var>width</var></span> and <span><var>cell<sub>y</sub></var> ≤ <var>y</var> < <var>cell<sub>y</sub></var>+<var>height</var></span>. Cells can either be <em>data cells</em>
- or <em>header cells</em>. Data cells correspond to <code id=processing-model-3:the-td-element><a href=#the-td-element>td</a></code> elements, and header cells
- correspond to <code id=processing-model-3:the-th-element><a href=#the-th-element>th</a></code> elements. Cells of both types can have zero or more associated
- header cells.</p>
- <p>It is possible, in certain error cases, for two cells to occupy the same slot.</p>
- <p>A <dfn id=concept-row>row</dfn> is a complete set of slots from <span><var>x</var>=0</span> to <span><var>x</var>=<var>x<sub>width</sub></var>-1</span>, for a particular value of <var>y</var>. Rows usually
- correspond to <code id=processing-model-3:the-tr-element><a href=#the-tr-element>tr</a></code> elements, though a <a href=#concept-row-group id=processing-model-3:concept-row-group>row group</a>
- can have some implied <a href=#concept-row id=processing-model-3:concept-row>rows</a> at the end in some cases involving
- <a href=#concept-cell id=processing-model-3:concept-cell>cells</a> spanning multiple rows.</p>
- <p>A <dfn id=concept-column>column</dfn> is a complete set of slots from <span><var>y</var>=0</span> to <span><var>y</var>=<var>y<sub>height</sub></var>-1</span>, for a particular value of <var>x</var>. Columns can
- correspond to <code id=processing-model-3:the-col-element><a href=#the-col-element>col</a></code> elements. In the absence of <code id=processing-model-3:the-col-element-2><a href=#the-col-element>col</a></code> elements, columns are
- implied.</p>
- <p>A <dfn id=concept-row-group>row group</dfn> is a set of <a href=#concept-row id=processing-model-3:concept-row-2>rows</a> anchored at a slot (0, <var>group<sub>y</sub></var>) with a particular <var>height</var> such that the row group
- covers all the slots with coordinates (<var>x</var>, <var>y</var>) where <span>0 ≤ <var>x</var> < <var>x<sub>width</sub></var></span> and <span><var>group<sub>y</sub></var> ≤ <var>y</var> < <var>group<sub>y</sub></var>+<var>height</var></span>. Row groups correspond to
- <code id=processing-model-3:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=processing-model-3:the-thead-element><a href=#the-thead-element>thead</a></code>, and <code id=processing-model-3:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> elements. Not every row is
- necessarily in a row group.</p>
- <p>A <dfn id=concept-column-group>column group</dfn> is a set of <a href=#concept-column id=processing-model-3:concept-column>columns</a> anchored at a slot (<var>group<sub>x</sub></var>, 0) with a particular <var>width</var> such that the column group
- covers all the slots with coordinates (<var>x</var>, <var>y</var>) where <span><var>group<sub>x</sub></var> ≤ <var>x</var> < <var>group<sub>x</sub></var>+<var>width</var></span> and <span>0 ≤ <var>y</var> < <var>y<sub>height</sub></var></span>. Column
- groups correspond to <code id=processing-model-3:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> elements. Not every column is necessarily in a column
- group.</p>
- <p><a href=#concept-row-group id=processing-model-3:concept-row-group-2>Row groups</a> cannot overlap each other. Similarly, <a href=#concept-column-group id=processing-model-3:concept-column-group>column groups</a> cannot overlap each other.</p>
- <p>A <a href=#concept-cell id=processing-model-3:concept-cell-2>cell</a> cannot cover slots that are from two or more <a href=#concept-row-group id=processing-model-3:concept-row-group-3>row groups</a>. It is, however, possible for a cell to be in multiple
- <a href=#concept-column-group id=processing-model-3:concept-column-group-2>column groups</a>. All the slots that form part of one cell
- are part of zero or one <a href=#concept-row-group id=processing-model-3:concept-row-group-4>row groups</a> and zero or more <a href=#concept-column-group id=processing-model-3:concept-column-group-3>column groups</a>.</p>
- <p>In addition to <a href=#concept-cell id=processing-model-3:concept-cell-3>cells</a>, <a href=#concept-column id=processing-model-3:concept-column-2>columns</a>, <a href=#concept-row id=processing-model-3:concept-row-3>rows</a>, <a href=#concept-row-group id=processing-model-3:concept-row-group-5>row groups</a>, and <a href=#concept-column-group id=processing-model-3:concept-column-group-4>column
- groups</a>, <a href=#concept-table id=processing-model-3:concept-table>tables</a> can have a <code id=processing-model-3:the-caption-element><a href=#the-caption-element>caption</a></code> element
- associated with them. This gives the table a heading, or legend.</p>
- <p>A <dfn id=table-model-error>table model error</dfn> is an error with the data represented by <code id=processing-model-3:the-table-element-2><a href=#the-table-element>table</a></code>
- elements and their descendants. Documents must not have table model errors.</p>
- <h5 id=forming-a-table>4.9.12.1 Forming a table</h5>
- <p>To determine which elements correspond to which slots in a <a href=#concept-table id=forming-a-table:concept-table>table</a> associated with a <code id=forming-a-table:the-table-element><a href=#the-table-element>table</a></code> element, to determine the
- dimensions of the table (<var>x<sub>width</sub></var> and <var>y<sub>height</sub></var>), and to determine if there are any <a href=#table-model-error id=forming-a-table:table-model-error>table model errors</a>, user agents must use the following algorithm:</p>
- <ol><li>
- <p>Let <var>x<sub>width</sub></var> be zero.</p>
- <li>
- <p>Let <var>y<sub>height</sub></var> be zero.</p>
- <li>
- <p>Let <var>pending <code id=forming-a-table:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> elements</var> be a list of <code id=forming-a-table:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code>
- elements, initially empty.</p>
- <li>
- <p>Let <var>the table</var> be the <a href=#concept-table id=forming-a-table:concept-table-2>table</a> represented
- by the <code id=forming-a-table:the-table-element-2><a href=#the-table-element>table</a></code> element. The <var>x<sub>width</sub></var> and <var>y<sub>height</sub></var> variables give <var>the table</var>'s
- dimensions. <var>The table</var> is initially empty.</p>
- <li>
-
- <p>If the <code id=forming-a-table:the-table-element-3><a href=#the-table-element>table</a></code> element has no children elements, then return <var>the
- table</var> (which will be empty), and abort these steps.</p>
- <li>
- <p>Associate the first <code id=forming-a-table:the-caption-element><a href=#the-caption-element>caption</a></code> element child of the <code id=forming-a-table:the-table-element-4><a href=#the-table-element>table</a></code> element with
- <var>the table</var>. If there are no such children, then it has no associated
- <code id=forming-a-table:the-caption-element-2><a href=#the-caption-element>caption</a></code> element.</p>
- <li>
- <p>Let the <var>current element</var> be the first element child of the
- <code id=forming-a-table:the-table-element-5><a href=#the-table-element>table</a></code> element.</p>
- <p>If a step in this algorithm ever requires the <var>current element</var> to be <dfn id=concept-table-advance>advanced to the next child of the <code>table</code></dfn> when
- there is no such next child, then the user agent must jump to the step labeled <i>end</i>, near
- the end of this algorithm.</p>
- <li>
- <p>While the <var>current element</var> is not one of the following elements, <a href=#concept-table-advance id=forming-a-table:concept-table-advance>advance</a> the <var>current element</var> to the next
- child of the <code id=forming-a-table:the-table-element-6><a href=#the-table-element>table</a></code>:</p>
- <ul class=brief><li><code id=forming-a-table:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code><li><code id=forming-a-table:the-thead-element><a href=#the-thead-element>thead</a></code><li><code id=forming-a-table:the-tbody-element><a href=#the-tbody-element>tbody</a></code><li><code id=forming-a-table:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code><li><code id=forming-a-table:the-tr-element><a href=#the-tr-element>tr</a></code></ul>
- <li>
- <p>If the <var>current element</var> is a <code id=forming-a-table:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code>, follow these
- substeps:</p>
- <ol><li>
- <p><i>Column groups</i>: Process the <var>current element</var> according to the
- appropriate case below:</p>
- <dl class=switch><dt>If the <var>current element</var> has any <code id=forming-a-table:the-col-element><a href=#the-col-element>col</a></code> element children<dd>
- <p>Follow these steps:</p>
- <ol><li>
- <p>Let <var>x<sub>start</sub></var> have the value of <span><var>x<sub>width</sub></var></span>.</p>
- <li>
- <p>Let the <var>current column</var> be the first <code id=forming-a-table:the-col-element-2><a href=#the-col-element>col</a></code> element child
- of the <code id=forming-a-table:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element.</p>
- <li>
- <p><i>Columns</i>: If the <var>current column</var> <code id=forming-a-table:the-col-element-3><a href=#the-col-element>col</a></code> element has
- a <code id=forming-a-table:attr-col-span><a href=#attr-col-span>span</a></code> attribute, then parse its value using the
- <a href=#rules-for-parsing-non-negative-integers id=forming-a-table:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a>.</p>
- <p>If the result of parsing the value is not an error or zero, then let <var>span</var> be that value.</p>
- <p>Otherwise, if the <code id=forming-a-table:the-col-element-4><a href=#the-col-element>col</a></code> element has no <code id=forming-a-table:attr-col-span-2><a href=#attr-col-span>span</a></code> attribute, or if trying to parse the attribute's value
- resulted in an error or zero, then let <var>span</var> be 1.</p>
- <li>
- <p>Increase <var>x<sub>width</sub></var> by <var>span</var>.</p>
- <li>
- <p>Let the last <var>span</var> <a href=#concept-column id=forming-a-table:concept-column>columns</a> in
- <var>the table</var> correspond to the <var>current column</var>
- <code id=forming-a-table:the-col-element-5><a href=#the-col-element>col</a></code> element.</p>
- <li>
- <p>If <var>current column</var> is not the last <code id=forming-a-table:the-col-element-6><a href=#the-col-element>col</a></code> element child of
- the <code id=forming-a-table:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code> element, then let the <var>current column</var> be the
- next <code id=forming-a-table:the-col-element-7><a href=#the-col-element>col</a></code> element child of the <code id=forming-a-table:the-colgroup-element-5><a href=#the-colgroup-element>colgroup</a></code> element, and return to
- the step labeled <i>columns</i>.</p>
- <li>
- <p>Let all the last <a href=#concept-column id=forming-a-table:concept-column-2>columns</a> in <var>the
- table</var> from <span>x=<var>x<sub>start</sub></var></span> to
- <span>x=<var>x<sub>width</sub></var>-1</span> form a new <a href=#concept-column-group id=forming-a-table:concept-column-group>column group</a>, anchored at the slot (<var>x<sub>start</sub></var>, 0), with width <span><var>x<sub>width</sub></var>-<var>x<sub>start</sub></var></span>, corresponding to the <code id=forming-a-table:the-colgroup-element-6><a href=#the-colgroup-element>colgroup</a></code> element.</p>
- </ol>
- <dt>If the <var>current element</var> has no <code id=forming-a-table:the-col-element-8><a href=#the-col-element>col</a></code> element children<dd>
- <ol><li>
- <p>If the <code id=forming-a-table:the-colgroup-element-7><a href=#the-colgroup-element>colgroup</a></code> element has a <code id=forming-a-table:attr-colgroup-span><a href=#attr-colgroup-span>span</a></code>
- attribute, then parse its value using the <a href=#rules-for-parsing-non-negative-integers id=forming-a-table:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative
- integers</a>.</p>
- <p>If the result of parsing the value is not an error or zero, then let <var>span</var> be that value.</p>
- <p>Otherwise, if the <code id=forming-a-table:the-colgroup-element-8><a href=#the-colgroup-element>colgroup</a></code> element has no <code id=forming-a-table:attr-colgroup-span-2><a href=#attr-colgroup-span>span</a></code> attribute, or if trying to parse the attribute's
- value resulted in an error or zero, then let <var>span</var> be 1.</p>
- <li>
- <p>Increase <var>x<sub>width</sub></var> by <var>span</var>.</p>
- <li>
- <p>Let the last <var>span</var> <a href=#concept-column id=forming-a-table:concept-column-3>columns</a> in
- <var>the table</var> form a new <a href=#concept-column-group id=forming-a-table:concept-column-group-2>column
- group</a>, anchored at the slot (<span><var>x<sub>width</sub></var>-<var>span</var></span>, 0), with width <var>span</var>, corresponding to the <code id=forming-a-table:the-colgroup-element-9><a href=#the-colgroup-element>colgroup</a></code> element.</p>
- </ol>
- </dl>
- <li>
- <p><a href=#concept-table-advance id=forming-a-table:concept-table-advance-2>Advance</a> the <var>current element</var>
- to the next child of the <code id=forming-a-table:the-table-element-7><a href=#the-table-element>table</a></code>.</p>
- <li>
- <p>While the <var>current element</var> is not one of the following elements, <a href=#concept-table-advance id=forming-a-table:concept-table-advance-3>advance</a> the <var>current element</var> to the
- next child of the <code id=forming-a-table:the-table-element-8><a href=#the-table-element>table</a></code>:</p>
- <ul class=brief><li><code id=forming-a-table:the-colgroup-element-10><a href=#the-colgroup-element>colgroup</a></code><li><code id=forming-a-table:the-thead-element-2><a href=#the-thead-element>thead</a></code><li><code id=forming-a-table:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code><li><code id=forming-a-table:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code><li><code id=forming-a-table:the-tr-element-2><a href=#the-tr-element>tr</a></code></ul>
- <li>
- <p>If the <var>current element</var> is a <code id=forming-a-table:the-colgroup-element-11><a href=#the-colgroup-element>colgroup</a></code> element, jump to the
- step labeled <i>column groups</i> above.</p>
- </ol>
- <li>
- <p>Let <var>y<sub>current</sub></var> be zero.</p>
- <li>
- <p>Let the <var>list of downward-growing cells</var> be an empty list.</p>
- <li>
- <p><i>Rows</i>: While the <var>current element</var> is not one of the following
- elements, <a href=#concept-table-advance id=forming-a-table:concept-table-advance-4>advance</a> the <var>current
- element</var> to the next child of the <code id=forming-a-table:the-table-element-9><a href=#the-table-element>table</a></code>:</p>
- <ul class=brief><li><code id=forming-a-table:the-thead-element-3><a href=#the-thead-element>thead</a></code><li><code id=forming-a-table:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code><li><code id=forming-a-table:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code><li><code id=forming-a-table:the-tr-element-3><a href=#the-tr-element>tr</a></code></ul>
- <li>
- <p>If the <var>current element</var> is a <code id=forming-a-table:the-tr-element-4><a href=#the-tr-element>tr</a></code>, then run the <a href=#algorithm-for-processing-rows id=forming-a-table:algorithm-for-processing-rows>algorithm
- for processing rows</a>, <a href=#concept-table-advance id=forming-a-table:concept-table-advance-5>advance</a> the <var>current element</var> to the next child of the <code id=forming-a-table:the-table-element-10><a href=#the-table-element>table</a></code>, and return to the
- step labeled <i>rows</i>.</p>
- <li>
- <p>Run the <a href=#algorithm-for-ending-a-row-group id=forming-a-table:algorithm-for-ending-a-row-group>algorithm for ending a row group</a>.</p>
- <li>
- <p>If the <var>current element</var> is a <code id=forming-a-table:the-tfoot-element-6><a href=#the-tfoot-element>tfoot</a></code>, then add that element to
- the list of <var>pending <code id=forming-a-table:the-tfoot-element-7><a href=#the-tfoot-element>tfoot</a></code> elements</var>, <a href=#concept-table-advance id=forming-a-table:concept-table-advance-6>advance</a> the <var>current element</var> to the next
- child of the <code id=forming-a-table:the-table-element-11><a href=#the-table-element>table</a></code>, and return to the step labeled <i>rows</i>.</p>
- <li>
- <p>The <var>current element</var> is either a <code id=forming-a-table:the-thead-element-4><a href=#the-thead-element>thead</a></code> or a
- <code id=forming-a-table:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>.</p>
- <p>Run the <a href=#algorithm-for-processing-row-groups id=forming-a-table:algorithm-for-processing-row-groups>algorithm for processing row groups</a>.</p>
- <li>
- <p><a href=#concept-table-advance id=forming-a-table:concept-table-advance-7>Advance</a> the <var>current element</var> to
- the next child of the <code id=forming-a-table:the-table-element-12><a href=#the-table-element>table</a></code>.</p>
- <li>
- <p>Return to the step labeled <i>rows</i>.</p>
- <li>
- <p><i>End</i>: For each <code id=forming-a-table:the-tfoot-element-8><a href=#the-tfoot-element>tfoot</a></code> element in the list of <var>pending
- <code id=forming-a-table:the-tfoot-element-9><a href=#the-tfoot-element>tfoot</a></code> elements</var>, in <a href=#tree-order id=forming-a-table:tree-order>tree order</a>, run the <a href=#algorithm-for-processing-row-groups id=forming-a-table:algorithm-for-processing-row-groups-2>algorithm for processing row
- groups</a>.</p>
- <li>
- <p>If there exists a <a href=#concept-row id=forming-a-table:concept-row>row</a> or <a href=#concept-column id=forming-a-table:concept-column-4>column</a> in <var>the table</var> containing only <a href=#concept-slots id=forming-a-table:concept-slots>slots</a> that do not have a <a href=#concept-cell id=forming-a-table:concept-cell>cell</a>
- anchored to them, then this is a <a href=#table-model-error id=forming-a-table:table-model-error-2>table model error</a>.</p>
- <li>
- <p>Return <var>the table</var>.</p>
- </ol>
- <p>The <dfn id=algorithm-for-processing-row-groups>algorithm for processing row groups</dfn>, which is invoked by the set of steps above
- for processing <code id=forming-a-table:the-thead-element-5><a href=#the-thead-element>thead</a></code>, <code id=forming-a-table:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code>, and <code id=forming-a-table:the-tfoot-element-10><a href=#the-tfoot-element>tfoot</a></code> elements, is:</p>
- <ol><li>
- <p>Let <var>y<sub>start</sub></var> have the value of <var>y<sub>height</sub></var>.</p>
- <li>
- <p>For each <code id=forming-a-table:the-tr-element-5><a href=#the-tr-element>tr</a></code> element that is a child of the element being processed, in tree
- order, run the <a href=#algorithm-for-processing-rows id=forming-a-table:algorithm-for-processing-rows-2>algorithm for processing rows</a>.</p>
- <li>
-
- <p>If <span><var>y<sub>height</sub></var> > <var>y<sub>start</sub></var></span>, then let all the last <a href=#concept-row id=forming-a-table:concept-row-2>rows</a> in <var>the table</var> from <span>y=<var>y<sub>start</sub></var></span> to <span>y=<var>y<sub>height</sub></var>-1</span> form a new <a href=#concept-row-group id=forming-a-table:concept-row-group>row
- group</a>, anchored at the slot with coordinate (0, <var>y<sub>start</sub></var>), with height <span><var>y<sub>height</sub></var>-<var>y<sub>start</sub></var></span>, corresponding
- to the element being processed.</p>
- <li>
- <p>Run the <a href=#algorithm-for-ending-a-row-group id=forming-a-table:algorithm-for-ending-a-row-group-2>algorithm for ending a row group</a>.</p>
- </ol>
- <p>The <dfn id=algorithm-for-ending-a-row-group>algorithm for ending a row group</dfn>, which is invoked by the set of steps above
- when starting and ending a block of rows, is:</p>
- <ol><li>
- <p>While <var>y<sub>current</sub></var> is less than <var>y<sub>height</sub></var>, follow these steps:</p>
- <ol><li>
- <p>Run the <a href=#algorithm-for-growing-downward-growing-cells id=forming-a-table:algorithm-for-growing-downward-growing-cells>algorithm for growing downward-growing cells</a>.</p>
- <li>
- <p>Increase <var>y<sub>current</sub></var> by 1.</p>
- </ol>
- <li>
- <p>Empty the <var>list of downward-growing cells</var>.</p>
- </ol>
- <p>The <dfn id=algorithm-for-processing-rows>algorithm for processing rows</dfn>, which is invoked by the set of steps above for
- processing <code id=forming-a-table:the-tr-element-6><a href=#the-tr-element>tr</a></code> elements, is:</p>
- <ol><li>
- <p>If <var>y<sub>height</sub></var> is equal to <var>y<sub>current</sub></var>, then increase <var>y<sub>height</sub></var> by
- 1. (<var>y<sub>current</sub></var> is never <em>greater</em> than <var>y<sub>height</sub></var>.)</p>
- <li>
- <p>Let <var>x<sub>current</sub></var> be 0.</p>
- <li>
- <p>Run the <a href=#algorithm-for-growing-downward-growing-cells id=forming-a-table:algorithm-for-growing-downward-growing-cells-2>algorithm for growing downward-growing cells</a>.</p>
- <li>
- <p>If the <code id=forming-a-table:the-tr-element-7><a href=#the-tr-element>tr</a></code> element being processed has no <code id=forming-a-table:the-td-element><a href=#the-td-element>td</a></code> or <code id=forming-a-table:the-th-element><a href=#the-th-element>th</a></code>
- element children, then increase <var>y<sub>current</sub></var> by 1, abort
- this set of steps, and return to the algorithm above.</p>
- <li>
- <p>Let <var>current cell</var> be the first <code id=forming-a-table:the-td-element-2><a href=#the-td-element>td</a></code> or <code id=forming-a-table:the-th-element-2><a href=#the-th-element>th</a></code> element child
- in the <code id=forming-a-table:the-tr-element-8><a href=#the-tr-element>tr</a></code> element being processed.</p>
- <li>
- <p><i>Cells</i>: While <var>x<sub>current</sub></var> is less than <var>x<sub>width</sub></var> and the slot with coordinate (<var>x<sub>current</sub></var>, <var>y<sub>current</sub></var>) already has a
- cell assigned to it, increase <var>x<sub>current</sub></var> by 1.</p>
- <li>
- <p>If <var>x<sub>current</sub></var> is equal to <var>x<sub>width</sub></var>, increase <var>x<sub>width</sub></var> by 1. (<var>x<sub>current</sub></var> is never <em>greater</em> than <var>x<sub>width</sub></var>.)</p>
- <li>
- <p>If the <var>current cell</var> has a <code id=forming-a-table:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>
- attribute, then <a href=#rules-for-parsing-non-negative-integers id=forming-a-table:rules-for-parsing-non-negative-integers-3>parse that attribute's
- value</a>, and let <var>colspan</var> be the result.</p>
- <p>If parsing that value failed, or returned zero, or if the attribute is absent, then let <var>colspan</var> be 1, instead.</p>
- <li>
- <p>If the <var>current cell</var> has a <code id=forming-a-table:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>
- attribute, then <a href=#rules-for-parsing-non-negative-integers id=forming-a-table:rules-for-parsing-non-negative-integers-4>parse that attribute's
- value</a>, and let <var>rowspan</var> be the result.</p>
- <p>If parsing that value failed or if the attribute is absent, then let <var>rowspan</var> be 1, instead.</p>
- <li>
- <p>If <var>rowspan</var> is zero and the <code id=forming-a-table:the-table-element-13><a href=#the-table-element>table</a></code> element's
- <a id=forming-a-table:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not set to <a href=#quirks-mode id=forming-a-table:quirks-mode>quirks mode</a>, then let <var>cell grows
- downward</var> be true, and set <var>rowspan</var> to 1. Otherwise, let <var>cell grows downward</var> be false.</p>
- <li>
- <p>If <span><var>x<sub>width</sub></var> < <var>x<sub>current</sub></var>+<var>colspan</var></span>, then let <var>x<sub>width</sub></var> be <span><var>x<sub>current</sub></var>+<var>colspan</var></span>.</p>
- <li>
- <p>If <span><var>y<sub>height</sub></var> < <var>y<sub>current</sub></var>+<var>rowspan</var></span>, then let <var>y<sub>height</sub></var> be <span><var>y<sub>current</sub></var>+<var>rowspan</var></span>.</p>
- <li>
- <p>Let the slots with coordinates (<var>x</var>, <var>y</var>) such that <span><var>x<sub>current</sub></var> ≤ <var>x</var> < <var>x<sub>current</sub></var>+<var>colspan</var></span> and <span><var>y<sub>current</sub></var> ≤ <var>y</var> < <var>y<sub>current</sub></var>+<var>rowspan</var></span> be covered by a
- new <a href=#concept-cell id=forming-a-table:concept-cell-2>cell</a> <var>c</var>, anchored at (<var>x<sub>current</sub></var>, <var>y<sub>current</sub></var>),
- which has width <var>colspan</var> and height <var>rowspan</var>,
- corresponding to the <var>current cell</var> element.</p>
- <p>If the <var>current cell</var> element is a <code id=forming-a-table:the-th-element-3><a href=#the-th-element>th</a></code> element, let this new
- cell <var>c</var> be a header cell; otherwise, let it be a data cell.</p>
- <p>To establish which header cells apply to the <var>current cell</var> element, use
- the <a href=#algorithm-for-assigning-header-cells id=forming-a-table:algorithm-for-assigning-header-cells>algorithm for assigning header cells</a> described in the next section.</p>
- <p>If any of the slots involved already had a <a href=#concept-cell id=forming-a-table:concept-cell-3>cell</a> covering
- them, then this is a <a href=#table-model-error id=forming-a-table:table-model-error-3>table model error</a>. Those slots now have two cells
- overlapping.</p>
- <li>
- <p>If <var>cell grows downward</var> is true, then add the tuple {<var>c</var>, <var>x<sub>current</sub></var>, <var>colspan</var>}
- to the <var>list of downward-growing cells</var>.</p>
- <li>
- <p>Increase <var>x<sub>current</sub></var> by <var>colspan</var>.</p>
- <li>
- <p>If <var>current cell</var> is the last <code id=forming-a-table:the-td-element-3><a href=#the-td-element>td</a></code> or <code id=forming-a-table:the-th-element-4><a href=#the-th-element>th</a></code> element child in
- the <code id=forming-a-table:the-tr-element-9><a href=#the-tr-element>tr</a></code> element being processed, then increase <var>y<sub>current</sub></var> by 1, abort this set of steps, and return to the algorithm
- above.</p>
- <li>
- <p>Let <var>current cell</var> be the next <code id=forming-a-table:the-td-element-4><a href=#the-td-element>td</a></code> or <code id=forming-a-table:the-th-element-5><a href=#the-th-element>th</a></code> element child
- in the <code id=forming-a-table:the-tr-element-10><a href=#the-tr-element>tr</a></code> element being processed.</p>
- <li>
- <p>Return to the step labeled <i>cells</i>.</p>
- </ol>
- <p>When the algorithms above require the user agent to run the <dfn id=algorithm-for-growing-downward-growing-cells>algorithm for growing
- downward-growing cells</dfn>, the user agent must, for each {<var>cell</var>, <var>cell<sub>x</sub></var>, <var>width</var>} tuple in the <var>list of downward-growing cells</var>, if any, extend the <a href=#concept-cell id=forming-a-table:concept-cell-4>cell</a> <var>cell</var> so that it also covers the slots with
- coordinates (<var>x</var>, <var>y<sub>current</sub></var>), where <span><var>cell<sub>x</sub></var> ≤ <var>x</var> < <var>cell<sub>x</sub></var>+<var>width</var></span>.</p>
- <h5 id=header-and-data-cell-semantics>4.9.12.2 Forming relationships between data cells and header cells</h5>
- <p>Each cell can be assigned zero or more header cells. The <dfn id=algorithm-for-assigning-header-cells>algorithm for assigning header
- cells</dfn> to a cell <var>principal cell</var> is as follows.</p>
- <ol><li>
- <p>Let <var>header list</var> be an empty list of cells.</p>
- <li>
- <p>Let (<var>principal<sub>x</sub></var>, <var>principal<sub>y</sub></var>) be the coordinate of the slot to which the <var>principal
- cell</var> is anchored.</p>
- <li>
- <dl class=switch><dt>If the <var>principal cell</var> has a <code id=header-and-data-cell-semantics:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code> attribute specified<dd>
-
- <ol><li>
- <p>Take the value of the <var>principal cell</var>'s <code id=header-and-data-cell-semantics:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code> attribute and <a href=#split-a-string-on-spaces id=header-and-data-cell-semantics:split-a-string-on-spaces>split it on spaces</a>, letting <var>id list</var> be the list of tokens
- obtained.</p>
- <li>
-
-
- <p>For each token in the <var>id list</var>, if the
- first element in the <code id=header-and-data-cell-semantics:document><a href=#document>Document</a></code> with an <a href=#concept-id id=header-and-data-cell-semantics:concept-id>ID</a> equal to
- the token is a cell in the same <a href=#concept-table id=header-and-data-cell-semantics:concept-table>table</a>, and that cell is not the
- <var>principal cell</var>, then add that cell to <var>header list</var>.</p>
- </ol>
- <dt>If <var>principal cell</var> does not have a <code id=header-and-data-cell-semantics:attr-tdth-headers-3><a href=#attr-tdth-headers>headers</a></code> attribute specified<dd>
- <ol><li>
- <p>Let <var>principal<sub>width</sub></var> be the width of the <var>principal cell</var>.</p>
- <li>
- <p>Let <var>principal<sub>height</sub></var> be the height of the <var>principal cell</var>.</p>
- <li>
- <p>For each value of <var>y</var> from <var>principal<sub>y</sub></var> to <span><var>principal<sub>y</sub></var>+<var>principal<sub>height</sub></var>-1</span>, run
- the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells id=header-and-data-cell-semantics:internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells</a>, with the <var>principal cell</var>, the <var>header list</var>, the initial coordinate
- (<var>principal<sub>x</sub></var>,<var>y</var>), and the
- increments <span>Δ<var>x</var>=−1</span> and <span>Δ<var>y</var>=0</span>.</p>
- <li>
- <p>For each value of <var>x</var> from <var>principal<sub>x</sub></var> to <span><var>principal<sub>x</sub></var>+<var>principal<sub>width</sub></var>-1</span>, run
- the <a href=#internal-algorithm-for-scanning-and-assigning-header-cells id=header-and-data-cell-semantics:internal-algorithm-for-scanning-and-assigning-header-cells-2>internal algorithm for scanning and assigning header cells</a>, with the <var>principal cell</var>, the <var>header list</var>, the initial coordinate
- (<var>x</var>,<var>principal<sub>y</sub></var>), and the
- increments <span>Δ<var>x</var>=0</span> and <span>Δ<var>y</var>=−1</span>.</p>
- <li>
- <p>If the <var>principal cell</var> is anchored in a <a href=#concept-row-group id=header-and-data-cell-semantics:concept-row-group>row group</a>, then add all header cells that are <a href=#row-group-header id=header-and-data-cell-semantics:row-group-header>row group headers</a> and are anchored in the same row group
- with an <var>x</var>-coordinate less than or equal to <span><var>principal<sub>x</sub></var>+<var>principal<sub>width</sub></var>-1</span> and a <var>y</var>-coordinate less than or
- equal to <span><var>principal<sub>y</sub></var>+<var>principal<sub>height</sub></var>-1</span> to <var>header
- list</var>.</p>
-
- <li>
- <p>If the <var>principal cell</var> is anchored in a <a href=#concept-column-group id=header-and-data-cell-semantics:concept-column-group>column group</a>, then add all header cells that are <a href=#column-group-header id=header-and-data-cell-semantics:column-group-header>column group headers</a> and are anchored in the same column
- group with an <var>x</var>-coordinate less than or equal to <span><var>principal<sub>x</sub></var>+<var>principal<sub>width</sub></var>-1</span> and a <var>y</var>-coordinate less than or
- equal to <span><var>principal<sub>y</sub></var>+<var>principal<sub>height</sub></var>-1</span> to <var>header
- list</var>.</p>
-
- </ol>
- </dl>
- <li>
- <p>Remove all the <a href=#empty-cell id=header-and-data-cell-semantics:empty-cell>empty cells</a> from the <var>header
- list</var>.</p>
- <li>
- <p>Remove any duplicates from the <var>header list</var>.</p>
- <li>
- <p>Remove <var>principal cell</var> from the <var>header list</var> if it is
- there.</p>
- <li>
- <p>Assign the headers in the <var>header list</var> to the <var>principal
- cell</var>.</p>
- </ol>
- <p>The <dfn id=internal-algorithm-for-scanning-and-assigning-header-cells>internal algorithm for scanning and assigning header cells</dfn>, given a <var>principal cell</var>, a <var>header list</var>, an initial coordinate (<var>initial<sub>x</sub></var>, <var>initial<sub>y</sub></var>),
- and Δ<var>x</var> and Δ<var>y</var> increments, is as follows:</p>
- <ol><li>
- <p>Let <var>x</var> equal <var>initial<sub>x</sub></var>.</p>
- <li>
- <p>Let <var>y</var> equal <var>initial<sub>y</sub></var>.</p>
- <li>
- <p>Let <var>opaque headers</var> be an empty list of cells.</p>
- <li>
- <dl class=switch><dt>If <var>principal cell</var> is a header cell<dd><p>Let <var>in header block</var> be true, and let <var>headers from
- current header block</var> be a list of cells containing just the <var>principal
- cell</var>.<dt>Otherwise<dd><p>Let <var>in header block</var> be false and let <var>headers from
- current header block</var> be an empty list of cells.</p>
- </dl>
- <li>
- <p><i>Loop</i>: Increment <var>x</var> by Δ<var>x</var>; increment <var>y</var> by Δ<var>y</var>.</p>
- <p class=note>For each invocation of this algorithm, one of Δ<var>x</var> and
- Δ<var>y</var> will be −1, and the other will be 0.</p>
- <li>
- <p>If either <var>x</var> or <var>y</var> is less than 0, then abort this
- internal algorithm.</p>
- <li>
- <p>If there is no cell covering slot (<var>x</var>, <var>y</var>), or if there
- is more than one cell covering slot (<var>x</var>, <var>y</var>), return to
- the substep labeled <i>loop</i>.</p>
- <li>
- <p>Let <var>current cell</var> be the cell covering slot (<var>x</var>, <var>y</var>).</p>
- <li>
- <dl class=switch><dt>If <var>current cell</var> is a header cell<dd>
- <ol><li><p>Set <var>in header block</var> to true.<li><p>Add <var>current cell</var> to <var>headers from current header
- block</var>.<li><p>Let <var>blocked</var> be false.<li>
- <dl class=switch><dt>If Δ<var>x</var> is 0<dd>
- <p>If there are any cells in the <var>opaque headers</var> list anchored with the
- same <var>x</var>-coordinate as the <var>current cell</var>, and with
- the same width as <var>current cell</var>, then let <var>blocked</var>
- be true.</p>
- <p>If the <var>current cell</var> is not a <a href=#column-header id=header-and-data-cell-semantics:column-header>column header</a>, then let
- <var>blocked</var> be true.</p>
- <dt>If Δ<var>y</var> is 0<dd>
- <p>If there are any cells in the <var>opaque headers</var> list anchored with the
- same <var>y</var>-coordinate as the <var>current cell</var>, and with
- the same height as <var>current cell</var>, then let <var>blocked</var>
- be true.</p>
- <p>If the <var>current cell</var> is not a <a href=#row-header id=header-and-data-cell-semantics:row-header>row header</a>, then let <var>blocked</var> be true.</p>
- </dl>
- <li><p>If <var>blocked</var> is false, then add the <var>current cell</var>
- to the <var>headers list</var>.</ol>
- <dt>If <var>current cell</var> is a data cell and <var>in header block</var> is true<dd><p>Set <var>in header block</var> to false. Add all the cells in <var>headers from current header block</var> to the <var>opaque headers</var>
- list, and empty the <var>headers from current header block</var> list.</p>
- </dl>
- <li>
- <p>Return to the step labeled <i>loop</i>.</p>
- </ol>
- <p>A header cell anchored at the slot with coordinate (<var>x</var>, <var>y</var>) with width <var>width</var> and height <var>height</var> is
- said to be a <dfn id=column-header>column header</dfn> if any of the following conditions are true:</p>
- <ul><li>The cell's <code id=header-and-data-cell-semantics:attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-col id=header-and-data-cell-semantics:attr-th-scope-col>column</a> state, or<li>The cell's <code id=header-and-data-cell-semantics:attr-th-scope-2><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-auto id=header-and-data-cell-semantics:attr-th-scope-auto>auto</a> state, and there are no data cells in any of the cells
- covering slots with <var>y</var>-coordinates <var>y</var> .. <span><var>y</var>+<var>height</var>-1</span>.</ul>
- <p>A header cell anchored at the slot with coordinate (<var>x</var>, <var>y</var>) with width <var>width</var> and height <var>height</var> is
- said to be a <dfn id=row-header>row header</dfn> if any of the following conditions are true:</p>
- <ul><li>The cell's <code id=header-and-data-cell-semantics:attr-th-scope-3><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-row id=header-and-data-cell-semantics:attr-th-scope-row>row</a> state, or<li>The cell's <code id=header-and-data-cell-semantics:attr-th-scope-4><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-auto id=header-and-data-cell-semantics:attr-th-scope-auto-2>auto</a> state, the cell is not a <a href=#column-header id=header-and-data-cell-semantics:column-header-2>column header</a>, and
- there are no data cells in any of the cells covering slots with <var>x</var>-coordinates
- <var>x</var> .. <span><var>x</var>+<var>width</var>-1</span>.</ul>
- <p>A header cell is said to be a <dfn id=column-group-header>column group header</dfn> if its <code id=header-and-data-cell-semantics:attr-th-scope-5><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-colgroup id=header-and-data-cell-semantics:attr-th-scope-colgroup>column
- group</a> state.</p>
- <p>A header cell is said to be a <dfn id=row-group-header>row group header</dfn> if its <code id=header-and-data-cell-semantics:attr-th-scope-6><a href=#attr-th-scope>scope</a></code> attribute is in the <a href=#attr-th-scope-rowgroup id=header-and-data-cell-semantics:attr-th-scope-rowgroup>row
- group</a> state.</p>
- <p>A cell is said to be an <dfn id=empty-cell>empty cell</dfn> if it contains no elements and its text content,
- if any, consists only of <a href=#white_space id=header-and-data-cell-semantics:white_space>White_Space</a> characters.</p>
-
- <h4 id=table-sorting-model>4.9.13 <dfn>Table sorting model</dfn></h4>
- <p>The <dfn id=attr-table-sortable><code>sortable</code></dfn> attribute on
- <code id=table-sorting-model:the-table-element><a href=#the-table-element>table</a></code> elements is a <a href=#boolean-attribute id=table-sorting-model:boolean-attribute>boolean attribute</a>. When present, it indicates that
- the user agent is to <a href=#sortable-ui>allow the user to sort</a> the <code id=table-sorting-model:the-table-element-2><a href=#the-table-element>table</a></code>.</p>
- <p>To make a column sortable in a <code id=table-sorting-model:the-table-element-3><a href=#the-table-element>table</a></code> with a <code id=table-sorting-model:the-thead-element><a href=#the-thead-element>thead</a></code>, the column needs
- to have <code id=table-sorting-model:the-th-element><a href=#the-th-element>th</a></code> element that does not <a href=#attr-tdth-colspan id=table-sorting-model:attr-tdth-colspan>span multiple
- columns</a> in a <code id=table-sorting-model:the-thead-element-2><a href=#the-thead-element>thead</a></code> above any rows that it is to sort.</p>
- <p>To make a column sortable in a <code id=table-sorting-model:the-table-element-4><a href=#the-table-element>table</a></code> without a <code id=table-sorting-model:the-thead-element-3><a href=#the-thead-element>thead</a></code>, the column
- needs to have <code id=table-sorting-model:the-th-element-2><a href=#the-th-element>th</a></code> element that does not <a href=#attr-tdth-colspan id=table-sorting-model:attr-tdth-colspan-2>span multiple
- columns</a> in the first <code id=table-sorting-model:the-tr-element><a href=#the-tr-element>tr</a></code> element of the <code id=table-sorting-model:the-table-element-5><a href=#the-table-element>table</a></code>, where that
- <code id=table-sorting-model:the-tr-element-2><a href=#the-tr-element>tr</a></code> element is not in a <code id=table-sorting-model:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>.</p>
- <p>When the user selects a column by which to sort, the user agent sets the <code id=table-sorting-model:the-th-element-3><a href=#the-th-element>th</a></code>
- element's <dfn id=attr-th-sorted><code>sorted</code></dfn> attribute. This attribute can also
- be set manually, to indicate that the table should be automatically sorted, even when scripts
- modify the page on when the page is loaded.</p>
- <p>The <code id=table-sorting-model:attr-th-sorted><a href=#attr-th-sorted>sorted</a></code> attribute, if specified, must have a value that
- is a <a href=#set-of-space-separated-tokens id=table-sorting-model:set-of-space-separated-tokens>set of space-separated tokens</a> consisting of optionally a token whose value is an
- <a href=#ascii-case-insensitive id=table-sorting-model:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<dfn id=attr-th-sorted-reversed><code>reversed</code></dfn>", and optionally a token whose value
- is a <a href=#valid-non-negative-integer id=table-sorting-model:valid-non-negative-integer>valid non-negative integer</a> greater than zero, in either order.</p>
- <p class=note>In other words, ignoring spaces and case, the <code id=table-sorting-model:attr-th-sorted-2><a href=#attr-th-sorted>sorted</a></code> attribute's value can be empty, "<code>reversed</code>", "<code>1</code>", "<code>reversed 1</code>", or
- "<code>1 reversed</code>", where "1" is any number equal to or greater than 1.</p>
- <p>While one or more <code id=table-sorting-model:the-th-element-4><a href=#the-th-element>th</a></code> elements in the table have a <code id=table-sorting-model:attr-th-sorted-3><a href=#attr-th-sorted>sorted</a></code> attribute, the user agent will keep the table's data rows
- sorted. The value of the attribute controls how the column is used in determining the sort order.
- The <code id=table-sorting-model:attr-th-sorted-reversed><a href=#attr-th-sorted-reversed>reversed</a></code> keyword means that the <dfn id=column-sort-direction>column sort
- direction</dfn> is <i>reversed</i>, rather than <i>normal</i>, which is the default if the keyword
- is omitted. The number, if present, indicates the <dfn id=column-key-ordinality>column key ordinality</dfn>; if the number
- is omitted, the column is the primary key, as if the value 1 had been specified.</p>
- <p class=note>Thus, <code>sorted="1"</code> indicates the table's primary key, <code>sorted="2"</code> its secondary key, and so forth.</p>
- <hr>
- <p>A <dfn id=sorting-capable-th-element>sorting-capable <code>th</code> element</dfn> is a <code id=table-sorting-model:the-th-element-5><a href=#the-th-element>th</a></code> element that matches
- all the following conditions simultaneously:</p>
- <ul><li><p>It corresponds to a <a href=#concept-cell id=table-sorting-model:concept-cell>cell</a> whose <i>width</i> is 1.
- (Specifically, a <i>header cell</i>, since this is a <code id=table-sorting-model:the-th-element-6><a href=#the-th-element>th</a></code> element.)<li><p>There is no <a href=#concept-cell id=table-sorting-model:concept-cell-2>cell</a> that corresponds to another
- <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element>sorting-capable <code>th</code> element</a> that covers slots in the same <a href=#concept-column id=table-sorting-model:concept-column>column</a> but on a higher (earlier) <a href=#concept-row id=table-sorting-model:concept-row>row</a>.<li>
- <p>If the <a href=#concept-cell id=table-sorting-model:concept-cell-3>cell</a>'s <a href=#concept-table id=table-sorting-model:concept-table>table</a> has
- a <a href=#concept-row-group id=table-sorting-model:concept-row-group>row group</a> corresponding to a <code id=table-sorting-model:the-thead-element-4><a href=#the-thead-element>thead</a></code>
- element, the <a href=#concept-cell id=table-sorting-model:concept-cell-4>cell</a> is in a <a href=#concept-row-group id=table-sorting-model:concept-row-group-2>row
- group</a> that corresponds to the <em>first</em> <code id=table-sorting-model:the-thead-element-5><a href=#the-thead-element>thead</a></code> element of the <a href=#concept-cell id=table-sorting-model:concept-cell-5>cell</a>'s <a href=#concept-table id=table-sorting-model:concept-table-2>table</a>.</p>
- <p>Otherwise: the <a href=#concept-cell id=table-sorting-model:concept-cell-6>cell</a> is not in a <a href=#concept-row-group id=table-sorting-model:concept-row-group-3>row group</a> corresponding to a <code id=table-sorting-model:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element, and
- the <a href=#concept-cell id=table-sorting-model:concept-cell-7>cell</a> is in the first <a href=#concept-row id=table-sorting-model:concept-row-2>row</a>
- of the <a href=#concept-table id=table-sorting-model:concept-table-3>table</a>.</p>
- </ul>
- <p class=note>In other words, each <a href=#concept-column id=table-sorting-model:concept-column-2>column</a> can have one
- <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-2>sorting-capable <code>th</code> element</a>; this will be the highest <code id=table-sorting-model:the-th-element-7><a href=#the-th-element>th</a></code> in
- a <code id=table-sorting-model:the-thead-element-6><a href=#the-thead-element>thead</a></code> that spans no other columns, or, if there is no <code id=table-sorting-model:the-thead-element-7><a href=#the-thead-element>thead</a></code>, the
- <code id=table-sorting-model:the-th-element-8><a href=#the-th-element>th</a></code> in the first row (that is not in a <code id=table-sorting-model:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code>), assuming it spans no
- columns.</p>
- <p>The <dfn id=sorting-capable-th-elements-of-the-table-element>sorting-capable <code>th</code> elements of the <code>table</code> element</dfn> <var>table</var> are the <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-3>sorting-capable
- <code>th</code> elements</a> whose <a href=#concept-cell id=table-sorting-model:concept-cell-8>cell</a>'s <a href=#concept-table id=table-sorting-model:concept-table-4>table</a> is <var>table</var>.</p>
- <p>A <code id=table-sorting-model:the-table-element-6><a href=#the-table-element>table</a></code> element <var>table</var> is a <dfn id=sorting-capable-table-element>sorting-capable
- <code>table</code> element</dfn> if there are one or more <a href=#sorting-capable-th-elements-of-the-table-element id=table-sorting-model:sorting-capable-th-elements-of-the-table-element>sorting-capable <code>th</code>
- elements of the <code>table</code> element</a> <var>table</var>.</p>
- <p>A <code id=table-sorting-model:the-th-element-9><a href=#the-th-element>th</a></code> element is a <dfn id=sorting-enabled-th-element>sorting-enabled <code>th</code> element</dfn> if it is a
- <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-4>sorting-capable <code>th</code> element</a> and it has a <code id=table-sorting-model:attr-th-sorted-4><a href=#attr-th-sorted>sorted</a></code> attribute.</p>
- <p>The <dfn id=sorting-enabled-th-elements-of-the-table-element>sorting-enabled <code>th</code> elements of the <code>table</code> element</dfn> <var>table</var> are the <a href=#sorting-enabled-th-element id=table-sorting-model:sorting-enabled-th-element>sorting-enabled
- <code>th</code> elements</a> whose <a href=#concept-cell id=table-sorting-model:concept-cell-9>cell</a>'s <a href=#concept-table id=table-sorting-model:concept-table-5>table</a> is <var>table</var>.</p>
- <p>A <code id=table-sorting-model:the-table-element-7><a href=#the-table-element>table</a></code> element <var>table</var> is a <dfn id=sorting-enabled-table-element>sorting-enabled
- <code>table</code> element</dfn> if there are one or more <a href=#sorting-capable-th-elements-of-the-table-element id=table-sorting-model:sorting-capable-th-elements-of-the-table-element-2>sorting-capable <code>th</code>
- elements of the <code>table</code> element</a> <var>table</var>, and at least one of
- them is a <a href=#sorting-enabled-th-element id=table-sorting-model:sorting-enabled-th-element-2>sorting-enabled <code>th</code> element</a> (i.e. at least one has a <code id=table-sorting-model:attr-th-sorted-5><a href=#attr-th-sorted>sorted</a></code> attribute).</p>
- <p>A <code id=table-sorting-model:the-table-element-8><a href=#the-table-element>table</a></code> element is a <dfn id=table-element-with-a-user-agent-exposed-sorting-interface><code>table</code> element with a user-agent exposed
- sorting interface</dfn> if it is a <a href=#sorting-capable-table-element id=table-sorting-model:sorting-capable-table-element>sorting-capable <code>table</code> element</a> and has
- a <code id=table-sorting-model:attr-table-sortable><a href=#attr-table-sortable>sortable</a></code> attribute specified.</p>
- <p>A <dfn id=sorting-interface-th-element>sorting interface <code>th</code> element</dfn> is a <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-5>sorting-capable
- <code>th</code> element</a> whose <a href=#concept-cell id=table-sorting-model:concept-cell-10>cell</a>'s <a href=#concept-table id=table-sorting-model:concept-table-6>table</a> is a <a href=#table-element-with-a-user-agent-exposed-sorting-interface id=table-sorting-model:table-element-with-a-user-agent-exposed-sorting-interface><code>table</code> element with a user-agent exposed
- sorting interface</a>.</p>
- <hr>
- <p>Each <code id=table-sorting-model:the-table-element-9><a href=#the-table-element>table</a></code> element has a <dfn id=currently-sorting-flag>currently-sorting flag</dfn>, which must initially
- be false.</p>
- <hr>
- <p>The <code id=table-sorting-model:attr-th-sorted-6><a href=#attr-th-sorted>sorted</a></code> attribute must not be specified on
- <code id=table-sorting-model:the-th-element-10><a href=#the-th-element>th</a></code> elements that are not <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-6>sorting-capable
- <code>th</code> elements</a>. The <code id=table-sorting-model:attr-table-sortable-2><a href=#attr-table-sortable>sortable</a></code> attribute
- must not be specified on <code id=table-sorting-model:the-table-element-10><a href=#the-table-element>table</a></code> elements that are not <a href=#sorting-capable-table-element id=table-sorting-model:sorting-capable-table-element-2>sorting-capable <code>table</code> elements</a>.</p>
-
- <p>To determine a <code id=table-sorting-model:the-th-element-11><a href=#the-th-element>th</a></code> element's <code id=table-sorting-model:attr-th-sorted-7><a href=#attr-th-sorted>sorted</a></code> attribute's
- <a href=#column-sort-direction id=table-sorting-model:column-sort-direction>column sort direction</a> and <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality>column key ordinality</a>, user agents must use
- the following algorithm:</p>
- <ol><li><p>Let <var>direction</var> be <i>normal</i>.</p>
- <li><p>Let <var>have explicit direction</var> be false.</p>
- <li><p>Let <var>ordinality</var> be 1.</p>
- <li><p>Let <var>have explicit ordinality</var> be false.</p>
- <li><p>Let <var>tokens</var> be the result of <a href=#split-a-string-on-spaces id=table-sorting-model:split-a-string-on-spaces>splitting the attribute's value on spaces</a>.<li>
- <p>For each token <var>token</var> in <var>tokens</var>, run the appropriate
- steps from the following list:</p>
- <dl class=switch><dt>If <var>have explicit direction</var> is false and <var>token</var> is an
- <a href=#ascii-case-insensitive id=table-sorting-model:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code id=table-sorting-model:attr-th-sorted-reversed-2><a href=#attr-th-sorted-reversed>reversed</a></code>"<dd>
- <p>Let <var>direction</var> be <i>reversed</i> and <var>have explicit
- direction</var> be true.</p>
- <dt>If <var>have explicit ordinality</var> is false<dd>
- <p><a href=#rules-for-parsing-integers id=table-sorting-model:rules-for-parsing-integers>Parse <var>token</var> as an
- integer</a>. If this resulted in an error or the value zero, then ignore the token.
- Otherwise, set <var>ordinality</var> to the parsed value, and set <var>have
- explicit ordinality</var> to true.</p>
- <dt>Otherwise<dd><p>Ignore the token.</dl>
- <li><p>The <a href=#column-sort-direction id=table-sorting-model:column-sort-direction-2>column sort direction</a> is the value of <var>direction</var>, and
- the <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-2>column key ordinality</a> is the value of <var>ordinality</var>.</ol>
-
- <p>A <code id=table-sorting-model:the-table-element-11><a href=#the-table-element>table</a></code> must not have two <code id=table-sorting-model:the-th-element-12><a href=#the-th-element>th</a></code> elements whose <code id=table-sorting-model:attr-th-sorted-8><a href=#attr-th-sorted>sorted</a></code> attribute have the same <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-3>column key
- ordinality</a>.</p>
-
- <hr>
- <p>The <dfn id=table-sorting-algorithm>table sorting algorithm</dfn>, which is applied to a <code id=table-sorting-model:the-table-element-12><a href=#the-table-element>table</a></code>, is as
- follows:</p>
- <ol><li><p>Let <var>table</var> be the <code id=table-sorting-model:the-table-element-13><a href=#the-table-element>table</a></code> element being sorted.<li><p>If <var>table</var>'s <a href=#currently-sorting-flag id=table-sorting-model:currently-sorting-flag>currently-sorting flag</a> is true, then abort
- these steps.<li><p>Set <var>table</var>'s <a href=#currently-sorting-flag id=table-sorting-model:currently-sorting-flag-2>currently-sorting flag</a> to true.<li><p><a href=#fire-a-simple-event id=table-sorting-model:fire-a-simple-event>Fire a simple event</a> named <code id=table-sorting-model:event-sort><a href=#event-sort>sort</a></code> that is
- cancelable at <var>table</var>.<li><p>If the event fired in the previous step was canceled, then jump to the step labeled
- <i>end</i> below.<li>
- <p>If <var>table</var> is not now a <a href=#sorting-enabled-table-element id=table-sorting-model:sorting-enabled-table-element>sorting-enabled <code>table</code>
- element</a>, then jump to the step labeled <i>end</i> below.</p>
- <p class=note>Even if <var>table</var> was a <a href=#sorting-enabled-table-element id=table-sorting-model:sorting-enabled-table-element-2>sorting-enabled <code>table</code>
- element</a> when the algorithm was invoked, the DOM might have been entirely changed by the
- event handlers for the <code id=table-sorting-model:event-sort-2><a href=#event-sort>sort</a></code> event, so this has to be verified at
- this stage, not earlier.</p>
- <li><p>Let <var>key heading cells</var> be the <a href=#sorting-enabled-th-elements-of-the-table-element id=table-sorting-model:sorting-enabled-th-elements-of-the-table-element>sorting-enabled <code>th</code>
- elements of the <code>table</code> element</a> <var>table</var>.<li><p>Sort <var>key heading cells</var> in ascending order of the <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-4>column key
- ordinality</a> of their <code id=table-sorting-model:attr-th-sorted-9><a href=#attr-th-sorted>sorted</a></code> attributes, with those
- having the same <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-5>column key ordinality</a> being sorted in <a href=#tree-order id=table-sorting-model:tree-order>tree order</a>.</p>
- <li>
- <p>Let <var>row collection cursor</var> be a pointer to an element, initially pointing
- at the first child of <var>table</var> that is after <var>table</var>'s first
- <code id=table-sorting-model:the-thead-element-8><a href=#the-thead-element>thead</a></code>, if any, and that is either a <code id=table-sorting-model:the-tbody-element><a href=#the-tbody-element>tbody</a></code> or a <code id=table-sorting-model:the-tr-element-3><a href=#the-tr-element>tr</a></code>
- element, assuming there is one. If there is no such child, then jump to the step labeled
- <i>end</i> below.</p>
- <li><p>If <var>table</var> has no <a href=#concept-row-group id=table-sorting-model:concept-row-group-4>row group</a>
- corresponding to a <code id=table-sorting-model:the-thead-element-9><a href=#the-thead-element>thead</a></code> element, then set <var>ignore first group</var> to
- true. Otherwise, set it to false.<li><p><i>Row loop</i>: Let <var>rows</var> be an empty list of <code id=table-sorting-model:the-tr-element-4><a href=#the-tr-element>tr</a></code>
- elements.<li>
- <p>Run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If <var>row collection cursor</var> points to a <code id=table-sorting-model:the-tr-element-5><a href=#the-tr-element>tr</a></code> element
- <dd>
- <ol><li><p><i>Collect</i>: Append the element pointed to by <var>row collection
- cursor</var> to <var>rows</var>.<li><p>If there are no <code id=table-sorting-model:the-tr-element-6><a href=#the-tr-element>tr</a></code> or <code id=table-sorting-model:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> children of <var>table</var> that are later siblings of the element pointed to by <var>row
- collection cursor</var>, or if the next such child is a <code id=table-sorting-model:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> element, then jump
- to the step labeled <i>group</i> below.<li><p>Let <var>row collection cursor</var> point to the next <code id=table-sorting-model:the-tr-element-7><a href=#the-tr-element>tr</a></code> child
- of <var>table</var> that is a later sibling of the element pointed to by <var>row collection cursor</var>.<li><p>Return to the step labeled <i>collect</i> above.</ol>
- <dt>If <var>row collection cursor</var> points to a <code id=table-sorting-model:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code> element
- <dd>
- <ol><li><p>Place all the <code id=table-sorting-model:the-tr-element-8><a href=#the-tr-element>tr</a></code> element children of the element pointed to by <var>row collection cursor</var> into <var>rows</var>, in <a href=#tree-order id=table-sorting-model:tree-order-2>tree
- order</a>.<li><p>If <var>rows</var> is empty, jump to the step labeled <i>increment loop</i>
- below.</ol>
- </dl>
- <li><p><i>Group</i>: Let <var>groups</var> be an empty list of groups of <code id=table-sorting-model:the-tr-element-9><a href=#the-tr-element>tr</a></code>
- elements.<li><p>Let <var>group</var> be an empty group of <code id=table-sorting-model:the-tr-element-10><a href=#the-tr-element>tr</a></code> elements.<li><p>Let <var>group cursor</var> be a pointer to an element, initially pointing at the
- first <code id=table-sorting-model:the-tr-element-11><a href=#the-tr-element>tr</a></code> element in <var>rows</var>.<li><p><i>Start group</i>: Let <var>pending rows in group</var> be 1.<li><p><i>Group loop</i>: Append the <code id=table-sorting-model:the-tr-element-12><a href=#the-tr-element>tr</a></code> element pointed to by <var>group
- cursor</var> to <var>group</var>.<li><p>If there are any <a href=#concept-cell id=table-sorting-model:concept-cell-11>cells</a> whose highest <a href=#concept-row id=table-sorting-model:concept-row-3>row</a>'s element is the one pointed to by <var>group
- cursor</var>, then let <var>tallest height</var> be the number of rows covered by the
- tallest such <a href=#concept-cell id=table-sorting-model:concept-cell-12>cell</a>.<li><p>If <var>tallest height</var> is greater than <var>pending rows in
- group</var> then set <var>pending rows in group</var> to <var>tallest
- height</var>.<li><p>Decrement <var>pending rows in group</var> by one.<li><p>Let <var>group cursor</var> point to the next <code id=table-sorting-model:the-tr-element-13><a href=#the-tr-element>tr</a></code> element in <var>rows</var>, if any; otherwise, let it be null.<li><p>If <var>group cursor</var> is not null and <var>pending rows in
- group</var> is not zero, return to the step labeled <i>group loop</i>.<li><p>Append a new group to <var>groups</var> consisting of the <code id=table-sorting-model:the-tr-element-14><a href=#the-tr-element>tr</a></code>
- elements in <var>group</var>.<li><p>Empty <var>group</var>.<li><p>If <var>group cursor</var> is not null, then return to the step labeled <i>start
- group</i>.<li><p>If <var>ignore first group</var> is true, then drop the first group in <var>groups</var> and set <var>ignore first group</var> to false.<li><p><i>Drop leading header groups</i>: If <var>groups</var> is now empty, jump to the
- step labeled <i>increment loop</i> below.<li><p>If the first group of <var>groups</var> consists of <code id=table-sorting-model:the-tr-element-15><a href=#the-tr-element>tr</a></code> elements
- whose element children are all <code id=table-sorting-model:the-th-element-13><a href=#the-th-element>th</a></code> elements, then drop the first group in <var>groups</var> and return to the previous step (labeled <i>drop leading header
- groups</i>).<li><p>Let <var>insertion point</var> be a placeholder in a DOM tree, which can be used
- to reinsert nodes at a specific point in the DOM. Insert <var>insertion point</var> into
- the parent of the first <code id=table-sorting-model:the-tr-element-16><a href=#the-tr-element>tr</a></code> element of the first group in <var>groups</var>,
- immediately before that <code id=table-sorting-model:the-tr-element-17><a href=#the-tr-element>tr</a></code> element.<li>
- <p>Sort the groups in <var>groups</var>, using the following algorithm to decide the
- relative order of any two groups <var>a</var> and <var>b</var> (the algorithm
- either returns that <var>a</var> comes before <var>b</var>, or that <var>b</var> comes before <var>a</var>):</p>
- <ol><li><p>Let <var>key index</var> be an index into <var>key heading
- cells</var>, initially denoting the first element in the list.<li><p>Let <var>direction</var> be a sort direction, initially <i>ascending</i>. Its
- other possible value is <i>descending</i>. When <var>direction</var> is
- <i>toggled</i>, that means that if its value is <i>ascending</i>, it must be changed to
- <i>descending</i>, and when its value is <i>descending</i>, it must be changed to
- <i>ascending</i>.<li><p><i>Column loop</i>: Let <var>th</var> be the <var>key index</var>th
- <code id=table-sorting-model:the-th-element-14><a href=#the-th-element>th</a></code> in <var>key heading cells</var>.<li><p>If <var>th</var>'s <code id=table-sorting-model:attr-th-sorted-10><a href=#attr-th-sorted>sorted</a></code> attribute's
- <a href=#column-sort-direction id=table-sorting-model:column-sort-direction-3>column sort direction</a> is <i>reversed</i>, then toggle <var>direction</var>.<li><p>Let <var>tentative order</var> be the result of <a href=#comparing-two-row-groups-using-the-th-element id=table-sorting-model:comparing-two-row-groups-using-the-th-element>comparing two row groups
- using the <code>th</code> element</a> <var>th</var>, with <var>a</var> and
- <var>b</var> as the rows.<li><p>If <var>tentative order</var> is not "equal", then jump to the step labeled
- <i>return</i> below.<li><p>Increment <var>key index</var>.<li><p>If <var>key index</var> still denotes a <code id=table-sorting-model:the-th-element-15><a href=#the-th-element>th</a></code> element in <var>key heading cells</var>, then jump back to the step above labeled <i>column
- loop</i>.<li><p>If <var>a</var>'s <code id=table-sorting-model:the-tr-element-18><a href=#the-tr-element>tr</a></code> elements precede <var>b</var>'s in
- <a href=#tree-order id=table-sorting-model:tree-order-3>tree order</a>, then let <var>tentative order</var> be "a before b".
- Otherwise, let <var>tentative order</var> be "b before a".<li><p><i>Return</i>: Return the relative order given by the matching option from the following
- list:</p>
- <dl class=switch><dt>If <var>direction</var> is <i>ascending</i> and <var>tentative
- order</var> is "a before b"<dd>Return that <var>a</var> comes before <var>b</var>.<dt>If <var>direction</var> is <i>ascending</i> and <var>tentative
- order</var> is "b before a"<dd>Return that <var>b</var> comes before <var>a</var>.<dt>If <var>direction</var> is <i>descending</i> and <var>tentative
- order</var> is "a before b"<dd>Return that <var>b</var> comes before <var>a</var>.<dt>If <var>direction</var> is <i>descending</i> and <var>tentative
- order</var> is "b before a"<dd>Return that <var>a</var> comes before <var>b</var>.</dl>
- </ol>
- <p>When the user agent is required to <dfn id=comparing-two-row-groups-using-the-th-element>compare two row groups using the <code>th</code> element</dfn> <var>th</var>,
- with <var>a</var> and <var>b</var> being the two row groups respectively, the
- user agent must run the following steps:</p>
- <ol><li><p>Let <var>x</var> be the <var>x</var>-coordinate of the slots that
- <code id=table-sorting-model:the-th-element-16><a href=#the-th-element>th</a></code> covers in its <a href=#concept-table id=table-sorting-model:concept-table-7>table</a>.<li>
- <p>Let <var>cell<sub>a</sub></var> be the element corresponding to the <a href=#concept-cell id=table-sorting-model:concept-cell-13>cell</a> in the first <a href=#concept-row id=table-sorting-model:concept-row-4>row</a> of group
- <var>a</var> that covers the slot in that <a href=#concept-row id=table-sorting-model:concept-row-5>row</a> whose
- <var>x</var>-coordinate is <var>x</var>.</p>
- <p>Let <var>cell<sub>b</sub></var> be the element corresponding to the <a href=#concept-cell id=table-sorting-model:concept-cell-14>cell</a> in the first <a href=#concept-row id=table-sorting-model:concept-row-6>row</a> of group
- <var>b</var> that covers the slot in that <a href=#concept-row id=table-sorting-model:concept-row-7>row</a> whose
- <var>x</var>-coordinate is <var>x</var>.</p>
-
- <p>In either case, if there's no <a href=#concept-cell id=table-sorting-model:concept-cell-15>cell</a> that actually covers
- the slot, then use the value <i>null</i> instead.</p>
- <li>
- <p>Let <var>type<sub>a</sub></var> and <var>value<sub>a</sub></var> be
- the <a href=#type-and-value-of-the-cell id=table-sorting-model:type-and-value-of-the-cell>type and value of the cell</a> <var>cell<sub>a</sub></var>, as defined
- below.</p>
- <p>Let <var>type<sub>b</sub></var> and <var>value<sub>b</sub></var> be
- the <a href=#type-and-value-of-the-cell id=table-sorting-model:type-and-value-of-the-cell-2>type and value of the cell</a> <var>cell<sub>b</sub></var>, as defined
- below.</p>
- <p>The <dfn id=type-and-value-of-the-cell>type and value of the cell</dfn> <var>cell</var> are computed as follows.</p>
- <ol><li><p>If <var>cell</var> is <i>null</i>, then the type is "string" and the value is
- the empty string; abort these steps.<li><p>If, ignoring <a href=#inter-element-whitespace id=table-sorting-model:inter-element-whitespace>inter-element whitespace</a> and nodes other than
- <a href=#element id=table-sorting-model:element>Element</a> and <a href=#text id=table-sorting-model:text>Text</a> nodes, <var>cell</var> has only one child
- and that child is a <code id=table-sorting-model:the-data-element><a href=#the-data-element>data</a></code> element, then the value is the value of that
- <code id=table-sorting-model:the-data-element-2><a href=#the-data-element>data</a></code> element's <code id=table-sorting-model:attr-data-value><a href=#attr-data-value>value</a></code> attribute, if there is
- one, or the empty string otherwise; the type is "string".</p>
- <li><p>If, ignoring <a href=#inter-element-whitespace id=table-sorting-model:inter-element-whitespace-2>inter-element whitespace</a> and nodes other than
- <a href=#element id=table-sorting-model:element-2>Element</a> and <a href=#text id=table-sorting-model:text-2>Text</a> nodes, <var>cell</var> has only one child
- and that child is a <code id=table-sorting-model:the-progress-element><a href=#the-progress-element>progress</a></code> element, then the value is the value of that
- <code id=table-sorting-model:the-progress-element-2><a href=#the-progress-element>progress</a></code> element's <code id=table-sorting-model:attr-progress-value><a href=#attr-progress-value>value</a></code> attribute, if
- there is one, or the empty string otherwise; the type is "string".</p>
- <li><p>If, ignoring <a href=#inter-element-whitespace id=table-sorting-model:inter-element-whitespace-3>inter-element whitespace</a> and nodes other than
- <a href=#element id=table-sorting-model:element-3>Element</a> and <a href=#text id=table-sorting-model:text-3>Text</a> nodes, <var>cell</var> has only one child
- and that child is a <code id=table-sorting-model:the-meter-element><a href=#the-meter-element>meter</a></code> element, then the value is the value of that
- <code id=table-sorting-model:the-meter-element-2><a href=#the-meter-element>meter</a></code> element's <code id=table-sorting-model:attr-meter-value><a href=#attr-meter-value>value</a></code> attribute, if there is
- one, or the empty string otherwise; the type is "string".</p>
- <li>
- <p>If, ignoring <a href=#inter-element-whitespace id=table-sorting-model:inter-element-whitespace-4>inter-element whitespace</a> and nodes other than
- <a href=#element id=table-sorting-model:element-4>Element</a> and <a href=#text id=table-sorting-model:text-4>Text</a> nodes, <var>cell</var> has only one
- child and that child is a <code id=table-sorting-model:the-time-element><a href=#the-time-element>time</a></code> element, then the value is the
- <a href="#machine-readable-equivalent-of-the-element's-contents" id="table-sorting-model:machine-readable-equivalent-of-the-element's-contents">machine-readable equivalent of the element's contents</a>, if any, and the type is
- the kind of value that is thus obtained
- (a <a href=#concept-month id=table-sorting-model:concept-month>month</a>,
- a <a href=#concept-date id=table-sorting-model:concept-date>date</a>,
- a <a href=#concept-yearless-date id=table-sorting-model:concept-yearless-date>yearless date</a>,
- a <a href=#concept-time id=table-sorting-model:concept-time>time</a>,
- a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local>local date and time</a>,
- a <a href=#concept-timezone id=table-sorting-model:concept-timezone>time-zone offset</a>,
- a <a href=#concept-datetime id=table-sorting-model:concept-datetime>global date and time</a>,
- a <a href=#concept-week id=table-sorting-model:concept-week>week</a>,
- a year, or
- a <a href=#concept-duration id=table-sorting-model:concept-duration>duration</a>);
- abort these steps after completing this one.</p>
- <p>If there is no machine-readable equivalent, then the type is "string" and the value is
- the empty string.</p>
- <p>If the type is
- a <a href=#concept-month id=table-sorting-model:concept-month-2>month</a>,
- a <a href=#concept-date id=table-sorting-model:concept-date-2>date</a>,
- a <a href=#concept-week id=table-sorting-model:concept-week-2>week</a>, or
- a year,
- then change the value to be the instant in time (with no time zone) that describes the
- earliest moment that the value represents, and change the type to be
- a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-2>local date and time</a>.</p>
- <p class=example>For example, if the cell was <code><td><time>2011-11</time></code> then for sorting purposes the value is
- interpreted as "2011-11-01T00:00:00.000" and the type is treated as a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-3>local date and time</a> rather than a <a href=#concept-month id=table-sorting-model:concept-month-3>month</a>.</p>
- <p class=example>Similarly, if the cell was <code><td><time
- datetime="2014">MMXIV</time></code> then for sorting purposes the value is interpreted as
- "2014-01-01T00:00:00.000" and the type is treated as a <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-4>local date and time</a> rather than a year.</p>
- <li><p>The value is the element's <code id=table-sorting-model:textcontent><a href=#textcontent>textContent</a></code>. The type is "string".</ol>
- <li>
- <p>If <var>type<sub>a</sub></var> and <var>type<sub>b</sub></var> are not
- equal, then: return "a before b" if <var>type<sub>a</sub></var> is earlier in the
- following list than <var>type<sub>b</sub></var>, otherwise, return "b before a";
- then, abort these steps.</p>
- <ol class=brief><li><a href=#concept-time id=table-sorting-model:concept-time-2>time</a><li><a href=#concept-yearless-date id=table-sorting-model:concept-yearless-date-2>yearless date</a><li><a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-5>local date and time</a><li><a href=#concept-datetime id=table-sorting-model:concept-datetime-2>global date and time</a><li><a href=#concept-timezone id=table-sorting-model:concept-timezone-2>time-zone offset</a><li><a href=#concept-duration id=table-sorting-model:concept-duration-2>duration</a><li>"string"</ol>
- <li><p>If <var>value<sub>a</sub></var> and <var>value<sub>b</sub></var> are
- equal, then return "equal" and abort these steps.<li>
- <p>If <var>type<sub>a</sub></var> and <var>type<sub>b</sub></var> are not
- "string", then: if <var>value<sub>a</sub></var> is earlier than <var>value<sub>b</sub></var> then return "a before b" and abort these steps, otherwise,
- return "b before a" and abort these steps.</p>
- <p>Values sort in their natural order, with the following additional constraints:</p>
- <p>For <a href=#concept-time id=table-sorting-model:concept-time-3>time</a> values, 00:00:00.000 is the earliest value and
- 23:59:59.999 is the latest value.</p>
- <p>For <a href=#concept-yearless-date id=table-sorting-model:concept-yearless-date-3>yearless date</a> values, 01-01 is the earliest
- value and 12-31 is the latest value; 02-28 is earlier than 02-29 which is earlier than
- 03-01.</p>
- <p>Values that are <a href=#concept-datetime-local id=table-sorting-model:concept-datetime-local-6>local date and time</a> compare as
- if they were in the same time zone.</p>
-
- <p>For <a href=#concept-timezone id=table-sorting-model:concept-timezone-3>time-zone offset</a> values, -23:59 is the earliest
- value and +23:59 is the latest value.</p>
-
- <li>
- <p>Let <var>components<sub>a</sub></var> be the result of <a href=#parsing-the-sort-key id=table-sorting-model:parsing-the-sort-key>parsing the sort
- key</a> <var>value<sub>a</sub></var>.</p>
- <p>Let <var>components<sub>b</sub></var> be the result of <a href=#parsing-the-sort-key id=table-sorting-model:parsing-the-sort-key-2>parsing the sort
- key</a> <var>value<sub>b</sub></var>.</p>
- <p>As described below, <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var> are tuples consisting of a list of <var>n</var>
- <i>numbers</i>, a list of <var>n</var> <i>number strings</i>, a list of <var>n</var>+1 <i>non-numeric strings</i>, and a list of 2<var>n</var>+1 <i>raw
- strings</i>, for any non-negative integer value of <var>n</var> (zero or more).</p>
- <li>
- <p>Let <var>order</var> be the result of a <a href=#locale-specific-string-comparison id=table-sorting-model:locale-specific-string-comparison>locale-specific string
- comparison</a> of <var>components<sub>a</sub></var>'s first <i>non-numeric
- string</i> and <var>components<sub>b</sub></var>'s first <i>non-numeric string</i>,
- in the context of <var>th</var>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and abort
- these steps.</p>
- <li>
- <p>If <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var> both have exactly one <i>number</i>, then run these
- substeps:</p>
- <ol><li>
- <p>If <var>components<sub>a</sub></var>'s <i>number</i> is less than <var>components<sub>b</sub></var>'s <i>number</i>, return "a before b".</p>
- <p>If <var>components<sub>b</sub></var>'s <i>number</i> is less than <var>components<sub>a</sub></var>'s <i>number</i>, return "b before a".</p>
- <li>
- <p>Let <var>order</var> be the result of a <a href=#locale-specific-string-comparison id=table-sorting-model:locale-specific-string-comparison-2>locale-specific string
- comparison</a> of <var>components<sub>a</sub></var>'s second <i>non-numeric
- string</i> and <var>components<sub>b</sub></var>'s second <i>non-numeric
- string</i>, in the context of <var>th</var>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and
- abort these steps.</p>
- <li>
- <p>Let <var>order</var> be the result of a <a href=#locale-specific-string-comparison id=table-sorting-model:locale-specific-string-comparison-3>locale-specific string
- comparison</a> of <var>components<sub>a</sub></var>'s <i>number string</i> and
- <var>components<sub>b</sub></var>'s <i>number string</i>, in the context of <var>th</var>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and
- abort these steps.</p>
- </ol>
- <p>Otherwise, run these substeps:</p>
- <ol><li>
- <p>If <var>components<sub>a</sub></var> has zero <i>numbers</i> but <var>components<sub>b</sub></var> has more than zero <i>numbers</i>, return "a before
- b".</p>
- <p>If <var>components<sub>b</sub></var> has zero <i>numbers</i> but <var>components<sub>a</sub></var> has more than zero <i>numbers</i>, return "b before
- a".</p>
- <li>
-
- <p>If <var>components<sub>a</sub></var> has one <i>number</i>, return "a before
- b".</p>
- <p>If <var>components<sub>b</sub></var> has one <i>number</i>, return "b before
- a".</p>
- <li>
-
- <p>If <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var> have more than one <i>number</i>, run these substeps:</p>
- <ol><li><p>Let <var>count</var> be the smaller of the number of <i>numbers</i> in <var>components<sub>a</sub></var> and the number of <i>numbers</i> in <var>components<sub>b</sub></var>.<li><p>For each <i>number</i> in <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var> from the first to the <var>count</var>th, in
- order: if <var>components<sub>a</sub></var>'s <i>number</i> is less than <var>components<sub>b</sub></var>'s <i>number</i>, then return "a before b" and abort
- these steps; otherwise, if <var>components<sub>b</sub></var>'s <i>number</i> is
- less than <var>components<sub>a</sub></var>'s <i>number</i>, return "b before a"
- and abort these steps.<li>
- <p>If <var>components<sub>a</sub></var> has fewer <i>numbers</i> than <var>components<sub>b</sub></var>, return "a before b" and abort these steps.</p>
- <p>If <var>components<sub>b</sub></var> has fewer <i>numbers</i> than <var>components<sub>a</sub></var>, return "b before a" and abort these steps.</p>
- <li><p>Let <var>index</var> be zero.<li>
- <p><i>String loop</i>: Let <var>order</var> be the result of a <a href=#locale-specific-string-comparison id=table-sorting-model:locale-specific-string-comparison-4>locale-specific
- string comparison</a> of <var>components<sub>a</sub></var>'s <var>index</var>th <i>number string</i> and <var>components<sub>b</sub></var>'s <var>index</var>th <i>number string</i>,
- in the context of <var>th</var>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and
- abort these steps.</p>
- <li>
- <p>Increment <var>index</var>.</p>
- <li>
- <p>Let <var>order</var> be the result of a <a href=#locale-specific-string-comparison id=table-sorting-model:locale-specific-string-comparison-5>locale-specific string
- comparison</a> of <var>components<sub>a</sub></var>'s <var>index</var>th <i>separator string</i> and <var>components<sub>b</sub></var>'s <var>index</var>th <i>separator
- string</i>, in the context of <var>th</var>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and
- abort these steps.</p>
- <li>
- <p>If <var>index</var> is less than the number of <i>numbers</i> in <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var>, return
- to the step labeled <i>string loop</i>.</p>
- </ol>
- </ol>
- <li>
-
- <p>Let <var>index</var> be zero.</p>
- <li>
- <p><i>Final loop:</i> Let <var>order</var> be the result of a <a href=#raw-string-comparison id=table-sorting-model:raw-string-comparison>raw string
- comparison</a> of <var>components<sub>a</sub></var>'s <var>n</var>th
- <i>raw string</i> and <var>components<sub>b</sub></var>'s <var>n</var>th
- <i>raw string</i>.</p>
- <p>If <var>order</var> is not "equal" then return <var>order</var> and abort
- these steps.</p>
- <li>
- <p>Increment <var>index</var>.</p>
- <li>
- <p>If <var>index</var> is less than the number of <i>raw strings</i> in <var>components<sub>a</sub></var> and <var>components<sub>b</sub></var>, return
- to the step labeled <i>final loop</i>.</p>
- <li>
- <p>Return "equal".</p>
- </ol>
- <li><p>Let <var>new order</var> be a list of <code id=table-sorting-model:the-tr-element-19><a href=#the-tr-element>tr</a></code> elements consisting of the
- <code id=table-sorting-model:the-tr-element-20><a href=#the-tr-element>tr</a></code> elements of all the groups in the newly ordered <var>groups</var>, with
- the <code id=table-sorting-model:the-tr-element-21><a href=#the-tr-element>tr</a></code> elements being in the same order as the groups to which they belong are in
- <var>groups</var>, and the <code id=table-sorting-model:the-tr-element-22><a href=#the-tr-element>tr</a></code> elements within each such group themselves
- being ordered in <a href=#tree-order id=table-sorting-model:tree-order-4>tree order</a>.<li><p><a href=#concept-node-remove id=table-sorting-model:concept-node-remove>Remove</a> all the <code id=table-sorting-model:the-tr-element-23><a href=#the-tr-element>tr</a></code> elements in <var>new order</var> from their parents, in <a href=#tree-order id=table-sorting-model:tree-order-5>tree order</a>.<li><p><a href=#concept-node-insert id=table-sorting-model:concept-node-insert>Insert</a> all the <code id=table-sorting-model:the-tr-element-24><a href=#the-tr-element>tr</a></code> elements in <var>new order</var> into the DOM at the location of <var>insertion point</var>, in
- the order these elements are found in <var>new order</var>.<li><p>Remove <var>insertion point</var> from the DOM.<li><p><i>Increment loop</i>: If there are no <code id=table-sorting-model:the-tr-element-25><a href=#the-tr-element>tr</a></code> or <code id=table-sorting-model:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code> children of
- <var>table</var> that are later siblings of the element pointed to by <var>row
- collection cursor</var>, then jump to the step labeled <i>end</i> below.<li><p>Let <var>row collection cursor</var> point to the next <code id=table-sorting-model:the-tr-element-26><a href=#the-tr-element>tr</a></code> or
- <code id=table-sorting-model:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code> child of <var>table</var> that is a later sibling of the element
- pointed to by <var>row collection cursor</var>.<li><p>Return to the step labeled <i>row loop</i> above.<li><p><i>End</i>: Set <var>table</var>'s <a href=#currently-sorting-flag id=table-sorting-model:currently-sorting-flag-3>currently-sorting flag</a> to
- false.</ol>
- <p>When a user agent is to <dfn id=parsing-the-sort-key>parse the sort key</dfn> <var>value</var>, it must run the following steps. These return a tuple consisting of a list
- of <var>n</var> <i>numbers</i>, a list of <var>n</var> <i>number strings</i>, a
- list of <var>n</var>+1 <i>non-numeric strings</i>, and a list of 2<var>n</var>+1
- <i>raw strings</i>, respectively, for any non-negative integer value of <var>n</var> (zero or
- more).</p>
- <ol><li>
- <p>Let <var>raw strings</var> be a list of strings initially containing just one entry, an empty string.</p>
- <li>
- <p>Let <var>negatives prejudiced</var> be false.</p>
- <p>Let <var>decimals prejudiced</var> be false.</p>
- <p>Let <var>exponents prejudiced</var> be false.</p>
- <li>
- <p>Let <var>buffer</var> be the empty string.</p>
- <p>Let <var>index</var> be zero.</p>
- <p>Let <dfn id=sort-parser-mode><var>mode</var></dfn> be "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator>separator</a>".</p>
- <p>When a subsequent step in this algorithm says to <dfn id=sort-parser-push-the-buffer>push the buffer</dfn>, the user agent must run the following substeps:</p>
- <ol><li><p>Add an entry to <var>raw strings</var> that consists of the value of <var>buffer</var>.<li><p>Add an entry to <var>raw strings</var> that is the empty string.<li><p>Decrement <var>index</var> by one.<li><p>Set <var id=table-sorting-model:sort-parser-mode><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator-2>separator</a>".</ol>
- <li>
- <p>Let <var>checkpoint buffer</var> be the empty string.</p>
- <p>Let <var>checkpoint index</var> be zero.</p>
- <p>When a subsequent step in this algorithm says to <dfn id=sort-parser-checkpoint>checkpoint</dfn>, the user agent must run the following substeps:</p>
- <ol><li><p>Set the <var>checkpoint buffer</var> to the value of <var>buffer</var>.</p>
- <li><p>Set the <var>checkpoint index</var> to the value of <var>index</var>.</p>
- </ol>
- <p>When a subsequent step in this algorithm says to <dfn id=sort-parser-push-the-checkpoint>push the checkpoint</dfn>, the user agent must run the following substeps:</p>
- <ol><li><p>Add an entry to <var>raw strings</var> that consists of the value of <var>checkpoint buffer</var>.<li><p>Add an entry to <var>raw strings</var> that is the empty string.<li><p>Decrement <var>index</var> by one.<li><p>Set <var id=table-sorting-model:sort-parser-mode-2><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator-3>separator</a>".</ol>
- <li>
- <p>Run through the following steps repeatedly until the condition in the last step is met.</p>
- <ol><li>
- <p><i>Top of loop</i>: If <var>index</var> is equal to or greater than the number of
- characters in <var>value</var>, let <var>c</var> be EOF. Otherwise, let <var>c</var> be the <var>index</var>th character in <var>value</var>.</p>
- <li>
- <p>Run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If <var id=table-sorting-model:sort-parser-mode-3><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-separator>separator</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a <a href=#space-character id=table-sorting-model:space-character>space character</a><dd>
- <p>Set <var>negatives prejudiced</var> to false.</p>
- <p>Set <var>decimals prejudiced</var> to false.</p>
- <p>Set <var>exponents prejudiced</var> to false.</p>
- <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
- <dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-) and <var>negatives prejudiced</var> is false<dd>
- <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-4><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-negative id=table-sorting-model:sort-parser-mode:-negative>negative</a>".</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
- <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-5><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-leading-decimal id=table-sorting-model:sort-parser-mode:-leading-decimal>leading-decimal</a>".</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits>ASCII digit</a><dd>
- <p>Set <var>buffer</var> to the value of <var>c</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-6><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-integral id=table-sorting-model:sort-parser-mode:-integral>integral</a>".</p>
- <dt>If <var>c</var> is an <a href=#uppercase-ascii-letters id=table-sorting-model:uppercase-ascii-letters>uppercase ASCII letter</a> or a <a href=#lowercase-ascii-letters id=table-sorting-model:lowercase-ascii-letters>lowercase ASCII letter</a><dd>
- <p>Set <var>exponents prejudiced</var> to true.</p>
- <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
- <dt>If <var>c</var> is EOF<dd>
- <p>Do nothing.</p>
- <dt>Otherwise<dd>
- <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-7><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-negative>negative</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
- <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-8><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator-4>separator</a>".</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-9><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-leading-decimal id=table-sorting-model:sort-parser-mode:-leading-decimal-2>leading-decimal</a>".</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-2>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-10><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-integral id=table-sorting-model:sort-parser-mode:-integral-2>integral</a>".</p>
- <dt>Otherwise<dd>
- <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
- <p>Decrement <var>index</var> by one.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-11><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator-5>separator</a>".</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-12><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-integral>integral</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer>Push the buffer</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.) and <var>decimals prejudiced</var> is false<dd>
- <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint>Checkpoint</a>.</p>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-13><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-decimal id=table-sorting-model:sort-parser-mode:-decimal>decimal</a>".</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-3>ASCII digit</a><dd>
- <p>Append <var>c</var> to the last entry in <var>raw strings</var>.</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character and <var>exponents prejudiced</var> is false<dd>
- <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint-2>Checkpoint</a>.</p>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-14><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-exponent id=table-sorting-model:sort-parser-mode:-exponent>exponent</a>".</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-2>Push the buffer</a>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-15><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-leading-decimal>leading-decimal</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-4>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-16><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-decimal id=table-sorting-model:sort-parser-mode:-decimal-2>decimal</a>".</p>
- <dt>Otherwise<dd>
- <p>Append <var>buffer</var> to the last entry in <var>raw strings</var>.</p>
- <p>Decrement <var>index</var> by one.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-17><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-separator id=table-sorting-model:sort-parser-mode:-separator-6>separator</a>".</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-18><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-decimal>decimal</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-3>Push the buffer</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.) and any of the characters in <var>value</var> past the <var>index</var>th character are <a href=#ascii-digits id=table-sorting-model:ascii-digits-5>ASCII digits</a><dd>
- <p>Set <var>decimals prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.) and none of the characters in <var>value</var> past the <var>index</var>th character are <a href=#ascii-digits id=table-sorting-model:ascii-digits-6>ASCII digits</a><dd>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-4>Push the buffer</a>.</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-7>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character and <var>exponents prejudiced</var> is false<dd>
- <p><a href=#sort-parser-checkpoint id=table-sorting-model:sort-parser-checkpoint-3>Checkpoint</a>.</p>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-19><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-exponent id=table-sorting-model:sort-parser-mode:-exponent-2>exponent</a>".</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-5>Push the buffer</a>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-20><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-exponent>exponent</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-) and <var>negatives prejudiced</var> is false<dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-21><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-exponent-negative id=table-sorting-model:sort-parser-mode:-exponent-negative>exponent-negative</a>".</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
- <p>Set <var>decimals prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-2>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-8>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-22><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-exponent-number id=table-sorting-model:sort-parser-mode:-exponent-number>exponent-number</a>".</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
- <p>Set <var>exponents prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-3>Push the checkpoint</a>.</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-4>Push the checkpoint</a>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-23><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-exponent-negative>exponent-negative</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-5>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
- <p>Set <var>decimals prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-6>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-9>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <p>Set <var id=table-sorting-model:sort-parser-mode-24><a href=#sort-parser-mode>mode</a></var> to "<a href=#sort-parser-mode:-exponent-negative-number id=table-sorting-model:sort-parser-mode:-exponent-negative-number>exponent-negative-number</a>".</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
- <p>Set <var>exponents prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-7>Push the checkpoint</a>.</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-8>Push the checkpoint</a>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-25><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-exponent-number>exponent-number</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-6>Push the buffer</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
- <p>Set <var>decimals prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-9>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-10>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
- <p>Set <var>exponents prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-10>Push the checkpoint</a>.</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-7>Push the buffer</a>.</p>
- </dl>
- <dt>If <var id=table-sorting-model:sort-parser-mode-26><a href=#sort-parser-mode>mode</a></var> is "<dfn id=sort-parser-mode:-exponent-negative-number>exponent-negative-number</dfn>"<dd>
- <p>Run the appropriate substeps from the following list:</p>
- <dl class=switch><dt>If <var>c</var> is a U+002D HYPHEN-MINUS character (-)<dd>
- <p>Set <var>negatives prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-11>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is a U+002E FULL STOP character (.)<dd>
- <p>Set <var>decimals prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-12>Push the checkpoint</a>.</p>
- <dt>If <var>c</var> is an <a href=#ascii-digits id=table-sorting-model:ascii-digits-11>ASCII digit</a><dd>
- <p>Append <var>c</var> to <var>buffer</var>.</p>
- <dt>If <var>c</var> is a U+0045 LATIN CAPITAL LETTER E character or a U+0065 LATIN SMALL LETTER E character<dd>
- <p>Set <var>exponents prejudiced</var> to true.</p>
- <p><a href=#sort-parser-push-the-checkpoint id=table-sorting-model:sort-parser-push-the-checkpoint-13>Push the checkpoint</a>.</p>
- <dt>Otherwise<dd>
- <p><a href=#sort-parser-push-the-buffer id=table-sorting-model:sort-parser-push-the-buffer-8>Push the buffer</a>.</p>
- </dl>
- </dl>
- <li>
- <p>Increment <var>index</var> by one.</p>
- <li>
- <p>If <var>index</var> is greater than the number of characters in <var>value</var>, stop repeating these substeps and continue along the overall steps.
- Otherwise, return to the step labeled <i>top of loop</i>.</p>
- </ol>
- <li>
- <p>Let <var>numbers</var> be an empty list.</p>
- <p>Let <var>number strings</var> be an empty list.</p>
- <p>Let <var>non-numeric strings</var> be an empty list.</p>
- <li>
- <p>For each even-numbered entry in <var>raw strings</var>, in order, starting from the
- first entry (numbered 0), append an entry to <var>non-numeric strings</var> that
- consists of the result of <a href=#trimming-and-collapsing id=table-sorting-model:trimming-and-collapsing>trimming and collapsing</a> the value of the entry.</p>
- <li>
- <p>If <var>raw strings</var> has more than one entry, then, for each odd-numbered entry
- in <var>raw strings</var>, in order, starting from the second entry (numbered 1),
- append an entry to <var>number strings</var> that consists of the value of the entry,
- and append an entry to <var>number strings</var> that consists of the result of parsing
- the value of the entry using the <a href=#rules-for-parsing-floating-point-number-values id=table-sorting-model:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number
- values</a>.</p>
- <li>
- <p>Return <var>numbers</var>, <var>number strings</var>, <var>non-numeric strings</var>, and <var>raw strings</var> respectively.</p>
- </ol>
- <p>When the user agent is required by the step above to perform a <dfn id=locale-specific-string-comparison>locale-specific string
- comparison</dfn> of two strings <var>a</var> and <var>b</var> in the context of
- an element <var>e</var>, the user agent must apply the Unicode Collation Algorithm, using
- the Default Unicode Collation Element Table as customised for the <a href=#language id=table-sorting-model:language>language</a> of the
- element <var>e</var> in the Common Locale Data Repository, to the strings <var>a</var> and <var>b</var>, ignoring case. If the result of this algorithm places
- <var>a</var> first, then return "a before b"; if it places <var>b</var> first,
- then return "b before a"; otherwise, if they compare as equal, then return "equal". <a href=#refsUCA>[UCA]</a> <a href=#refsCLDR>[CLDR]</a></p>
- <p>When the user agent is required by the step above to perform a <dfn id=raw-string-comparison>raw string comparison</dfn>
- of two strings <var>a</var> and <var>b</var>, the user agent must apply the
- Unicode Collation Algorithm, using the Default Unicode Collation Element Table without
- customizations, to the strings <var>a</var> and <var>b</var>. If the result of
- this algorithm places <var>a</var> first, then return "a before b"; if it places <var>b</var> first, then return "b before a"; otherwise, if they compare as equal, then return
- "equal". <a href=#refsUCA>[UCA]</a></p>
- <p>Where the steps above refer to <dfn id=trimming-and-collapsing>trimming and collapsing</dfn> a string <var>value</var>, it means running the following algorithm:</p>
- <ol><li><p><a href=#strip-leading-and-trailing-whitespace id=table-sorting-model:strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var>value</var>.<li><p>Replace any sequence of one or more <a href=#space-character id=table-sorting-model:space-character-2>space characters</a>
- in <var>value</var> with a single U+0020 SPACE character.</ol>
- <hr>
- <p>When any of the descendants of a <a href=#sorting-enabled-table-element id=table-sorting-model:sorting-enabled-table-element-3>sorting-enabled <code>table</code> element</a> change
- in any way (including attributes changing), and when a <code id=table-sorting-model:the-table-element-14><a href=#the-table-element>table</a></code> element becomes a
- <a href=#sorting-enabled-table-element id=table-sorting-model:sorting-enabled-table-element-4>sorting-enabled <code>table</code> element</a>, the <code id=table-sorting-model:the-table-element-15><a href=#the-table-element>table</a></code> element is said to
- become <dfn id=a-table-with-a-pending-sort>a table with a pending sort</dfn>. When a <code id=table-sorting-model:the-table-element-16><a href=#the-table-element>table</a></code> element becomes <a href=#a-table-with-a-pending-sort id=table-sorting-model:a-table-with-a-pending-sort>a
- table with a pending sort</a>, the user agent must <a href=#queue-a-microtask id=table-sorting-model:queue-a-microtask>queue a microtask</a> that applies
- the <a href=#table-sorting-algorithm id=table-sorting-model:table-sorting-algorithm>table sorting algorithm</a> to that <code id=table-sorting-model:the-table-element-17><a href=#the-table-element>table</a></code>, and then flags the
- <code id=table-sorting-model:the-table-element-18><a href=#the-table-element>table</a></code> as no longer being <a href=#a-table-with-a-pending-sort id=table-sorting-model:a-table-with-a-pending-sort-2>a table with a pending sort</a>.</p>
- <hr>
- <p>When the user agent is to <dfn id=set-the-sort-key>set the sort key</dfn> to a <code id=table-sorting-model:the-th-element-17><a href=#the-th-element>th</a></code> element <var>target</var>, it must run the following algorithm:</p>
- <ol><li><p>Let <var>table</var> be the <code id=table-sorting-model:the-table-element-19><a href=#the-table-element>table</a></code> of the <a href=#concept-table id=table-sorting-model:concept-table-8>table</a> of which <var>target</var> is a header cell.<li><p>If <code id=table-sorting-model:the-th-element-18><a href=#the-th-element>th</a></code> is a <a href=#sorting-enabled-th-element id=table-sorting-model:sorting-enabled-th-element-3>sorting-enabled <code>th</code> element</a> whose
- <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-6>column key ordinality</a> is 1, then: if its <a href=#column-sort-direction id=table-sorting-model:column-sort-direction-4>column sort direction</a> is
- <i>normal</i>, set that element's <code id=table-sorting-model:attr-th-sorted-11><a href=#attr-th-sorted>sorted</a></code> attribute to the
- string "<code>reversed</code>", otherwise, set it to the empty string; then, abort these
- steps.<li><p>Let <var>current headers</var> be the <a href=#sorting-enabled-th-elements-of-the-table-element id=table-sorting-model:sorting-enabled-th-elements-of-the-table-element-2>sorting-enabled <code>th</code>
- elements of the <code>table</code> element</a> <var>table</var>, excluding <var>target</var>.<li><p>Sort <var>current headers</var> by their <code id=table-sorting-model:attr-th-sorted-12><a href=#attr-th-sorted>sorted</a></code> attributes' <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-7>column key ordinality</a>, in ascending
- order, with elements that have the same <a href=#column-key-ordinality id=table-sorting-model:column-key-ordinality-8>column key ordinality</a> being sorted in
- <a href=#tree-order id=table-sorting-model:tree-order-6>tree order</a>.<li><p>Let <var>level</var> be 2.<li>
- <p>For each <code id=table-sorting-model:the-th-element-19><a href=#the-th-element>th</a></code> element <var>th</var> in <var>current
- headers</var>, in order, run the following substeps:</p>
- <ol><li><p>If <var>th</var>'s <code id=table-sorting-model:attr-th-sorted-13><a href=#attr-th-sorted>sorted</a></code> attribute's
- <a href=#column-sort-direction id=table-sorting-model:column-sort-direction-5>column sort direction</a> is <i>normal</i>, then set <var>th</var>'s <code id=table-sorting-model:attr-th-sorted-14><a href=#attr-th-sorted>sorted</a></code> attribute to a <a href=#valid-integer id=table-sorting-model:valid-integer>valid integer</a> whose value is
- <var>level</var>. Otherwise, set it to the concatenation of the string "<code>reversed</code>", a U+0020 SPACE character, and a <a href=#valid-integer id=table-sorting-model:valid-integer-2>valid integer</a> whose
- value is <var>level</var>.</p>
- <li><p>Increment <var>level</var> by 1.</ol>
- <li><p>Set <var>target</var>'s <code id=table-sorting-model:attr-th-sorted-15><a href=#attr-th-sorted>sorted</a></code> attribute to
- the empty string.</ol>
- <hr>
- <p>The <a href=#activation-behavior id=table-sorting-model:activation-behavior>activation behavior</a> of a <a href=#sorting-interface-th-element id=table-sorting-model:sorting-interface-th-element>sorting interface <code>th</code>
- element</a> is to <a href=#set-the-sort-key id=table-sorting-model:set-the-sort-key>set the sort key</a> to the <code id=table-sorting-model:the-th-element-20><a href=#the-th-element>th</a></code> element.</p>
- <p class=note>The <code id=table-sorting-model:the-table-element-20><a href=#the-table-element>table</a></code> will be sorted the next time the user agent <a href=#perform-a-microtask-checkpoint id=table-sorting-model:perform-a-microtask-checkpoint>performs a microtask checkpoint</a>.</p>
-
- <dl class=domintro><dt><var>th</var> . <code id=table-sorting-model:dom-th-sort><a href=#dom-th-sort>sort</a></code>()<dd>
- <p>Act as if the user had indicated that this was to be the new primary sort column.</p>
- <p>The <code id=table-sorting-model:the-table-element-21><a href=#the-table-element>table</a></code> won't actually be sorted until the script terminates.</p>
- <dt><var>table</var> . <code id=table-sorting-model:dom-table-stopsorting><a href=#dom-table-stopsorting>stopSorting</a></code>()<dd>
- <p>Removes all the <code id=table-sorting-model:attr-th-sorted-16><a href=#attr-th-sorted>sorted</a></code> attributes that are causing the
- table to automatically sort its contents, if any.</p>
- </dl>
-
- <p>The <code id=table-sorting-model:the-th-element-21><a href=#the-th-element>th</a></code> element's <dfn id=dom-th-sort><code>sort()</code></dfn> method, when
- invoked, must run the following steps:</p>
- <ol><li><p>If the <code id=table-sorting-model:the-th-element-22><a href=#the-th-element>th</a></code> element is not a <a href=#sorting-capable-th-element id=table-sorting-model:sorting-capable-th-element-7>sorting-capable <code>th</code>
- element</a>, then abort these steps.<li>
- <p><a href=#set-the-sort-key id=table-sorting-model:set-the-sort-key-2>Set the sort key</a> to the <code id=table-sorting-model:the-th-element-23><a href=#the-th-element>th</a></code> element.</p>
- <p class=note>The <code id=table-sorting-model:the-table-element-22><a href=#the-table-element>table</a></code> will be sorted the next time the user agent <a href=#perform-a-microtask-checkpoint id=table-sorting-model:perform-a-microtask-checkpoint-2>performs a microtask checkpoint</a>.</p>
- </ol>
- <p>The <code id=table-sorting-model:the-table-element-23><a href=#the-table-element>table</a></code> element's <dfn id=dom-table-stopsorting><code>stopSorting()</code></dfn> method, when invoked, must remove
- the <code id=table-sorting-model:attr-th-sorted-17><a href=#attr-th-sorted>sorted</a></code> attribute of all the <a href=#sorting-enabled-th-elements-of-the-table-element id=table-sorting-model:sorting-enabled-th-elements-of-the-table-element-3>sorting-enabled
- <code>th</code> elements of the table element</a> on which the method was invoked.</p>
-
- <h4 id=table-examples>4.9.14 Examples</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The following shows how might one mark up the bottom part of table 45 of the <cite>Smithsonian
- physical tables, Volume 71</cite>:</p>
-
-
- <pre><table>
- <caption>Specification values: <b>Steel</b>, <b>Castings</b>,
- Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption>
- <thead>
- <tr>
- <th rowspan=2>Grade.</th>
- <th rowspan=2>Yield Point.</th>
- <th colspan=2>Ultimate tensile strength</th>
- <th rowspan=2>Per cent elong. 50.8mm or 2 in.</th>
- <th rowspan=2>Per cent reduct. area.</th>
- </tr>
- <tr>
- <th>kg/mm<sup>2</sup></th>
- <th>lb/in<sup>2</sup></th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Hard</td>
- <td>0.45 ultimate</td>
- <td>56.2</td>
- <td>80,000</td>
- <td>15</td>
- <td>20</td>
- </tr>
- <tr>
- <td>Medium</td>
- <td>0.45 ultimate</td>
- <td>49.2</td>
- <td>70,000</td>
- <td>18</td>
- <td>25</td>
- </tr>
- <tr>
- <td>Soft</td>
- <td>0.45 ultimate</td>
- <td>42.2</td>
- <td>60,000</td>
- <td>22</td>
- <td>30</td>
- </tr>
- </tbody>
- </table></pre>
- <p>This table could look like this:</p>
- <table id=table-example-1><caption>Specification values: <b>Steel</b>, <b>Castings</b>,
- Ann. A.S.T.M. A27-16, Class B;* P max. 0.06; S max. 0.05.</caption><thead><tr><th rowspan=2>Grade.<th rowspan=2>Yield Point.<th colspan=2>Ultimate tensile strength<th rowspan=2>Per cent elong. 50.8 mm or 2 in.<th rowspan=2>Per cent reduct. area.<tr><th>kg/mm<sup>2</sup><th>lb/in<sup>2</sup><tbody><tr><td>Hard<td>0.45 ultimate<td>56.2<td>80,000<td>15<td>20<tr><td>Medium<td>0.45 ultimate<td>49.2<td>70,000<td>18<td>25<tr><td>Soft<td>0.45 ultimate<td>42.2<td>60,000<td>22<td>30</table>
- <hr>
- <p>The following shows how one might mark up the gross margin table on page 46 of Apple, Inc's
- 10-K filing for fiscal year 2008:</p>
- <pre><table>
- <thead>
- <tr>
- <th>
- <th>2008
- <th>2007
- <th>2006
- <tbody>
- <tr>
- <th>Net sales
- <td>$ 32,479
- <td>$ 24,006
- <td>$ 19,315
- <tr>
- <th>Cost of sales
- <td> 21,334
- <td> 15,852
- <td> 13,717
- <tbody>
- <tr>
- <th>Gross margin
- <td>$ 11,145
- <td>$ 8,154
- <td>$ 5,598
- <tfoot>
- <tr>
- <th>Gross margin percentage
- <td>34.3%
- <td>34.0%
- <td>29.0%
- </table></pre>
- <p>This table could look like this:</p>
- <table class="apple-table-examples e1"><thead><tr><th>
- <th>2008
- <th>2007
- <th>2006
- <tbody><tr><th>Net sales
- <td>$ 32,479
- <td>$ 24,006
- <td>$ 19,315
- <tr><th>Cost of sales
- <td> 21,334
- <td> 15,852
- <td> 13,717
- <tbody><tr><th>Gross margin
- <td>$ 11,145
- <td>$ 8,154
- <td>$ 5,598
- <tfoot><tr><th>Gross margin percentage
- <td>34.3%
- <td>34.0%
- <td>29.0%
- </table>
- <hr>
- <p>The following shows how one might mark up the operating expenses table from lower on the same
- page of that document:</p>
- <pre><table>
- <colgroup> <col>
- <colgroup> <col> <col> <col>
- <thead>
- <tr> <th> <th>2008 <th>2007 <th>2006
- <tbody>
- <tr> <th scope=rowgroup> Research and development
- <td> $ 1,109 <td> $ 782 <td> $ 712
- <tr> <th scope=row> Percentage of net sales
- <td> 3.4% <td> 3.3% <td> 3.7%
- <tbody>
- <tr> <th scope=rowgroup> Selling, general, and administrative
- <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
- <tr> <th scope=row> Percentage of net sales
- <td> 11.6% <td> 12.3% <td> 12.6%
- </table></pre>
- <p>This table could look like this:</p>
- <table class="apple-table-examples e2"><thead><tr><th> <th>2008 <th>2007 <th>2006
- <tbody><tr><th scope=rowgroup> Research and development
- <td> $ 1,109 <td> $ 782 <td> $ 712
- <tr><th scope=row> Percentage of net sales
- <td> 3.4% <td> 3.3% <td> 3.7%
- <tbody><tr><th scope=rowgroup> Selling, general, and administrative
- <td> $ 3,761 <td> $ 2,963 <td> $ 2,433
- <tr><th scope=row> Percentage of net sales
- <td> 11.6% <td> 12.3% <td> 12.6%
- </table>
- <hr>
- <p>Sometimes, tables are used for dense data. For examples, here a table is used to show entries
- in an access log:</p>
- <pre><table sortable>
- <thead>
- <tr>
- <th sorted> Timestamp
- <th> IP
- <th> Message
- <tbody>
- <tr>
- <td> <time>21:01</time>
- <td> 128.30.52.199
- <td> Exceeded ingress limit
- <tr>
- <td> <time>21:04</time>
- <td> 128.30.52.3
- <td> Authentication failure
- <tr>
- <td> <time>22:35</time>
- <td> 128.30.52.29
- <td> Malware command request blocked
- <tr>
- <td> <time>22:36</time>
- <td> 128.30.52.3
- <td> Authentication failure
- </table></pre>
- <p>Because the <code id=table-examples:the-table-element><a href=#the-table-element>table</a></code> element has a <code id=table-examples:attr-table-sortable><a href=#attr-table-sortable>sortable</a></code>
- attribute, the column headers can be selected to change the table's sort order.</p>
- <p>This might render as follows:</p>
- <p><img src=http://images.whatwg.org/sample-table-sortable-1.png width=418 alt="The table as marked above, but with the column headers having interactive affordances to select which column to sort by, the first being already selected." height=109>
- <p>If the user activates the second column, the table might change as follows:</p>
- <p><img src=http://images.whatwg.org/sample-table-sortable-2.png width=414 alt="The same table, but with the second column header's interactive affordance marked as selected, with the IP addresses sorted in numeric order (first the rows with the address ending in '3', then the row with the address ending in '29', and finally the row with the address ending in '199'." height=109>
- <p>If the user activates the second column again, reversing the sort order, it might change as follows:</p>
- <p><img src=http://images.whatwg.org/sample-table-sortable-3.png width=414 alt="The same table, but with the second column header's interactive affordance marked as selected and reversed, with the IP addresses sorted in reverse numeric order (first the row with the address ending in '199', then the row with the address ending in '29', and finally the rows with the address ending in '3'." height=109>
- <h3 id=forms>4.10 Forms</h3>
- <h4 id=introduction-5>4.10.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>A form is a component of a Web page that has form controls, such as text fields, buttons,
- checkboxes, range controls, or colour pickers. A user can interact with such a form, providing data
- that can then be sent to the server for further processing (e.g. returning the results of a search
- or calculation). No client-side scripting is needed in many cases, though an API is available so
- that scripts can augment the user experience or use forms for purposes other than submitting data
- to a server.</p>
- <p>Writing a form consists of several steps, which can be performed in any order: writing the user
- interface, implementing the server-side processing, and configuring the user interface to
- communicate with the server.</p>
- <h5 id="writing-a-form's-user-interface">4.10.1.1 Writing a form's user interface</h5>
- <p><i>This section is non-normative.</i></p>
- <p>For the purposes of this brief introduction, we will create a pizza ordering form.</p>
- <p>Any form starts with a <code id="writing-a-form's-user-interface:the-form-element"><a href=#the-form-element>form</a></code> element, inside which are placed the controls. Most
- controls are represented by the <code id="writing-a-form's-user-interface:the-input-element"><a href=#the-input-element>input</a></code> element, which by default provides a one-line
- text field. To label a control, the <code id="writing-a-form's-user-interface:the-label-element"><a href=#the-label-element>label</a></code> element is used; the label text and the
- control itself go inside the <code id="writing-a-form's-user-interface:the-label-element-2"><a href=#the-label-element>label</a></code> element. Each part of a form is considered a
- <a href=#paragraph id="writing-a-form's-user-interface:paragraph">paragraph</a>, and is typically separated from other parts using <code id="writing-a-form's-user-interface:the-p-element"><a href=#the-p-element>p</a></code> elements.
- Putting this together, here is how one might ask for the customer's name:</p>
- <pre><strong><form>
- <p><label>Customer name: <input></label></p>
- </form></strong></pre>
- <p>To let the user select the size of the pizza, we can use a set of radio buttons. Radio buttons
- also use the <code id="writing-a-form's-user-interface:the-input-element-2"><a href=#the-input-element>input</a></code> element, this time with a <code id="writing-a-form's-user-interface:attr-input-type"><a href=#attr-input-type>type</a></code> attribute with the value <code id="writing-a-form's-user-interface:radio-button-state-(type=radio)"><a href="#radio-button-state-(type=radio)">radio</a></code>. To make the radio buttons work as a group, they are
- given a common name using the <code id="writing-a-form's-user-interface:attr-fe-name"><a href=#attr-fe-name>name</a></code> attribute. To group a batch
- of controls together, such as, in this case, the radio buttons, one can use the
- <code id="writing-a-form's-user-interface:the-fieldset-element"><a href=#the-fieldset-element>fieldset</a></code> element. The title of such a group of controls is given by the first element
- in the <code id="writing-a-form's-user-interface:the-fieldset-element-2"><a href=#the-fieldset-element>fieldset</a></code>, which has to be a <code id="writing-a-form's-user-interface:the-legend-element"><a href=#the-legend-element>legend</a></code> element.</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <strong> <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset></strong>
- </form></pre>
- <p class=note>Changes from the previous step are highlighted.</p>
- <p>To pick toppings, we can use checkboxes. These use the <code id="writing-a-form's-user-interface:the-input-element-3"><a href=#the-input-element>input</a></code> element with a <code id="writing-a-form's-user-interface:attr-input-type-2"><a href=#attr-input-type>type</a></code> attribute with the value <code id="writing-a-form's-user-interface:checkbox-state-(type=checkbox)"><a href="#checkbox-state-(type=checkbox)">checkbox</a></code>:</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset>
- <strong> <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox> Bacon </label></p>
- <p><label> <input type=checkbox> Extra Cheese </label></p>
- <p><label> <input type=checkbox> Onion </label></p>
- <p><label> <input type=checkbox> Mushroom </label></p>
- </fieldset></strong>
- </form></pre>
- <p>The pizzeria for which this form is being written is always making mistakes, so it needs a way
- to contact the customer. For this purpose, we can use form controls specifically for telephone
- numbers (<code id="writing-a-form's-user-interface:the-input-element-4"><a href=#the-input-element>input</a></code> elements with their <code id="writing-a-form's-user-interface:attr-input-type-3"><a href=#attr-input-type>type</a></code>
- attribute set to <code id="writing-a-form's-user-interface:telephone-state-(type=tel)"><a href="#telephone-state-(type=tel)">tel</a></code>) and e-mail addresses
- (<code id="writing-a-form's-user-interface:the-input-element-5"><a href=#the-input-element>input</a></code> elements with their <code id="writing-a-form's-user-interface:attr-input-type-4"><a href=#attr-input-type>type</a></code> attribute set to
- <code id="writing-a-form's-user-interface:e-mail-state-(type=email)"><a href="#e-mail-state-(type=email)">email</a></code>):</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <strong> <p><label>Telephone: <input type=tel></label></p>
- <p><label>E-mail address: <input type=email></label></p></strong>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox> Bacon </label></p>
- <p><label> <input type=checkbox> Extra Cheese </label></p>
- <p><label> <input type=checkbox> Onion </label></p>
- <p><label> <input type=checkbox> Mushroom </label></p>
- </fieldset>
- </form></pre>
- <p>We can use an <code id="writing-a-form's-user-interface:the-input-element-6"><a href=#the-input-element>input</a></code> element with its <code id="writing-a-form's-user-interface:attr-input-type-5"><a href=#attr-input-type>type</a></code>
- attribute set to <code id="writing-a-form's-user-interface:time-state-(type=time)"><a href="#time-state-(type=time)">time</a></code> to ask for a delivery time. Many
- of these form controls have attributes to control exactly what values can be specified; in this
- case, three attributes of particular interest are <code id="writing-a-form's-user-interface:attr-input-min"><a href=#attr-input-min>min</a></code>, <code id="writing-a-form's-user-interface:attr-input-max"><a href=#attr-input-max>max</a></code>, and <code id="writing-a-form's-user-interface:attr-input-step"><a href=#attr-input-step>step</a></code>. These set the
- minimum time, the maximum time, and the interval between allowed values (in seconds). This
- pizzeria only delivers between 11am and 9pm, and doesn't promise anything better than 15 minute
- increments, which we can mark up as follows:</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <p><label>Telephone: <input type=tel></label></p>
- <p><label>E-mail address: <input type=email></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox> Bacon </label></p>
- <p><label> <input type=checkbox> Extra Cheese </label></p>
- <p><label> <input type=checkbox> Onion </label></p>
- <p><label> <input type=checkbox> Mushroom </label></p>
- </fieldset>
- <strong> <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900"></label></p></strong>
- </form></pre>
- <p>The <code id="writing-a-form's-user-interface:the-textarea-element"><a href=#the-textarea-element>textarea</a></code> element can be used to provide a free-form text field. In this
- instance, we are going to use it to provide a space for the customer to give delivery
- instructions:</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <p><label>Telephone: <input type=tel></label></p>
- <p><label>E-mail address: <input type=email></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox> Bacon </label></p>
- <p><label> <input type=checkbox> Extra Cheese </label></p>
- <p><label> <input type=checkbox> Onion </label></p>
- <p><label> <input type=checkbox> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900"></label></p>
- <strong> <p><label>Delivery instructions: <textarea></textarea></label></p></strong>
- </form></pre>
- <p>Finally, to make the form submittable we use the <code id="writing-a-form's-user-interface:the-button-element"><a href=#the-button-element>button</a></code> element:</p>
- <pre><form>
- <p><label>Customer name: <input></label></p>
- <p><label>Telephone: <input type=tel></label></p>
- <p><label>E-mail address: <input type=email></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size> Small </label></p>
- <p><label> <input type=radio name=size> Medium </label></p>
- <p><label> <input type=radio name=size> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox> Bacon </label></p>
- <p><label> <input type=checkbox> Extra Cheese </label></p>
- <p><label> <input type=checkbox> Onion </label></p>
- <p><label> <input type=checkbox> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900"></label></p>
- <p><label>Delivery instructions: <textarea></textarea></label></p>
- <strong> <p><button>Submit order</button></p></strong>
- </form></pre>
- <h5 id=implementing-the-server-side-processing-for-a-form>4.10.1.2 Implementing the server-side processing for a form</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The exact details for writing a server-side processor are out of scope for this specification.
- For the purposes of this introduction, we will assume that the script at <code>https://pizza.example.com/order.cgi</code> is configured to accept submissions using the
- <code id=implementing-the-server-side-processing-for-a-form:attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> format,
- expecting the following parameters sent in an HTTP POST body:</p>
- <dl><dt><code>custname</code><dd>Customer's name<dt><code>custtel</code><dd>Customer's telephone number<dt><code>custemail</code><dd>Customer's e-mail address<dt><code>size</code><dd>The pizza size, either <code>small</code>, <code>medium</code>, or <code>large</code><dt><code>topping</code><dd>A topping, specified once for each selected topping, with the allowed values being <code>bacon</code>, <code>cheese</code>, <code>onion</code>, and <code>mushroom</code><dt><code>delivery</code><dd>The requested delivery time<dt><code>comments</code><dd>The delivery instructions</dl>
- <h5 id=configuring-a-form-to-communicate-with-a-server>4.10.1.3 Configuring a form to communicate with a server</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Form submissions are exposed to servers in a variety of ways, most commonly as HTTP GET or POST
- requests. To specify the exact method used, the <code id=configuring-a-form-to-communicate-with-a-server:attr-fs-method><a href=#attr-fs-method>method</a></code>
- attribute is specified on the <code id=configuring-a-form-to-communicate-with-a-server:the-form-element><a href=#the-form-element>form</a></code> element. This doesn't specify how the form data is
- encoded, though; to specify that, you use the <code id=configuring-a-form-to-communicate-with-a-server:attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>
- attribute. You also have to specify the <a href=#url id=configuring-a-form-to-communicate-with-a-server:url>URL</a> of the service that will handle the
- submitted data, using the <code id=configuring-a-form-to-communicate-with-a-server:attr-fs-action><a href=#attr-fs-action>action</a></code> attribute.</p>
- <p>For each form control you want submitted, you then have to give a name that will be used to
- refer to the data in the submission. We already specified the name for the group of radio buttons;
- the same attribute (<code id=configuring-a-form-to-communicate-with-a-server:attr-fe-name><a href=#attr-fe-name>name</a></code>) also specifies the submission name.
- Radio buttons can be distinguished from each other in the submission by giving them different
- values, using the <code id=configuring-a-form-to-communicate-with-a-server:attr-input-value><a href=#attr-input-value>value</a></code> attribute.</p>
- <p>Multiple controls can have the same name; for example, here we give all the checkboxes the same
- name, and the server distinguishes which checkbox was checked by seeing which values are submitted
- with that name — like the radio buttons, they are also given unique values with the <code id=configuring-a-form-to-communicate-with-a-server:attr-input-value-2><a href=#attr-input-value>value</a></code> attribute.</p>
- <p>Given the settings in the previous section, this all becomes:</p>
- <pre><form<strong> method="post"
- enctype="application/x-www-form-urlencoded"
- action="https://pizza.example.com/order.cgi"</strong>>
- <p><label>Customer name: <input<strong> name="custname"</strong>></label></p>
- <p><label>Telephone: <input type=tel<strong> name="custtel"</strong>></label></p>
- <p><label>E-mail address: <input type=email<strong> name="custemail"</strong>></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size<strong> value="small"</strong>> Small </label></p>
- <p><label> <input type=radio name=size<strong> value="medium"</strong>> Medium </label></p>
- <p><label> <input type=radio name=size<strong> value="large"</strong>> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox<strong> name="topping" value="bacon"</strong>> Bacon </label></p>
- <p><label> <input type=checkbox<strong> name="topping" value="cheese"</strong>> Extra Cheese </label></p>
- <p><label> <input type=checkbox<strong> name="topping" value="onion"</strong>> Onion </label></p>
- <p><label> <input type=checkbox<strong> name="topping" value="mushroom"</strong>> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900"<strong> name="delivery"</strong>></label></p>
- <p><label>Delivery instructions: <textarea<strong> name="comments"</strong>></textarea></label></p>
- <p><button>Submit order</button></p>
- </form></pre>
- <p class=note>There is no particular significance to the way some of the attributes have their
- values quoted and others don't. The HTML syntax allows a variety of equally valid ways to specify
- attributes, as discussed <a href=#syntax-attributes id=configuring-a-form-to-communicate-with-a-server:syntax-attributes>in the syntax section</a>.</p>
- <p>For example, if the customer entered "Denise Lawrence" as their name, "555-321-8642" as their
- telephone number, did not specify an e-mail address, asked for a medium-sized pizza, selected the
- Extra Cheese and Mushroom toppings, entered a delivery time of 7pm, and left the delivery
- instructions text field blank, the user agent would submit the following to the online Web
- service:</p>
- <pre>custname=Denise+Lawrence&custtel=555-321-8642&custemail=&size=medium&topping=cheese&topping=mushroom&delivery=19%3A00&comments=</pre>
- <h5 id=client-side-form-validation>4.10.1.4 Client-side form validation</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Forms can be annotated in such a way that the user agent will check the user's input before the
- form is submitted. The server still has to verify the input is valid (since hostile users can
- easily bypass the form validation), but it allows the user to avoid the wait incurred by having
- the server be the sole checker of the user's input.</p>
- <p>The simplest annotation is the <code id=client-side-form-validation:attr-input-required><a href=#attr-input-required>required</a></code> attribute,
- which can be specified on <code id=client-side-form-validation:the-input-element><a href=#the-input-element>input</a></code> elements to indicate that the form is not to be
- submitted until a value is given. By adding this attribute to the customer name, pizza size, and
- delivery time fields, we allow the user agent to notify the user when the user submits the form
- without filling in those fields:</p>
- <pre><form method="post"
- enctype="application/x-www-form-urlencoded"
- action="https://pizza.example.com/order.cgi">
- <p><label>Customer name: <input name="custname"<strong> required</strong>></label></p>
- <p><label>Telephone: <input type=tel name="custtel"></label></p>
- <p><label>E-mail address: <input type=email name="custemail"></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size<strong> required</strong> value="small"> Small </label></p>
- <p><label> <input type=radio name=size<strong> required</strong> value="medium"> Medium </label></p>
- <p><label> <input type=radio name=size<strong> required</strong> value="large"> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox name="topping" value="bacon"> Bacon </label></p>
- <p><label> <input type=checkbox name="topping" value="cheese"> Extra Cheese </label></p>
- <p><label> <input type=checkbox name="topping" value="onion"> Onion </label></p>
- <p><label> <input type=checkbox name="topping" value="mushroom"> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900" name="delivery"<strong> required</strong>></label></p>
- <p><label>Delivery instructions: <textarea name="comments"></textarea></label></p>
- <p><button>Submit order</button></p>
- </form></pre>
- <p>It is also possible to limit the length of the input, using the <code id=client-side-form-validation:attr-fe-maxlength><a href=#attr-fe-maxlength>maxlength</a></code> attribute. By adding this to the <code id=client-side-form-validation:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
- element, we can limit users to 1000 characters, preventing them from writing huge essays to the
- busy delivery drivers instead of staying focused and to the point:</p>
- <pre><form method="post"
- enctype="application/x-www-form-urlencoded"
- action="https://pizza.example.com/order.cgi">
- <p><label>Customer name: <input name="custname" required></label></p>
- <p><label>Telephone: <input type=tel name="custtel"></label></p>
- <p><label>E-mail address: <input type=email name="custemail"></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size required value="small"> Small </label></p>
- <p><label> <input type=radio name=size required value="medium"> Medium </label></p>
- <p><label> <input type=radio name=size required value="large"> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox name="topping" value="bacon"> Bacon </label></p>
- <p><label> <input type=checkbox name="topping" value="cheese"> Extra Cheese </label></p>
- <p><label> <input type=checkbox name="topping" value="onion"> Onion </label></p>
- <p><label> <input type=checkbox name="topping" value="mushroom"> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900" name="delivery" required></label></p>
- <p><label>Delivery instructions: <textarea name="comments"<strong> maxlength=1000</strong>></textarea></label></p>
- <p><button>Submit order</button></p>
- </form></pre>
- <p class=note>When a form is submitted, <code id=client-side-form-validation:event-invalid><a href=#event-invalid>invalid</a></code> events are
- fired at each form control that is invalid, and then at the <code id=client-side-form-validation:the-form-element><a href=#the-form-element>form</a></code> element itself. This
- can be useful for displaying a summary of the problems with the form, since typically the browser
- itself will only report one problem at a time.</p>
- <h5 id=enabling-client-side-automatic-filling-of-form-controls>4.10.1.5 Enabling client-side automatic filling of form controls</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Some browsers attempt to aid the user by automatically filling form controls rather than having
- the user reenter their information each time. For example, a field asking for the user's telephone
- number can be automatically filled with the user's phone number.</p>
- <p>To help the user agent with this, the <code id=enabling-client-side-automatic-filling-of-form-controls:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
- attribute can be used to describe the field's purpose. In the case of this form, we have three
- fields that can be usefully annotated in this way: the information about who the pizza is to be
- delivered to. Adding this information looks like this:</p>
- <pre><form method="post"
- enctype="application/x-www-form-urlencoded"
- action="https://pizza.example.com/order.cgi">
- <p><label>Customer name: <input name="custname" required <strong>autocomplete="shipping name"</strong>></label></p>
- <p><label>Telephone: <input type=tel name="custtel" <strong>autocomplete="shipping tel"</strong>></label></p>
- <p><label>E-mail address: <input type=email name="custemail" <strong>autocomplete="shipping email"</strong>></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size required value="small"> Small </label></p>
- <p><label> <input type=radio name=size required value="medium"> Medium </label></p>
- <p><label> <input type=radio name=size required value="large"> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox name="topping" value="bacon"> Bacon </label></p>
- <p><label> <input type=checkbox name="topping" value="cheese"> Extra Cheese </label></p>
- <p><label> <input type=checkbox name="topping" value="onion"> Onion </label></p>
- <p><label> <input type=checkbox name="topping" value="mushroom"> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900" name="delivery" required></label></p>
- <p><label>Delivery instructions: <textarea name="comments" maxlength=1000></textarea></label></p>
- <p><button>Submit order</button></p>
- </form></pre>
- <h5 id=improving-the-user-experience-on-mobile-devices>4.10.1.6 Improving the user experience on mobile devices</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Some devices, in particular those with on-screen keyboards and those in locales with languages
- with many characters (e.g. Japanese), can provide the user with multiple input modalities. For
- example, when typing in a credit card number the user may wish to only see keys for digits 0-9,
- while when typing in their name they may wish to see a form field that by default capitalises each
- word.</p>
- <p>Using the <code id=improving-the-user-experience-on-mobile-devices:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute we can select appropriate
- input modalities:</p>
- <pre><form method="post"
- enctype="application/x-www-form-urlencoded"
- action="https://pizza.example.com/order.cgi">
- <p><label>Customer name: <input name="custname" required autocomplete="shipping name" <strong>inputmode="latin-name"</strong>></label></p>
- <p><label>Telephone: <input type=tel name="custtel" autocomplete="shipping tel"></label></p>
- <p><label>E-mail address: <input type=email name="custemail" autocomplete="shipping email"></label></p>
- <fieldset>
- <legend> Pizza Size </legend>
- <p><label> <input type=radio name=size required value="small"> Small </label></p>
- <p><label> <input type=radio name=size required value="medium"> Medium </label></p>
- <p><label> <input type=radio name=size required value="large"> Large </label></p>
- </fieldset>
- <fieldset>
- <legend> Pizza Toppings </legend>
- <p><label> <input type=checkbox name="topping" value="bacon"> Bacon </label></p>
- <p><label> <input type=checkbox name="topping" value="cheese"> Extra Cheese </label></p>
- <p><label> <input type=checkbox name="topping" value="onion"> Onion </label></p>
- <p><label> <input type=checkbox name="topping" value="mushroom"> Mushroom </label></p>
- </fieldset>
- <p><label>Preferred delivery time: <input type=time min="11:00" max="21:00" step="900" name="delivery" required></label></p>
- <p><label>Delivery instructions: <textarea name="comments" maxlength=1000 <strong>inputmode="latin-prose"</strong>></textarea></label></p>
- <p><button>Submit order</button></p>
- </form></pre>
- <h5 id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality>4.10.1.7 The difference between the field type, the autofill field name, and the input modality</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-input-type><a href=#attr-input-type>type</a></code>, <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>, and <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attributes can seem confusingly similar. For instance,
- in all three cases, the string "<code>email</code>" is a valid value. This section
- attempts to illustrate the difference between the three attributes and provides advice suggesting
- how to use them.</p>
- <p>The <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute on <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-input-element><a href=#the-input-element>input</a></code> elements decides
- what kind of control the user agent will use to expose the field. Choosing between different
- values of this attribute is the same choice as choosing whether to use an <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-input-element-2><a href=#the-input-element>input</a></code>
- element, a <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element, a <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-select-element><a href=#the-select-element>select</a></code> element, a <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-keygen-element><a href=#the-keygen-element>keygen</a></code>
- element, etc.</p>
- <p>The <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute, in contrast, describes
- what the value that the user will enter actually represents. Choosing between different values of
- this attribute is the same choice as choosing what the label for the element will be.</p>
- <p>First, consider telephone numbers. If a page is asking for a telephone number from the user,
- the right form control to use is <code id="the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:telephone-state-(type=tel)"><a href="#telephone-state-(type=tel)"><input type=tel></a></code>.
- However, which <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code> value to use depends on
- which phone number the page is asking for, whether they expect a telephone number in the
- international format or just the local format, and so forth.</p>
- <p>For example, a page that forms part of a checkout process on an e-commerce site for a customer
- buying a gift to be shipped to a friend might need both the buyer's telephone number (in case of
- payment issues) and the friend's telephone number (in case of delivery issues). If the site
- expects international phone numbers (with the country code prefix), this could thus look like
- this:</p>
- <pre><p><label>Your phone number: <input type=tel name=custtel autocomplete="billing tel"></label>
- <p><label>Recipient's phone number: <input type=tel name=shiptel autocomplete="shipping tel"></label>
- <p>Please enter complete phone numbers including the country code prefix, as in "+1 555 123 4567".</pre>
- <p>But if the site only supports British customers and recipients, it might instead look like this
- (notice the use of <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code> rather than
- <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>):</p>
- <pre><p><label>Your phone number: <input type=tel name=custtel autocomplete="billing tel-national"></label>
- <p><label>Recipient's phone number: <input type=tel name=shiptel autocomplete="shipping tel-national"></label>
- <p>Please enter complete UK phone numbers, as in "(01632) 960 123".</pre>
- <p>Now, consider a person's preferred languages. The right <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> value is <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>. However, there could be a number of
- different form controls used for the purpose: a free text field (<code id="the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:text-(type=text)-state-and-search-state-(type=search)"><a href="#text-(type=text)-state-and-search-state-(type=search)"><input type=text></a></code>), a drop-down list (<code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:the-select-element-2><a href=#the-select-element><select></a></code>), radio buttons (<code id="the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:radio-button-state-(type=radio)"><a href="#radio-button-state-(type=radio)"><input
- type=radio></a></code>), etc. It only depends on what kind of interface is desired.</p>
- <p>The <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code> decides what kind of input modality (e.g.
- keyboard) to use, when the control is a free-form text field.</p>
- <p>Consider names. If a page just wants one name from the user, then the relevant control is <code id="the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:text-(type=text)-state-and-search-state-(type=search)-2"><a href="#text-(type=text)-state-and-search-state-(type=search)"><input type=text></a></code>. If the page is asking for the user's
- full name, then the relevant <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-5><a href=#attr-fe-autocomplete>autocomplete</a></code> value is <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>. But if the user is Japanese, and the page is asking
- for the user's Japanese name and the user's romanised name, then it would be helpful to the user
- if the first field defaulted to a Japanese input modality, while the second defaulted to a Latin
- input modality (ideally with automatic capitalization of each word). This is where the <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-inputmode-3><a href=#attr-fe-inputmode>inputmode</a></code> attribute can help:</p>
- <pre><p><label>Japanese name: <input name="j" type="text" autocomplete="section-jp name" inputmode="kana"></label>
- <label>Romanised name: <input name="e" type="text" autocomplete="section-en name" inputmode="latin-name"></label></pre>
- <p>In this example, the "<code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-section><a href=#attr-fe-autocomplete-section>section-*</a></code>" keywords in
- the <code id=the-difference-between-the-field-type,-the-autofill-field-name,-and-the-input-modality:attr-fe-autocomplete-6><a href=#attr-fe-autocomplete>autocomplete</a></code> attributes' values tell the user agent
- that the two fields expect <em>different</em> names. Without them, the user agent could
- automatically fill the second field with the value given in the first field when the user gave a
- value to the first field.</p>
- <p class=note>The "<code>-jp</code>" and "<code>-en</code>" parts of the
- keywords are opaque to the user agent; the user agent cannot guess, from those, that the two names
- are expected to be in Japanese and English respectively.</p>
- <h5 id=input-author-notes>4.10.1.8 Date, time, and number formats</h5>
-
- <p><i>This section is non-normative.</i></p>
- <p>In this pizza delivery example, the times are specified in the format "HH:MM": two digits for
- the hour, in 24-hour format, and two digits for the time. (Seconds could also be specified, though
- they are not necessary in this example.)</p>
- <p>In some locales, however, times are often expressed differently when presented to users. For
- example, in the United States, it is still common to use the 12-hour clock with an am/pm
- indicator, as in "2pm". In France, it is common to separate the hours from the minutes using an
- "h" character, as in "14h00".</p>
- <p>Similar issues exist with dates, with the added complication that even the order of the
- components is not always consistent — for example, in Cyprus the first of February 2003
- would typically be written "1/2/03", while that same date in Japan would typically be written as
- "2003年02月01日" — and even with numbers, where locales differ, for
- example, in what punctuation is used as the decimal separator and the thousands separator.</p>
- <p>It is therefore important to distinguish the time, date, and number formats used in HTML and in
- form submissions, which are always the formats defined in this specification (and based on the
- well-established ISO 8601 standard for computer-readable date and time formats), from the time,
- date, and number formats presented to the user by the browser and accepted as input from the user
- by the browser.</p>
- <p>The format used "on the wire", i.e. in HTML markup and in form submissions, is intended to be
- computer-readable and consistent irrespective of the user's locale. Dates, for instance, are
- always written in the format "YYYY-MM-DD", as in "2003-02-01". Users are not expected to ever see
- this format.</p>
- <p>The time, date, or number given by the page in the wire format is then translated to the user's
- preferred presentation (based on user preferences or on the locale of the page itself), before
- being displayed to the user. Similarly, after the user inputs a time, date, or number using their
- preferred format, the user agent converts it back to the wire format before putting it in the DOM
- or submitting it.</p>
- <p>This allows scripts in pages and on servers to process times, dates, and numbers in a
- consistent manner without needing to support dozens of different formats, while still supporting
- the users' needs.</p>
-
- <p class=note>See also the <a href=#input-impl-notes>implementation notes</a> regarding
- localization of form controls.</p>
-
- <h4 id=categories>4.10.2 Categories</h4>
- <p>Mostly for historical reasons, elements in this section fall into several overlapping (but
- subtly different) categories in addition to the usual ones like <a href=#flow-content-2 id=categories:flow-content-2>flow content</a>,
- <a href=#phrasing-content-2 id=categories:phrasing-content-2>phrasing content</a>, and <a href=#interactive-content-2 id=categories:interactive-content-2>interactive content</a>.</p>
- <p>A number of the elements are <dfn id=form-associated-element>form-associated
- elements</dfn>, which means they can have a <a href=#form-owner id=categories:form-owner>form owner</a>.
-
- <ul class="brief category-list"><li><code id=categories:the-button-element><a href=#the-button-element>button</a></code><li><code id=categories:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code><li><code id=categories:the-input-element><a href=#the-input-element>input</a></code><li><code id=categories:the-keygen-element><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-label-element><a href=#the-label-element>label</a></code><li><code id=categories:the-object-element><a href=#the-object-element>object</a></code><li><code id=categories:the-output-element><a href=#the-output-element>output</a></code><li><code id=categories:the-select-element><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element><a href=#the-textarea-element>textarea</a></code><li><code id=categories:the-img-element><a href=#the-img-element>img</a></code></ul>
- <p>The <a href=#form-associated-element id=categories:form-associated-element>form-associated elements</a> fall into several
- subcategories:</p>
- <dl><dt><dfn id=category-listed>Listed elements</dfn><dd>
- <p>Denotes elements that are listed in the <code id=categories:dom-form-elements><a href=#dom-form-elements><var>form</var>.elements</a></code> and <code id=categories:dom-fieldset-elements><a href=#dom-fieldset-elements><var>fieldset</var>.elements</a></code> APIs.</p>
-
- <ul class="brief category-list"><li><code id=categories:the-button-element-2><a href=#the-button-element>button</a></code><li><code id=categories:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code><li><code id=categories:the-input-element-2><a href=#the-input-element>input</a></code><li><code id=categories:the-keygen-element-2><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-object-element-2><a href=#the-object-element>object</a></code><li><code id=categories:the-output-element-2><a href=#the-output-element>output</a></code><li><code id=categories:the-select-element-2><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code></ul>
- <dt><dfn id=category-submit>Submittable elements</dfn><dd>
- <p>Denotes elements that can be used for <a href=#constructing-form-data-set>constructing the
- form data set</a> when a <code id=categories:the-form-element><a href=#the-form-element>form</a></code> element is <a href=#concept-form-submit id=categories:concept-form-submit>submitted</a>.</p>
-
- <ul class="brief category-list"><li><code id=categories:the-button-element-3><a href=#the-button-element>button</a></code><li><code id=categories:the-input-element-3><a href=#the-input-element>input</a></code><li><code id=categories:the-keygen-element-3><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-object-element-3><a href=#the-object-element>object</a></code><li><code id=categories:the-select-element-3><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code></ul>
- <p>Some <a href=#category-submit id=categories:category-submit>submittable elements</a> can be, depending on their
- attributes, <dfn id=concept-button>buttons</dfn>. The prose below defines when an element
- is a button. Some buttons are specifically <dfn id=concept-submit-button>submit
- buttons</dfn>.</p>
- <dt><dfn id=category-reset>Resettable elements</dfn><dd>
- <p>Denotes elements that can be affected when a <code id=categories:the-form-element-2><a href=#the-form-element>form</a></code> element is <a href=#concept-form-reset id=categories:concept-form-reset>reset</a>.</p>
-
- <ul class="brief category-list"><li><code id=categories:the-input-element-4><a href=#the-input-element>input</a></code><li><code id=categories:the-keygen-element-4><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-output-element-3><a href=#the-output-element>output</a></code><li><code id=categories:the-select-element-4><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code></ul>
- <dt><dfn id=category-form-attr>Reassociateable elements</dfn><dd>
- <p>Denotes elements that have a <code id=categories:attr-fae-form><a href=#attr-fae-form>form</a></code> content attribute, and a
- matching <code id=categories:dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute, that allow authors to specify an
- explicit <a href=#form-owner id=categories:form-owner-2>form owner</a>.</p>
-
- <ul class="brief category-list"><li><code id=categories:the-button-element-4><a href=#the-button-element>button</a></code><li><code id=categories:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code><li><code id=categories:the-input-element-5><a href=#the-input-element>input</a></code><li><code id=categories:the-keygen-element-5><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-label-element-2><a href=#the-label-element>label</a></code><li><code id=categories:the-object-element-4><a href=#the-object-element>object</a></code><li><code id=categories:the-output-element-4><a href=#the-output-element>output</a></code><li><code id=categories:the-select-element-5><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code></ul>
- </dl>
- <p>Some elements, not all of them <a href=#form-associated-element id=categories:form-associated-element-2>form-associated</a>,
- are categorised as <dfn id=category-label>labelable elements</dfn>. These are elements that
- can be associated with a <code id=categories:the-label-element-3><a href=#the-label-element>label</a></code> element.
-
- <ul class="brief category-list"><li><code id=categories:the-button-element-5><a href=#the-button-element>button</a></code><li><code id=categories:the-input-element-6><a href=#the-input-element>input</a></code> (if the <code id=categories:attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="categories:hidden-state-(type=hidden)">Hidden</a> state)<li><code id=categories:the-keygen-element-6><a href=#the-keygen-element>keygen</a></code><li><code id=categories:the-meter-element><a href=#the-meter-element>meter</a></code><li><code id=categories:the-output-element-5><a href=#the-output-element>output</a></code><li><code id=categories:the-progress-element><a href=#the-progress-element>progress</a></code><li><code id=categories:the-select-element-6><a href=#the-select-element>select</a></code><li><code id=categories:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code></ul>
- <h4 id=the-form-element>4.10.3 The <dfn><code>form</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-form-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-form-element:flow-content-2>Flow content</a>.<dd><a href=#palpable-content-2 id=the-form-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-form-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-form-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-form-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-form-element:flow-content-2-3>Flow content</a>, but with no <code id=the-form-element:the-form-element><a href=#the-form-element>form</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-form-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-form-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-form-element:global-attributes>Global attributes</a><dd><code id=the-form-element:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> — Character encodings to use for <a href=#form-submission-2 id=the-form-element:form-submission-2>form submission</a><dd><code id=the-form-element:attr-fs-action><a href=#attr-fs-action>action</a></code> — <a href=#url id=the-form-element:url>URL</a> to use for <a href=#form-submission-2 id=the-form-element:form-submission-2-2>form submission</a><dd><code id=the-form-element:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> — Default setting for autofill feature for controls in the form<dd><code id=the-form-element:attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code> — Form data set encoding type to use for <a href=#form-submission-2 id=the-form-element:form-submission-2-3>form submission</a><dd><code id=the-form-element:attr-fs-method><a href=#attr-fs-method>method</a></code> — HTTP method to use for <a href=#form-submission-2 id=the-form-element:form-submission-2-4>form submission</a><dd><code id=the-form-element:attr-form-name><a href=#attr-form-name>name</a></code> — Name of form to use in the <code id=the-form-element:dom-document-forms><a href=#dom-document-forms>document.forms</a></code> API<dd><code id=the-form-element:attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code> — Bypass form control validation for <a href=#form-submission-2 id=the-form-element:form-submission-2-5>form submission</a><dd><code id=the-form-element:attr-fs-target><a href=#attr-fs-target>target</a></code> — <a href=#browsing-context id=the-form-element:browsing-context>Browsing context</a> for <a href=#form-submission-2 id=the-form-element:form-submission-2-6>form submission</a><dt><a href=#concept-element-dom id=the-form-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>[OverrideBuiltins]
- interface <dfn id=htmlformelement>HTMLFormElement</dfn> : <a href=#htmlelement id=the-form-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-form-acceptcharset id=the-form-element:dom-form-acceptcharset>acceptCharset</a>;
- attribute DOMString <a href=#dom-fs-action id=the-form-element:dom-fs-action>action</a>;
- attribute DOMString <a href=#dom-form-autocomplete id=the-form-element:dom-form-autocomplete>autocomplete</a>;
- attribute DOMString <a href=#dom-fs-enctype id=the-form-element:dom-fs-enctype>enctype</a>;
- attribute DOMString <a href=#dom-fs-encoding id=the-form-element:dom-fs-encoding>encoding</a>;
- attribute DOMString <a href=#dom-fs-method id=the-form-element:dom-fs-method>method</a>;
- attribute DOMString <a href=#dom-form-name id=the-form-element:dom-form-name>name</a>;
- attribute boolean <a href=#dom-fs-novalidate id=the-form-element:dom-fs-novalidate>noValidate</a>;
- attribute DOMString <a href=#dom-fs-target id=the-form-element:dom-fs-target>target</a>;
- readonly attribute <a href=#htmlformcontrolscollection-2 id=the-form-element:htmlformcontrolscollection-2>HTMLFormControlsCollection</a> <a href=#dom-form-elements id=the-form-element:dom-form-elements>elements</a>;
- readonly attribute long <a href=#dom-form-length id=the-form-element:dom-form-length>length</a>;
- <a href=#dom-form-item id=the-form-element:dom-form-item>getter</a> <a href=#element id=the-form-element:element>Element</a> (unsigned long index);
- <a href=#dom-form-nameditem id=the-form-element:dom-form-nameditem>getter</a> (<a href=#radionodelist id=the-form-element:radionodelist>RadioNodeList</a> or <a href=#element id=the-form-element:element-2>Element</a>) (DOMString name);
- void <a href=#dom-form-submit id=the-form-element:dom-form-submit>submit</a>();
- void <a href=#dom-form-reset id=the-form-element:dom-form-reset>reset</a>();
- boolean <a href=#dom-form-checkvalidity id=the-form-element:dom-form-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-form-reportvalidity id=the-form-element:dom-form-reportvalidity>reportValidity</a>();
- void <a href=#dom-form-requestautocomplete id=the-form-element:dom-form-requestautocomplete>requestAutocomplete</a>();
- };</pre>
- </dl>
- <p>The <code id=the-form-element:the-form-element-2><a href=#the-form-element>form</a></code> element <a href=#represents id=the-form-element:represents>represents</a> a collection of <a href=#form-associated-element id=the-form-element:form-associated-element>form-associated elements</a>, some of which can represent
- editable values that can be submitted to a server for processing.</p>
- <p>The <dfn id=attr-form-accept-charset><code>accept-charset</code></dfn> attribute gives the
- character encodings that are to be used for the submission. If specified, the value must be an
- <a href=#ordered-set-of-unique-space-separated-tokens id=the-form-element:ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</a> that are <a href=#ascii-case-insensitive id=the-form-element:ascii-case-insensitive>ASCII
- case-insensitive</a>, and each token must be an <a href=#ascii-case-insensitive id=the-form-element:ascii-case-insensitive-2>ASCII case-insensitive</a> match for
- one of the <a href=#encoding-label id=the-form-element:encoding-label>labels</a> of an <a href=#ascii-compatible-character-encoding id=the-form-element:ascii-compatible-character-encoding>ASCII-compatible character
- encoding</a>. <a href=#refsENCODING>[ENCODING]</a></p>
- <p>The <dfn id=attr-form-name><code>name</code></dfn> attribute represents the
- <code id=the-form-element:the-form-element-3><a href=#the-form-element>form</a></code>'s name within the <code id=the-form-element:dom-document-forms-2><a href=#dom-document-forms>forms</a></code> collection. The
- value must not be the empty string, and the value must be unique amongst the <code id=the-form-element:the-form-element-4><a href=#the-form-element>form</a></code>
- elements in the <code id=the-form-element:dom-document-forms-3><a href=#dom-document-forms>forms</a></code> collection that it is in, if
- any.</p>
- <p>The <dfn id=attr-form-autocomplete><code>autocomplete</code></dfn> attribute is an
- <a href=#enumerated-attribute id=the-form-element:enumerated-attribute>enumerated attribute</a>. The attribute has two states. The <dfn id=attr-form-autocomplete-on><code>on</code></dfn> keyword maps to the <dfn id=attr-form-autocomplete-on-state>on</dfn> state, and the <dfn id=attr-form-autocomplete-off><code>off</code></dfn> keyword maps to the <dfn id=attr-form-autocomplete-off-state>off</dfn> state. The attribute may also be omitted. The
- <i id=the-form-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-form-autocomplete-on-state id=the-form-element:attr-form-autocomplete-on-state>on</a> state. The <a href=#attr-form-autocomplete-off-state id=the-form-element:attr-form-autocomplete-off-state>off</a> state indicates that by default, form
- controls in the form will have their <a href=#autofill-field-name id=the-form-element:autofill-field-name>autofill field name</a> set to "<code id=the-form-element:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"; the <a href=#attr-form-autocomplete-on-state id=the-form-element:attr-form-autocomplete-on-state-2>on</a> state indicates that by default, form controls
- in the form will have their <a href=#autofill-field-name id=the-form-element:autofill-field-name-2>autofill field name</a> set to "<code id=the-form-element:attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>".</p>
- <p>The <code id=the-form-element:attr-fs-action-2><a href=#attr-fs-action>action</a></code>, <code id=the-form-element:attr-fs-enctype-2><a href=#attr-fs-enctype>enctype</a></code>,
- <code id=the-form-element:attr-fs-method-2><a href=#attr-fs-method>method</a></code>, <code id=the-form-element:attr-fs-novalidate-2><a href=#attr-fs-novalidate>novalidate</a></code>,
- and <code id=the-form-element:attr-fs-target-2><a href=#attr-fs-target>target</a></code> attributes are <a href=#attributes-for-form-submission id=the-form-element:attributes-for-form-submission>attributes for form
- submission</a>.</p>
- <dl class=domintro><dt><var>form</var> . <code id=the-form-element:dom-form-elements-2><a href=#dom-form-elements>elements</a></code><dd>
- <p>Returns an <code id=the-form-element:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> of the form controls in the form (excluding image
- buttons for historical reasons).</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-length-2><a href=#dom-form-length>length</a></code><dd>
- <p>Returns the number of form controls in the form (excluding image buttons for historical
- reasons).</p>
- <dt><var>form</var>[<var>index</var>]<dd>
- <p>Returns the <var>index</var>th element in the form (excluding image buttons for
- historical reasons).</p>
- <dt><var>form</var>[<var>name</var>]<dd>
- <p>Returns the form control (or, if there are several, a <code id=the-form-element:radionodelist-2><a href=#radionodelist>RadioNodeList</a></code> of the form
- controls) in the form with the given <a href=#concept-id id=the-form-element:concept-id>ID</a> or <code id=the-form-element:attr-fe-name><a href=#attr-fe-name>name</a></code> (excluding image buttons for historical reasons); or, if there
- are none, returns the <code id=the-form-element:the-img-element><a href=#the-img-element>img</a></code> element with the given ID.</p>
- <p>Once an element has been referenced using a particular name, that name will continue being
- available as a way to reference that element in this method, even if the element's actual <a href=#concept-id id=the-form-element:concept-id-2>ID</a> or <code id=the-form-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> changes, for as long as
- the element remains in the <code id=the-form-element:document><a href=#document>Document</a></code>.</p>
- <p>If there are multiple matching items, then a <code id=the-form-element:radionodelist-3><a href=#radionodelist>RadioNodeList</a></code> object containing all
- those elements is returned.</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-submit-2><a href=#dom-form-submit>submit</a></code>()<dd>
- <p>Submits the form.</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-reset-2><a href=#dom-form-reset>reset</a></code>()<dd>
- <p>Resets the form.</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-checkvalidity-2><a href=#dom-form-checkvalidity>checkValidity</a></code>()<dd>
- <p>Returns true if the form's controls are all valid; otherwise, returns false.</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-reportvalidity-2><a href=#dom-form-reportvalidity>reportValidity</a></code>()<dd>
- <p>Returns true if the form's controls are all valid; otherwise, returns false and informs the user.</p>
- <dt><var>form</var> . <code id=the-form-element:dom-form-requestautocomplete-2><a href=#dom-form-requestautocomplete>requestAutocomplete</a></code>()<dd>
- <p>Triggers a user-agent-specific asynchronous user interface to help the user fill in any
- fields that have an <a href=#autofill-field-name id=the-form-element:autofill-field-name-3>autofill field name</a> other than "<code id=the-form-element:attr-fe-autocomplete-on-2><a href=#attr-fe-autocomplete-on>on</a></code>" or "<code id=the-form-element:attr-fe-autocomplete-off-2><a href=#attr-fe-autocomplete-off>off</a></code>".</p>
- <p>The <code id=the-form-element:the-form-element-5><a href=#the-form-element>form</a></code> element will subsequently receive an event, either <code id=the-form-element:event-autocomplete><a href=#event-autocomplete>autocomplete</a></code>, indicating that the fields have been prefilled,
- or <code id=the-form-element:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> (using the
- <code id=the-form-element:autocompleteerrorevent><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code> interface), indicating that there was some problem (the
- general class of problem is described by the <code id=the-form-element:dom-autocompleteerrorevent-reason><a href=#dom-autocompleteerrorevent-reason>reason</a></code> IDL attribute on the event).</p>
- </dl>
-
- <p>The <dfn id=dom-form-autocomplete><code>autocomplete</code></dfn> IDL attribute must
- <a href=#reflect id=the-form-element:reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values id=the-form-element:limited-to-only-known-values>limited to only known
- values</a>.</p>
- <p>The <code id=the-form-element:dom-form-requestautocomplete-3><a href=#dom-form-requestautocomplete>requestAutocomplete()</a></code> method is part of
- the <a href=#attr-fe-autocomplete id=the-form-element:attr-fe-autocomplete>autofill mechanism</a>.</p>
- <p>The <dfn id=dom-form-name><code>name</code></dfn> IDL attribute must <a href=#reflect id=the-form-element:reflect-2>reflect</a>
- the content attribute of the same name.</p>
- <p>The <dfn id=dom-form-acceptcharset><code>acceptCharset</code></dfn> IDL attribute must
- <a href=#reflect id=the-form-element:reflect-3>reflect</a> the <code id=the-form-element:attr-form-accept-charset-2><a href=#attr-form-accept-charset>accept-charset</a></code> content
- attribute.</p>
- <hr>
- <p>The <dfn id=dom-form-elements><code>elements</code></dfn> IDL attribute must return an
- <code id=the-form-element:htmlformcontrolscollection-2-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> rooted at the <code id=the-form-element:the-form-element-6><a href=#the-form-element>form</a></code> element's <a href=#home-subtree id=the-form-element:home-subtree>home
- subtree</a>'s <a href=#root-element id=the-form-element:root-element>root element</a>, whose filter matches <a href=#category-listed id=the-form-element:category-listed>listed elements</a> whose <a href=#form-owner id=the-form-element:form-owner>form owner</a> is the
- <code id=the-form-element:the-form-element-7><a href=#the-form-element>form</a></code> element, with the exception of <code id=the-form-element:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=the-form-element:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="the-form-element:image-button-state-(type=image)">Image Button</a> state, which must, for historical reasons, be
- excluded from this particular collection.</p>
- <p>The <dfn id=dom-form-length><code>length</code></dfn> IDL attribute must return the number
- of nodes <a href=#represented-by-the-collection id=the-form-element:represented-by-the-collection>represented</a> by the <code id=the-form-element:dom-form-elements-3><a href=#dom-form-elements>elements</a></code> collection.</p>
- <p>The <a href=#supported-property-indices id=the-form-element:supported-property-indices>supported property indices</a> at any instant are the indices supported by the
- object returned by the <code id=the-form-element:dom-form-elements-4><a href=#dom-form-elements>elements</a></code> attribute at that
- instant.</p>
- <p>When a <code id=the-form-element:the-form-element-8><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-item>indexed for indexed property
- retrieval</dfn>, the user agent must return the value returned by the <code id=the-form-element:dom-htmlcollection-item><a href=#dom-htmlcollection-item>item</a></code> method on the <code id=the-form-element:dom-form-elements-5><a href=#dom-form-elements>elements</a></code> collection, when invoked with the given index as its
- argument.</p>
- <hr>
-
- <p>Each <code id=the-form-element:the-form-element-9><a href=#the-form-element>form</a></code> element has a mapping of names to elements called the <dfn id=past-names-map>past names
- map</dfn>. It is used to persist names of controls even when they change names.</p>
- <p>The <a href=#supported-property-names id=the-form-element:supported-property-names>supported property names</a> consist of the names obtained from the following
- algorithm, in the order obtained from this algorithm:</p>
- <ol><li><p>Let <var>sourced names</var> be an initially empty ordered list of tuples
- consisting of a string, an element, a source, where the source is either <i>id</i>, <i>name</i>,
- or <i>past</i>, and, if the source is <i>past</i>, an age.<li>
- <p>For each <a href=#category-listed id=the-form-element:category-listed-2>listed element</a> <var>candidate</var>
- whose <a href=#form-owner id=the-form-element:form-owner-2>form owner</a> is the <code id=the-form-element:the-form-element-10><a href=#the-form-element>form</a></code> element, with the exception of any
- <code id=the-form-element:the-input-element-2><a href=#the-input-element>input</a></code> elements whose <code id=the-form-element:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the
- <a href="#image-button-state-(type=image)" id="the-form-element:image-button-state-(type=image)-2">Image Button</a> state, run these substeps:</p>
- <ol><li><p>If <var>candidate</var> has an <code id=the-form-element:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute, add
- an entry to <var>sourced names</var> with that <code id=the-form-element:the-id-attribute-2><a href=#the-id-attribute>id</a></code>
- attribute's value as the string, <var>candidate</var> as the element, and <i>id</i> as
- the source.<li><p>If <var>candidate</var> has a <code id=the-form-element:attr-fe-name-3><a href=#attr-fe-name>name</a></code> attribute,
- add an entry to <var>sourced names</var> with that <code id=the-form-element:attr-fe-name-4><a href=#attr-fe-name>name</a></code> attribute's value as the string, <var>candidate</var>
- as the element, and <i>name</i> as the source.</ol>
- <li>
- <p>For each <code id=the-form-element:the-img-element-2><a href=#the-img-element>img</a></code> element <var>candidate</var> whose <a href=#form-owner id=the-form-element:form-owner-3>form owner</a>
- is the <code id=the-form-element:the-form-element-11><a href=#the-form-element>form</a></code> element, run these substeps:</p>
- <ol><li><p>If <var>candidate</var> has an <code id=the-form-element:the-id-attribute-3><a href=#the-id-attribute>id</a></code> attribute, add
- an entry to <var>sourced names</var> with that <code id=the-form-element:the-id-attribute-4><a href=#the-id-attribute>id</a></code>
- attribute's value as the string, <var>candidate</var> as the element, and <i>id</i> as
- the source.<li><p>If <var>candidate</var> has a <code id=the-form-element:attr-img-name><a href=#attr-img-name>name</a></code> attribute,
- add an entry to <var>sourced names</var> with that <code id=the-form-element:attr-img-name-2><a href=#attr-img-name>name</a></code> attribute's value as the string, <var>candidate</var>
- as the element, and <i>name</i> as the source.</ol>
- <li>
- <p>For each entry <var>past entry</var> in the <a href=#past-names-map id=the-form-element:past-names-map>past names map</a> add an entry
- to <var>sourced names</var> with the <var>past entry</var>'s name as the
- string, <var>past entry</var>'s element as the element, <i>past</i> as the source, and
- the length of time <var>past entry</var> has been in the <a href=#past-names-map id=the-form-element:past-names-map-2>past names map</a> as
- the age.</p>
- <li><p>Sort <var>sourced names</var> by <a href=#tree-order id=the-form-element:tree-order>tree order</a> of the element entry of
- each tuple, sorting entries with the same element by putting entries whose source is <i>id</i>
- first, then entries whose source is <i>name</i>, and finally entries whose source is <i>past</i>,
- and sorting entries with the same element and source by their age, oldest first.<li><p>Remove any entries in <var>sourced names</var> that have the empty string as
- their name.<li><p>Remove any entries in <var>sourced names</var> that have the same name as an
- earlier entry in the map.<li><p>Return the list of names from <var>sourced names</var>, maintaining their
- relative order.</ol>
- <p>The properties exposed in this way must be <a href=#unenumerable id=the-form-element:unenumerable>unenumerable</a>.</p>
- <p>When a <code id=the-form-element:the-form-element-12><a href=#the-form-element>form</a></code> element is <dfn id=dom-form-nameditem>indexed for named property
- retrieval</dfn>, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>candidates</var> be a <a href=#live id=the-form-element:live>live</a> <code id=the-form-element:radionodelist-4><a href=#radionodelist>RadioNodeList</a></code>
- object containing all the <a href=#category-listed id=the-form-element:category-listed-3>listed elements</a> whose <a href=#form-owner id=the-form-element:form-owner-4>form
- owner</a> is the <code id=the-form-element:the-form-element-13><a href=#the-form-element>form</a></code> element that have either an <code id=the-form-element:the-id-attribute-5><a href=#the-id-attribute>id</a></code>
- attribute or a <code id=the-form-element:attr-fe-name-5><a href=#attr-fe-name>name</a></code> attribute equal to <var>name</var>, with the exception of <code id=the-form-element:the-input-element-3><a href=#the-input-element>input</a></code> elements whose <code id=the-form-element:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="the-form-element:image-button-state-(type=image)-3">Image
- Button</a> state, in <a href=#tree-order id=the-form-element:tree-order-2>tree order</a>.<li><p>If <var>candidates</var> is empty, let <var>candidates</var> be a
- <a href=#live id=the-form-element:live-2>live</a> <code id=the-form-element:radionodelist-5><a href=#radionodelist>RadioNodeList</a></code> object containing all the <code id=the-form-element:the-img-element-3><a href=#the-img-element>img</a></code> elements
- that are descendants of the <code id=the-form-element:the-form-element-14><a href=#the-form-element>form</a></code> element and that have either an <code id=the-form-element:the-id-attribute-6><a href=#the-id-attribute>id</a></code> attribute or a <code id=the-form-element:attr-img-name-3><a href=#attr-img-name>name</a></code> attribute equal
- to <var>name</var>, in <a href=#tree-order id=the-form-element:tree-order-3>tree order</a>.<li><p>If <var>candidates</var> is empty, <var>name</var> is the name of one of
- the entries in the <code id=the-form-element:the-form-element-15><a href=#the-form-element>form</a></code> element's <a href=#past-names-map id=the-form-element:past-names-map-3>past names map</a>: return the object
- associated with <var>name</var> in that map.<li><p>If <var>candidates</var> contains more than one node, return <var>candidates</var> and abort these steps.<li><p>Otherwise, <var>candidates</var> contains exactly one node. Add a mapping from
- <var>name</var> to the node in <var>candidates</var> in the <code id=the-form-element:the-form-element-16><a href=#the-form-element>form</a></code>
- element's <a href=#past-names-map id=the-form-element:past-names-map-4>past names map</a>, replacing the previous entry with the same name, if
- any.<li><p>Return the node in <var>candidates</var>.</ol>
- <p>If an element listed in a <code id=the-form-element:the-form-element-17><a href=#the-form-element>form</a></code> element's <a href=#past-names-map id=the-form-element:past-names-map-5>past names map</a> changes
- <a href=#form-owner id=the-form-element:form-owner-5>form owner</a>, then its entries must be removed from that map.</p>
-
-
- <hr>
- <p>The <dfn id=dom-form-submit><code>submit()</code></dfn> method, when invoked, must <a href=#concept-form-submit id=the-form-element:concept-form-submit>submit</a> the <code id=the-form-element:the-form-element-18><a href=#the-form-element>form</a></code> element from the <code id=the-form-element:the-form-element-19><a href=#the-form-element>form</a></code>
- element itself, with the <var>submitted from <code id=the-form-element:dom-form-submit-3><a href=#dom-form-submit>submit()</a></code> method</var> flag set.</p>
- <p>The <dfn id=dom-form-reset><code>reset()</code></dfn> method, when invoked, must run the
- following steps:</p>
- <ol><li><p>If the <code id=the-form-element:the-form-element-20><a href=#the-form-element>form</a></code> element is marked as <i id=the-form-element:locked-for-reset><a href=#locked-for-reset>locked for reset</a></i>, then abort these
- steps.<li><p>Mark the <code id=the-form-element:the-form-element-21><a href=#the-form-element>form</a></code> element as <dfn id=locked-for-reset>locked for reset</dfn>.<li><p><a href=#concept-form-reset id=the-form-element:concept-form-reset>Reset</a> the <code id=the-form-element:the-form-element-22><a href=#the-form-element>form</a></code> element.<li><p>Unmark the <code id=the-form-element:the-form-element-23><a href=#the-form-element>form</a></code> element as <i id=the-form-element:locked-for-reset-2><a href=#locked-for-reset>locked for reset</a></i>.</ol>
- <p>If the <dfn id=dom-form-checkvalidity><code>checkValidity()</code></dfn> method is
- invoked, the user agent must <a href=#statically-validate-the-constraints id=the-form-element:statically-validate-the-constraints>statically validate the constraints</a> of the
- <code id=the-form-element:the-form-element-24><a href=#the-form-element>form</a></code> element, and return true if the constraint validation return a <i>positive</i>
- result, and false if it returned a <i>negative</i> result.</p>
- <p>If the <dfn id=dom-form-reportvalidity><code>reportValidity()</code></dfn> method is
- invoked, the user agent must <a href=#interactively-validate-the-constraints id=the-form-element:interactively-validate-the-constraints>interactively validate the constraints</a> of the
- <code id=the-form-element:the-form-element-25><a href=#the-form-element>form</a></code> element, and return true if the constraint validation return a <i>positive</i>
- result, and false if it returned a <i>negative</i> result.</p>
-
- <div class=example>
- <p>This example shows two search forms:</p>
- <pre><form action="http://www.google.com/search" method="get">
- <label>Google: <input type="search" name="q"></label> <input type="submit" value="Search...">
- </form>
- <form action="http://www.bing.com/search" method="get">
- <label>Bing: <input type="search" name="q"></label> <input type="submit" value="Search...">
- </form></pre>
- </div>
- <h4 id=the-label-element>4.10.4 The <dfn><code>label</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-label-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-label-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-label-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-label-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-form-attr id=the-label-element:category-form-attr>Reassociateable</a> <a href=#form-associated-element id=the-label-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-label-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-label-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-label-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-label-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-label-element:phrasing-content-2-3>Phrasing content</a>, but with no descendant <a href=#category-label id=the-label-element:category-label>labelable elements</a> unless it is the element's <a href=#labeled-control id=the-label-element:labeled-control>labeled control</a>, and no descendant <code id=the-label-element:the-label-element><a href=#the-label-element>label</a></code> elements.<dt><a href=#concept-element-tag-omission id=the-label-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-label-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-label-element:global-attributes>Global attributes</a><dd><code id=the-label-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-label-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-label-element:attr-label-for><a href=#attr-label-for>for</a></code> — Associate the label with form control<dt><a href=#concept-element-dom id=the-label-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmllabelelement>HTMLLabelElement</dfn> : <a href=#htmlelement id=the-label-element:htmlelement>HTMLElement</a> {
- readonly attribute <a href=#htmlformelement id=the-label-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-label-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-label-htmlfor id=the-label-element:dom-label-htmlfor>htmlFor</a>;
- readonly attribute <a href=#htmlelement id=the-label-element:htmlelement-2>HTMLElement</a>? <a href=#dom-label-control id=the-label-element:dom-label-control>control</a>;
- };</pre>
- </dl>
- <p>The <code id=the-label-element:the-label-element-2><a href=#the-label-element>label</a></code> element <a href=#represents id=the-label-element:represents>represents</a> a caption in a user interface. The
- caption can be associated with a specific form control, known as the
- <code id=the-label-element:the-label-element-3><a href=#the-label-element>label</a></code> element's <dfn id=labeled-control>labeled control</dfn>, either using the <code id=the-label-element:attr-label-for-2><a href=#attr-label-for>for</a></code> attribute, or by putting the form control inside the
- <code id=the-label-element:the-label-element-4><a href=#the-label-element>label</a></code> element itself.</p>
-
- <p>Except where otherwise specified by the following rules, a <code id=the-label-element:the-label-element-5><a href=#the-label-element>label</a></code> element has no
- <a href=#labeled-control id=the-label-element:labeled-control-2>labeled control</a>.</p>
-
- <p>The <dfn id=attr-label-for><code>for</code></dfn> attribute may be specified to indicate a
- form control with which the caption is to be associated. If the attribute is specified, the
- attribute's value must be the <a href=#concept-id id=the-label-element:concept-id>ID</a> of a <a href=#category-label id=the-label-element:category-label-2>labelable element</a> in the same <code id=the-label-element:document><a href=#document>Document</a></code> as the
- <code id=the-label-element:the-label-element-6><a href=#the-label-element>label</a></code> element. If the attribute is specified and there is an
- element in the <code id=the-label-element:document-2><a href=#document>Document</a></code> whose <a href=#concept-id id=the-label-element:concept-id-2>ID</a> is equal to the
- value of the <code id=the-label-element:attr-label-for-3><a href=#attr-label-for>for</a></code> attribute, and the first such element is a
- <a href=#category-label id=the-label-element:category-label-3>labelable element</a>, then that element is the <code id=the-label-element:the-label-element-7><a href=#the-label-element>label</a></code>
- element's <a href=#labeled-control id=the-label-element:labeled-control-3>labeled control</a>.</p>
-
- <p>If the <code id=the-label-element:attr-label-for-4><a href=#attr-label-for>for</a></code> attribute is not specified, but the
- <code id=the-label-element:the-label-element-8><a href=#the-label-element>label</a></code> element has a <a href=#category-label id=the-label-element:category-label-4>labelable element</a> descendant,
- then the first such descendant in <a href=#tree-order id=the-label-element:tree-order>tree order</a> is the <code id=the-label-element:the-label-element-9><a href=#the-label-element>label</a></code> element's
- <a href=#labeled-control id=the-label-element:labeled-control-4>labeled control</a>.</p>
- <p>The <code id=the-label-element:the-label-element-10><a href=#the-label-element>label</a></code> element's exact default presentation and behavior, in particular what
- its <a href=#activation-behavior id=the-label-element:activation-behavior>activation behavior</a> might be, if anything, should match the platform's label
- behavior. The <a href=#activation-behavior id=the-label-element:activation-behavior-2>activation behavior</a> of a <code id=the-label-element:the-label-element-11><a href=#the-label-element>label</a></code> element for events targeted
- at <a href=#interactive-content-2 id=the-label-element:interactive-content-2-2>interactive content</a> descendants of a <code id=the-label-element:the-label-element-12><a href=#the-label-element>label</a></code> element, and any
- descendants of those <a href=#interactive-content-2 id=the-label-element:interactive-content-2-3>interactive content</a> descendants, must be to do nothing.</p>
-
- <div class=example>
- <p>For example, on platforms where clicking a checkbox label checks the checkbox, clicking the
- <code id=the-label-element:the-label-element-13><a href=#the-label-element>label</a></code> in the following snippet could trigger the user agent to <a href=#run-synthetic-click-activation-steps id=the-label-element:run-synthetic-click-activation-steps>run synthetic
- click activation steps</a> on the <code id=the-label-element:the-input-element><a href=#the-input-element>input</a></code> element, as if the element itself had
- been triggered by the user:</p>
- <pre><label><input type=checkbox name=lost> Lost</label></pre>
- <p>On other platforms, the behavior might be just to focus the control, or do nothing.</p>
- </div>
-
- <p>The <code id=the-label-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-label-element:the-label-element-14><a href=#the-label-element>label</a></code> element with its <a href=#form-owner id=the-label-element:form-owner>form owner</a>.</p>
- <div class=example>
- <p>The following example shows three form controls each with a label, two of which have small
- text showing the right format for users to use.</p>
- <pre><p><label>Full name: <input name=fn> <small>Format: First Last</small></label></p>
- <p><label>Age: <input name=age type=number min=0></label></p>
- <p><label>Post code: <input name=pc> <small>Format: AB12 3CD</small></label></p></pre>
- </div>
- <dl class=domintro><dt><var>label</var> . <code id=the-label-element:dom-label-control-2><a href=#dom-label-control>control</a></code><dd>
- <p>Returns the form control that is associated with this element.</p>
- </dl>
-
- <p>The <dfn id=dom-label-htmlfor><code>htmlFor</code></dfn> IDL attribute must
- <a href=#reflect id=the-label-element:reflect>reflect</a> the <code id=the-label-element:attr-label-for-5><a href=#attr-label-for>for</a></code> content attribute.</p>
- <p>The <dfn id=dom-label-control><code>control</code></dfn> IDL attribute must return the
- <code id=the-label-element:the-label-element-15><a href=#the-label-element>label</a></code> element's <a href=#labeled-control id=the-label-element:labeled-control-5>labeled control</a>, if any, or null if there isn't one.</p>
- <p>The <code id=the-label-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code> IDL attribute is part of the element's forms
- API.</p>
-
- <hr>
- <dl class=domintro><dt><var>control</var> . <code id=the-label-element:dom-lfe-labels><a href=#dom-lfe-labels>labels</a></code><dd>
- <p>Returns a <code id=the-label-element:nodelist><a href=#nodelist>NodeList</a></code> of all the <code id=the-label-element:the-label-element-16><a href=#the-label-element>label</a></code> elements that the form control
- is associated with.</p>
- </dl>
-
- <p><a href=#category-label id=the-label-element:category-label-5>Labelable elements</a> have a <code id=the-label-element:nodelist-2><a href=#nodelist>NodeList</a></code> object
- associated with them that represents the list of <code id=the-label-element:the-label-element-17><a href=#the-label-element>label</a></code> elements, in <a href=#tree-order id=the-label-element:tree-order-2>tree
- order</a>, whose <a href=#labeled-control id=the-label-element:labeled-control-6>labeled control</a> is the element in question. The <dfn id=dom-lfe-labels><code>labels</code></dfn> IDL attribute of <a href=#category-label id=the-label-element:category-label-6>labelable elements</a>, on getting, must return that
- <code id=the-label-element:nodelist-3><a href=#nodelist>NodeList</a></code> object.</p>
-
- <h4 id=the-input-element>4.10.5 The <dfn><code>input</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-input-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-input-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-input-element:phrasing-content-2>Phrasing content</a>.<dd>If the <code id=the-input-element:attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)">Hidden</a> state: <a href=#interactive-content-2 id=the-input-element:interactive-content-2>Interactive content</a>.<dd>If the <code id=the-input-element:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-2">Hidden</a> state: <a href=#category-listed id=the-input-element:category-listed>Listed</a>, <a href=#category-label id=the-input-element:category-label>labelable</a>, <a href=#category-submit id=the-input-element:category-submit>submittable</a>, <a href=#category-reset id=the-input-element:category-reset>resettable</a>, and <a href=#category-form-attr id=the-input-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-input-element:form-associated-element>form-associated element</a>.<dd>If the <code id=the-input-element:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-3">Hidden</a> state: <a href=#category-listed id=the-input-element:category-listed-2>Listed</a>, <a href=#category-submit id=the-input-element:category-submit-2>submittable</a>, <a href=#category-reset id=the-input-element:category-reset-2>resettable</a>, and <a href=#category-form-attr id=the-input-element:category-form-attr-2>reassociateable</a> <a href=#form-associated-element id=the-input-element:form-associated-element-2>form-associated element</a>.<dd>If the <code id=the-input-element:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-4">Hidden</a> state: <a href=#palpable-content-2 id=the-input-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-input-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-input-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-input-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-input-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-input-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-input-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-input-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-input-element:global-attributes>Global attributes</a><dd><code id=the-input-element:attr-input-accept><a href=#attr-input-accept>accept</a></code> — Hint for expected file type in <a href="#file-upload-state-(type=file)" id="the-input-element:file-upload-state-(type=file)">file upload controls</a><dd><code id=the-input-element:attr-input-alt><a href=#attr-input-alt>alt</a></code> — Replacement text for use when images are not available<dd><code id=the-input-element:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> — Hint for form autofill feature<dd><code id=the-input-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> — Automatically focus the form control when the page is loaded<dd><code id=the-input-element:attr-input-checked><a href=#attr-input-checked>checked</a></code> — Whether the command or control is checked<dd><code id=the-input-element:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> — Name of form field to use for sending the element's <a href=#the-directionality id=the-input-element:the-directionality>directionality</a> in <a href=#form-submission-2 id=the-input-element:form-submission-2>form submission</a><dd><code id=the-input-element:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-input-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-input-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-input-element:attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> — <a href=#url id=the-input-element:url>URL</a> to use for <a href=#form-submission-2 id=the-input-element:form-submission-2-2>form submission</a><dd><code id=the-input-element:attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> — Form data set encoding type to use for <a href=#form-submission-2 id=the-input-element:form-submission-2-3>form submission</a><dd><code id=the-input-element:attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> — HTTP method to use for <a href=#form-submission-2 id=the-input-element:form-submission-2-4>form submission</a><dd><code id=the-input-element:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> — Bypass form control validation for <a href=#form-submission-2 id=the-input-element:form-submission-2-5>form submission</a><dd><code id=the-input-element:attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> — <a href=#browsing-context id=the-input-element:browsing-context>Browsing context</a> for <a href=#form-submission-2 id=the-input-element:form-submission-2-6>form submission</a><dd><code id=the-input-element:attr-dim-height><a href=#attr-dim-height>height</a></code> — Vertical dimension<dd><code id=the-input-element:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> — Hint for selecting an input modality<dd><code id=the-input-element:attr-input-list><a href=#attr-input-list>list</a></code> — List of autocomplete options<dd><code id=the-input-element:attr-input-max><a href=#attr-input-max>max</a></code> — Maximum value<dd><code id=the-input-element:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> — Maximum length of value<dd><code id=the-input-element:attr-input-min><a href=#attr-input-min>min</a></code> — Minimum value<dd><code id=the-input-element:attr-input-minlength><a href=#attr-input-minlength>minlength</a></code> — Minimum length of value<dd><code id=the-input-element:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> — Whether to allow multiple values<dd><code id=the-input-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use for <a href=#form-submission-2 id=the-input-element:form-submission-2-7>form submission</a> and in the <code id=the-input-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dd><code id=the-input-element:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> — Pattern to be matched by the form control's value<dd><code id=the-input-element:attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> — User-visible label to be placed within the form control<dd><code id=the-input-element:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> — Whether to allow the value to be edited by the user<dd><code id=the-input-element:attr-input-required><a href=#attr-input-required>required</a></code> — Whether the control is required for <a href=#form-submission-2 id=the-input-element:form-submission-2-8>form submission</a><dd><code id=the-input-element:attr-input-size><a href=#attr-input-size>size</a></code> — Size of the control<dd><code id=the-input-element:attr-input-src><a href=#attr-input-src>src</a></code> — Address of the resource<dd><code id=the-input-element:attr-input-step><a href=#attr-input-step>step</a></code> — Granularity to be matched by the form control's value<dd><code id=the-input-element:attr-input-type-5><a href=#attr-input-type>type</a></code> — Type of form control<dd><code id=the-input-element:attr-input-value><a href=#attr-input-value>value</a></code> — Value of the form control<dd><code id=the-input-element:attr-dim-width><a href=#attr-dim-width>width</a></code> — Horizontal dimension<dd>Also, the <code id=the-input-element:attr-input-title><a href=#attr-input-title>title</a></code> attribute <a href=#attr-input-title id=the-input-element:attr-input-title-2>has special semantics</a> on this element: Description of pattern (when used with <code id=the-input-element:attr-input-pattern-2><a href=#attr-input-pattern>pattern</a></code> attribute).<dt><a href=#concept-element-dom id=the-input-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlinputelement>HTMLInputElement</dfn> : <a href=#htmlelement id=the-input-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-input-accept id=the-input-element:dom-input-accept>accept</a>;
- attribute DOMString <a href=#dom-input-alt id=the-input-element:dom-input-alt>alt</a>;
- attribute DOMString <a href=#dom-fe-autocomplete id=the-input-element:dom-fe-autocomplete>autocomplete</a>;
- attribute boolean <a href=#dom-fe-autofocus id=the-input-element:dom-fe-autofocus>autofocus</a>;
- attribute boolean <a href=#dom-input-defaultchecked id=the-input-element:dom-input-defaultchecked>defaultChecked</a>;
- attribute boolean <a href=#dom-input-checked id=the-input-element:dom-input-checked>checked</a>;
- attribute DOMString <a href=#dom-input-dirname id=the-input-element:dom-input-dirname>dirName</a>;
- attribute boolean <a href=#dom-fe-disabled id=the-input-element:dom-fe-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-input-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-input-element:dom-fae-form>form</a>;
- readonly attribute <a href=#filelist id=the-input-element:filelist>FileList</a>? <a href=#dom-input-files id=the-input-element:dom-input-files>files</a>;
- attribute DOMString <a href=#dom-fs-formaction id=the-input-element:dom-fs-formaction>formAction</a>;
- attribute DOMString <a href=#dom-fs-formenctype id=the-input-element:dom-fs-formenctype>formEnctype</a>;
- attribute DOMString <a href=#dom-fs-formmethod id=the-input-element:dom-fs-formmethod>formMethod</a>;
- attribute boolean <a href=#dom-fs-formnovalidate id=the-input-element:dom-fs-formnovalidate>formNoValidate</a>;
- attribute DOMString <a href=#dom-fs-formtarget id=the-input-element:dom-fs-formtarget>formTarget</a>;
- attribute unsigned long <a href=#dom-input-height id=the-input-element:dom-input-height>height</a>;
- attribute boolean <a href=#dom-input-indeterminate id=the-input-element:dom-input-indeterminate>indeterminate</a>;
- attribute DOMString <a href=#dom-input-inputmode id=the-input-element:dom-input-inputmode>inputMode</a>;
- readonly attribute <a href=#htmlelement id=the-input-element:htmlelement-2>HTMLElement</a>? <a href=#dom-input-list id=the-input-element:dom-input-list>list</a>;
- attribute DOMString <a href=#dom-input-max id=the-input-element:dom-input-max>max</a>;
- attribute long <a href=#dom-input-maxlength id=the-input-element:dom-input-maxlength>maxLength</a>;
- attribute DOMString <a href=#dom-input-min id=the-input-element:dom-input-min>min</a>;
- attribute long <a href=#dom-input-minlength id=the-input-element:dom-input-minlength>minLength</a>;
- attribute boolean <a href=#dom-input-multiple id=the-input-element:dom-input-multiple>multiple</a>;
- attribute DOMString <a href=#dom-fe-name id=the-input-element:dom-fe-name>name</a>;
- attribute DOMString <a href=#dom-input-pattern id=the-input-element:dom-input-pattern>pattern</a>;
- attribute DOMString <a href=#dom-input-placeholder id=the-input-element:dom-input-placeholder>placeholder</a>;
- attribute boolean <a href=#dom-input-readonly id=the-input-element:dom-input-readonly>readOnly</a>;
- attribute boolean <a href=#dom-input-required id=the-input-element:dom-input-required>required</a>;
- attribute unsigned long <a href=#dom-input-size id=the-input-element:dom-input-size>size</a>;
- attribute DOMString <a href=#dom-input-src id=the-input-element:dom-input-src>src</a>;
- attribute DOMString <a href=#dom-input-step id=the-input-element:dom-input-step>step</a>;
- attribute DOMString <a href=#dom-input-type id=the-input-element:dom-input-type>type</a>;
- attribute DOMString <a href=#dom-input-defaultvalue id=the-input-element:dom-input-defaultvalue>defaultValue</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-input-value id=the-input-element:dom-input-value>value</a>;
- attribute <a href=#idl-date id=the-input-element:idl-date>Date</a>? <a href=#dom-input-valueasdate id=the-input-element:dom-input-valueasdate>valueAsDate</a>;
- attribute unrestricted double <a href=#dom-input-valueasnumber id=the-input-element:dom-input-valueasnumber>valueAsNumber</a>;
- attribute double <a href=#dom-input-valuelow id=the-input-element:dom-input-valuelow>valueLow</a>;
- attribute double <a href=#dom-input-valuehigh id=the-input-element:dom-input-valuehigh>valueHigh</a>;
- attribute unsigned long <a href=#dom-input-width id=the-input-element:dom-input-width>width</a>;
- void <a href=#dom-input-stepup id=the-input-element:dom-input-stepup>stepUp</a>(optional long n = 1);
- void <a href=#dom-input-stepdown id=the-input-element:dom-input-stepdown>stepDown</a>(optional long n = 1);
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-input-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-input-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-input-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-input-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-input-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-input-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-input-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-input-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-input-element:dom-lfe-labels>labels</a>;
- void <a href=#dom-textarea/input-select id=the-input-element:dom-textarea/input-select>select</a>();
- attribute unsigned long <a href=#dom-textarea/input-selectionstart id=the-input-element:dom-textarea/input-selectionstart>selectionStart</a>;
- attribute unsigned long <a href=#dom-textarea/input-selectionend id=the-input-element:dom-textarea/input-selectionend>selectionEnd</a>;
- attribute DOMString <a href=#dom-textarea/input-selectiondirection id=the-input-element:dom-textarea/input-selectiondirection>selectionDirection</a>;
- void <a href=#dom-textarea/input-setrangetext id=the-input-element:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
- void <a href=#dom-textarea/input-setrangetext id=the-input-element:dom-textarea/input-setrangetext-2>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode id=the-input-element:selectionmode>SelectionMode</a> selectionMode = "preserve");
- void <a href=#dom-textarea/input-setselectionrange id=the-input-element:dom-textarea/input-setselectionrange>setSelectionRange</a>(unsigned long start, unsigned long end, optional DOMString direction);
- // <a href="#HTMLInputElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-input-element:the-input-element><a href=#the-input-element>input</a></code> element <a href=#represents id=the-input-element:represents>represents</a> a typed data field, usually with a form
- control to allow the user to edit the data.</p>
- <p>The <dfn id=attr-input-type><code>type</code></dfn> attribute controls the data type (and
- associated control) of the element. It is an <a href=#enumerated-attribute id=the-input-element:enumerated-attribute>enumerated attribute</a>. The following
- table lists the keywords and states for the attribute — the keywords in the left column map
- to the states in the cell in the second column on the same row as the keyword.</p>
- <table id=attr-input-type-keywords><thead><tr><th> Keyword
- <th> State
- <th> Data type
- <th> Control type
- <tbody><tr><td> <dfn id=attr-input-type-hidden-keyword><code>hidden</code></dfn>
- <td> <a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-5">Hidden</a>
- <td> An arbitrary string
- <td> n/a
- <tr><td> <dfn id=attr-input-type-text-keyword><code>text</code></dfn>
- <td> <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element:text-(type=text)-state-and-search-state-(type=search)">Text</a>
- <td> Text with no line breaks
- <td> A text field
- <tr><td> <dfn id=attr-input-type-search-keyword><code>search</code></dfn>
- <td> <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>
- <td> Text with no line breaks
- <td> Search field
- <tr><td> <dfn id=attr-input-type-tel-keyword><code>tel</code></dfn>
- <td> <a href="#telephone-state-(type=tel)" id="the-input-element:telephone-state-(type=tel)">Telephone</a>
- <td> Text with no line breaks
- <td> A text field
- <tr><td> <dfn id=attr-input-type-url-keyword><code>url</code></dfn>
- <td> <a href="#url-state-(type=url)" id="the-input-element:url-state-(type=url)">URL</a>
- <td> An absolute URL
- <td> A text field
- <tr><td> <dfn id=attr-input-type-email-keyword><code>email</code></dfn>
- <td> <a href="#e-mail-state-(type=email)" id="the-input-element:e-mail-state-(type=email)">E-mail</a>
- <td> An e-mail address or list of e-mail addresses
- <td> A text field
- <tr><td> <dfn id=attr-input-type-password-keyword><code>password</code></dfn>
- <td> <a href="#password-state-(type=password)" id="the-input-element:password-state-(type=password)">Password</a>
- <td> Text with no line breaks (sensitive information)
- <td> A text field that obscures data entry
- <tr><td> <dfn id=attr-input-type-datetime-keyword><code>datetime</code></dfn>
- <td> <a href="#date-and-time-state-(type=datetime)" id="the-input-element:date-and-time-state-(type=datetime)">Date and Time</a>
- <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with the time zone set to UTC
- <td> A date and time control
- <tr><td> <dfn id=attr-input-type-date-keyword><code>date</code></dfn>
- <td> <a href="#date-state-(type=date)" id="the-input-element:date-state-(type=date)">Date</a>
- <td> A date (year, month, day) with no time zone
- <td> A date control
- <tr><td> <dfn id=attr-input-type-month-keyword><code>month</code></dfn>
- <td> <a href="#month-state-(type=month)" id="the-input-element:month-state-(type=month)">Month</a>
- <td> A date consisting of a year and a month with no time zone
- <td> A month control
- <tr><td> <dfn id=attr-input-type-week-keyword><code>week</code></dfn>
- <td> <a href="#week-state-(type=week)" id="the-input-element:week-state-(type=week)">Week</a>
- <td> A date consisting of a week-year number and a week number with no time zone
- <td> A week control
- <tr><td> <dfn id=attr-input-type-time-keyword><code>time</code></dfn>
- <td> <a href="#time-state-(type=time)" id="the-input-element:time-state-(type=time)">Time</a>
- <td> A time (hour, minute, seconds, fractional seconds) with no time zone
- <td> A time control
- <tr><td> <dfn id=attr-input-type-datetime-local-keyword><code>datetime-local</code></dfn>
- <td> <a href="#local-date-and-time-state-(type=datetime-local)" id="the-input-element:local-date-and-time-state-(type=datetime-local)">Local Date and Time</a>
- <td> A date and time (year, month, day, hour, minute, second, fraction of a second) with no time zone
- <td> A date and time control
- <tr><td> <dfn id=attr-input-type-number-keyword><code>number</code></dfn>
- <td> <a href="#number-state-(type=number)" id="the-input-element:number-state-(type=number)">Number</a>
- <td> A numerical value
- <td> A text field or spinner control
- <tr><td> <dfn id=attr-input-type-range-keyword><code>range</code></dfn>
- <td> <a href="#range-state-(type=range)" id="the-input-element:range-state-(type=range)">Range</a>
- <td> A numerical value, with the extra semantic that the exact value is not important
- <td> A slider control or similar
- <tr><td> <dfn id=attr-input-type-color-keyword><code>color</code></dfn>
- <td> <a href="#colour-state-(type=color)" id="the-input-element:colour-state-(type=color)">Colour</a>
- <td> An sRGB colour with 8-bit red, green, and blue components
- <td> A colour well
- <tr><td> <dfn id=attr-input-type-checkbox-keyword><code>checkbox</code></dfn>
- <td> <a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)">Checkbox</a>
- <td> A set of zero or more values from a predefined list
- <td> A checkbox
- <tr><td> <dfn id=attr-input-type-radio-keyword><code>radio</code></dfn>
- <td> <a href="#radio-button-state-(type=radio)" id="the-input-element:radio-button-state-(type=radio)">Radio Button</a>
- <td> An enumerated value
- <td> A radio button
- <tr><td> <dfn id=attr-input-type-file-keyword><code>file</code></dfn>
- <td> <a href="#file-upload-state-(type=file)" id="the-input-element:file-upload-state-(type=file)-2">File Upload</a>
- <td> Zero or more files each with a <a href=#mime-type id=the-input-element:mime-type>MIME type</a> and optionally a file name
- <td> A label and a button
- <tr><td> <dfn id=attr-input-type-submit-keyword><code>submit</code></dfn>
- <td> <a href="#submit-button-state-(type=submit)" id="the-input-element:submit-button-state-(type=submit)">Submit Button</a>
- <td> An enumerated value, with the extra semantic that it must be the last value selected and initiates form submission
- <td> A button
- <tr><td> <dfn id=attr-input-type-image-keyword><code>image</code></dfn>
- <td> <a href="#image-button-state-(type=image)" id="the-input-element:image-button-state-(type=image)">Image Button</a>
- <td> A coordinate, relative to a particular image's size, with the extra semantic that it must
- be the last value selected and initiates form submission
- <td> Either a clickable image, or a button
- <tr><td> <dfn id=attr-input-type-reset-keyword><code>reset</code></dfn>
- <td> <a href="#reset-button-state-(type=reset)" id="the-input-element:reset-button-state-(type=reset)">Reset Button</a>
- <td> n/a
- <td> A button
- <tr><td> <dfn id=attr-input-type-button-keyword><code>button</code></dfn>
- <td> <a href="#button-state-(type=button)" id="the-input-element:button-state-(type=button)">Button</a>
- <td> n/a
- <td> A button
- </table>
- <p>The <i id=the-input-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element:text-(type=text)-state-and-search-state-(type=search)-3">Text</a>
- state.</p>
- <p>Which of the
- <code id=the-input-element:attr-input-accept-2><a href=#attr-input-accept>accept</a></code>,
- <code id=the-input-element:attr-input-alt-2><a href=#attr-input-alt>alt</a></code>,
- <code id=the-input-element:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id=the-input-element:attr-input-checked-2><a href=#attr-input-checked>checked</a></code>,
- <code id=the-input-element:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code>,
- <code id=the-input-element:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code>,
- <code id=the-input-element:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id=the-input-element:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id=the-input-element:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id=the-input-element:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id=the-input-element:attr-dim-height-2><a href=#attr-dim-height>height</a></code>,
- <code id=the-input-element:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id=the-input-element:attr-input-list-2><a href=#attr-input-list>list</a></code>,
- <code id=the-input-element:attr-input-max-2><a href=#attr-input-max>max</a></code>,
- <code id=the-input-element:attr-input-maxlength-2><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id=the-input-element:attr-input-min-2><a href=#attr-input-min>min</a></code>,
- <code id=the-input-element:attr-input-minlength-2><a href=#attr-input-minlength>minlength</a></code>,
- <code id=the-input-element:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code>,
- <code id=the-input-element:attr-input-pattern-3><a href=#attr-input-pattern>pattern</a></code>,
- <code id=the-input-element:attr-input-placeholder-2><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id=the-input-element:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code>,
- <code id=the-input-element:attr-input-required-2><a href=#attr-input-required>required</a></code>,
- <code id=the-input-element:attr-input-size-2><a href=#attr-input-size>size</a></code>,
- <code id=the-input-element:attr-input-src-2><a href=#attr-input-src>src</a></code>,
- <code id=the-input-element:attr-input-step-2><a href=#attr-input-step>step</a></code>, and
- <code id=the-input-element:attr-dim-width-2><a href=#attr-dim-width>width</a></code> content attributes, the
- <code id=the-input-element:dom-input-checked-2><a href=#dom-input-checked>checked</a></code>,
- <code id=the-input-element:dom-input-files-2><a href=#dom-input-files>files</a></code>,
- <code id=the-input-element:dom-input-valueasdate-2><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id=the-input-element:dom-input-valueasnumber-2><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id=the-input-element:dom-input-valuelow-2><a href=#dom-input-valuelow>valueLow</a></code>,
- <code id=the-input-element:dom-input-valuehigh-2><a href=#dom-input-valuehigh>valueHigh</a></code>, and
- <code id=the-input-element:dom-input-list-2><a href=#dom-input-list>list</a></code> IDL attributes, the
- <code id=the-input-element:dom-textarea/input-select-2><a href=#dom-textarea/input-select>select()</a></code> method, the
- <code id=the-input-element:dom-textarea/input-selectionstart-2><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id=the-input-element:dom-textarea/input-selectionend-2><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, and
- <code id=the-input-element:dom-textarea/input-selectiondirection-2><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, IDL attributes, the
- <code id=the-input-element:dom-textarea/input-setrangetext-3><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code> and
- <code id=the-input-element:dom-textarea/input-setselectionrange-2><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods, the
- <code id=the-input-element:dom-input-stepup-2><a href=#dom-input-stepup>stepUp()</a></code> and
- <code id=the-input-element:dom-input-stepdown-2><a href=#dom-input-stepdown>stepDown()</a></code> methods, and the
- <code id=the-input-element:event-input-input><a href=#event-input-input>input</a></code> and
- <code id=the-input-element:event-input-change><a href=#event-input-change>change</a></code> events <dfn id=concept-input-apply>apply</dfn> to an
- <code id=the-input-element:the-input-element-2><a href=#the-input-element>input</a></code> element depends on the state of its
- <code id=the-input-element:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute.
- The subsections that define each type also clearly define in normative "bookkeeping" sections
- which of these feature apply, and which <dfn id=do-not-apply>do not apply</dfn>, to each type. The behavior of
- these features depends on whether they apply or not, as defined in their various sections (q.v.
- for <a href=#common-input-element-attributes>content attributes</a>, for <a href=#common-input-element-apis>APIs</a>, for <a href=#common-input-element-events>events</a>).</p>
- <p>The following table is non-normative and summarizes which of those
- content attributes, IDL attributes, methods, and events <a href=#concept-input-apply id=the-input-element:concept-input-apply>apply</a> to each state:</p>
- <table id=input-type-attr-summary class=applies><thead><tr><th>
- <th> <span><a href="#hidden-state-(type=hidden)" id="the-input-element:hidden-state-(type=hidden)-6">Hidden</a></span>
- <th> <span><a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element:text-(type=text)-state-and-search-state-(type=search)-4">Text</a>,</span>
- <span><a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element:text-(type=text)-state-and-search-state-(type=search)-5">Search</a></span>
- <th> <span><a href="#url-state-(type=url)" id="the-input-element:url-state-(type=url)-2">URL</a>,</span>
- <span><a href="#telephone-state-(type=tel)" id="the-input-element:telephone-state-(type=tel)-2">Telephone</a></span>
- <th> <span><a href="#e-mail-state-(type=email)" id="the-input-element:e-mail-state-(type=email)-2">E-mail</a></span>
- <th> <span><a href="#password-state-(type=password)" id="the-input-element:password-state-(type=password)-2">Password</a></span>
- <th> <span><a href="#date-and-time-state-(type=datetime)" id="the-input-element:date-and-time-state-(type=datetime)-2">Date and Time</a>,</span>
- <span><a href="#date-state-(type=date)" id="the-input-element:date-state-(type=date)-2">Date</a>,</span>
- <span><a href="#month-state-(type=month)" id="the-input-element:month-state-(type=month)-2">Month</a>,</span>
- <span><a href="#week-state-(type=week)" id="the-input-element:week-state-(type=week)-2">Week</a>,</span>
- <span><a href="#time-state-(type=time)" id="the-input-element:time-state-(type=time)-2">Time</a></span>
- <th> <span><a href="#local-date-and-time-state-(type=datetime-local)" id="the-input-element:local-date-and-time-state-(type=datetime-local)-2">Local Date and Time</a></span>
- <th> <span><a href="#number-state-(type=number)" id="the-input-element:number-state-(type=number)-2">Number</a></span>
- <th> <span><a href="#range-state-(type=range)" id="the-input-element:range-state-(type=range)-2">Range</a></span>
- <th> <span><a href="#colour-state-(type=color)" id="the-input-element:colour-state-(type=color)-2">Colour</a></span>
- <th> <span><a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)-2">Checkbox</a>,</span>
- <span><a href="#radio-button-state-(type=radio)" id="the-input-element:radio-button-state-(type=radio)-2">Radio Button</a></span>
- <th> <span><a href="#file-upload-state-(type=file)" id="the-input-element:file-upload-state-(type=file)-3">File Upload</a></span>
- <th> <span><a href="#submit-button-state-(type=submit)" id="the-input-element:submit-button-state-(type=submit)-2">Submit Button</a></span>
- <th> <span><a href="#image-button-state-(type=image)" id="the-input-element:image-button-state-(type=image)-2">Image Button</a></span>
- <th> <span><a href="#reset-button-state-(type=reset)" id="the-input-element:reset-button-state-(type=reset)-2">Reset Button</a>,</span>
- <span><a href="#button-state-(type=button)" id="the-input-element:button-state-(type=button)-2">Button</a></span>
- <tbody><tr><th colspan=16 scope=rowgroup>Content attributes
- <tr><th> <code id=the-input-element:attr-input-accept-3><a href=#attr-input-accept>accept</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-alt-3><a href=#attr-input-alt>alt</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code>
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-checked-3><a href=#attr-input-checked>checked</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fe-dirname-3><a href=#attr-fe-dirname>dirname</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fs-formaction-3><a href=#attr-fs-formaction>formaction</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fs-formenctype-3><a href=#attr-fs-formenctype>formenctype</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fs-formmethod-3><a href=#attr-fs-formmethod>formmethod</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fs-formnovalidate-3><a href=#attr-fs-formnovalidate>formnovalidate</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fs-formtarget-3><a href=#attr-fs-formtarget>formtarget</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-dim-height-3><a href=#attr-dim-height>height</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-fe-inputmode-3><a href=#attr-fe-inputmode>inputmode</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-list-3><a href=#attr-input-list>list</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-max-3><a href=#attr-input-max>max</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-maxlength-3><a href=#attr-input-maxlength>maxlength</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-min-3><a href=#attr-input-min>min</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-minlength-3><a href=#attr-input-minlength>minlength</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-pattern-4><a href=#attr-input-pattern>pattern</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-placeholder-3><a href=#attr-input-placeholder>placeholder</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-readonly-3><a href=#attr-input-readonly>readonly</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-required-3><a href=#attr-input-required>required</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-size-3><a href=#attr-input-size>size</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-src-3><a href=#attr-input-src>src</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-input-step-3><a href=#attr-input-step>step</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:attr-dim-width-3><a href=#attr-dim-width>width</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <tbody><tr><th colspan=16 scope=rowgroup>IDL attributes and methods
- <tr><th> <code id=the-input-element:dom-input-checked-3><a href=#dom-input-checked>checked</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-files-3><a href=#dom-input-files>files</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-value-2><a href=#dom-input-value>value</a></code>
- <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default>default</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-2>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-3>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-4>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-5>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-6>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-7>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-8>value</a>
- <td class=yes> <a href=#dom-input-value-value id=the-input-element:dom-input-value-value-9>value</a>
- <td class=yes> <a href=#dom-input-value-default-on id=the-input-element:dom-input-value-default-on>default/on</a>
- <td class=yes> <a href=#dom-input-value-filename id=the-input-element:dom-input-value-filename>filename</a>
- <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-2>default</a>
- <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-3>default</a>
- <td class=yes> <a href=#dom-input-value-default id=the-input-element:dom-input-value-default-4>default</a>
- <tr><th> <code id=the-input-element:dom-input-valueasdate-3><a href=#dom-input-valueasdate>valueAsDate</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-valueasnumber-3><a href=#dom-input-valueasnumber>valueAsNumber</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes*
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-valuelow-3><a href=#dom-input-valuelow>valueLow</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes**
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-valuehigh-3><a href=#dom-input-valuehigh>valueHigh</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes**
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-list-3><a href=#dom-input-list>list</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-select-3><a href=#dom-textarea/input-select>select()</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-selectionstart-3><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-selectionend-3><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-selectiondirection-3><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-setrangetext-4><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-textarea/input-setselectionrange-3><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-stepdown-3><a href=#dom-input-stepdown>stepDown()</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <code id=the-input-element:dom-input-stepup-3><a href=#dom-input-stepup>stepUp()</a></code>
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tbody><tr><th colspan=16 scope=rowgroup>Events
- <tr><th> <span><code id=the-input-element:event-input-input-2><a href=#event-input-input>input</a></code> event</span>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- <tr><th> <span><code id=the-input-element:event-input-change-2><a href=#event-input-change>change</a></code> event</span>
- <td class=no> ·
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=yes> Yes
- <td class=no> ·
- <td class=no> ·
- <td class=no> ·
- </table>
- <p class=tablenote><small>* If the <code id=the-input-element:attr-input-multiple-4><a href=#attr-input-multiple>multiple</a></code> attribute
- is not specified.</small></p>
- <p class=tablenote><small>** If the <code id=the-input-element:attr-input-multiple-5><a href=#attr-input-multiple>multiple</a></code> attribute
- <em>is</em> specified.</small></p>
-
- <p>Some states of the <code id=the-input-element:attr-input-type-7><a href=#attr-input-type>type</a></code> attribute define a <dfn id=value-sanitization-algorithm>value
- sanitization algorithm</dfn>.</p>
- <p>Each <code id=the-input-element:the-input-element-3><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-value id=the-input-element:concept-fe-value>value</a>, which is
- exposed by the <code id=the-input-element:dom-input-value-3><a href=#dom-input-value>value</a></code> IDL attribute. Some states define an
- <dfn id=concept-input-value-string-number>algorithm to convert a string to a number</dfn>,
- an <dfn id=concept-input-value-number-string>algorithm to convert a number to a
- string</dfn>, an <dfn id=concept-input-value-string-date>algorithm to convert a string to a
- <code>Date</code> object</dfn>, and an <dfn id=concept-input-value-date-string>algorithm to
- convert a <code>Date</code> object to a string</dfn>, which are used by <code id=the-input-element:attr-input-max-4><a href=#attr-input-max>max</a></code>, <code id=the-input-element:attr-input-min-4><a href=#attr-input-min>min</a></code>, <code id=the-input-element:attr-input-step-4><a href=#attr-input-step>step</a></code>, <code id=the-input-element:dom-input-valueasdate-4><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id=the-input-element:dom-input-valueasnumber-4><a href=#dom-input-valueasnumber>valueAsNumber</a></code>, <code id=the-input-element:dom-input-valuelow-4><a href=#dom-input-valuelow>valueLow</a></code>, <code id=the-input-element:dom-input-valuehigh-4><a href=#dom-input-valuehigh>valueHigh</a></code>,
- <code id=the-input-element:dom-input-stepdown-4><a href=#dom-input-stepdown>stepDown()</a></code>, and <code id=the-input-element:dom-input-stepup-4><a href=#dom-input-stepup>stepUp()</a></code>.</p>
- <p>Each <code id=the-input-element:the-input-element-4><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-value-dirty-flag>dirty
- value flag</dfn>. The <a href=#concept-input-value-dirty-flag id=the-input-element:concept-input-value-dirty-flag>dirty value flag</a> must be
- initially set to false when the element is created, and must be set to true whenever the user
- interacts with the control in a way that changes the <a href=#concept-fe-value id=the-input-element:concept-fe-value-2>value</a>.
- (It is also set to true when the value is programmatically changed, as described in the definition
- of the <code id=the-input-element:dom-input-value-4><a href=#dom-input-value>value</a></code> IDL attribute.)</p>
-
- <p>The <dfn id=attr-input-value><code>value</code></dfn> content attribute gives the default
- <a href=#concept-fe-value id=the-input-element:concept-fe-value-3>value</a> of the <code id=the-input-element:the-input-element-5><a href=#the-input-element>input</a></code> element. When the <code id=the-input-element:attr-input-value-2><a href=#attr-input-value>value</a></code> content attribute is added, set,
- or removed, if the control's <a href=#concept-input-value-dirty-flag id=the-input-element:concept-input-value-dirty-flag-2>dirty value flag</a>
- is false, the user agent must set the <a href=#concept-fe-value id=the-input-element:concept-fe-value-4>value</a> of the element
- to the value of the <code id=the-input-element:attr-input-value-3><a href=#attr-input-value>value</a></code> content attribute, if there is
- one, or the empty string otherwise, and then run the current <a href=#value-sanitization-algorithm id=the-input-element:value-sanitization-algorithm>value sanitization
- algorithm</a>, if one is defined.</p>
-
- <p>Each <code id=the-input-element:the-input-element-6><a href=#the-input-element>input</a></code> element has a <a href=#concept-fe-checked id=the-input-element:concept-fe-checked>checkedness</a>,
- which is exposed by the <code id=the-input-element:dom-input-checked-4><a href=#dom-input-checked>checked</a></code> IDL attribute.</p>
- <p>Each <code id=the-input-element:the-input-element-7><a href=#the-input-element>input</a></code> element has a boolean <dfn id=concept-input-checked-dirty-flag>dirty checkedness flag</dfn>. When it is true, the
- element is said to have a <dfn id=concept-input-checked-dirty><i>dirty checkedness</i></dfn>.
- The <a href=#concept-input-checked-dirty-flag id=the-input-element:concept-input-checked-dirty-flag>dirty checkedness flag</a> must be initially
- set to false when the element is created, and must be set to true whenever the user interacts with
- the control in a way that changes the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-2>checkedness</a>.</p>
-
- <p>The <dfn id=attr-input-checked><code>checked</code></dfn> content attribute is a
- <a href=#boolean-attribute id=the-input-element:boolean-attribute>boolean attribute</a> that gives the default <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-3>checkedness</a> of the <code id=the-input-element:the-input-element-8><a href=#the-input-element>input</a></code> element. When the <code id=the-input-element:attr-input-checked-4><a href=#attr-input-checked>checked</a></code> content attribute is added,
- if the control does not have <i id=the-input-element:concept-input-checked-dirty><a href=#concept-input-checked-dirty>dirty checkedness</a></i>, the
- user agent must set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-4>checkedness</a> of the element to
- true; when the <code id=the-input-element:attr-input-checked-5><a href=#attr-input-checked>checked</a></code> content attribute is removed, if
- the control does not have <i id=the-input-element:concept-input-checked-dirty-2><a href=#concept-input-checked-dirty>dirty checkedness</a></i>, the user
- agent must set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-5>checkedness</a> of the element to
- false.</p>
-
- <p>The <a href=#concept-form-reset-control id=the-input-element:concept-form-reset-control>reset algorithm</a> for <code id=the-input-element:the-input-element-9><a href=#the-input-element>input</a></code>
- elements is to set the <a href=#concept-input-value-dirty-flag id=the-input-element:concept-input-value-dirty-flag-3>dirty value flag</a> and
- <a href=#concept-input-checked-dirty-flag id=the-input-element:concept-input-checked-dirty-flag-2>dirty checkedness flag</a> back to false, set
- the <a href=#concept-fe-value id=the-input-element:concept-fe-value-5>value</a> of the element to the value of the <code id=the-input-element:attr-input-value-4><a href=#attr-input-value>value</a></code> content attribute, if there is one, or the empty string
- otherwise, set the <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-6>checkedness</a> of the element to true if
- the element has a <code id=the-input-element:attr-input-checked-6><a href=#attr-input-checked>checked</a></code> content attribute and false if
- it does not, empty the list of <a href=#concept-input-type-file-selected id=the-input-element:concept-input-type-file-selected>selected
- files</a>, and then invoke the <a href=#value-sanitization-algorithm id=the-input-element:value-sanitization-algorithm-2>value sanitization algorithm</a>, if the <code id=the-input-element:attr-input-type-8><a href=#attr-input-type>type</a></code> attribute's current state defines one.</p>
- <p>Each <code id=the-input-element:the-input-element-10><a href=#the-input-element>input</a></code> element can be <i id=the-input-element:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>. Except where
- otherwise specified, an <code id=the-input-element:the-input-element-11><a href=#the-input-element>input</a></code> element is always <i id=the-input-element:concept-fe-mutable-2><a href=#concept-fe-mutable>mutable</a></i>. Similarly, except where otherwise specified, the user
- agent should not allow the user to modify the element's <a href=#concept-fe-value id=the-input-element:concept-fe-value-6>value</a> or <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-7>checkedness</a>.</p>
- <p>When an <code id=the-input-element:the-input-element-12><a href=#the-input-element>input</a></code> element is <a href=#concept-fe-disabled id=the-input-element:concept-fe-disabled>disabled</a>, it is not <i id=the-input-element:concept-fe-mutable-3><a href=#concept-fe-mutable>mutable</a></i>.</p>
- <p class=note>The <code id=the-input-element:attr-input-readonly-4><a href=#attr-input-readonly>readonly</a></code> attribute can also in some
- cases (e.g. for the <a href="#date-state-(type=date)" id="the-input-element:date-state-(type=date)-3">Date</a> state, but not the <a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)-3">Checkbox</a> state) stop an <code id=the-input-element:the-input-element-13><a href=#the-input-element>input</a></code> element from
- being <i id=the-input-element:concept-fe-mutable-4><a href=#concept-fe-mutable>mutable</a></i>.</p>
- <p>The <a href=#concept-node-clone-ext id=the-input-element:concept-node-clone-ext>cloning steps</a> for <code id=the-input-element:the-input-element-14><a href=#the-input-element>input</a></code> elements
- must propagate the <a href=#concept-fe-value id=the-input-element:concept-fe-value-7>value</a>, <a href=#concept-input-value-dirty-flag id=the-input-element:concept-input-value-dirty-flag-4>dirty value flag</a>, <a href=#concept-fe-checked id=the-input-element:concept-fe-checked-8>checkedness</a>, and <a href=#concept-input-checked-dirty-flag id=the-input-element:concept-input-checked-dirty-flag-3>dirty checkedness flag</a> from the node being cloned
- to the copy.</p>
- <hr>
- <p>When an <code id=the-input-element:the-input-element-15><a href=#the-input-element>input</a></code> element is first created, the element's rendering and behavior must
- be set to the rendering and behavior defined for the <code id=the-input-element:attr-input-type-9><a href=#attr-input-type>type</a></code>
- attribute's state, and the <a href=#value-sanitization-algorithm id=the-input-element:value-sanitization-algorithm-3>value sanitization algorithm</a>, if one is defined for the
- <code id=the-input-element:attr-input-type-10><a href=#attr-input-type>type</a></code> attribute's state, must be invoked.</p>
-
- <div id=input-type-change>
- <p>When an <code id=the-input-element:the-input-element-16><a href=#the-input-element>input</a></code> element's <code id=the-input-element:attr-input-type-11><a href=#attr-input-type>type</a></code> attribute
- changes state, the user agent must run the following steps:</p>
- <ol><li><p>If the previous state of the element's <code id=the-input-element:attr-input-type-12><a href=#attr-input-type>type</a></code> attribute
- put the <code id=the-input-element:dom-input-value-5><a href=#dom-input-value>value</a></code> IDL attribute in the <i id=the-input-element:dom-input-value-value-10><a href=#dom-input-value-value>value</a></i> mode, and the element's <a href=#concept-fe-value id=the-input-element:concept-fe-value-8>value</a> is not the empty string, and the new state of the element's
- <code id=the-input-element:attr-input-type-13><a href=#attr-input-type>type</a></code> attribute puts the <code id=the-input-element:dom-input-value-6><a href=#dom-input-value>value</a></code> IDL attribute in either the <i id=the-input-element:dom-input-value-default-5><a href=#dom-input-value-default>default</a></i> mode or the <i id=the-input-element:dom-input-value-default-on-2><a href=#dom-input-value-default-on>default/on</a></i> mode, then set the element's <code id=the-input-element:attr-input-value-5><a href=#attr-input-value>value</a></code> content attribute to the element's <a href=#concept-fe-value id=the-input-element:concept-fe-value-9>value</a>.<li><p>Otherwise, if the previous state of the element's <code id=the-input-element:attr-input-type-14><a href=#attr-input-type>type</a></code> attribute put the <code id=the-input-element:dom-input-value-7><a href=#dom-input-value>value</a></code>
- IDL attribute in any mode other than the <i id=the-input-element:dom-input-value-value-11><a href=#dom-input-value-value>value</a></i> mode, and the
- new state of the element's <code id=the-input-element:attr-input-type-15><a href=#attr-input-type>type</a></code> attribute puts the <code id=the-input-element:dom-input-value-8><a href=#dom-input-value>value</a></code> IDL attribute in the <i id=the-input-element:dom-input-value-value-12><a href=#dom-input-value-value>value</a></i> mode, then set the <a href=#concept-fe-value id=the-input-element:concept-fe-value-10>value</a> of the element to the value of the <code id=the-input-element:attr-input-value-6><a href=#attr-input-value>value</a></code> content attribute, if there is one, or the empty string
- otherwise, and then set the control's <a href=#concept-input-value-dirty-flag id=the-input-element:concept-input-value-dirty-flag-5>dirty value
- flag</a> to false.<li><p>Update the element's rendering and behavior to the new state's.<li><p><dfn id=signal-a-type-change>Signal a type change</dfn> for the element. (The <a href="#radio-button-state-(type=radio)" id="the-input-element:radio-button-state-(type=radio)-3">Radio Button</a> state uses this, in particular.)<li><p>Invoke the <a href=#value-sanitization-algorithm id=the-input-element:value-sanitization-algorithm-4>value sanitization algorithm</a>, if one is defined for the <code id=the-input-element:attr-input-type-16><a href=#attr-input-type>type</a></code> attribute's new state.</ol>
- </div>
- <hr>
- <p>
- The <code id=the-input-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
- The <code id=the-input-element:attr-fe-dirname-4><a href=#attr-fe-dirname>dirname</a></code> attribute controls how the element's <a href=#the-directionality id=the-input-element:the-directionality-2>directionality</a> is submitted.
- The <code id=the-input-element:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make the control non-interactive and to prevent its value from being submitted.
- The <code id=the-input-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the <code id=the-input-element:the-input-element-17><a href=#the-input-element>input</a></code> element with its <a href=#form-owner id=the-input-element:form-owner>form owner</a>.
- The <code id=the-input-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
- The <code id=the-input-element:attr-fe-inputmode-4><a href=#attr-fe-inputmode>inputmode</a></code> attribute controls the user interface's input modality for the control.
- The <code id=the-input-element:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent provides autofill behavior.
- </p>
-
- <p>The <dfn id=dom-input-indeterminate><code>indeterminate</code></dfn> IDL attribute must
- initially be set to false. On getting, it must return the last value it was set to. On setting, it
- must be set to the new value. It has no effect except for changing the appearance of <a href="#checkbox-state-(type=checkbox)" id="the-input-element:checkbox-state-(type=checkbox)-4">checkbox</a> controls.</p>
- <p>The <dfn id=dom-input-accept><code>accept</code></dfn>, <dfn id=dom-input-alt><code>alt</code></dfn>, <dfn id=dom-input-max><code>max</code></dfn>,
- <dfn id=dom-input-min><code>min</code></dfn>, <dfn id=dom-input-multiple><code>multiple</code></dfn>, <dfn id=dom-input-pattern><code>pattern</code></dfn>, <dfn id=dom-input-placeholder><code>placeholder</code></dfn>, <dfn id=dom-input-required><code>required</code></dfn>, <dfn id=dom-input-size><code>size</code></dfn>, <dfn id=dom-input-src><code>src</code></dfn>,
- and <dfn id=dom-input-step><code>step</code></dfn> IDL attributes must <a href=#reflect id=the-input-element:reflect>reflect</a>
- the respective content attributes of the same name. The <dfn id=dom-input-dirname><code>dirName</code></dfn> IDL attribute must <a href=#reflect id=the-input-element:reflect-2>reflect</a> the
- <code id=the-input-element:attr-fe-dirname-5><a href=#attr-fe-dirname>dirname</a></code> content attribute. The <dfn id=dom-input-readonly><code>readOnly</code></dfn> IDL attribute must <a href=#reflect id=the-input-element:reflect-3>reflect</a> the
- <code id=the-input-element:attr-input-readonly-5><a href=#attr-input-readonly>readonly</a></code> content attribute. The <dfn id=dom-input-defaultchecked><code>defaultChecked</code></dfn> IDL attribute must
- <a href=#reflect id=the-input-element:reflect-4>reflect</a> the <code id=the-input-element:attr-input-checked-7><a href=#attr-input-checked>checked</a></code> content attribute. The
- <dfn id=dom-input-defaultvalue><code>defaultValue</code></dfn> IDL attribute must
- <a href=#reflect id=the-input-element:reflect-5>reflect</a> the <code id=the-input-element:attr-input-value-7><a href=#attr-input-value>value</a></code> content attribute.</p>
- <p>The <dfn id=dom-input-type><code>type</code></dfn> IDL attribute must <a href=#reflect id=the-input-element:reflect-6>reflect</a>
- the respective content attribute of the same name, <a href=#limited-to-only-known-values id=the-input-element:limited-to-only-known-values>limited to only known values</a>. The
- <dfn id=dom-input-inputmode><code>inputMode</code></dfn> IDL attribute must
- <a href=#reflect id=the-input-element:reflect-7>reflect</a> the <code id=the-input-element:attr-fe-inputmode-5><a href=#attr-fe-inputmode>inputmode</a></code> content attribute,
- <a href=#limited-to-only-known-values id=the-input-element:limited-to-only-known-values-2>limited to only known values</a>. The <dfn id=dom-input-maxlength><code>maxLength</code></dfn> IDL attribute must <a href=#reflect id=the-input-element:reflect-8>reflect</a>
- the <code id=the-input-element:attr-input-maxlength-4><a href=#attr-input-maxlength>maxlength</a></code> content attribute, <a href=#limited-to-only-non-negative-numbers id=the-input-element:limited-to-only-non-negative-numbers>limited to only
- non-negative numbers</a>. The <dfn id=dom-input-minlength><code>minLength</code></dfn> IDL attribute must <a href=#reflect id=the-input-element:reflect-9>reflect</a>
- the <code id=the-input-element:attr-input-minlength-4><a href=#attr-input-minlength>minlength</a></code> content attribute, <a href=#limited-to-only-non-negative-numbers id=the-input-element:limited-to-only-non-negative-numbers-2>limited to only
- non-negative numbers</a>.</p>
- <p>The IDL attributes <dfn id=dom-input-width><code>width</code></dfn> and <dfn id=dom-input-height><code>height</code></dfn> must return the rendered width and height of
- the image, in CSS pixels, if an image is <a href=#being-rendered id=the-input-element:being-rendered>being rendered</a>, and is being rendered to a
- visual medium; or else the intrinsic width and height of the image, in CSS pixels, if an image is
- <i id=the-input-element:input-img-available><a href=#input-img-available>available</a></i> but not being rendered to a visual medium; or else 0,
- if no image is <i id=the-input-element:input-img-available-2><a href=#input-img-available>available</a></i>. When the <code id=the-input-element:the-input-element-18><a href=#the-input-element>input</a></code> element's
- <code id=the-input-element:attr-input-type-17><a href=#attr-input-type>type</a></code> attribute is not in the <a href="#image-button-state-(type=image)" id="the-input-element:image-button-state-(type=image)-3">Image Button</a> state, then no image is <i id=the-input-element:input-img-available-3><a href=#input-img-available>available</a></i>. <a href=#refsCSS>[CSS]</a></p>
- <p>On setting, they must act as if they <a href=#reflect id=the-input-element:reflect-10>reflected</a> the respective
- content attributes of the same name.</p>
- <p>The <code id=the-input-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-input-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-input-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-input-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-input-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-input-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-input-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-input-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-input-element:the-label-element><a href=#the-label-element>label</a></code>s. The <code id=the-input-element:dom-textarea/input-select-4><a href=#dom-textarea/input-select>select()</a></code>, <code id=the-input-element:dom-textarea/input-selectionstart-4><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, <code id=the-input-element:dom-textarea/input-selectionend-4><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, <code id=the-input-element:dom-textarea/input-selectiondirection-4><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, <code id=the-input-element:dom-textarea/input-setrangetext-5><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and <code id=the-input-element:dom-textarea/input-setselectionrange-4><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods and IDL attributes
- expose the element's text selection. The <code id=the-input-element:dom-fe-autofocus-2><a href=#dom-fe-autofocus>autofocus</a></code>, <code id=the-input-element:dom-fe-disabled-2><a href=#dom-fe-disabled>disabled</a></code>, <code id=the-input-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code>, and <code id=the-input-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are part of the element's forms API.</p>
-
- <h5 id=states-of-the-type-attribute>4.10.5.1 States of the <code id=states-of-the-type-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute</h5>
- <h6 id="hidden-state-(type=hidden)">4.10.5.1.1 <dfn>Hidden</dfn> state (<code>type=hidden</code>)</h6>
-
- <p>When an <code id="hidden-state-(type=hidden):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="hidden-state-(type=hidden):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#hidden-state-(type=hidden)" id="hidden-state-(type=hidden):hidden-state-(type=hidden)">Hidden</a> state, the rules in this section apply.</p>
-
- <p>The <code id="hidden-state-(type=hidden):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="hidden-state-(type=hidden):represents">represents</a> a value that is not intended to be
- examined or manipulated by the user.</p>
-
- <p><strong>Constraint validation</strong>: If an <code id="hidden-state-(type=hidden):the-input-element-3"><a href=#the-input-element>input</a></code> element's <code id="hidden-state-(type=hidden):attr-input-type-2"><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="hidden-state-(type=hidden):hidden-state-(type=hidden)-2">Hidden</a> state, it is <a href=#barred-from-constraint-validation id="hidden-state-(type=hidden):barred-from-constraint-validation">barred from constraint
- validation</a>.</p>
-
- <p>If the <code id="hidden-state-(type=hidden):attr-fe-name"><a href=#attr-fe-name>name</a></code> attribute is present and has a value that is a
- <a href=#case-sensitive id="hidden-state-(type=hidden):case-sensitive">case-sensitive</a> match for the string "<code id="hidden-state-(type=hidden):attr-fe-name-charset"><a href=#attr-fe-name-charset>_charset_</a></code>", then the element's <code id="hidden-state-(type=hidden):attr-input-value"><a href=#attr-input-value>value</a></code> attribute must be omitted.</p>
- <div class=bookkeeping>
- <p>The
- <code id="hidden-state-(type=hidden):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>
- content attribute <a href=#concept-input-apply id="hidden-state-(type=hidden):concept-input-apply">applies</a> to this element.</p>
- <p>The
- <code id="hidden-state-(type=hidden):dom-input-value"><a href=#dom-input-value>value</a></code>
- IDL attribute <a href=#concept-input-apply id="hidden-state-(type=hidden):concept-input-apply-2">applies</a> to this element and is
- in mode <a href=#dom-input-value-default id="hidden-state-(type=hidden):dom-input-value-default">default</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="hidden-state-(type=hidden):do-not-apply">do not
- apply</a> to the element:
- <code id="hidden-state-(type=hidden):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="hidden-state-(type=hidden):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="hidden-state-(type=hidden):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="hidden-state-(type=hidden):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="hidden-state-(type=hidden):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="hidden-state-(type=hidden):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="hidden-state-(type=hidden):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="hidden-state-(type=hidden):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="hidden-state-(type=hidden):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="hidden-state-(type=hidden):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="hidden-state-(type=hidden):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="hidden-state-(type=hidden):do-not-apply-2">do not apply</a> to the
- element:
- <code id="hidden-state-(type=hidden):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="hidden-state-(type=hidden):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="hidden-state-(type=hidden):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="hidden-state-(type=hidden):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="hidden-state-(type=hidden):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="hidden-state-(type=hidden):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="hidden-state-(type=hidden):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="hidden-state-(type=hidden):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="hidden-state-(type=hidden):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="hidden-state-(type=hidden):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="hidden-state-(type=hidden):event-input-input" class=no-backref><a href=#event-input-input>input</a></code> and <code id="hidden-state-(type=hidden):event-input-change" class=no-backref><a href=#event-input-change>change</a></code> events <a href=#do-not-apply id="hidden-state-(type=hidden):do-not-apply-3">do not apply</a>.</p>
- </div>
- <h6 id="text-(type=text)-state-and-search-state-(type=search)">4.10.5.1.2 <dfn>Text</dfn> (<code>type=text</code>) state and <dfn>Search</dfn> state (<code>type=search</code>)</h6>
-
-
- <p>When an <code id="text-(type=text)-state-and-search-state-(type=search):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="text-(type=text)-state-and-search-state-(type=search):text-(type=text)-state-and-search-state-(type=search)">Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="text-(type=text)-state-and-search-state-(type=search):text-(type=text)-state-and-search-state-(type=search)-2">Search</a> state, the rules in this section apply.</p>
-
- <p>The <code id="text-(type=text)-state-and-search-state-(type=search):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="text-(type=text)-state-and-search-state-(type=search):represents">represents</a> a one line plain text edit control for
- the element's <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value">value</a>.</p>
- <p class=note>The difference between the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="text-(type=text)-state-and-search-state-(type=search):text-(type=text)-state-and-search-state-(type=search)-3">Text</a> state
- and the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="text-(type=text)-state-and-search-state-(type=search):text-(type=text)-state-and-search-state-(type=search)-4">Search</a> state is primarily stylistic: on
- platforms where search fields are distinguished from regular text fields, the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="text-(type=text)-state-and-search-state-(type=search):text-(type=text)-state-and-search-state-(type=search)-5">Search</a> state might result in an appearance consistent with
- the platform's search fields rather than appearing like a regular text field.</p>
-
- <p>If the element is <i id="text-(type=text)-state-and-search-state-(type=search):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value-2">value</a> should be editable by the user. User agents must not allow
- users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the element's
- <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value-3">value</a>.</p>
-
-
- <p>If the element is <i id="text-(type=text)-state-and-search-state-(type=search):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the writing direction of the element, setting it either to a left-to-right writing
- direction or a right-to-left writing direction. If the user does so, the user agent must then run
- the following steps:</p>
- <ol><li><p>Set the element's <code id="text-(type=text)-state-and-search-state-(type=search):the-dir-attribute"><a href=#the-dir-attribute>dir</a></code> attribute to "<code id="text-(type=text)-state-and-search-state-(type=search):attr-dir-ltr"><a href=#attr-dir-ltr>ltr</a></code>" if the user selected a left-to-right writing direction, and
- "<code id="text-(type=text)-state-and-search-state-(type=search):attr-dir-rtl"><a href=#attr-dir-rtl>rtl</a></code>" if the user selected a right-to-left writing
- direction.<li><p><a href=#queue-a-task id="text-(type=text)-state-and-search-state-(type=search):queue-a-task">Queue a task</a> to <a href=#fire-a-simple-event id="text-(type=text)-state-and-search-state-(type=search):fire-a-simple-event">fire a simple event</a> that bubbles named <code id="text-(type=text)-state-and-search-state-(type=search):event-input-input"><a href=#event-input-input>input</a></code> at the <code id="text-(type=text)-state-and-search-state-(type=search):the-input-element-3"><a href=#the-input-element>input</a></code> element.</ol>
-
- <p>The <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value that
- contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="text-(type=text)-state-and-search-state-(type=search):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks id="text-(type=text)-state-and-search-state-(type=search):strip-line-breaks">Strip line
- breaks</a> from the <a href=#concept-fe-value id="text-(type=text)-state-and-search-state-(type=search):concept-fe-value-4">value</a>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="text-(type=text)-state-and-search-state-(type=search):the-input-element-4"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="text-(type=text)-state-and-search-state-(type=search):concept-input-apply">apply</a> to the element:
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-dirname"><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fe-inputmode"><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- <p>The <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="text-(type=text)-state-and-search-state-(type=search):dom-input-value-value">value</a>.</p>
- <p>The <code id="text-(type=text)-state-and-search-state-(type=search):event-input-input-2"><a href=#event-input-input>input</a></code> and <code id="text-(type=text)-state-and-search-state-(type=search):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="text-(type=text)-state-and-search-state-(type=search):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="text-(type=text)-state-and-search-state-(type=search):do-not-apply">do not
- apply</a> to the element:
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="text-(type=text)-state-and-search-state-(type=search):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="text-(type=text)-state-and-search-state-(type=search):do-not-apply-2">do not apply</a> to the
- element:
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="text-(type=text)-state-and-search-state-(type=search):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="telephone-state-(type=tel)">4.10.5.1.3 <dfn>Telephone</dfn> state (<code>type=tel</code>)</h6>
-
- <p>When an <code id="telephone-state-(type=tel):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="telephone-state-(type=tel):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#telephone-state-(type=tel)" id="telephone-state-(type=tel):telephone-state-(type=tel)">Telephone</a> state, the rules in this section apply.</p>
-
- <p>The <code id="telephone-state-(type=tel):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="telephone-state-(type=tel):represents">represents</a> a control for editing a telephone number
- given in the element's <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value">value</a>.</p>
-
- <p>If the element is <i id="telephone-state-(type=tel):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-2">value</a> should be editable by the user. User agents may change the
- spacing and, with care, the punctuation of <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-3">values</a> that the
- user enters. User agents must not allow users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE
- RETURN (CR) characters into the element's <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-4">value</a>.</p>
-
- <p>The <code id="telephone-state-(type=tel):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value that
- contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="telephone-state-(type=tel):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks id="telephone-state-(type=tel):strip-line-breaks">Strip line
- breaks</a> from the <a href=#concept-fe-value id="telephone-state-(type=tel):concept-fe-value-5">value</a>.</p>
-
- <p class=note>Unlike the <a href="#url-state-(type=url)" id="telephone-state-(type=tel):url-state-(type=url)">URL</a> and <a href="#e-mail-state-(type=email)" id="telephone-state-(type=tel):e-mail-state-(type=email)">E-mail</a> types, the <a href="#telephone-state-(type=tel)" id="telephone-state-(type=tel):telephone-state-(type=tel)-2">Telephone</a> type does not enforce a particular syntax. This is
- intentional; in practice, telephone number fields tend to be free-form fields, because there are a
- wide variety of valid phone numbers. Systems that need to enforce a particular format are
- encouraged to use the <code id="telephone-state-(type=tel):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code> attribute or the <code id="telephone-state-(type=tel):dom-cva-setcustomvalidity"><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method to hook into the client-side
- validation mechanism.</p>
- <div class=bookkeeping>
- <p>The following common <code id="telephone-state-(type=tel):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="telephone-state-(type=tel):concept-input-apply">apply</a> to the element:
- <code id="telephone-state-(type=tel):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="telephone-state-(type=tel):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="telephone-state-(type=tel):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="telephone-state-(type=tel):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
- <code id="telephone-state-(type=tel):attr-input-pattern-2"><a href=#attr-input-pattern>pattern</a></code>,
- <code id="telephone-state-(type=tel):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="telephone-state-(type=tel):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="telephone-state-(type=tel):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="telephone-state-(type=tel):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
- <code id="telephone-state-(type=tel):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="telephone-state-(type=tel):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="telephone-state-(type=tel):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="telephone-state-(type=tel):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
- <code id="telephone-state-(type=tel):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
- <code id="telephone-state-(type=tel):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="telephone-state-(type=tel):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="telephone-state-(type=tel):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- <p>The <code id="telephone-state-(type=tel):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="telephone-state-(type=tel):dom-input-value-value">value</a>.</p>
- <p>The <code id="telephone-state-(type=tel):event-input-input"><a href=#event-input-input>input</a></code> and <code id="telephone-state-(type=tel):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="telephone-state-(type=tel):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="telephone-state-(type=tel):do-not-apply">do not
- apply</a> to the element:
- <code id="telephone-state-(type=tel):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="telephone-state-(type=tel):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="telephone-state-(type=tel):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="telephone-state-(type=tel):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="telephone-state-(type=tel):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="telephone-state-(type=tel):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="telephone-state-(type=tel):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="telephone-state-(type=tel):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="telephone-state-(type=tel):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="telephone-state-(type=tel):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="telephone-state-(type=tel):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="telephone-state-(type=tel):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="telephone-state-(type=tel):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="telephone-state-(type=tel):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="telephone-state-(type=tel):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="telephone-state-(type=tel):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="telephone-state-(type=tel):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="telephone-state-(type=tel):do-not-apply-2">do not apply</a> to the
- element:
- <code id="telephone-state-(type=tel):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="telephone-state-(type=tel):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="telephone-state-(type=tel):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="telephone-state-(type=tel):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="telephone-state-(type=tel):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="telephone-state-(type=tel):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="telephone-state-(type=tel):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="telephone-state-(type=tel):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="url-state-(type=url)">4.10.5.1.4 <dfn>URL</dfn> state (<code>type=url</code>)</h6>
-
- <p>When an <code id="url-state-(type=url):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="url-state-(type=url):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#url-state-(type=url)" id="url-state-(type=url):url-state-(type=url)">URL</a> state, the rules in this section apply.</p>
-
- <p>The <code id="url-state-(type=url):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="url-state-(type=url):represents">represents</a> a control for editing a single
- <a href=#absolute-url id="url-state-(type=url):absolute-url">absolute URL</a> given in the element's <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value">value</a>.</p>
-
- <p>If the element is <i id="url-state-(type=url):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the URL represented by its <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-2">value</a>. User agents
- may allow the user to set the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-3">value</a> to a string that is not
- a <a href=#valid-url id="url-state-(type=url):valid-url">valid</a> <a href=#absolute-url id="url-state-(type=url):absolute-url-2">absolute URL</a>, but may also or instead
- automatically escape characters entered by the user so that the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-4">value</a> is always a <a href=#valid-url id="url-state-(type=url):valid-url-2">valid</a>
- <a href=#absolute-url id="url-state-(type=url):absolute-url-3">absolute URL</a> (even if that isn't the actual value seen and edited by the user in the
- interface). User agents should allow the user to set the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-5">value</a> to the empty string. User agents must not allow users to
- insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-6">value</a>.</p>
-
- <p>The <code id="url-state-(type=url):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-url-potentially-surrounded-by-spaces id="url-state-(type=url):valid-url-potentially-surrounded-by-spaces">valid URL potentially surrounded by spaces</a> that is also an
- <a href=#absolute-url id="url-state-(type=url):absolute-url-4">absolute URL</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="url-state-(type=url):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks id="url-state-(type=url):strip-line-breaks">Strip line
- breaks</a> from the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-7">value</a>, then <a href=#strip-leading-and-trailing-whitespace id="url-state-(type=url):strip-leading-and-trailing-whitespace">strip leading and
- trailing whitespace</a> from the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-8">value</a>.</p>
- <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="url-state-(type=url):concept-fe-value-9">value</a>
- of the element is neither the empty string nor a <a href=#valid-url id="url-state-(type=url):valid-url-3">valid</a>
- <a href=#absolute-url id="url-state-(type=url):absolute-url-5">absolute URL</a>, the element is <a href=#suffering-from-a-type-mismatch id="url-state-(type=url):suffering-from-a-type-mismatch">suffering from a type mismatch</a>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="url-state-(type=url):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="url-state-(type=url):concept-input-apply">apply</a> to the element:
- <code id="url-state-(type=url):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="url-state-(type=url):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="url-state-(type=url):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="url-state-(type=url):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
- <code id="url-state-(type=url):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
- <code id="url-state-(type=url):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="url-state-(type=url):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="url-state-(type=url):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="url-state-(type=url):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
- <code id="url-state-(type=url):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="url-state-(type=url):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="url-state-(type=url):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="url-state-(type=url):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
- <code id="url-state-(type=url):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
- <code id="url-state-(type=url):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="url-state-(type=url):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="url-state-(type=url):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- <p>The <code id="url-state-(type=url):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="url-state-(type=url):dom-input-value-value">value</a>.</p>
- <p>The <code id="url-state-(type=url):event-input-input"><a href=#event-input-input>input</a></code> and <code id="url-state-(type=url):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="url-state-(type=url):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="url-state-(type=url):do-not-apply">do not
- apply</a> to the element:
- <code id="url-state-(type=url):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="url-state-(type=url):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="url-state-(type=url):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="url-state-(type=url):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="url-state-(type=url):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="url-state-(type=url):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="url-state-(type=url):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="url-state-(type=url):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="url-state-(type=url):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="url-state-(type=url):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="url-state-(type=url):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="url-state-(type=url):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="url-state-(type=url):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="url-state-(type=url):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="url-state-(type=url):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="url-state-(type=url):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="url-state-(type=url):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="url-state-(type=url):do-not-apply-2">do not apply</a> to the
- element:
- <code id="url-state-(type=url):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="url-state-(type=url):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="url-state-(type=url):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="url-state-(type=url):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="url-state-(type=url):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="url-state-(type=url):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="url-state-(type=url):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="url-state-(type=url):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <div class=example>
- <p>If a document contained the following markup:</p>
- <pre><input type="url" name="location" list="urls">
- <datalist id="urls">
- <option label="MIME: Format of Internet Message Bodies" value="http://tools.ietf.org/html/rfc2045">
- <option label="HTML 4.01 Specification" value="http://www.w3.org/TR/html4/">
- <option label="Form Controls" value="http://www.w3.org/TR/xforms/slice8.html#ui-commonelems-hint">
- <option label="Scalable Vector Graphics (SVG) 1.1 Specification" value="http://www.w3.org/TR/SVG/">
- <option label="Feature Sets - SVG 1.1 - 20030114" value="http://www.w3.org/TR/SVG/feature.html">
- <option label="The Single UNIX Specification, Version 3" value="http://www.unix-systems.org/version3/">
- </datalist>
- </pre>
- <p>...and the user had typed "<kbd>www.w3</kbd>", and the user agent had also found that the user
- had visited <code>http://www.w3.org/Consortium/#membership</code> and <code>http://www.w3.org/TR/XForms/</code> in the recent past, then the rendering might look
- like this:</p>
- <p><img src=http://images.whatwg.org/sample-url.png width=472 alt="A text box with an icon on the left followed by the text "www.w3" and a cursor, with a drop down button on the right hand side; with, below, a drop down box containing a list of six URLs on the left, with the first four having grayed out labels on the right; and a scroll bar to the right of the drop down box, indicating further values are available." height=134></p>
- <p>The first four URLs in this sample consist of the four URLs in the author-specified list that
- match the text the user has entered, sorted in some UA-defined manner (maybe by how frequently
- the user refers to those URLs). Note how the UA is using the knowledge that the values are URLs
- to allow the user to omit the scheme part and perform intelligent matching on the domain
- name.</p>
- <p>The last two URLs (and probably many more, given the scrollbar's indications of more values
- being available) are the matches from the user agent's session history data. This data is not
- made available to the page DOM. In this particular case, the UA has no titles to provide for
- those values.</p>
- </div>
- <h6 id="e-mail-state-(type=email)">4.10.5.1.5 <dfn>E-mail</dfn> state (<code>type=email</code>)</h6>
-
- <p>When an <code id="e-mail-state-(type=email):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="e-mail-state-(type=email):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#e-mail-state-(type=email)" id="e-mail-state-(type=email):e-mail-state-(type=email)">E-mail</a> state, the rules in this section apply.</p>
-
- <p>How the <a href="#e-mail-state-(type=email)" id="e-mail-state-(type=email):e-mail-state-(type=email)-2">E-mail</a> state operates depends on whether the
- <code id="e-mail-state-(type=email):attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute is specified or not.</p>
- <dl class=switch><dt>When the <code id="e-mail-state-(type=email):attr-input-multiple-2"><a href=#attr-input-multiple>multiple</a></code> attribute is not specified on the
- element<dd>
- <p>The <code id="e-mail-state-(type=email):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="e-mail-state-(type=email):represents">represents</a> a control for editing an e-mail
- address given in the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value">value</a>.</p>
-
- <p>If the element is <i id="e-mail-state-(type=email):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the e-mail address represented by its <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-2">value</a>. User agents may allow the user to set the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-3">value</a> to a string that is not a <a href=#valid-e-mail-address id="e-mail-state-(type=email):valid-e-mail-address">valid e-mail
- address</a>. The user agent should act in a manner consistent with expecting the user to
- provide a single e-mail address. User agents should allow the user to set the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-4">value</a> to the empty string. User agents must not allow users to
- insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-5">value</a>. User agents may transform the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-6">value</a> for display and editing; in particular, user agents should
- convert punycode in the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-7">value</a> to IDN in the display and
- vice versa.</p>
- <p><strong>Constraint validation</strong>: While the user interface is representing input that
- the user agent cannot convert to punycode, the control is <a href=#suffering-from-bad-input id="e-mail-state-(type=email):suffering-from-bad-input">suffering from bad
- input</a>.</p>
-
- <p>The <code id="e-mail-state-(type=email):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a single <a href=#valid-e-mail-address id="e-mail-state-(type=email):valid-e-mail-address-2">valid e-mail address</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="e-mail-state-(type=email):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks id="e-mail-state-(type=email):strip-line-breaks">Strip
- line breaks</a> from the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-8">value</a>, then <a href=#strip-leading-and-trailing-whitespace id="e-mail-state-(type=email):strip-leading-and-trailing-whitespace">strip
- leading and trailing whitespace</a> from the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-9">value</a>.</p>
- <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-10">value</a>
- of the element is neither the empty string nor a single <a href=#valid-e-mail-address id="e-mail-state-(type=email):valid-e-mail-address-3">valid e-mail address</a>, the
- element is <a href=#suffering-from-a-type-mismatch id="e-mail-state-(type=email):suffering-from-a-type-mismatch">suffering from a type mismatch</a>.</p>
-
- <dt>When the <code id="e-mail-state-(type=email):attr-input-multiple-3"><a href=#attr-input-multiple>multiple</a></code> attribute <em>is</em> specified on
- the element<dd>
- <p>The <code id="e-mail-state-(type=email):the-input-element-3"><a href=#the-input-element>input</a></code> element <a href=#represents id="e-mail-state-(type=email):represents-2">represents</a> a control for adding, removing, and
- editing the e-mail addresses given in the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values">value<em>s</em></a>.</p>
-
- <p>If the element is <i id="e-mail-state-(type=email):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to add, remove, and edit the e-mail addresses represented by its <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-2">values</a>. User agents may allow the user to set any
- individual value in the list of <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-11">value<em>s</em></a> to a
- string that is not a <a href=#valid-e-mail-address id="e-mail-state-(type=email):valid-e-mail-address-4">valid e-mail address</a>, but must not allow users to set any
- individual value to a string containing U+002C COMMA (,), U+000A LINE FEED (LF), or U+000D
- CARRIAGE RETURN (CR) characters. User agents should allow the user to remove all the addresses
- in the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-3">values</a>. User agents may
- transform the <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-4">values</a> for display and editing; in
- particular, user agents should convert punycode in the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-12">value</a> to IDN in the display and vice versa.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes a situation where
- an individual value contains a U+002C COMMA (,) or is representing input that the user agent
- cannot convert to punycode, the control is <a href=#suffering-from-bad-input id="e-mail-state-(type=email):suffering-from-bad-input-2">suffering from bad input</a>.</p>
- <p>Whenever the user changes the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-13">value<em>s</em></a>, the user agent must run the following
- steps:</p>
- <ol><li><p>Let <var>latest values</var> be a copy of the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-14">value<em>s</em></a>.<li><p><a href=#strip-leading-and-trailing-whitespace id="e-mail-state-(type=email):strip-leading-and-trailing-whitespace-2">Strip leading and trailing whitespace</a> from each value in <var>latest values</var>.<li><p>Let the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-15">value</a> be the result of
- concatenating all the values in <var>latest values</var>, separating each value from
- the next by a single U+002C COMMA character (,), maintaining the list's order.</ol>
-
- <p>The <code id="e-mail-state-(type=email):attr-input-value-2"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value
- that is a <a href=#valid-e-mail-address-list id="e-mail-state-(type=email):valid-e-mail-address-list">valid e-mail address list</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="e-mail-state-(type=email):value-sanitization-algorithm-2">value sanitization algorithm</a> is as follows</strong>:</p>
- <ol><li><p><a href=#split-a-string-on-commas id="e-mail-state-(type=email):split-a-string-on-commas">Split on commas</a> the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-16">value</a>, <a href=#strip-leading-and-trailing-whitespace id="e-mail-state-(type=email):strip-leading-and-trailing-whitespace-3">strip leading and trailing whitespace</a> from
- each resulting token, if any, and let the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-5">values</a> be the (possibly empty) resulting list of
- (possibly empty) tokens, maintaining the original order.<li><p>Let the element's <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-17">value</a> be the result of
- concatenating the element's <a href=#concept-fe-values id="e-mail-state-(type=email):concept-fe-values-6">values</a>, separating
- each value from the next by a single U+002C COMMA character (,), maintaining the list's
- order.</ol>
- <p><strong>Constraint validation</strong>: While the <a href=#concept-fe-value id="e-mail-state-(type=email):concept-fe-value-18">value</a>
- of the element is not a <a href=#valid-e-mail-address-list id="e-mail-state-(type=email):valid-e-mail-address-list-2">valid e-mail address list</a>, the element is <a href=#suffering-from-a-type-mismatch id="e-mail-state-(type=email):suffering-from-a-type-mismatch-2">suffering
- from a type mismatch</a>.</p>
-
- </dl>
- <p>When the <code id="e-mail-state-(type=email):attr-input-multiple-4"><a href=#attr-input-multiple>multiple</a></code> attribute is set or removed, the
- user agent must run the <a href=#value-sanitization-algorithm id="e-mail-state-(type=email):value-sanitization-algorithm-3">value sanitization algorithm</a>.</p>
- <p>A <dfn id=valid-e-mail-address>valid e-mail address</dfn> is a string that matches the <code>email</code>
- production of the following ABNF, the character set for which is Unicode. This ABNF implements the
- extensions described in RFC 1123. <a href=#refsABNF>[ABNF]</a> <a href=#refsRFC5322>[RFC5322]</a> <a href=#refsRFC1034>[RFC1034]</a> <a href=#refsRFC1123>[RFC1123]</a></p>
- <pre>email = 1*( atext / "." ) "@" label *( "." label )
- label = let-dig [ [ ldh-str ] let-dig ] ; limited to a length of 63 characters by <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a>
- atext = < as defined in <a href=http://tools.ietf.org/html/rfc5322#section-3.2.3>RFC 5322 section 3.2.3</a> >
- let-dig = < as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> >
- ldh-str = < as defined in <a href=http://tools.ietf.org/html/rfc1034#section-3.5>RFC 1034 section 3.5</a> ></pre>
-
- <p class=note>This requirement is a <a href=#willful-violation id="e-mail-state-(type=email):willful-violation">willful violation</a> of RFC 5322, which defines a
- syntax for e-mail addresses that is simultaneously too strict (before the "@" character), too
- vague (after the "@" character), and too lax (allowing comments, whitespace characters, and quoted
- strings in manners unfamiliar to most users) to be of practical use here.</p>
- <div class=note>
- <p>The following JavaScript- and Perl-compatible regular expression is an implementation of the
- above definition.</p>
- <pre>/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/</pre>
-
- </div>
- <p>A <dfn id=valid-e-mail-address-list>valid e-mail address list</dfn> is a <a href=#set-of-comma-separated-tokens id="e-mail-state-(type=email):set-of-comma-separated-tokens">set of comma-separated tokens</a>, where
- each token is itself a <a href=#valid-e-mail-address id="e-mail-state-(type=email):valid-e-mail-address-5">valid e-mail address</a>. To obtain the list of
- tokens from a <a href=#valid-e-mail-address-list id="e-mail-state-(type=email):valid-e-mail-address-list-3">valid e-mail address list</a>, and implementation must <a href=#split-a-string-on-commas id="e-mail-state-(type=email):split-a-string-on-commas-2">split the string on commas</a>.</p>
- <div class=bookkeeping>
- <p>The following common <code id="e-mail-state-(type=email):the-input-element-4"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="e-mail-state-(type=email):concept-input-apply">apply</a> to the element:
- <code id="e-mail-state-(type=email):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="e-mail-state-(type=email):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="e-mail-state-(type=email):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="e-mail-state-(type=email):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
- <code id="e-mail-state-(type=email):attr-input-multiple-5"><a href=#attr-input-multiple>multiple</a></code>,
- <code id="e-mail-state-(type=email):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
- <code id="e-mail-state-(type=email):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="e-mail-state-(type=email):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="e-mail-state-(type=email):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="e-mail-state-(type=email):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
- <code id="e-mail-state-(type=email):dom-input-list"><a href=#dom-input-list>list</a></code> and
- <code id="e-mail-state-(type=email):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
- <p>The <code id="e-mail-state-(type=email):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="e-mail-state-(type=email):dom-input-value-value">value</a>.</p>
- <p>The <code id="e-mail-state-(type=email):event-input-input"><a href=#event-input-input>input</a></code> and <code id="e-mail-state-(type=email):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="e-mail-state-(type=email):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="e-mail-state-(type=email):do-not-apply">do not
- apply</a> to the element:
- <code id="e-mail-state-(type=email):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="e-mail-state-(type=email):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="e-mail-state-(type=email):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="e-mail-state-(type=email):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="e-mail-state-(type=email):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="e-mail-state-(type=email):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="e-mail-state-(type=email):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="e-mail-state-(type=email):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="e-mail-state-(type=email):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="e-mail-state-(type=email):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="e-mail-state-(type=email):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="e-mail-state-(type=email):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="e-mail-state-(type=email):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="e-mail-state-(type=email):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="e-mail-state-(type=email):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="e-mail-state-(type=email):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="e-mail-state-(type=email):do-not-apply-2">do not apply</a> to the
- element:
- <code id="e-mail-state-(type=email):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="e-mail-state-(type=email):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="e-mail-state-(type=email):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="e-mail-state-(type=email):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="e-mail-state-(type=email):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="e-mail-state-(type=email):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="e-mail-state-(type=email):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="e-mail-state-(type=email):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="e-mail-state-(type=email):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="e-mail-state-(type=email):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="e-mail-state-(type=email):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="e-mail-state-(type=email):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="e-mail-state-(type=email):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="e-mail-state-(type=email):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="password-state-(type=password)">4.10.5.1.6 <dfn>Password</dfn> state (<code>type=password</code>)</h6>
-
- <p>When an <code id="password-state-(type=password):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="password-state-(type=password):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#password-state-(type=password)" id="password-state-(type=password):password-state-(type=password)">Password</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="password-state-(type=password):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="password-state-(type=password):represents">represents</a> a one line plain text edit control for
- the element's <a href=#concept-fe-value id="password-state-(type=password):concept-fe-value">value</a>. The user agent should obscure the value
- so that people other than the user cannot see it.</p>
-
- <p>If the element is <i id="password-state-(type=password):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, its <a href=#concept-fe-value id="password-state-(type=password):concept-fe-value-2">value</a> should be editable by the user. User agents must not allow
- users to insert U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href=#concept-fe-value id="password-state-(type=password):concept-fe-value-3">value</a>.</p>
-
- <p>The <code id="password-state-(type=password):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value that
- contains no U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR) characters.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="password-state-(type=password):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: <a href=#strip-line-breaks id="password-state-(type=password):strip-line-breaks">Strip line
- breaks</a> from the <a href=#concept-fe-value id="password-state-(type=password):concept-fe-value-4">value</a>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="password-state-(type=password):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="password-state-(type=password):concept-input-apply">apply</a> to the element:
- <code id="password-state-(type=password):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="password-state-(type=password):attr-fe-inputmode"><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="password-state-(type=password):attr-input-maxlength"><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="password-state-(type=password):attr-input-minlength"><a href=#attr-input-minlength>minlength</a></code>,
- <code id="password-state-(type=password):attr-input-pattern"><a href=#attr-input-pattern>pattern</a></code>,
- <code id="password-state-(type=password):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="password-state-(type=password):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="password-state-(type=password):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="password-state-(type=password):attr-input-size"><a href=#attr-input-size>size</a></code> content attributes;
- <code id="password-state-(type=password):dom-textarea/input-selectionstart"><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="password-state-(type=password):dom-textarea/input-selectionend"><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="password-state-(type=password):dom-textarea/input-selectiondirection"><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, and
- <code id="password-state-(type=password):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes;
- <code id="password-state-(type=password):dom-textarea/input-select"><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="password-state-(type=password):dom-textarea/input-setrangetext"><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="password-state-(type=password):dom-textarea/input-setselectionrange"><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- <p>The <code id="password-state-(type=password):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="password-state-(type=password):dom-input-value-value">value</a>.</p>
- <p>The <code id="password-state-(type=password):event-input-input"><a href=#event-input-input>input</a></code> and <code id="password-state-(type=password):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="password-state-(type=password):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="password-state-(type=password):do-not-apply">do not
- apply</a> to the element:
- <code id="password-state-(type=password):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="password-state-(type=password):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="password-state-(type=password):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="password-state-(type=password):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="password-state-(type=password):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="password-state-(type=password):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="password-state-(type=password):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="password-state-(type=password):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="password-state-(type=password):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="password-state-(type=password):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="password-state-(type=password):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="password-state-(type=password):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="password-state-(type=password):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="password-state-(type=password):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="password-state-(type=password):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="password-state-(type=password):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="password-state-(type=password):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="password-state-(type=password):do-not-apply-2">do not apply</a> to the
- element:
- <code id="password-state-(type=password):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="password-state-(type=password):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="password-state-(type=password):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="password-state-(type=password):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="password-state-(type=password):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="password-state-(type=password):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="password-state-(type=password):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="password-state-(type=password):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="password-state-(type=password):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="date-and-time-state-(type=datetime)">4.10.5.1.7 <dfn>Date and Time</dfn> state (<code>type=datetime</code>)</h6>
-
- <p>When an <code id="date-and-time-state-(type=datetime):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="date-and-time-state-(type=datetime):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#date-and-time-state-(type=datetime)" id="date-and-time-state-(type=datetime):date-and-time-state-(type=datetime)">Date and Time</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="date-and-time-state-(type=datetime):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="date-and-time-state-(type=datetime):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value">value</a> to a string representing a specific <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime">global date and time</a>. User agents may display
- the date and time in whatever time zone is appropriate for the user.</p>
-
- <p>If the element is <i id="date-and-time-state-(type=datetime):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-2">global date and time</a> represented by its
- <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-global-date-and-time-string id="date-and-time-state-(type=datetime):parse-a-global-date-and-time-string">parsing a global date and time</a> from it. User agents must not allow the user to
- set the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-3">value</a> to a non-empty string that is not a
- <a href=#valid-normalised-forced-utc-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-normalised-forced-utc-global-date-and-time-string">valid normalised forced-UTC global date and time string</a>, though user agents may allow
- the user to set and view the time in another time zone and silently translate the time to and from
- the UTC time zone in the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-4">value</a>. If the user agent provides a
- user interface for selecting a <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-3">global date and time</a>, then
- the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-5">value</a> must be set to a <a href=#valid-normalised-forced-utc-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-normalised-forced-utc-global-date-and-time-string-2">valid normalised forced-UTC
- global date and time string</a> representing the user's selection. User agents should allow the
- user to set the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-6">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-normalised-forced-utc-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-normalised-forced-utc-global-date-and-time-string-3">valid normalised forced-UTC global date and time string</a>,
- the control is <a href=#suffering-from-bad-input id="date-and-time-state-(type=datetime):suffering-from-bad-input">suffering from bad input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="date-and-time-state-(type=datetime):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-global-date-and-time-string">valid global date and time string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="date-and-time-state-(type=datetime):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-7">value</a> of the element is a <a href=#valid-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-global-date-and-time-string-2">valid global date and time
- string</a>, then adjust the time so that the <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-8">value</a>
- represents the same point in time but expressed in the UTC time zone as a <span>valid normalized
- forced-UTC global date and time string</span>, otherwise, set it to the empty string instead.</p>
-
- <p>The <code id="date-and-time-state-(type=datetime):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-global-date-and-time-string-3">valid global date and time string</a>. The <code id="date-and-time-state-(type=datetime):attr-input-max"><a href=#attr-input-max>max</a></code>
- attribute, if specified, must have a value that is a <a href=#valid-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-global-date-and-time-string-4">valid global date and time
- string</a>.</p>
- <p>The <code id="date-and-time-state-(type=datetime):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. The <a href=#concept-input-step-scale id="date-and-time-state-(type=datetime):concept-input-step-scale">step scale factor</a> is 1000 (which
- converts the seconds to milliseconds, as used in the other algorithms). The <a href=#concept-input-step-default id="date-and-time-state-(type=datetime):concept-input-step-default">default step</a> is 60 seconds.</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="date-and-time-state-(type=datetime):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="date-and-time-state-(type=datetime):concept-fe-value-9">value</a> to the nearest <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-4">global date and time</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="date-and-time-state-(type=datetime):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="date-and-time-state-(type=datetime):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-global-date-and-time-string id="date-and-time-state-(type=datetime):parse-a-global-date-and-time-string-2">parsing a global date and time</a> from <var>input</var> results in an error, then return an error; otherwise, return the number of
- milliseconds elapsed from midnight UTC on the morning of 1970-01-01 (the time represented by the
- value "<code>1970-01-01T00:00:00.0Z</code>") to the parsed <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-5">global date and time</a>, ignoring leap seconds.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="date-and-time-state-(type=datetime):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-normalised-forced-utc-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-normalised-forced-utc-global-date-and-time-string-4">valid normalised forced-UTC global date and time string</a> that represents the <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-6">global date and time</a> that is <var>input</var>
- milliseconds after midnight UTC on the morning of 1970-01-01 (the time represented by the value
- "<code>1970-01-01T00:00:00.0Z</code>").</p>
- <p><strong>The <a href=#concept-input-value-string-date id="date-and-time-state-(type=datetime):concept-input-value-string-date">algorithm to convert a string to a
- <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
- If <a href=#parse-a-global-date-and-time-string id="date-and-time-state-(type=datetime):parse-a-global-date-and-time-string-3">parsing a global date and time</a> from
- <var>input</var> results in an error, then return an error; otherwise, return <a href=#create-a-date-object id="date-and-time-state-(type=datetime):create-a-date-object">a new <code>Date</code> object</a> representing the parsed <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-7">global date and time</a>, expressed in UTC.</p>
- <p><strong>The <a href=#concept-input-value-date-string id="date-and-time-state-(type=datetime):concept-input-value-date-string">algorithm to convert a
- <code>Date</code> object to a string</a>, given a <code id="date-and-time-state-(type=datetime):idl-date"><a href=#idl-date>Date</a></code> object <var>input</var>, is as follows</strong>: Return a <a href=#valid-normalised-forced-utc-global-date-and-time-string id="date-and-time-state-(type=datetime):valid-normalised-forced-utc-global-date-and-time-string-5">valid normalised forced-UTC global
- date and time string</a> that represents the <a href=#concept-datetime id="date-and-time-state-(type=datetime):concept-datetime-8">global date and
- time</a> that is represented by <var>input</var>.</p>
-
- <div id=only-contemporary-times class=note>
- <p>The <a href="#date-and-time-state-(type=datetime)" id="date-and-time-state-(type=datetime):date-and-time-state-(type=datetime)-2">Date and Time</a> state (and other date- and
- time-related states described in subsequent sections) is not intended for the entry of values for
- which a precise date and time relative to the contemporary calendar cannot be established. For
- example, it would be inappropriate for the entry of times like "one millisecond after the big
- bang", "the early part of the Jurassic period", or "a winter around 250 BCE".</p>
- <p>For the input of dates before the introduction of the Gregorian calendar, authors are
- encouraged to not use the <a href="#date-and-time-state-(type=datetime)" id="date-and-time-state-(type=datetime):date-and-time-state-(type=datetime)-3">Date and Time</a> state (and
- the other date- and time-related states described in subsequent sections), as user agents are not
- required to support converting dates and times from earlier periods to the Gregorian calendar,
- and asking users to do so manually puts an undue burden on users. (This is complicated by the
- manner in which the Gregorian calendar was phased in, which occurred at different times in
- different countries, ranging from partway through the 16th century all the way to early in the
- 20th.) Instead, authors are encouraged to provide fine-grained input controls using the
- <code id="date-and-time-state-(type=datetime):the-select-element"><a href=#the-select-element>select</a></code> element and <code id="date-and-time-state-(type=datetime):the-input-element-3"><a href=#the-input-element>input</a></code> elements with the <a href="#number-state-(type=number)" id="date-and-time-state-(type=datetime):number-state-(type=number)">Number</a> state.</p>
- </div>
- <div class=bookkeeping>
- <p>The following common <code id="date-and-time-state-(type=datetime):the-input-element-4"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="date-and-time-state-(type=datetime):concept-input-apply">apply</a> to the element:
- <code id="date-and-time-state-(type=datetime):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="date-and-time-state-(type=datetime):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="date-and-time-state-(type=datetime):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-input-value"><a href=#dom-input-value>value</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
- <code id="date-and-time-state-(type=datetime):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="date-and-time-state-(type=datetime):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="date-and-time-state-(type=datetime):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="date-and-time-state-(type=datetime):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="date-and-time-state-(type=datetime):dom-input-value-value">value</a>.</p>
- <p>The <code id="date-and-time-state-(type=datetime):event-input-input"><a href=#event-input-input>input</a></code> and <code id="date-and-time-state-(type=datetime):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="date-and-time-state-(type=datetime):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="date-and-time-state-(type=datetime):do-not-apply">do not
- apply</a> to the element:
- <code id="date-and-time-state-(type=datetime):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="date-and-time-state-(type=datetime):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="date-and-time-state-(type=datetime):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="date-and-time-state-(type=datetime):do-not-apply-2">do not apply</a> to the
- element:
- <code id="date-and-time-state-(type=datetime):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="date-and-time-state-(type=datetime):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="date-and-time-state-(type=datetime):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <div class=example>
- <p>The following fragment shows part of a calendar application. A user can specify a date and
- time for a meeting (in his local time zone, probably, though the user agent can allow the user to
- change that), and since the submitted data includes the time-zone offset, the application can
- ensure that the meeting is shown at the correct time regardless of the time zones used by all the
- participants.</p>
- <pre><fieldset>
- <legend>Add Meeting</legend>
- <p><label>Meeting name: <input type=text name="meeting.label"></label>
- <p><label>Meeting time: <input type=datetime name="meeting.start"></label>
- </fieldset></pre>
- <p>Had the application used the <code id="date-and-time-state-(type=datetime):local-date-and-time-state-(type=datetime-local)"><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code> type instead, the calendar
- application would have also had to explicitly determine which time zone the user intended.</p>
- <p>For events where the precise time is to vary as the user travels (e.g. "celebrate the new
- year!"), and for recurring events that are to stay at the same time for a specific geographic
- location even though that location may go in and out of daylight savings time (e.g. "bring the
- kid to school"), the <code id="date-and-time-state-(type=datetime):local-date-and-time-state-(type=datetime-local)-2"><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code> type
- combined with a <code id="date-and-time-state-(type=datetime):the-select-element-2"><a href=#the-select-element>select</a></code> element (or other similar control) to pick the specific
- geographic location to which to anchor the time would be more appropriate.</p>
- </div>
- <h6 id="date-state-(type=date)">4.10.5.1.8 <dfn>Date</dfn> state (<code>type=date</code>)</h6>
-
- <p>When an <code id="date-state-(type=date):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="date-state-(type=date):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#date-state-(type=date)" id="date-state-(type=date):date-state-(type=date)">Date</a> state, the rules in this section apply.</p>
-
- <p>The <code id="date-state-(type=date):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="date-state-(type=date):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value">value</a> to a string representing a specific <a href=#concept-date id="date-state-(type=date):concept-date">date</a>.</p>
-
- <p>If the element is <i id="date-state-(type=date):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-date id="date-state-(type=date):concept-date-2">date</a> represented by its <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-date-string id="date-state-(type=date):parse-a-date-string">parsing a
- date</a> from it. User agents must not allow the user to set the <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-3">value</a> to a non-empty string that is not a <a href=#valid-date-string id="date-state-(type=date):valid-date-string">valid date
- string</a>. If the user agent provides a user interface for selecting a <a href=#concept-date id="date-state-(type=date):concept-date-3">date</a>, then the <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-4">value</a> must be set
- to a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-2">valid date string</a> representing the user's selection. User agents should allow
- the user to set the <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-3">valid date string</a>, the control is <a href=#suffering-from-bad-input id="date-state-(type=date):suffering-from-bad-input">suffering from bad
- input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="date-state-(type=date):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-4">valid date string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="date-state-(type=date):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-6">value</a> of the element is not a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-5">valid date string</a>, then
- set it to the empty string instead.</p>
-
- <p>The <code id="date-state-(type=date):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-6">valid date string</a>. The <code id="date-state-(type=date):attr-input-max"><a href=#attr-input-max>max</a></code> attribute, if
- specified, must have a value that is a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-7">valid date string</a>.</p>
- <p>The <code id="date-state-(type=date):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in days. The <a href=#concept-input-step-scale id="date-state-(type=date):concept-input-step-scale">step scale factor</a> is 86,400,000
- (which converts the days to milliseconds, as used in the other algorithms). The <a href=#concept-input-step-default id="date-state-(type=date):concept-input-step-default">default step</a> is 1 day.</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="date-state-(type=date):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="date-state-(type=date):concept-fe-value-7">value</a> to the nearest <a href=#concept-date id="date-state-(type=date):concept-date-4">date</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="date-state-(type=date):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="date-state-(type=date):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-date-string id="date-state-(type=date):parse-a-date-string-2">parsing a date</a> from <var>input</var> results in an
- error, then return an error; otherwise, return the number of milliseconds elapsed from midnight
- UTC on the morning of 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>") to midnight UTC on the morning of the parsed <a href=#concept-date id="date-state-(type=date):concept-date-5">date</a>, ignoring leap seconds.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="date-state-(type=date):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-date-string id="date-state-(type=date):valid-date-string-8">valid date string</a> that represents the <a href=#concept-date id="date-state-(type=date):concept-date-6">date</a> that, in
- UTC, is current <var>input</var> milliseconds after midnight UTC on the morning of
- 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>").</p>
- <p><strong>The <a href=#concept-input-value-string-date id="date-state-(type=date):concept-input-value-string-date">algorithm to convert a string to a
- <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
- If <a href=#parse-a-date-string id="date-state-(type=date):parse-a-date-string-3">parsing a date</a> from <var>input</var> results
- in an error, then return an error; otherwise, return <a href=#create-a-date-object id="date-state-(type=date):create-a-date-object">a new
- <code>Date</code> object</a> representing midnight UTC on the morning of the parsed <a href=#concept-date id="date-state-(type=date):concept-date-7">date</a>.</p>
- <p><strong>The <a href=#concept-input-value-date-string id="date-state-(type=date):concept-input-value-date-string">algorithm to convert a
- <code>Date</code> object to a string</a>, given a <code id="date-state-(type=date):idl-date"><a href=#idl-date>Date</a></code> object <var>input</var>, is as follows</strong>: Return a <a href=#valid-date-string id="date-state-(type=date):valid-date-string-9">valid date string</a> that
- represents the <a href=#concept-date id="date-state-(type=date):concept-date-8">date</a> current at the time represented by <var>input</var> in the UTC time zone.</p>
-
- <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
- <a href="#date-and-time-state-(type=datetime)" id="date-state-(type=date):date-and-time-state-(type=datetime)">Date and Time</a> state section.</p>
- <div class=bookkeeping>
- <p>The following common <code id="date-state-(type=date):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="date-state-(type=date):concept-input-apply">apply</a> to the element:
- <code id="date-state-(type=date):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="date-state-(type=date):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="date-state-(type=date):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="date-state-(type=date):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="date-state-(type=date):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="date-state-(type=date):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="date-state-(type=date):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="date-state-(type=date):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="date-state-(type=date):dom-input-value"><a href=#dom-input-value>value</a></code>,
- <code id="date-state-(type=date):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
- <code id="date-state-(type=date):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="date-state-(type=date):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="date-state-(type=date):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="date-state-(type=date):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="date-state-(type=date):dom-input-value-value">value</a>.</p>
- <p>The <code id="date-state-(type=date):event-input-input"><a href=#event-input-input>input</a></code> and <code id="date-state-(type=date):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="date-state-(type=date):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="date-state-(type=date):do-not-apply">do not
- apply</a> to the element:
- <code id="date-state-(type=date):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="date-state-(type=date):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="date-state-(type=date):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="date-state-(type=date):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="date-state-(type=date):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="date-state-(type=date):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="date-state-(type=date):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="date-state-(type=date):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="date-state-(type=date):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="date-state-(type=date):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="date-state-(type=date):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="date-state-(type=date):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="date-state-(type=date):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="date-state-(type=date):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="date-state-(type=date):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="date-state-(type=date):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="date-state-(type=date):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="date-state-(type=date):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="date-state-(type=date):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="date-state-(type=date):do-not-apply-2">do not apply</a> to the
- element:
- <code id="date-state-(type=date):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="date-state-(type=date):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="date-state-(type=date):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="date-state-(type=date):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="date-state-(type=date):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="date-state-(type=date):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="date-state-(type=date):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="date-state-(type=date):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="date-state-(type=date):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <h6 id="month-state-(type=month)">4.10.5.1.9 <dfn>Month</dfn> state (<code>type=month</code>)</h6>
-
- <p>When an <code id="month-state-(type=month):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="month-state-(type=month):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#month-state-(type=month)" id="month-state-(type=month):month-state-(type=month)">Month</a> state, the rules in this section apply.</p>
-
- <p>The <code id="month-state-(type=month):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="month-state-(type=month):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value">value</a> to a string representing a specific <a href=#concept-month id="month-state-(type=month):concept-month">month</a>.</p>
-
- <p>If the element is <i id="month-state-(type=month):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-month id="month-state-(type=month):concept-month-2">month</a> represented by its <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-month-string id="month-state-(type=month):parse-a-month-string">parsing a
- month</a> from it. User agents must not allow the user to set the <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-3">value</a> to a non-empty string that is not a <a href=#valid-month-string id="month-state-(type=month):valid-month-string">valid month
- string</a>. If the user agent provides a user interface for selecting a <a href=#concept-month id="month-state-(type=month):concept-month-3">month</a>, then the <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-4">value</a> must be
- set to a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-2">valid month string</a> representing the user's selection. User agents should
- allow the user to set the <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-3">valid month string</a>, the control is <a href=#suffering-from-bad-input id="month-state-(type=month):suffering-from-bad-input">suffering from bad
- input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="month-state-(type=month):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-4">valid month string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="month-state-(type=month):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-6">value</a> of the element is not a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-5">valid month string</a>,
- then set it to the empty string instead.</p>
-
- <p>The <code id="month-state-(type=month):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-6">valid month string</a>. The <code id="month-state-(type=month):attr-input-max"><a href=#attr-input-max>max</a></code> attribute, if
- specified, must have a value that is a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-7">valid month string</a>.</p>
- <p>The <code id="month-state-(type=month):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in months. The <a href=#concept-input-step-scale id="month-state-(type=month):concept-input-step-scale">step scale factor</a> is 1 (there is no
- conversion needed as the algorithms use months). The <a href=#concept-input-step-default id="month-state-(type=month):concept-input-step-default">default step</a> is 1 month.</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="month-state-(type=month):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="month-state-(type=month):concept-fe-value-7">value</a> to the nearest <a href=#concept-month id="month-state-(type=month):concept-month-4">month</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="month-state-(type=month):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="month-state-(type=month):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-month-string id="month-state-(type=month):parse-a-month-string-2">parsing a month</a> from <var>input</var> results in an
- error, then return an error; otherwise, return the number of months between January 1970 and the
- parsed <a href=#concept-month id="month-state-(type=month):concept-month-5">month</a>.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="month-state-(type=month):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-month-string id="month-state-(type=month):valid-month-string-8">valid month string</a> that represents the <a href=#concept-month id="month-state-(type=month):concept-month-6">month</a> that
- has <var>input</var> months between it and January 1970.</p>
-
- <p><strong>The <a href=#concept-input-value-string-date id="month-state-(type=month):concept-input-value-string-date">algorithm to convert a string to a
- <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
- If <a href=#parse-a-month-string id="month-state-(type=month):parse-a-month-string-3">parsing a month</a> from <var>input</var>
- results in an error, then return an error; otherwise, return <a href=#create-a-date-object id="month-state-(type=month):create-a-date-object">a
- new <code>Date</code> object</a> representing midnight UTC on the morning of the first day of
- the parsed <a href=#concept-month id="month-state-(type=month):concept-month-7">month</a>.</p>
- <p><strong>The <a href=#concept-input-value-date-string id="month-state-(type=month):concept-input-value-date-string">algorithm to convert a
- <code>Date</code> object to a string</a>, given a <code id="month-state-(type=month):idl-date"><a href=#idl-date>Date</a></code> object <var>input</var>, is as follows</strong>: Return a <a href=#valid-month-string id="month-state-(type=month):valid-month-string-9">valid month string</a> that
- represents the <a href=#concept-month id="month-state-(type=month):concept-month-8">month</a> current at the time represented by <var>input</var> in the UTC time zone.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="month-state-(type=month):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="month-state-(type=month):concept-input-apply">apply</a> to the element:
- <code id="month-state-(type=month):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="month-state-(type=month):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="month-state-(type=month):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="month-state-(type=month):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="month-state-(type=month):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="month-state-(type=month):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="month-state-(type=month):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="month-state-(type=month):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="month-state-(type=month):dom-input-value"><a href=#dom-input-value>value</a></code>,
- <code id="month-state-(type=month):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
- <code id="month-state-(type=month):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="month-state-(type=month):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="month-state-(type=month):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="month-state-(type=month):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="month-state-(type=month):dom-input-value-value">value</a>.</p>
- <p>The <code id="month-state-(type=month):event-input-input"><a href=#event-input-input>input</a></code> and <code id="month-state-(type=month):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="month-state-(type=month):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="month-state-(type=month):do-not-apply">do not
- apply</a> to the element:
- <code id="month-state-(type=month):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="month-state-(type=month):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="month-state-(type=month):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="month-state-(type=month):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="month-state-(type=month):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="month-state-(type=month):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="month-state-(type=month):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="month-state-(type=month):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="month-state-(type=month):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="month-state-(type=month):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="month-state-(type=month):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="month-state-(type=month):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="month-state-(type=month):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="month-state-(type=month):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="month-state-(type=month):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="month-state-(type=month):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="month-state-(type=month):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="month-state-(type=month):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="month-state-(type=month):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="month-state-(type=month):do-not-apply-2">do not apply</a> to the
- element:
- <code id="month-state-(type=month):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="month-state-(type=month):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="month-state-(type=month):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="month-state-(type=month):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="month-state-(type=month):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="month-state-(type=month):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="month-state-(type=month):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="month-state-(type=month):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="month-state-(type=month):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="month-state-(type=month):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <h6 id="week-state-(type=week)">4.10.5.1.10 <dfn>Week</dfn> state (<code>type=week</code>)</h6>
-
- <p>When an <code id="week-state-(type=week):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="week-state-(type=week):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#week-state-(type=week)" id="week-state-(type=week):week-state-(type=week)">Week</a> state, the rules in this section apply.</p>
-
- <p>The <code id="week-state-(type=week):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="week-state-(type=week):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value">value</a> to a string representing a specific <a href=#concept-week id="week-state-(type=week):concept-week">week</a>.</p>
-
- <p>If the element is <i id="week-state-(type=week):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-week id="week-state-(type=week):concept-week-2">week</a> represented by its <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-week-string id="week-state-(type=week):parse-a-week-string">parsing a
- week</a> from it. User agents must not allow the user to set the <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-3">value</a> to a non-empty string that is not a <a href=#valid-week-string id="week-state-(type=week):valid-week-string">valid week
- string</a>. If the user agent provides a user interface for selecting a <a href=#concept-week id="week-state-(type=week):concept-week-3">week</a>, then the <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-4">value</a> must be set
- to a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-2">valid week string</a> representing the user's selection. User agents should allow
- the user to set the <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-3">valid week string</a>, the control is <a href=#suffering-from-bad-input id="week-state-(type=week):suffering-from-bad-input">suffering from bad
- input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="week-state-(type=week):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-4">valid week string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="week-state-(type=week):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-6">value</a> of the element is not a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-5">valid week string</a>, then
- set it to the empty string instead.</p>
-
- <p>The <code id="week-state-(type=week):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-6">valid week string</a>. The <code id="week-state-(type=week):attr-input-max"><a href=#attr-input-max>max</a></code> attribute, if
- specified, must have a value that is a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-7">valid week string</a>.</p>
- <p>The <code id="week-state-(type=week):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in weeks. The <a href=#concept-input-step-scale id="week-state-(type=week):concept-input-step-scale">step scale factor</a> is 604,800,000
- (which converts the weeks to milliseconds, as used in the other algorithms). The <a href=#concept-input-step-default id="week-state-(type=week):concept-input-step-default">default step</a> is 1 week. The <a href=#concept-input-step-default-base id="week-state-(type=week):concept-input-step-default-base">default step base</a> is −259,200,000 (the start
- of week 1970-W01).</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="week-state-(type=week):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="week-state-(type=week):concept-fe-value-7">value</a> to the nearest <a href=#concept-week id="week-state-(type=week):concept-week-4">week</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="week-state-(type=week):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="week-state-(type=week):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-week-string id="week-state-(type=week):parse-a-week-string-2">parsing a week string</a> from <var>input</var> results in
- an error, then return an error; otherwise, return the number of milliseconds elapsed from midnight
- UTC on the morning of 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>") to midnight UTC on the morning of the Monday of the
- parsed <a href=#concept-week id="week-state-(type=week):concept-week-5">week</a>, ignoring leap seconds.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="week-state-(type=week):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-week-string id="week-state-(type=week):valid-week-string-8">valid week string</a> that represents the <a href=#concept-week id="week-state-(type=week):concept-week-6">week</a> that, in
- UTC, is current <var>input</var> milliseconds after midnight UTC on the morning of
- 1970-01-01 (the time represented by the value "<code>1970-01-01T00:00:00.0Z</code>").</p>
- <p><strong>The <a href=#concept-input-value-string-date id="week-state-(type=week):concept-input-value-string-date">algorithm to convert a string to a
- <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
- If <a href=#parse-a-week-string id="week-state-(type=week):parse-a-week-string-3">parsing a week</a> from <var>input</var> results
- in an error, then return an error; otherwise, return <a href=#create-a-date-object id="week-state-(type=week):create-a-date-object">a new
- <code>Date</code> object</a> representing midnight UTC on the morning of the Monday of the
- parsed <a href=#concept-week id="week-state-(type=week):concept-week-7">week</a>.</p>
- <p><strong>The <a href=#concept-input-value-date-string id="week-state-(type=week):concept-input-value-date-string">algorithm to convert a
- <code>Date</code> object to a string</a>, given a <code id="week-state-(type=week):idl-date"><a href=#idl-date>Date</a></code> object <var>input</var>, is as follows</strong>: Return a <a href=#valid-week-string id="week-state-(type=week):valid-week-string-9">valid week string</a> that
- represents the <a href=#concept-week id="week-state-(type=week):concept-week-8">week</a> current at the time represented by <var>input</var> in the UTC time zone.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="week-state-(type=week):the-input-element-3"><a href=#the-input-element>input</a></code> element content attributes, IDL attributes, and
- methods <a href=#concept-input-apply id="week-state-(type=week):concept-input-apply">apply</a> to the element:
- <code id="week-state-(type=week):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="week-state-(type=week):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="week-state-(type=week):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="week-state-(type=week):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="week-state-(type=week):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="week-state-(type=week):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="week-state-(type=week):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="week-state-(type=week):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="week-state-(type=week):dom-input-value"><a href=#dom-input-value>value</a></code>,
- <code id="week-state-(type=week):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
- <code id="week-state-(type=week):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="week-state-(type=week):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="week-state-(type=week):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="week-state-(type=week):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-value id="week-state-(type=week):dom-input-value-value">value</a>.</p>
- <p>The <code id="week-state-(type=week):event-input-input"><a href=#event-input-input>input</a></code> and <code id="week-state-(type=week):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="week-state-(type=week):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="week-state-(type=week):do-not-apply">do not apply</a> to the
- element:
- <code id="week-state-(type=week):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="week-state-(type=week):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="week-state-(type=week):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="week-state-(type=week):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="week-state-(type=week):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="week-state-(type=week):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="week-state-(type=week):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="week-state-(type=week):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="week-state-(type=week):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="week-state-(type=week):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="week-state-(type=week):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="week-state-(type=week):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="week-state-(type=week):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="week-state-(type=week):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="week-state-(type=week):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="week-state-(type=week):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="week-state-(type=week):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="week-state-(type=week):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="week-state-(type=week):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="week-state-(type=week):do-not-apply-2">do not apply</a> to the element:
- <code id="week-state-(type=week):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="week-state-(type=week):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="week-state-(type=week):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="week-state-(type=week):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="week-state-(type=week):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="week-state-(type=week):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="week-state-(type=week):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="week-state-(type=week):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="week-state-(type=week):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="week-state-(type=week):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <h6 id="time-state-(type=time)">4.10.5.1.11 <dfn>Time</dfn> state (<code>type=time</code>)</h6>
-
- <p>When an <code id="time-state-(type=time):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="time-state-(type=time):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#time-state-(type=time)" id="time-state-(type=time):time-state-(type=time)">Time</a> state, the rules in this section apply.</p>
-
- <p>The <code id="time-state-(type=time):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="time-state-(type=time):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value">value</a> to a string representing a specific <a href=#concept-time id="time-state-(type=time):concept-time">time</a>.</p>
-
- <p>If the element is <i id="time-state-(type=time):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-time id="time-state-(type=time):concept-time-2">time</a> represented by its <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-time-string id="time-state-(type=time):parse-a-time-string">parsing a
- time</a> from it. User agents must not allow the user to set the <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-3">value</a> to a non-empty string that is not a <a href=#valid-time-string id="time-state-(type=time):valid-time-string">valid time
- string</a>. If the user agent provides a user interface for selecting a <a href=#concept-time id="time-state-(type=time):concept-time-3">time</a>, then the <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-4">value</a> must be set
- to a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-2">valid time string</a> representing the user's selection. User agents should allow
- the user to set the <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-3">valid time string</a>, the control is <a href=#suffering-from-bad-input id="time-state-(type=time):suffering-from-bad-input">suffering from bad
- input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="time-state-(type=time):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-4">valid time string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="time-state-(type=time):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-6">value</a> of the element is not a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-5">valid time string</a>, then
- set it to the empty string instead.</p>
- <p>The form control <a href=#has-a-periodic-domain id="time-state-(type=time):has-a-periodic-domain">has a periodic domain</a>.</p>
-
- <p>The <code id="time-state-(type=time):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-6">valid time string</a>. The <code id="time-state-(type=time):attr-input-max"><a href=#attr-input-max>max</a></code> attribute, if
- specified, must have a value that is a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-7">valid time string</a>.</p>
- <p>The <code id="time-state-(type=time):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. The <a href=#concept-input-step-scale id="time-state-(type=time):concept-input-step-scale">step scale factor</a> is 1000 (which
- converts the seconds to milliseconds, as used in the other algorithms). The <a href=#concept-input-step-default id="time-state-(type=time):concept-input-step-default">default step</a> is 60 seconds.</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="time-state-(type=time):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="time-state-(type=time):concept-fe-value-7">value</a> to the nearest <a href=#concept-time id="time-state-(type=time):concept-time-4">time</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="time-state-(type=time):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="time-state-(type=time):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-time-string id="time-state-(type=time):parse-a-time-string-2">parsing a time</a> from <var>input</var> results in an
- error, then return an error; otherwise, return the number of milliseconds elapsed from midnight to
- the parsed <a href=#concept-time id="time-state-(type=time):concept-time-5">time</a> on a day with no time changes.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="time-state-(type=time):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-time-string id="time-state-(type=time):valid-time-string-8">valid time string</a> that represents the <a href=#concept-time id="time-state-(type=time):concept-time-6">time</a> that is
- <var>input</var> milliseconds after midnight on a day with no time changes.</p>
- <p><strong>The <a href=#concept-input-value-string-date id="time-state-(type=time):concept-input-value-string-date">algorithm to convert a string to a
- <code>Date</code> object</a>, given a string <var>input</var>, is as follows</strong>:
- If <a href=#parse-a-time-string id="time-state-(type=time):parse-a-time-string-3">parsing a time</a> from <var>input</var> results
- in an error, then return an error; otherwise, return <a href=#create-a-date-object id="time-state-(type=time):create-a-date-object">a new
- <code>Date</code> object</a> representing the parsed <a href=#concept-time id="time-state-(type=time):concept-time-7">time</a> in
- UTC on 1970-01-01.</p>
- <p><strong>The <a href=#concept-input-value-date-string id="time-state-(type=time):concept-input-value-date-string">algorithm to convert a
- <code>Date</code> object to a string</a>, given a <code id="time-state-(type=time):idl-date"><a href=#idl-date>Date</a></code> object <var>input</var>, is as follows</strong>: Return a <a href=#valid-time-string id="time-state-(type=time):valid-time-string-9">valid time string</a> that
- represents the UTC <a href=#concept-time id="time-state-(type=time):concept-time-8">time</a> component that is represented by <var>input</var>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="time-state-(type=time):the-input-element-3"><a href=#the-input-element>input</a></code> element content attributes, IDL attributes, and
- methods <a href=#concept-input-apply id="time-state-(type=time):concept-input-apply">apply</a> to the element:
- <code id="time-state-(type=time):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="time-state-(type=time):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="time-state-(type=time):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="time-state-(type=time):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="time-state-(type=time):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="time-state-(type=time):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="time-state-(type=time):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="time-state-(type=time):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="time-state-(type=time):dom-input-value"><a href=#dom-input-value>value</a></code>,
- <code id="time-state-(type=time):dom-input-valueasdate"><a href=#dom-input-valueasdate>valueAsDate</a></code>, and
- <code id="time-state-(type=time):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="time-state-(type=time):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="time-state-(type=time):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="time-state-(type=time):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-value id="time-state-(type=time):dom-input-value-value">value</a>.</p>
- <p>The <code id="time-state-(type=time):event-input-input"><a href=#event-input-input>input</a></code> and <code id="time-state-(type=time):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="time-state-(type=time):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="time-state-(type=time):do-not-apply">do not apply</a> to the
- element:
- <code id="time-state-(type=time):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="time-state-(type=time):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="time-state-(type=time):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="time-state-(type=time):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="time-state-(type=time):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="time-state-(type=time):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="time-state-(type=time):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="time-state-(type=time):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="time-state-(type=time):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="time-state-(type=time):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="time-state-(type=time):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="time-state-(type=time):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="time-state-(type=time):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="time-state-(type=time):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="time-state-(type=time):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="time-state-(type=time):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="time-state-(type=time):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="time-state-(type=time):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="time-state-(type=time):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="time-state-(type=time):do-not-apply-2">do not apply</a> to the element:
- <code id="time-state-(type=time):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="time-state-(type=time):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="time-state-(type=time):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="time-state-(type=time):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="time-state-(type=time):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="time-state-(type=time):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="time-state-(type=time):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="time-state-(type=time):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="time-state-(type=time):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="time-state-(type=time):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <h6 id="local-date-and-time-state-(type=datetime-local)">4.10.5.1.12 <dfn>Local Date and Time</dfn> state (<code>type=datetime-local</code>)</h6>
-
- <p>When an <code id="local-date-and-time-state-(type=datetime-local):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="local-date-and-time-state-(type=datetime-local):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#local-date-and-time-state-(type=datetime-local)" id="local-date-and-time-state-(type=datetime-local):local-date-and-time-state-(type=datetime-local)">Local Date and Time</a> state, the rules in
- this section apply.</p>
-
- <p>The <code id="local-date-and-time-state-(type=datetime-local):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="local-date-and-time-state-(type=datetime-local):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value">value</a> to a string representing a <a href=#concept-datetime-local id="local-date-and-time-state-(type=datetime-local):concept-datetime-local">local date and time</a>, with no time-zone offset
- information.</p>
-
- <p>If the element is <i id="local-date-and-time-state-(type=datetime-local):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the <a href=#concept-datetime-local id="local-date-and-time-state-(type=datetime-local):concept-datetime-local-2">date and time</a> represented by its
- <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-2">value</a>, as obtained by <a href=#parse-a-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):parse-a-local-date-and-time-string">parsing a date and time</a> from it. User agents must not allow the user to set
- the <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-3">value</a> to a non-empty string that is not a <a href=#valid-normalised-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-normalised-local-date-and-time-string">valid
- normalised local date and time string</a>. If the user agent provides a user interface for
- selecting a <a href=#concept-datetime-local id="local-date-and-time-state-(type=datetime-local):concept-datetime-local-3">local date and time</a>, then the <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-4">value</a> must be set to a <a href=#valid-normalised-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-normalised-local-date-and-time-string-2">valid normalised local date and time
- string</a> representing the user's selection. User agents should allow the user to set the
- <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-normalised-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-normalised-local-date-and-time-string-3">valid normalised local date and time string</a>, the control is
- <a href=#suffering-from-bad-input id="local-date-and-time-state-(type=datetime-local):suffering-from-bad-input">suffering from bad input</a>.</p>
-
- <p class=note>See the <a href=#input-author-notes>introduction section</a> for a discussion of
- the difference between the input format and submission format for date, time, and number form
- controls, and the <a href=#input-impl-notes>implementation notes</a>
- regarding localization of form controls.</p>
- <p>The <code id="local-date-and-time-state-(type=datetime-local):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-local-date-and-time-string">valid local date and time string</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="local-date-and-time-state-(type=datetime-local):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-6">value</a> of the element is a <a href=#valid-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-local-date-and-time-string-2">valid local date and time
- string</a>, then set it to a <a href=#valid-normalised-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-normalised-local-date-and-time-string-4">valid normalised local date and time string</a>
- representing the same date and time; otherwise, set it to the empty string instead.</p>
-
- <p>The <code id="local-date-and-time-state-(type=datetime-local):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-local-date-and-time-string-3">valid local date and time string</a>. The <code id="local-date-and-time-state-(type=datetime-local):attr-input-max"><a href=#attr-input-max>max</a></code>
- attribute, if specified, must have a value that is a <a href=#valid-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-local-date-and-time-string-4">valid local date and time
- string</a>.</p>
- <p>The <code id="local-date-and-time-state-(type=datetime-local):attr-input-step"><a href=#attr-input-step>step</a></code> attribute is expressed in seconds. The <a href=#concept-input-step-scale id="local-date-and-time-state-(type=datetime-local):concept-input-step-scale">step scale factor</a> is 1000 (which
- converts the seconds to milliseconds, as used in the other algorithms). The <a href=#concept-input-step-default id="local-date-and-time-state-(type=datetime-local):concept-input-step-default">default step</a> is 60 seconds.</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="local-date-and-time-state-(type=datetime-local):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="local-date-and-time-state-(type=datetime-local):concept-fe-value-7">value</a> to the nearest <a href=#concept-datetime-local id="local-date-and-time-state-(type=datetime-local):concept-datetime-local-4">local date and time</a> for which the element would not <a href=#suffering-from-a-step-mismatch id="local-date-and-time-state-(type=datetime-local):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="local-date-and-time-state-(type=datetime-local):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If <a href=#parse-a-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):parse-a-local-date-and-time-string-2">parsing a date and time</a> from <var>input</var> results in an error, then return an error; otherwise, return the number of
- milliseconds elapsed from midnight on the morning of 1970-01-01 (the time represented by the value
- "<code>1970-01-01T00:00:00.0</code>") to the parsed <a href=#concept-datetime-local id="local-date-and-time-state-(type=datetime-local):concept-datetime-local-5">local date and time</a>, ignoring leap seconds.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="local-date-and-time-state-(type=datetime-local):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-normalised-local-date-and-time-string id="local-date-and-time-state-(type=datetime-local):valid-normalised-local-date-and-time-string-5">valid normalised local date and time string</a> that represents the date and time that is
- <var>input</var> milliseconds after midnight on the morning of 1970-01-01 (the time
- represented by the value "<code>1970-01-01T00:00:00.0</code>").</p>
-
- <p class=note>See <a href=#only-contemporary-times>the note on historical dates</a> in the
- <a href="#date-and-time-state-(type=datetime)" id="local-date-and-time-state-(type=datetime-local):date-and-time-state-(type=datetime)">Date and Time</a> state section.</p>
- <div class=bookkeeping>
- <p>The following common <code id="local-date-and-time-state-(type=datetime-local):the-input-element-3"><a href=#the-input-element>input</a></code> element content
- attributes, IDL attributes, and methods <a href=#concept-input-apply id="local-date-and-time-state-(type=datetime-local):concept-input-apply">apply</a> to the element:
- <code id="local-date-and-time-state-(type=datetime-local):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-value"><a href=#dom-input-value>value</a></code>, and
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="local-date-and-time-state-(type=datetime-local):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is
- in mode <a href=#dom-input-value-value id="local-date-and-time-state-(type=datetime-local):dom-input-value-value">value</a>.</p>
- <p>The <code id="local-date-and-time-state-(type=datetime-local):event-input-input"><a href=#event-input-input>input</a></code> and <code id="local-date-and-time-state-(type=datetime-local):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="local-date-and-time-state-(type=datetime-local):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="local-date-and-time-state-(type=datetime-local):do-not-apply">do not
- apply</a> to the element:
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="local-date-and-time-state-(type=datetime-local):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="local-date-and-time-state-(type=datetime-local):do-not-apply-2">do not apply</a> to the
- element:
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="local-date-and-time-state-(type=datetime-local):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="local-date-and-time-state-(type=datetime-local):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <div class=example>
- <p>The following example shows part of a flight booking application. The application uses an
- <code id="local-date-and-time-state-(type=datetime-local):the-input-element-4"><a href=#the-input-element>input</a></code> element with its <code id="local-date-and-time-state-(type=datetime-local):attr-input-type-2"><a href=#attr-input-type>type</a></code> attribute set to
- <code id="local-date-and-time-state-(type=datetime-local):local-date-and-time-state-(type=datetime-local)-2"><a href="#local-date-and-time-state-(type=datetime-local)">datetime-local</a></code>, and it then interprets the
- given date and time in the time zone of the selected airport.</p>
- <pre><fieldset>
- <legend>Destination</legend>
- <p><label>Airport: <input type=text name=to list=airports></label></p>
- <p><label>Departure time: <input type=datetime-local name=totime step=3600></label></p>
- </fieldset>
- <datalist id=airports>
- <option value=ATL label="Atlanta">
- <option value=MEM label="Memphis">
- <option value=LHR label="London Heathrow">
- <option value=LAX label="Los Angeles">
- <option value=FRA label="Frankfurt">
- </datalist></pre>
- <p>If the application instead used the <code id="local-date-and-time-state-(type=datetime-local):date-and-time-state-(type=datetime)-2"><a href="#date-and-time-state-(type=datetime)">datetime</a></code>
- type, then the user would have to work out the time-zone conversions himself, which is clearly
- not a good user experience!</p>
- </div>
- <h6 id="number-state-(type=number)">4.10.5.1.13 <dfn id=number-state>Number</dfn> state (<code>type=number</code>)</h6>
-
- <p>When an <code id="number-state-(type=number):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="number-state-(type=number):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#number-state-(type=number)" id="number-state-(type=number):number-state-(type=number)">Number</a> state, the rules in this section apply.</p>
-
- <p>The <code id="number-state-(type=number):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="number-state-(type=number):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value">value</a> to a string representing a number.</p>
-
- <p>If the element is <i id="number-state-(type=number):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the number represented by its <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-2">value</a>, as
- obtained from applying the <a href=#rules-for-parsing-floating-point-number-values id="number-state-(type=number):rules-for-parsing-floating-point-number-values">rules for parsing floating-point number values</a> to it. User
- agents must not allow the user to set the <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-3">value</a> to a
- non-empty string that is not a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number">valid floating-point number</a>. If the user agent
- provides a user interface for selecting a number, then the <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-4">value</a> must be set to the <a href=#best-representation-of-the-number-as-a-floating-point-number id="number-state-(type=number):best-representation-of-the-number-as-a-floating-point-number">best representation of the number representing the user's
- selection as a floating-point number</a>. User agents should allow the user to set the <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-2">valid floating-point number</a>, the control is <a href=#suffering-from-bad-input id="number-state-(type=number):suffering-from-bad-input">suffering
- from bad input</a>.</p>
-
- <p class=note>This specification does not define what user interface user agents are to use;
- user agent vendors are encouraged to consider what would best serve their users' needs. For
- example, a user agent in Persian or Arabic markets might support Persian and Arabic numeric input
- (converting it to the format required for submission as described above). Similarly, a user agent
- designed for Romans might display the value in Roman numerals rather than in decimal; or (more
- realistically) a user agent designed for the French market might display the value with
- apostrophes between thousands and commas before the decimals, and allow the user to enter a value
- in that manner, internally converting it to the submission format described above.</p>
- <p>The <code id="number-state-(type=number):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-3">valid floating-point number</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="number-state-(type=number):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-6">value</a> of the element is not a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-4">valid floating-point
- number</a>, then set it to the empty string instead.</p>
-
- <p>The <code id="number-state-(type=number):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-5">valid floating-point number</a>. The <code id="number-state-(type=number):attr-input-max"><a href=#attr-input-max>max</a></code> attribute,
- if specified, must have a value that is a <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-6">valid floating-point number</a>.</p>
- <p>The <a href=#concept-input-step-scale id="number-state-(type=number):concept-input-step-scale">step scale factor</a> is
- 1. The <a href=#concept-input-step-default id="number-state-(type=number):concept-input-step-default">default step</a> is 1 (allowing only
- integers to be selected by the user, unless the <a href=#concept-input-min-zero id="number-state-(type=number):concept-input-min-zero">step
- base</a> has a non-integer value).</p>
-
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="number-state-(type=number):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent may round the
- element's <a href=#concept-fe-value id="number-state-(type=number):concept-fe-value-7">value</a> to the nearest number for which the element
- would not <a href=#suffering-from-a-step-mismatch id="number-state-(type=number):suffering-from-a-step-mismatch-2">suffer from a step mismatch</a>. If
- there are two such numbers, user agents are encouraged to pick the one nearest positive
- infinity.</p>
- <p><strong>The <a href=#concept-input-value-string-number id="number-state-(type=number):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If applying the
- <a href=#rules-for-parsing-floating-point-number-values id="number-state-(type=number):rules-for-parsing-floating-point-number-values-2">rules for parsing floating-point number values</a> to <var>input</var> results
- in an error, then return an error; otherwise, return the resulting number.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="number-state-(type=number):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return a
- <a href=#valid-floating-point-number id="number-state-(type=number):valid-floating-point-number-7">valid floating-point number</a> that represents <var>input</var>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="number-state-(type=number):the-input-element-3"><a href=#the-input-element>input</a></code> element content attributes, IDL attributes, and
- methods <a href=#concept-input-apply id="number-state-(type=number):concept-input-apply">apply</a> to the element:
- <code id="number-state-(type=number):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="number-state-(type=number):attr-input-list"><a href=#attr-input-list>list</a></code>,
- <code id="number-state-(type=number):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="number-state-(type=number):attr-input-min-2"><a href=#attr-input-min>min</a></code>,
- <code id="number-state-(type=number):attr-input-placeholder"><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="number-state-(type=number):attr-input-readonly"><a href=#attr-input-readonly>readonly</a></code>,
- <code id="number-state-(type=number):attr-input-required"><a href=#attr-input-required>required</a></code>, and
- <code id="number-state-(type=number):attr-input-step"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="number-state-(type=number):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="number-state-(type=number):dom-input-value"><a href=#dom-input-value>value</a></code>, and
- <code id="number-state-(type=number):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="number-state-(type=number):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="number-state-(type=number):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="number-state-(type=number):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-value id="number-state-(type=number):dom-input-value-value">value</a>.</p>
- <p>The <code id="number-state-(type=number):event-input-input"><a href=#event-input-input>input</a></code> and <code id="number-state-(type=number):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="number-state-(type=number):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="number-state-(type=number):do-not-apply">do not apply</a> to the
- element:
- <code id="number-state-(type=number):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="number-state-(type=number):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="number-state-(type=number):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="number-state-(type=number):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="number-state-(type=number):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="number-state-(type=number):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="number-state-(type=number):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="number-state-(type=number):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="number-state-(type=number):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="number-state-(type=number):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="number-state-(type=number):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="number-state-(type=number):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="number-state-(type=number):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="number-state-(type=number):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="number-state-(type=number):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="number-state-(type=number):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="number-state-(type=number):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="number-state-(type=number):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="number-state-(type=number):do-not-apply-2">do not apply</a> to the element:
- <code id="number-state-(type=number):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="number-state-(type=number):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="number-state-(type=number):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="number-state-(type=number):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="number-state-(type=number):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="number-state-(type=number):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="number-state-(type=number):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="number-state-(type=number):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="number-state-(type=number):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="number-state-(type=number):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="number-state-(type=number):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- </div>
- <div class=example>
- <p>Here is an example of using a numeric input control:</p>
- <pre><label>How much do you want to charge? $<input type=number min=0 step=0.01 name=price></label></pre>
- <p>As described above, a user agent might support numeric input in the user's local format,
- converting it to the format required for submission as described above. This might include
- handling grouping separators (as in "872,000,000,000") and various decimal separators (such as
- "3,99" vs "3.99") or using local digits (such as those in Arabic, Devanagari, Persian, and
- Thai).</p>
- </div>
- <p class=note>The <code>type=number</code> state is not appropriate for input that
- happens to only consist of numbers but isn't strictly speaking a number. For example, it would be
- inappropriate for credit card numbers or US postal codes. A simple way of determining whether to
- use <code>type=number</code> is to consider whether it would make sense for the input
- control to have a spinbox interface (e.g. with "up" and "down" arrows). Getting a credit card
- number wrong by 1 in the last digit isn't a minor mistake, it's as wrong as getting every digit
- incorrect. So it would not make sense for the user to select a credit card number using "up" and
- "down" buttons. When a spinbox interface is not appropriate, <code>type=text</code> is
- probably the right choice (possibly with a <code id="number-state-(type=number):attr-input-pattern-2"><a href=#attr-input-pattern>pattern</a></code>
- attribute).</p>
- <h6 id="range-state-(type=range)">4.10.5.1.14 <dfn>Range</dfn> state (<code>type=range</code>)</h6>
-
- <p>When an <code id="range-state-(type=range):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="range-state-(type=range):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#range-state-(type=range)" id="range-state-(type=range):range-state-(type=range)">Range</a> state, the rules in this section apply.</p>
-
- <p>How the <a href="#range-state-(type=range)" id="range-state-(type=range):range-state-(type=range)-2">Range</a> state operates depends on whether the
- <code id="range-state-(type=range):attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute is specified or not.</p>
- <dl class=switch><dt>When the <code id="range-state-(type=range):attr-input-multiple-2"><a href=#attr-input-multiple>multiple</a></code> attribute is not specified on the
- element<dd>
- <p>The <code id="range-state-(type=range):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="range-state-(type=range):represents">represents</a> a control for setting the element's
- <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value">value</a> to a string representing a number, but with the
- caveat that the exact value is not important, letting UAs provide a simpler interface than they
- do for the <a href="#number-state-(type=number)" id="range-state-(type=range):number-state-(type=number)">Number</a> state.</p>
-
- <p>If the element is <i id="range-state-(type=range):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the number represented by its <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-2">value</a>, as
- obtained from applying the <a href=#rules-for-parsing-floating-point-number-values id="range-state-(type=range):rules-for-parsing-floating-point-number-values">rules for parsing floating-point number values</a> to it.
- User agents must not allow the user to set the <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-3">value</a> to a
- string that is not a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number">valid floating-point number</a>. If the user agent provides a user
- interface for selecting a number, then the <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-4">value</a> must be
- set to a <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number">best
- representation of the number representing the user's selection as a floating-point
- number</a>. User agents must not allow the user to set the <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-5">value</a> to the empty string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the
- user agent cannot convert to a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-2">valid floating-point number</a>, the control is
- <a href=#suffering-from-bad-input id="range-state-(type=range):suffering-from-bad-input">suffering from bad input</a>.</p>
-
- <p>The <code id="range-state-(type=range):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value
- that is a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-3">valid floating-point number</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="range-state-(type=range):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-6">value</a> of the element is not a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-4">valid floating-point
- number</a>, then set it to the <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-2">best representation, as a floating-point number</a>, of the <a href=#concept-input-value-default-range id="range-state-(type=range):concept-input-value-default-range">default value</a>.</p>
-
- <p>The <dfn id=concept-input-value-default-range>default value</dfn> is the <a href=#concept-input-min id="range-state-(type=range):concept-input-min">minimum</a> plus half the difference between the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-2">minimum</a> and the <a href=#concept-input-max id="range-state-(type=range):concept-input-max">maximum</a>, unless the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-2">maximum</a> is less than the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-3">minimum</a>, in which case the <a href=#concept-input-value-default-range id="range-state-(type=range):concept-input-value-default-range-2">default value</a> is the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-4">minimum</a>.</p>
-
- <p>When the element is <a href=#suffering-from-an-underflow id="range-state-(type=range):suffering-from-an-underflow">suffering from an underflow</a>, the user agent must set the
- element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-7">value</a> to the <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-3">best representation, as a floating-point
- number</a>, of the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-5">minimum</a>.</p>
- <p>When the element is <a href=#suffering-from-an-overflow id="range-state-(type=range):suffering-from-an-overflow">suffering from an overflow</a>, if the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-3">maximum</a> is not less than the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-6">minimum</a>, the user agent must set the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-8">value</a> to a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-5">valid floating-point number</a> that
- represents the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-4">maximum</a>.</p>
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="range-state-(type=range):suffering-from-a-step-mismatch">suffering from a step mismatch</a>, the user agent must round
- the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-9">value</a> to the nearest number for which the
- element would not <a href=#suffering-from-a-step-mismatch id="range-state-(type=range):suffering-from-a-step-mismatch-2">suffer from a step
- mismatch</a>, and which is greater than or equal to the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-7">minimum</a>, and, if the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-5">maximum</a> is not less than the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-8">minimum</a>, which is less than or equal to the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-6">maximum</a>, if there is a number that matches these constraints.
- If two numbers match these constraints, then user agents must use the one nearest to positive
- infinity.</p>
- <p class=example>For example, the markup
- <code><input type="range" min=0 max=100 step=20 value=50></code>
- results in a range control whose initial value is 60.</p>
-
- <div class=example>
- <p>Here is an example of a range control using an autocomplete list with the <code id="range-state-(type=range):attr-input-list"><a href=#attr-input-list>list</a></code> attribute. This could be useful if there are values along
- the full range of the control that are especially important, such as preconfigured light levels
- or typical speed limits in a range control used as a speed control. The following markup
- fragment:</p>
- <pre><input type="range" min="-100" max="100" value="0" step="10" name="power" list="powers">
- <datalist id="powers">
- <option value="0">
- <option value="-30">
- <option value="30">
- <span class=bad> <option value="++50"></span>
- </datalist>
- </pre>
- <p>...with the following style sheet applied:</p>
- <pre>input { height: 75px; width: 49px; background: #D5CCBB; color: black; }</pre>
- <p>...might render as:</p>
- <p><img src=http://images.whatwg.org/sample-range.png width=49 alt="A vertical slider control whose primary colour is black and whose background colour is beige, with the slider having five tick marks, one long one at each extremity, and three short ones clustered around the midpoint." height=75>
- <p>Note how the UA determined the orientation of the control from the ratio of the
- style-sheet-specified height and width properties. The colours were similarly derived from the
- style sheet. The tick marks, however, were derived from the markup. In particular, the <code id="range-state-(type=range):attr-input-step"><a href=#attr-input-step>step</a></code> attribute has not affected the placement of tick marks,
- the UA deciding to only use the author-specified completion values and then adding longer tick
- marks at the extremes.</p>
- <p>Note also how the invalid value <code>++50</code> was completely ignored.</p>
- </div>
- <div class=example>
- <p>For another example, consider the following markup fragment:</p>
- <pre><input name=x type=range min=100 max=700 step=9.09090909 value=509.090909></pre>
- <p>A user agent could display in a variety of ways, for instance:</p>
- <p><img src=http://images.whatwg.org/sample-range-2a.png width=231 alt="As a dial." height=57></p>
- <p>Or, alternatively, for instance:</p>
- <p><img src=http://images.whatwg.org/sample-range-2b.png width=445 alt="As a long horizontal slider with tick marks." height=56></p>
- <p>The user agent could pick which one to display based on the dimensions given in the style
- sheet. This would allow it to maintain the same resolution for the tick marks, despite the
- differences in width.</p>
- </div>
- <div class=example>
- <p>Finally, here is an example of a range control with two labeled values:</p>
- <pre><input type="range" name="a" list="a-values">
- <datalist id="a-values">
- <option value="10" label="Low">
- <option value="90" label="High">
- </datalist>
- </pre>
- <p>With styles that make the control draw vertically, it might look as follows:</p>
- <p><img src=http://images.whatwg.org/sample-range-labels.png width=103 alt="A vertical slider control with two tick marks, one near the top labeled 'High', and one near the bottom labeled 'Low'." height=164>
- </div>
- <dt>When the <code id="range-state-(type=range):attr-input-multiple-3"><a href=#attr-input-multiple>multiple</a></code> attribute <em>is</em> specified on
- the element<dd>
- <p>The <code id="range-state-(type=range):the-input-element-3"><a href=#the-input-element>input</a></code> element <a href=#represents id="range-state-(type=range):represents-2">represents</a> a control for setting the element's
- <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values">value<em>s</em></a> to two strings representing numbers, but
- with the caveat that the exact values are not important, enabling UAs provide a graphical
- interface rather than requiring the user to type the numbers directly.</p>
-
- <p>If the element is <i id="range-state-(type=range):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change either the first or second number represented by its <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-2">values</a>, as obtained from applying the <a href=#rules-for-parsing-floating-point-number-values id="range-state-(type=range):rules-for-parsing-floating-point-number-values-2">rules for parsing
- floating-point number values</a> to them, and ensuring that the first value is never larger
- than the second value. User agents must not allow the user to set either the first or second of
- the <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-3">values</a> to a string that is not a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-6">valid
- floating-point number</a>. If the user agent provides a user interface for selecting a
- number, then these <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-4">values</a> must be set to the <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-4">best representations of
- the numbers representing the user's selections as floating-point numbers</a>. User agents
- must not allow the user to set the <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-5">values</a> to the empty
- string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the
- user agent cannot convert to a pair of <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-7">valid
- floating-point numbers</a>, the control is <a href=#suffering-from-bad-input id="range-state-(type=range):suffering-from-bad-input-2">suffering from bad input</a>.</p>
-
- <p>The <code id="range-state-(type=range):attr-input-value-2"><a href=#attr-input-value>value</a></code> attribute, if specified, must have a value
- that is a pair of <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-8">valid floating-point numbers</a>
- separated by a single U+002C COMMA character (,).</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="range-state-(type=range):value-sanitization-algorithm-2">value sanitization algorithm</a> is as follows</strong>:</p>
- <ol><li><p><a href=#split-a-string-on-commas id="range-state-(type=range):split-a-string-on-commas">Split on commas</a> the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-10">value</a>.<li><p>If there are not exactly two values, or if either value is not a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-9">valid
- floating-point number</a>, then let the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-6">values</a> be a pair of values consisting of <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-5">a best representation, as a
- floating-point number</a>, of the element's <a href=#concept-input-min id="range-state-(type=range):concept-input-min-9">minimum</a>
- and the element's <a href=#concept-input-max id="range-state-(type=range):concept-input-max-7">maximum</a>, with the smaller value
- first.<li><p>Othwerwise, let the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-7">values</a> be the two
- values, with the smaller value first.<li><p>Let the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-11">value</a> be the result of
- concatenating the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-8">values</a>, separating them by
- a single U+002C COMMA character (,), with the lower value coming first.</ol>
- <p>Whenever the user changes the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-9">values</a>, the
- user agent must set the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-12">value</a> to the result of
- concatenating the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-10">values</a>, separating them by a
- single U+002C COMMA character (,), with the lower value coming first.</p>
-
-
- <p>When the element is <a href=#suffering-from-an-underflow id="range-state-(type=range):suffering-from-an-underflow-2">suffering from an underflow</a>, the user agent must set either
- of the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-11">values</a> that represent values less than
- the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-10">minimum</a> to the <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-6">best representation, as a floating-point number</a>,
- of the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-11">minimum</a>.</p>
- <p>When the element is <a href=#suffering-from-an-overflow id="range-state-(type=range):suffering-from-an-overflow-2">suffering from an overflow</a>, if the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-8">maximum</a> is not less than the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-12">minimum</a>, the user agent must set either of the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-12">values</a> that represent values greater than the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-9">maximum</a> to a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-10">valid floating-point number</a> that
- represents the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-10">maximum</a>.</p>
- <p>When the element is <a href=#suffering-from-a-step-mismatch id="range-state-(type=range):suffering-from-a-step-mismatch-3">suffering from a step mismatch</a>, the user agent must round
- the values represented by the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-13">values</a> to, in
- each case, the nearest number for which the element would not <a href=#suffering-from-a-step-mismatch id="range-state-(type=range):suffering-from-a-step-mismatch-4">suffer from a step mismatch</a>, and which is greater than or equal to the
- <a href=#concept-input-min id="range-state-(type=range):concept-input-min-13">minimum</a>, and, if the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-11">maximum</a> is not less than the <a href=#concept-input-min id="range-state-(type=range):concept-input-min-14">minimum</a>, which is less than or equal to the <a href=#concept-input-max id="range-state-(type=range):concept-input-max-12">maximum</a>, if there is a number that matches these constraints.
- If two numbers match these constraints, then user agents must use the one nearest to positive
- infinity.</p>
- <p>Whenever the user agent changes the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-14">values</a>
- according to the three previous paragraphs, the user agent must set the element's <a href=#concept-fe-value id="range-state-(type=range):concept-fe-value-13">value</a> to the result of concatenating the element's <a href=#concept-fe-values id="range-state-(type=range):concept-fe-values-15">values</a>, separating them by a single U+002C COMMA character
- (,), with the lower value coming first.</p>
-
- <div class=example>
- <p>Consider a user interface that filters possible flights by departure and arrival time:</p>
- <pre><form ...>
- <fieldset>
- <legend>Outbound flight time</legend>
- <select ...>
- <option>Departure
- <option>Arrival
- </select>
- <p><output name=o1>00:00</output> – <output name=o2>24:00</output></p>
- <input type=range multiple min=0 max=24 value=0,24 step=1.0 ...
- oninput="o1.value = valueLow + ':00'; o2.value = valueHigh + ':00'">
- </fieldset>
- ...
- </form></pre>
- <p>With appropriate styling, this might look like:</p>
- <img src=http://images.whatwg.org/sample-range-multiple.png alt="A control group with the label 'Outbound flight time', showing a drop-down that lets you select Departure vs Arrival, a two-handled range control that lets you set the start and end time of the range, and a label showing the currently selected times.">
- </div>
- </dl>
- <p>When the <code id="range-state-(type=range):attr-input-multiple-4"><a href=#attr-input-multiple>multiple</a></code> attribute is set or removed, the
- user agent must run the <a href=#value-sanitization-algorithm id="range-state-(type=range):value-sanitization-algorithm-3">value sanitization algorithm</a>.</p>
- <p class=note>In this state, the range and step constraints are enforced even during user input,
- and there is no way to set the value to the empty string.</p>
- <p>The <code id="range-state-(type=range):attr-input-min"><a href=#attr-input-min>min</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-11">valid floating-point number</a>. The <a href=#concept-input-min-default id="range-state-(type=range):concept-input-min-default">default
- minimum</a> is 0. The <code id="range-state-(type=range):attr-input-max"><a href=#attr-input-max>max</a></code> attribute, if specified, must
- have a value that is a <a href=#valid-floating-point-number id="range-state-(type=range):valid-floating-point-number-12">valid floating-point number</a>. The <a href=#concept-input-max-default id="range-state-(type=range):concept-input-max-default">default maximum</a> is 100.</p>
- <p>The <a href=#concept-input-step-scale id="range-state-(type=range):concept-input-step-scale">step scale factor</a> is
- 1. The <a href=#concept-input-step-default id="range-state-(type=range):concept-input-step-default">default step</a> is 1 (allowing only
- integers, unless the <code id="range-state-(type=range):attr-input-min-2"><a href=#attr-input-min>min</a></code> attribute has a non-integer
- value).</p>
-
- <p><strong>The <a href=#concept-input-value-string-number id="range-state-(type=range):concept-input-value-string-number">algorithm to convert a string to a
- number</a>, given a string <var>input</var>, is as follows</strong>: If applying the
- <a href=#rules-for-parsing-floating-point-number-values id="range-state-(type=range):rules-for-parsing-floating-point-number-values-3">rules for parsing floating-point number values</a> to <var>input</var> results
- in an error, then return an error; otherwise, return the resulting number.</p>
- <p><strong>The <a href=#concept-input-value-number-string id="range-state-(type=range):concept-input-value-number-string">algorithm to convert a number to a
- string</a>, given a number <var>input</var>, is as follows</strong>: Return the <a href=#best-representation-of-the-number-as-a-floating-point-number id="range-state-(type=range):best-representation-of-the-number-as-a-floating-point-number-7">best representation, as a
- floating-point number</a>, of <var>input</var>.</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="range-state-(type=range):the-input-element-4"><a href=#the-input-element>input</a></code> element content attributes, IDL attributes, and
- methods <a href=#concept-input-apply id="range-state-(type=range):concept-input-apply">apply</a> to the element:
- <code id="range-state-(type=range):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="range-state-(type=range):attr-input-list-2"><a href=#attr-input-list>list</a></code>,
- <code id="range-state-(type=range):attr-input-max-2"><a href=#attr-input-max>max</a></code>,
- <code id="range-state-(type=range):attr-input-min-3"><a href=#attr-input-min>min</a></code>,
- <code id="range-state-(type=range):attr-input-multiple-5"><a href=#attr-input-multiple>multiple</a></code>, and
- <code id="range-state-(type=range):attr-input-step-2"><a href=#attr-input-step>step</a></code> content attributes;
- <code id="range-state-(type=range):dom-input-list"><a href=#dom-input-list>list</a></code>,
- <code id="range-state-(type=range):dom-input-value"><a href=#dom-input-value>value</a></code>, and
- <code id="range-state-(type=range):dom-input-valueasnumber"><a href=#dom-input-valueasnumber>valueAsNumber</a></code> IDL attributes;
- <code id="range-state-(type=range):dom-input-stepdown"><a href=#dom-input-stepdown>stepDown()</a></code> and
- <code id="range-state-(type=range):dom-input-stepup"><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The following common <code id="range-state-(type=range):the-input-element-5"><a href=#the-input-element>input</a></code> IDL attribute <a href=#concept-input-apply id="range-state-(type=range):concept-input-apply-2">applies</a> to the element if the <code id="range-state-(type=range):attr-input-multiple-6" class=no-backref><a href=#attr-input-multiple>multiple</a></code> content attribute is not specified:
- <code id="range-state-(type=range):dom-input-valueasnumber-2"><a href=#dom-input-valueasnumber>valueAsNumber</a></code>.</p>
- <p>The following common <code id="range-state-(type=range):the-input-element-6"><a href=#the-input-element>input</a></code> IDL attributes <a href=#concept-input-apply id="range-state-(type=range):concept-input-apply-3">apply</a> to the element if the <code id="range-state-(type=range):attr-input-multiple-7" class=no-backref><a href=#attr-input-multiple>multiple</a></code> content attribute <em>is</em> specified:
- <code id="range-state-(type=range):dom-input-valuelow"><a href=#dom-input-valuelow>valueLow</a></code> and
- <code id="range-state-(type=range):dom-input-valuehigh"><a href=#dom-input-valuehigh>valueHigh</a></code>.</p>
- <p>The <code id="range-state-(type=range):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-value id="range-state-(type=range):dom-input-value-value">value</a>.</p>
- <p>The <code id="range-state-(type=range):event-input-input"><a href=#event-input-input>input</a></code> and <code id="range-state-(type=range):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="range-state-(type=range):concept-input-apply-4">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="range-state-(type=range):do-not-apply">do not apply</a> to the
- element:
- <code id="range-state-(type=range):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="range-state-(type=range):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="range-state-(type=range):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="range-state-(type=range):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="range-state-(type=range):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="range-state-(type=range):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="range-state-(type=range):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="range-state-(type=range):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="range-state-(type=range):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="range-state-(type=range):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="range-state-(type=range):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="range-state-(type=range):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="range-state-(type=range):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="range-state-(type=range):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="range-state-(type=range):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="range-state-(type=range):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="range-state-(type=range):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="range-state-(type=range):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="range-state-(type=range):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>, and
- <code id="range-state-(type=range):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="range-state-(type=range):do-not-apply-2">do not apply</a> to the element:
- <code id="range-state-(type=range):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="range-state-(type=range):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="range-state-(type=range):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="range-state-(type=range):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="range-state-(type=range):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="range-state-(type=range):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="range-state-(type=range):dom-input-valuelow-2" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="range-state-(type=range):dom-input-valuehigh-2" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="range-state-(type=range):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="range-state-(type=range):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and
- <code id="range-state-(type=range):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods.</p>
- <p>The following common <code id="range-state-(type=range):the-input-element-7"><a href=#the-input-element>input</a></code> IDL attributes <a href=#do-not-apply id="range-state-(type=range):do-not-apply-3">do not apply</a> to the
- element if the <code id="range-state-(type=range):attr-input-multiple-8" class=no-backref><a href=#attr-input-multiple>multiple</a></code> content
- attribute is not specified:
- <code id="range-state-(type=range):dom-input-valuelow-3" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code> and
- <code id="range-state-(type=range):dom-input-valuehigh-3" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code>.</p>
- <p>The following common <code id="range-state-(type=range):the-input-element-8"><a href=#the-input-element>input</a></code> IDL attribute <a href=#do-not-apply id="range-state-(type=range):do-not-apply-4">does not
- apply</a> to the element if the <code id="range-state-(type=range):attr-input-multiple-9" class=no-backref><a href=#attr-input-multiple>multiple</a></code> content attribute <em>is</em> specified:
- <code id="range-state-(type=range):dom-input-valueasnumber-3" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>.</p>
- </div>
- <h6 id="colour-state-(type=color)">4.10.5.1.15 <dfn>Colour</dfn> state (<code>type=color</code>)</h6>
-
- <p>When an <code id="colour-state-(type=color):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="colour-state-(type=color):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#colour-state-(type=color)" id="colour-state-(type=color):colour-state-(type=color)">Colour</a> state, the rules in this section apply.</p>
-
- <p>The <code id="colour-state-(type=color):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="colour-state-(type=color):represents">represents</a> a colour well control, for setting the
- element's <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value">value</a> to a string representing a <a href=#simple-colour id="colour-state-(type=color):simple-colour">simple
- colour</a>.</p>
-
- <p class=note>In this state, there is always a colour picked, and there is no way to set the
- value to the empty string.</p>
- <p>If the element is <i id="colour-state-(type=color):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the colour represented by its <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-2">value</a>, as
- obtained from applying the <a href=#rules-for-parsing-simple-colour-values id="colour-state-(type=color):rules-for-parsing-simple-colour-values">rules for parsing simple colour values</a> to it. User agents
- must not allow the user to set the <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-3">value</a> to a string that is
- not a <a href=#valid-lowercase-simple-colour id="colour-state-(type=color):valid-lowercase-simple-colour">valid lowercase simple colour</a>. If the user agent provides a user interface for
- selecting a colour, then the <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-4">value</a> must be set to the result
- of using the <a href=#rules-for-serialising-simple-colour-values id="colour-state-(type=color):rules-for-serialising-simple-colour-values">rules for serialising simple colour values</a> to the user's selection. User
- agents must not allow the user to set the <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-5">value</a> to the empty
- string.</p>
- <p><strong>Constraint validation</strong>: While the user interface describes input that the user
- agent cannot convert to a <a href=#valid-lowercase-simple-colour id="colour-state-(type=color):valid-lowercase-simple-colour-2">valid lowercase simple colour</a>, the control is
- <a href=#suffering-from-bad-input id="colour-state-(type=color):suffering-from-bad-input">suffering from bad input</a>.</p>
-
- <p>The <code id="colour-state-(type=color):attr-input-value"><a href=#attr-input-value>value</a></code> attribute, if specified and not empty, must
- have a value that is a <a href=#valid-simple-colour id="colour-state-(type=color):valid-simple-colour">valid simple colour</a>.</p>
-
- <p><strong>The <a href=#value-sanitization-algorithm id="colour-state-(type=color):value-sanitization-algorithm">value sanitization algorithm</a> is as follows</strong>: If the <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-6">value</a> of the element is a <a href=#valid-simple-colour id="colour-state-(type=color):valid-simple-colour-2">valid simple colour</a>, then
- set it to the <a href=#concept-fe-value id="colour-state-(type=color):concept-fe-value-7">value</a> of the element <a href=#converted-to-ascii-lowercase id="colour-state-(type=color):converted-to-ascii-lowercase">converted to ASCII
- lowercase</a>; otherwise, set it to the string "<code>#000000</code>".</p>
-
- <div class=bookkeeping>
- <p>The following common <code id="colour-state-(type=color):the-input-element-3"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="colour-state-(type=color):concept-input-apply">apply</a> to the element:
- <code id="colour-state-(type=color):attr-fe-autocomplete"><a href=#attr-fe-autocomplete>autocomplete</a></code> and
- <code id="colour-state-(type=color):attr-input-list"><a href=#attr-input-list>list</a></code> content attributes;
- <code id="colour-state-(type=color):dom-input-list"><a href=#dom-input-list>list</a></code> and
- <code id="colour-state-(type=color):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
- <p>The <code id="colour-state-(type=color):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-value id="colour-state-(type=color):dom-input-value-value">value</a>.</p>
- <p>The <code id="colour-state-(type=color):event-input-input"><a href=#event-input-input>input</a></code> and <code id="colour-state-(type=color):event-input-change"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="colour-state-(type=color):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="colour-state-(type=color):do-not-apply">do not apply</a> to the
- element:
- <code id="colour-state-(type=color):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="colour-state-(type=color):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="colour-state-(type=color):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="colour-state-(type=color):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="colour-state-(type=color):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="colour-state-(type=color):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="colour-state-(type=color):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="colour-state-(type=color):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="colour-state-(type=color):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="colour-state-(type=color):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="colour-state-(type=color):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="colour-state-(type=color):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="colour-state-(type=color):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="colour-state-(type=color):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="colour-state-(type=color):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="colour-state-(type=color):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="colour-state-(type=color):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="colour-state-(type=color):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="colour-state-(type=color):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="colour-state-(type=color):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="colour-state-(type=color):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="colour-state-(type=color):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="colour-state-(type=color):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="colour-state-(type=color):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="colour-state-(type=color):do-not-apply-2">do not apply</a> to the element:
- <code id="colour-state-(type=color):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="colour-state-(type=color):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="colour-state-(type=color):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="colour-state-(type=color):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="colour-state-(type=color):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="colour-state-(type=color):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="colour-state-(type=color):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="colour-state-(type=color):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="colour-state-(type=color):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="colour-state-(type=color):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="colour-state-(type=color):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="colour-state-(type=color):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="colour-state-(type=color):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="colour-state-(type=color):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="checkbox-state-(type=checkbox)">4.10.5.1.16 <dfn>Checkbox</dfn> state (<code>type=checkbox</code>)</h6>
-
- <p>When an <code id="checkbox-state-(type=checkbox):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="checkbox-state-(type=checkbox):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#checkbox-state-(type=checkbox)" id="checkbox-state-(type=checkbox):checkbox-state-(type=checkbox)">Checkbox</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="checkbox-state-(type=checkbox):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="checkbox-state-(type=checkbox):represents">represents</a> a two-state control that represents the
- element's <a href=#concept-fe-checked id="checkbox-state-(type=checkbox):concept-fe-checked">checkedness</a> state. If the element's <a href=#concept-fe-checked id="checkbox-state-(type=checkbox):concept-fe-checked-2">checkedness</a> state is true, the control represents a positive
- selection, and if it is false, a negative selection. If the element's <code id="checkbox-state-(type=checkbox):dom-input-indeterminate"><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is set to true, then the
- control's selection should be obscured as if the control was in a third, indeterminate, state.</p>
- <p class=note>The control is never a true tri-state control, even if the element's <code id="checkbox-state-(type=checkbox):dom-input-indeterminate-2"><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is set to true. The <code id="checkbox-state-(type=checkbox):dom-input-indeterminate-3"><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute only gives the appearance of a
- third state.</p>
-
- <p>If the element is <i id="checkbox-state-(type=checkbox):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, then: The <a href=#pre-click-activation-steps id="checkbox-state-(type=checkbox):pre-click-activation-steps">pre-click
- activation steps</a> consist of setting the element's <a href=#concept-fe-checked id="checkbox-state-(type=checkbox):concept-fe-checked-3">checkedness</a> to its opposite value (i.e. true if it is false,
- false if it is true), and of setting the element's <code id="checkbox-state-(type=checkbox):dom-input-indeterminate-4"><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute to false. The <a href=#canceled-activation-steps id="checkbox-state-(type=checkbox):canceled-activation-steps">canceled
- activation steps</a> consist of setting the <a href=#concept-fe-checked id="checkbox-state-(type=checkbox):concept-fe-checked-4">checkedness</a> and the element's <code id="checkbox-state-(type=checkbox):dom-input-indeterminate-5"><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute back to the values they had
- before the <a href=#pre-click-activation-steps id="checkbox-state-(type=checkbox):pre-click-activation-steps-2">pre-click activation steps</a> were run. The <a href=#activation-behavior id="checkbox-state-(type=checkbox):activation-behavior">activation behavior</a>
- is to <a href=#fire-a-simple-event id="checkbox-state-(type=checkbox):fire-a-simple-event">fire a simple event</a> that bubbles named <code id="checkbox-state-(type=checkbox):event-input-input"><a href=#event-input-input>input</a></code> at the element and then <a href=#fire-a-simple-event id="checkbox-state-(type=checkbox):fire-a-simple-event-2">fire a simple event</a>
- that bubbles named <code id="checkbox-state-(type=checkbox):event-input-change"><a href=#event-input-change>change</a></code> at the element. </p>
- <p>If the element is not <i id="checkbox-state-(type=checkbox):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="checkbox-state-(type=checkbox):activation-behavior-2">activation
- behavior</a>.</p>
- <p><strong>Constraint validation</strong>: If the element is <i id="checkbox-state-(type=checkbox):concept-input-required"><a href=#concept-input-required>required</a></i> and its <a href=#concept-fe-checked id="checkbox-state-(type=checkbox):concept-fe-checked-5">checkedness</a> is false, then the element is <a href=#suffering-from-being-missing id="checkbox-state-(type=checkbox):suffering-from-being-missing">suffering from
- being missing</a>.</p>
-
- <dl class=domintro><dt><var>input</var> . <code id="checkbox-state-(type=checkbox):dom-input-indeterminate-6"><a href=#dom-input-indeterminate>indeterminate</a></code> [ = <var>value</var> ]<dd>
- <p>When set, overrides the rendering of <a href="#checkbox-state-(type=checkbox)" id="checkbox-state-(type=checkbox):checkbox-state-(type=checkbox)-2">checkbox</a>
- controls so that the current value is not visible.</p>
- </dl>
- <div class=bookkeeping>
- <p>The following common <code id="checkbox-state-(type=checkbox):the-input-element-3"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="checkbox-state-(type=checkbox):concept-input-apply">apply</a> to the element:
- <code id="checkbox-state-(type=checkbox):attr-input-checked"><a href=#attr-input-checked>checked</a></code>, and
- <code id="checkbox-state-(type=checkbox):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
- <code id="checkbox-state-(type=checkbox):dom-input-checked"><a href=#dom-input-checked>checked</a></code> and
- <code id="checkbox-state-(type=checkbox):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
- <p>The <code id="checkbox-state-(type=checkbox):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-default-on id="checkbox-state-(type=checkbox):dom-input-value-default-on">default/on</a>.</p>
- <p>The <code id="checkbox-state-(type=checkbox):event-input-input-2"><a href=#event-input-input>input</a></code> and <code id="checkbox-state-(type=checkbox):event-input-change-2"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="checkbox-state-(type=checkbox):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="checkbox-state-(type=checkbox):do-not-apply">do not apply</a> to the
- element:
- <code id="checkbox-state-(type=checkbox):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="checkbox-state-(type=checkbox):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="checkbox-state-(type=checkbox):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="checkbox-state-(type=checkbox):do-not-apply-2">do not apply</a> to the element:
- <code id="checkbox-state-(type=checkbox):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="checkbox-state-(type=checkbox):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="checkbox-state-(type=checkbox):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="checkbox-state-(type=checkbox):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="radio-button-state-(type=radio)">4.10.5.1.17 <dfn>Radio Button</dfn> state (<code>type=radio</code>)</h6>
-
- <p>When an <code id="radio-button-state-(type=radio):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="radio-button-state-(type=radio):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#radio-button-state-(type=radio)" id="radio-button-state-(type=radio):radio-button-state-(type=radio)">Radio Button</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="radio-button-state-(type=radio):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="radio-button-state-(type=radio):represents">represents</a> a control that, when used in conjunction
- with other <code id="radio-button-state-(type=radio):the-input-element-3"><a href=#the-input-element>input</a></code> elements, forms a <i id="radio-button-state-(type=radio):radio-button-group"><a href=#radio-button-group>radio button group</a></i> in which only one
- control can have its <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked">checkedness</a> state set to true. If
- the element's <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-2">checkedness</a> state is true, the control
- represents the selected control in the group, and if it is false, it indicates a control in the
- group that is not selected.</p>
- <p>The <dfn id=radio-button-group><i>radio button group</i></dfn> that contains an <code id="radio-button-state-(type=radio):the-input-element-4"><a href=#the-input-element>input</a></code> element
- <var>a</var> also contains all the other <code id="radio-button-state-(type=radio):the-input-element-5"><a href=#the-input-element>input</a></code> elements <var>b</var> that fulfill all
- of the following conditions:</p>
- <ul><li>The <code id="radio-button-state-(type=radio):the-input-element-6"><a href=#the-input-element>input</a></code> element <var>b</var>'s <code id="radio-button-state-(type=radio):attr-input-type-2"><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="radio-button-state-(type=radio):radio-button-state-(type=radio)-2">Radio
- Button</a> state.<li>Either <var>a</var> and <var>b</var> have the same <a href=#form-owner id="radio-button-state-(type=radio):form-owner">form owner</a>,
- or they both have no <a href=#form-owner id="radio-button-state-(type=radio):form-owner-2">form owner</a>.<li>Both <var>a</var> and <var>b</var> are in the same <a href=#home-subtree id="radio-button-state-(type=radio):home-subtree">home
- subtree</a>.<li>They both have a <code id="radio-button-state-(type=radio):attr-fe-name"><a href=#attr-fe-name>name</a></code> attribute, their <code id="radio-button-state-(type=radio):attr-fe-name-2"><a href=#attr-fe-name>name</a></code> attributes are not empty, and the value of <var>a</var>'s <code id="radio-button-state-(type=radio):attr-fe-name-3"><a href=#attr-fe-name>name</a></code> attribute is a <a href=#compatibility-caseless id="radio-button-state-(type=radio):compatibility-caseless">compatibility
- caseless</a> match for the value of <var>b</var>'s <code id="radio-button-state-(type=radio):attr-fe-name-4"><a href=#attr-fe-name>name</a></code> attribute.</ul>
- <p>A document must not contain an <code id="radio-button-state-(type=radio):the-input-element-7"><a href=#the-input-element>input</a></code> element whose <i id="radio-button-state-(type=radio):radio-button-group-2"><a href=#radio-button-group>radio button group</a></i>
- contains only that element.</p>
-
- <p>When any of the following phenomena occur, if the element's <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-3">checkedness</a> state is true after the occurrence, the <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-4">checkedness</a> state of all the other elements in the same <i id="radio-button-state-(type=radio):radio-button-group-3"><a href=#radio-button-group>radio
- button group</a></i> must be set to false:</p>
- <ul><li>The element's <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-5">checkedness</a> state is set to true (for
- whatever reason).<li>The element's <code id="radio-button-state-(type=radio):attr-fe-name-5"><a href=#attr-fe-name>name</a></code> attribute is set, changed, or
- removed.<li>The element's <a href=#form-owner id="radio-button-state-(type=radio):form-owner-3">form owner</a> changes.<li><a href=#signal-a-type-change id="radio-button-state-(type=radio):signal-a-type-change">A type change is signalled</a> for the element.</ul>
- <p>If the element <var>R</var> is <i id="radio-button-state-(type=radio):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, then: The
- <a href=#pre-click-activation-steps id="radio-button-state-(type=radio):pre-click-activation-steps">pre-click activation steps</a> for <var>R</var> consist of getting a reference to the
- element in <var>R</var>'s <a href=#radio-button-group id="radio-button-state-(type=radio):radio-button-group-4">radio button group</a> that has its <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-6">checkedness</a> set to true, if any, and then setting
- <var>R</var>'s <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-7">checkedness</a> to true. The <a href=#canceled-activation-steps id="radio-button-state-(type=radio):canceled-activation-steps">canceled
- activation steps</a> for <var>R</var> consist of checking if the element to which a reference
- was obtained in the <a href=#pre-click-activation-steps id="radio-button-state-(type=radio):pre-click-activation-steps-2">pre-click activation steps</a>, if any, is still in what is now
- <var>R</var>'s <a href=#radio-button-group id="radio-button-state-(type=radio):radio-button-group-5">radio button group</a>, if it still has one, and if so, setting that
- element's <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-8">checkedness</a> to true; or else, if there was no
- such element, or that element is no longer in <var>R</var>'s <a href=#radio-button-group id="radio-button-state-(type=radio):radio-button-group-6">radio button group</a>, or
- if <var>R</var> no longer has a <a href=#radio-button-group id="radio-button-state-(type=radio):radio-button-group-7">radio button group</a>, setting <var>R</var>'s <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-9">checkedness</a> to false. The <a href=#activation-behavior id="radio-button-state-(type=radio):activation-behavior">activation behavior</a> for
- <var>R</var> is to <a href=#fire-a-simple-event id="radio-button-state-(type=radio):fire-a-simple-event">fire a simple event</a> that bubbles named <code id="radio-button-state-(type=radio):event-input-input"><a href=#event-input-input>input</a></code> at <var>R</var> and then <a href=#fire-a-simple-event id="radio-button-state-(type=radio):fire-a-simple-event-2">fire a simple event</a>
- that bubbles named <code id="radio-button-state-(type=radio):event-input-change"><a href=#event-input-change>change</a></code> at <var>R</var>. </p>
-
- <p>If the element is not <i id="radio-button-state-(type=radio):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="radio-button-state-(type=radio):activation-behavior-2">activation
- behavior</a>.</p>
- <p><strong>Constraint validation</strong>: If an element in the <i id="radio-button-state-(type=radio):radio-button-group-8"><a href=#radio-button-group>radio button group</a></i> is <i id="radio-button-state-(type=radio):concept-input-required"><a href=#concept-input-required>required</a></i>, and all of the <code id="radio-button-state-(type=radio):the-input-element-8"><a href=#the-input-element>input</a></code> elements in the
- <i id="radio-button-state-(type=radio):radio-button-group-9"><a href=#radio-button-group>radio button group</a></i> have a <a href=#concept-fe-checked id="radio-button-state-(type=radio):concept-fe-checked-10">checkedness</a> that is
- false, then the element is <a href=#suffering-from-being-missing id="radio-button-state-(type=radio):suffering-from-being-missing">suffering from being missing</a>.</p>
-
- <p class=note>If none of the radio buttons in a <a href=#radio-button-group id="radio-button-state-(type=radio):radio-button-group-10">radio button group</a> are checked when
- they are inserted into the document, then they will all be initially unchecked in the interface,
- until such time as one of them is checked (either by the user or by script).</p>
- <div class=bookkeeping>
- <p>The following common <code id="radio-button-state-(type=radio):the-input-element-9"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="radio-button-state-(type=radio):concept-input-apply">apply</a> to the element:
- <code id="radio-button-state-(type=radio):attr-input-checked"><a href=#attr-input-checked>checked</a></code> and
- <code id="radio-button-state-(type=radio):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
- <code id="radio-button-state-(type=radio):dom-input-checked"><a href=#dom-input-checked>checked</a></code> and
- <code id="radio-button-state-(type=radio):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
- <p>The <code id="radio-button-state-(type=radio):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-default-on id="radio-button-state-(type=radio):dom-input-value-default-on">default/on</a>.</p>
- <p>The <code id="radio-button-state-(type=radio):event-input-input-2"><a href=#event-input-input>input</a></code> and <code id="radio-button-state-(type=radio):event-input-change-2"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="radio-button-state-(type=radio):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="radio-button-state-(type=radio):do-not-apply">do not apply</a> to the
- element:
- <code id="radio-button-state-(type=radio):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="radio-button-state-(type=radio):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="radio-button-state-(type=radio):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="radio-button-state-(type=radio):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="radio-button-state-(type=radio):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="radio-button-state-(type=radio):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="radio-button-state-(type=radio):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="radio-button-state-(type=radio):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="radio-button-state-(type=radio):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="radio-button-state-(type=radio):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="radio-button-state-(type=radio):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="radio-button-state-(type=radio):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="radio-button-state-(type=radio):do-not-apply-2">do not apply</a> to the element:
- <code id="radio-button-state-(type=radio):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="radio-button-state-(type=radio):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="radio-button-state-(type=radio):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="radio-button-state-(type=radio):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="radio-button-state-(type=radio):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="radio-button-state-(type=radio):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="radio-button-state-(type=radio):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="radio-button-state-(type=radio):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="radio-button-state-(type=radio):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="radio-button-state-(type=radio):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="radio-button-state-(type=radio):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="radio-button-state-(type=radio):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="radio-button-state-(type=radio):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="radio-button-state-(type=radio):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="file-upload-state-(type=file)">4.10.5.1.18 <dfn>File Upload</dfn> state (<code>type=file</code>)</h6>
-
-
- <p>When an <code id="file-upload-state-(type=file):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="file-upload-state-(type=file):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#file-upload-state-(type=file)" id="file-upload-state-(type=file):file-upload-state-(type=file)">File Upload</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="file-upload-state-(type=file):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="file-upload-state-(type=file):represents">represents</a> a list of <dfn id=concept-input-type-file-selected>selected files</dfn>, each file consisting of a file
- name, a file type, and a file body (the contents of the file).</p>
-
- <p>File names must not contain <a href=#concept-input-file-path id="file-upload-state-(type=file):concept-input-file-path">path components</a>, even
- in the case that a user has selected an entire directory hierarchy or multiple files with the same
- name from different directories. <dfn id=concept-input-file-path>Path components</dfn>, for
- the purposes of the <a href="#file-upload-state-(type=file)" id="file-upload-state-(type=file):file-upload-state-(type=file)-2">File Upload</a> state, are those parts
- of file names that are separated by U+005C REVERSE SOLIDUS character (\) characters.</p>
- <p>Unless the <code id="file-upload-state-(type=file):attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute is set, there must be
- no more than one file in the list of <a href=#concept-input-type-file-selected id="file-upload-state-(type=file):concept-input-type-file-selected">selected
- files</a>.</p>
- <p>If the element is <i id="file-upload-state-(type=file):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, then the element's
- <a href=#activation-behavior id="file-upload-state-(type=file):activation-behavior">activation behavior</a> is to run the following steps:</p>
- <ol><li><p>If the algorithm is not <a href=#allowed-to-show-a-popup id="file-upload-state-(type=file):allowed-to-show-a-popup">allowed to show a popup</a>, then abort these steps
- without doing anything else.<li><p>Return, but continue running these steps asynchronously.<li><p>Optionally, wait until any prior execution of this algorithm has terminated.</p>
- <li><p>Display a prompt to the user requesting that the user specify some files. If the <code id="file-upload-state-(type=file):attr-input-multiple-2"><a href=#attr-input-multiple>multiple</a></code> attribute is not set, there must be no more than one
- file selected; otherwise, any number may be selected. Files can be from the filesystem or created
- on the fly, e.g. a picture taken from a camera connected to the user's device.</p>
- <li><p>Wait for the user to have made their selection.<li><p><a href=#queue-a-task id="file-upload-state-(type=file):queue-a-task">Queue a task</a> to first update the element's <a href=#concept-input-type-file-selected id="file-upload-state-(type=file):concept-input-type-file-selected-2">selected files</a> so that it represents the user's
- selection, then <a href=#fire-a-simple-event id="file-upload-state-(type=file):fire-a-simple-event">fire a simple event</a> that bubbles named <code id="file-upload-state-(type=file):event-input-input"><a href=#event-input-input>input</a></code> at the <code id="file-upload-state-(type=file):the-input-element-3"><a href=#the-input-element>input</a></code> element, and finally <a href=#fire-a-simple-event id="file-upload-state-(type=file):fire-a-simple-event-2">fire
- a simple event</a> that bubbles named <code id="file-upload-state-(type=file):event-input-change"><a href=#event-input-change>change</a></code> at the
- <code id="file-upload-state-(type=file):the-input-element-4"><a href=#the-input-element>input</a></code> element.</ol>
- <p>If the element is <i id="file-upload-state-(type=file):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the
- user to change the files on the list in other ways also, e.g. adding or removing files by
- drag-and-drop. When the user does so, the user agent must <a href=#queue-a-task id="file-upload-state-(type=file):queue-a-task-2">queue a task</a> to first
- update the element's <a href=#concept-input-type-file-selected id="file-upload-state-(type=file):concept-input-type-file-selected-3">selected files</a> so that
- it represents the user's new selection, then <a href=#fire-a-simple-event id="file-upload-state-(type=file):fire-a-simple-event-3">fire a simple event</a> that bubbles named
- <code id="file-upload-state-(type=file):event-input-input-2"><a href=#event-input-input>input</a></code> at the <code id="file-upload-state-(type=file):the-input-element-5"><a href=#the-input-element>input</a></code> element, and finally
- <a href=#fire-a-simple-event id="file-upload-state-(type=file):fire-a-simple-event-4">fire a simple event</a> that bubbles named <code id="file-upload-state-(type=file):event-input-change-2"><a href=#event-input-change>change</a></code> at the <code id="file-upload-state-(type=file):the-input-element-6"><a href=#the-input-element>input</a></code> element.</p>
- <p>If the element is not <i id="file-upload-state-(type=file):concept-fe-mutable-3"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="file-upload-state-(type=file):activation-behavior-2">activation
- behavior</a> and the user agent must not allow the user to change the element's selection.</p>
- <p><strong>Constraint validation</strong>: If the element is <i id="file-upload-state-(type=file):concept-input-required"><a href=#concept-input-required>required</a></i> and the list of <a href=#concept-input-type-file-selected id="file-upload-state-(type=file):concept-input-type-file-selected-4">selected files</a> is empty, then the element is
- <a href=#suffering-from-being-missing id="file-upload-state-(type=file):suffering-from-being-missing">suffering from being missing</a>.</p>
-
- <hr>
- <p>The <dfn id=attr-input-accept><code>accept</code></dfn> attribute may be specified to
- provide user agents with a hint of what file types will be accepted.</p>
- <p>If specified, the attribute must consist of a <a href=#set-of-comma-separated-tokens id="file-upload-state-(type=file):set-of-comma-separated-tokens">set of comma-separated tokens</a>, each
- of which must be an <a href=#ascii-case-insensitive id="file-upload-state-(type=file):ascii-case-insensitive">ASCII case-insensitive</a> match for one of the following:</p>
- <dl><dt>The string "<code>audio/*</code>"<dd>Indicates that sound files are accepted.<dt>The string "<code>video/*</code>"<dd>Indicates that video files are accepted.<dt>The string "<code>image/*</code>"<dd>Indicates that image files are accepted.<dt>A <a href=#valid-mime-type-with-no-parameters id="file-upload-state-(type=file):valid-mime-type-with-no-parameters">valid MIME type with no parameters</a><dd>Indicates that files of the specified type are accepted.<dt>A string whose first character is a U+002E FULL STOP character (.)<dd>Indicates that files with the specified file extension are accepted.</dl>
- <p>The tokens must not be <a href=#ascii-case-insensitive id="file-upload-state-(type=file):ascii-case-insensitive-2">ASCII case-insensitive</a> matches for any of the other tokens
- (i.e. duplicates are not allowed). To obtain the list of tokens from the
- attribute, the user agent must <a href=#split-a-string-on-commas id="file-upload-state-(type=file):split-a-string-on-commas">split the attribute value on
- commas</a>.</p>
- <p>User agents may use the value of this attribute to display a more appropriate user interface
- than a generic file picker. For instance, given the value <code>image/*</code>, a user
- agent could offer the user the option of using a local camera or selecting a photograph from their
- photo collection; given the value <code>audio/*</code>, a user agent could offer the user
- the option of recording a clip using a headset microphone.</p>
-
- <p>User agents should prevent the user from selecting files that are not accepted by one (or more)
- of these tokens.</p>
-
- <p class=note>Authors are encouraged to specify both any MIME types and any corresponding
- extensions when looking for data in a specific format.</p>
- <div class=example>
- <p>For example, consider an application that converts Microsoft Word documents to Open Document
- Format files. Since Microsoft Word documents are described with a wide variety of MIME types and
- extensions, the site can list several, as follows:</p>
- <pre><input type="file" accept=".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document"></pre>
- <p>On platforms that only use file extensions to describe file types, the extensions listed here
- can be used to filter the allowed documents, while the MIME types can be used with the system's
- type registration table (mapping MIME types to extensions used by the system), if any, to
- determine any other extensions to allow. Similarly, on a system that does not have file names or
- extensions but labels documents with MIME types internally, the MIME types can be used to pick
- the allowed files, while the extensions can be used if the system has an extension registration
- table that maps known extensions to MIME types used by the system.</p>
- </div>
- <p class=warning>Extensions tend to be ambiguous (e.g. there are an untold number of formats
- that use the "<code>.dat</code>" extension, and users can typically quite easily rename
- their files to have a "<code>.doc</code>" extension even if they are not Microsoft Word
- documents), and MIME types tend to be unreliable (e.g. many formats have no formally registered
- types, and many formats are in practice labeled using a number of different MIME types). Authors
- are reminded that, as usual, data received from a client should be treated with caution, as it may
- not be in an expected format even if the user is not hostile and the user agent fully obeyed the
- <code id="file-upload-state-(type=file):attr-input-accept"><a href=#attr-input-accept>accept</a></code> attribute's requirements.</p>
- <div id=fakepath-srsly class=example>
- <p>For historical reasons, the <code id="file-upload-state-(type=file):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute prefixes
- the file name with the string "<code>C:\fakepath\</code>". Some legacy user agents
- actually included the full path (which was a security vulnerability). As a result of this,
- obtaining the file name from the <code id="file-upload-state-(type=file):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute in a
- backwards-compatible way is non-trivial. The following function extracts the file name in a
- suitably compatible manner:</p>
- <pre>function extractFilename(path) {
- if (path.substr(0, 12) == "C:\\fakepath\\")
- return path.substr(12); // modern browser
- var x;
- x = path.lastIndexOf('/');
- if (x >= 0) // Unix-based path
- return path.substr(x+1);
- x = path.lastIndexOf('\\');
- if (x >= 0) // Windows-based path
- return path.substr(x+1);
- return path; // just the file name
- }</pre>
- <p>This can be used as follows:</p>
- <pre><p><input type=file name=image onchange="updateFilename(this.value)"></p>
- <p>The name of the file you picked is: <span id="filename">(none)</span></p>
- <script>
- function updateFilename(path) {
- var name = extractFilename(path);
- document.getElementById('filename').textContent = name;
- }
- </script></pre>
-
- </div>
- <hr>
- <div class=bookkeeping>
- <p>The following common <code id="file-upload-state-(type=file):the-input-element-7"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="file-upload-state-(type=file):concept-input-apply">apply</a> to the element:
- <code id="file-upload-state-(type=file):attr-input-accept-2"><a href=#attr-input-accept>accept</a></code>,
- <code id="file-upload-state-(type=file):attr-input-multiple-3"><a href=#attr-input-multiple>multiple</a></code>, and
- <code id="file-upload-state-(type=file):attr-input-required"><a href=#attr-input-required>required</a></code> content attributes;
- <code id="file-upload-state-(type=file):dom-input-files"><a href=#dom-input-files>files</a></code> and
- <code id="file-upload-state-(type=file):dom-input-value-3"><a href=#dom-input-value>value</a></code> IDL attributes.</p>
- <p>The <code id="file-upload-state-(type=file):dom-input-value-4"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-filename id="file-upload-state-(type=file):dom-input-value-filename">filename</a>.</p>
- <p>The <code id="file-upload-state-(type=file):event-input-input-3"><a href=#event-input-input>input</a></code> and <code id="file-upload-state-(type=file):event-input-change-3"><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id="file-upload-state-(type=file):concept-input-apply-2">apply</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="file-upload-state-(type=file):do-not-apply">do not apply</a> to the
- element:
- <code id="file-upload-state-(type=file):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="file-upload-state-(type=file):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="file-upload-state-(type=file):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="file-upload-state-(type=file):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="file-upload-state-(type=file):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="file-upload-state-(type=file):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="file-upload-state-(type=file):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="file-upload-state-(type=file):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="file-upload-state-(type=file):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="file-upload-state-(type=file):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="file-upload-state-(type=file):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="file-upload-state-(type=file):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="file-upload-state-(type=file):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="file-upload-state-(type=file):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="file-upload-state-(type=file):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="file-upload-state-(type=file):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="file-upload-state-(type=file):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="file-upload-state-(type=file):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="file-upload-state-(type=file):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="file-upload-state-(type=file):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="file-upload-state-(type=file):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="file-upload-state-(type=file):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="file-upload-state-(type=file):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The element's <code id="file-upload-state-(type=file):attr-input-value"><a href=#attr-input-value>value</a></code> attribute must be omitted.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="file-upload-state-(type=file):do-not-apply-2">do not apply</a> to the element:
- <code id="file-upload-state-(type=file):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="file-upload-state-(type=file):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="file-upload-state-(type=file):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="file-upload-state-(type=file):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="file-upload-state-(type=file):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="file-upload-state-(type=file):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="file-upload-state-(type=file):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="file-upload-state-(type=file):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="file-upload-state-(type=file):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="file-upload-state-(type=file):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="file-upload-state-(type=file):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="file-upload-state-(type=file):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="file-upload-state-(type=file):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="file-upload-state-(type=file):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- </div>
- <h6 id="submit-button-state-(type=submit)">4.10.5.1.19 <dfn>Submit Button</dfn> state (<code>type=submit</code>)</h6>
-
- <p>When an <code id="submit-button-state-(type=submit):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="submit-button-state-(type=submit):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#submit-button-state-(type=submit)" id="submit-button-state-(type=submit):submit-button-state-(type=submit)">Submit Button</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="submit-button-state-(type=submit):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="submit-button-state-(type=submit):represents">represents</a> a button that, when activated, submits
- the form. If the element has a <code id="submit-button-state-(type=submit):attr-input-value"><a href=#attr-input-value>value</a></code>
- attribute, the button's label must be the value of that attribute; otherwise, it must be an
- implementation-defined string that means "Submit" or some such. The element is a <a href=#concept-button id="submit-button-state-(type=submit):concept-button">button</a>, specifically a <a href=#concept-submit-button id="submit-button-state-(type=submit):concept-submit-button">submit
- button</a>.
- <a href=#fingerprinting-vector id="submit-button-state-(type=submit):fingerprinting-vector" class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p class=note>Since the default label is implementation-defined, and the width of the button
- typically depends on the button's label, the button's width can leak a few bits of fingerprintable
- information. These bits are likely to be strongly correlated to the identity of the user agent and
- the user's locale.</p>
-
- <p>If the element is <i id="submit-button-state-(type=submit):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, then the element's
- <a href=#activation-behavior id="submit-button-state-(type=submit):activation-behavior">activation behavior</a> is as follows: if the element has a <a href=#form-owner id="submit-button-state-(type=submit):form-owner">form owner</a>,
- and the element's <a id="submit-button-state-(type=submit):node-document" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is <a href=#fully-active id="submit-button-state-(type=submit):fully-active">fully active</a>,
- <a href=#concept-form-submit id="submit-button-state-(type=submit):concept-form-submit">submit</a> the <a href=#form-owner id="submit-button-state-(type=submit):form-owner-2">form owner</a> from the
- <code id="submit-button-state-(type=submit):the-input-element-3"><a href=#the-input-element>input</a></code> element; otherwise, do nothing.</p>
- <p>If the element is not <i id="submit-button-state-(type=submit):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="submit-button-state-(type=submit):activation-behavior-2">activation
- behavior</a>.</p>
-
- <p>The <code id="submit-button-state-(type=submit):attr-fs-formaction"><a href=#attr-fs-formaction>formaction</a></code>, <code id="submit-button-state-(type=submit):attr-fs-formenctype"><a href=#attr-fs-formenctype>formenctype</a></code>, <code id="submit-button-state-(type=submit):attr-fs-formmethod"><a href=#attr-fs-formmethod>formmethod</a></code>, <code id="submit-button-state-(type=submit):attr-fs-formnovalidate"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code id="submit-button-state-(type=submit):attr-fs-formtarget"><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission id="submit-button-state-(type=submit):attributes-for-form-submission">attributes for form
- submission</a>.</p>
- <p class=note>The <code id="submit-button-state-(type=submit):attr-fs-formnovalidate-2"><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can be
- used to make submit buttons that do not trigger the constraint validation.</p>
- <div class=bookkeeping>
- <p>The following common <code id="submit-button-state-(type=submit):the-input-element-4"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="submit-button-state-(type=submit):concept-input-apply">apply</a> to the element:
- <code id="submit-button-state-(type=submit):attr-fs-formaction-2"><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="submit-button-state-(type=submit):attr-fs-formenctype-2"><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="submit-button-state-(type=submit):attr-fs-formmethod-2"><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="submit-button-state-(type=submit):attr-fs-formnovalidate-3"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and
- <code id="submit-button-state-(type=submit):attr-fs-formtarget-2"><a href=#attr-fs-formtarget>formtarget</a></code> content attributes;
- <code id="submit-button-state-(type=submit):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute.</p>
- <p>The <code id="submit-button-state-(type=submit):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-default id="submit-button-state-(type=submit):dom-input-value-default">default</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="submit-button-state-(type=submit):do-not-apply">do not apply</a> to the
- element:
- <code id="submit-button-state-(type=submit):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="submit-button-state-(type=submit):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="submit-button-state-(type=submit):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="submit-button-state-(type=submit):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="submit-button-state-(type=submit):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="submit-button-state-(type=submit):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="submit-button-state-(type=submit):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="submit-button-state-(type=submit):do-not-apply-2">do not apply</a> to the element:
- <code id="submit-button-state-(type=submit):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="submit-button-state-(type=submit):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="submit-button-state-(type=submit):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="submit-button-state-(type=submit):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="submit-button-state-(type=submit):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="submit-button-state-(type=submit):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="submit-button-state-(type=submit):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="submit-button-state-(type=submit):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="submit-button-state-(type=submit):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="submit-button-state-(type=submit):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="submit-button-state-(type=submit):event-input-input" class=no-backref><a href=#event-input-input>input</a></code> and <code id="submit-button-state-(type=submit):event-input-change" class=no-backref><a href=#event-input-change>change</a></code> events <a href=#do-not-apply id="submit-button-state-(type=submit):do-not-apply-3">do not apply</a>.</p>
- </div>
- <h6 id="image-button-state-(type=image)">4.10.5.1.20 <dfn>Image Button</dfn> state (<code>type=image</code>)</h6>
-
- <p>When an <code id="image-button-state-(type=image):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="image-button-state-(type=image):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#image-button-state-(type=image)" id="image-button-state-(type=image):image-button-state-(type=image)">Image Button</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="image-button-state-(type=image):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="image-button-state-(type=image):represents">represents</a> either an image from which a user can
- select a coordinate and submit the form, or alternatively a button from which the user can submit
- the form. The element is a <a href=#concept-button id="image-button-state-(type=image):concept-button">button</a>, specifically a <a href=#concept-submit-button id="image-button-state-(type=image):concept-submit-button">submit button</a>.</p>
- <p class=note>The coordinate is sent to the server <a href=#constructing-the-form-data-set id="image-button-state-(type=image):constructing-the-form-data-set">during form submission</a> by sending two entries for the element, derived from the name
- of the control but with "<code>.x</code>" and "<code>.y</code>" appended to the
- name with the <var>x</var> and <var>y</var> components of the coordinate
- respectively.</p>
- <hr>
- <p>The image is given by the <dfn id=attr-input-src><code>src</code></dfn> attribute. The
- <code id="image-button-state-(type=image):attr-input-src"><a href=#attr-input-src>src</a></code> attribute must be present, and must contain a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id="image-button-state-(type=image):valid-non-empty-url-potentially-surrounded-by-spaces">valid
- non-empty URL potentially surrounded by spaces</a> referencing a non-interactive, optionally
- animated, image resource that is neither paged nor scripted.</p>
-
- <p>When any of the following events occur, unless the user agent cannot support images, or its
- support for images has been disabled, or the user agent only fetches elements on demand, or the
- <code id="image-button-state-(type=image):attr-input-src-2"><a href=#attr-input-src>src</a></code> attribute's value is the empty string, the user agent must
- <a href=#resolve-a-url id="image-button-state-(type=image):resolve-a-url">resolve</a> the value of the <code id="image-button-state-(type=image):attr-input-src-3"><a href=#attr-input-src>src</a></code> attribute, relative to the element, and if that is successful,
- must <a href=#fetch id="image-button-state-(type=image):fetch">fetch</a> the resulting <a href=#absolute-url id="image-button-state-(type=image):absolute-url">absolute URL</a>:</p>
- <ul><li>The <code id="image-button-state-(type=image):the-input-element-3"><a href=#the-input-element>input</a></code> element's <code id="image-button-state-(type=image):attr-input-type-2"><a href=#attr-input-type>type</a></code> attribute is first
- set to the <a href="#image-button-state-(type=image)" id="image-button-state-(type=image):image-button-state-(type=image)-2">Image Button</a> state (possibly when the
- element is first created), and the <code id="image-button-state-(type=image):attr-input-src-4"><a href=#attr-input-src>src</a></code> attribute is
- present.<li>The <code id="image-button-state-(type=image):the-input-element-4"><a href=#the-input-element>input</a></code> element's <code id="image-button-state-(type=image):attr-input-type-3"><a href=#attr-input-type>type</a></code> attribute is
- changed back to the <a href="#image-button-state-(type=image)" id="image-button-state-(type=image):image-button-state-(type=image)-3">Image Button</a> state, and the <code id="image-button-state-(type=image):attr-input-src-5"><a href=#attr-input-src>src</a></code> attribute is present, and its value has changed since the last
- time the <code id="image-button-state-(type=image):attr-input-type-4"><a href=#attr-input-type>type</a></code> attribute was in the <a href="#image-button-state-(type=image)" id="image-button-state-(type=image):image-button-state-(type=image)-4">Image Button</a> state.<li>The <code id="image-button-state-(type=image):the-input-element-5"><a href=#the-input-element>input</a></code> element's <code id="image-button-state-(type=image):attr-input-type-5"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#image-button-state-(type=image)" id="image-button-state-(type=image):image-button-state-(type=image)-5">Image Button</a> state, and the <code id="image-button-state-(type=image):attr-input-src-6"><a href=#attr-input-src>src</a></code> attribute is set or changed.</ul>
-
- <p>Fetching the image must <a href=#delay-the-load-event id="image-button-state-(type=image):delay-the-load-event">delay the load event</a> of the element's <a id="image-button-state-(type=image):node-document" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> until the
- <a href=#concept-task id="image-button-state-(type=image):concept-task">task</a> that is <a href=#queue-a-task id="image-button-state-(type=image):queue-a-task">queued</a> by the
- <a href=#networking-task-source id="image-button-state-(type=image):networking-task-source">networking task source</a> once the resource has been <a href=#fetch id="image-button-state-(type=image):fetch-2">fetched</a>
- (defined below) has been run.</p>
- <p>If the image was successfully obtained, with no network errors, and the image's type is a
- supported image type, and the image is a valid image of that type, then the image is said to be
- <dfn id=input-img-available><i>available</i></dfn>. If this is true before the image is
- completely downloaded, each <a href=#concept-task id="image-button-state-(type=image):concept-task-2">task</a> that is <a href=#queue-a-task id="image-button-state-(type=image):queue-a-task-2">queued</a> by the <a href=#networking-task-source id="image-button-state-(type=image):networking-task-source-2">networking task source</a> while the image is being <a href=#fetch id="image-button-state-(type=image):fetch-3">fetched</a> must update the presentation of the image appropriately.</p>
- <p>The user agent should apply the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id="image-button-state-(type=image):content-type-sniffing:-image" data-x-internal=content-type-sniffing:-image>image sniffing
- rules</a> to determine the type of the image, with the image's <a href=#content-type id="image-button-state-(type=image):content-type">associated Content-Type headers</a> giving the <var>official
- type</var>. If these rules are not applied, then the type of the image must be the type given by
- the image's <a href=#content-type id="image-button-state-(type=image):content-type-2">associated Content-Type headers</a>.</p>
- <p>User agents must not support non-image resources with the <code id="image-button-state-(type=image):the-input-element-6"><a href=#the-input-element>input</a></code> element. User
- agents must not run executable code embedded in the image resource. User agents must only display
- the first page of a multipage resource. User agents must not allow the resource to act in an
- interactive fashion, but should honor any animation in the resource.</p>
- <p>The <a href=#concept-task id="image-button-state-(type=image):concept-task-3">task</a> that is <a href=#queue-a-task id="image-button-state-(type=image):queue-a-task-3">queued</a> by
- the <a href=#networking-task-source id="image-button-state-(type=image):networking-task-source-3">networking task source</a> once the resource has been <a href=#fetch id="image-button-state-(type=image):fetch-4">fetched</a>, must, if the download was successful and the image is <i id="image-button-state-(type=image):input-img-available"><a href=#input-img-available>available</a></i>, <a href=#queue-a-task id="image-button-state-(type=image):queue-a-task-4">queue a task</a> to <a href=#fire-a-simple-event id="image-button-state-(type=image):fire-a-simple-event">fire a simple
- event</a> named <code id="image-button-state-(type=image):event-load"><a href=#event-load>load</a></code> at the <code id="image-button-state-(type=image):the-input-element-7"><a href=#the-input-element>input</a></code> element; and
- otherwise, if the fetching process fails without a response from the remote server, or completes
- but the image is not a valid or supported image, <a href=#queue-a-task id="image-button-state-(type=image):queue-a-task-5">queue a task</a> to <a href=#fire-a-simple-event id="image-button-state-(type=image):fire-a-simple-event-2">fire a simple
- event</a> named <code id="image-button-state-(type=image):event-error"><a href=#event-error>error</a></code> on the <code id="image-button-state-(type=image):the-input-element-8"><a href=#the-input-element>input</a></code> element.</p>
- <hr>
-
- <p>The <dfn id=attr-input-alt><code>alt</code></dfn> attribute provides the textual label for
- the button for users and user agents who cannot use the image. The <code id="image-button-state-(type=image):attr-input-alt"><a href=#attr-input-alt>alt</a></code> attribute must be present, and must contain a non-empty string
- giving the label that would be appropriate for an equivalent button if the image was
- unavailable.</p>
- <p>The <code id="image-button-state-(type=image):the-input-element-9"><a href=#the-input-element>input</a></code> element supports <a href=#dimension-attributes id="image-button-state-(type=image):dimension-attributes">dimension attributes</a>.</p>
-
- <hr>
- <p>If the <code id="image-button-state-(type=image):attr-input-src-7"><a href=#attr-input-src>src</a></code> attribute is set, and the image is <i id="image-button-state-(type=image):input-img-available-2"><a href=#input-img-available>available</a></i> and the user agent is configured to display that image,
- then: The element <a href=#represents id="image-button-state-(type=image):represents-2">represents</a> a control for selecting a <a href=#concept-input-type-image-coordinate id="image-button-state-(type=image):concept-input-type-image-coordinate">coordinate</a> from the image specified by the
- <code id="image-button-state-(type=image):attr-input-src-8"><a href=#attr-input-src>src</a></code> attribute; if the element is <i id="image-button-state-(type=image):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the user agent should allow the user to select this <a href=#concept-input-type-image-coordinate id="image-button-state-(type=image):concept-input-type-image-coordinate-2">coordinate</a>, and the element's <a href=#activation-behavior id="image-button-state-(type=image):activation-behavior">activation
- behavior</a> is as follows: if the element has a <a href=#form-owner id="image-button-state-(type=image):form-owner">form owner</a>, and the element's
- <a id="image-button-state-(type=image):node-document-2" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is <a href=#fully-active id="image-button-state-(type=image):fully-active">fully active</a>, take the user's selected <a href=#concept-input-type-image-coordinate id="image-button-state-(type=image):concept-input-type-image-coordinate-3">coordinate</a>, and <a href=#concept-form-submit id="image-button-state-(type=image):concept-form-submit">submit</a> the <code id="image-button-state-(type=image):the-input-element-10"><a href=#the-input-element>input</a></code> element's <a href=#form-owner id="image-button-state-(type=image):form-owner-2">form owner</a>
- from the <code id="image-button-state-(type=image):the-input-element-11"><a href=#the-input-element>input</a></code> element. If the user activates the control without explicitly
- selecting a coordinate, then the coordinate (0,0) must be assumed.</p>
- <p>Otherwise, the element <a href=#represents id="image-button-state-(type=image):represents-3">represents</a> a submit button whose label is given by the
- value of the <code id="image-button-state-(type=image):attr-input-alt-2"><a href=#attr-input-alt>alt</a></code> attribute; if the element is <i id="image-button-state-(type=image):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, then the element's <a href=#activation-behavior id="image-button-state-(type=image):activation-behavior-2">activation behavior</a> is as
- follows: if the element has a <a href=#form-owner id="image-button-state-(type=image):form-owner-3">form owner</a>, and the element's <a id="image-button-state-(type=image):node-document-3" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is
- <a href=#fully-active id="image-button-state-(type=image):fully-active-2">fully active</a>, set the <a href=#concept-input-type-image-coordinate id="image-button-state-(type=image):concept-input-type-image-coordinate-4">selected
- coordinate</a> to (0,0), and <a href=#concept-form-submit id="image-button-state-(type=image):concept-form-submit-2">submit</a> the
- <code id="image-button-state-(type=image):the-input-element-12"><a href=#the-input-element>input</a></code> element's <a href=#form-owner id="image-button-state-(type=image):form-owner-4">form owner</a> from the <code id="image-button-state-(type=image):the-input-element-13"><a href=#the-input-element>input</a></code> element.</p>
- <p>In either case, if the element is <i id="image-button-state-(type=image):concept-fe-mutable-3"><a href=#concept-fe-mutable>mutable</a></i> but has no
- <a href=#form-owner id="image-button-state-(type=image):form-owner-5">form owner</a> or the element's <a id="image-button-state-(type=image):node-document-4" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id="image-button-state-(type=image):fully-active-3">fully active</a>,
- then its <a href=#activation-behavior id="image-button-state-(type=image):activation-behavior-3">activation behavior</a> must be to do nothing. If the element is not <i id="image-button-state-(type=image):concept-fe-mutable-4"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="image-button-state-(type=image):activation-behavior-4">activation behavior</a>.</p>
- <p>The <dfn id=concept-input-type-image-coordinate>selected coordinate</dfn> must consist of
- an <var>x</var>-component and a <var>y</var>-component. The coordinates
- represent the position relative to the edge of the image, with the coordinate space having the
- positive <var>x</var> direction to the right, and the positive <var>y</var>
- direction downwards.</p>
- <p>The <var>x</var>-component must be a <a href=#valid-integer id="image-button-state-(type=image):valid-integer">valid integer</a> representing a number
- <var>x</var> in the range <span>−(<var>border<sub>left</sub></var>+<var>padding<sub>left</sub></var>) ≤ <var>x</var> ≤ <var>width</var>+<var>border<sub>right</sub></var>+<var>padding<sub>right</sub></var></span>, where <var>width</var> is the rendered width of the image, <var>border<sub>left</sub></var> is the width of the border on the left of the image, <var>padding<sub>left</sub></var> is the width of the padding on the left of the
- image, <var>border<sub>right</sub></var> is the width of the border on the right
- of the image, and <var>padding<sub>right</sub></var> is the width of the padding
- on the right of the image, with all dimensions given in CSS pixels.</p>
- <p>The <var>y</var>-component must be a <a href=#valid-integer id="image-button-state-(type=image):valid-integer-2">valid integer</a> representing a number
- <var>y</var> in the range <span>−(<var>border<sub>top</sub></var>+<var>padding<sub>top</sub></var>) ≤ <var>y</var> ≤ <var>height</var>+<var>border<sub>bottom</sub></var>+<var>padding<sub>bottom</sub></var></span>, where
- <var>height</var> is the rendered height of the image, <var>border<sub>top</sub></var> is the width of the border above the image, <var>padding<sub>top</sub></var> is the width of the padding above the image, <var>border<sub>bottom</sub></var> is the width of the border below the image, and <var>padding<sub>bottom</sub></var> is the width of the padding below the image, with
- all dimensions given in CSS pixels.</p>
- <p>Where a border or padding is missing, its width is zero CSS pixels.</p>
- <hr>
-
- <p>The <code id="image-button-state-(type=image):attr-fs-formaction"><a href=#attr-fs-formaction>formaction</a></code>, <code id="image-button-state-(type=image):attr-fs-formenctype"><a href=#attr-fs-formenctype>formenctype</a></code>, <code id="image-button-state-(type=image):attr-fs-formmethod"><a href=#attr-fs-formmethod>formmethod</a></code>, <code id="image-button-state-(type=image):attr-fs-formnovalidate"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code id="image-button-state-(type=image):attr-fs-formtarget"><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission id="image-button-state-(type=image):attributes-for-form-submission">attributes for form
- submission</a>.</p>
- <dl class=domintro><dt><var>image</var> . <code id="image-button-state-(type=image):dom-input-width"><a href=#dom-input-width>width</a></code> [ = <var>value</var> ]<dt><var>image</var> . <code id="image-button-state-(type=image):dom-input-height"><a href=#dom-input-height>height</a></code> [ = <var>value</var> ]<dd>
- <p>These attributes return the actual rendered dimensions of the image, or zero if the
- dimensions are not known.</p>
- <p>They can be set, to change the corresponding content attributes.</p>
- </dl>
- <div class=bookkeeping>
- <p>The following common <code id="image-button-state-(type=image):the-input-element-14"><a href=#the-input-element>input</a></code> element content attributes and IDL attributes <a href=#concept-input-apply id="image-button-state-(type=image):concept-input-apply">apply</a> to the element:
- <code id="image-button-state-(type=image):attr-input-alt-3"><a href=#attr-input-alt>alt</a></code>,
- <code id="image-button-state-(type=image):attr-fs-formaction-2"><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="image-button-state-(type=image):attr-fs-formenctype-2"><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="image-button-state-(type=image):attr-fs-formmethod-2"><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="image-button-state-(type=image):attr-fs-formnovalidate-2"><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="image-button-state-(type=image):attr-fs-formtarget-2"><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="image-button-state-(type=image):attr-dim-height"><a href=#attr-dim-height>height</a></code>,
- <code id="image-button-state-(type=image):attr-input-src-9"><a href=#attr-input-src>src</a></code>, and
- <code id="image-button-state-(type=image):attr-dim-width"><a href=#attr-dim-width>width</a></code> content attributes;
- <code id="image-button-state-(type=image):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute.</p>
- <p>The <code id="image-button-state-(type=image):dom-input-value-2"><a href=#dom-input-value>value</a></code> IDL attribute is in mode <a href=#dom-input-value-default id="image-button-state-(type=image):dom-input-value-default">default</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="image-button-state-(type=image):do-not-apply">do not apply</a> to the
- element:
- <code id="image-button-state-(type=image):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="image-button-state-(type=image):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="image-button-state-(type=image):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="image-button-state-(type=image):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="image-button-state-(type=image):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="image-button-state-(type=image):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="image-button-state-(type=image):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="image-button-state-(type=image):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="image-button-state-(type=image):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="image-button-state-(type=image):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="image-button-state-(type=image):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="image-button-state-(type=image):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="image-button-state-(type=image):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="image-button-state-(type=image):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="image-button-state-(type=image):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="image-button-state-(type=image):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>, and
- <code id="image-button-state-(type=image):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>.</p>
- <p>The element's <code id="image-button-state-(type=image):attr-input-value"><a href=#attr-input-value>value</a></code> attribute must be omitted.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="image-button-state-(type=image):do-not-apply-2">do not apply</a> to the element:
- <code id="image-button-state-(type=image):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="image-button-state-(type=image):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="image-button-state-(type=image):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="image-button-state-(type=image):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="image-button-state-(type=image):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="image-button-state-(type=image):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="image-button-state-(type=image):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="image-button-state-(type=image):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="image-button-state-(type=image):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="image-button-state-(type=image):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="image-button-state-(type=image):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="image-button-state-(type=image):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="image-button-state-(type=image):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="image-button-state-(type=image):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="image-button-state-(type=image):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="image-button-state-(type=image):event-input-input" class=no-backref><a href=#event-input-input>input</a></code> and <code id="image-button-state-(type=image):event-input-change" class=no-backref><a href=#event-input-change>change</a></code> events <a href=#do-not-apply id="image-button-state-(type=image):do-not-apply-3">do not apply</a>.</p>
- </div>
- <p class=note>Many aspects of this state's behavior are similar to the behavior of the
- <code id="image-button-state-(type=image):the-img-element"><a href=#the-img-element>img</a></code> element. Readers are encouraged to read that section, where many of the same
- requirements are described in more detail.</p>
- <div class=example>
- <p>Take the following form:</p>
- <pre><form action="process.cgi">
- <input type=image src=map.png name=where alt="Show location list">
- </form></pre>
- <p>If the user clicked on the image at coordinate (127,40) then the URL used to submit the form
- would be "<code>process.cgi?where.x=127&where.y=40</code>".</p>
- <p>(In this example, it's assumed that for users who don't see the map, and who instead just see
- a button labeled "Show location list", clicking the button will cause the server to show a list
- of locations to pick from instead of the map.)</p>
- </div>
- <h6 id="reset-button-state-(type=reset)">4.10.5.1.21 <dfn>Reset Button</dfn> state (<code>type=reset</code>)</h6>
-
- <p>When an <code id="reset-button-state-(type=reset):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="reset-button-state-(type=reset):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#reset-button-state-(type=reset)" id="reset-button-state-(type=reset):reset-button-state-(type=reset)">Reset Button</a> state, the rules in this section
- apply.</p>
-
- <p>The <code id="reset-button-state-(type=reset):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="reset-button-state-(type=reset):represents">represents</a> a button that, when activated, resets
- the form. If the element has a <code id="reset-button-state-(type=reset):attr-input-value"><a href=#attr-input-value>value</a></code>
- attribute, the button's label must be the value of that attribute; otherwise, it must be an
- implementation-defined string that means "Reset" or some such. The element is a <a href=#concept-button id="reset-button-state-(type=reset):concept-button">button</a>.
- <a href=#fingerprinting-vector id="reset-button-state-(type=reset):fingerprinting-vector" class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p class=note>Since the default label is implementation-defined, and the width of the button
- typically depends on the button's label, the button's width can leak a few bits of fingerprintable
- information. These bits are likely to be strongly correlated to the identity of the user agent and
- the user's locale.</p>
-
- <p>If the element is <i id="reset-button-state-(type=reset):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, then the element's
- <a href=#activation-behavior id="reset-button-state-(type=reset):activation-behavior">activation behavior</a>, if the element has a <a href=#form-owner id="reset-button-state-(type=reset):form-owner">form owner</a> and the element's
- <a id="reset-button-state-(type=reset):node-document" href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is <a href=#fully-active id="reset-button-state-(type=reset):fully-active">fully active</a>, is to <a href=#concept-form-reset id="reset-button-state-(type=reset):concept-form-reset">reset</a> the <a href=#form-owner id="reset-button-state-(type=reset):form-owner-2">form owner</a>; otherwise, it is to do
- nothing.</p>
- <p>If the element is not <i id="reset-button-state-(type=reset):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="reset-button-state-(type=reset):activation-behavior-2">activation
- behavior</a>.</p>
- <p><strong>Constraint validation</strong>: The element is <a href=#barred-from-constraint-validation id="reset-button-state-(type=reset):barred-from-constraint-validation">barred from constraint
- validation</a>.</p>
-
- <div class=bookkeeping>
- <p>The <code id="reset-button-state-(type=reset):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute <a href=#concept-input-apply id="reset-button-state-(type=reset):concept-input-apply">applies</a> to this element and is in mode <a href=#dom-input-value-default id="reset-button-state-(type=reset):dom-input-value-default">default</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="reset-button-state-(type=reset):do-not-apply">do not apply</a> to the
- element:
- <code id="reset-button-state-(type=reset):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="reset-button-state-(type=reset):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="reset-button-state-(type=reset):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="reset-button-state-(type=reset):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="reset-button-state-(type=reset):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="reset-button-state-(type=reset):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="reset-button-state-(type=reset):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="reset-button-state-(type=reset):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="reset-button-state-(type=reset):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="reset-button-state-(type=reset):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="reset-button-state-(type=reset):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="reset-button-state-(type=reset):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="reset-button-state-(type=reset):do-not-apply-2">do not apply</a> to the element:
- <code id="reset-button-state-(type=reset):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="reset-button-state-(type=reset):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="reset-button-state-(type=reset):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="reset-button-state-(type=reset):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="reset-button-state-(type=reset):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="reset-button-state-(type=reset):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="reset-button-state-(type=reset):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="reset-button-state-(type=reset):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="reset-button-state-(type=reset):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="reset-button-state-(type=reset):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="reset-button-state-(type=reset):event-input-input" class=no-backref><a href=#event-input-input>input</a></code> and <code id="reset-button-state-(type=reset):event-input-change" class=no-backref><a href=#event-input-change>change</a></code> events <a href=#do-not-apply id="reset-button-state-(type=reset):do-not-apply-3">do not apply</a>.</p>
- </div>
- <h6 id="button-state-(type=button)">4.10.5.1.22 <dfn>Button</dfn> state (<code>type=button</code>)</h6>
-
- <p>When an <code id="button-state-(type=button):the-input-element"><a href=#the-input-element>input</a></code> element's <code id="button-state-(type=button):attr-input-type"><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#button-state-(type=button)" id="button-state-(type=button):button-state-(type=button)">Button</a> state, the rules in this section apply.</p>
-
- <p>The <code id="button-state-(type=button):the-input-element-2"><a href=#the-input-element>input</a></code> element <a href=#represents id="button-state-(type=button):represents">represents</a> a button with no default behavior. A
- label for the button must be provided in the <code id="button-state-(type=button):attr-input-value"><a href=#attr-input-value>value</a></code>
- attribute, though it may be the empty string. If the element has a <code id="button-state-(type=button):attr-input-value-2"><a href=#attr-input-value>value</a></code> attribute, the button's label must be the value of that
- attribute; otherwise, it must be the empty string. The element is a <a href=#concept-button id="button-state-(type=button):concept-button">button</a>.</p>
-
- <p>If the element is <i id="button-state-(type=button):concept-fe-mutable"><a href=#concept-fe-mutable>mutable</a></i>, the element's <a href=#activation-behavior id="button-state-(type=button):activation-behavior">activation
- behavior</a> is to do nothing.</p>
- <p>If the element is not <i id="button-state-(type=button):concept-fe-mutable-2"><a href=#concept-fe-mutable>mutable</a></i>, it has no <a href=#activation-behavior id="button-state-(type=button):activation-behavior-2">activation
- behavior</a>.</p>
- <p><strong>Constraint validation</strong>: The element is <a href=#barred-from-constraint-validation id="button-state-(type=button):barred-from-constraint-validation">barred from constraint
- validation</a>.</p>
-
- <div class=bookkeeping>
- <p>The <code id="button-state-(type=button):dom-input-value"><a href=#dom-input-value>value</a></code> IDL attribute <a href=#concept-input-apply id="button-state-(type=button):concept-input-apply">applies</a> to this element and is in mode <a href=#dom-input-value-default id="button-state-(type=button):dom-input-value-default">default</a>.</p>
- <p>The following content attributes must not be specified and <a href=#do-not-apply id="button-state-(type=button):do-not-apply">do not apply</a> to the
- element:
- <code id="button-state-(type=button):attr-input-accept" class=no-backref><a href=#attr-input-accept>accept</a></code>,
- <code id="button-state-(type=button):attr-input-alt" class=no-backref><a href=#attr-input-alt>alt</a></code>,
- <code id="button-state-(type=button):attr-fe-autocomplete" class=no-backref><a href=#attr-fe-autocomplete>autocomplete</a></code>,
- <code id="button-state-(type=button):attr-input-checked" class=no-backref><a href=#attr-input-checked>checked</a></code>,
- <code id="button-state-(type=button):attr-fe-dirname" class=no-backref><a href=#attr-fe-dirname>dirname</a></code>,
- <code id="button-state-(type=button):attr-fs-formaction" class=no-backref><a href=#attr-fs-formaction>formaction</a></code>,
- <code id="button-state-(type=button):attr-fs-formenctype" class=no-backref><a href=#attr-fs-formenctype>formenctype</a></code>,
- <code id="button-state-(type=button):attr-fs-formmethod" class=no-backref><a href=#attr-fs-formmethod>formmethod</a></code>,
- <code id="button-state-(type=button):attr-fs-formnovalidate" class=no-backref><a href=#attr-fs-formnovalidate>formnovalidate</a></code>,
- <code id="button-state-(type=button):attr-fs-formtarget" class=no-backref><a href=#attr-fs-formtarget>formtarget</a></code>,
- <code id="button-state-(type=button):attr-dim-height" class=no-backref><a href=#attr-dim-height>height</a></code>,
- <code id="button-state-(type=button):attr-fe-inputmode" class=no-backref><a href=#attr-fe-inputmode>inputmode</a></code>,
- <code id="button-state-(type=button):attr-input-list" class=no-backref><a href=#attr-input-list>list</a></code>,
- <code id="button-state-(type=button):attr-input-max" class=no-backref><a href=#attr-input-max>max</a></code>,
- <code id="button-state-(type=button):attr-input-maxlength" class=no-backref><a href=#attr-input-maxlength>maxlength</a></code>,
- <code id="button-state-(type=button):attr-input-min" class=no-backref><a href=#attr-input-min>min</a></code>,
- <code id="button-state-(type=button):attr-input-minlength" class=no-backref><a href=#attr-input-minlength>minlength</a></code>,
- <code id="button-state-(type=button):attr-input-multiple" class=no-backref><a href=#attr-input-multiple>multiple</a></code>,
- <code id="button-state-(type=button):attr-input-pattern" class=no-backref><a href=#attr-input-pattern>pattern</a></code>,
- <code id="button-state-(type=button):attr-input-placeholder" class=no-backref><a href=#attr-input-placeholder>placeholder</a></code>,
- <code id="button-state-(type=button):attr-input-readonly" class=no-backref><a href=#attr-input-readonly>readonly</a></code>,
- <code id="button-state-(type=button):attr-input-required" class=no-backref><a href=#attr-input-required>required</a></code>,
- <code id="button-state-(type=button):attr-input-size" class=no-backref><a href=#attr-input-size>size</a></code>,
- <code id="button-state-(type=button):attr-input-src" class=no-backref><a href=#attr-input-src>src</a></code>,
- <code id="button-state-(type=button):attr-input-step" class=no-backref><a href=#attr-input-step>step</a></code>, and
- <code id="button-state-(type=button):attr-dim-width" class=no-backref><a href=#attr-dim-width>width</a></code>.</p>
- <p>The following IDL attributes and methods <a href=#do-not-apply id="button-state-(type=button):do-not-apply-2">do not apply</a> to the element:
- <code id="button-state-(type=button):dom-input-checked" class=no-backref><a href=#dom-input-checked>checked</a></code>,
- <code id="button-state-(type=button):dom-input-files" class=no-backref><a href=#dom-input-files>files</a></code>,
- <code id="button-state-(type=button):dom-input-list" class=no-backref><a href=#dom-input-list>list</a></code>,
- <code id="button-state-(type=button):dom-textarea/input-selectionstart" class=no-backref><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>,
- <code id="button-state-(type=button):dom-textarea/input-selectionend" class=no-backref><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>,
- <code id="button-state-(type=button):dom-textarea/input-selectiondirection" class=no-backref><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>,
- <code id="button-state-(type=button):dom-input-valueasdate" class=no-backref><a href=#dom-input-valueasdate>valueAsDate</a></code>,
- <code id="button-state-(type=button):dom-input-valueasnumber" class=no-backref><a href=#dom-input-valueasnumber>valueAsNumber</a></code>,
- <code id="button-state-(type=button):dom-input-valuelow" class=no-backref><a href=#dom-input-valuelow>valueLow</a></code>, and
- <code id="button-state-(type=button):dom-input-valuehigh" class=no-backref><a href=#dom-input-valuehigh>valueHigh</a></code> IDL attributes;
- <code id="button-state-(type=button):dom-textarea/input-select" class=no-backref><a href=#dom-textarea/input-select>select()</a></code>,
- <code id="button-state-(type=button):dom-textarea/input-setrangetext" class=no-backref><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>,
- <code id="button-state-(type=button):dom-textarea/input-setselectionrange" class=no-backref><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code>,
- <code id="button-state-(type=button):dom-input-stepdown" class=no-backref><a href=#dom-input-stepdown>stepDown()</a></code>, and
- <code id="button-state-(type=button):dom-input-stepup" class=no-backref><a href=#dom-input-stepup>stepUp()</a></code> methods.</p>
- <p>The <code id="button-state-(type=button):event-input-input" class=no-backref><a href=#event-input-input>input</a></code> and <code id="button-state-(type=button):event-input-change" class=no-backref><a href=#event-input-change>change</a></code> events <a href=#do-not-apply id="button-state-(type=button):do-not-apply-3">do not apply</a>.</p>
- </div>
-
- <h5 id=input-impl-notes>4.10.5.2 Implemention notes regarding localization of form controls</h5>
-
- <p><i>This section is non-normative.</i></p>
- <p>The formats shown to the user in date, time, and number controls is independent of the format
- used for form submission.</p>
- <p>Browsers are encouraged to use user interfaces that present dates, times, and numbers according
- to the conventions of either the locale implied by the <code id=input-impl-notes:the-input-element><a href=#the-input-element>input</a></code> element's
- <a href=#language id=input-impl-notes:language>language</a> or the user's preferred locale. Using the page's locale will ensure
- consistency with page-provided data.
- <p class=example>For example, it would be confusing to users if an American English page claimed
- that a Cirque De Soleil show was going to be showing on 02/03, but their
- browser, configured to use the British English locale, only showed the date 03/02 in the ticket purchase date picker. Using the page's locale would at least ensure that the
- date was presented in the same format everywhere. (There's still a risk that the user would end up
- arriving a month late, of course, but there's only so much that can be done about such cultural
- differences...)</p>
-
- <h5 id=common-input-element-attributes>4.10.5.3 Common <code id=common-input-element-attributes:the-input-element><a href=#the-input-element>input</a></code> element attributes</h5>
-
- <p>These attributes only <a href=#concept-input-apply id=common-input-element-attributes:concept-input-apply>apply</a> to an <code id=common-input-element-attributes:the-input-element-2><a href=#the-input-element>input</a></code>
- element if its <code id=common-input-element-attributes:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in a state whose definition
- declares that the attribute <a href=#concept-input-apply id=common-input-element-attributes:concept-input-apply-2>applies</a>. When an attribute
- <a href=#do-not-apply id=common-input-element-attributes:do-not-apply>doesn't apply</a> to an <code id=common-input-element-attributes:the-input-element-3><a href=#the-input-element>input</a></code> element, user agents must
- <a href=#ignore id=common-input-element-attributes:ignore>ignore</a> the attribute, regardless of the requirements and definitions below.</p>
-
- <h6 id=the-maxlength-and-minlength-attributes>4.10.5.3.1 The <code id=the-maxlength-and-minlength-attributes:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> and <code id=the-maxlength-and-minlength-attributes:attr-input-minlength><a href=#attr-input-minlength>minlength</a></code> attributes</h6>
- <p>The <dfn id=attr-input-maxlength><code>maxlength</code></dfn> attribute, when it <a href=#concept-input-apply id=the-maxlength-and-minlength-attributes:concept-input-apply>applies</a>, is a <a href=#attr-fe-maxlength id=the-maxlength-and-minlength-attributes:attr-fe-maxlength>form control <code>maxlength</code> attribute</a> controlled by the <code id=the-maxlength-and-minlength-attributes:the-input-element><a href=#the-input-element>input</a></code> element's <a href=#concept-input-value-dirty-flag id=the-maxlength-and-minlength-attributes:concept-input-value-dirty-flag>dirty value flag</a>.</p>
- <p>The <dfn id=attr-input-minlength><code>minlength</code></dfn> attribute, when it <a href=#concept-input-apply id=the-maxlength-and-minlength-attributes:concept-input-apply-2>applies</a>, is a <a href=#attr-fe-minlength id=the-maxlength-and-minlength-attributes:attr-fe-minlength>form control <code>minlength</code> attribute</a> controlled by the <code id=the-maxlength-and-minlength-attributes:the-input-element-2><a href=#the-input-element>input</a></code> element's <a href=#concept-input-value-dirty-flag id=the-maxlength-and-minlength-attributes:concept-input-value-dirty-flag-2>dirty value flag</a>.</p>
- <p>If the <code id=the-maxlength-and-minlength-attributes:the-input-element-3><a href=#the-input-element>input</a></code> element has a <a href=#maximum-allowed-value-length id=the-maxlength-and-minlength-attributes:maximum-allowed-value-length>maximum allowed value length</a>, then the
- <a href=#code-unit-length id=the-maxlength-and-minlength-attributes:code-unit-length>code-unit length</a> of the value of the element's <code id=the-maxlength-and-minlength-attributes:attr-input-value><a href=#attr-input-value>value</a></code> attribute must be equal to or less than the element's
- <a href=#maximum-allowed-value-length id=the-maxlength-and-minlength-attributes:maximum-allowed-value-length-2>maximum allowed value length</a>.</p>
-
- <div class=example>
- <p>The following extract shows how a messaging client's text entry could be arbitrarily
- restricted to a fixed number of characters, thus forcing any conversation through this medium to
- be terse and discouraging intelligent discourse.</p>
- <pre><label>What are you doing? <input name=status maxlength=140></label></pre>
- </div>
- <div class=example>
- <p>Here, a password is given a minimum length:</p>
- <pre><p><label>Username: <input name=u required></label>
- <p><label>Password: <input name=p required minlength=12></label></pre>
- </div>
- <h6 id=the-size-attribute>4.10.5.3.2 The <code id=the-size-attribute:attr-input-size><a href=#attr-input-size>size</a></code> attribute</h6>
- <p>The <dfn id=attr-input-size><code>size</code></dfn> attribute gives the number of
- characters that, in a visual rendering, the user agent is to allow the user to see while editing
- the element's <a href=#concept-fe-value id=the-size-attribute:concept-fe-value>value</a>.</p>
- <p>The <code id=the-size-attribute:attr-input-size-2><a href=#attr-input-size>size</a></code> attribute, if specified, must have a value that
- is a <a href=#valid-non-negative-integer id=the-size-attribute:valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>
-
- <p>If the attribute is present, then its value must be parsed using the <a href=#rules-for-parsing-non-negative-integers id=the-size-attribute:rules-for-parsing-non-negative-integers>rules for parsing
- non-negative integers</a>, and if the result is a number greater than zero, then the user agent
- should ensure that at least that many characters are visible.</p>
- <p>The <code id=the-size-attribute:dom-input-size><a href=#dom-input-size>size</a></code> IDL attribute is <a href=#limited-to-only-non-negative-numbers-greater-than-zero id=the-size-attribute:limited-to-only-non-negative-numbers-greater-than-zero>limited to only
- non-negative numbers greater than zero</a> and has a default value of 20.</p>
-
- <h6 id=the-readonly-attribute>4.10.5.3.3 The <code id=the-readonly-attribute:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute</h6>
- <p>The <dfn id=attr-input-readonly><code>readonly</code></dfn> attribute is a <a href=#boolean-attribute id=the-readonly-attribute:boolean-attribute>boolean
- attribute</a> that controls whether or not the user can edit the form control. When specified, the element is not <i id=the-readonly-attribute:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>
-
- <p><strong>Constraint validation</strong>: If the <code id=the-readonly-attribute:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code> attribute is specified on an <code id=the-readonly-attribute:the-input-element><a href=#the-input-element>input</a></code>
- element, the element is <a href=#barred-from-constraint-validation id=the-readonly-attribute:barred-from-constraint-validation>barred from constraint validation</a>.</p>
-
- <p class=note>The difference between <code id=the-readonly-attribute:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> and <code id=the-readonly-attribute:attr-input-readonly-3><a href=#attr-input-readonly>readonly</a></code> is that read-only controls are still focusable, so the
- user can still select the text and interact with it, whereas disabled controls are entirely
- non-interactive. (For this reason, only text controls can be made read-only: it wouldn't make
- sense for checkboxes or buttons, for instances.)</p>
- <div class=example>
- <p>In the following example, the existing product identifiers cannot be modified, but they are
- still displayed as part of the form, for consistency with the row representing a new product
- (where the identifier is not yet filled in).</p>
- <pre><form action="products.cgi" method="post" enctype="multipart/form-data">
- <table>
- <tr> <th> Product ID <th> Product name <th> Price <th> Action
- <tr>
- <td> <input readonly="readonly" name="1.pid" value="H412">
- <td> <input required="required" name="1.pname" value="Floor lamp Ulke">
- <td> $<input required="required" type="number" min="0" step="0.01" name="1.pprice" value="49.99">
- <td> <button formnovalidate="formnovalidate" name="action" value="delete:1">Delete</button>
- <tr>
- <td> <input readonly="readonly" name="2.pid" value="FG28">
- <td> <input required="required" name="2.pname" value="Table lamp Ulke">
- <td> $<input required="required" type="number" min="0" step="0.01" name="2.pprice" value="24.99">
- <td> <button formnovalidate="formnovalidate" name="action" value="delete:2">Delete</button>
- <tr>
- <td> <input required="required" name="3.pid" value="" pattern="[A-Z0-9]+">
- <td> <input required="required" name="3.pname" value="">
- <td> $<input required="required" type="number" min="0" step="0.01" name="3.pprice" value="">
- <td> <button formnovalidate="formnovalidate" name="action" value="delete:3">Delete</button>
- </table>
- <p> <button formnovalidate="formnovalidate" name="action" value="add">Add</button> </p>
- <p> <button name="action" value="update">Save</button> </p>
- </form></pre>
- </div>
- <h6 id=the-required-attribute>4.10.5.3.4 The <code id=the-required-attribute:attr-input-required><a href=#attr-input-required>required</a></code> attribute</h6>
- <p>The <dfn id=attr-input-required><code>required</code></dfn> attribute is a <a href=#boolean-attribute id=the-required-attribute:boolean-attribute>boolean
- attribute</a>. When specified, the element is <dfn id=concept-input-required><i>required</i></dfn>.</p>
-
- <p><strong>Constraint validation</strong>: If the element is <i id=the-required-attribute:concept-input-required><a href=#concept-input-required>required</a></i>, and its <code id=the-required-attribute:dom-input-value><a href=#dom-input-value>value</a></code>
- IDL attribute <a href=#concept-input-apply id=the-required-attribute:concept-input-apply>applies</a> and is in the mode <a href=#dom-input-value-value id=the-required-attribute:dom-input-value-value>value</a>, and the element is <i id=the-required-attribute:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>, and the element's <a href=#concept-fe-value id=the-required-attribute:concept-fe-value>value</a> is the empty string, then the element is <a href=#suffering-from-being-missing id=the-required-attribute:suffering-from-being-missing>suffering
- from being missing</a>.</p>
-
- <div class=example>
- <p>The following form has two required fields, one for an e-mail address and one for a password.
- It also has a third field that is only considered valid if the user types the same password in
- the password field and this third field.</p>
- <pre><h1>Create new account</h1>
- <form action="/newaccount" method=post
- oninput="up2.setCustomValidity(up2.value != up.value ? 'Passwords do not match.' : '')">
- <p>
- <label for="username">E-mail address:</label>
- <input id="username" type=email required name=un>
- <p>
- <label for="password1">Password:</label>
- <input id="password1" type=password required name=up>
- <p>
- <label for="password2">Confirm password:</label>
- <input id="password2" type=password name=up2>
- <p>
- <input type=submit value="Create account">
- </form></pre>
- </div>
- <div class=example>
- <p>For radio buttons, the <code id=the-required-attribute:attr-input-required-2><a href=#attr-input-required>required</a></code> attribute is
- satisfied if any of the radio buttons in the <a href=#radio-button-group id=the-required-attribute:radio-button-group>group</a> is
- selected. Thus, in the following example, any of the radio buttons can be checked, not just the
- one marked as required:</p>
- <pre><fieldset>
- <legend>Did the movie pass the Bechdel test?</legend>
- <p><label><input type="radio" name="bechdel" value="no-characters"> No, there are not even two female characters in the movie. </label>
- <p><label><input type="radio" name="bechdel" value="no-names"> No, the female characters never talk to each other. </label>
- <p><label><input type="radio" name="bechdel" value="no-topic"> No, when female characters talk to each other it's always about a male character. </label>
- <p><label><input type="radio" name="bechdel" value="yes" <strong>required</strong>> Yes. </label>
- <p><label><input type="radio" name="bechdel" value="unknown"> I don't know. </label>
- </fieldset></pre>
- <p>To avoid confusion as to whether a <a href=#radio-button-group id=the-required-attribute:radio-button-group-2>radio button group</a> is required or not, authors
- are encouraged to specify the attribute on all the radio buttons in a group. Indeed, in general,
- authors are encouraged to avoid having radio button groups that do not have any initially checked
- controls in the first place, as this is a state that the user cannot return to, and is therefore
- generally considered a poor user interface.</p>
- </div>
- <h6 id=the-multiple-attribute>4.10.5.3.5 The <code id=the-multiple-attribute:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute</h6>
- <p>The <dfn id=attr-input-multiple><code>multiple</code></dfn> attribute is a <a href=#boolean-attribute id=the-multiple-attribute:boolean-attribute>boolean
- attribute</a> that indicates whether the user is to be allowed to specify more than one
- value.</p>
- <div class=example>
- <p>The following extract shows how an e-mail client's "Cc" field could accept multiple e-mail
- addresses.</p>
- <pre><label>Cc: <input type=email multiple name=cc></label></pre>
- <p>If the user had, amongst many friends in his user contacts database, two friends "Arthur Dent"
- (with address "art@example.net") and "Adam Josh" (with address "adamjosh@example.net"), then,
- after the user has typed "a", the user agent might suggest these two e-mail addresses to the
- user.</p>
-
- <p><img src=http://images.whatwg.org/sample-email-1.png width=500 alt="" height=140></p>
- <p>The page could also link in the user's contacts database from the site:</p>
- <pre><label>Cc: <input type=email multiple name=cc list=contacts></label>
- ...
- <datalist id="contacts">
- <option value="hedral@damowmow.com">
- <option value="pillar@example.com">
- <option value="astrophy@cute.example">
- <option value="astronomy@science.example.org">
- </datalist></pre>
- <p>Suppose the user had entered "bob@example.net" into this text field, and then started typing a
- second e-mail address starting with "a". The user agent might show both the two friends mentioned
- earlier, as well as the "astrophy" and "astronomy" values given in the <code id=the-multiple-attribute:the-datalist-element><a href=#the-datalist-element>datalist</a></code>
- element.</p>
-
- <p><img src=http://images.whatwg.org/sample-email-2.png width=500 alt="" height=171></p>
- </div>
- <div class=example>
- <p>The following extract shows how an e-mail client's "Attachments" field could accept multiple
- files for upload.</p>
- <pre><label>Attachments: <input type=file multiple name=att></label></pre>
- </div>
- <h6 id=the-pattern-attribute>4.10.5.3.6 The <code id=the-pattern-attribute:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute</h6>
-
- <p>The <dfn id=attr-input-pattern><code>pattern</code></dfn> attribute specifies a regular
- expression against which the control's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value>value</a>, or, when the
- <code id=the-pattern-attribute:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#concept-input-apply id=the-pattern-attribute:concept-input-apply>applies</a> and is set, the control's <a href=#concept-fe-values id=the-pattern-attribute:concept-fe-values>values</a>, are to be checked.</p>
- <p>If specified, the attribute's value must match the JavaScript <i>Pattern</i>
- production. <a href=#refsECMA262>[ECMA262]</a></p>
-
- <p>If an <code id=the-pattern-attribute:the-input-element><a href=#the-input-element>input</a></code> element has a <code id=the-pattern-attribute:attr-input-pattern-2><a href=#attr-input-pattern>pattern</a></code>
- attribute specified, and the attribute's value, when compiled as a JavaScript regular expression
- with the <code>global</code>, <code>ignoreCase</code>, and <code>multiline</code> flags <em>disabled</em> (see ECMA262 Edition 5, sections 15.10.7.2
- through 15.10.7.4), compiles successfully, then the resulting regular expression is the element's
- <dfn id=compiled-pattern-regular-expression>compiled pattern regular expression</dfn>. If the element has no such attribute, or if the
- value doesn't compile successfully, then the element has no <a href=#compiled-pattern-regular-expression id=the-pattern-attribute:compiled-pattern-regular-expression>compiled pattern regular
- expression</a>. <a href=#refsECMA262>[ECMA262]</a></p>
- <p><strong>Constraint validation</strong>: If the element's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value-2>value</a> is not the empty string, and either the element's <code id=the-pattern-attribute:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code> attribute is not specified or it <a href=#do-not-apply id=the-pattern-attribute:do-not-apply>does not apply</a> to the <code id=the-pattern-attribute:the-input-element-2><a href=#the-input-element>input</a></code> element given its <code id=the-pattern-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state, and the element has a
- <a href=#compiled-pattern-regular-expression id=the-pattern-attribute:compiled-pattern-regular-expression-2>compiled pattern regular expression</a> but that regular expression does not match the
- entirety of the element's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value-3>value</a>, then the element is
- <a href=#suffering-from-a-pattern-mismatch id=the-pattern-attribute:suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p>
- <p><strong>Constraint validation</strong>: If the element's <a href=#concept-fe-value id=the-pattern-attribute:concept-fe-value-4>value</a> is not the empty string, and the element's <code id=the-pattern-attribute:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code> attribute is specified and <a href=#concept-input-apply id=the-pattern-attribute:concept-input-apply-2>applies</a> to the <code id=the-pattern-attribute:the-input-element-3><a href=#the-input-element>input</a></code> element, and the element has
- a <a href=#compiled-pattern-regular-expression id=the-pattern-attribute:compiled-pattern-regular-expression-3>compiled pattern regular expression</a> but that regular expression does not match the
- entirety of each of the element's <a href=#concept-fe-values id=the-pattern-attribute:concept-fe-values-2>values</a>, then the
- element is <a href=#suffering-from-a-pattern-mismatch id=the-pattern-attribute:suffering-from-a-pattern-mismatch-2>suffering from a pattern mismatch</a>.</p>
- <p>The <a href=#compiled-pattern-regular-expression id=the-pattern-attribute:compiled-pattern-regular-expression-4>compiled pattern regular expression</a>, when matched against a string, must have
- its start anchored to the start of the string and its end anchored to the end of the string.</p>
- <p class=note>This implies that the regular expression language used for this attribute is the
- same as that used in JavaScript, except that the <code id=the-pattern-attribute:attr-input-pattern-3><a href=#attr-input-pattern>pattern</a></code>
- attribute is matched against the entire value, not just any subset (somewhat as if it implied a
- <code>^(?:</code> at the start of the pattern and a <code>)$</code> at the
- end).</p>
-
- <p>When an <code id=the-pattern-attribute:the-input-element-4><a href=#the-input-element>input</a></code> element has a <code id=the-pattern-attribute:attr-input-pattern-4><a href=#attr-input-pattern>pattern</a></code>
- attribute specified, authors should include a <dfn id=attr-input-title><code>title</code></dfn> attribute to give a description of the pattern.
- User agents may use the contents of this attribute, if it is present, when informing the user that
- the pattern is not matched, or at any other suitable time, such as in a tooltip or read out by
- assistive technology when the control <a href=#gains-focus id=the-pattern-attribute:gains-focus>gains focus</a>.</p>
- <div class=example>
- <p>For example, the following snippet:</p>
- <pre><label> Part number:
- <input pattern="[0-9][A-Z]{3}" name="part"
- title="A part number is a digit followed by three uppercase letters."/>
- </label></pre>
- <p>...could cause the UA to display an alert such as:</p>
- <pre><samp>A part number is a digit followed by three uppercase letters.
- You cannot submit this form when the field is incorrect.</samp></pre>
- </div>
- <p>When a control has a <code id=the-pattern-attribute:attr-input-pattern-5><a href=#attr-input-pattern>pattern</a></code> attribute, the <code id=the-pattern-attribute:attr-input-title><a href=#attr-input-title>title</a></code> attribute, if used, must describe the pattern. Additional
- information could also be included, so long as it assists the user in filling in the control.
- Otherwise, assistive technology would be impaired.</p>
- <p class=example>For instance, if the title attribute contained the caption of the control,
- assistive technology could end up saying something like <samp>The text you have entered does not
- match the required pattern. Birthday</samp>, which is not useful.</p>
- <p>UAs may still show the <code id=the-pattern-attribute:attr-title><a href=#attr-title>title</a></code> in non-error situations (for
- example, as a tooltip when hovering over the control), so authors should be careful not to word
- <code id=the-pattern-attribute:attr-input-title-2><a href=#attr-input-title>title</a></code>s as if an error has necessarily occurred.</p>
- <h6 id=the-min-and-max-attributes>4.10.5.3.7 The <code id=the-min-and-max-attributes:attr-input-min><a href=#attr-input-min>min</a></code> and <code id=the-min-and-max-attributes:attr-input-max><a href=#attr-input-max>max</a></code> attributes</h6>
-
- <p>Some form controls can have explicit constraints applied limiting the allowed range of values
- that the user can provide. Normally, such a range would be linear and continuous. A form control
- can <dfn id=has-a-periodic-domain>have a periodic domain</dfn>, however, in which case the
- form control's broadest possible range is finite, and authors can specify explicit ranges within
- it that span the boundaries.</p>
- <p class=example>Specifically, the broadest range of a <code id="the-min-and-max-attributes:time-state-(type=time)"><a href="#time-state-(type=time)">type=time</a></code> control is midnight to midnight (24 hours), and
- authors can set both continuous linear ranges (such as 9pm to 11pm) and discontinuous ranges
- spanning midnight (such as 11pm to 1am).</p>
- <p>The <dfn id=attr-input-min><code>min</code></dfn> and <dfn id=attr-input-max><code>max</code></dfn> attributes indicate the allowed range of values for
- the element.</p>
-
- <p>Their syntax is defined by the section that defines the <code id=the-min-and-max-attributes:attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state.</p>
- <p>If the element has a <code id=the-min-and-max-attributes:attr-input-min-2><a href=#attr-input-min>min</a></code> attribute, and the result of
- applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number>algorithm to convert a string to a
- number</a> to the value of the <code id=the-min-and-max-attributes:attr-input-min-3><a href=#attr-input-min>min</a></code> attribute is a number,
- then that number is the element's <dfn id=concept-input-min>minimum</dfn>; otherwise, if the
- <code id=the-min-and-max-attributes:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute's current state defines a <dfn id=concept-input-min-default>default minimum</dfn>, then that is the <a href=#concept-input-min id=the-min-and-max-attributes:concept-input-min>minimum</a>; otherwise, the element has no <a href=#concept-input-min id=the-min-and-max-attributes:concept-input-min-2>minimum</a>.</p>
- <p>The <code id=the-min-and-max-attributes:attr-input-min-4><a href=#attr-input-min>min</a></code> attribute also defines the <a href=#concept-input-min-zero id=the-min-and-max-attributes:concept-input-min-zero>step base</a>.</p>
- <p>If the element has a <code id=the-min-and-max-attributes:attr-input-max-2><a href=#attr-input-max>max</a></code> attribute, and the result of
- applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-2>algorithm to convert a string to a
- number</a> to the value of the <code id=the-min-and-max-attributes:attr-input-max-3><a href=#attr-input-max>max</a></code> attribute is a number,
- then that number is the element's <dfn id=concept-input-max>maximum</dfn>; otherwise, if the
- <code id=the-min-and-max-attributes:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute's current state defines a <dfn id=concept-input-max-default>default maximum</dfn>, then that is the <a href=#concept-input-max id=the-min-and-max-attributes:concept-input-max>maximum</a>; otherwise, the element has no <a href=#concept-input-max id=the-min-and-max-attributes:concept-input-max-2>maximum</a>.</p>
-
- <p>If the element does not <a href=#has-a-periodic-domain id=the-min-and-max-attributes:has-a-periodic-domain>have a periodic domain</a>, the
- <code id=the-min-and-max-attributes:attr-input-max-4><a href=#attr-input-max>max</a></code> attribute's value (the <a href=#concept-input-max id=the-min-and-max-attributes:concept-input-max-3>maximum</a>) must not be less than the <code id=the-min-and-max-attributes:attr-input-min-5><a href=#attr-input-min>min</a></code> attribute's value (its <a href=#concept-input-min id=the-min-and-max-attributes:concept-input-min-3>minimum</a>).</p>
-
- <p class=note>If an element that does not <a href=#has-a-periodic-domain id=the-min-and-max-attributes:has-a-periodic-domain-2>have a periodic
- domain</a> has a <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-5>maximum</a> that is less than its <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-6>minimum</a>, then so long as the element has a <a href=#concept-fe-value id=the-min-and-max-attributes:concept-fe-value>value</a>, it will either be <a href=#suffering-from-an-underflow id=the-min-and-max-attributes:suffering-from-an-underflow>suffering from an underflow</a>
- or <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow>suffering from an overflow</a>.</p>
- <p>An element <dfn id=has-a-reversed-range>has a reversed range</dfn> if it <a href=#has-a-periodic-domain id=the-min-and-max-attributes:has-a-periodic-domain-3>has a periodic domain</a> and its
- <a href=#concept-input-max id=the-min-and-max-attributes:concept-input-max-4>maximum</a> is less than its <a href=#concept-input-min id=the-min-and-max-attributes:concept-input-min-4>minimum</a>.</p>
-
- <p>An element <dfn id=have-range-limitations>has range limitations</dfn> if it has a defined
- <a href=#concept-input-min id=the-min-and-max-attributes:concept-input-min-5>minimum</a> or a defined <a href=#concept-input-max id=the-min-and-max-attributes:concept-input-max-5>maximum</a>.</p>
-
- <p>How these range limitations apply depends on whether the element has a <code id=the-min-and-max-attributes:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute.</p>
- <dl class=switch><dt>If the element does not have a <code id=the-min-and-max-attributes:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code> attribute
- specified or if the <code id=the-min-and-max-attributes:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#do-not-apply id=the-min-and-max-attributes:do-not-apply>does not apply</a><dd>
- <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-7>minimum</a> and does not <a href=#has-a-reversed-range id=the-min-and-max-attributes:has-a-reversed-range>have a
- reversed range</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-3>algorithm to convert a string to a number</a> to
- the string given by the element's <a href=#concept-fe-value id=the-min-and-max-attributes:concept-fe-value-2>value</a> is a number, and
- the number obtained from that algorithm is less than the <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-8>minimum</a>, the element is <a href=#suffering-from-an-underflow id=the-min-and-max-attributes:suffering-from-an-underflow-2>suffering from an
- underflow</a>.</p>
- <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-6>maximum</a> and does not <a href=#has-a-reversed-range id=the-min-and-max-attributes:has-a-reversed-range-2>have a
- reversed range</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-4>algorithm to convert a string to a number</a> to
- the string given by the element's <a href=#concept-fe-value id=the-min-and-max-attributes:concept-fe-value-3>value</a> is a number, and
- the number obtained from that algorithm is more than the <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-7>maximum</a>, the element is <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow-2>suffering from an
- overflow</a>.</p>
- <p><strong>Constraint validation</strong>: When an element <a href=#has-a-reversed-range id=the-min-and-max-attributes:has-a-reversed-range-3>has a reversed range</a>,
- and the result of applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-5>algorithm to
- convert a string to a number</a> to the string given by the element's <a href=#concept-fe-value id=the-min-and-max-attributes:concept-fe-value-4>value</a> is a number, and the number obtained from that algorithm
- is more than the <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-8>maximum</a> <em>and</em> less than the <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-9>minimum</a>, the element is simultaneously <a href=#suffering-from-an-underflow id=the-min-and-max-attributes:suffering-from-an-underflow-3>suffering from an
- underflow</a> and <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow-3>suffering from an overflow</a>.</p>
- <dt>If the element does have a <code id=the-min-and-max-attributes:attr-input-multiple-4><a href=#attr-input-multiple>multiple</a></code> attribute
- specified and the <code id=the-min-and-max-attributes:attr-input-multiple-5><a href=#attr-input-multiple>multiple</a></code> attribute does <a href=#concept-input-apply id=the-min-and-max-attributes:concept-input-apply>apply</a><dd>
- <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-10>minimum</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-6>algorithm to convert a string to a number</a> to
- any of the strings in the element's <a href=#concept-fe-values id=the-min-and-max-attributes:concept-fe-values>values</a> is a number
- that is less than the <a href=#attr-input-min id=the-min-and-max-attributes:attr-input-min-11>minimum</a>, the element is
- <a href=#suffering-from-an-underflow id=the-min-and-max-attributes:suffering-from-an-underflow-4>suffering from an underflow</a>.</p>
- <p><strong>Constraint validation</strong>: When the element has a <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-9>maximum</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-min-and-max-attributes:concept-input-value-string-number-7>algorithm to convert a string to a number</a> to
- any of the strings in the element's <a href=#concept-fe-values id=the-min-and-max-attributes:concept-fe-values-2>values</a> is a number
- that is more than the <a href=#attr-input-max id=the-min-and-max-attributes:attr-input-max-10>maximum</a>, the element is
- <a href=#suffering-from-an-overflow id=the-min-and-max-attributes:suffering-from-an-overflow-4>suffering from an overflow</a>.</p>
-
- </dl>
-
- <div class=example>
- <p>The following date control limits input to dates that are before the 1980s:</p>
- <pre><input name=bday type=date max="1979-12-31"></pre>
- </div>
- <div class=example>
- <p>The following number control limits input to whole numbers greater than zero:</p>
- <pre><input name=quantity required="" type="number" min="1" value="1"></pre>
- </div>
- <div class=example>
- <p>The following time control limits input to those minutes that occur between 9pm and 6am,
- defaulting to midnight:</p>
- <pre><input name="sleepStart" type=time min="21:00" max="06:00" step="60" value="00:00"></pre>
- </div>
- <h6 id=the-step-attribute>4.10.5.3.8 The <code id=the-step-attribute:attr-input-step><a href=#attr-input-step>step</a></code> attribute</h6>
-
- <p>The <dfn id=attr-input-step><code>step</code></dfn> attribute indicates the granularity
- that is expected (and required) of the <a href=#concept-fe-value id=the-step-attribute:concept-fe-value>value</a> or <a href=#concept-fe-values id=the-step-attribute:concept-fe-values>values</a>, by limiting the allowed values. The
- section that defines the <code id=the-step-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state also
- defines the <dfn id=concept-input-step-default>default step</dfn>, the <dfn id=concept-input-step-scale>step scale factor</dfn>, and in some cases the <dfn id=concept-input-step-default-base>default step base</dfn>, which are used in processing the
- attribute as described below.</p>
- <p>The <code id=the-step-attribute:attr-input-step-2><a href=#attr-input-step>step</a></code> attribute, if specified, must either have a
- value that is a <a href=#valid-floating-point-number id=the-step-attribute:valid-floating-point-number>valid floating-point number</a> that <a href=#rules-for-parsing-floating-point-number-values id=the-step-attribute:rules-for-parsing-floating-point-number-values>parses</a> to a number that is greater than zero, or must have a
- value that is an <a href=#ascii-case-insensitive id=the-step-attribute:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>any</code>".</p>
-
- <p>The attribute provides the <dfn id=concept-input-step>allowed value step</dfn> for the
- element, as follows:</p>
- <ol><li>If the attribute is absent, then the <a href=#concept-input-step id=the-step-attribute:concept-input-step>allowed value
- step</a> is the <a href=#concept-input-step-default id=the-step-attribute:concept-input-step-default>default step</a> multiplied by the
- <a href=#concept-input-step-scale id=the-step-attribute:concept-input-step-scale>step scale factor</a>.<li>Otherwise, if the attribute's value is an <a href=#ascii-case-insensitive id=the-step-attribute:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the
- string "<code>any</code>", then there is no <a href=#concept-input-step id=the-step-attribute:concept-input-step-2>allowed
- value step</a>.<li>Otherwise, if the <a href=#rules-for-parsing-floating-point-number-values id=the-step-attribute:rules-for-parsing-floating-point-number-values-2>rules for parsing floating-point number values</a>, when they are
- applied to the attribute's value, return an error, zero, or a number less than zero, then the
- <a href=#concept-input-step id=the-step-attribute:concept-input-step-3>allowed value step</a> is the <a href=#concept-input-step-default id=the-step-attribute:concept-input-step-default-2>default step</a> multiplied by the <a href=#concept-input-step-scale id=the-step-attribute:concept-input-step-scale-2>step scale factor</a>.<li>Otherwise, the <a href=#concept-input-step id=the-step-attribute:concept-input-step-4>allowed value step</a> is the number
- returned by the <a href=#rules-for-parsing-floating-point-number-values id=the-step-attribute:rules-for-parsing-floating-point-number-values-3>rules for parsing floating-point number values</a> when they are applied
- to the attribute's value, multiplied by the <a href=#concept-input-step-scale id=the-step-attribute:concept-input-step-scale-3>step scale
- factor</a>.</ol>
- <p>The <dfn id=concept-input-min-zero>step base</dfn> is the value returned by the following
- algorithm:</p>
- <ol><li><p>If the element has a <code id=the-step-attribute:attr-input-min><a href=#attr-input-min>min</a></code> content attribute, and the
- result of applying the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number>algorithm to convert a
- string to a number</a> to the value of the <code id=the-step-attribute:attr-input-min-2><a href=#attr-input-min>min</a></code> content
- attribute is not an error, then return that result and abort these steps.<li>
- <p>If the element does not have a <code id=the-step-attribute:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute
- specified or if the <code id=the-step-attribute:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#do-not-apply id=the-step-attribute:do-not-apply>does not apply</a>, then: if the element has a <code id=the-step-attribute:attr-input-value><a href=#attr-input-value>value</a></code> content attribute, and the result of applying the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number-2>algorithm to convert a string to a number</a> to
- the value of the <code id=the-step-attribute:attr-input-value-2><a href=#attr-input-value>value</a></code> content attribute is not an error,
- then return that result and abort these steps.</p>
- <p>Otherwise, the element's <code id=the-step-attribute:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#range-state-(type=range)" id="the-step-attribute:range-state-(type=range)">Range</a> state and the element has a <code id=the-step-attribute:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code> attribute specified: run these substeps:</p>
- <ol><li><p>If the element does not have a <code id=the-step-attribute:attr-input-value-3><a href=#attr-input-value>value</a></code> content
- attribute, skip these substeps.<li><p><a href=#split-a-string-on-commas id=the-step-attribute:split-a-string-on-commas>Split on commas</a> the value of the <code id=the-step-attribute:attr-input-value-4><a href=#attr-input-value>value</a></code> content attribute.<li><p>If the result of the previous step was not exactly two values, or if either gets an
- error when you apply the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number-3>algorithm to convert
- a string to a number</a>, then skip these substeps.<li><p>Return the lower of the two numbers obtained in the previous step, and abort these
- steps.</ol>
- <li><p>If a <a href=#concept-input-step-default-base id=the-step-attribute:concept-input-step-default-base>default step base</a> is defined for
- this element given its <code id=the-step-attribute:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute's state, then return
- it and abort these steps.</p>
- <li><p>Return zero.</ol>
- <p>How these range limitations apply depends on whether the element has a <code id=the-step-attribute:attr-input-multiple-4><a href=#attr-input-multiple>multiple</a></code> attribute.</p>
- <dl class=switch><dt>If the element does not have a <code id=the-step-attribute:attr-input-multiple-5><a href=#attr-input-multiple>multiple</a></code> attribute
- specified or if the <code id=the-step-attribute:attr-input-multiple-6><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#do-not-apply id=the-step-attribute:do-not-apply-2>does not apply</a><dd>
- <p><strong>Constraint validation</strong>: When the element has an <a href=#concept-input-step id=the-step-attribute:concept-input-step-5>allowed value step</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number-4>algorithm to convert a string to a number</a> to
- the string given by the element's <a href=#concept-fe-value id=the-step-attribute:concept-fe-value-2>value</a> is a number, and
- that number subtracted from the <a href=#concept-input-min-zero id=the-step-attribute:concept-input-min-zero>step base</a> is not an
- integral multiple of the <a href=#concept-input-step id=the-step-attribute:concept-input-step-6>allowed value step</a>, the
- element is <a href=#suffering-from-a-step-mismatch id=the-step-attribute:suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p>
- <dt>If the element does have a <code id=the-step-attribute:attr-input-multiple-7><a href=#attr-input-multiple>multiple</a></code> attribute
- specified and the <code id=the-step-attribute:attr-input-multiple-8><a href=#attr-input-multiple>multiple</a></code> attribute does <a href=#concept-input-apply id=the-step-attribute:concept-input-apply>apply</a><dd>
- <p><strong>Constraint validation</strong>: When the element has an <a href=#attr-input-step id=the-step-attribute:attr-input-step-3>allowed value step</a>, and the result of applying the <a href=#concept-input-value-string-number id=the-step-attribute:concept-input-value-string-number-5>algorithm to convert a string to a number</a> to
- any of the strings in the element's <a href=#concept-fe-values id=the-step-attribute:concept-fe-values-2>values</a> is a number
- that, when subtracted from the <a href=#concept-input-min-zero id=the-step-attribute:concept-input-min-zero-2>step base</a>, is not an
- integral multiple of the <a href=#concept-input-step id=the-step-attribute:concept-input-step-7>allowed value step</a>, the
- element is <a href=#suffering-from-a-step-mismatch id=the-step-attribute:suffering-from-a-step-mismatch-2>suffering from a step mismatch</a>.</p>
- </dl>
-
- <div class=example>
- <p>The following range control only accepts values in the range 0..1, and allows 256 steps in
- that range:</p>
- <pre><input name=opacity type=range min=0 max=1 step=0.00392156863></pre>
- </div>
- <div class=example>
- <p>The following control allows any time in the day to be selected, with any accuracy (e.g.
- thousandth-of-a-second accuracy or more):</p>
- <pre><input name=favtime type=time step=any></pre>
- <p>Normally, time controls are limited to an accuracy of one minute.</p>
- </div>
- <h6 id=the-list-attribute>4.10.5.3.9 The <code id=the-list-attribute:attr-input-list><a href=#attr-input-list>list</a></code> attribute</h6>
-
- <p>The <dfn id=attr-input-list><code>list</code></dfn> attribute is used to identify an
- element that lists predefined options suggested to the user.</p>
- <p>If present, its value must be the <a href=#concept-id id=the-list-attribute:concept-id>ID</a> of a <code id=the-list-attribute:the-datalist-element><a href=#the-datalist-element>datalist</a></code>
- element in the same document.</p>
-
- <p>The <dfn id=concept-input-list>suggestions source element</dfn> is the first element in
- the document in <a href=#tree-order id=the-list-attribute:tree-order>tree order</a> to have an <a href=#concept-id id=the-list-attribute:concept-id-2>ID</a> equal to the
- value of the <code id=the-list-attribute:attr-input-list-2><a href=#attr-input-list>list</a></code> attribute, if that element is a
- <code id=the-list-attribute:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code> element. If there is no <code id=the-list-attribute:attr-input-list-3><a href=#attr-input-list>list</a></code> attribute,
- or if there is no element with that <a href=#concept-id id=the-list-attribute:concept-id-3>ID</a>, or if the first element
- with that <a href=#concept-id id=the-list-attribute:concept-id-4>ID</a> is not a <code id=the-list-attribute:the-datalist-element-3><a href=#the-datalist-element>datalist</a></code> element, then there is
- no <a href=#concept-input-list id=the-list-attribute:concept-input-list>suggestions source element</a>.</p>
- <p>If there is a <a href=#concept-input-list id=the-list-attribute:concept-input-list-2>suggestions source element</a>, then, when
- the user agent is allowing the user to edit the <code id=the-list-attribute:the-input-element><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value id=the-list-attribute:concept-fe-value>value</a>, the user agent should offer the suggestions represented by
- the <a href=#concept-input-list id=the-list-attribute:concept-input-list-3>suggestions source element</a> to the user in a manner
- suitable for the type of control used. The user agent may use the suggestion's <a href=#concept-option-label id=the-list-attribute:concept-option-label>label</a> to identify the suggestion if appropriate.</p>
- <p>How user selections of suggestions are handled depends on whether the element is a control
- accepting a single value only, or whether it accepts multiple values:</p>
- <dl class=switch><dt>If the element does not have a <code id=the-list-attribute:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute
- specified or if the <code id=the-list-attribute:attr-input-multiple-2><a href=#attr-input-multiple>multiple</a></code> attribute <a href=#do-not-apply id=the-list-attribute:do-not-apply>does not apply</a><dd>
- <p>When the user selects a suggestion, the <code id=the-list-attribute:the-input-element-2><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value id=the-list-attribute:concept-fe-value-2>value</a> must be set to the selected suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value>value</a>, as if the user had written that value himself.</p>
- <dt>If the element's <code id=the-list-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#range-state-(type=range)" id="the-list-attribute:range-state-(type=range)">Range</a> state and the element has a <code id=the-list-attribute:attr-input-multiple-3><a href=#attr-input-multiple>multiple</a></code> attribute specified<dd>
- <p>When the user selects a suggestion, the user agent must identify which value in the element's
- <a href=#concept-fe-values id=the-list-attribute:concept-fe-values>values</a> the user intended to update, and must then update
- the element's <a href=#concept-fe-values id=the-list-attribute:concept-fe-values-2>values</a> so that the relevant value is
- changed to the value given by the selected suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value-2>value</a>, as if the user had himself set it to that value.</p>
- <dt>If the element's <code id=the-list-attribute:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#e-mail-state-(type=email)" id="the-list-attribute:e-mail-state-(type=email)">Email</a> state and the element has a <code id=the-list-attribute:attr-input-multiple-4><a href=#attr-input-multiple>multiple</a></code> attribute specified<dd>
- <p>When the user selects a suggestion, the user agent must either add a new entry to the
- <code id=the-list-attribute:the-input-element-3><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-values id=the-list-attribute:concept-fe-values-3>values</a>, whose value
- is the selected suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value-3>value</a>, or change an
- existing entry in the <code id=the-list-attribute:the-input-element-4><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-values id=the-list-attribute:concept-fe-values-4>values</a> to have the value given by the selected
- suggestion's <a href=#concept-option-value id=the-list-attribute:concept-option-value-4>value</a>, as if the user had himself added
- an entry with that value, or edited an existing entry to be that value. Which behavior is to be
- applied depends on the user interface in a user-agent-defined manner.</p>
- </dl>
- <hr>
- <p>If the <code id=the-list-attribute:attr-input-list-4><a href=#attr-input-list>list</a></code> attribute <a href=#do-not-apply id=the-list-attribute:do-not-apply-2>does not
- apply</a>, there is no <a href=#concept-input-list id=the-list-attribute:concept-input-list-4>suggestions source element</a>.</p>
-
- <div class=example>
- <p>This URL field offers some suggestions.</p>
- <pre><label>Homepage: <input name=hp type=url list=hpurls></label>
- <datalist id=hpurls>
- <option value="http://www.google.com/" label="Google">
- <option value="http://www.reddit.com/" label="Reddit">
- </datalist></pre>
- <p>Other URLs from the user's history might show also; this is up to the user agent.</p>
- </div>
- <div class=example>
- <p>This example demonstrates how to design a form that uses the autocompletion list feature while
- still degrading usefully in legacy user agents.</p>
- <p>If the autocompletion list is merely an aid, and is not important to the content, then simply
- using a <code id=the-list-attribute:the-datalist-element-4><a href=#the-datalist-element>datalist</a></code> element with children <code id=the-list-attribute:the-option-element><a href=#the-option-element>option</a></code> elements is enough. To
- prevent the values from being rendered in legacy user agents, they need to be placed inside the
- <code id=the-list-attribute:attr-option-value><a href=#attr-option-value>value</a></code> attribute instead of inline.</p>
- <pre><p>
- <label>
- Enter a breed:
- <input type="text" name="breed" list="breeds">
- <datalist id="breeds">
- <option value="Abyssinian">
- <option value="Alpaca">
- <!-- ... -->
- </datalist>
- </label>
- </p></pre>
- <p>However, if the values need to be shown in legacy UAs, then fallback content can be placed
- inside the <code id=the-list-attribute:the-datalist-element-5><a href=#the-datalist-element>datalist</a></code> element, as follows:</p>
- <pre><p>
- <label>
- Enter a breed:
- <input type="text" name="breed" list="breeds">
- </label>
- <datalist id="breeds">
- <label>
- or select one from the list:
- <select name="breed">
- <option value=""> (none selected)
- <option>Abyssinian
- <option>Alpaca
- <!-- ... -->
- </select>
- </label>
- </datalist>
- </p>
- </pre>
- <p>The fallback content will only be shown in UAs that don't support <code id=the-list-attribute:the-datalist-element-6><a href=#the-datalist-element>datalist</a></code>. The
- options, on the other hand, will be detected by all UAs, even though they are not children of the
- <code id=the-list-attribute:the-datalist-element-7><a href=#the-datalist-element>datalist</a></code> element.</p>
- <p>Note that if an <code id=the-list-attribute:the-option-element-2><a href=#the-option-element>option</a></code> element used in a <code id=the-list-attribute:the-datalist-element-8><a href=#the-datalist-element>datalist</a></code> is <code id=the-list-attribute:attr-option-selected><a href=#attr-option-selected>selected</a></code>, it will be selected by default by legacy UAs
- (because it affects the <code id=the-list-attribute:the-select-element><a href=#the-select-element>select</a></code>), but it will not have any effect on the
- <code id=the-list-attribute:the-input-element-5><a href=#the-input-element>input</a></code> element in UAs that support <code id=the-list-attribute:the-datalist-element-9><a href=#the-datalist-element>datalist</a></code>.</p>
- </div>
- <h6 id=the-placeholder-attribute>4.10.5.3.10 The <code id=the-placeholder-attribute:attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code> attribute</h6>
-
- <p>The <dfn id=attr-input-placeholder><code>placeholder</code></dfn> attribute represents a
- <em>short</em> hint (a word or short phrase) intended to aid the user with data entry when the
- control has no value. A hint could be a sample value or a brief description of the expected
- format. The attribute, if specified, must have a value that contains no U+000A LINE FEED (LF) or
- U+000D CARRIAGE RETURN (CR) characters.</p>
- <p>The <code id=the-placeholder-attribute:attr-input-placeholder-2><a href=#attr-input-placeholder>placeholder</a></code> attribute should not be used as an
- alternative to a <code id=the-placeholder-attribute:the-label-element><a href=#the-label-element>label</a></code>. For a longer hint or other advisory text, the <code id=the-placeholder-attribute:attr-title><a href=#attr-title>title</a></code> attribute is more appropriate.</p>
- <p class=note>These mechanisms are very similar but subtly different: the hint given by the
- control's <code id=the-placeholder-attribute:the-label-element-2><a href=#the-label-element>label</a></code> is shown at all times; the short hint given in the <code id=the-placeholder-attribute:attr-input-placeholder-3><a href=#attr-input-placeholder>placeholder</a></code> attribute is shown before the user enters a
- value; and the hint in the <code id=the-placeholder-attribute:attr-title-2><a href=#attr-title>title</a></code> attribute is shown when the user
- requests further help.</p>
-
- <p>User agents should present this hint to the user, after having <a href=#strip-line-breaks id=the-placeholder-attribute:strip-line-breaks>stripped line breaks</a> from it, when the element's <a href=#concept-fe-value id=the-placeholder-attribute:concept-fe-value>value</a> is the empty string, especially if the control is not <a href=#focused id=the-placeholder-attribute:focused>focused</a>.</p>
- <p>If a user agent normally doesn't show this hint to the user when the control is
- <a href=#focused id=the-placeholder-attribute:focused-2>focused</a>, then the user agent should nonetheless show the hint for the control if it
- was focused as a result of the <code id=the-placeholder-attribute:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute, since
- in that case the user will not have had an opportunity to examine the control before focusing
- it.</p>
-
- <div class=example>
- <p>Here is an example of a mail configuration user interface that uses the <code id=the-placeholder-attribute:attr-input-placeholder-4><a href=#attr-input-placeholder>placeholder</a></code> attribute:</p>
- <pre><fieldset>
- <legend>Mail Account</legend>
- <p><label>Name: <input type="text" name="fullname" placeholder="John Ratzenberger"></label></p>
- <p><label>Address: <input type="email" name="address" placeholder="john@example.net"></label></p>
- <p><label>Password: <input type="password" name="password"></label></p>
- <p><label>Description: <input type="text" name="desc" placeholder="My Email Account"></label></p>
- </fieldset></pre>
- </div>
- <div class=example>
- <p>In situations where the control's content has one directionality but the placeholder needs to
- have a different directionality, Unicode's bidirectional-algorithm formatting characters can be
- used in the attribute value:</p>
- <pre><input name=t1 type=tel placeholder="<strong>&#x202B;</strong> <bdo dir=rtl>رقم الهاتف 1</bdo> <strong>&#x202E;</strong>">
- <input name=t2 type=tel placeholder="<strong>&#x202B;</strong> <bdo dir=rtl>رقم الهاتف 2</bdo> <strong>&#x202E;</strong>"></pre>
- <p>For slightly more clarity, here's the same example using numeric character references instead of inline Arabic:</p>
- <pre><input name=t1 type=tel placeholder="<strong>&#x202B;</strong>&#1585;&#1602;&#1605; &#1575;&#1604;&#1607;&#1575;&#1578;&#1601; 1<strong>&#x202E;</strong>">
- <input name=t2 type=tel placeholder="<strong>&#x202B;</strong>&#1585;&#1602;&#1605; &#1575;&#1604;&#1607;&#1575;&#1578;&#1601; 2<strong>&#x202E;</strong>"></pre>
- </div>
- <h5 id=common-input-element-apis>4.10.5.4 Common <code id=common-input-element-apis:the-input-element><a href=#the-input-element>input</a></code> element APIs</h5>
- <dl class=domintro><dt><var>input</var> . <code id=common-input-element-apis:dom-input-value><a href=#dom-input-value>value</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value>value</a> of the form control.</p>
- <p>Can be set, to change the value.</p>
- <p>Throws an <code id=common-input-element-apis:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if it is set to any value other than the
- empty string when the control is a file upload control.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-checked><a href=#dom-input-checked>checked</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked>checkedness</a> of the form
- control.</p>
- <p>Can be set, to change the <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked-2>checkedness</a>.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-files><a href=#dom-input-files>files</a></code> <dd>
- <p>Returns a <code id=common-input-element-apis:filelist><a href=#filelist>FileList</a></code> object listing the <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected>selected files</a> of the form control.</p>
- <p>Returns null if the control isn't a file control.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-valueasdate><a href=#dom-input-valueasdate>valueAsDate</a></code> [ = <var>value</var> ]<dd>
- <p>Returns a <code id=common-input-element-apis:idl-date><a href=#idl-date>Date</a></code> object representing the form control's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-2>value</a>, if applicable; otherwise, returns null.</p>
- <p>Can be set, to change the value.</p>
- <p>Throws an <code id=common-input-element-apis:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control isn't date- or
- time-based.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-valueasnumber><a href=#dom-input-valueasnumber>valueAsNumber</a></code> [ = <var>value</var> ]<dd>
- <p>Returns a number representing the form control's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-3>value</a>,
- if applicable; otherwise, returns NaN.</p>
- <p>Can be set, to change the value. Setting this to NaN will set the underlying value to the
- empty string.</p>
- <p>Throws an <code id=common-input-element-apis:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control is neither date- or
- time-based nor numeric.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-valuelow><a href=#dom-input-valuelow>valueLow</a></code> [ = <var>value</var> ]<dt><var>input</var> . <code id=common-input-element-apis:dom-input-valuehigh><a href=#dom-input-valuehigh>valueHigh</a></code> [ = <var>value</var> ]<dd>
- <p>Returns a number representing the low and high components of form control's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-4>value</a> respectively, if applicable; otherwise, returns NaN.</p>
- <p>Can be set, to change the value.</p>
- <p>Throws an <code id=common-input-element-apis:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control is not a two-handle range
- control.</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-stepup><a href=#dom-input-stepup>stepUp</a></code>( [ <var>n</var> ] )<dt><var>input</var> . <code id=common-input-element-apis:dom-input-stepdown><a href=#dom-input-stepdown>stepDown</a></code>( [ <var>n</var> ] )<dd>
- <p>Changes the form control's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-5>value</a> by the value given in
- the <code id=common-input-element-apis:attr-input-step><a href=#attr-input-step>step</a></code> attribute, multiplied by <var>n</var>.
- The default value for <var>n</var> is 1.</p>
- <p>Throws <code id=common-input-element-apis:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code> exception if the control is neither date- or time-based
- nor numeric, or if the <code id=common-input-element-apis:attr-input-step-2><a href=#attr-input-step>step</a></code> attribute's value is "<code>any</code>".</p>
- <dt><var>input</var> . <code id=common-input-element-apis:dom-input-list><a href=#dom-input-list>list</a></code><dd>
- <p>Returns the <code id=common-input-element-apis:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element indicated by the <code id=common-input-element-apis:attr-input-list><a href=#attr-input-list>list</a></code> attribute.</p>
- </dl>
-
- <p>The <dfn id=dom-input-value><code>value</code></dfn> IDL attribute allows scripts to
- manipulate the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-6>value</a> of an <code id=common-input-element-apis:the-input-element-2><a href=#the-input-element>input</a></code> element. The
- attribute is in one of the following modes, which define its behavior:</p>
- <dl><dt><dfn id=dom-input-value-value>value</dfn>
- <dd>
- <p>On getting, it must return the current <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-7>value</a> of the
- element. On setting, it must set the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-8>value</a> to
- the new value, set the element's <a href=#concept-input-value-dirty-flag id=common-input-element-apis:concept-input-value-dirty-flag>dirty value
- flag</a> to true, invoke the <a href=#value-sanitization-algorithm id=common-input-element-apis:value-sanitization-algorithm>value sanitization algorithm</a>, if the element's
- <code id=common-input-element-apis:attr-input-type><a href=#attr-input-type>type</a></code> attribute's current state defines one, and then, if
- the element has a text entry cursor position, should move the text entry cursor position to the
- end of the text field, unselecting any selected text and resetting the selection direction to
- <i>none</i>.</p>
- <dt><dfn id=dom-input-value-default>default</dfn>
- <dd>
- <p>On getting, if the element has a <code id=common-input-element-apis:attr-input-value><a href=#attr-input-value>value</a></code> attribute, it
- must return that attribute's value; otherwise, it must return the empty string. On setting, it
- must set the element's <code id=common-input-element-apis:attr-input-value-2><a href=#attr-input-value>value</a></code> attribute to the new
- value.</p>
- <dt><dfn id=dom-input-value-default-on>default/on</dfn>
- <dd>
- <p>On getting, if the element has a <code id=common-input-element-apis:attr-input-value-3><a href=#attr-input-value>value</a></code> attribute, it
- must return that attribute's value; otherwise, it must return the string "<code>on</code>". On setting, it must set the element's <code id=common-input-element-apis:attr-input-value-4><a href=#attr-input-value>value</a></code> attribute to the new value.</p>
- <dt><dfn id=dom-input-value-filename>filename</dfn>
- <dd id=fakepath-orly>
- <p>On getting, it must return the string "<code>C:\fakepath\</code>" followed by the
- name of the first file in the list of <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-2>selected
- files</a>, if any, or the empty string if the list is empty. On setting, if the new value is
- the empty string, it must empty the list of <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-3>selected files</a>; otherwise, it must throw an
- <code id=common-input-element-apis:invalidstateerror-6><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
- <p class=note>This "fakepath" requirement is a sad accident of history. See <a href=#fakepath-srsly>the example in the File Upload state section</a> for more
- information.</p>
- <p class=note>Since <a href=#concept-input-file-path id=common-input-element-apis:concept-input-file-path>path components</a> are not
- permitted in file names in the list of <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-4>selected
- files</a>, the "\fakepath\" cannot be mistaken for a path component.</p>
- </dl>
- <hr>
- <p>The <dfn id=dom-input-checked><code>checked</code></dfn> IDL attribute allows scripts to
- manipulate the <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked-3>checkedness</a> of an <code id=common-input-element-apis:the-input-element-3><a href=#the-input-element>input</a></code>
- element. On getting, it must return the current <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked-4>checkedness</a> of the element; and on setting, it must set the
- element's <a href=#concept-fe-checked id=common-input-element-apis:concept-fe-checked-5>checkedness</a> to the new value and set the
- element's <a href=#concept-input-checked-dirty-flag id=common-input-element-apis:concept-input-checked-dirty-flag>dirty checkedness flag</a> to
- true.</p>
- <hr>
- <p>The <dfn id=dom-input-files><code>files</code></dfn> IDL attribute allows scripts to
- access the element's <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-5>selected files</a>. On
- getting, if the IDL attribute <a href=#concept-input-apply id=common-input-element-apis:concept-input-apply>applies</a>, it must return a
- <code id=common-input-element-apis:filelist-2><a href=#filelist>FileList</a></code> object that represents the current <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-6>selected files</a>. The same object must be returned
- until the list of <a href=#concept-input-type-file-selected id=common-input-element-apis:concept-input-type-file-selected-7>selected files</a> changes. If
- the IDL attribute <a href=#do-not-apply id=common-input-element-apis:do-not-apply>does not apply</a>, then it must instead return
- null. <a href=#refsFILEAPI>[FILEAPI]</a></p>
- <hr>
- <p>The <dfn id=dom-input-valueasdate><code>valueAsDate</code></dfn> IDL attribute represents
- the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-9>value</a> of the element, interpreted as a date.</p>
- <p>On getting, if the <code id=common-input-element-apis:dom-input-valueasdate-2><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute <a href=#do-not-apply id=common-input-element-apis:do-not-apply-2>does not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-4><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute's current state, then return null. Otherwise, run
- the <a href=#concept-input-value-string-date id=common-input-element-apis:concept-input-value-string-date>algorithm to convert a string to a
- <code>Date</code> object</a> defined for that state to the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-10>value</a>; if the algorithm returned a <code id=common-input-element-apis:idl-date-2><a href=#idl-date>Date</a></code> object, then
- return it, otherwise, return null.</p>
- <p>On setting, if the <code id=common-input-element-apis:dom-input-valueasdate-3><a href=#dom-input-valueasdate>valueAsDate</a></code> attribute <a href=#do-not-apply id=common-input-element-apis:do-not-apply-3>does not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-5><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute's current state, then throw an
- <code id=common-input-element-apis:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception; otherwise, if the new value is null or a
- <code id=common-input-element-apis:idl-date-3><a href=#idl-date>Date</a></code> object representing the NaN time value, then set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-11>value</a> of the element to the empty string; otherwise, run the
- <a href=#concept-input-value-date-string id=common-input-element-apis:concept-input-value-date-string>algorithm to convert a <code>Date</code> object to
- a string</a>, as defined for that state, on the new value, and set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-12>value</a> of the element to the resulting string.</p>
- <hr>
- <p>The <dfn id=dom-input-valueasnumber><code>valueAsNumber</code></dfn> IDL attribute
- represents the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-13>value</a> of the element, interpreted as a
- number.</p>
- <p>On getting, if the <code id=common-input-element-apis:dom-input-valueasnumber-2><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute <a href=#do-not-apply id=common-input-element-apis:do-not-apply-4>does not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-6><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute's current state, then return a Not-a-Number (NaN)
- value. Otherwise, if the <code id=common-input-element-apis:dom-input-valueasdate-4><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code>
- attribute <a href=#concept-input-apply id=common-input-element-apis:concept-input-apply-2>applies</a>, run the <a href=#concept-input-value-string-date id=common-input-element-apis:concept-input-value-string-date-2>algorithm to convert a string to a <code>Date</code>
- object</a> defined for that state to the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-14>value</a>; if the algorithm returned a <code id=common-input-element-apis:idl-date-4><a href=#idl-date>Date</a></code> object, then
- return the <i>time value</i> of the object (the number of milliseconds from midnight UTC the
- morning of 1970-01-01 to the time represented by the <code id=common-input-element-apis:idl-date-5><a href=#idl-date>Date</a></code> object), otherwise, return
- a Not-a-Number (NaN) value. Otherwise, run the <a href=#concept-input-value-string-number id=common-input-element-apis:concept-input-value-string-number>algorithm to convert a string to a number</a>
- defined for that state to the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-15>value</a>; if the
- algorithm returned a number, then return it, otherwise, return a Not-a-Number (NaN) value.</p>
- <p>On setting, if the new value is infinite, then throw a <code id=common-input-element-apis:typeerror><a href=#typeerror>TypeError</a></code> exception.
- Otherwise, if the <code id=common-input-element-apis:dom-input-valueasnumber-3><a href=#dom-input-valueasnumber>valueAsNumber</a></code> attribute <a href=#do-not-apply id=common-input-element-apis:do-not-apply-5>does not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-7><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute's current state, then throw an
- <code id=common-input-element-apis:invalidstateerror-8><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, if the new value is a Not-a-Number (NaN)
- value, then set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-16>value</a> of the element to the empty
- string. Otherwise, if the <code id=common-input-element-apis:dom-input-valueasdate-5><a href=#dom-input-valueasdate>valueAs<em>Date</em></a></code>
- attribute <a href=#concept-input-apply id=common-input-element-apis:concept-input-apply-3>applies</a>, run the <a href=#concept-input-value-date-string id=common-input-element-apis:concept-input-value-date-string-2>algorithm to convert a <code>Date</code> object to a
- string</a> defined for that state, passing it a <code id=common-input-element-apis:idl-date-6><a href=#idl-date>Date</a></code> object whose <i>time
- value</i> is the new value, and set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-17>value</a> of the
- element to the resulting string. Otherwise, run the <a href=#concept-input-value-number-string id=common-input-element-apis:concept-input-value-number-string>algorithm to convert a number to a string</a>, as
- defined for that state, on the new value, and set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-18>value</a>
- of the element to the resulting string.</p>
- <hr>
- <p>The <dfn id=dom-input-valuelow><code>valueLow</code></dfn> and <dfn id=dom-input-valuehigh><code>valueHigh</code></dfn> IDL attributes represent the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-19>value</a> of the element, interpreted as a comma-separated pair of
- numbers.</p>
- <p>On getting, if the attributes <a href=#do-not-apply id=common-input-element-apis:do-not-apply-6>do not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-8><a href=#the-input-element>input</a></code>
- element's <code id=common-input-element-apis:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute's current state, then return zero;
- otherwise, run the following steps:</p>
- <ol><li><p>Let <var>values</var> be the <a href=#concept-fe-values id=common-input-element-apis:concept-fe-values>values</a> of
- the element, interpreted according to the <a href=#concept-input-value-string-number id=common-input-element-apis:concept-input-value-string-number-2>algorithm to convert a string to a number</a>, as
- defined by the <code id=common-input-element-apis:the-input-element-9><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-7><a href=#attr-input-type>type</a></code>
- attribute's current state.<li><p>If the attribute in question is <code id=common-input-element-apis:dom-input-valuelow-2><a href=#dom-input-valuelow>valueLow</a></code>, return
- the lowest of the values in <var>values</var>; otherwise, return the highest of the
- values in <var>values</var>.</ol>
- <p>On setting, if the attributes <a href=#do-not-apply id=common-input-element-apis:do-not-apply-7>do not apply</a>, as defined for the <code id=common-input-element-apis:the-input-element-10><a href=#the-input-element>input</a></code>
- element's <code id=common-input-element-apis:attr-input-type-8><a href=#attr-input-type>type</a></code> attribute's current state, then throw an
- <code id=common-input-element-apis:invalidstateerror-9><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, run the following steps:</p>
- <ol><li><p>Let <var>values</var> be the <a href=#concept-fe-values id=common-input-element-apis:concept-fe-values-2>values</a> of
- the element, interpreted according to the <a href=#concept-input-value-string-number id=common-input-element-apis:concept-input-value-string-number-3>algorithm to convert a string to a number</a>, as
- defined by the <code id=common-input-element-apis:the-input-element-11><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-9><a href=#attr-input-type>type</a></code>
- attribute's current state.<li><p>Let <var>new value</var> be the result of running the <a href=#concept-input-value-number-string id=common-input-element-apis:concept-input-value-number-string-2>algorithm to convert a number to a string</a>, as
- defined for that state, on the new value.<li><p>If the attribute in question is <code id=common-input-element-apis:dom-input-valuelow-3><a href=#dom-input-valuelow>valueLow</a></code>, replace
- the lower value in <var>values</var> with <var>new value</var>; otherwise,
- replace the higher value in <var>values</var> with <var>new
- value</var>.<li><p>Sort <var>values</var> in increasing numeric order.<li><p>Let <a href=#concept-fe-values id=common-input-element-apis:concept-fe-values-3>values</a> be the result of running the <a href=#concept-input-value-number-string id=common-input-element-apis:concept-input-value-number-string-3>algorithm to convert a number to a string</a>, as
- defined by the <code id=common-input-element-apis:the-input-element-12><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-10><a href=#attr-input-type>type</a></code>
- attribute's current state, to the values in <var>values</var>.<li><p>Set the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-20>value</a> to the concatenation of the
- strings in in <a href=#concept-fe-values id=common-input-element-apis:concept-fe-values-4>values</a>, separating each value from the next
- by a U+002C COMMA character (,).</ol>
- <hr>
- <p>The <dfn id=dom-input-stepdown><code>stepDown(<var>n</var>)</code></dfn> and <dfn id=dom-input-stepup><code>stepUp(<var>n</var>)</code></dfn> methods, when invoked,
- must run the following algorithm:</p>
- <ol><li><p>If the <code id=common-input-element-apis:dom-input-stepdown-2><a href=#dom-input-stepdown>stepDown()</a></code> and <code id=common-input-element-apis:dom-input-stepup-2><a href=#dom-input-stepup>stepUp()</a></code> methods <a href=#do-not-apply id=common-input-element-apis:do-not-apply-8>do not apply</a>, as defined for the
- <code id=common-input-element-apis:the-input-element-13><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-11><a href=#attr-input-type>type</a></code> attribute's current state,
- then throw an <code id=common-input-element-apis:invalidstateerror-10><a href=#invalidstateerror>InvalidStateError</a></code> exception, and abort these steps.<li><p>If the element has no <a href=#concept-input-step id=common-input-element-apis:concept-input-step>allowed value step</a>, then
- throw an <code id=common-input-element-apis:invalidstateerror-11><a href=#invalidstateerror>InvalidStateError</a></code> exception, and abort these steps.<li><p>If the element has a <a href=#concept-input-min id=common-input-element-apis:concept-input-min>minimum</a> and a <a href=#concept-input-max id=common-input-element-apis:concept-input-max>maximum</a> and the <a href=#concept-input-min id=common-input-element-apis:concept-input-min-2>minimum</a>
- is greater than the <a href=#concept-input-max id=common-input-element-apis:concept-input-max-2>maximum</a>, then abort these steps.</p>
- <li><p>If the element has a <a href=#concept-input-min id=common-input-element-apis:concept-input-min-3>minimum</a> and a <a href=#concept-input-max id=common-input-element-apis:concept-input-max-3>maximum</a> and there is no value greater than or equal to the
- element's <a href=#concept-input-min id=common-input-element-apis:concept-input-min-4>minimum</a> and less than or equal to the element's
- <a href=#concept-input-max id=common-input-element-apis:concept-input-max-4>maximum</a> that, when subtracted from the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero>step base</a>, is an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-2>allowed value step</a>, then abort these steps.</p>
- <li><p>If applying the <a href=#concept-input-value-string-number id=common-input-element-apis:concept-input-value-string-number-4>algorithm to convert a
- string to a number</a> to the string given by the element's <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-21>value</a> does not result in an error, then let <var>value</var> be the result of that algorithm. Otherwise, let <var>value</var>
- be zero.<li>
- <p>If <var>value</var> subtracted from the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero-2>step
- base</a> is not an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-3>allowed value
- step</a>, then set <var>value</var> to the nearest value that, when subtracted from
- the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero-3>step base</a>, is an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-4>allowed value step</a>, and that is less than <var>value</var> if the method invoked was the <code id=common-input-element-apis:dom-input-stepdown-3><a href=#dom-input-stepdown>stepDown()</a></code> and more than <var>value</var>
- otherwise.</p>
- <p>Otherwise (<var>value</var> subtracted from the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero-4>step base</a> is an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-5>allowed value step</a>), run the following substeps:</p>
- <ol><li><p>Let <var>n</var> be the argument.<li><p>Let <var>delta</var> be the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-6>allowed value
- step</a> multiplied by <var>n</var>.<li><p>If the method invoked was the <code id=common-input-element-apis:dom-input-stepdown-4><a href=#dom-input-stepdown>stepDown()</a></code> method,
- negate <var>delta</var>.<li><p>Let <var>value</var> be the result of adding <var>delta</var> to <var>value</var>.</ol>
- <li><p>If the element has a <a href=#concept-input-min id=common-input-element-apis:concept-input-min-5>minimum</a>, and <var>value</var> is less than that <a href=#concept-input-min id=common-input-element-apis:concept-input-min-6>minimum</a>, then set
- <var>value</var> to the smallest value that, when subtracted from the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero-5>step base</a>, is an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-7>allowed value step</a>, and that is more than or equal to <var>minimum</var>.<li><p>If the element has a <a href=#concept-input-min id=common-input-element-apis:concept-input-min-7>maximum</a>, and <var>value</var> is greater than that <a href=#concept-input-min id=common-input-element-apis:concept-input-min-8>maximum</a>, then
- set <var>value</var> to the largest value that, when subtracted from the <a href=#concept-input-min-zero id=common-input-element-apis:concept-input-min-zero-6>step base</a>, is an integral multiple of the <a href=#concept-input-step id=common-input-element-apis:concept-input-step-8>allowed value step</a>, and that is less than or equal to <var>maximum</var>.<li><p>Let <var>value as string</var> be the result of running the <a href=#concept-input-value-number-string id=common-input-element-apis:concept-input-value-number-string-4>algorithm to convert a number to a string</a>, as
- defined for the <code id=common-input-element-apis:the-input-element-14><a href=#the-input-element>input</a></code> element's <code id=common-input-element-apis:attr-input-type-12><a href=#attr-input-type>type</a></code>
- attribute's current state, on <var>value</var>.<li><p>Set the <a href=#concept-fe-value id=common-input-element-apis:concept-fe-value-22>value</a> of the element to <var>value
- as string</var>.</ol>
- <hr>
- <p>The <dfn id=dom-input-list><code>list</code></dfn> IDL attribute must return the current
- <a href=#concept-input-list id=common-input-element-apis:concept-input-list>suggestions source element</a>, if any, or null otherwise.</p>
-
-
- <h5 id=common-input-element-events>4.10.5.5 Common event behaviors</h5>
- <p>When the <code id=common-input-element-events:event-input-input><a href=#event-input-input>input</a></code> and <code id=common-input-element-events:event-input-change><a href=#event-input-change>change</a></code> events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply>apply</a>
- (which is the case for all <code id=common-input-element-events:the-input-element><a href=#the-input-element>input</a></code> controls other than <a href=#concept-button id=common-input-element-events:concept-button>buttons</a> and those with the <code id=common-input-element-events:attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#hidden-state-(type=hidden)" id="common-input-element-events:hidden-state-(type=hidden)">Hidden</a> state), the events are fired to indicate that the
- user has interacted with the control. The <dfn id=event-input-input><code>input</code></dfn>
- event fires whenever the user has modified the data of the control. The <dfn id=event-input-change><code>change</code></dfn> event fires when the value is committed, if
- that makes sense for the control, or else when the control <a href=#unfocus-causes-change-event>loses focus</a>. In all cases, the <code id=common-input-element-events:event-input-input-2><a href=#event-input-input>input</a></code> event comes before the corresponding <code id=common-input-element-events:event-input-change-2><a href=#event-input-change>change</a></code> event (if any).</p>
- <p>When an <code id=common-input-element-events:the-input-element-2><a href=#the-input-element>input</a></code> element has a defined <a href=#activation-behavior id=common-input-element-events:activation-behavior>activation behavior</a>, the rules
- for dispatching these events, if they <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-2>apply</a>, are given
- in the section above that defines the <code id=common-input-element-events:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute's
- state. (This is the case for all <code id=common-input-element-events:the-input-element-3><a href=#the-input-element>input</a></code> controls with the <code id=common-input-element-events:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute in the <a href="#checkbox-state-(type=checkbox)" id="common-input-element-events:checkbox-state-(type=checkbox)">Checkbox</a> state, the <a href="#radio-button-state-(type=radio)" id="common-input-element-events:radio-button-state-(type=radio)">Radio Button</a> state, or the <a href="#file-upload-state-(type=file)" id="common-input-element-events:file-upload-state-(type=file)">File Upload</a> state.)</p>
- <p>For <code id=common-input-element-events:the-input-element-4><a href=#the-input-element>input</a></code> elements without a defined <a href=#activation-behavior id=common-input-element-events:activation-behavior-2>activation behavior</a>, but to
- which these events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-3>apply</a>, and for which the user
- interface involves both interactive manipulation and an explicit commit action, then when the user
- changes the element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value>value</a>, the user agent must
- <a href=#queue-a-task id=common-input-element-events:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event>fire a simple event</a> that bubbles named <code id=common-input-element-events:event-input-input-3><a href=#event-input-input>input</a></code> at the <code id=common-input-element-events:the-input-element-5><a href=#the-input-element>input</a></code> element, and any time the user
- commits the change, the user agent must <a href=#queue-a-task id=common-input-element-events:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-2>fire a simple
- event</a> that bubbles named <code id=common-input-element-events:event-input-change-3><a href=#event-input-change>change</a></code> at the
- <code id=common-input-element-events:the-input-element-6><a href=#the-input-element>input</a></code> element.</p>
- <p class=example>An example of a user interface involving both interactive manipulation and a
- commit action would be a <a href="#range-state-(type=range)" id="common-input-element-events:range-state-(type=range)">Range</a> controls that use a
- slider, when manipulated using a pointing device. While the user is dragging the control's knob,
- <code id=common-input-element-events:event-input-input-4><a href=#event-input-input>input</a></code> events would fire whenever the position changed,
- whereas the <code id=common-input-element-events:event-input-change-4><a href=#event-input-change>change</a></code> event would only fire when the user
- let go of the knob, committing to a specific value.</p>
- <p>For <code id=common-input-element-events:the-input-element-7><a href=#the-input-element>input</a></code> elements without a defined <a href=#activation-behavior id=common-input-element-events:activation-behavior-3>activation behavior</a>, but to
- which these events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-4>apply</a>, and for which the user
- interface involves an explicit commit action but no intermediate manipulation, then any time the
- user commits a change to the element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-2>value</a>, the user
- agent must <a href=#queue-a-task id=common-input-element-events:queue-a-task-3>queue a task</a> to first <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-3>fire a simple event</a> that bubbles named
- <code id=common-input-element-events:event-input-input-5><a href=#event-input-input>input</a></code> at the <code id=common-input-element-events:the-input-element-8><a href=#the-input-element>input</a></code> element, and then
- <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-4>fire a simple event</a> that bubbles named <code id=common-input-element-events:event-input-change-5><a href=#event-input-change>change</a></code> at the <code id=common-input-element-events:the-input-element-9><a href=#the-input-element>input</a></code> element.</p>
- <p class=example>An example of a user interface with a commit action would be a <a href="#colour-state-(type=color)" id="common-input-element-events:colour-state-(type=color)">Colour</a> control that consists of a single button that brings
- up a colour wheel: if the <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-3>value</a> only changes when the dialog
- is closed, then that would be the explicit commit action. On the other hand, if manipulating the
- control changes the colour interactively, then there might be no commit action.</p>
- <p class=example>Another example of a user interface with a commit action would be a <a href="#date-state-(type=date)" id="common-input-element-events:date-state-(type=date)">Date</a> control that allows both text-based user input and user
- selection from a drop-down calendar: while text input might not have an explicit commit step,
- selecting a date from the drop down calendar and then dismissing the drop down would be a commit
- action.</p>
- <p>For <code id=common-input-element-events:the-input-element-10><a href=#the-input-element>input</a></code> elements without a defined <a href=#activation-behavior id=common-input-element-events:activation-behavior-4>activation behavior</a>, but to
- which these events <a href=#concept-input-apply id=common-input-element-events:concept-input-apply-5>apply</a>, any time the user causes the
- element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-4>value</a> to change without an explicit commit
- action, the user agent must <a href=#queue-a-task id=common-input-element-events:queue-a-task-4>queue a task</a> to <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-5>fire a simple event</a> that
- bubbles named <code id=common-input-element-events:event-input-input-6><a href=#event-input-input>input</a></code> at the <code id=common-input-element-events:the-input-element-11><a href=#the-input-element>input</a></code> element. The
- corresponding <code id=common-input-element-events:event-input-change-6><a href=#event-input-change>change</a></code> event, if any, will be fired when
- the control <a href=#unfocus-causes-change-event>loses focus</a>.</p>
- <p class=example>Examples of a user changing the element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-5>value</a> would include the user typing into a text field, pasting a
- new value into the field, or undoing an edit in that field. Some user interactions do not cause
- changes to the value, e.g. hitting the "delete" key in an empty text field, or replacing some text
- in the field with text from the clipboard that happens to be exactly the same text.</p>
- <p class=example>A <a href="#range-state-(type=range)" id="common-input-element-events:range-state-(type=range)-2">Range</a> control in the form of a
- slider that the user has <a href=#focused id=common-input-element-events:focused>focused</a> and is interacting with using a keyboard would be
- another example of the user changing the element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-6>value</a>
- without a commit step.</p>
- <p>In the case of <a href=#concept-task id=common-input-element-events:concept-task>tasks</a> that just fire an <code id=common-input-element-events:event-input-input-7><a href=#event-input-input>input</a></code> event, user agents may wait for a suitable break in the
- user's interaction before <a href=#queue-a-task id=common-input-element-events:queue-a-task-5>queuing</a> the tasks; for example, a
- user agent could wait for the user to have not hit a key for 100ms, so as to only fire the event
- when the user pauses, instead of continuously for each keystroke.
- <p>When the user agent is to change an <code id=common-input-element-events:the-input-element-12><a href=#the-input-element>input</a></code> element's <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-7>value</a> on behalf of the user (e.g. as part of a form prefilling
- feature), the user agent must <a href=#queue-a-task id=common-input-element-events:queue-a-task-6>queue a task</a> to first update the <a href=#concept-fe-value id=common-input-element-events:concept-fe-value-8>value</a> accordingly, then <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-6>fire a simple event</a> that
- bubbles named <code id=common-input-element-events:event-input-input-8><a href=#event-input-input>input</a></code> at the <code id=common-input-element-events:the-input-element-13><a href=#the-input-element>input</a></code> element,
- then <a href=#fire-a-simple-event id=common-input-element-events:fire-a-simple-event-7>fire a simple event</a> that bubbles named <code id=common-input-element-events:event-input-change-7><a href=#event-input-change>change</a></code> at the <code id=common-input-element-events:the-input-element-14><a href=#the-input-element>input</a></code> element.</p>
- <p class=note>These events are not fired in response to changes made to the values of form
- controls by scripts. (This is to make it easier to update the values of form controls in response
- to the user manipulating the controls, without having to then filter out the script's own changes
- to avoid an infinite loop.)</p>
- <p>The <a href=#task-source id=common-input-element-events:task-source>task source</a> for these <a href=#concept-task id=common-input-element-events:concept-task-2>tasks</a> is the
- <a href=#user-interaction-task-source id=common-input-element-events:user-interaction-task-source>user interaction task source</a>.</p>
-
- <h4 id=the-button-element>4.10.6 The <dfn><code>button</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-button-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-button-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-button-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-button-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-listed id=the-button-element:category-listed>Listed</a>, <a href=#category-label id=the-button-element:category-label>labelable</a>, <a href=#category-submit id=the-button-element:category-submit>submittable</a>, and <a href=#category-form-attr id=the-button-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-button-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-button-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-button-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-button-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-button-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-button-element:phrasing-content-2-3>Phrasing content</a>, but there must be no <a href=#interactive-content-2 id=the-button-element:interactive-content-2-2>interactive content</a> descendant.<dt><a href=#concept-element-tag-omission id=the-button-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-button-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-button-element:global-attributes>Global attributes</a><dd><code id=the-button-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> — Automatically focus the form control when the page is loaded<dd><code id=the-button-element:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-button-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-button-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-button-element:attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code> — <a href=#url id=the-button-element:url>URL</a> to use for <a href=#form-submission-2 id=the-button-element:form-submission-2>form submission</a><dd><code id=the-button-element:attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code> — Form data set encoding type to use for <a href=#form-submission-2 id=the-button-element:form-submission-2-2>form submission</a><dd><code id=the-button-element:attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code> — HTTP method to use for <a href=#form-submission-2 id=the-button-element:form-submission-2-3>form submission</a><dd><code id=the-button-element:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code> — Bypass form control validation for <a href=#form-submission-2 id=the-button-element:form-submission-2-4>form submission</a><dd><code id=the-button-element:attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code> — <a href=#browsing-context id=the-button-element:browsing-context>Browsing context</a> for <a href=#form-submission-2 id=the-button-element:form-submission-2-5>form submission</a><dd><code id=the-button-element:attr-button-menu><a href=#attr-button-menu>menu</a></code> — Specifies the element's <a href=#designated-pop-up-menu id=the-button-element:designated-pop-up-menu>designated pop-up menu</a><dd><code id=the-button-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use for <a href=#form-submission-2 id=the-button-element:form-submission-2-6>form submission</a> and in the <code id=the-button-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dd><code id=the-button-element:attr-button-type><a href=#attr-button-type>type</a></code> — Type of button<dd><code id=the-button-element:attr-button-value><a href=#attr-button-value>value</a></code> — Value to be used for <a href=#form-submission-2 id=the-button-element:form-submission-2-7>form submission</a><dt><a href=#concept-element-dom id=the-button-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlbuttonelement>HTMLButtonElement</dfn> : <a href=#htmlelement id=the-button-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-fe-autofocus id=the-button-element:dom-fe-autofocus>autofocus</a>;
- attribute boolean <a href=#dom-fe-disabled id=the-button-element:dom-fe-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-button-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-button-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-fs-formaction id=the-button-element:dom-fs-formaction>formAction</a>;
- attribute DOMString <a href=#dom-fs-formenctype id=the-button-element:dom-fs-formenctype>formEnctype</a>;
- attribute DOMString <a href=#dom-fs-formmethod id=the-button-element:dom-fs-formmethod>formMethod</a>;
- attribute boolean <a href=#dom-fs-formnovalidate id=the-button-element:dom-fs-formnovalidate>formNoValidate</a>;
- attribute DOMString <a href=#dom-fs-formtarget id=the-button-element:dom-fs-formtarget>formTarget</a>;
- attribute DOMString <a href=#dom-fe-name id=the-button-element:dom-fe-name>name</a>;
- attribute DOMString <a href=#dom-button-type id=the-button-element:dom-button-type>type</a>;
- attribute DOMString <a href=#dom-button-value id=the-button-element:dom-button-value>value</a>;
- attribute <a href=#htmlmenuelement id=the-button-element:htmlmenuelement>HTMLMenuElement</a>? <a href=#dom-button-menu id=the-button-element:dom-button-menu>menu</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-button-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-button-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-button-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-button-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-button-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-button-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-button-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-button-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-button-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
- <p>The <code id=the-button-element:the-button-element><a href=#the-button-element>button</a></code> element <a href=#represents id=the-button-element:represents>represents</a> a button labeled by its contents.</p>
- <p>The element is a <a href=#concept-button id=the-button-element:concept-button>button</a>.</p>
- <p>The <dfn id=attr-button-type><code>type</code></dfn> attribute controls the behavior of
- the button when it is activated. It is an <a href=#enumerated-attribute id=the-button-element:enumerated-attribute>enumerated attribute</a>. The following table
- lists the keywords and states for the attribute — the keywords in the left column map to the
- states in the cell in the second column on the same row as the keyword.</p>
- <table><thead><tr><th> Keyword
- <th> State
- <th> Brief description
- <tbody><tr><td><dfn id=attr-button-type-submit><code>submit</code></dfn>
- <td><a href=#attr-button-type-submit-state id=the-button-element:attr-button-type-submit-state>Submit Button</a>
- <td>Submits the form.
- <tr><td><dfn id=attr-button-type-reset><code>reset</code></dfn>
- <td><a href=#attr-button-type-reset-state id=the-button-element:attr-button-type-reset-state>Reset Button</a>
- <td>Resets the form.
- <tr><td><dfn id=attr-button-type-button><code>button</code></dfn>
- <td><a href=#attr-button-type-button-state id=the-button-element:attr-button-type-button-state>Button</a>
- <td>Does nothing.
- <tr><td><dfn id=attr-button-type-menu><code>menu</code></dfn>
- <td><a href=#attr-button-type-menu-state id=the-button-element:attr-button-type-menu-state>Menu</a>
- <td>Shows a menu.
- </table>
- <p>The <i id=the-button-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-button-type-submit-state id=the-button-element:attr-button-type-submit-state-2>Submit
- Button</a> state.</p>
- <p>If the <code id=the-button-element:attr-button-type-2><a href=#attr-button-type>type</a></code> attribute is in the <a href=#attr-button-type-submit-state id=the-button-element:attr-button-type-submit-state-3>Submit Button</a> state, the element is specifically a
- <a href=#concept-submit-button id=the-button-element:concept-submit-button>submit button</a>.</p>
-
- <p><strong>Constraint validation</strong>: If the <code id=the-button-element:attr-button-type-3><a href=#attr-button-type>type</a></code>
- attribute is in the <a href=#attr-button-type-reset-state id=the-button-element:attr-button-type-reset-state-2>Reset Button</a> state, the
- <a href=#attr-button-type-button-state id=the-button-element:attr-button-type-button-state-2>Button</a> state, or the <a href=#attr-button-type-menu-state id=the-button-element:attr-button-type-menu-state-2>Menu</a> state, the element is <a href=#barred-from-constraint-validation id=the-button-element:barred-from-constraint-validation>barred from constraint
- validation</a>.</p>
- <p>When a <code id=the-button-element:the-button-element-2><a href=#the-button-element>button</a></code> element is not <a href=#concept-fe-disabled id=the-button-element:concept-fe-disabled>disabled</a>,
- its <a href=#activation-behavior id=the-button-element:activation-behavior>activation behavior</a> element is to run the steps defined in the following list for
- the current state of the element's <code id=the-button-element:attr-button-type-4><a href=#attr-button-type>type</a></code> attribute:</p>
- <dl><dt> <dfn id=attr-button-type-submit-state>Submit Button</dfn> <dd><p>If the element has a <a href=#form-owner id=the-button-element:form-owner>form owner</a> and the element's <a id=the-button-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is
- <a href=#fully-active id=the-button-element:fully-active>fully active</a>, the element must <a href=#concept-form-submit id=the-button-element:concept-form-submit>submit</a> the
- <a href=#form-owner id=the-button-element:form-owner-2>form owner</a> from the <code id=the-button-element:the-button-element-3><a href=#the-button-element>button</a></code> element.<dt> <dfn id=attr-button-type-reset-state>Reset Button</dfn> <dd><p>If the element has a <a href=#form-owner id=the-button-element:form-owner-3>form owner</a> and the element's <a id=the-button-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is
- <a href=#fully-active id=the-button-element:fully-active-2>fully active</a>, the element must <a href=#concept-form-reset id=the-button-element:concept-form-reset>reset</a> the
- <a href=#form-owner id=the-button-element:form-owner-4>form owner</a>.<dt> <dfn id=attr-button-type-button-state>Button</dfn>
- <dd><p>Do nothing.<dt> <dfn id=attr-button-type-menu-state>Menu</dfn>
- <dd>
- <p>The element must follow these steps:</p>
- <ol><li><p>If the <code id=the-button-element:the-button-element-4><a href=#the-button-element>button</a></code> is not <a href=#being-rendered id=the-button-element:being-rendered>being rendered</a>, abort these
- steps.<li><p>If the <code id=the-button-element:the-button-element-5><a href=#the-button-element>button</a></code> element's <a id=the-button-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-button-element:fully-active-3>fully
- active</a>, abort these steps.<li><p>Let <var>menu</var> be the element's <a href=#designated-pop-up-menu id=the-button-element:designated-pop-up-menu-2>designated pop-up menu</a>, if
- any. If there isn't one, then abort these steps.<li><p><a href=#concept-event-fire id=the-button-element:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=the-button-element:concept-events-trusted>trusted</a> event with the name <code id=the-button-element:event-show><a href=#event-show>show</a></code> at <var>menu</var>, using the <code id=the-button-element:relatedevent><a href=#relatedevent>RelatedEvent</a></code>
- interface, with the <code id=the-button-element:dom-relatedevent-relatedtarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute
- initialised to the <code id=the-button-element:the-button-element-6><a href=#the-button-element>button</a></code> element. The event must be cancelable. <li><p>If the event is not canceled, then <a href=#build-and-show-a-menu id=the-button-element:build-and-show-a-menu>build and
- show</a> the menu for <var>menu</var>, with the <code id=the-button-element:the-button-element-7><a href=#the-button-element>button</a></code> element as the
- subject.</ol>
- </dl>
-
- <p>The <code id=the-button-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-button-element:the-button-element-8><a href=#the-button-element>button</a></code> element with its <a href=#form-owner id=the-button-element:form-owner-5>form owner</a>. The <code id=the-button-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name. The <code id=the-button-element:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make the control non-interactive and
- to prevent its value from being submitted. The <code id=the-button-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code>
- attribute controls focus. The <code id=the-button-element:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code>, <code id=the-button-element:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>, <code id=the-button-element:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code>, <code id=the-button-element:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code id=the-button-element:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code> attributes are <a href=#attributes-for-form-submission id=the-button-element:attributes-for-form-submission>attributes for form
- submission</a>.</p>
- <p class=note>The <code id=the-button-element:attr-fs-formnovalidate-3><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute can be
- used to make submit buttons that do not trigger the constraint validation.</p>
- <p>The <code id=the-button-element:attr-fs-formaction-3><a href=#attr-fs-formaction>formaction</a></code>, <code id=the-button-element:attr-fs-formenctype-3><a href=#attr-fs-formenctype>formenctype</a></code>, <code id=the-button-element:attr-fs-formmethod-3><a href=#attr-fs-formmethod>formmethod</a></code>, <code id=the-button-element:attr-fs-formnovalidate-4><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code id=the-button-element:attr-fs-formtarget-3><a href=#attr-fs-formtarget>formtarget</a></code> must not be specified if the element's <code id=the-button-element:attr-button-type-5><a href=#attr-button-type>type</a></code> attribute is not in the <a href=#attr-button-type-submit-state id=the-button-element:attr-button-type-submit-state-4>Submit Button</a> state.</p>
- <p>The <dfn id=attr-button-value><code>value</code></dfn> attribute gives the element's value
- for the purposes of form submission. The element's <a href=#concept-fe-value id=the-button-element:concept-fe-value>value</a> is
- the value of the element's <code id=the-button-element:attr-button-value-2><a href=#attr-button-value>value</a></code> attribute, if there is
- one, or the empty string otherwise.</p>
- <p class=note>A button (and its value) is only included in the form submission if the button
- itself was used to initiate the form submission.</p>
- <hr>
- <p>If the element's <code id=the-button-element:attr-button-type-6><a href=#attr-button-type>type</a></code> attribute is in the <a href=#attr-button-type-menu-state id=the-button-element:attr-button-type-menu-state-3>Menu</a> state, the <dfn id=attr-button-menu><code>menu</code></dfn> attribute must be specified to give the element's
- menu. The value must be the <a href=#concept-id id=the-button-element:concept-id>ID</a> of a <code id=the-button-element:the-menu-element><a href=#the-menu-element>menu</a></code> element in
- the same <a href=#home-subtree id=the-button-element:home-subtree>home subtree</a> whose <code id=the-button-element:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in
- the <a href=#popup-menu-state id=the-button-element:popup-menu-state>popup menu</a> state. The attribute must not be specified if
- the element's <code id=the-button-element:attr-button-type-7><a href=#attr-button-type>type</a></code> attribute is not in the <a href=#attr-button-type-menu-state id=the-button-element:attr-button-type-menu-state-4>Menu</a> state.</p>
-
- <p>A <code id=the-button-element:the-button-element-9><a href=#the-button-element>button</a></code> element's <dfn id=designated-pop-up-menu>designated pop-up menu</dfn> is the first element in the
- <code id=the-button-element:the-button-element-10><a href=#the-button-element>button</a></code>'s <a href=#home-subtree id=the-button-element:home-subtree-2>home subtree</a> whose ID is that given by the <code id=the-button-element:the-button-element-11><a href=#the-button-element>button</a></code>
- element's <code id=the-button-element:attr-button-menu-2><a href=#attr-button-menu>menu</a></code> attribute, if there is such an element and
- its <code id=the-button-element:attr-menu-type-2><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-button-element:popup-menu-state-2>popup menu</a> state; otherwise, the element has no <a href=#designated-pop-up-menu id=the-button-element:designated-pop-up-menu-3>designated pop-up
- menu</a>.</p>
- <hr>
- <p>The <dfn id=dom-button-value><code>value</code></dfn> and <dfn id=dom-button-menu><code>menu</code></dfn> IDL attributes must <a href=#reflect id=the-button-element:reflect>reflect</a> the
- content attributes of the same name.</p>
- <p>The <dfn id=dom-button-type><code>type</code></dfn> IDL attribute must
- <a href=#reflect id=the-button-element:reflect-2>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values id=the-button-element:limited-to-only-known-values>limited to only known
- values</a>.</p>
- <p>The <code id=the-button-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-button-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-button-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-button-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-button-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-button-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-button-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-button-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-button-element:the-label-element><a href=#the-label-element>label</a></code>s. The <code id=the-button-element:dom-fe-autofocus-2><a href=#dom-fe-autofocus>autofocus</a></code>, <code id=the-button-element:dom-fe-disabled-2><a href=#dom-fe-disabled>disabled</a></code>, <code id=the-button-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code>, and <code id=the-button-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are
- part of the element's forms API.</p>
-
- <div class=example>
- <p>The following button is labeled "Show hint" and pops up a dialog box when activated:</p>
- <pre><button type=button
- onclick="alert('This 15-20 minute piece was composed by George Gershwin.')">
- Show hint
- </button></pre>
- </div>
- <h4 id=the-select-element>4.10.7 The <dfn><code>select</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-select-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-select-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-select-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-select-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-listed id=the-select-element:category-listed>Listed</a>, <a href=#category-label id=the-select-element:category-label>labelable</a>, <a href=#category-submit id=the-select-element:category-submit>submittable</a>, <a href=#category-reset id=the-select-element:category-reset>resettable</a>, and <a href=#category-form-attr id=the-select-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-select-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-select-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-select-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-select-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-select-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-select-element:the-option-element><a href=#the-option-element>option</a></code>, <code id=the-select-element:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code>, and <a href=#script-supporting-elements-2 id=the-select-element:script-supporting-elements-2>script-supporting</a> elements.<dt><a href=#concept-element-tag-omission id=the-select-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-select-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-select-element:global-attributes>Global attributes</a><dd><code id=the-select-element:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> — Hint for form autofill feature<dd><code id=the-select-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> — Automatically focus the form control when the page is loaded<dd><code id=the-select-element:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-select-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-select-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-select-element:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> — Whether to allow multiple values<dd><code id=the-select-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use for <a href=#form-submission-2 id=the-select-element:form-submission-2>form submission</a> and in the <code id=the-select-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dd><code id=the-select-element:attr-select-required><a href=#attr-select-required>required</a></code> — Whether the control is required for <a href=#form-submission-2 id=the-select-element:form-submission-2-2>form submission</a><dd><code id=the-select-element:attr-select-size><a href=#attr-select-size>size</a></code> — Size of the control<dt><a href=#concept-element-dom id=the-select-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlselectelement>HTMLSelectElement</dfn> : <a href=#htmlelement id=the-select-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-fe-autocomplete id=the-select-element:dom-fe-autocomplete>autocomplete</a>;
- attribute boolean <a href=#dom-fe-autofocus id=the-select-element:dom-fe-autofocus>autofocus</a>;
- attribute boolean <a href=#dom-fe-disabled id=the-select-element:dom-fe-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-select-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-select-element:dom-fae-form>form</a>;
- attribute boolean <a href=#dom-select-multiple id=the-select-element:dom-select-multiple>multiple</a>;
- attribute DOMString <a href=#dom-fe-name id=the-select-element:dom-fe-name>name</a>;
- attribute boolean <a href=#dom-select-required id=the-select-element:dom-select-required>required</a>;
- attribute unsigned long <a href=#dom-select-size id=the-select-element:dom-select-size>size</a>;
- readonly attribute DOMString <a href=#dom-select-type id=the-select-element:dom-select-type>type</a>;
- readonly attribute <a href=#htmloptionscollection-2 id=the-select-element:htmloptionscollection-2>HTMLOptionsCollection</a> <a href=#dom-select-options id=the-select-element:dom-select-options>options</a>;
- attribute unsigned long <a href=#dom-select-length id=the-select-element:dom-select-length>length</a>;
- getter <a href=#element id=the-select-element:element>Element</a>? <a href=#dom-select-item id=the-select-element:dom-select-item>item</a>(unsigned long index);
- <a href=#htmloptionelement id=the-select-element:htmloptionelement>HTMLOptionElement</a>? <a href=#dom-select-nameditem id=the-select-element:dom-select-nameditem>namedItem</a>(DOMString name);
- void <a href=#dom-select-add id=the-select-element:dom-select-add>add</a>((<a href=#htmloptionelement id=the-select-element:htmloptionelement-2>HTMLOptionElement</a> or <a href=#htmloptgroupelement id=the-select-element:htmloptgroupelement>HTMLOptGroupElement</a>) element, optional (<a href=#htmlelement id=the-select-element:htmlelement-2>HTMLElement</a> or long)? before = null);
- void <a href=#dom-select-remove id=the-select-element:dom-select-remove>remove</a>(); // ChildNode overload
- void <a href=#dom-select-remove id=the-select-element:dom-select-remove-2>remove</a>(long index);
- <a href=#dom-select-setter id=the-select-element:dom-select-setter>setter creator</a> void (unsigned long index, <a href=#htmloptionelement id=the-select-element:htmloptionelement-3>HTMLOptionElement</a>? option);
- readonly attribute <a href=#htmlcollection id=the-select-element:htmlcollection>HTMLCollection</a> <a href=#dom-select-selectedoptions id=the-select-element:dom-select-selectedoptions>selectedOptions</a>;
- attribute long <a href=#dom-select-selectedindex id=the-select-element:dom-select-selectedindex>selectedIndex</a>;
- attribute DOMString <a href=#dom-select-value id=the-select-element:dom-select-value>value</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-select-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-select-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-select-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-select-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-select-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-select-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-select-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-select-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-select-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
-
- <p>The <code id=the-select-element:the-select-element><a href=#the-select-element>select</a></code> element represents a control for selecting amongst a set of
- options.</p>
- <p>The <dfn id=attr-select-multiple><code>multiple</code></dfn> attribute is a <a href=#boolean-attribute id=the-select-element:boolean-attribute>boolean
- attribute</a>. If the attribute is present, then the <code id=the-select-element:the-select-element-2><a href=#the-select-element>select</a></code> element
- <a href=#represents id=the-select-element:represents>represents</a> a control for selecting zero or more options from the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list>list of options</a>. If the attribute is absent, then the
- <code id=the-select-element:the-select-element-3><a href=#the-select-element>select</a></code> element <a href=#represents id=the-select-element:represents-2>represents</a> a control for selecting a single option from
- the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-2>list of options</a>.</p>
- <p>The <dfn id=attr-select-size><code>size</code></dfn> attribute gives the number of options
- to show to the user. The <code id=the-select-element:attr-select-size-2><a href=#attr-select-size>size</a></code> attribute, if specified, must
- have a value that is a <a href=#valid-non-negative-integer id=the-select-element:valid-non-negative-integer>valid non-negative integer</a> greater than zero.</p>
-
- <p>The <dfn id=concept-select-size>display size</dfn> of a <code id=the-select-element:the-select-element-4><a href=#the-select-element>select</a></code> element is the
- result of applying the <a href=#rules-for-parsing-non-negative-integers id=the-select-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to the value of
- element's <code id=the-select-element:attr-select-size-3><a href=#attr-select-size>size</a></code> attribute, if it has one and parsing it is
- successful. If applying those rules to the attribute's value is not successful, or if the <code id=the-select-element:attr-select-size-4><a href=#attr-select-size>size</a></code> attribute is absent, then the element's <a href=#concept-select-size id=the-select-element:concept-select-size>display size</a> is 4 if the element's <code id=the-select-element:attr-select-multiple-2><a href=#attr-select-multiple>multiple</a></code> content attribute is present, and 1 otherwise.</p>
-
- <p>The <dfn id=concept-select-option-list>list of options</dfn> for a <code id=the-select-element:the-select-element-5><a href=#the-select-element>select</a></code>
- element consists of all the <code id=the-select-element:the-option-element-2><a href=#the-option-element>option</a></code> element children of the <code id=the-select-element:the-select-element-6><a href=#the-select-element>select</a></code>
- element, and all the <code id=the-select-element:the-option-element-3><a href=#the-option-element>option</a></code> element children of all the <code id=the-select-element:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element
- children of the <code id=the-select-element:the-select-element-7><a href=#the-select-element>select</a></code> element, in <a href=#tree-order id=the-select-element:tree-order>tree order</a>.</p>
- <p>The <dfn id=attr-select-required><code>required</code></dfn> attribute is a <a href=#boolean-attribute id=the-select-element:boolean-attribute-2>boolean
- attribute</a>. When specified, the user will be required to select a value before submitting
- the form.</p>
- <p>If a <code id=the-select-element:the-select-element-8><a href=#the-select-element>select</a></code> element has a <code id=the-select-element:attr-select-required-2><a href=#attr-select-required>required</a></code>
- attribute specified, does not have a <code id=the-select-element:attr-select-multiple-3><a href=#attr-select-multiple>multiple</a></code> attribute
- specified, and has a <a href=#concept-select-size id=the-select-element:concept-select-size-2>display size</a> of 1; and if the <a href=#concept-option-value id=the-select-element:concept-option-value>value</a> of the first <code id=the-select-element:the-option-element-4><a href=#the-option-element>option</a></code> element in the
- <code id=the-select-element:the-select-element-9><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-3>list of options</a> (if
- any) is the empty string, and that <code id=the-select-element:the-option-element-5><a href=#the-option-element>option</a></code> element's parent node is the
- <code id=the-select-element:the-select-element-10><a href=#the-select-element>select</a></code> element (and not an <code id=the-select-element:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element), then that
- <code id=the-select-element:the-option-element-6><a href=#the-option-element>option</a></code> is the <code id=the-select-element:the-select-element-11><a href=#the-select-element>select</a></code> element's <dfn id=placeholder-label-option>placeholder label option</dfn>.</p>
- <p>If a <code id=the-select-element:the-select-element-12><a href=#the-select-element>select</a></code> element has a <code id=the-select-element:attr-select-required-3><a href=#attr-select-required>required</a></code>
- attribute specified, does not have a <code id=the-select-element:attr-select-multiple-4><a href=#attr-select-multiple>multiple</a></code> attribute
- specified, and has a <a href=#concept-select-size id=the-select-element:concept-select-size-3>display size</a> of 1, then the
- <code id=the-select-element:the-select-element-13><a href=#the-select-element>select</a></code> element must have a <a href=#placeholder-label-option id=the-select-element:placeholder-label-option>placeholder label option</a>.</p>
-
- <p><strong>Constraint validation</strong>: If the element has its <code id=the-select-element:attr-select-required-4><a href=#attr-select-required>required</a></code> attribute specified, and either none of the
- <code id=the-select-element:the-option-element-7><a href=#the-option-element>option</a></code> elements in the <code id=the-select-element:the-select-element-14><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-4>list of options</a> have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness>selectedness</a> set to true, or the only
- <code id=the-select-element:the-option-element-8><a href=#the-option-element>option</a></code> element in the <code id=the-select-element:the-select-element-15><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-5>list of options</a> with its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-2>selectedness</a> set to true is the <a href=#placeholder-label-option id=the-select-element:placeholder-label-option-2>placeholder label
- option</a>, then the element is <a href=#suffering-from-being-missing id=the-select-element:suffering-from-being-missing>suffering from being missing</a>.</p>
-
-
- <p>If the <code id=the-select-element:attr-select-multiple-5><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the element
- is not <a href=#concept-fe-disabled id=the-select-element:concept-fe-disabled>disabled</a>, then the user agent should allow the
- user to pick an <code id=the-select-element:the-option-element-9><a href=#the-option-element>option</a></code> element in its <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-6>list
- of options</a> that is itself not <a href=#concept-option-disabled id=the-select-element:concept-option-disabled>disabled</a>. Upon
- this <code id=the-select-element:the-option-element-10><a href=#the-option-element>option</a></code> element being <dfn id=concept-select-pick>picked</dfn> (either
- through a click, or through unfocusing the element after changing its value, or through a <a href=#using-the-option-element-to-define-a-command id=the-select-element:using-the-option-element-to-define-a-command>menu command</a>, or through any other mechanism), and before the
- relevant user interaction event is queued (e.g. before the
- <code id=the-select-element:event-click><a href=#event-click>click</a></code> event), the user agent must set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-3>selectedness</a> of the picked <code id=the-select-element:the-option-element-11><a href=#the-option-element>option</a></code> element
- to true, set its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness>dirtiness</a> to true, and then
- <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications>send <code>select</code> update notifications</a>.</p>
- <p>If the <code id=the-select-element:attr-select-multiple-6><a href=#attr-select-multiple>multiple</a></code> attribute is absent, whenever an
- <code id=the-select-element:the-option-element-12><a href=#the-option-element>option</a></code> element in the <code id=the-select-element:the-select-element-16><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-7>list of options</a> has its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-4>selectedness</a> set to true, and whenever an
- <code id=the-select-element:the-option-element-13><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-5>selectedness</a> set to true is added to the
- <code id=the-select-element:the-select-element-17><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-8>list of options</a>,
- the user agent must set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-6>selectedness</a> of all
- the other <code id=the-select-element:the-option-element-14><a href=#the-option-element>option</a></code> elements in its <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-9>list of
- options</a> to false.</p>
- <p>If the <code id=the-select-element:attr-select-multiple-7><a href=#attr-select-multiple>multiple</a></code> attribute is absent and the
- element's <a href=#concept-select-size id=the-select-element:concept-select-size-4>display size</a> is greater than 1, then the user
- agent should also allow the user to request that the <code id=the-select-element:the-option-element-15><a href=#the-option-element>option</a></code> whose <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-7>selectedness</a> is true, if any, be unselected. Upon this
- request being conveyed to the user agent, and before the relevant user interaction event is queued (e.g. before the <code id=the-select-element:event-click-2><a href=#event-click>click</a></code> event), the user agent must set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-8>selectedness</a> of that <code id=the-select-element:the-option-element-16><a href=#the-option-element>option</a></code> element to
- false, set its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-2>dirtiness</a> to true, and then
- <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications-2>send <code>select</code> update notifications</a>.</p>
- <p>If <a href=#nodes-are-inserted id=the-select-element:nodes-are-inserted>nodes are inserted</a> or <a href=#nodes-are-removed id=the-select-element:nodes-are-removed>nodes are removed</a> causing the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-10>list of options</a> to gain or lose one or more
- <code id=the-select-element:the-option-element-17><a href=#the-option-element>option</a></code> elements, or if an <code id=the-select-element:the-option-element-18><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-11>list of options</a> <dfn id=ask-for-a-reset>asks for
- a reset</dfn>, then, if the <code id=the-select-element:the-select-element-18><a href=#the-select-element>select</a></code> element's <code id=the-select-element:attr-select-multiple-8><a href=#attr-select-multiple>multiple</a></code> attribute is absent, the user agent must run the
- first applicable set of steps from the following list:</p>
- <dl class=switch><dt>If the <code id=the-select-element:the-select-element-19><a href=#the-select-element>select</a></code>
- element's <a href=#concept-select-size id=the-select-element:concept-select-size-5>display size</a> is 1, and no <code id=the-select-element:the-option-element-19><a href=#the-option-element>option</a></code>
- elements in the <code id=the-select-element:the-select-element-20><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-12>list of
- options</a> have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-9>selectedness</a> set to
- true<dd><p>Set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-10>selectedness</a> of the first
- <code id=the-select-element:the-option-element-20><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-13>list of
- options</a> in <a href=#tree-order id=the-select-element:tree-order-2>tree order</a> that is not <a href=#concept-option-disabled id=the-select-element:concept-option-disabled-2>disabled</a>, if any, to true.<dt>If two or more <code id=the-select-element:the-option-element-21><a href=#the-option-element>option</a></code> elements in the <code id=the-select-element:the-select-element-21><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-14>list of options</a> have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-11>selectedness</a> set to true<dd><p>Set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-12>selectedness</a> of all but the last
- <code id=the-select-element:the-option-element-22><a href=#the-option-element>option</a></code> element with its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-13>selectedness</a> set to true in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-15>list of options</a> in <a href=#tree-order id=the-select-element:tree-order-3>tree order</a> to
- false.</dl>
- <p>If the <code id=the-select-element:attr-select-multiple-9><a href=#attr-select-multiple>multiple</a></code> attribute is present, and the
- element is not <a href=#concept-fe-disabled id=the-select-element:concept-fe-disabled-2>disabled</a>, then the user agent should
- allow the user to <dfn id=concept-select-toggle>toggle</dfn> the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-14>selectedness</a> of the <code id=the-select-element:the-option-element-23><a href=#the-option-element>option</a></code> elements in
- its <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-16>list of options</a> that are themselves not <a href=#concept-option-disabled id=the-select-element:concept-option-disabled-3>disabled</a>. Upon such an element being <a href=#concept-select-toggle id=the-select-element:concept-select-toggle>toggled</a> (either through a click, or through a <a href=#using-the-option-element-to-define-a-command id=the-select-element:using-the-option-element-to-define-a-command-2>menu command</a>, or any other mechanism), and before the relevant user
- interaction event is queued (e.g. before a related <code id=the-select-element:event-click-3><a href=#event-click>click</a></code> event), the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-15>selectedness</a> of the <code id=the-select-element:the-option-element-24><a href=#the-option-element>option</a></code> element must
- be changed (from true to false or false to true), the <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-3>dirtiness</a> of the element must be set to true, and the
- user agent must <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications-3>send <code>select</code> update notifications</a>.</p>
- <p>When the user agent is to <dfn id=send-select-update-notifications>send <code>select</code> update notifications</dfn>, <a href=#queue-a-task id=the-select-element:queue-a-task>queue
- a task</a> to first <a href=#fire-a-simple-event id=the-select-element:fire-a-simple-event>fire a simple event</a> that bubbles named <code id=the-select-element:event-input><a href=#event-input>input</a></code> at the <code id=the-select-element:the-select-element-22><a href=#the-select-element>select</a></code> element, and then <a href=#fire-a-simple-event id=the-select-element:fire-a-simple-event-2>fire a simple
- event</a> that bubbles named <code id=the-select-element:event-change><a href=#event-change>change</a></code> at the
- <code id=the-select-element:the-select-element-23><a href=#the-select-element>select</a></code> element, using the <a href=#user-interaction-task-source id=the-select-element:user-interaction-task-source>user interaction task source</a> as the task
- source. If the <a href=#stack-of-script-settings-objects id=the-select-element:stack-of-script-settings-objects>stack of script settings objects</a> was not empty when the user agent was
- to <a href=#send-select-update-notifications id=the-select-element:send-select-update-notifications-4>send <code>select</code> update notifications</a>, then the resulting <code id=the-select-element:event-input-2><a href=#event-input>input</a></code> and <code id=the-select-element:event-change-2><a href=#event-change>change</a></code> events must not be
- <a href=#concept-events-trusted id=the-select-element:concept-events-trusted>trusted</a>.</p>
- <p>The <a href=#concept-form-reset-control id=the-select-element:concept-form-reset-control>reset algorithm</a> for <code id=the-select-element:the-select-element-24><a href=#the-select-element>select</a></code>
- elements is to go through all the <code id=the-select-element:the-option-element-25><a href=#the-option-element>option</a></code> elements in the element's <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-17>list of options</a>, set their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-16>selectedness</a> to true if the <code id=the-select-element:the-option-element-26><a href=#the-option-element>option</a></code>
- element has a <code id=the-select-element:attr-option-selected><a href=#attr-option-selected>selected</a></code> attribute, and false otherwise,
- set their <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-4>dirtiness</a> to false, and then have the
- <code id=the-select-element:the-option-element-27><a href=#the-option-element>option</a></code> elements <a href=#ask-for-a-reset id=the-select-element:ask-for-a-reset>ask for a reset</a>.</p>
-
- <p>
- The <code id=the-select-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the <code id=the-select-element:the-select-element-25><a href=#the-select-element>select</a></code> element with its <a href=#form-owner id=the-select-element:form-owner>form owner</a>.
- The <code id=the-select-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
- The <code id=the-select-element:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make the control non-interactive and to prevent its value from being submitted.
- The <code id=the-select-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
- The <code id=the-select-element:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent provides autofill behavior.
- </p>
- <p>A <code id=the-select-element:the-select-element-26><a href=#the-select-element>select</a></code> element that is not <a href=#concept-fe-disabled id=the-select-element:concept-fe-disabled-3>disabled</a> is
- <i id=the-select-element:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i>.</p>
- <dl class=domintro><dt><var>select</var> . <code id=the-select-element:dom-select-type-2><a href=#dom-select-type>type</a></code><dd>
- <p>Returns "<code>select-multiple</code>" if the element has a <code id=the-select-element:attr-select-multiple-10><a href=#attr-select-multiple>multiple</a></code> attribute, and "<code>select-one</code>"
- otherwise.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-options-2><a href=#dom-select-options>options</a></code><dd>
- <p>Returns an <code id=the-select-element:htmloptionscollection-2-2><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> of the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-18>list of options</a>.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-length-2><a href=#dom-select-length>length</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the number of elements in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-19>list of
- options</a>.</p>
- <p>When set to a smaller number, truncates the number of <code id=the-select-element:the-option-element-28><a href=#the-option-element>option</a></code> elements in the
- <code id=the-select-element:the-select-element-27><a href=#the-select-element>select</a></code>.</p>
- <p>When set to a greater number, adds new blank <code id=the-select-element:the-option-element-29><a href=#the-option-element>option</a></code> elements to the
- <code id=the-select-element:the-select-element-28><a href=#the-select-element>select</a></code>.</p>
- <dt><var>element</var> = <var>select</var> . <code id=the-select-element:dom-select-item-2><a href=#dom-select-item>item</a></code>(<var>index</var>)<dt><var>select</var>[<var>index</var>]<dd>
- <p>Returns the item with index <var>index</var> from the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-20>list of options</a>. The items are sorted in <a href=#tree-order id=the-select-element:tree-order-4>tree
- order</a>.</p>
- <dt><var>element</var> = <var>select</var> . <code id=the-select-element:dom-select-nameditem-2><a href=#dom-select-nameditem>namedItem</a></code>(<var>name</var>)<dd>
- <p>Returns the first item with <a href=#concept-id id=the-select-element:concept-id>ID</a> or <code id=the-select-element:attr-option-name><a href=#attr-option-name>name</a></code> <var>name</var> from the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-21>list of options</a>.</p>
- <p>Returns null if no element with that <a href=#concept-id id=the-select-element:concept-id-2>ID</a> could be found.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-add-2><a href=#dom-select-add>add</a></code>(<var>element</var> [, <var>before</var> ] )<dd>
- <p>Inserts <var>element</var> before the node given by <var>before</var>.</p>
- <p>The <var>before</var> argument can be a number, in which case <var>element</var> is inserted before the item with that number, or an element from the
- <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-22>list of options</a>, in which case <var>element</var> is inserted before that element.</p>
- <p>If <var>before</var> is omitted, null, or a number out of range, then <var>element</var> will be added at the end of the list.</p>
- <p>This method will throw a <code id=the-select-element:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception if <var>element</var> is an ancestor of the element into which it is to be inserted.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-selectedoptions-2><a href=#dom-select-selectedoptions>selectedOptions</a></code><dd>
- <p>Returns an <code id=the-select-element:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> of the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-23>list
- of options</a> that are selected.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-selectedindex-2><a href=#dom-select-selectedindex>selectedIndex</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the index of the first selected item, if any, or −1 if there is no selected
- item.</p>
- <p>Can be set, to change the selection.</p>
- <dt><var>select</var> . <code id=the-select-element:dom-select-value-2><a href=#dom-select-value>value</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the <a href=#concept-option-value id=the-select-element:concept-option-value-2>value</a> of the first selected item, if
- any, or the empty string if there is no selected item.</p>
- <p>Can be set, to change the selection.</p>
- </dl>
-
- <p>The <dfn id=dom-select-type><code>type</code></dfn> IDL attribute, on getting, must
- return the string "<code>select-one</code>" if the <code id=the-select-element:attr-select-multiple-11><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the string "<code>select-multiple</code>" if the <code id=the-select-element:attr-select-multiple-12><a href=#attr-select-multiple>multiple</a></code>
- attribute is present.</p>
- <p>The <dfn id=dom-select-options><code>options</code></dfn> IDL attribute must return an
- <code id=the-select-element:htmloptionscollection-2-3><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code> rooted at the <code id=the-select-element:the-select-element-29><a href=#the-select-element>select</a></code> node, whose filter matches
- the elements in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-24>list of options</a>.</p>
- <p>The <code id=the-select-element:dom-select-options-3><a href=#dom-select-options>options</a></code> collection is also mirrored on the
- <code id=the-select-element:htmlselectelement><a href=#htmlselectelement>HTMLSelectElement</a></code> object. The <a href=#supported-property-indices id=the-select-element:supported-property-indices>supported property indices</a> at any instant
- are the indices supported by the object returned by the <code id=the-select-element:dom-select-options-4><a href=#dom-select-options>options</a></code> attribute at that instant.</p>
- <p>The <dfn id=dom-select-length><code>length</code></dfn> IDL attribute must return the
- number of nodes <a href=#represented-by-the-collection id=the-select-element:represented-by-the-collection>represented</a> by the <code id=the-select-element:dom-select-options-5><a href=#dom-select-options>options</a></code> collection. On setting, it must act like the attribute
- of the same name on the <code id=the-select-element:dom-select-options-6><a href=#dom-select-options>options</a></code> collection.</p>
- <p>The <dfn id=dom-select-item><code>item(<var>index</var>)</code></dfn> method
- must return the value returned by <a href=#dom-htmlcollection-item id=the-select-element:dom-htmlcollection-item>the method of the same
- name</a> on the <code id=the-select-element:dom-select-options-7><a href=#dom-select-options>options</a></code> collection, when invoked with
- the same argument.</p>
- <p>The <dfn id=dom-select-nameditem><code>namedItem(<var>name</var>)</code></dfn>
- method must return the value returned by <a href=#dom-htmloptionscollection-nameditem id=the-select-element:dom-htmloptionscollection-nameditem>the
- method of the same name</a> on the <code id=the-select-element:dom-select-options-8><a href=#dom-select-options>options</a></code> collection,
- when invoked with the same argument.</p>
- <p>When the user agent is to <dfn id=dom-select-setter>set the value of a new indexed
- property</dfn> for a given property index <var>index</var> to a new value <var>value</var>, it must instead <a href=#dom-htmloptionscollection-setter id=the-select-element:dom-htmloptionscollection-setter>set the
- value of a new indexed property</a> with the given property index <var>index</var> to
- the new value <var>value</var> on the <code id=the-select-element:dom-select-options-9><a href=#dom-select-options>options</a></code>
- collection.</p>
- <p>Similarly, the <dfn id=dom-select-add><code>add()</code></dfn> method must act like its
- namesake method on that same <code id=the-select-element:dom-select-options-10><a href=#dom-select-options>options</a></code> collection.</p>
- <p>The <dfn id=dom-select-remove><code>remove()</code></dfn> method must act like its
- namesake method on that same <code id=the-select-element:dom-select-options-11><a href=#dom-select-options>options</a></code> collection when it
- has arguments, and like its namesake method on the <code id=the-select-element:childnode><a href=#childnode>ChildNode</a></code> interface implemented by
- the <code id=the-select-element:htmlselectelement-2><a href=#htmlselectelement>HTMLSelectElement</a></code> ancestor interface <code id=the-select-element:element-2><a href=#element>Element</a></code> when it has no
- arguments.</p>
- <p>The <dfn id=dom-select-selectedoptions><code>selectedOptions</code></dfn> IDL attribute
- must return an <code id=the-select-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-select-element:the-select-element-30><a href=#the-select-element>select</a></code> node, whose filter
- matches the elements in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-25>list of options</a> that
- have their <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-17>selectedness</a> set to true.</p>
- <p>The <dfn id=dom-select-selectedindex><code>selectedIndex</code></dfn> IDL attribute, on
- getting, must return the <a href=#concept-option-index id=the-select-element:concept-option-index>index</a> of the first
- <code id=the-select-element:the-option-element-30><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-26>list of
- options</a> in <a href=#tree-order id=the-select-element:tree-order-5>tree order</a> that has its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-18>selectedness</a> set to true, if any. If there isn't one,
- then it must return −1.</p>
- <p>On setting, the <code id=the-select-element:dom-select-selectedindex-3><a href=#dom-select-selectedindex>selectedIndex</a></code> attribute must set
- the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-19>selectedness</a> of all the <code id=the-select-element:the-option-element-31><a href=#the-option-element>option</a></code>
- elements in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-27>list of options</a> to false, and
- then the <code id=the-select-element:the-option-element-32><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-28>list of
- options</a> whose <a href=#concept-option-index id=the-select-element:concept-option-index-2>index</a> is the given new value, if
- any, must have its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-20>selectedness</a> set to true and
- its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-5>dirtiness</a> set to true.</p>
- <p class=note>This can result in no element having a <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-21>selectedness</a> set to true even in the case of the
- <code id=the-select-element:the-select-element-31><a href=#the-select-element>select</a></code> element having no <code id=the-select-element:attr-select-multiple-13><a href=#attr-select-multiple>multiple</a></code>
- attribute and a <a href=#concept-select-size id=the-select-element:concept-select-size-6>display size</a> of 1.</p>
- <p>The <dfn id=dom-select-value><code>value</code></dfn> IDL attribute, on getting, must
- return the <a href=#concept-option-value id=the-select-element:concept-option-value-3>value</a> of the first <code id=the-select-element:the-option-element-33><a href=#the-option-element>option</a></code>
- element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-29>list of options</a> in <a href=#tree-order id=the-select-element:tree-order-6>tree
- order</a> that has its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-22>selectedness</a> set to
- true, if any. If there isn't one, then it must return the empty string.</p>
- <p>On setting, the <code id=the-select-element:dom-select-value-3><a href=#dom-select-value>value</a></code> attribute must set the <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-23>selectedness</a> of all the <code id=the-select-element:the-option-element-34><a href=#the-option-element>option</a></code> elements
- in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-30>list of options</a> to false, and then the
- first <code id=the-select-element:the-option-element-35><a href=#the-option-element>option</a></code> element in the <a href=#concept-select-option-list id=the-select-element:concept-select-option-list-31>list of
- options</a>, in <a href=#tree-order id=the-select-element:tree-order-7>tree order</a>, whose <a href=#concept-option-value id=the-select-element:concept-option-value-4>value</a>
- is equal to the given new value, if any, must have its <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-24>selectedness</a> set to true and its <a href=#concept-option-dirtiness id=the-select-element:concept-option-dirtiness-6>dirtiness</a> set to true.</p>
- <p class=note>This can result in no element having a <a href=#concept-option-selectedness id=the-select-element:concept-option-selectedness-25>selectedness</a> set to true even in the case of the
- <code id=the-select-element:the-select-element-32><a href=#the-select-element>select</a></code> element having no <code id=the-select-element:attr-select-multiple-14><a href=#attr-select-multiple>multiple</a></code>
- attribute and a <a href=#concept-select-size id=the-select-element:concept-select-size-7>display size</a> of 1.</p>
- <p>The <dfn id=dom-select-multiple><code>multiple</code></dfn>, <dfn id=dom-select-required><code>required</code></dfn>, and <dfn id=dom-select-size><code>size</code></dfn> IDL attributes must <a href=#reflect id=the-select-element:reflect>reflect</a> the
- respective content attributes of the same name. The <code id=the-select-element:dom-select-size-2><a href=#dom-select-size>size</a></code> IDL
- attribute has a default value of zero.</p>
- <p class=note>For historical reasons, the default value of the <code id=the-select-element:dom-select-size-3><a href=#dom-select-size>size</a></code> IDL attribute does not return the actual size used, which, in
- the absence of the <code id=the-select-element:attr-select-size-5><a href=#attr-select-size>size</a></code> content attribute, is either 1 or 4
- depending on the presence of the <code id=the-select-element:attr-select-multiple-15><a href=#attr-select-multiple>multiple</a></code>
- attribute.</p>
- <p>The <code id=the-select-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-select-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-select-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-select-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-select-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-select-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-select-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-select-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-select-element:the-label-element><a href=#the-label-element>label</a></code>s. The <code id=the-select-element:dom-fe-autofocus-2><a href=#dom-fe-autofocus>autofocus</a></code>, <code id=the-select-element:dom-fe-disabled-2><a href=#dom-fe-disabled>disabled</a></code>, <code id=the-select-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code>, and <code id=the-select-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are
- part of the element's forms API.</p>
-
- <div class=example>
- <p>The following example shows how a <code id=the-select-element:the-select-element-33><a href=#the-select-element>select</a></code> element can be used to offer the user
- with a set of options from which the user can select a single option. The default option is
- preselected.</p>
- <pre><p>
- <label for="unittype">Select unit type:</label>
- <select id="unittype" name="unittype">
- <option value="1"> Miner </option>
- <option value="2"> Puffer </option>
- <option value="3" selected> Snipey </option>
- <option value="4"> Max </option>
- <option value="5"> Firebot </option>
- </select>
- </p></pre>
- <p>When there is no default option, a placeholder can be used instead:</p>
- <pre><select name="unittype" <strong>required</strong>>
- <strong><option value=""> Select unit type </option></strong>
- <option value="1"> Miner </option>
- <option value="2"> Puffer </option>
- <option value="3"> Snipey </option>
- <option value="4"> Max </option>
- <option value="5"> Firebot </option>
- </select></pre>
- </div>
- <div class=example>
- <p>Here, the user is offered a set of options from which he can select any number. By default,
- all five options are selected.</p>
- <pre><p>
- <label for="allowedunits">Select unit types to enable on this map:</label>
- <select id="allowedunits" name="allowedunits" multiple>
- <option value="1" selected> Miner </option>
- <option value="2" selected> Puffer </option>
- <option value="3" selected> Snipey </option>
- <option value="4" selected> Max </option>
- <option value="5" selected> Firebot </option>
- </select>
- </p></pre>
- </div>
- <div class=example>
- <p>Sometimes, a user has to select one or more items. This example shows such an interface.</p>
- <pre><p>Select the songs from that you would like on your Act II Mix Tape:</p>
- <select multiple required name="act2">
- <option value="s1">It Sucks to Be Me (Reprise)
- <option value="s2">There is Life Outside Your Apartment
- <option value="s3">The More You Ruv Someone
- <option value="s4">Schadenfreude
- <option value="s5">I Wish I Could Go Back to College
- <option value="s6">The Money Song
- <option value="s7">School for Monsters
- <option value="s8">The Money Song (Reprise)
- <option value="s9">There's a Fine, Fine Line (Reprise)
- <option value="s10">What Do You Do With a B.A. in English? (Reprise)
- <option value="s11">For Now
- </select></pre>
- </div>
- <h4 id=the-datalist-element>4.10.8 The <dfn><code>datalist</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-datalist-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-datalist-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-datalist-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-datalist-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-datalist-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-datalist-element:concept-element-content-model>Content model</a>:<dd>Either: <a href=#phrasing-content-2 id=the-datalist-element:phrasing-content-2-3>phrasing content</a>.<dd>Or: Zero or more <code id=the-datalist-element:the-option-element><a href=#the-option-element>option</a></code> and <span>script-supporting</span> elements.<dt><a href=#concept-element-tag-omission id=the-datalist-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-datalist-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-datalist-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-datalist-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldatalistelement>HTMLDataListElement</dfn> : <a href=#htmlelement id=the-datalist-element:htmlelement>HTMLElement</a> {
- readonly attribute <a href=#htmlcollection id=the-datalist-element:htmlcollection>HTMLCollection</a> <a href=#dom-datalist-options id=the-datalist-element:dom-datalist-options>options</a>;
- };</pre>
- </dl>
- <p>The <code id=the-datalist-element:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element represents a set of <code id=the-datalist-element:the-option-element-2><a href=#the-option-element>option</a></code> elements that
- represent predefined options for other controls. In the rendering, the <code id=the-datalist-element:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code>
- element <a href=#represents id=the-datalist-element:represents>represents</a> nothing and it, along with its children, should
- be hidden.</p>
- <p>The <code id=the-datalist-element:the-datalist-element-3><a href=#the-datalist-element>datalist</a></code> element can be used in two ways. In the simplest case, the
- <code id=the-datalist-element:the-datalist-element-4><a href=#the-datalist-element>datalist</a></code> element has just <code id=the-datalist-element:the-option-element-3><a href=#the-option-element>option</a></code> element children.</p>
- <div class=example>
- <pre><label>
- Sex:
- <input name=sex list=sexes>
- <datalist id=sexes>
- <option value="Female">
- <option value="Male">
- </datalist>
- </label></pre>
- </div>
- <p>In the more elaborate case, the <code id=the-datalist-element:the-datalist-element-5><a href=#the-datalist-element>datalist</a></code> element can be given contents that are to
- be displayed for down-level clients that don't support <code id=the-datalist-element:the-datalist-element-6><a href=#the-datalist-element>datalist</a></code>. In this case, the
- <code id=the-datalist-element:the-option-element-4><a href=#the-option-element>option</a></code> elements are provided inside a <code id=the-datalist-element:the-select-element><a href=#the-select-element>select</a></code> element inside the
- <code id=the-datalist-element:the-datalist-element-7><a href=#the-datalist-element>datalist</a></code> element.</p>
- <div class=example>
- <pre><label>
- Sex:
- <input name=sex list=sexes>
- </label>
- <datalist id=sexes>
- <label>
- or select from the list:
- <select name=sex>
- <option value="">
- <option>Female
- <option>Male
- </select>
- </label>
- </datalist></pre>
- </div>
- <p>The <code id=the-datalist-element:the-datalist-element-8><a href=#the-datalist-element>datalist</a></code> element is hooked up to an <code id=the-datalist-element:the-input-element><a href=#the-input-element>input</a></code> element using the <code id=the-datalist-element:attr-input-list><a href=#attr-input-list>list</a></code> attribute on the <code id=the-datalist-element:the-input-element-2><a href=#the-input-element>input</a></code> element.</p>
- <p>Each <code id=the-datalist-element:the-option-element-5><a href=#the-option-element>option</a></code> element that is a descendant of the <code id=the-datalist-element:the-datalist-element-9><a href=#the-datalist-element>datalist</a></code> element,
- that is not <a href=#concept-option-disabled id=the-datalist-element:concept-option-disabled>disabled</a>, and whose <a href=#concept-option-value id=the-datalist-element:concept-option-value>value</a> is a string that isn't the empty string, represents a
- suggestion. Each suggestion has a <a href=#concept-option-value id=the-datalist-element:concept-option-value-2>value</a> and a <a href=#concept-option-label id=the-datalist-element:concept-option-label>label</a>.
- <dl class=domintro><dt><var>datalist</var> . <code id=the-datalist-element:dom-datalist-options-2><a href=#dom-datalist-options>options</a></code><dd>
- <p>Returns an <code id=the-datalist-element:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> of the <code id=the-datalist-element:the-option-element-6><a href=#the-option-element>option</a></code> elements of the
- <code id=the-datalist-element:the-datalist-element-10><a href=#the-datalist-element>datalist</a></code> element.</p>
- </dl>
-
- <p>The <dfn id=dom-datalist-options><code>options</code></dfn> IDL attribute must return an
- <code id=the-datalist-element:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=the-datalist-element:the-datalist-element-11><a href=#the-datalist-element>datalist</a></code> node, whose filter matches
- <code id=the-datalist-element:the-option-element-7><a href=#the-option-element>option</a></code> elements.</p>
- <p><strong>Constraint validation</strong>: If an element has a <code id=the-datalist-element:the-datalist-element-12><a href=#the-datalist-element>datalist</a></code> element
- ancestor, it is <a href=#barred-from-constraint-validation id=the-datalist-element:barred-from-constraint-validation>barred from constraint validation</a>.</p>
-
- <h4 id=the-optgroup-element>4.10.9 The <dfn><code>optgroup</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-optgroup-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-optgroup-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-optgroup-element:the-select-element><a href=#the-select-element>select</a></code> element.<dt><a href=#concept-element-content-model id=the-optgroup-element:concept-element-content-model>Content model</a>:<dd>Zero or more <code id=the-optgroup-element:the-option-element><a href=#the-option-element>option</a></code> and <a href=#script-supporting-elements-2 id=the-optgroup-element:script-supporting-elements-2>script-supporting</a> elements.<dt><a href=#concept-element-tag-omission id=the-optgroup-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-optgroup-element:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element's <a href=#syntax-end-tag id=the-optgroup-element:syntax-end-tag>end tag</a> can be omitted
- if the <code id=the-optgroup-element:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element is
- immediately followed by another <code id=the-optgroup-element:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content in
- the parent element.<dt><a href=#concept-element-attributes id=the-optgroup-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-optgroup-element:global-attributes>Global attributes</a><dd><code id=the-optgroup-element:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-optgroup-element:attr-optgroup-label><a href=#attr-optgroup-label>label</a></code> — User-visible label<dt><a href=#concept-element-dom id=the-optgroup-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmloptgroupelement>HTMLOptGroupElement</dfn> : <a href=#htmlelement id=the-optgroup-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-optgroup-disabled id=the-optgroup-element:dom-optgroup-disabled>disabled</a>;
- attribute DOMString <a href=#dom-optgroup-label id=the-optgroup-element:dom-optgroup-label>label</a>;
- };</pre>
- </dl>
- <p>The <code id=the-optgroup-element:the-optgroup-element-4><a href=#the-optgroup-element>optgroup</a></code> element <a href=#represents id=the-optgroup-element:represents>represents</a> a group of <code id=the-optgroup-element:the-option-element-2><a href=#the-option-element>option</a></code>
- elements with a common label.</p>
- <p>The element's group of <code id=the-optgroup-element:the-option-element-3><a href=#the-option-element>option</a></code> elements consists of the <code id=the-optgroup-element:the-option-element-4><a href=#the-option-element>option</a></code>
- elements that are children of the <code id=the-optgroup-element:the-optgroup-element-5><a href=#the-optgroup-element>optgroup</a></code> element.</p>
-
- <p>When showing <code id=the-optgroup-element:the-option-element-5><a href=#the-option-element>option</a></code> elements in <code id=the-optgroup-element:the-select-element-2><a href=#the-select-element>select</a></code> elements, user agents should
- show the <code id=the-optgroup-element:the-option-element-6><a href=#the-option-element>option</a></code> elements of such groups as being related to each other and separate
- from other <code id=the-optgroup-element:the-option-element-7><a href=#the-option-element>option</a></code> elements.</p>
-
- <p>The <dfn id=attr-optgroup-disabled><code>disabled</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-optgroup-element:boolean-attribute>boolean attribute</a> and can be used to <a href=#concept-option-disabled id=the-optgroup-element:concept-option-disabled>disable</a> a group of <code id=the-optgroup-element:the-option-element-8><a href=#the-option-element>option</a></code> elements
- together.</p>
- <p>The <dfn id=attr-optgroup-label><code>label</code></dfn> attribute must be specified. Its
- value gives the name of the group, for the purposes of the user interface. User
- agents should use this attribute's value when labeling the group of <code id=the-optgroup-element:the-option-element-9><a href=#the-option-element>option</a></code> elements
- in a <code id=the-optgroup-element:the-select-element-3><a href=#the-select-element>select</a></code> element.</p>
-
- <p>The <dfn id=dom-optgroup-disabled><code>disabled</code></dfn> and <dfn id=dom-optgroup-label><code>label</code></dfn> attributes must <a href=#reflect id=the-optgroup-element:reflect>reflect</a> the
- respective content attributes of the same name.</p>
-
- <p class=note>There is no way to select an <code id=the-optgroup-element:the-optgroup-element-6><a href=#the-optgroup-element>optgroup</a></code> element. Only
- <code id=the-optgroup-element:the-option-element-10><a href=#the-option-element>option</a></code> elements can be selected. An <code id=the-optgroup-element:the-optgroup-element-7><a href=#the-optgroup-element>optgroup</a></code> element merely provides a
- label for a group of <code id=the-optgroup-element:the-option-element-11><a href=#the-option-element>option</a></code> elements.</p>
- <div class=example>
- <p>The following snippet shows how a set of lessons from three courses could be offered in a
- <code id=the-optgroup-element:the-select-element-4><a href=#the-select-element>select</a></code> drop-down widget:</p>
- <pre><form action="courseselector.dll" method="get">
- <p>Which course would you like to watch today?
- <p><label>Course:
- <select name="c">
- <optgroup label="8.01 Physics I: Classical Mechanics">
- <option value="8.01.1">Lecture 01: Powers of Ten
- <option value="8.01.2">Lecture 02: 1D Kinematics
- <option value="8.01.3">Lecture 03: Vectors
- <optgroup label="8.02 Electricity and Magnestism">
- <option value="8.02.1">Lecture 01: What holds our world together?
- <option value="8.02.2">Lecture 02: Electric Field
- <option value="8.02.3">Lecture 03: Electric Flux
- <optgroup label="8.03 Physics III: Vibrations and Waves">
- <option value="8.03.1">Lecture 01: Periodic Phenomenon
- <option value="8.03.2">Lecture 02: Beats
- <option value="8.03.3">Lecture 03: Forced Oscillations with Damping
- </select>
- </label>
- <p><input type=submit value="▶ Play">
- </form></pre>
- </div>
- <h4 id=the-option-element>4.10.10 The <dfn><code>option</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-option-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-option-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-option-element:the-select-element><a href=#the-select-element>select</a></code> element.<dd>As a child of a <code id=the-option-element:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element.<dd>As a child of an <code id=the-option-element:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element.<dt><a href=#concept-element-content-model id=the-option-element:concept-element-content-model>Content model</a>:<dd>If the element has a <code id=the-option-element:attr-option-label><a href=#attr-option-label>label</a></code> attribute and a <code id=the-option-element:attr-option-value><a href=#attr-option-value>value</a></code> attribute: <a href=#concept-content-nothing id=the-option-element:concept-content-nothing>Nothing</a>.<dd>If the element has a <code id=the-option-element:attr-option-label-2><a href=#attr-option-label>label</a></code> attribute but no <code id=the-option-element:attr-option-value-2><a href=#attr-option-value>value</a></code> attribute: <a href=#text-content id=the-option-element:text-content>Text</a>.<dd>If the element has no <code id=the-option-element:attr-option-label-3><a href=#attr-option-label>label</a></code> attribute: <a href=#text-content id=the-option-element:text-content-2>Text</a> that is not <a href=#inter-element-whitespace id=the-option-element:inter-element-whitespace>inter-element whitespace</a>.<dt><a href=#concept-element-tag-omission id=the-option-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>An <code id=the-option-element:the-option-element><a href=#the-option-element>option</a></code> element's <a href=#syntax-end-tag id=the-option-element:syntax-end-tag>end tag</a> can be omitted if
- the <code id=the-option-element:the-option-element-2><a href=#the-option-element>option</a></code> element is immediately followed by another <code id=the-option-element:the-option-element-3><a href=#the-option-element>option</a></code> element, or
- if it is immediately followed by an <code id=the-option-element:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content
- in the parent element.<dt><a href=#concept-element-attributes id=the-option-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-option-element:global-attributes>Global attributes</a><dd><code id=the-option-element:attr-option-disabled><a href=#attr-option-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-option-element:attr-option-label-4><a href=#attr-option-label>label</a></code> — User-visible label<dd><code id=the-option-element:attr-option-selected><a href=#attr-option-selected>selected</a></code> — Whether the option is selected by default<dd><code id=the-option-element:attr-option-value-3><a href=#attr-option-value>value</a></code> — Value to be used for <a href=#form-submission-2 id=the-option-element:form-submission-2>form submission</a><dt><a href=#concept-element-dom id=the-option-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>[NamedConstructor=<a href=#dom-option id=the-option-element:dom-option>Option</a>(optional DOMString text = "", optional DOMString value, optional boolean defaultSelected = false, optional boolean selected = false)]
- interface <dfn id=htmloptionelement>HTMLOptionElement</dfn> : <a href=#htmlelement id=the-option-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-option-disabled id=the-option-element:dom-option-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-option-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-option-form id=the-option-element:dom-option-form>form</a>;
- attribute DOMString <a href=#dom-option-label id=the-option-element:dom-option-label>label</a>;
- attribute boolean <a href=#dom-option-defaultselected id=the-option-element:dom-option-defaultselected>defaultSelected</a>;
- attribute boolean <a href=#dom-option-selected id=the-option-element:dom-option-selected>selected</a>;
- attribute DOMString <a href=#dom-option-value id=the-option-element:dom-option-value>value</a>;
- attribute DOMString <a href=#dom-option-text id=the-option-element:dom-option-text>text</a>;
- readonly attribute long <a href=#dom-option-index id=the-option-element:dom-option-index>index</a>;
- };</pre>
- </dl>
- <p>The <code id=the-option-element:the-option-element-4><a href=#the-option-element>option</a></code> element <a href=#represents id=the-option-element:represents>represents</a> an option in a <code id=the-option-element:the-select-element-2><a href=#the-select-element>select</a></code>
- element or as part of a list of suggestions in a <code id=the-option-element:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code> element.</p>
- <p>In certain circumstances described in the definition of the <code id=the-option-element:the-select-element-3><a href=#the-select-element>select</a></code> element, an
- <code id=the-option-element:the-option-element-5><a href=#the-option-element>option</a></code> element can be a <code id=the-option-element:the-select-element-4><a href=#the-select-element>select</a></code> element's <a href=#placeholder-label-option id=the-option-element:placeholder-label-option>placeholder label
- option</a>. A <a href=#placeholder-label-option id=the-option-element:placeholder-label-option-2>placeholder label option</a> does not represent an actual option, but
- instead represents a label for the <code id=the-option-element:the-select-element-5><a href=#the-select-element>select</a></code> control.</p>
- <p>The <dfn id=attr-option-disabled><code>disabled</code></dfn> attribute is a <a href=#boolean-attribute id=the-option-element:boolean-attribute>boolean
- attribute</a>. An <code id=the-option-element:the-option-element-6><a href=#the-option-element>option</a></code> element is <dfn id=concept-option-disabled>disabled</dfn> if its <code id=the-option-element:attr-option-disabled-2><a href=#attr-option-disabled>disabled</a></code> attribute is present or if it is a child of an
- <code id=the-option-element:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element whose <code id=the-option-element:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute
- is present.</p>
-
- <p>An <code id=the-option-element:the-option-element-7><a href=#the-option-element>option</a></code> element that is <a href=#attr-option-disabled id=the-option-element:attr-option-disabled-3>disabled</a> must
- prevent any <code id=the-option-element:event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task id=the-option-element:queue-a-task>queued</a> on the <a href=#user-interaction-task-source id=the-option-element:user-interaction-task-source>user interaction task source</a> from being dispatched on the
- element.</p>
-
- <p>The <dfn id=attr-option-label><code>label</code></dfn> attribute provides a label for
- element. The <dfn id=concept-option-label>label</dfn> of an <code id=the-option-element:the-option-element-8><a href=#the-option-element>option</a></code> element is
- the value of the <code id=the-option-element:attr-option-label-5><a href=#attr-option-label>label</a></code> content attribute, if there is one,
- or, if there is not, the value of the element's <code id=the-option-element:dom-option-text-2><a href=#dom-option-text>text</a></code> IDL
- attribute.</p>
- <p>The <code id=the-option-element:attr-option-label-6><a href=#attr-option-label>label</a></code> content attribute, if specified, must not be
- empty.</p>
- <p>The <dfn id=attr-option-value><code>value</code></dfn> attribute provides a value for
- element. The <dfn id=concept-option-value>value</dfn> of an <code id=the-option-element:the-option-element-9><a href=#the-option-element>option</a></code> element is
- the value of the <code id=the-option-element:attr-option-value-4><a href=#attr-option-value>value</a></code> content attribute, if there is one,
- or, if there is not, the value of the element's <code id=the-option-element:dom-option-text-3><a href=#dom-option-text>text</a></code> IDL
- attribute.</p>
- <p>The <dfn id=attr-option-selected><code>selected</code></dfn> attribute is a <a href=#boolean-attribute id=the-option-element:boolean-attribute-2>boolean
- attribute</a>. It represents the default <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness>selectedness</a> of the element.</p>
-
- <p>The <dfn id=concept-option-dirtiness>dirtiness</dfn> of an <code id=the-option-element:the-option-element-10><a href=#the-option-element>option</a></code> element is
- a boolean state, initially false. It controls whether adding or removing the <code id=the-option-element:attr-option-selected-2><a href=#attr-option-selected>selected</a></code> content attribute has any effect.</p>
- <p>The <dfn id=concept-option-selectedness>selectedness</dfn> of an <code id=the-option-element:the-option-element-11><a href=#the-option-element>option</a></code>
- element is a boolean state, initially false. Except where otherwise specified, when the element is
- created, its <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-2>selectedness</a> must be set to true if
- the element has a <code id=the-option-element:attr-option-selected-3><a href=#attr-option-selected>selected</a></code> attribute. Whenever an
- <code id=the-option-element:the-option-element-12><a href=#the-option-element>option</a></code> element's <code id=the-option-element:attr-option-selected-4><a href=#attr-option-selected>selected</a></code> attribute is
- added, if its <a href=#concept-option-dirtiness id=the-option-element:concept-option-dirtiness>dirtiness</a> is false, its <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-3>selectedness</a> must be set to true. Whenever an
- <code id=the-option-element:the-option-element-13><a href=#the-option-element>option</a></code> element's <code id=the-option-element:attr-option-selected-5><a href=#attr-option-selected>selected</a></code> attribute is
- <em>removed</em>, if its <a href=#concept-option-dirtiness id=the-option-element:concept-option-dirtiness-2>dirtiness</a> is false, its
- <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-4>selectedness</a> must be set to false.</p>
- <p class=note>The <code id=the-option-element:dom-option-2><a href=#dom-option>Option()</a></code> constructor, when called with three
- or fewer arguments, overrides the initial state of the <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-5>selectedness</a> state to always be false even if the third
- argument is true (implying that a <code id=the-option-element:attr-option-selected-6><a href=#attr-option-selected>selected</a></code> attribute is
- to be set). The fourth argument can be used to explicitly set the initial <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-6>selectedness</a> state when using the constructor.</p>
-
-
- <p>A <code id=the-option-element:the-select-element-6><a href=#the-select-element>select</a></code> element whose <code id=the-option-element:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
- attribute is not specified must not have more than one descendant <code id=the-option-element:the-option-element-14><a href=#the-option-element>option</a></code> element with
- its <code id=the-option-element:attr-option-selected-7><a href=#attr-option-selected>selected</a></code> attribute set.</p>
-
- <p>An <code id=the-option-element:the-option-element-15><a href=#the-option-element>option</a></code> element's <dfn id=concept-option-index>index</dfn> is the number of
- <code id=the-option-element:the-option-element-16><a href=#the-option-element>option</a></code> elements that are in the same <a href=#concept-select-option-list id=the-option-element:concept-select-option-list>list of
- options</a> but that come before it in <a href=#tree-order id=the-option-element:tree-order>tree order</a>. If the <code id=the-option-element:the-option-element-17><a href=#the-option-element>option</a></code>
- element is not in a <a href=#concept-select-option-list id=the-option-element:concept-select-option-list-2>list of options</a>, then the
- <code id=the-option-element:the-option-element-18><a href=#the-option-element>option</a></code> element's <a href=#concept-option-index id=the-option-element:concept-option-index>index</a> is zero.</p>
-
- <dl class=domintro><dt><var>option</var> . <code id=the-option-element:dom-option-selected-2><a href=#dom-option-selected>selected</a></code><dd>
- <p>Returns true if the element is selected, and false otherwise.</p>
- <p>Can be set, to override the current state of the element.</p>
- <dt><var>option</var> . <code id=the-option-element:dom-option-index-2><a href=#dom-option-index>index</a></code><dd>
- <p>Returns the index of the element in its <code id=the-option-element:the-select-element-7><a href=#the-select-element>select</a></code> element's <code id=the-option-element:dom-select-options><a href=#dom-select-options>options</a></code> list.</p>
- <dt><var>option</var> . <code id=the-option-element:dom-option-form-2><a href=#dom-option-form>form</a></code><dd>
- <p>Returns the element's <code id=the-option-element:the-form-element><a href=#the-form-element>form</a></code> element, if any, or null otherwise.</p>
- <dt><var>option</var> . <code id=the-option-element:dom-option-text-4><a href=#dom-option-text>text</a></code><dd>
- <p>Same as <code id=the-option-element:textcontent><a href=#textcontent>textContent</a></code>, except that spaces are collapsed and <code id=the-option-element:the-script-element><a href=#the-script-element>script</a></code> elements are skipped.</p>
- <dt><var>option</var> = new <code id=the-option-element:dom-option-3><a href=#dom-option>Option</a></code>( [ <var>text</var> [, <var>value</var> [, <var>defaultSelected</var> [, <var>selected</var> ] ] ] ] )<dd>
- <p>Returns a new <code id=the-option-element:the-option-element-19><a href=#the-option-element>option</a></code> element.</p>
- <p>The <var>text</var> argument sets the contents of the element.</p>
- <p>The <var>value</var> argument sets the <code id=the-option-element:attr-option-value-5><a href=#attr-option-value>value</a></code>
- attribute.</p>
- <p>The <var>defaultSelected</var> argument sets the <code id=the-option-element:attr-option-selected-8><a href=#attr-option-selected>selected</a></code> attribute.</p>
- <p>The <var>selected</var> argument sets whether or not the element is selected. If it
- is omitted, even if the <var>defaultSelected</var> argument is true, the element is not
- selected.</p>
- </dl>
-
- <p>The <dfn id=dom-option-disabled><code>disabled</code></dfn> IDL attribute must
- <a href=#reflect id=the-option-element:reflect>reflect</a> the content attribute of the same name. The <dfn id=dom-option-defaultselected><code>defaultSelected</code></dfn> IDL attribute must
- <a href=#reflect id=the-option-element:reflect-2>reflect</a> the <code id=the-option-element:attr-option-selected-9><a href=#attr-option-selected>selected</a></code> content attribute.</p>
- <p>The <dfn id=dom-option-label><code>label</code></dfn> IDL attribute, on getting, must
- return the element's <a href=#concept-option-label id=the-option-element:concept-option-label>label</a>. On setting, the element's
- <code id=the-option-element:attr-option-label-7><a href=#attr-option-label>label</a></code> content attribute must be set to the new value.</p>
- <p>The <dfn id=dom-option-value><code>value</code></dfn> IDL attribute, on getting, must
- return the element's <a href=#concept-option-value id=the-option-element:concept-option-value>value</a>. On setting, the element's
- <code id=the-option-element:attr-option-value-6><a href=#attr-option-value>value</a></code> content attribute must be set to the new value.</p>
- <p>The <dfn id=dom-option-selected><code>selected</code></dfn> IDL attribute, on getting,
- must return true if the element's <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-7>selectedness</a>
- is true, and false otherwise. On setting, it must set the element's <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-8>selectedness</a> to the new value, set its <a href=#concept-option-dirtiness id=the-option-element:concept-option-dirtiness-3>dirtiness</a> to true, and then cause the element to
- <a href=#ask-for-a-reset id=the-option-element:ask-for-a-reset>ask for a reset</a>.</p>
- <p>The <dfn id=dom-option-index><code>index</code></dfn> IDL attribute must return the
- element's <a href=#concept-option-index id=the-option-element:concept-option-index-2>index</a>.</p>
- <p>The <dfn id=dom-option-text><code>text</code></dfn> IDL attribute, on getting, must
- return the result of <a href=#strip-and-collapse-whitespace id=the-option-element:strip-and-collapse-whitespace>stripping and collapsing
- whitespace</a> from the concatenation of <a href=#concept-cd-data id=the-option-element:concept-cd-data>data</a> of all the
- <code id=the-option-element:text><a href=#text>Text</a></code> node descendants of the <code id=the-option-element:the-option-element-20><a href=#the-option-element>option</a></code> element, in <a href=#tree-order id=the-option-element:tree-order-2>tree order</a>,
- excluding any that are descendants of descendants of the <code id=the-option-element:the-option-element-21><a href=#the-option-element>option</a></code> element that are
- themselves <code id=the-option-element:the-script-element-2><a href=#the-script-element>script</a></code> elements in the <a href=#html-namespace-2 id=the-option-element:html-namespace-2>HTML namespace</a> or <code>script</code> elements in the <a href=#svg-namespace id=the-option-element:svg-namespace>SVG namespace</a>.</p>
- <p>On setting, the <code id=the-option-element:dom-option-text-5><a href=#dom-option-text>text</a></code> attribute must act as if the
- <code id=the-option-element:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute on the element had been set to the new value.</p>
- <p>The <dfn id=dom-option-form><code>form</code></dfn> IDL attribute's behavior depends on
- whether the <code id=the-option-element:the-option-element-22><a href=#the-option-element>option</a></code> element is in a <code id=the-option-element:the-select-element-8><a href=#the-select-element>select</a></code> element or not. If the
- <code id=the-option-element:the-option-element-23><a href=#the-option-element>option</a></code> has a <code id=the-option-element:the-select-element-9><a href=#the-select-element>select</a></code> element as its parent, or has an
- <code id=the-option-element:the-optgroup-element-4><a href=#the-optgroup-element>optgroup</a></code> element as its parent and that <code id=the-option-element:the-optgroup-element-5><a href=#the-optgroup-element>optgroup</a></code> element has a
- <code id=the-option-element:the-select-element-10><a href=#the-select-element>select</a></code> element as its parent, then the <code id=the-option-element:dom-option-form-3><a href=#dom-option-form>form</a></code> IDL
- attribute must return the same value as the <code id=the-option-element:dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute
- on that <code id=the-option-element:the-select-element-11><a href=#the-select-element>select</a></code> element. Otherwise, it must return null.</p>
- <p>A constructor is provided for creating <code id=the-option-element:htmloptionelement><a href=#htmloptionelement>HTMLOptionElement</a></code> objects (in addition to
- the factory methods from DOM such as <code>createElement()</code>): <dfn id=dom-option><code>Option(<var>text</var>, <var>value</var>, <var>defaultSelected</var>, <var>selected</var>)</code></dfn>. When invoked as a
- constructor, it must return a new <code id=the-option-element:htmloptionelement-2><a href=#htmloptionelement>HTMLOptionElement</a></code> object (a new <code id=the-option-element:the-option-element-24><a href=#the-option-element>option</a></code>
- element). If the first argument is not the empty string, the new object must have as its only
- child a <code id=the-option-element:text-2><a href=#text>Text</a></code> node whose data is the value of that argument. Otherwise, it must have
- no children. If the <var>value</var> argument is present, the new object must have a
- <code id=the-option-element:attr-option-value-7><a href=#attr-option-value>value</a></code> attribute set with the value of the argument as its
- value. If the <var>defaultSelected</var> argument is true, the new object must have a
- <code id=the-option-element:attr-option-selected-10><a href=#attr-option-selected>selected</a></code> attribute set with no value. If the <var>selected</var> argument is true, the new object must have its <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-9>selectedness</a> set to true; otherwise the <a href=#concept-option-selectedness id=the-option-element:concept-option-selectedness-10>selectedness</a> must be set to false, even if the <var>defaultSelected</var> argument is true. The element's <a id=the-option-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> must be the <a href=#active-document id=the-option-element:active-document>active
- document</a> of the <a href=#browsing-context id=the-option-element:browsing-context>browsing context</a> of the <code id=the-option-element:window><a href=#window>Window</a></code> object on which
- the interface object of the invoked constructor is found.</p>
-
- <h4 id=the-textarea-element>4.10.11 The <dfn><code>textarea</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-textarea-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-textarea-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-textarea-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-textarea-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-listed id=the-textarea-element:category-listed>Listed</a>, <a href=#category-label id=the-textarea-element:category-label>labelable</a>, <a href=#category-submit id=the-textarea-element:category-submit>submittable</a>, <a href=#category-reset id=the-textarea-element:category-reset>resettable</a>, and <a href=#category-form-attr id=the-textarea-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-textarea-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-textarea-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-textarea-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-textarea-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-textarea-element:concept-element-content-model>Content model</a>:<dd><a href=#text-content id=the-textarea-element:text-content>Text</a>.<dt><a href=#concept-element-tag-omission id=the-textarea-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-textarea-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-textarea-element:global-attributes>Global attributes</a><dd><code id=the-textarea-element:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> — Hint for form autofill feature<dd><code id=the-textarea-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> — Automatically focus the form control when the page is loaded<dd><code id=the-textarea-element:attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> — Maximum number of characters per line<dd><code id=the-textarea-element:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> — Name of form field to use for sending the element's <a href=#the-directionality id=the-textarea-element:the-directionality>directionality</a> in <a href=#form-submission-2 id=the-textarea-element:form-submission-2>form submission</a><dd><code id=the-textarea-element:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-textarea-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-textarea-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-textarea-element:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> — Hint for selecting an input modality<dd><code id=the-textarea-element:attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code> — Maximum length of value<dd><code id=the-textarea-element:attr-textarea-minlength><a href=#attr-textarea-minlength>minlength</a></code> — Minimum length of value<dd><code id=the-textarea-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use for <a href=#form-submission-2 id=the-textarea-element:form-submission-2-2>form submission</a> and in the <code id=the-textarea-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dd><code id=the-textarea-element:attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code> — User-visible label to be placed within the form control<dd><code id=the-textarea-element:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> — Whether to allow the value to be edited by the user<dd><code id=the-textarea-element:attr-textarea-required><a href=#attr-textarea-required>required</a></code> — Whether the control is required for <a href=#form-submission-2 id=the-textarea-element:form-submission-2-3>form submission</a><dd><code id=the-textarea-element:attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> — Number of lines to show<dd><code id=the-textarea-element:attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> — How the value of the form control is to be wrapped for <a href=#form-submission-2 id=the-textarea-element:form-submission-2-4>form submission</a><dt><a href=#concept-element-dom id=the-textarea-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltextareaelement>HTMLTextAreaElement</dfn> : <a href=#htmlelement id=the-textarea-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-fe-autocomplete id=the-textarea-element:dom-fe-autocomplete>autocomplete</a>;
- attribute boolean <a href=#dom-fe-autofocus id=the-textarea-element:dom-fe-autofocus>autofocus</a>;
- attribute unsigned long <a href=#dom-textarea-cols id=the-textarea-element:dom-textarea-cols>cols</a>;
- attribute DOMString <a href=#dom-textarea-dirname id=the-textarea-element:dom-textarea-dirname>dirName</a>;
- attribute boolean <a href=#dom-fe-disabled id=the-textarea-element:dom-fe-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-textarea-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-textarea-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-textarea-inputmode id=the-textarea-element:dom-textarea-inputmode>inputMode</a>;
- attribute long <a href=#dom-textarea-maxlength id=the-textarea-element:dom-textarea-maxlength>maxLength</a>;
- attribute long <a href=#dom-textarea-minlength id=the-textarea-element:dom-textarea-minlength>minLength</a>;
- attribute DOMString <a href=#dom-fe-name id=the-textarea-element:dom-fe-name>name</a>;
- attribute DOMString <a href=#dom-textarea-placeholder id=the-textarea-element:dom-textarea-placeholder>placeholder</a>;
- attribute boolean <a href=#dom-textarea-readonly id=the-textarea-element:dom-textarea-readonly>readOnly</a>;
- attribute boolean <a href=#dom-textarea-required id=the-textarea-element:dom-textarea-required>required</a>;
- attribute unsigned long <a href=#dom-textarea-rows id=the-textarea-element:dom-textarea-rows>rows</a>;
- attribute DOMString <a href=#dom-textarea-wrap id=the-textarea-element:dom-textarea-wrap>wrap</a>;
- readonly attribute DOMString <a href=#dom-textarea-type id=the-textarea-element:dom-textarea-type>type</a>;
- attribute DOMString <a href=#dom-textarea-defaultvalue id=the-textarea-element:dom-textarea-defaultvalue>defaultValue</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-textarea-value id=the-textarea-element:dom-textarea-value>value</a>;
- readonly attribute unsigned long <a href=#dom-textarea-textlength id=the-textarea-element:dom-textarea-textlength>textLength</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-textarea-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-textarea-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-textarea-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-textarea-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-textarea-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-textarea-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-textarea-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-textarea-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-textarea-element:dom-lfe-labels>labels</a>;
- void <a href=#dom-textarea/input-select id=the-textarea-element:dom-textarea/input-select>select</a>();
- attribute unsigned long <a href=#dom-textarea/input-selectionstart id=the-textarea-element:dom-textarea/input-selectionstart>selectionStart</a>;
- attribute unsigned long <a href=#dom-textarea/input-selectionend id=the-textarea-element:dom-textarea/input-selectionend>selectionEnd</a>;
- attribute DOMString <a href=#dom-textarea/input-selectiondirection id=the-textarea-element:dom-textarea/input-selectiondirection>selectionDirection</a>;
- void <a href=#dom-textarea/input-setrangetext id=the-textarea-element:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
- void <a href=#dom-textarea/input-setrangetext id=the-textarea-element:dom-textarea/input-setrangetext-2>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode id=the-textarea-element:selectionmode>SelectionMode</a> selectionMode = "preserve");
- void <a href=#dom-textarea/input-setselectionrange id=the-textarea-element:dom-textarea/input-setselectionrange>setSelectionRange</a>(unsigned long start, unsigned long end, optional DOMString direction);
- };</pre>
- </dl>
- <p>The <code id=the-textarea-element:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element <a href=#represents id=the-textarea-element:represents>represents</a> a multiline plain text edit
- control for the element's <dfn id=concept-textarea-raw-value>raw
- value</dfn>. The contents of the control represent the control's default value.</p>
-
- <p>The <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value>raw value</a> of a <code id=the-textarea-element:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>
- control must be initially the empty string.</p>
- <p class=note>This element <a href=#bidireq>has rendering requirements involving the
- bidirectional algorithm</a>.</p>
-
- <p>The <dfn id=attr-textarea-readonly><code>readonly</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-textarea-element:boolean-attribute>boolean attribute</a> used to control whether the text can be edited by the user or
- not.</p>
- <div class=example>
- <p>In this example, a text field is marked read-only because it represents a read-only file:</p>
- <pre>Filename: <code>/etc/bash.bashrc</code>
- <textarea name="buffer" readonly>
- # System-wide .bashrc file for interactive bash(1) shells.
- # To enable the settings / commands in this file for login shells as well,
- # this file has to be sourced in /etc/profile.
- # If not running interactively, don't do anything
- [ -z "$PS1" ] &amp;&amp; return
- ...</textarea></pre>
- </div>
-
- <p><strong>Constraint validation</strong>: If the <code id=the-textarea-element:attr-textarea-readonly-2><a href=#attr-textarea-readonly>readonly</a></code> attribute is specified on a <code id=the-textarea-element:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code>
- element, the element is <a href=#barred-from-constraint-validation id=the-textarea-element:barred-from-constraint-validation>barred from constraint validation</a>.</p>
- <p>A <code id=the-textarea-element:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> element is <a href=#concept-fe-mutable id=the-textarea-element:concept-fe-mutable>mutable</a> if it is
- neither <a href=#concept-fe-disabled id=the-textarea-element:concept-fe-disabled>disabled</a> nor has a <code id=the-textarea-element:attr-textarea-readonly-3><a href=#attr-textarea-readonly>readonly</a></code> attribute specified.</p>
- <p>When a <code id=the-textarea-element:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code> is <a href=#concept-fe-mutable id=the-textarea-element:concept-fe-mutable-2>mutable</a>, its <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-2>raw value</a> should be editable by the user: the user agent
- should allow the user to edit, insert, and remove text, and to insert and remove line breaks in
- the form of U+000A LINE FEED (LF) characters. Any time the user causes the element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-3>raw value</a> to change, the user agent must <a href=#queue-a-task id=the-textarea-element:queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event id=the-textarea-element:fire-a-simple-event>fire a simple event</a> that bubbles named <code id=the-textarea-element:event-input><a href=#event-input>input</a></code> at the <code id=the-textarea-element:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code> element. User agents may wait for a
- suitable break in the user's interaction before queuing the task; for example, a user agent could
- wait for the user to have not hit a key for 100ms, so as to only fire the event when the user
- pauses, instead of continuously for each keystroke.</p>
- <p>A <code id=the-textarea-element:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code> element has a <dfn id=concept-textarea-dirty>dirty value
- flag</dfn>, which must be initially set to false, and must be set to true whenever the user
- interacts with the control in a way that changes the <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-4>raw
- value</a>.</p>
- <p>When the <code id=the-textarea-element:the-textarea-element-8><a href=#the-textarea-element>textarea</a></code> element's <code id=the-textarea-element:textcontent><a href=#textcontent>textContent</a></code> IDL attribute changes value,
- if the element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty>dirty value flag</a> is false, then the
- element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-5>raw value</a> must be set to the value of
- the element's <code id=the-textarea-element:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <a href=#concept-form-reset-control id=the-textarea-element:concept-form-reset-control>reset algorithm</a> for <code id=the-textarea-element:the-textarea-element-9><a href=#the-textarea-element>textarea</a></code>
- elements is to set the element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-6>raw value</a> to the
- value of the element's <code id=the-textarea-element:textcontent-3><a href=#textcontent>textContent</a></code> IDL attribute.</p>
-
-
- <p>If the element is <a href=#concept-fe-mutable id=the-textarea-element:concept-fe-mutable-3>mutable</a>, the user agent should allow
- the user to change the writing direction of the element, setting it either to a left-to-right
- writing direction or a right-to-left writing direction. If the user does so, the user agent must
- then run the following steps:</p>
- <ol><li><p>Set the element's <code id=the-textarea-element:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute to "<code id=the-textarea-element:attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code>" if the user selected a left-to-right writing direction, and
- "<code id=the-textarea-element:attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code>" if the user selected a right-to-left writing
- direction.<li><p><a href=#queue-a-task id=the-textarea-element:queue-a-task-2>Queue a task</a> to <a href=#fire-a-simple-event id=the-textarea-element:fire-a-simple-event-2>fire a simple event</a> that bubbles named <code id=the-textarea-element:event-input-2><a href=#event-input>input</a></code> at the <code id=the-textarea-element:the-textarea-element-10><a href=#the-textarea-element>textarea</a></code> element.</ol>
-
- <p>The <dfn id=attr-textarea-cols><code>cols</code></dfn> attribute specifies the expected
- maximum number of characters per line. If the <code id=the-textarea-element:attr-textarea-cols-2><a href=#attr-textarea-cols>cols</a></code>
- attribute is specified, its value must be a <a href=#valid-non-negative-integer id=the-textarea-element:valid-non-negative-integer>valid non-negative integer</a> greater than
- zero. If applying the <a href=#rules-for-parsing-non-negative-integers id=the-textarea-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> to
- the attribute's value results in a number greater than zero, then the element's <dfn id=attr-textarea-cols-value>character width</dfn> is that value; otherwise, it is
- 20.</p>
-
- <p>The user agent may use the <code id=the-textarea-element:the-textarea-element-11><a href=#the-textarea-element>textarea</a></code> element's <a href=#attr-textarea-cols-value id=the-textarea-element:attr-textarea-cols-value>character width</a> as a hint to the user as to how many
- characters the server prefers per line (e.g. for visual user agents by making the width of the
- control be that many characters). In visual renderings, the user agent should wrap the user's
- input in the rendering so that each line is no wider than this number of characters.</p>
-
- <p>The <dfn id=attr-textarea-rows><code>rows</code></dfn> attribute specifies the number of
- lines to show. If the <code id=the-textarea-element:attr-textarea-rows-2><a href=#attr-textarea-rows>rows</a></code> attribute is specified, its
- value must be a <a href=#valid-non-negative-integer id=the-textarea-element:valid-non-negative-integer-2>valid non-negative integer</a> greater than zero. If
- applying the <a href=#rules-for-parsing-non-negative-integers id=the-textarea-element:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> to the attribute's value results
- in a number greater than zero, then the element's <dfn id=attr-textarea-rows-value>character
- height</dfn> is that value; otherwise, it is 2.</p>
-
- <p>Visual user agents should set the height of the control to the number of lines given by <a href=#attr-textarea-rows-value id=the-textarea-element:attr-textarea-rows-value>character height</a>.</p>
-
- <p>The <dfn id=attr-textarea-wrap><code>wrap</code></dfn> attribute is an <a href=#enumerated-attribute id=the-textarea-element:enumerated-attribute>enumerated
- attribute</a> with two keywords and states: the <dfn id=attr-textarea-wrap-soft><code>soft</code></dfn> keyword which maps to the <a href=#attr-textarea-wrap-soft-state id=the-textarea-element:attr-textarea-wrap-soft-state>Soft</a> state, and the <dfn id=attr-textarea-wrap-hard><code>hard</code></dfn> keyword which maps to the <a href=#attr-textarea-wrap-hard-state id=the-textarea-element:attr-textarea-wrap-hard-state>Hard</a> state. The <i id=the-textarea-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the
- <a href=#attr-textarea-wrap-soft-state id=the-textarea-element:attr-textarea-wrap-soft-state-2>Soft</a> state.</p>
- <p>The <dfn id=attr-textarea-wrap-soft-state>Soft</dfn> state indicates that the text in the
- <code id=the-textarea-element:the-textarea-element-12><a href=#the-textarea-element>textarea</a></code> is not to be wrapped when it is submitted (though it can still be wrapped in
- the rendering).</p>
- <p>The <dfn id=attr-textarea-wrap-hard-state>Hard</dfn> state indicates that the text in the
- <code id=the-textarea-element:the-textarea-element-13><a href=#the-textarea-element>textarea</a></code> is to have newlines added by the user agent so that the text is wrapped when
- it is submitted.</p>
- <p>If the element's <code id=the-textarea-element:attr-textarea-wrap-2><a href=#attr-textarea-wrap>wrap</a></code> attribute is in the <a href=#attr-textarea-wrap-hard-state id=the-textarea-element:attr-textarea-wrap-hard-state-2>Hard</a> state, the <code id=the-textarea-element:attr-textarea-cols-3><a href=#attr-textarea-cols>cols</a></code> attribute must be specified.</p>
-
-
- <p>For historical reasons, the element's value is normalised in three different ways for three
- different purposes. The <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-7>raw value</a> is the value as
- it was originally set. It is not normalized. The <a href=#concept-textarea-api-value id=the-textarea-element:concept-textarea-api-value>API
- value</a> is the value used in the <code id=the-textarea-element:dom-textarea-value-2><a href=#dom-textarea-value>value</a></code> IDL
- attribute. It is normalised so that line breaks use U+000A LINE FEED (LF) characters. Finally,
- there is the <a href=#concept-fe-value id=the-textarea-element:concept-fe-value>value</a>, as used in form submission and other
- processing models in this specification. It is normalised so that line breaks use U+000D CARRIAGE
- RETURN U+000A LINE FEED (CRLF) character pairs, and in addition, if necessary given the element's
- <code id=the-textarea-element:attr-textarea-wrap-3><a href=#attr-textarea-wrap>wrap</a></code> attribute, additional line breaks are inserted to
- wrap the text at the given width.</p>
- <p>The element's <dfn id=concept-textarea-api-value>API value</dfn> is defined to be the
- element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-8>raw value</a> with the following
- transformation applied:</p>
- <ol><li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair from the <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-9>raw value</a> with a single U+000A LINE FEED (LF)
- character.<li><p>Replace every remaining U+000D CARRIAGE RETURN character from the <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-10>raw value</a> with a single U+000A LINE FEED (LF)
- character.</ol>
- <p>The element's <a href=#concept-fe-value id=the-textarea-element:concept-fe-value-2>value</a> is defined to be the element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-11>raw value</a> with the <a href=#textarea-wrapping-transformation id=the-textarea-element:textarea-wrapping-transformation>textarea wrapping
- transformation</a> applied. The <dfn id=textarea-wrapping-transformation>textarea wrapping transformation</dfn> is the following
- algorithm, as applied to a string:</p>
- <ol><li><p>Replace every occurrence of a U+000D CARRIAGE RETURN (CR) character not followed by a
- U+000A LINE FEED (LF) character, and every occurrence of a U+000A LINE FEED (LF) character not
- preceded by a U+000D CARRIAGE RETURN (CR) character, by a two-character string consisting of a
- U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pair.<li><p>If the element's <code id=the-textarea-element:attr-textarea-wrap-4><a href=#attr-textarea-wrap>wrap</a></code> attribute is in the <a href=#attr-textarea-wrap-hard-state id=the-textarea-element:attr-textarea-wrap-hard-state-3>Hard</a> state, insert U+000D CARRIAGE RETURN U+000A
- LINE FEED (CRLF) character pairs into the string using a UA-defined algorithm so that each line
- has no more than <a href=#attr-textarea-cols-value id=the-textarea-element:attr-textarea-cols-value-2>character width</a> characters. For
- the purposes of this requirement, lines are delimited by the start of the string, the end of the
- string, and U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character pairs.</ol>
-
- <p>The <dfn id=attr-textarea-maxlength><code>maxlength</code></dfn> attribute is a <a href=#attr-fe-maxlength id=the-textarea-element:attr-fe-maxlength>form control <code>maxlength</code> attribute</a> controlled
- by the <code id=the-textarea-element:the-textarea-element-14><a href=#the-textarea-element>textarea</a></code> element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty-2>dirty value
- flag</a>.</p>
- <p>If the <code id=the-textarea-element:the-textarea-element-15><a href=#the-textarea-element>textarea</a></code> element has a <a href=#maximum-allowed-value-length id=the-textarea-element:maximum-allowed-value-length>maximum allowed value length</a>, then the
- element's children must be such that the <a href=#code-unit-length id=the-textarea-element:code-unit-length>code-unit length</a> of the value of the
- element's <code id=the-textarea-element:textcontent-4><a href=#textcontent>textContent</a></code> IDL attribute with the <a href=#textarea-wrapping-transformation id=the-textarea-element:textarea-wrapping-transformation-2>textarea wrapping
- transformation</a> applied is equal to or less than the element's <a href=#maximum-allowed-value-length id=the-textarea-element:maximum-allowed-value-length-2>maximum allowed value
- length</a>.</p>
- <p>The <dfn id=attr-textarea-minlength><code>minlength</code></dfn> attribute is a <a href=#attr-fe-minlength id=the-textarea-element:attr-fe-minlength>form control <code>minlength</code> attribute</a>
- controlled by the <code id=the-textarea-element:the-textarea-element-16><a href=#the-textarea-element>textarea</a></code> element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty-3>dirty
- value flag</a>.</p>
-
- <p>The <dfn id=attr-textarea-required><code>required</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-textarea-element:boolean-attribute-2>boolean attribute</a>. When specified, the user will be required to enter a value before
- submitting the form.</p>
-
- <p><strong>Constraint validation</strong>: If the element has its <code id=the-textarea-element:attr-textarea-required-2><a href=#attr-textarea-required>required</a></code> attribute specified, and the element is <a href=#concept-fe-mutable id=the-textarea-element:concept-fe-mutable-4>mutable</a>, and the element's <a href=#concept-fe-value id=the-textarea-element:concept-fe-value-3>value</a> is the empty string, then the element is <a href=#suffering-from-being-missing id=the-textarea-element:suffering-from-being-missing>suffering
- from being missing</a>.</p>
-
-
- <p>The <dfn id=attr-textarea-placeholder><code>placeholder</code></dfn> attribute represents
- a <em>short</em> hint (a word or short phrase) intended to aid the user with data entry when the
- control has no value. A hint could be a sample value or a brief description of the expected
- format.</p>
- <p>The <code id=the-textarea-element:attr-textarea-placeholder-2><a href=#attr-textarea-placeholder>placeholder</a></code> attribute should not be used as
- an alternative to a <code id=the-textarea-element:the-label-element><a href=#the-label-element>label</a></code>. For a longer hint or other advisory text, the <code id=the-textarea-element:attr-title><a href=#attr-title>title</a></code> attribute is more appropriate.</p>
- <p class=note>These mechanisms are very similar but subtly different: the hint given by the
- control's <code id=the-textarea-element:the-label-element-2><a href=#the-label-element>label</a></code> is shown at all times; the short hint given in the <code id=the-textarea-element:attr-textarea-placeholder-3><a href=#attr-textarea-placeholder>placeholder</a></code> attribute is shown before the user enters a
- value; and the hint in the <code id=the-textarea-element:attr-title-2><a href=#attr-title>title</a></code> attribute is shown when the user
- requests further help.</p>
-
- <p>User agents should present this hint to the user when the element's <a href=#concept-fe-value id=the-textarea-element:concept-fe-value-4>value</a> is the empty string and the control is not
- <a href=#focused id=the-textarea-element:focused>focused</a> (e.g. by displaying it inside a blank unfocused control). All U+000D CARRIAGE
- RETURN U+000A LINE FEED character pairs (CRLF) in the hint, as well as all other U+000D CARRIAGE
- RETURN (CR) and U+000A LINE FEED (LF) characters in the hint, must be treated as line breaks when
- rendering the hint.
- </p>
-
- <p>
- The <code id=the-textarea-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.
- The <code id=the-textarea-element:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code> attribute controls how the element's <a href=#the-directionality id=the-textarea-element:the-directionality-2>directionality</a> is submitted.
- The <code id=the-textarea-element:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make the control
- non-interactive and to prevent its value from being submitted.
- The <code id=the-textarea-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-textarea-element:the-textarea-element-17><a href=#the-textarea-element>textarea</a></code> element with its <a href=#form-owner id=the-textarea-element:form-owner>form owner</a>.
- The <code id=the-textarea-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute controls focus.
- The <code id=the-textarea-element:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code> attribute controls the user interface's input
- modality for the control.
- The <code id=the-textarea-element:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute controls how the user agent
- provides autofill behavior.
- </p>
- <dl class=domintro><dt><var>textarea</var> . <code id=the-textarea-element:dom-textarea-type-2><a href=#dom-textarea-type>type</a></code><dd>
- <p>Returns the string "<code>textarea</code>".</p>
- <dt><var>textarea</var> . <code id=the-textarea-element:dom-textarea-value-3><a href=#dom-textarea-value>value</a></code><dd>
- <p>Returns the current value of the element.</p>
- <p>Can be set, to change the value.</p>
- </dl>
-
- <p>The <dfn id=dom-textarea-cols><code>cols</code></dfn>, <dfn id=dom-textarea-placeholder><code>placeholder</code></dfn>, <dfn id=dom-textarea-required><code>required</code></dfn>, <dfn id=dom-textarea-rows><code>rows</code></dfn>, and <dfn id=dom-textarea-wrap><code>wrap</code></dfn> attributes must <a href=#reflect id=the-textarea-element:reflect>reflect</a> the
- respective content attributes of the same name. The <code id=the-textarea-element:dom-textarea-cols-2><a href=#dom-textarea-cols>cols</a></code>
- and <code id=the-textarea-element:dom-textarea-rows-2><a href=#dom-textarea-rows>rows</a></code> attributes are <a href=#limited-to-only-non-negative-numbers-greater-than-zero id=the-textarea-element:limited-to-only-non-negative-numbers-greater-than-zero>limited to only non-negative
- numbers greater than zero</a>. The <code id=the-textarea-element:dom-textarea-cols-3><a href=#dom-textarea-cols>cols</a></code> attribute's
- default value is 20. The <code id=the-textarea-element:dom-textarea-rows-3><a href=#dom-textarea-rows>rows</a></code> attribute's default value is
- 2. The <dfn id=dom-textarea-dirname><code>dirName</code></dfn> IDL attribute must
- <a href=#reflect id=the-textarea-element:reflect-2>reflect</a> the <code id=the-textarea-element:attr-fe-dirname-3><a href=#attr-fe-dirname>dirname</a></code> content attribute. The <dfn id=dom-textarea-inputmode><code>inputMode</code></dfn> IDL attribute must
- <a href=#reflect id=the-textarea-element:reflect-3>reflect</a> the <code id=the-textarea-element:attr-fe-inputmode-3><a href=#attr-fe-inputmode>inputmode</a></code> content attribute,
- <a href=#limited-to-only-known-values id=the-textarea-element:limited-to-only-known-values>limited to only known values</a>. The <dfn id=dom-textarea-maxlength><code>maxLength</code></dfn> IDL attribute must
- <a href=#reflect id=the-textarea-element:reflect-4>reflect</a> the <code id=the-textarea-element:attr-textarea-maxlength-2><a href=#attr-textarea-maxlength>maxlength</a></code> content attribute,
- <a href=#limited-to-only-non-negative-numbers id=the-textarea-element:limited-to-only-non-negative-numbers>limited to only non-negative numbers</a>. The <dfn id=dom-textarea-minlength><code>minLength</code></dfn> IDL attribute must
- <a href=#reflect id=the-textarea-element:reflect-5>reflect</a> the <code id=the-textarea-element:attr-textarea-minlength-2><a href=#attr-textarea-minlength>minlength</a></code> content attribute,
- <a href=#limited-to-only-non-negative-numbers id=the-textarea-element:limited-to-only-non-negative-numbers-2>limited to only non-negative numbers</a>. The <dfn id=dom-textarea-readonly><code>readOnly</code></dfn> IDL attribute must <a href=#reflect id=the-textarea-element:reflect-6>reflect</a>
- the <code id=the-textarea-element:attr-textarea-readonly-4><a href=#attr-textarea-readonly>readonly</a></code> content attribute.</p>
- <p>The <dfn id=dom-textarea-type><code>type</code></dfn> IDL attribute must return the value
- "<code>textarea</code>".</p>
- <p>The <dfn id=dom-textarea-defaultvalue><code>defaultValue</code></dfn> IDL attribute must
- act like the element's <code id=the-textarea-element:textcontent-5><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <dfn id=dom-textarea-value><code>value</code></dfn> attribute must, on getting, return
- the element's <a href=#concept-textarea-api-value id=the-textarea-element:concept-textarea-api-value-2>API value</a>; on setting, it must set
- the element's <a href=#concept-textarea-raw-value id=the-textarea-element:concept-textarea-raw-value-12>raw value</a> to the new value, set the
- element's <a href=#concept-textarea-dirty id=the-textarea-element:concept-textarea-dirty-4>dirty value flag</a> to true, and should then
- move the text entry cursor position to the end of the text field, unselecting any selected text
- and resetting the selection direction to <i>none</i>.</p>
- <p>The <dfn id=dom-textarea-textlength><code>textLength</code></dfn> IDL attribute must
- return the <a href=#code-unit-length id=the-textarea-element:code-unit-length-2>code-unit length</a> of the element's <a href=#concept-textarea-api-value id=the-textarea-element:concept-textarea-api-value-3>API value</a>.</p>
- <p>The <code id=the-textarea-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-textarea-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-textarea-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-textarea-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-textarea-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-textarea-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-textarea-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-textarea-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-textarea-element:the-label-element-3><a href=#the-label-element>label</a></code>s. The <code id=the-textarea-element:dom-textarea/input-select-2><a href=#dom-textarea/input-select>select()</a></code>, <code id=the-textarea-element:dom-textarea/input-selectionstart-2><a href=#dom-textarea/input-selectionstart>selectionStart</a></code>, <code id=the-textarea-element:dom-textarea/input-selectionend-2><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>, <code id=the-textarea-element:dom-textarea/input-selectiondirection-2><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>, <code id=the-textarea-element:dom-textarea/input-setrangetext-3><a href=#dom-textarea/input-setrangetext>setRangeText()</a></code>, and <code id=the-textarea-element:dom-textarea/input-setselectionrange-2><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> methods and IDL attributes
- expose the element's text selection. The <code id=the-textarea-element:dom-fe-autofocus-2><a href=#dom-fe-autofocus>autofocus</a></code>, <code id=the-textarea-element:dom-fe-disabled-2><a href=#dom-fe-disabled>disabled</a></code>, <code id=the-textarea-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code>, and <code id=the-textarea-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are part of the element's forms API.</p>
-
- <div class=example>
- <p>Here is an example of a <code id=the-textarea-element:the-textarea-element-18><a href=#the-textarea-element>textarea</a></code> being used for unrestricted free-form text input
- in a form:</p>
- <pre><p>If you have any comments, please let us know: <textarea cols=80 name=comments></textarea></p></pre>
- <p>To specify a maximum length for the comments, one can use the <code id=the-textarea-element:attr-textarea-maxlength-3><a href=#attr-textarea-maxlength>maxlength</a></code> attribute:</p>
- <pre><p>If you have any short comments, please let us know: <textarea cols=80 name=comments maxlength=200></textarea></p></pre>
- <p>To give a default value, text can be included inside the element:</p>
- <pre><p>If you have any comments, please let us know: <textarea cols=80 name=comments>You rock!</textarea></p></pre>
- <p>You can also give a minimum length. Here, a letter needs to be filled out by the user; a
- template (which is shorter than the minimum length) is provided, but is insufficient to submit
- the form:</p>
- <pre><textarea required minlength="500">Dear Madam Speaker,
- Regarding your letter dated ...
- ...
- Yours Sincerely,
- ...</textarea></pre>
- <p>A placeholder can be given as well, to suggest the basic form to the user, without providing
- an explicit template:</p>
- <pre><textarea placeholder="Dear Francine,
- They closed the parks this week, so we won't be able to
- meet your there. Should we just have dinner?
- Love,
- Daddy"></textarea></pre>
- <p>To have the browser submit <a href=#the-directionality id=the-textarea-element:the-directionality-3>the directionality</a> of the element along with the
- value, the <code id=the-textarea-element:attr-fe-dirname-4><a href=#attr-fe-dirname>dirname</a></code> attribute can be specified:</p>
- <pre><p>If you have any comments, please let us know (you may use either English or Hebrew for your comments):
- <textarea cols=80 name=comments dirname=comments.dir></textarea></p></pre>
- </div>
- <h4 id=the-keygen-element>4.10.12 The <dfn><code>keygen</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-keygen-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-keygen-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-keygen-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#interactive-content-2 id=the-keygen-element:interactive-content-2>Interactive content</a>.<dd><a href=#category-listed id=the-keygen-element:category-listed>Listed</a>, <a href=#category-label id=the-keygen-element:category-label>labelable</a>, <a href=#category-submit id=the-keygen-element:category-submit>submittable</a>, <a href=#category-reset id=the-keygen-element:category-reset>resettable</a>, and <a href=#category-form-attr id=the-keygen-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-keygen-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-keygen-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-keygen-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-keygen-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-keygen-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-keygen-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-keygen-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-keygen-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-keygen-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-keygen-element:global-attributes>Global attributes</a><dd><code id=the-keygen-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> — Automatically focus the form control when the page is loaded<dd><code id=the-keygen-element:attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code> — String to package with the generated and signed public key<dd><code id=the-keygen-element:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-keygen-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-keygen-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-keygen-element:attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code> — The type of cryptographic key to generate<dd><code id=the-keygen-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use for <a href=#form-submission-2 id=the-keygen-element:form-submission-2>form submission</a> and in the <code id=the-keygen-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dt><a href=#concept-element-dom id=the-keygen-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlkeygenelement>HTMLKeygenElement</dfn> : <a href=#htmlelement id=the-keygen-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-fe-autofocus id=the-keygen-element:dom-fe-autofocus>autofocus</a>;
- attribute DOMString <a href=#dom-keygen-challenge id=the-keygen-element:dom-keygen-challenge>challenge</a>;
- attribute boolean <a href=#dom-fe-disabled id=the-keygen-element:dom-fe-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-keygen-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-keygen-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-keygen-keytype id=the-keygen-element:dom-keygen-keytype>keytype</a>;
- attribute DOMString <a href=#dom-fe-name id=the-keygen-element:dom-fe-name>name</a>;
- readonly attribute DOMString <a href=#dom-keygen-type id=the-keygen-element:dom-keygen-type>type</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-keygen-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-keygen-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-keygen-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-keygen-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-keygen-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-keygen-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-keygen-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-keygen-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-keygen-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
- <p>The <code id=the-keygen-element:the-keygen-element><a href=#the-keygen-element>keygen</a></code> element <a href=#represents id=the-keygen-element:represents>represents</a> a key pair generator control. When the
- control's form is submitted, the private key is stored in the local keystore, and the public key
- is packaged and sent to the server.</p>
- <p>The <dfn id=attr-keygen-challenge><code>challenge</code></dfn> attribute may be specified.
- Its value will be packaged with the submitted key.</p>
- <p>The <dfn id=attr-keygen-keytype><code>keytype</code></dfn> attribute is an
- <a href=#enumerated-attribute id=the-keygen-element:enumerated-attribute>enumerated attribute</a>. The following table lists the keywords and states for the
- attribute — the keywords in the left column map to the states listed in the cell in the
- second column on the same row as the keyword. User agents are not required to support these
- values, and must only recognise values whose corresponding algorithms they support.</p>
- <table><thead><tr><th> Keyword <th> State
- <tbody><tr><td> <code>rsa</code>
- <td> <i>RSA</i>
- </table>
- <p>The <i id=the-keygen-element:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i> state is the <i>unknown</i> state. The <i id=the-keygen-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> state is the <i>RSA</i> state, if it is supported, or the <i>unknown</i> state otherwise.</p>
- <p class=note>This specification does not specify what key types user agents are to support
- — it is possible for a user agent to not support any key types at all.</p>
-
- <p>The user agent may expose a user interface for each <code id=the-keygen-element:the-keygen-element-2><a href=#the-keygen-element>keygen</a></code> element to allow the
- user to configure settings of the element's key pair generator, e.g. the key length.</p>
- <p>The <a href=#concept-form-reset-control id=the-keygen-element:concept-form-reset-control>reset algorithm</a> for <code id=the-keygen-element:the-keygen-element-3><a href=#the-keygen-element>keygen</a></code>
- elements is to set these various configuration settings back to their defaults.</p>
- <p>The element's <a href=#concept-fe-value id=the-keygen-element:concept-fe-value>value</a> is the string returned from the
- following algorithm:</p>
- <ol><li>
- <p>Use the appropriate step from the following list:</p>
- <dl class=switch><dt>If the <code id=the-keygen-element:attr-keygen-keytype-2><a href=#attr-keygen-keytype>keytype</a></code> attribute is in the <i>RSA</i> state<dd>
- <p>Generate an RSA key pair using the settings given by the user, if appropriate, using the
- <code>md5WithRSAEncryption</code> RSA signature algorithm (the signature algorithm
- with MD5 and the RSA encryption algorithm) referenced in section 2.2.1 ("RSA Signature
- Algorithm") of RFC 3279, and defined in RFC 2313. <a href=#refsRFC3279>[RFC3279]</a> <a href=#refsRFC2313>[RFC2313]</a></p>
- <dt>Otherwise, the <code id=the-keygen-element:attr-keygen-keytype-3><a href=#attr-keygen-keytype>keytype</a></code> attribute is in the <i>unknown</i> state<dd>
- <p>The given key type is not supported. Return the empty string and abort this algorithm.</p>
- </dl>
- <p>Let <var>private key</var> be the generated private key.</p>
- <p>Let <var>public key</var> be the generated public key.</p>
- <p>Let <var>signature algorithm</var> be the selected signature algorithm.</p>
- <li>
- <p>If the element has a <code id=the-keygen-element:attr-keygen-challenge-2><a href=#attr-keygen-challenge>challenge</a></code> attribute, then let
- <var>challenge</var> be that attribute's value. Otherwise, let <var>challenge</var> be the empty string.</p>
- <li>
- <p>Let <var>algorithm</var> be an ASN.1 <code>AlgorithmIdentifier</code>
- structure as defined by RFC 5280, with the <code>algorithm</code> field giving the
- ASN.1 OID used to identify <var>signature algorithm</var>, using the OIDs defined in
- section 2.2 ("Signature Algorithms") of RFC 3279, and the <code>parameters</code> field
- set up as required by RFC 3279 for <code>AlgorithmIdentifier</code> structures for that
- algorithm. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a> <a href=#refsRFC3279>[RFC3279]</a></p>
- <li>
- <p>Let <var>spki</var> be an ASN.1 <code>SubjectPublicKeyInfo</code> structure
- as defined by RFC 5280, with the <code>algorithm</code> field set to the <var>algorithm</var> structure from the previous step, and the <code>subjectPublicKey</code> field set to the BIT STRING value resulting from ASN.1 DER
- encoding the <var>public key</var>. <a href=#refsX690>[X690]</a> <a href=#refsRFC5280>[RFC5280]</a></p>
- <li>
- <p>Let <var>publicKeyAndChallenge</var> be an ASN.1 <code id=the-keygen-element:publickeyandchallenge><a href=#publickeyandchallenge>PublicKeyAndChallenge</a></code>
- structure as defined below, with the <code>spki</code> field set to the <var>spki</var> structure from the previous step, and the <code>challenge</code>
- field set to the string <var>challenge</var> obtained earlier. <a href=#refsX690>[X690]</a></p>
- <li>
- <p>Let <var>signature</var> be the BIT STRING value resulting from ASN.1 DER encoding
- the signature generated by applying the <var>signature algorithm</var> to the byte
- string obtained by ASN.1 DER encoding the <var>publicKeyAndChallenge</var> structure,
- using <var>private key</var> as the signing key. <a href=#refsX690>[X690]</a></p>
- <li>
- <p>Let <var>signedPublicKeyAndChallenge</var> be an ASN.1
- <code id=the-keygen-element:signedpublickeyandchallenge><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> structure as defined below, with the <code>publicKeyAndChallenge</code> field set to the <var>publicKeyAndChallenge</var>
- structure, the <code>signatureAlgorithm</code> field set to the <var>algorithm</var> structure, and the <code>signature</code> field set to the BIT
- STRING <var>signature</var> from the previous step. <a href=#refsX690>[X690]</a></p>
- <li>
- <p>Return the result of base64 encoding the result of ASN.1 DER encoding the <var>signedPublicKeyAndChallenge</var> structure. <a href=#refsRFC4648>[RFC4648]</a> <a href=#refsX690>[X690]</a></p>
- </ol>
- <p>The data objects used by the above algorithm are defined as follows. These definitions use the
- same "ASN.1-like" syntax defined by RFC 5280. <a href=#refsRFC5280>[RFC5280]</a></p>
- <pre class=asn><dfn id=publickeyandchallenge>PublicKeyAndChallenge</dfn> ::= SEQUENCE {
- spki <span>SubjectPublicKeyInfo</span>,
- challenge IA5STRING
- }
- <dfn id=signedpublickeyandchallenge>SignedPublicKeyAndChallenge</dfn> ::= SEQUENCE {
- publicKeyAndChallenge <a href=#publickeyandchallenge id=the-keygen-element:publickeyandchallenge-2>PublicKeyAndChallenge</a>,
- signatureAlgorithm <span>AlgorithmIdentifier</span>,
- signature BIT STRING
- }</pre>
- <hr>
- <p><strong>Constraint validation</strong>: The <code id=the-keygen-element:the-keygen-element-4><a href=#the-keygen-element>keygen</a></code> element is <a href=#barred-from-constraint-validation id=the-keygen-element:barred-from-constraint-validation>barred from
- constraint validation</a>.</p>
-
- <p>The <code id=the-keygen-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-keygen-element:the-keygen-element-5><a href=#the-keygen-element>keygen</a></code> element with its <a href=#form-owner id=the-keygen-element:form-owner>form owner</a>. The <code id=the-keygen-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name. The <code id=the-keygen-element:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute is used to make the control non-interactive and
- to prevent its value from being submitted. The <code id=the-keygen-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code>
- attribute controls focus.</p>
- <dl class=domintro><dt><var>keygen</var> . <code id=the-keygen-element:dom-keygen-type-2><a href=#dom-keygen-type>type</a></code><dd>
- <p>Returns the string "<code>keygen</code>".</p>
- </dl>
-
- <p>The <dfn id=dom-keygen-challenge><code>challenge</code></dfn> IDL attribute must
- <a href=#reflect id=the-keygen-element:reflect>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-keygen-keytype><code>keytype</code></dfn> IDL attribute must
- <a href=#reflect id=the-keygen-element:reflect-2>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values id=the-keygen-element:limited-to-only-known-values>limited to only known
- values</a>.</p>
- <p>The <dfn id=dom-keygen-type><code>type</code></dfn> IDL attribute must return the value
- "<code>keygen</code>".</p>
- <p>The <code id=the-keygen-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-keygen-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-keygen-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-keygen-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-keygen-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-keygen-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-keygen-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-keygen-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-keygen-element:the-label-element><a href=#the-label-element>label</a></code>s. The <code id=the-keygen-element:dom-fe-autofocus-2><a href=#dom-fe-autofocus>autofocus</a></code>, <code id=the-keygen-element:dom-fe-disabled-2><a href=#dom-fe-disabled>disabled</a></code>, <code id=the-keygen-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code>, and <code id=the-keygen-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are
- part of the element's forms API.</p>
-
- <p class=note>This specification does not specify how the private key generated is to be used.
- It is expected that after receiving the <code id=the-keygen-element:signedpublickeyandchallenge-2><a href=#signedpublickeyandchallenge>SignedPublicKeyAndChallenge</a></code> (SPKAC)
- structure, the server will generate a client certificate and offer it back to the user for
- download; this certificate, once downloaded and stored in the key store along with the private
- key, can then be used to authenticate to services that use TLS and certificate authentication. For
- more information, see e.g. <a href=https://wiki.mozilla.org/CA:Certificate_Download_Specification>this MDN article</a>.</p>
-
-
- <div class=example>
- <p>To generate a key pair, add the private key to the user's key store, and submit the public key
- to the server, markup such as the following can be used:</p>
- <pre><form action="processkey.cgi" method="post" enctype="multipart/form-data">
- <p><keygen name="key"></p>
- <p><input type=submit value="Submit key..."></p>
- </form></pre>
- <p>The server will then receive a form submission with a packaged RSA public key as the value of
- "<code>key</code>". This can then be used for various purposes, such as generating a
- client certificate, as mentioned above.</p>
- </div>
- <h4 id=the-output-element>4.10.13 The <dfn><code>output</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-output-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-output-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-output-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#category-listed id=the-output-element:category-listed>Listed</a>, <a href=#category-label id=the-output-element:category-label>labelable</a>, <a href=#category-reset id=the-output-element:category-reset>resettable</a>, and <a href=#category-form-attr id=the-output-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-output-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-output-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-output-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-output-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-output-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-output-element:phrasing-content-2-3>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-output-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-output-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-output-element:global-attributes>Global attributes</a><dd><code id=the-output-element:attr-output-for><a href=#attr-output-for>for</a></code> — Specifies controls from which the output was calculated<dd><code id=the-output-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-output-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-output-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use in the <code id=the-output-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dt><a href=#concept-element-dom id=the-output-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmloutputelement>HTMLOutputElement</dfn> : <a href=#htmlelement id=the-output-element:htmlelement>HTMLElement</a> {
- [PutForwards=<a href=#dom-domsettabletokenlist-value id=the-output-element:dom-domsettabletokenlist-value>value</a>] readonly attribute <a href=#domsettabletokenlist id=the-output-element:domsettabletokenlist>DOMSettableTokenList</a> <a href=#dom-output-htmlfor id=the-output-element:dom-output-htmlfor>htmlFor</a>;
- readonly attribute <a href=#htmlformelement id=the-output-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-output-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-fe-name id=the-output-element:dom-fe-name>name</a>;
- readonly attribute DOMString <a href=#dom-output-type id=the-output-element:dom-output-type>type</a>;
- attribute DOMString <a href=#dom-output-defaultvalue id=the-output-element:dom-output-defaultvalue>defaultValue</a>;
- attribute DOMString <a href=#dom-output-value id=the-output-element:dom-output-value>value</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-output-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-output-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-output-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-output-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-output-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-output-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-output-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- readonly attribute <a href=#nodelist id=the-output-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-output-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
- <p>The <code id=the-output-element:the-output-element><a href=#the-output-element>output</a></code> element <a href=#represents id=the-output-element:represents>represents</a> the result of a calculation performed
- by the application, or the result of a user action.</p>
- <p class=note>This element can be contrasted with the <code id=the-output-element:the-samp-element><a href=#the-samp-element>samp</a></code> element, which is the
- appropriate element for quoting the output of other programs run previously.</p>
- <p>The <dfn id=attr-output-for><code>for</code></dfn> content attribute allows an explicit
- relationship to be made between the result of a calculation and the elements that represent the
- values that went into the calculation or that otherwise influenced the calculation. The <code id=the-output-element:attr-output-for-2><a href=#attr-output-for>for</a></code> attribute, if specified, must contain a string consisting of
- an <a href=#unordered-set-of-unique-space-separated-tokens id=the-output-element:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are
- <a href=#case-sensitive id=the-output-element:case-sensitive>case-sensitive</a>, each of which must have the value of an <a href=#concept-id id=the-output-element:concept-id>ID</a> of an element in the same <code id=the-output-element:document><a href=#document>Document</a></code>.</p>
- <p>The <code id=the-output-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-output-element:the-output-element-2><a href=#the-output-element>output</a></code> element with its <a href=#form-owner id=the-output-element:form-owner>form owner</a>. The <code id=the-output-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.</p>
-
- <p>The element has a <dfn id=concept-output-mode>value mode flag</dfn> which is either <i id=the-output-element:concept-output-mode-value><a href=#concept-output-mode-value>value</a></i> or <i id=the-output-element:concept-output-mode-default><a href=#concept-output-mode-default>default</a></i>. Initially, the <a href=#concept-output-mode id=the-output-element:concept-output-mode>value mode flag</a> must be set to <i id=the-output-element:concept-output-mode-default-2><a href=#concept-output-mode-default>default</a></i>.</p>
- <p>The element also has a <dfn id=concept-output-defaultvalue>default value</dfn>.
- Initially, the <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue>default value</a> must be the empty
- string.</p>
- <p>When the <a href=#concept-output-mode id=the-output-element:concept-output-mode-2>value mode flag</a> is in mode <dfn id=concept-output-mode-default><i>default</i></dfn>, the contents of the element represent both
- the value of the element and its <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-2>default value</a>.
- When the <a href=#concept-output-mode id=the-output-element:concept-output-mode-3>value mode flag</a> is in mode <dfn id=concept-output-mode-value><i>value</i></dfn>, the contents of the element represent the
- value of the element only, and the <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-3>default value</a>
- is only accessible using the <code id=the-output-element:dom-output-defaultvalue-2><a href=#dom-output-defaultvalue>defaultValue</a></code> IDL
- attribute.</p>
- <p>Whenever the element's descendants are changed in any way, if the <a href=#concept-output-mode id=the-output-element:concept-output-mode-4>value mode flag</a> is in mode <i id=the-output-element:concept-output-mode-default-3><a href=#concept-output-mode-default>default</a></i>, the element's <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-4>default value</a> must be set to the value of the
- element's <code id=the-output-element:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <a href=#concept-form-reset-control id=the-output-element:concept-form-reset-control>reset algorithm</a> for <code id=the-output-element:the-output-element-3><a href=#the-output-element>output</a></code>
- elements is to set the element's <a href=#concept-output-mode id=the-output-element:concept-output-mode-5>value mode flag</a> to <i id=the-output-element:concept-output-mode-default-4><a href=#concept-output-mode-default>default</a></i> and then to set the element's
- <code id=the-output-element:textcontent-2><a href=#textcontent>textContent</a></code> IDL attribute to the value of the element's <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-5>default value</a> (thus replacing the element's child
- nodes).</p>
-
- <dl class=domintro><dt><var>output</var> . <code id=the-output-element:dom-output-value-2><a href=#dom-output-value>value</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the element's current value.</p>
- <p>Can be set, to change the value.</p>
- <dt><var>output</var> . <code id=the-output-element:dom-output-defaultvalue-3><a href=#dom-output-defaultvalue>defaultValue</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the element's current default value.</p>
- <p>Can be set, to change the default value.</p>
- <dt><var>output</var> . <code id=the-output-element:dom-output-type-2><a href=#dom-output-type>type</a></code><dd>
- <p>Returns the string "<code>output</code>".</p>
- </dl>
-
- <p>The <dfn id=dom-output-value><code>value</code></dfn> IDL attribute must act like the
- element's <code id=the-output-element:textcontent-3><a href=#textcontent>textContent</a></code> IDL attribute, except that on setting, in addition, before the
- child nodes are changed, the element's <a href=#concept-output-mode id=the-output-element:concept-output-mode-6>value mode flag</a>
- must be set to <i id=the-output-element:concept-output-mode-value-2><a href=#concept-output-mode-value>value</a></i>.</p>
- <p>The <dfn id=dom-output-defaultvalue><code>defaultValue</code></dfn> IDL attribute, on
- getting, must return the element's <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-6>default
- value</a>. On setting, the attribute must set the element's <a href=#concept-output-defaultvalue id=the-output-element:concept-output-defaultvalue-7>default value</a>, and, if the element's <a href=#concept-output-mode id=the-output-element:concept-output-mode-7>value mode flag</a> is in the mode <i id=the-output-element:concept-output-mode-default-5><a href=#concept-output-mode-default>default</a></i>, set the element's <code id=the-output-element:textcontent-4><a href=#textcontent>textContent</a></code> IDL
- attribute as well.</p>
- <p>The <dfn id=dom-output-type><code>type</code></dfn> attribute must return the string
- "<code>output</code>".</p>
- <p>The <dfn id=dom-output-htmlfor><code>htmlFor</code></dfn> IDL attribute must
- <a href=#reflect id=the-output-element:reflect>reflect</a> the <code id=the-output-element:attr-output-for-3><a href=#attr-output-for>for</a></code> content attribute.</p>
- <p>The <code id=the-output-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-output-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-output-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> IDL attributes, and the <code id=the-output-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-output-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-output-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-output-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-output-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL
- attribute provides a list of the element's <code id=the-output-element:the-label-element><a href=#the-label-element>label</a></code>s. The <code id=the-output-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code> and <code id=the-output-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are
- part of the element's forms API.</p>
-
- <div class=example>
- <p>A simple calculator could use <code id=the-output-element:the-output-element-4><a href=#the-output-element>output</a></code> for its display of calculated results:</p>
- <pre><form onsubmit="return false" oninput="o.value = a.valueAsNumber + b.valueAsNumber">
- <input name=a type=number step=any> +
- <input name=b type=number step=any> =
- <output name=o for="a b"></output>
- </form></pre>
- </div>
- <div class=example>
- <p>In this example, an <code id=the-output-element:the-output-element-5><a href=#the-output-element>output</a></code> element is used to report the results from a remote
- server, as they come in:</p>
- <pre><output id="result"></output>
- <script>
- var primeSource = new WebSocket('ws://primes.example.net/');
- primeSource.onmessage = function (event) {
- document.getElementById('result').value = event.data;
- }
- </script></pre>
- </div>
- <h4 id=the-progress-element>4.10.14 The <dfn><code>progress</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-progress-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-progress-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-progress-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#category-label id=the-progress-element:category-label>Labelable element</a>.<dd><a href=#palpable-content-2 id=the-progress-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-progress-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-progress-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-progress-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-progress-element:phrasing-content-2-3>Phrasing content</a>, but there must be no <code id=the-progress-element:the-progress-element><a href=#the-progress-element>progress</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-progress-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-progress-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-progress-element:global-attributes>Global attributes</a><dd><code id=the-progress-element:attr-progress-value><a href=#attr-progress-value>value</a></code> — Current value of the element<dd><code id=the-progress-element:attr-progress-max><a href=#attr-progress-max>max</a></code> — Upper bound of range<dt><a href=#concept-element-dom id=the-progress-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlprogresselement>HTMLProgressElement</dfn> : <a href=#htmlelement id=the-progress-element:htmlelement>HTMLElement</a> {
- attribute double <a href=#dom-progress-value id=the-progress-element:dom-progress-value>value</a>;
- attribute double <a href=#dom-progress-max id=the-progress-element:dom-progress-max>max</a>;
- readonly attribute double <a href=#dom-progress-position id=the-progress-element:dom-progress-position>position</a>;
- readonly attribute <a href=#nodelist id=the-progress-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-progress-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
- <p>The <code id=the-progress-element:the-progress-element-2><a href=#the-progress-element>progress</a></code> element <a href=#represents id=the-progress-element:represents>represents</a> the completion progress of a task.
- The progress is either indeterminate, indicating that progress is being made but that it is not
- clear how much more work remains to be done before the task is complete (e.g. because the task is
- waiting for a remote host to respond), or the progress is a number in the range zero to a maximum,
- giving the fraction of work that has so far been completed.</p>
- <p>There are two attributes that determine the current task completion represented by the element.
- The <dfn id=attr-progress-value><code>value</code></dfn> attribute specifies how much of the
- task has been completed, and the <dfn id=attr-progress-max><code>max</code></dfn> attribute
- specifies how much work the task requires in total. The units are arbitrary and not specified.</p>
- <p class=note>To make a determinate progress bar, add a <code id=the-progress-element:attr-progress-value-2><a href=#attr-progress-value>value</a></code> attribute with the current progress (either a number from
- 0.0 to 1.0, or, if the <code id=the-progress-element:attr-progress-max-2><a href=#attr-progress-max>max</a></code> attribute is specified, a number
- from 0 to the value of the <code id=the-progress-element:attr-progress-max-3><a href=#attr-progress-max>max</a></code> attribute). To make an
- indeterminate progress bar, remove the <code id=the-progress-element:attr-progress-value-3><a href=#attr-progress-value>value</a></code>
- attribute.</p>
- <p>Authors are encouraged to also include the current value and the maximum value inline as text
- inside the element, so that the progress is made available to users of legacy user agents.</p>
- <div class=example>
- <p>Here is a snippet of a Web application that shows the progress of some automated task:</p>
- <pre><section>
- <h2>Task Progress</h2>
- <p>Progress: <progress id="p" max=100><span>0</span>%</progress></p>
- <script>
- var progressBar = document.getElementById('p');
- function updateProgress(newValue) {
- progressBar.value = newValue;
- progressBar.getElementsByTagName('span')[0].textContent = newValue;
- }
- </script>
- </section></pre>
- <p>(The <code>updateProgress()</code> method in this example would be called by some
- other code on the page to update the actual progress bar as the task progressed.)</p>
- </div>
- <p>The <code id=the-progress-element:attr-progress-value-4><a href=#attr-progress-value>value</a></code> and <code id=the-progress-element:attr-progress-max-4><a href=#attr-progress-max>max</a></code> attributes, when present, must have values that are <a href=#valid-floating-point-number id=the-progress-element:valid-floating-point-number>valid floating-point numbers</a>. The <code id=the-progress-element:attr-progress-value-5><a href=#attr-progress-value>value</a></code> attribute, if present, must have a value equal to or
- greater than zero, and less than or equal to the value of the <code id=the-progress-element:attr-progress-max-5><a href=#attr-progress-max>max</a></code> attribute, if present, or 1.0, otherwise. The <code id=the-progress-element:attr-progress-max-6><a href=#attr-progress-max>max</a></code> attribute, if present, must have a value greater than
- zero.</p>
- <p class=note>The <code id=the-progress-element:the-progress-element-3><a href=#the-progress-element>progress</a></code> element is the wrong element to use for something that
- is just a gauge, as opposed to task progress. For instance, indicating disk space usage using
- <code id=the-progress-element:the-progress-element-4><a href=#the-progress-element>progress</a></code> would be inappropriate. Instead, the <code id=the-progress-element:the-meter-element><a href=#the-meter-element>meter</a></code> element is available
- for such use cases.</p>
-
- <p><strong>User agent requirements</strong>: If the <code id=the-progress-element:attr-progress-value-6><a href=#attr-progress-value>value</a></code>
- attribute is omitted, then the progress bar is an indeterminate progress bar. Otherwise, it is a
- determinate progress bar.</p>
- <p>If the progress bar is a determinate progress bar and the element has a <code id=the-progress-element:attr-progress-max-7><a href=#attr-progress-max>max</a></code> attribute, the user agent must parse the <code id=the-progress-element:attr-progress-max-8><a href=#attr-progress-max>max</a></code> attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values id=the-progress-element:rules-for-parsing-floating-point-number-values>rules for parsing
- floating-point number values</a>. If this does not result in an error, and if the parsed value
- is greater than zero, then the <dfn id=concept-progress-maximum>maximum value</dfn> of the
- progress bar is that value. Otherwise, if the element has no <code id=the-progress-element:attr-progress-max-9><a href=#attr-progress-max>max</a></code> attribute, or if it has one but parsing it resulted in an
- error, or if the parsed value was less than or equal to zero, then the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum>maximum value</a> of the progress bar is 1.0.</p>
- <p>If the progress bar is a determinate progress bar, user agents must parse the <code id=the-progress-element:attr-progress-value-7><a href=#attr-progress-value>value</a></code> attribute's value according to the <a href=#rules-for-parsing-floating-point-number-values id=the-progress-element:rules-for-parsing-floating-point-number-values-2>rules for
- parsing floating-point number values</a>. If this does not result in an error, and if the
- parsed value is less than the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-2>maximum value</a> and
- greater than zero, then the <dfn id=concept-progress-value>current value</dfn> of the
- progress bar is that parsed value. Otherwise, if the parsed value was greater than or equal to the
- <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-3>maximum value</a>, then the <a href=#concept-progress-value id=the-progress-element:concept-progress-value>current value</a> of the progress bar is the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-4>maximum value</a> of the progress bar. Otherwise, if parsing
- the <code id=the-progress-element:attr-progress-value-8><a href=#attr-progress-value>value</a></code> attribute's value resulted in an error, or a
- number less than or equal to zero, then the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-2>current
- value</a> of the progress bar is zero.</p>
- <p><strong>UA requirements for showing the progress bar</strong>: When representing a
- <code id=the-progress-element:the-progress-element-5><a href=#the-progress-element>progress</a></code> element to the user, the UA should indicate whether it is a determinate or
- indeterminate progress bar, and in the former case, should indicate the relative position of the
- <a href=#concept-progress-value id=the-progress-element:concept-progress-value-3>current value</a> relative to the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-5>maximum value</a>.</p>
-
- <dl class=domintro><dt><var>progress</var> . <code id=the-progress-element:dom-progress-position-2><a href=#dom-progress-position>position</a></code><dd>
- <p>For a determinate progress bar (one with known current and maximum values), returns the
- result of dividing the current value by the maximum value.</p>
- <p>For an indeterminate progress bar, returns −1.</p>
- </dl>
-
- <p>If the progress bar is an indeterminate progress bar, then the <dfn id=dom-progress-position><code>position</code></dfn> IDL attribute must return −1.
- Otherwise, it must return the result of dividing the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-4>current
- value</a> by the <a href=#concept-progress-maximum id=the-progress-element:concept-progress-maximum-6>maximum value</a>.</p>
- <p>If the progress bar is an indeterminate progress bar, then the <dfn id=dom-progress-value><code>value</code></dfn> IDL attribute, on getting, must return 0.
- Otherwise, it must return the <a href=#concept-progress-value id=the-progress-element:concept-progress-value-5>current value</a>. On
- setting, the given value must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-progress-element:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a
- floating-point number</a> and then the <code id=the-progress-element:dom-progress-value-2><a href=#dom-progress-value>value</a></code> content
- attribute must be set to that string.</p>
- <p class=note>Setting the <code id=the-progress-element:dom-progress-value-3><a href=#dom-progress-value>value</a></code> IDL attribute to itself
- when the corresponding content attribute is absent would change the progress bar from an
- indeterminate progress bar to a determinate progress bar with no progress.</p>
- <p>The <dfn id=dom-progress-max><code>max</code></dfn> IDL attribute must
- <a href=#reflect id=the-progress-element:reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-numbers-greater-than-zero id=the-progress-element:limited-to-numbers-greater-than-zero>limited to numbers greater than
- zero</a>. The default value for <code id=the-progress-element:dom-progress-max-2><a href=#dom-progress-max>max</a></code> is 1.0.</p>
- <p>The <code id=the-progress-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a list of the element's
- <code id=the-progress-element:the-label-element><a href=#the-label-element>label</a></code>s.</p>
-
- <h4 id=the-meter-element>4.10.15 The <dfn><code>meter</code></dfn> element</h4>
-
- <dl class=element><dt><a href=#concept-element-categories id=the-meter-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-meter-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-meter-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#category-label id=the-meter-element:category-label>Labelable element</a>.<dd><a href=#palpable-content-2 id=the-meter-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-meter-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#phrasing-content-2 id=the-meter-element:phrasing-content-2-2>phrasing content</a> is expected.<dt><a href=#concept-element-content-model id=the-meter-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-meter-element:phrasing-content-2-3>Phrasing content</a>, but there must be no <code id=the-meter-element:the-meter-element><a href=#the-meter-element>meter</a></code> element descendants.<dt><a href=#concept-element-tag-omission id=the-meter-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-meter-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-meter-element:global-attributes>Global attributes</a><dd><code id=the-meter-element:attr-meter-value><a href=#attr-meter-value>value</a></code> — Current value of the element<dd><code id=the-meter-element:attr-meter-min><a href=#attr-meter-min>min</a></code> — Lower bound of range<dd><code id=the-meter-element:attr-meter-max><a href=#attr-meter-max>max</a></code> — Upper bound of range<dd><code id=the-meter-element:attr-meter-low><a href=#attr-meter-low>low</a></code> — High limit of low range<dd><code id=the-meter-element:attr-meter-high><a href=#attr-meter-high>high</a></code> — Low limit of high range<dd><code id=the-meter-element:attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code> — Optimum value in gauge<dt><a href=#concept-element-dom id=the-meter-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlmeterelement>HTMLMeterElement</dfn> : <a href=#htmlelement id=the-meter-element:htmlelement>HTMLElement</a> {
- attribute double <a href=#dom-meter-value id=the-meter-element:dom-meter-value>value</a>;
- attribute double <a href=#dom-meter-min id=the-meter-element:dom-meter-min>min</a>;
- attribute double <a href=#dom-meter-max id=the-meter-element:dom-meter-max>max</a>;
- attribute double <a href=#dom-meter-low id=the-meter-element:dom-meter-low>low</a>;
- attribute double <a href=#dom-meter-high id=the-meter-element:dom-meter-high>high</a>;
- attribute double <a href=#dom-meter-optimum id=the-meter-element:dom-meter-optimum>optimum</a>;
- readonly attribute <a href=#nodelist id=the-meter-element:nodelist>NodeList</a> <a href=#dom-lfe-labels id=the-meter-element:dom-lfe-labels>labels</a>;
- };</pre>
- </dl>
- <p>The <code id=the-meter-element:the-meter-element-2><a href=#the-meter-element>meter</a></code> element <a href=#represents id=the-meter-element:represents>represents</a> a scalar measurement within a known
- range, or a fractional value; for example disk usage, the relevance of a query result, or the
- fraction of a voting population to have selected a particular candidate.</p>
- <p>This is also known as a gauge.</p>
- <p class=note>The <code id=the-meter-element:the-meter-element-3><a href=#the-meter-element>meter</a></code> element should not be used to indicate progress (as in a
- progress bar). For that role, HTML provides a separate <code id=the-meter-element:the-progress-element><a href=#the-progress-element>progress</a></code> element.</p>
- <p class=note>The <code id=the-meter-element:the-meter-element-4><a href=#the-meter-element>meter</a></code> element also does not represent a scalar value of arbitrary
- range — for example, it would be wrong to use this to report a weight, or height, unless
- there is a known maximum value.</p>
- <p>There are six attributes that determine the semantics of the gauge represented by the
- element.</p>
- <p>The <dfn id=attr-meter-min><code>min</code></dfn> attribute specifies the lower bound of
- the range, and the <dfn id=attr-meter-max><code>max</code></dfn> attribute specifies the
- upper bound. The <dfn id=attr-meter-value><code>value</code></dfn> attribute specifies the
- value to have the gauge indicate as the "measured" value.</p>
- <p>The other three attributes can be used to segment the gauge's range into "low", "medium", and
- "high" parts, and to indicate which part of the gauge is the "optimum" part. The <dfn id=attr-meter-low><code>low</code></dfn> attribute specifies the range that is considered to
- be the "low" part, and the <dfn id=attr-meter-high><code>high</code></dfn> attribute
- specifies the range that is considered to be the "high" part. The <dfn id=attr-meter-optimum><code>optimum</code></dfn> attribute gives the position that is
- "optimum"; if that is higher than the "high" value then this indicates that the higher the value,
- the better; if it's lower than the "low" mark then it indicates that lower values are better, and
- naturally if it is in between then it indicates that neither high nor low values are good.</p>
- <p><strong>Authoring requirements</strong>: The <code id=the-meter-element:attr-meter-value-2><a href=#attr-meter-value>value</a></code> attribute must be specified. The <code id=the-meter-element:attr-meter-value-3><a href=#attr-meter-value>value</a></code>, <code id=the-meter-element:attr-meter-min-2><a href=#attr-meter-min>min</a></code>, <code id=the-meter-element:attr-meter-low-2><a href=#attr-meter-low>low</a></code>, <code id=the-meter-element:attr-meter-high-2><a href=#attr-meter-high>high</a></code>, <code id=the-meter-element:attr-meter-max-2><a href=#attr-meter-max>max</a></code>, and <code id=the-meter-element:attr-meter-optimum-2><a href=#attr-meter-optimum>optimum</a></code> attributes,
- when present, must have values that are <a href=#valid-floating-point-number id=the-meter-element:valid-floating-point-number>valid
- floating-point numbers</a>.</p>
- <p>In addition, the attributes' values are further constrained:</p>
- <p>Let <var>value</var> be the <code id=the-meter-element:attr-meter-value-4><a href=#attr-meter-value>value</a></code> attribute's
- number.</p>
- <p>If the <code id=the-meter-element:attr-meter-min-3><a href=#attr-meter-min>min</a></code> attribute is specified, then let <var>minimum</var> be that attribute's value; otherwise, let it be zero.</p>
- <p>If the <code id=the-meter-element:attr-meter-max-3><a href=#attr-meter-max>max</a></code> attribute is specified, then let <var>maximum</var> be that attribute's value; otherwise, let it be 1.0.</p>
- <p>The following inequalities must hold, as applicable:</p>
- <ul class=brief><li><var>minimum</var> ≤ <var>value</var> ≤ <var>maximum</var><li><var>minimum</var> ≤ <code id=the-meter-element:attr-meter-low-3><a href=#attr-meter-low>low</a></code> ≤ <var>maximum</var> (if <code id=the-meter-element:attr-meter-low-4><a href=#attr-meter-low>low</a></code> is specified)<li><var>minimum</var> ≤ <code id=the-meter-element:attr-meter-high-3><a href=#attr-meter-high>high</a></code> ≤ <var>maximum</var> (if <code id=the-meter-element:attr-meter-high-4><a href=#attr-meter-high>high</a></code> is specified)<li><var>minimum</var> ≤ <code id=the-meter-element:attr-meter-optimum-3><a href=#attr-meter-optimum>optimum</a></code> ≤ <var>maximum</var> (if <code id=the-meter-element:attr-meter-optimum-4><a href=#attr-meter-optimum>optimum</a></code> is specified)<li><code id=the-meter-element:attr-meter-low-5><a href=#attr-meter-low>low</a></code> ≤ <code id=the-meter-element:attr-meter-high-5><a href=#attr-meter-high>high</a></code> (if
- both <code id=the-meter-element:attr-meter-low-6><a href=#attr-meter-low>low</a></code> and <code id=the-meter-element:attr-meter-high-6><a href=#attr-meter-high>high</a></code> are
- specified)</ul>
- <p class=note>If no minimum or maximum is specified, then the range is assumed to be 0..1, and
- the value thus has to be within that range.</p>
- <p>Authors are encouraged to include a textual representation of the gauge's state in the
- element's contents, for users of user agents that do not support the <code id=the-meter-element:the-meter-element-5><a href=#the-meter-element>meter</a></code>
- element.</p>
- <p>When used with <a href=#microdata id=the-meter-element:microdata>microdata</a>, the <code id=the-meter-element:the-meter-element-6><a href=#the-meter-element>meter</a></code> element's <code id=the-meter-element:attr-meter-value-5><a href=#attr-meter-value>value</a></code> attribute provides the element's machine-readable value.</p>
- <div class=example>
- <p>The following examples show three gauges that would all be three-quarters full:</p>
- <pre>Storage space usage: <meter value=6 max=8>6 blocks used (out of 8 total)</meter>
- Voter turnout: <meter value=0.75><img alt="75%" src="graph75.png"></meter>
- Tickets sold: <meter min="0" max="100" value="75"></meter></pre>
- <p>The following example is incorrect use of the element, because it doesn't give a range (and
- since the default maximum is 1, both of the gauges would end up looking maxed out):</p>
- <pre class=bad><p>The grapefruit pie had a radius of <meter value=12>12cm</meter>
- and a height of <meter value=2>2cm</meter>.</p> <!-- <strong>BAD!</strong> --></pre>
- <p>Instead, one would either not include the meter element, or use the meter element with a
- defined range to give the dimensions in context compared to other pies:</p>
- <pre><p>The grapefruit pie had a radius of 12cm and a height of
- 2cm.</p>
- <dl>
- <dt>Radius: <dd> <meter min=0 max=20 value=12>12cm</meter>
- <dt>Height: <dd> <meter min=0 max=10 value=2>2cm</meter>
- </dl></pre>
- </div>
- <p>There is no explicit way to specify units in the <code id=the-meter-element:the-meter-element-7><a href=#the-meter-element>meter</a></code> element, but the units may
- be specified in the <code id=the-meter-element:attr-title><a href=#attr-title>title</a></code> attribute in free-form text.</p>
- <div class=example>
- <p>The example above could be extended to mention the units:</p>
- <pre><dl>
- <dt>Radius: <dd> <meter min=0 max=20 value=12 title="centimeters">12cm</meter>
- <dt>Height: <dd> <meter min=0 max=10 value=2 title="centimeters">2cm</meter>
- </dl></pre>
- </div>
-
- <p><strong>User agent requirements</strong>: User agents must parse the <code id=the-meter-element:attr-meter-min-4><a href=#attr-meter-min>min</a></code>, <code id=the-meter-element:attr-meter-max-4><a href=#attr-meter-max>max</a></code>, <code id=the-meter-element:attr-meter-value-6><a href=#attr-meter-value>value</a></code>, <code id=the-meter-element:attr-meter-low-7><a href=#attr-meter-low>low</a></code>, <code id=the-meter-element:attr-meter-high-7><a href=#attr-meter-high>high</a></code>, and <code id=the-meter-element:attr-meter-optimum-5><a href=#attr-meter-optimum>optimum</a></code>
- attributes using the <a href=#rules-for-parsing-floating-point-number-values id=the-meter-element:rules-for-parsing-floating-point-number-values>rules for parsing floating-point number values</a>.</p>
- <p>User agents must then use all these numbers to obtain values for six points on the gauge, as
- follows. (The order in which these are evaluated is important, as some of the values refer to
- earlier ones.)</p>
- <dl><dt>The <dfn id=concept-meter-minimum>minimum value</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-min-5><a href=#attr-meter-min>min</a></code> attribute is specified and a value could be
- parsed out of it, then the minimum value is that value. Otherwise, the minimum value is
- zero.</p>
- <dt>The <dfn id=concept-meter-maximum>maximum value</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-max-5><a href=#attr-meter-max>max</a></code> attribute is specified and a value could be
- parsed out of it, then the candidate maximum value is that value. Otherwise, the candidate
- maximum value is 1.0.</p>
- <p>If the candidate maximum value is greater than or equal to the minimum value, then the
- maximum value is the candidate maximum value. Otherwise, the maximum value is the same as the
- minimum value.</p>
- <dt>The <dfn id=concept-meter-actual>actual value</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-value-7><a href=#attr-meter-value>value</a></code> attribute is specified and a value could
- be parsed out of it, then that value is the candidate actual value. Otherwise, the candidate
- actual value is zero.</p>
- <p>If the candidate actual value is less than the minimum value, then the actual value is the
- minimum value.</p>
- <p>Otherwise, if the candidate actual value is greater than the maximum value, then the actual
- value is the maximum value.</p>
- <p>Otherwise, the actual value is the candidate actual value.</p>
- <dt>The <dfn id=concept-meter-low>low boundary</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-low-8><a href=#attr-meter-low>low</a></code> attribute is specified and a value could be
- parsed out of it, then the candidate low boundary is that value. Otherwise, the candidate low
- boundary is the same as the minimum value.</p>
- <p>If the candidate low boundary is less than the minimum value, then the low boundary is the
- minimum value.</p>
- <p>Otherwise, if the candidate low boundary is greater than the maximum value, then the low
- boundary is the maximum value.</p>
- <p>Otherwise, the low boundary is the candidate low boundary.</p>
- <dt>The <dfn id=concept-meter-high>high boundary</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-high-8><a href=#attr-meter-high>high</a></code> attribute is specified and a value could be
- parsed out of it, then the candidate high boundary is that value. Otherwise, the candidate high
- boundary is the same as the maximum value.</p>
- <p>If the candidate high boundary is less than the low boundary, then the high boundary is the
- low boundary.</p>
- <p>Otherwise, if the candidate high boundary is greater than the maximum value, then the high
- boundary is the maximum value.</p>
- <p>Otherwise, the high boundary is the candidate high boundary.</p>
- <dt>The <dfn id=concept-meter-optimum>optimum point</dfn><dd>
- <p>If the <code id=the-meter-element:attr-meter-optimum-6><a href=#attr-meter-optimum>optimum</a></code> attribute is specified and a value
- could be parsed out of it, then the candidate optimum point is that value. Otherwise, the
- candidate optimum point is the midpoint between the minimum value and the maximum value.</p>
- <p>If the candidate optimum point is less than the minimum value, then the optimum point is the
- minimum value.</p>
- <p>Otherwise, if the candidate optimum point is greater than the maximum value, then the optimum
- point is the maximum value.</p>
- <p>Otherwise, the optimum point is the candidate optimum point.</p>
- </dl>
- <p>All of which will result in the following inequalities all being true:</p>
- <ul class=brief><li>minimum value ≤ actual value ≤ maximum value<li>minimum value ≤ low boundary ≤ high boundary ≤ maximum value<li>minimum value ≤ optimum point ≤ maximum value</ul>
- <p><strong>UA requirements for regions of the gauge</strong>: If the optimum point is equal to the
- low boundary or the high boundary, or anywhere in between them, then the region between the low
- and high boundaries of the gauge must be treated as the optimum region, and the low and high
- parts, if any, must be treated as suboptimal. Otherwise, if the optimum point is less than the low
- boundary, then the region between the minimum value and the low boundary must be treated as the
- optimum region, the region from the low boundary up to the high boundary must be treated as a
- suboptimal region, and the remaining region must be treated as an even less good region. Finally,
- if the optimum point is higher than the high boundary, then the situation is reversed; the region
- between the high boundary and the maximum value must be treated as the optimum region, the region
- from the high boundary down to the low boundary must be treated as a suboptimal region, and the
- remaining region must be treated as an even less good region.</p>
- <p><strong>UA requirements for showing the gauge</strong>: When representing a <code id=the-meter-element:the-meter-element-8><a href=#the-meter-element>meter</a></code>
- element to the user, the UA should indicate the relative position of the actual value to the
- minimum and maximum values, and the relationship between the actual value and the three regions of
- the gauge.</p>
-
- <div class=example>
- <p>The following markup:</p>
- <pre><h3>Suggested groups</h3>
- <menu type="toolbar">
- <a href="?cmd=hsg" onclick="hideSuggestedGroups()">Hide suggested groups</a>
- </menu>
- <ul>
- <li>
- <p><a href="/group/comp.infosystems.www.authoring.stylesheets/view">comp.infosystems.www.authoring.stylesheets</a> -
- <a href="/group/comp.infosystems.www.authoring.stylesheets/subscribe">join</a></p>
- <p>Group description: <strong>Layout/presentation on the WWW.</strong></p>
- <p><strong><meter value="0.5">Moderate activity,</meter></strong> Usenet, 618 subscribers</p>
- </li>
- <li>
- <p><a href="/group/netscape.public.mozilla.xpinstall/view">netscape.public.mozilla.xpinstall</a> -
- <a href="/group/netscape.public.mozilla.xpinstall/subscribe">join</a></p>
- <p>Group description: <strong>Mozilla XPInstall discussion.</strong></p>
- <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 22 subscribers</p>
- </li>
- <li>
- <p><a href="/group/mozilla.dev.general/view">mozilla.dev.general</a> -
- <a href="/group/mozilla.dev.general/subscribe">join</a></p>
- <p><strong><meter value="0.25">Low activity,</meter></strong> Usenet, 66 subscribers</p>
- </li>
- </ul></pre>
- <p>Might be rendered as follows:</p>
- <p><img src=http://images.whatwg.org/sample-meter.png width=332 alt="With the <meter> elements rendered as inline green bars of varying lengths." height=178></p>
- </div>
- <p>User agents may combine the value of the <code id=the-meter-element:attr-title-2><a href=#attr-title>title</a></code> attribute and the other attributes to provide context-sensitive
- help or inline text detailing the actual values.</p>
- <div class=example>
- <p>For example, the following snippet:</p>
- <pre><meter min=0 max=60 value=23.2 title=seconds></meter></pre>
- <p>...might cause the user agent to display a gauge with a tooltip
- saying "Value: 23.2 out of 60." on one line and "seconds" on a
- second line.</p>
- </div>
-
- <p>The <dfn id=dom-meter-value><code>value</code></dfn> IDL attribute, on getting, must
- return the <a href=#concept-meter-actual id=the-meter-element:concept-meter-actual>actual value</a>. On setting, the given value
- must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number>best representation of the number as a floating-point number</a>
- and then the <code id=the-meter-element:dom-meter-value-2><a href=#dom-meter-value>value</a></code> content attribute must be set to that
- string.</p>
- <p>The <dfn id=dom-meter-min><code>min</code></dfn> IDL attribute, on getting, must return
- the <a href=#concept-meter-minimum id=the-meter-element:concept-meter-minimum>minimum value</a>. On setting, the given value must be
- converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number-2>best representation of the number as a floating-point number</a> and
- then the <code id=the-meter-element:dom-meter-min-2><a href=#dom-meter-min>min</a></code> content attribute must be set to that string.</p>
- <p>The <dfn id=dom-meter-max><code>max</code></dfn> IDL attribute, on getting, must return
- the <a href=#concept-meter-maximum id=the-meter-element:concept-meter-maximum>maximum value</a>. On setting, the given value must be
- converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number-3>best representation of the number as a floating-point number</a> and
- then the <code id=the-meter-element:dom-meter-max-2><a href=#dom-meter-max>max</a></code> content attribute must be set to that string.</p>
- <p>The <dfn id=dom-meter-low><code>low</code></dfn> IDL attribute, on getting, must return
- the <a href=#concept-meter-low id=the-meter-element:concept-meter-low>low boundary</a>. On setting, the given value must be
- converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number-4>best representation of the number as a floating-point number</a> and
- then the <code id=the-meter-element:dom-meter-low-2><a href=#dom-meter-low>low</a></code> content attribute must be set to that string.</p>
- <p>The <dfn id=dom-meter-high><code>high</code></dfn> IDL attribute, on getting, must return
- the <a href=#concept-meter-high id=the-meter-element:concept-meter-high>high boundary</a>. On setting, the given value must be
- converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number-5>best representation of the number as a floating-point number</a> and
- then the <code id=the-meter-element:dom-meter-high-2><a href=#dom-meter-high>high</a></code> content attribute must be set to that
- string.</p>
- <p>The <dfn id=dom-meter-optimum><code>optimum</code></dfn> IDL attribute, on getting, must
- return the <a href=#concept-meter-optimum id=the-meter-element:concept-meter-optimum>optimum value</a>. On setting, the given value
- must be converted to the <a href=#best-representation-of-the-number-as-a-floating-point-number id=the-meter-element:best-representation-of-the-number-as-a-floating-point-number-6>best representation of the number as a floating-point number</a>
- and then the <code id=the-meter-element:dom-meter-optimum-2><a href=#dom-meter-optimum>optimum</a></code> content attribute must be set to that
- string.</p>
- <p>The <code id=the-meter-element:dom-lfe-labels-2><a href=#dom-lfe-labels>labels</a></code> IDL attribute provides a list of the element's
- <code id=the-meter-element:the-label-element><a href=#the-label-element>label</a></code>s.</p>
-
- <div class=example>
- <p>The following example shows how a gauge could fall back to localised or pretty-printed
- text.</p>
- <pre><p>Disk usage: <meter min=0 value=170261928 max=233257824>170 261 928 bytes used
- out of 233 257 824 bytes available</meter></p></pre>
- </div>
- <h4 id=the-fieldset-element>4.10.16 The <dfn><code>fieldset</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-fieldset-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-fieldset-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-root id=the-fieldset-element:sectioning-root>Sectioning root</a>.<dd><a href=#category-listed id=the-fieldset-element:category-listed>Listed</a> and <a href=#category-form-attr id=the-fieldset-element:category-form-attr>reassociateable</a> <a href=#form-associated-element id=the-fieldset-element:form-associated-element>form-associated element</a>.<dd><a href=#palpable-content-2 id=the-fieldset-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-fieldset-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-fieldset-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-fieldset-element:concept-element-content-model>Content model</a>:<dd>Optionally a <code id=the-fieldset-element:the-legend-element><a href=#the-legend-element>legend</a></code> element, followed by <a href=#flow-content-2 id=the-fieldset-element:flow-content-2-3>flow content</a>.<dt><a href=#concept-element-tag-omission id=the-fieldset-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-fieldset-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-fieldset-element:global-attributes>Global attributes</a><dd><code id=the-fieldset-element:attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-fieldset-element:attr-fae-form><a href=#attr-fae-form>form</a></code> — Associates the control with a <code id=the-fieldset-element:the-form-element><a href=#the-form-element>form</a></code> element<dd><code id=the-fieldset-element:attr-fe-name><a href=#attr-fe-name>name</a></code> — Name of form control to use in the <code id=the-fieldset-element:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API <dt><a href=#concept-element-dom id=the-fieldset-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlfieldsetelement>HTMLFieldSetElement</dfn> : <a href=#htmlelement id=the-fieldset-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-fieldset-disabled id=the-fieldset-element:dom-fieldset-disabled>disabled</a>;
- readonly attribute <a href=#htmlformelement id=the-fieldset-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-fae-form id=the-fieldset-element:dom-fae-form>form</a>;
- attribute DOMString <a href=#dom-fe-name id=the-fieldset-element:dom-fe-name>name</a>;
- readonly attribute DOMString <a href=#dom-fieldset-type id=the-fieldset-element:dom-fieldset-type>type</a>;
- readonly attribute <a href=#htmlformcontrolscollection-2 id=the-fieldset-element:htmlformcontrolscollection-2>HTMLFormControlsCollection</a> <a href=#dom-fieldset-elements id=the-fieldset-element:dom-fieldset-elements>elements</a>;
- readonly attribute boolean <a href=#dom-cva-willvalidate id=the-fieldset-element:dom-cva-willvalidate>willValidate</a>;
- readonly attribute <a href=#validitystate id=the-fieldset-element:validitystate>ValidityState</a> <a href=#dom-cva-validity id=the-fieldset-element:dom-cva-validity>validity</a>;
- readonly attribute DOMString <a href=#dom-cva-validationmessage id=the-fieldset-element:dom-cva-validationmessage>validationMessage</a>;
- boolean <a href=#dom-cva-checkvalidity id=the-fieldset-element:dom-cva-checkvalidity>checkValidity</a>();
- boolean <a href=#dom-cva-reportvalidity id=the-fieldset-element:dom-cva-reportvalidity>reportValidity</a>();
- void <a href=#dom-cva-setcustomvalidity id=the-fieldset-element:dom-cva-setcustomvalidity>setCustomValidity</a>(DOMString error);
- };</pre>
- </dl>
- <p>The <code id=the-fieldset-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element <a href=#represents id=the-fieldset-element:represents>represents</a> a set of form controls optionally
- grouped under a common name.</p>
- <p>The name of the group is given by the first <code id=the-fieldset-element:the-legend-element-2><a href=#the-legend-element>legend</a></code> element that is a child of the
- <code id=the-fieldset-element:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code> element, if any. The remainder of the descendants form the group.</p>
- <p>The <dfn id=attr-fieldset-disabled><code>disabled</code></dfn> attribute, when specified,
- causes all the form control descendants of the <code id=the-fieldset-element:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code> element, excluding those that
- are descendants of the <code id=the-fieldset-element:the-fieldset-element-4><a href=#the-fieldset-element>fieldset</a></code> element's first <code id=the-fieldset-element:the-legend-element-3><a href=#the-legend-element>legend</a></code> element child, if
- any, to be <a href=#concept-fe-disabled id=the-fieldset-element:concept-fe-disabled>disabled</a>.</p>
- <p>A <code id=the-fieldset-element:the-fieldset-element-5><a href=#the-fieldset-element>fieldset</a></code> element is a <dfn id=concept-fieldset-disabled>disabled
- fieldset</dfn> if it matches any of the following conditions:</p>
- <ul><li>Its <code id=the-fieldset-element:attr-fieldset-disabled-2><a href=#attr-fieldset-disabled>disabled</a></code> attribute is specified
- <li>It is a descendant of another <code id=the-fieldset-element:the-fieldset-element-6><a href=#the-fieldset-element>fieldset</a></code> element whose <code id=the-fieldset-element:attr-fieldset-disabled-3><a href=#attr-fieldset-disabled>disabled</a></code> attribute is specified, and is <em>not</em> a
- descendant of that <code id=the-fieldset-element:the-fieldset-element-7><a href=#the-fieldset-element>fieldset</a></code> element's first <code id=the-fieldset-element:the-legend-element-4><a href=#the-legend-element>legend</a></code> element child, if
- any.</ul>
- <p>The <code id=the-fieldset-element:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is used to explicitly associate the
- <code id=the-fieldset-element:the-fieldset-element-8><a href=#the-fieldset-element>fieldset</a></code> element with its <a href=#form-owner id=the-fieldset-element:form-owner>form owner</a>. The <code id=the-fieldset-element:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute represents the element's name.</p>
- <dl class=domintro><dt><var>fieldset</var> . <code id=the-fieldset-element:dom-fieldset-type-2><a href=#dom-fieldset-type>type</a></code><dd>
- <p>Returns the string "fieldset".</p>
- <dt><var>fieldset</var> . <code id=the-fieldset-element:dom-fieldset-elements-2><a href=#dom-fieldset-elements>elements</a></code><dd>
- <p>Returns an <code id=the-fieldset-element:htmlformcontrolscollection-2-2><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> of the form controls in the element.</p>
- </dl>
-
- <p>The <dfn id=dom-fieldset-disabled><code>disabled</code></dfn> IDL attribute must
- <a href=#reflect id=the-fieldset-element:reflect>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-fieldset-type><code>type</code></dfn> IDL attribute must return the string
- "<code>fieldset</code>".</p>
- <p>The <dfn id=dom-fieldset-elements><code>elements</code></dfn> IDL attribute must return an
- <code id=the-fieldset-element:htmlformcontrolscollection-2-3><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code> rooted at the <code id=the-fieldset-element:the-fieldset-element-9><a href=#the-fieldset-element>fieldset</a></code> element, whose filter
- matches <a href=#category-listed id=the-fieldset-element:category-listed-2>listed elements</a>.</p>
- <p>The <code id=the-fieldset-element:dom-cva-willvalidate-2><a href=#dom-cva-willvalidate>willValidate</a></code>, <code id=the-fieldset-element:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code>, and <code id=the-fieldset-element:dom-cva-validationmessage-2><a href=#dom-cva-validationmessage>validationMessage</a></code> attributes, and the <code id=the-fieldset-element:dom-cva-checkvalidity-2><a href=#dom-cva-checkvalidity>checkValidity()</a></code>, <code id=the-fieldset-element:dom-cva-reportvalidity-2><a href=#dom-cva-reportvalidity>reportValidity()</a></code>, and <code id=the-fieldset-element:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> methods, are part of the
- <a href=#the-constraint-validation-api id=the-fieldset-element:the-constraint-validation-api>constraint validation API</a>. The <code id=the-fieldset-element:dom-fae-form-2><a href=#dom-fae-form>form</a></code> and <code id=the-fieldset-element:dom-fe-name-2><a href=#dom-fe-name>name</a></code> IDL attributes are part of the element's forms API.</p>
-
- <div class=example>
- <p>This example shows a <code id=the-fieldset-element:the-fieldset-element-10><a href=#the-fieldset-element>fieldset</a></code> element being used to group a set of related
- controls:</p>
- <pre><fieldset>
- <legend>Display</legend>
- <p><label><input type=radio name=c value=0 checked> Black on White</label>
- <p><label><input type=radio name=c value=1> White on Black</label>
- <p><label><input type=checkbox name=g> Use grayscale</label>
- <p><label>Enhance contrast <input type=range name=e list=contrast min=0 max=100 value=0 step=1></label>
- <datalist id=contrast>
- <option label=Normal value=0>
- <option label=Maximum value=100>
- </datalist>
- </fieldset></pre>
- </div>
- <div class=example>
- <p>The following snippet shows a fieldset with a checkbox in the legend that controls whether or
- not the fieldset is enabled. The contents of the fieldset consist of two required text fields and
- an optional year/month control.</p>
- <pre><fieldset name="clubfields" disabled>
- <legend> <label>
- <input type=checkbox name=club onchange="form.clubfields.disabled = !checked">
- Use Club Card
- </label> </legend>
- <p><label>Name on card: <input name=clubname required></label></p>
- <p><label>Card number: <input name=clubnum required pattern="[-0-9]+"></label></p>
- <p><label>Expiry date: <input name=clubexp type=month></label></p>
- </fieldset></pre>
- </div>
- <div class=example>
- <p>You can also nest <code id=the-fieldset-element:the-fieldset-element-11><a href=#the-fieldset-element>fieldset</a></code> elements. Here is an example expanding on the previous
- one that does so:</p>
- <pre><fieldset name="clubfields" disabled>
- <legend> <label>
- <input type=checkbox name=club onchange="form.clubfields.disabled = !checked">
- Use Club Card
- </label> </legend>
- <p><label>Name on card: <input name=clubname required></label></p>
- <fieldset name="numfields">
- <legend> <label>
- <input type=radio checked name=clubtype onchange="form.numfields.disabled = !checked">
- My card has numbers on it
- </label> </legend>
- <p><label>Card number: <input name=clubnum required pattern="[-0-9]+"></label></p>
- </fieldset>
- <fieldset name="letfields" disabled>
- <legend> <label>
- <input type=radio name=clubtype onchange="form.letfields.disabled = !checked">
- My card has letters on it
- </label> </legend>
- <p><label>Card code: <input name=clublet required pattern="[A-Za-z]+"></label></p>
- </fieldset>
- </fieldset></pre>
- <p>In this example, if the outer "Use Club Card" checkbox is not checked, everything inside the
- outer <code id=the-fieldset-element:the-fieldset-element-12><a href=#the-fieldset-element>fieldset</a></code>, including the two radio buttons in the legends of the two nested
- <code id=the-fieldset-element:the-fieldset-element-13><a href=#the-fieldset-element>fieldset</a></code>s, will be disabled. However, if the checkbox is checked, then the radio
- buttons will both be enabled and will let you select which of the two inner
- <code id=the-fieldset-element:the-fieldset-element-14><a href=#the-fieldset-element>fieldset</a></code>s is to be enabled.</p>
- </div>
- <h4 id=the-legend-element>4.10.17 The <dfn><code>legend</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-legend-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-legend-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the first child of a <code id=the-legend-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element.<dt><a href=#concept-element-content-model id=the-legend-element:concept-element-content-model>Content model</a>:<dd><a href=#phrasing-content-2 id=the-legend-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-tag-omission id=the-legend-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-legend-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-legend-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-legend-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmllegendelement>HTMLLegendElement</dfn> : <a href=#htmlelement id=the-legend-element:htmlelement>HTMLElement</a> {
- readonly attribute <a href=#htmlformelement id=the-legend-element:htmlformelement>HTMLFormElement</a>? <a href=#dom-legend-form id=the-legend-element:dom-legend-form>form</a>;
- // <a href="#HTMLLegendElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-legend-element:the-legend-element><a href=#the-legend-element>legend</a></code> element <a href=#represents id=the-legend-element:represents>represents</a> a caption for the rest of the contents
- of the <code id=the-legend-element:the-legend-element-2><a href=#the-legend-element>legend</a></code> element's parent <code id=the-legend-element:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code> element, if
- any.</p>
- <dl class=domintro><dt><var>legend</var> . <code id=the-legend-element:dom-legend-form-2><a href=#dom-legend-form>form</a></code><dd>
- <p>Returns the element's <code id=the-legend-element:the-form-element><a href=#the-form-element>form</a></code> element, if any, or null otherwise.</p>
- </dl>
-
- <p>The <dfn id=dom-legend-form><code>form</code></dfn> IDL attribute's behavior depends on
- whether the <code id=the-legend-element:the-legend-element-3><a href=#the-legend-element>legend</a></code> element is in a <code id=the-legend-element:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code> element or not. If the
- <code id=the-legend-element:the-legend-element-4><a href=#the-legend-element>legend</a></code> has a <code id=the-legend-element:the-fieldset-element-4><a href=#the-fieldset-element>fieldset</a></code> element as its parent, then the <code id=the-legend-element:dom-legend-form-3><a href=#dom-legend-form>form</a></code> IDL attribute must return the same value as the <code id=the-legend-element:dom-fae-form><a href=#dom-fae-form>form</a></code> IDL attribute on that <code id=the-legend-element:the-fieldset-element-5><a href=#the-fieldset-element>fieldset</a></code> element. Otherwise,
- it must return null.</p>
-
- <h4 id=form-control-infrastructure>4.10.18 Form control infrastructure</h4>
- <h5 id="a-form-control's-value">4.10.18.1 A form control's value</h5>
- <p>Most form controls have a <dfn id=concept-fe-value>value</dfn> and a <dfn id=concept-fe-checked>checkedness</dfn>. (The latter is only used by <code id="a-form-control's-value:the-input-element"><a href=#the-input-element>input</a></code>
- elements.) These are used to describe how the user interacts with the control.</p>
- <p>A control's <a href=#concept-fe-value id="a-form-control's-value:concept-fe-value">value</a> is its internal state. As such, it
- might not match the user's current input.</p>
- <p class=example>For instance, if a user enters the word "<kbd>three</kbd>" into <a href="#number-state-(type=number)" id="a-form-control's-value:number-state-(type=number)">a numeric field</a> that expects digits, the user's input would
- be the string "three" but the control's <a href=#concept-fe-value id="a-form-control's-value:concept-fe-value-2">value</a> would remain
- unchanged.</p>
- <p>To define the behaviour of constraint validation in the face of the <code id="a-form-control's-value:the-input-element-2"><a href=#the-input-element>input</a></code>
- element's <code id="a-form-control's-value:attr-input-multiple"><a href=#attr-input-multiple>multiple</a></code> attribute, <code id="a-form-control's-value:the-input-element-3"><a href=#the-input-element>input</a></code> elements
- can also have separately defined <dfn id=concept-fe-values>value<em>s</em></dfn>.</p>
- <p>The <code id="a-form-control's-value:the-select-element"><a href=#the-select-element>select</a></code> element does not have a <a href=#concept-fe-value id="a-form-control's-value:concept-fe-value-3">value</a>;
- the <a href=#concept-option-selectedness id="a-form-control's-value:concept-option-selectedness">selectedness</a> of its <code id="a-form-control's-value:the-option-element"><a href=#the-option-element>option</a></code>
- elements is what is used instead.</p>
- <h5 id=mutability>4.10.18.2 Mutability</h5>
- <p>A form control can be designated as <dfn id=concept-fe-mutable><i>mutable</i></dfn>.</p>
- <p class=note>This determines (by means of definitions and requirements in this specification
- that rely on whether an element is so designated) whether or not the user can modify the <a href=#concept-fe-value id=mutability:concept-fe-value>value</a> or <a href=#concept-fe-checked id=mutability:concept-fe-checked>checkedness</a> of a
- form control, or whether or not a control can be automatically prefilled.</p>
-
- <h5 id=association-of-controls-and-forms>4.10.18.3 Association of controls and forms</h5>
- <p>A <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element>form-associated element</a> can have a relationship with a <code id=association-of-controls-and-forms:the-form-element><a href=#the-form-element>form</a></code>
- element, which is called the element's <dfn id=form-owner>form owner</dfn>. If a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-2>form-associated
- element</a> is not associated with a <code id=association-of-controls-and-forms:the-form-element-2><a href=#the-form-element>form</a></code> element, its <a href=#form-owner id=association-of-controls-and-forms:form-owner>form owner</a> is
- said to be null.</p>
- <p>A <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-3>form-associated element</a> is, by default, associated with its nearest ancestor <code id=association-of-controls-and-forms:the-form-element-3><a href=#the-form-element>form</a></code> element (as described
- below), but, if it is <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr>reassociateable</a>, may have a
- <dfn id=attr-fae-form><code>form</code></dfn> attribute specified to override this.</p>
- <p class=note>This feature allows authors to work around the lack of support for nested
- <code id=association-of-controls-and-forms:the-form-element-4><a href=#the-form-element>form</a></code> elements.</p>
- <p>If a <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-2>reassociateable</a> <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-4>form-associated
- element</a> has a <code id=association-of-controls-and-forms:attr-fae-form><a href=#attr-fae-form>form</a></code> attribute specified, then that
- attribute's value must be the <a href=#concept-id id=association-of-controls-and-forms:concept-id>ID</a> of a <code id=association-of-controls-and-forms:the-form-element-5><a href=#the-form-element>form</a></code> element
- in the element's owner <code id=association-of-controls-and-forms:document><a href=#document>Document</a></code>.</p>
-
- <p class=note>The rules in this section are complicated by the fact that although conforming
- documents will never contain nested <code id=association-of-controls-and-forms:the-form-element-6><a href=#the-form-element>form</a></code> elements, it is quite possible (e.g. using a
- script that performs DOM manipulation) to generate documents that have such nested elements. They
- are also complicated by rules in the HTML parser that, for historical reasons, can result in a
- <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-5>form-associated element</a> being associated with a <code id=association-of-controls-and-forms:the-form-element-7><a href=#the-form-element>form</a></code> element that is not
- its ancestor.</p>
- <p>When a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-6>form-associated element</a> is created, its <a href=#form-owner id=association-of-controls-and-forms:form-owner-2>form owner</a> must be
- initialised to null (no owner).</p>
- <p>When a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-7>form-associated element</a> is to be <dfn id=concept-form-association>associated</dfn> with a form, its <a href=#form-owner id=association-of-controls-and-forms:form-owner-3>form owner</a> must
- be set to that form.</p>
- <p>When a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-8>form-associated element</a> or one of its ancestors is <a href=#insert-an-element-into-a-document id=association-of-controls-and-forms:insert-an-element-into-a-document>inserted into a <code>Document</code></a>, then the user agent must
- <a href=#reset-the-form-owner id=association-of-controls-and-forms:reset-the-form-owner>reset the form owner</a> of that <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-9>form-associated element</a>. <span class=note>The <a href=#html-parser id=association-of-controls-and-forms:html-parser>HTML parser</a> overrides this requirement when inserting form
- controls.</span></p>
- <p>When an element changes its parent node resulting in a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-10>form-associated element</a> and
- its <a href=#form-owner id=association-of-controls-and-forms:form-owner-4>form owner</a> (if any) no longer being in the same <a href=#home-subtree id=association-of-controls-and-forms:home-subtree>home subtree</a>, then
- the user agent must <a href=#reset-the-form-owner id=association-of-controls-and-forms:reset-the-form-owner-2>reset the form owner</a> of that <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-11>form-associated
- element</a>.</p>
- <p>When a <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-3>reassociateable</a> <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-12>form-associated
- element</a>'s <code id=association-of-controls-and-forms:attr-fae-form-2><a href=#attr-fae-form>form</a></code> attribute is set, changed, or removed,
- then the user agent must <a href=#reset-the-form-owner id=association-of-controls-and-forms:reset-the-form-owner-3>reset the form owner</a> of that element.</p>
- <p>When a <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-4>reassociateable</a> <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-13>form-associated
- element</a> has a <code id=association-of-controls-and-forms:attr-fae-form-3><a href=#attr-fae-form>form</a></code> attribute and the <a href=#concept-id id=association-of-controls-and-forms:concept-id-2>ID</a> of any of the elements in the <code id=association-of-controls-and-forms:document-2><a href=#document>Document</a></code> changes, then
- the user agent must <a href=#reset-the-form-owner id=association-of-controls-and-forms:reset-the-form-owner-4>reset the form owner</a> of that <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-14>form-associated
- element</a>.</p>
- <p>When a <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-5>reassociateable</a> <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-15>form-associated
- element</a> has a <code id=association-of-controls-and-forms:attr-fae-form-4><a href=#attr-fae-form>form</a></code> attribute and an element with an
- <a href=#concept-id id=association-of-controls-and-forms:concept-id-3>ID</a> is <a href=#insert-an-element-into-a-document id=association-of-controls-and-forms:insert-an-element-into-a-document-2>inserted
- into</a> or <a href=#remove-an-element-from-a-document id=association-of-controls-and-forms:remove-an-element-from-a-document>removed from</a> the
- <code id=association-of-controls-and-forms:document-3><a href=#document>Document</a></code>, then the user agent must <a href=#reset-the-form-owner id=association-of-controls-and-forms:reset-the-form-owner-5>reset the form owner</a> of that
- <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-16>form-associated element</a>.</p>
- <p>When the user agent is to <dfn id=reset-the-form-owner>reset the form owner</dfn> of a <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-17>form-associated
- element</a>, it must run the following steps:</p>
- <ol><li><p>If the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-5>form owner</a> is not null, and either the element is not <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-6>reassociateable</a> or its <code id=association-of-controls-and-forms:attr-fae-form-5><a href=#attr-fae-form>form</a></code> content attribute is not present, and the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-6>form
- owner</a> is its nearest <code id=association-of-controls-and-forms:the-form-element-8><a href=#the-form-element>form</a></code> element ancestor after the change to the ancestor
- chain, then do nothing, and abort these steps.<li><p>Let the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-7>form owner</a> be null.<li>
- <p>If the element is <a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-7>reassociateable</a>, has a <code id=association-of-controls-and-forms:attr-fae-form-6><a href=#attr-fae-form>form</a></code> content attribute, and is itself <a href=#in-a-document id=association-of-controls-and-forms:in-a-document>in a <code>Document</code></a>, then run these substeps:</p>
- <ol><li><p>If the first element <a href=#in-a-document id=association-of-controls-and-forms:in-a-document-2>in the <code>Document</code></a> to
- have an <a href=#concept-id id=association-of-controls-and-forms:concept-id-4>ID</a> that is <a href=#case-sensitive id=association-of-controls-and-forms:case-sensitive>case-sensitively</a> equal to the element's <code id=association-of-controls-and-forms:attr-fae-form-7><a href=#attr-fae-form>form</a></code> content attribute's value is a <code id=association-of-controls-and-forms:the-form-element-9><a href=#the-form-element>form</a></code> element,
- then <a href=#concept-form-association id=association-of-controls-and-forms:concept-form-association>associate</a> the <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-18>form-associated
- element</a> with that <code id=association-of-controls-and-forms:the-form-element-10><a href=#the-form-element>form</a></code> element.<li><p>Abort the "reset the form owner" steps.</ol>
- <li><p>Otherwise, if the <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-19>form-associated element</a> in question has an ancestor
- <code id=association-of-controls-and-forms:the-form-element-11><a href=#the-form-element>form</a></code> element, then <a href=#concept-form-association id=association-of-controls-and-forms:concept-form-association-2>associate</a> the
- <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-20>form-associated element</a> with the nearest such ancestor <code id=association-of-controls-and-forms:the-form-element-12><a href=#the-form-element>form</a></code>
- element.<li><p>Otherwise, the element is left unassociated.</ol>
- <div class=example>
- <p>In the following non-conforming snippet:</p>
- <pre class=bad>...
- <form id="a">
- <div id="b"></div>
- </form>
- <script>
- document.getElementById('b').innerHTML =
- '<table><tr><td><form id="c"><input id="d"></table>' +
- '<input id="e">';
- </script>
- ...</pre>
- <p>The <a href=#form-owner id=association-of-controls-and-forms:form-owner-8>form owner</a> of "d" would be the inner nested form "c", while the <a href=#form-owner id=association-of-controls-and-forms:form-owner-9>form
- owner</a> of "e" would be the outer form "a".</p>
- <p>This happens as follows: First, the "e" node gets associated with "c" in the <a href=#html-parser id=association-of-controls-and-forms:html-parser-2>HTML
- parser</a>. Then, the <code id=association-of-controls-and-forms:dom-innerhtml><a href=#dom-innerhtml>innerHTML</a></code> algorithm moves the nodes
- from the temporary document to the "b" element. At this point, the nodes see their ancestor chain
- change, and thus all the "magic" associations done by the parser are reset to normal ancestor
- associations.</p>
- <p>This example is a non-conforming document, though, as it is a violation of the content models
- to nest <code id=association-of-controls-and-forms:the-form-element-13><a href=#the-form-element>form</a></code> elements.</p>
- </div>
-
- <dl class=domintro><dt><var>element</var> . <code id=association-of-controls-and-forms:dom-fae-form><a href=#dom-fae-form>form</a></code><dd>
- <p>Returns the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-10>form owner</a>.</p>
- <p>Returns null if there isn't one.</p>
- </dl>
-
- <p><a href=#category-form-attr id=association-of-controls-and-forms:category-form-attr-8>Reassociateable</a> <a href=#form-associated-element id=association-of-controls-and-forms:form-associated-element-21>form-associated elements</a> have a <dfn id=dom-fae-form><code>form</code></dfn>
- IDL attribute, which, on getting, must return the element's <a href=#form-owner id=association-of-controls-and-forms:form-owner-11>form owner</a>, or null if
- there isn't one.</p>
-
- <h4 id=attributes-common-to-form-controls>4.10.19 Attributes common to form controls</h4>
- <h5 id=naming-form-controls:-the-name-attribute>4.10.19.1 Naming form controls: the <code id=naming-form-controls:-the-name-attribute:attr-fe-name><a href=#attr-fe-name>name</a></code> attribute</h5>
- <p>The <dfn id=attr-fe-name><code>name</code></dfn> content attribute gives the name of the
- form control, as used in <a href=#form-submission-2 id=naming-form-controls:-the-name-attribute:form-submission-2>form submission</a> and in the <code id=naming-form-controls:-the-name-attribute:the-form-element><a href=#the-form-element>form</a></code> element's <code id=naming-form-controls:-the-name-attribute:dom-form-elements><a href=#dom-form-elements>elements</a></code> object. If the attribute is specified, its value must
- not be the empty string.</p>
- <p>Any non-empty value for <code id=naming-form-controls:-the-name-attribute:attr-form-name><a href=#attr-form-name>name</a></code> is allowed, but the names
- "<code id=naming-form-controls:-the-name-attribute:attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and "<code id=naming-form-controls:-the-name-attribute:attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>" are special:</p>
- <dl><dt><dfn id=attr-fe-name-isindex><code>isindex</code></dfn><dd>
- <p>This value, if used as the name of a <a href="#text-(type=text)-state-and-search-state-(type=search)" id="naming-form-controls:-the-name-attribute:text-(type=text)-state-and-search-state-(type=search)">Text</a> control
- that is the first control in a form that is submitted using the <code id=naming-form-controls:-the-name-attribute:attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> mechanism, causes
- the submission to only include the value of this control, with no name.</p>
- <dt><dfn id=attr-fe-name-charset><code>_charset_</code></dfn><dd>
- <p>This value, if used as the name of a <a href="#hidden-state-(type=hidden)" id="naming-form-controls:-the-name-attribute:hidden-state-(type=hidden)">Hidden</a>
- control with no <code id=naming-form-controls:-the-name-attribute:attr-input-value><a href=#attr-input-value>value</a></code> attribute, is automatically given a
- value during submission consisting of the submission character encoding.</p>
- </dl>
-
- <p>The <dfn id=dom-fe-name><code>name</code></dfn> IDL attribute must <a href=#reflect id=naming-form-controls:-the-name-attribute:reflect>reflect</a>
- the <code id=naming-form-controls:-the-name-attribute:attr-fe-name-2><a href=#attr-fe-name>name</a></code> content attribute.</p>
-
- <h5 id=submitting-element-directionality:-the-dirname-attribute>4.10.19.2 Submitting element directionality: the <code id=submitting-element-directionality:-the-dirname-attribute:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute</h5>
- <p>The <dfn id=attr-fe-dirname><code>dirname</code></dfn> attribute on a form control element
- enables the submission of <a href=#the-directionality id=submitting-element-directionality:-the-dirname-attribute:the-directionality>the directionality</a> of the element, and gives the name of
- the field that contains this value during <a href=#form-submission-2 id=submitting-element-directionality:-the-dirname-attribute:form-submission-2>form submission</a>. If such an attribute is
- specified, its value must not be the empty string.</p>
- <div class=example>
- <p>In this example, a form contains a text field and a submission button:</p>
- <pre><form action="addcomment.cgi" method=post>
- <p><label>Comment: <input type=text name="comment" dirname="comment.dir" required></label></p>
- <p><button name="mode" type=submit value="add">Post Comment</button></p>
- </form></pre>
- <p>When the user submits the form, the user agent includes three fields, one called "comment",
- one called "comment.dir", and one called "mode"; so if the user types "Hello", the submission
- body might be something like:</p>
- <pre>comment=Hello&<strong>comment.dir=ltr</strong>&mode=add</pre>
- <p>If the user manually switches to a right-to-left writing direction and enters "<span dir=rtl lang=ar>مرحبا</span>", the submission body might be
- something like:</p>
- <pre>comment=%D9%85%D8%B1%D8%AD%D8%A8%D8%A7&<strong>comment.dir=rtl</strong>&mode=add</pre>
- </div>
- <h5 id=limiting-user-input-length:-the-maxlength-attribute>4.10.19.3 Limiting user input length: the <code id=limiting-user-input-length:-the-maxlength-attribute:attr-fe-maxlength><a href=#attr-fe-maxlength>maxlength</a></code> attribute</h5>
- <p>A <dfn id=attr-fe-maxlength>form control <code>maxlength</code> attribute</dfn>,
- controlled by a <var>dirty value flag</var>, declares a limit on the number of characters
- a user can input.</p>
- <p>If an element has its <a href=#attr-fe-maxlength id=limiting-user-input-length:-the-maxlength-attribute:attr-fe-maxlength-2>form control <code>maxlength</code> attribute</a> specified, the attribute's value must be a <a href=#valid-non-negative-integer id=limiting-user-input-length:-the-maxlength-attribute:valid-non-negative-integer>valid
- non-negative integer</a>. If the attribute is specified and applying the <a href=#rules-for-parsing-non-negative-integers id=limiting-user-input-length:-the-maxlength-attribute:rules-for-parsing-non-negative-integers>rules for
- parsing non-negative integers</a> to its value results in a number, then that number is the
- element's <dfn id=maximum-allowed-value-length>maximum allowed value length</dfn>. If the attribute is omitted or parsing its
- value results in an error, then there is no <a href=#maximum-allowed-value-length id=limiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length>maximum allowed value length</a>.</p>
-
- <p><strong>Constraint validation</strong>: If an element has a <a href=#maximum-allowed-value-length id=limiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-2>maximum allowed value
- length</a>, its <var>dirty value flag</var> is true, its <a href=#concept-fe-value id=limiting-user-input-length:-the-maxlength-attribute:concept-fe-value>value</a> was last changed by a user edit (as opposed to a change made
- by a script), and the <a href=#code-unit-length id=limiting-user-input-length:-the-maxlength-attribute:code-unit-length>code-unit length</a> of the element's <a href=#concept-fe-value id=limiting-user-input-length:-the-maxlength-attribute:concept-fe-value-2>value</a> is greater than the element's <a href=#maximum-allowed-value-length id=limiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-3>maximum allowed value
- length</a>, then the element is <a href=#suffering-from-being-too-long id=limiting-user-input-length:-the-maxlength-attribute:suffering-from-being-too-long>suffering from being too long</a>.</p>
- <p>User agents may prevent the user from causing the element's <a href=#concept-fe-value id=limiting-user-input-length:-the-maxlength-attribute:concept-fe-value-3>value</a> to be set to a value whose <a href=#code-unit-length id=limiting-user-input-length:-the-maxlength-attribute:code-unit-length-2>code-unit length</a> is
- greater than the element's <a href=#maximum-allowed-value-length id=limiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-4>maximum allowed value length</a>.</p>
- <p class=note>In the case of <code id=limiting-user-input-length:-the-maxlength-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements, this is the <a href=#concept-fe-value id=limiting-user-input-length:-the-maxlength-attribute:concept-fe-value-4>value</a>, not the <a href=#concept-textarea-raw-value id=limiting-user-input-length:-the-maxlength-attribute:concept-textarea-raw-value>raw
- value</a>, so the <a href=#textarea-wrapping-transformation id=limiting-user-input-length:-the-maxlength-attribute:textarea-wrapping-transformation>textarea wrapping transformation</a> is applied before the
- <a href=#maximum-allowed-value-length id=limiting-user-input-length:-the-maxlength-attribute:maximum-allowed-value-length-5>maximum allowed value length</a> is checked.</p>
-
- <h5 id=setting-minimum-input-length-requirements:-the-minlength-attribute>4.10.19.4 Setting minimum input length requirements: the <code id=setting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength><a href=#attr-fe-minlength>minlength</a></code> attribute</h5>
- <p>A <dfn id=attr-fe-minlength>form control <code>minlength</code> attribute</dfn>,
- controlled by a <var>dirty value flag</var>, declares a lower bound on the number of
- characters a user can input.</p>
- <p class=note>The <code id=setting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-2><a href=#attr-fe-minlength>minlength</a></code> attribute does not imply the
- <code>required</code> attribute. If the form control has no <code id=setting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-3><a href=#attr-fe-minlength>minlength</a></code> attribute, then the value can still be omitted; the
- <code id=setting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-4><a href=#attr-fe-minlength>minlength</a></code> attribute only kicks in once the user has entered
- a value at all. If the empty string is not allowed, then the <code>required</code>
- attribute also needs to be set.</p>
- <p>If an element has its <a href=#attr-fe-minlength id=setting-minimum-input-length-requirements:-the-minlength-attribute:attr-fe-minlength-5>form control <code>minlength</code> attribute</a> specified, the attribute's value must be a <a href=#valid-non-negative-integer id=setting-minimum-input-length-requirements:-the-minlength-attribute:valid-non-negative-integer>valid
- non-negative integer</a>. If the attribute is specified and applying the <a href=#rules-for-parsing-non-negative-integers id=setting-minimum-input-length-requirements:-the-minlength-attribute:rules-for-parsing-non-negative-integers>rules for
- parsing non-negative integers</a> to its value results in a number, then that number is the
- element's <dfn id=minimum-allowed-value-length>minimum allowed value length</dfn>. If the attribute is omitted or parsing its
- value results in an error, then there is no <a href=#minimum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length>minimum allowed value length</a>.</p>
- <p>If an element has both a <a href=#maximum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:maximum-allowed-value-length>maximum allowed value length</a> and a <a href=#minimum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-2>minimum allowed
- value length</a>, the <a href=#minimum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-3>minimum allowed value length</a> must be smaller than or equal
- to the <a href=#maximum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:maximum-allowed-value-length-2>maximum allowed value length</a>.</p>
-
- <p><strong>Constraint validation</strong>: If an element has a <a href=#minimum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-4>minimum allowed value
- length</a>, its <a href=#concept-fe-value id=setting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-value>value</a> is not the empty string, and the
- <a href=#code-unit-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:code-unit-length>code-unit length</a> of the element's <a href=#concept-fe-value id=setting-minimum-input-length-requirements:-the-minlength-attribute:concept-fe-value-2>value</a> is less
- than the element's <a href=#minimum-allowed-value-length id=setting-minimum-input-length-requirements:-the-minlength-attribute:minimum-allowed-value-length-5>minimum allowed value length</a>, then the element is <a href=#suffering-from-being-too-short id=setting-minimum-input-length-requirements:-the-minlength-attribute:suffering-from-being-too-short>suffering
- from being too short</a>.</p>
-
- <div class=example>
- <p>In this example, there are four text fields. The first is required, and has to be at least 5
- characters long. The other three are optional, but if the user fills one in, the user has to
- enter at least 10 characters.</p>
- <pre><form action="/events/menu.cgi" method="post">
- <p><label>Name of Event: <input required minlength=5 maxlength=50 name=event></label></p>
- <p><label>Describe what you would like for breakfast, if anything:
- <textarea name="breakfast" minlength="10"></textarea></label></p>
- <p><label>Describe what you would like for lunch, if anything:
- <textarea name="lunch" minlength="10"></textarea></label></p>
- <p><label>Describe what you would like for dinner, if anything:
- <textarea name="dinner" minlength="10"></textarea></label></p>
- <p><input type=submit value="Submit Request"></p>
- </form></pre>
- </div>
- <h5 id=enabling-and-disabling-form-controls:-the-disabled-attribute>4.10.19.5 Enabling and disabling form controls: the <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute</h5>
- <p>The <dfn id=attr-fe-disabled><code>disabled</code></dfn> content attribute is a
- <a href=#boolean-attribute id=enabling-and-disabling-form-controls:-the-disabled-attribute:boolean-attribute>boolean attribute</a>.</p>
- <p>A form control is <dfn id=concept-fe-disabled>disabled</dfn> if any of the following
- conditions are met:</p>
- <ol><li>The element is a <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-button-element><a href=#the-button-element>button</a></code>, <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-input-element><a href=#the-input-element>input</a></code>, <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-select-element><a href=#the-select-element>select</a></code>, or
- <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element, and the <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code> attribute
- is specified on this element (regardless of its value).<li>The element is a descendant of a <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element whose <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code> attribute is specified, and is <em>not</em> a
- descendant of that <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code> element's first <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:the-legend-element><a href=#the-legend-element>legend</a></code> element child, if
- any.</ol>
-
- <p>A form control that is <a href=#concept-fe-disabled id=enabling-and-disabling-form-controls:-the-disabled-attribute:concept-fe-disabled>disabled</a> must prevent any <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:event-click><a href=#event-click>click</a></code> events that are <a href=#queue-a-task id=enabling-and-disabling-form-controls:-the-disabled-attribute:queue-a-task>queued</a> on the
- <a href=#user-interaction-task-source id=enabling-and-disabling-form-controls:-the-disabled-attribute:user-interaction-task-source>user interaction task source</a> from being dispatched on the element.</p>
- <p><strong>Constraint validation</strong>: If an element is <a href=#concept-fe-disabled id=enabling-and-disabling-form-controls:-the-disabled-attribute:concept-fe-disabled-2>disabled</a>, it is <a href=#barred-from-constraint-validation id=enabling-and-disabling-form-controls:-the-disabled-attribute:barred-from-constraint-validation>barred from constraint
- validation</a>.</p>
- <p>The <dfn id=dom-fe-disabled><code>disabled</code></dfn> IDL attribute must
- <a href=#reflect id=enabling-and-disabling-form-controls:-the-disabled-attribute:reflect>reflect</a> the <code id=enabling-and-disabling-form-controls:-the-disabled-attribute:attr-fe-disabled-3><a href=#attr-fe-disabled>disabled</a></code> content attribute.</p>
-
- <h5 id=form-submission>4.10.19.6 Form submission</h5>
- <p><dfn id=attributes-for-form-submission>Attributes for form submission</dfn> can be specified both on <code id=form-submission:the-form-element><a href=#the-form-element>form</a></code> elements
- and on <a href=#concept-submit-button id=form-submission:concept-submit-button>submit buttons</a> (elements that represent buttons
- that submit forms, e.g. an <code id=form-submission:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=form-submission:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#submit-button-state-(type=submit)" id="form-submission:submit-button-state-(type=submit)">Submit Button</a> state).
- <p>The <a href=#attributes-for-form-submission id=form-submission:attributes-for-form-submission>attributes for form submission</a> that may be specified on <code id=form-submission:the-form-element-2><a href=#the-form-element>form</a></code>
- elements are <code id=form-submission:attr-fs-action><a href=#attr-fs-action>action</a></code>, <code id=form-submission:attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>, <code id=form-submission:attr-fs-method><a href=#attr-fs-method>method</a></code>, <code id=form-submission:attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>, and <code id=form-submission:attr-fs-target><a href=#attr-fs-target>target</a></code>.</p>
- <p>The corresponding <a href=#attributes-for-form-submission id=form-submission:attributes-for-form-submission-2>attributes for form submission</a> that may be specified on <a href=#concept-submit-button id=form-submission:concept-submit-button-2>submit buttons</a> are <code id=form-submission:attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>, <code id=form-submission:attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>, <code id=form-submission:attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>, <code id=form-submission:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>, and <code id=form-submission:attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>. When omitted, they default to the values given on
- the corresponding attributes on the <code id=form-submission:the-form-element-3><a href=#the-form-element>form</a></code> element.</p>
- <hr>
- <p>The <dfn id=attr-fs-action><code>action</code></dfn> and <dfn id=attr-fs-formaction><code>formaction</code></dfn> content attributes, if specified, must
- have a value that is a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=form-submission:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>.</p>
- <p>The <dfn id=concept-fs-action>action</dfn> of an element is the value of the element's
- <code id=form-submission:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code> attribute, if the element is a <a href=#concept-submit-button id=form-submission:concept-submit-button-3>submit button</a> and has such an attribute, or the value of its
- <a href=#form-owner id=form-submission:form-owner>form owner</a>'s <code id=form-submission:attr-fs-action-2><a href=#attr-fs-action>action</a></code> attribute, if <em>it</em> has
- one, or else the empty string.</p>
- <hr>
- <p>The <dfn id=attr-fs-method><code>method</code></dfn> and <dfn id=attr-fs-formmethod><code>formmethod</code></dfn> content attributes are <a href=#enumerated-attribute id=form-submission:enumerated-attribute>enumerated attributes</a> with the following keywords and
- states:</p>
- <ul><li>The keyword <dfn id=attr-fs-method-get-keyword><code>get</code></dfn>, mapping to the
- state <dfn id=attr-fs-method-get>GET</dfn>, indicating the HTTP GET method.<li>The keyword <dfn id=attr-fs-method-post-keyword><code>post</code></dfn>, mapping to the
- state <dfn id=attr-fs-method-post>POST</dfn>, indicating the HTTP POST method.<li>The keyword <dfn id=attr-fs-method-dialog-keyword><code>dialog</code></dfn>, mapping to
- the state <dfn id=attr-fs-method-dialog>dialog</dfn>, indicating that submitting the
- <code id=form-submission:the-form-element-4><a href=#the-form-element>form</a></code> is intended to close the <code id=form-submission:the-dialog-element><a href=#the-dialog-element>dialog</a></code> box in which the form finds
- itself, if any, and otherwise not submit.</ul>
- <p>The <i id=form-submission:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i> for these attributes is the <a href=#attr-fs-method-get id=form-submission:attr-fs-method-get>GET</a> state. The <i id=form-submission:missing-value-default><a href=#missing-value-default>missing value default</a></i> for the <code id=form-submission:attr-fs-method-2><a href=#attr-fs-method>method</a></code> attribute is also the <a href=#attr-fs-method-get id=form-submission:attr-fs-method-get-2>GET</a> state. (There is no <i id=form-submission:missing-value-default-2><a href=#missing-value-default>missing value default</a></i> for the
- <code id=form-submission:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code> attribute.)</p>
- <p>The <dfn id=concept-fs-method>method</dfn> of an element is one of those states. If the
- element is a <a href=#concept-submit-button id=form-submission:concept-submit-button-4>submit button</a> and has a <code id=form-submission:attr-fs-formmethod-3><a href=#attr-fs-formmethod>formmethod</a></code> attribute, then the element's <a href=#concept-fs-method id=form-submission:concept-fs-method>method</a> is that attribute's state; otherwise, it is the <a href=#form-owner id=form-submission:form-owner-2>form
- owner</a>'s <code id=form-submission:attr-fs-method-3><a href=#attr-fs-method>method</a></code> attribute's state.</p>
- <div class=example>
- <p>Here the <code id=form-submission:attr-fs-method-4><a href=#attr-fs-method>method</a></code> attribute is used to explicitly specify
- the default value, "<code id=form-submission:attr-fs-method-get-keyword><a href=#attr-fs-method-get-keyword>get</a></code>", so that the search
- query is submitted in the URL:</p>
- <pre><form method="get" action="/search.cgi">
- <p><label>Search terms: <input type=search name=q></label></p>
- <p><input type=submit></p>
- </form></pre>
- </div>
- <div class=example>
- <p>On the other hand, here the <code id=form-submission:attr-fs-method-5><a href=#attr-fs-method>method</a></code> attribute is used to
- specify the value "<code id=form-submission:attr-fs-method-post-keyword><a href=#attr-fs-method-post-keyword>post</a></code>", so that the user's
- message is submitted in the HTTP request's body:</p>
- <pre><form method="post" action="/post-message.cgi">
- <p><label>Message: <input type=text name=m></label></p>
- <p><input type=submit value="Submit message"></p>
- </form></pre>
- </div>
- <div class=example>
- <p>In this example, a <code id=form-submission:the-form-element-5><a href=#the-form-element>form</a></code> is used with a <code id=form-submission:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code>. The <code id=form-submission:attr-fs-method-6><a href=#attr-fs-method>method</a></code> attribute's "<code id=form-submission:attr-fs-method-dialog-keyword><a href=#attr-fs-method-dialog-keyword>dialog</a></code>" keyword is used to have the dialog
- automatically close when the form is submitted.</p>
- <pre lang=en-GB><dialog id="ship">
- <form method=dialog>
- <p>A ship has arrived in the harbour.</p>
- <button type=submit value="board">Board the ship</button>
- <button type=submit value="call">Call to the captain</button>
- </form>
- </dialog>
- <script>
- var ship = document.getElementById('ship');
- ship.showModal();
- ship.onclose = function (event) {
- if (ship.returnValue == 'board') {
- // ...
- } else {
- // ...
- }
- };
- </script></pre>
- </div>
- <hr>
- <p>The <dfn id=attr-fs-enctype><code>enctype</code></dfn> and <dfn id=attr-fs-formenctype><code>formenctype</code></dfn> content attributes are <a href=#enumerated-attribute id=form-submission:enumerated-attribute-2>enumerated attributes</a> with the following keywords and
- states:</p>
- <ul><li>The "<dfn id=attr-fs-enctype-urlencoded><code>application/x-www-form-urlencoded</code></dfn>" keyword and corresponding state.<li>The "<dfn id=attr-fs-enctype-formdata><code>multipart/form-data</code></dfn>" keyword and corresponding state.<li>The "<dfn id=attr-fs-enctype-text><code>text/plain</code></dfn>" keyword and corresponding state.</ul>
- <p>The <i id=form-submission:invalid-value-default-2><a href=#invalid-value-default>invalid value default</a></i> for these attributes is the <code id=form-submission:attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> state. The <i id=form-submission:missing-value-default-3><a href=#missing-value-default>missing value default</a></i> for the <code id=form-submission:attr-fs-enctype-2><a href=#attr-fs-enctype>enctype</a></code> attribute is also the <code id=form-submission:attr-fs-enctype-urlencoded-2><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code> state. (There is no
- <i id=form-submission:missing-value-default-4><a href=#missing-value-default>missing value default</a></i> for the <code id=form-submission:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>
- attribute.)</p>
- <p>The <dfn id=concept-fs-enctype>enctype</dfn> of an element is one of those three states.
- If the element is a <a href=#concept-submit-button id=form-submission:concept-submit-button-5>submit button</a> and has a <code id=form-submission:attr-fs-formenctype-3><a href=#attr-fs-formenctype>formenctype</a></code> attribute, then the element's <a href=#concept-fs-enctype id=form-submission:concept-fs-enctype>enctype</a> is that attribute's state; otherwise, it is the
- <a href=#form-owner id=form-submission:form-owner-3>form owner</a>'s <code id=form-submission:attr-fs-enctype-3><a href=#attr-fs-enctype>enctype</a></code> attribute's state.</p>
- <hr>
- <p>The <dfn id=attr-fs-target><code>target</code></dfn> and <dfn id=attr-fs-formtarget><code>formtarget</code></dfn> content attributes, if specified, must
- have values that are <a href=#valid-browsing-context-name-or-keyword id=form-submission:valid-browsing-context-name-or-keyword>valid browsing context
- names or keywords</a>.</p>
- <p>The <dfn id=concept-fs-target>target</dfn> of an element is the value of the element's
- <code id=form-submission:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code> attribute, if the element is a <a href=#concept-submit-button id=form-submission:concept-submit-button-6>submit button</a> and has such an attribute; or the value of its
- <a href=#form-owner id=form-submission:form-owner-4>form owner</a>'s <code id=form-submission:attr-fs-target-2><a href=#attr-fs-target>target</a></code> attribute, if <em>it</em> has
- such an attribute; or, if the <code id=form-submission:document><a href=#document>Document</a></code> contains a <code id=form-submission:the-base-element><a href=#the-base-element>base</a></code> element with a
- <code id=form-submission:attr-base-target><a href=#attr-base-target>target</a></code> attribute, then the value of the <code id=form-submission:attr-base-target-2><a href=#attr-base-target>target</a></code> attribute of the first such <code id=form-submission:the-base-element-2><a href=#the-base-element>base</a></code> element; or,
- if there is no such element, the empty string.</p>
- <hr>
- <p>The <dfn id=attr-fs-novalidate><code>novalidate</code></dfn> and <dfn id=attr-fs-formnovalidate><code>formnovalidate</code></dfn> content attributes are <a href=#boolean-attribute id=form-submission:boolean-attribute>boolean attributes</a>. If present, they indicate that the form is
- not to be validated during submission.</p>
- <p>The <dfn id=concept-fs-novalidate>no-validate state</dfn> of an element is true if the
- element is a <a href=#concept-submit-button id=form-submission:concept-submit-button-7>submit button</a> and the element's <code id=form-submission:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code> attribute is present, or if the element's
- <a href=#form-owner id=form-submission:form-owner-5>form owner</a>'s <code id=form-submission:attr-fs-novalidate-2><a href=#attr-fs-novalidate>novalidate</a></code> attribute is present,
- and false otherwise.</p>
- <div class=example>
- <p>This attribute is useful to include "save" buttons on forms that have validation constraints,
- to allow users to save their progress even though they haven't fully entered the data in the
- form. The following example shows a simple form that has two required fields. There are three
- buttons: one to submit the form, which requires both fields to be filled in; one to save the form
- so that the user can come back and fill it in later; and one to cancel the form altogether.</p>
- <pre><form action="editor.cgi" method="post">
- <p><label>Name: <input required name=fn></label></p>
- <p><label>Essay: <textarea required name=essay></textarea></label></p>
- <p><input type=submit name=submit value="Submit essay"></p>
- <p><input type=submit formnovalidate name=save value="Save essay"></p>
- <p><input type=submit formnovalidate name=cancel value="Cancel"></p>
- </form></pre>
- </div>
-
- <hr>
- <p>The <dfn id=dom-fs-action><code>action</code></dfn> IDL attribute must
- <a href=#reflect id=form-submission:reflect>reflect</a> the content attribute of the same name, except that on getting, when the
- content attribute is missing or its value is the empty string, <a id="form-submission:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>
- must be returned instead. The <dfn id=dom-fs-target><code>target</code></dfn> IDL attribute
- must <a href=#reflect id=form-submission:reflect-2>reflect</a> the content attribute of the same name. The <dfn id=dom-fs-method><code>method</code></dfn> and <dfn id=dom-fs-enctype><code>enctype</code></dfn> IDL attributes must <a href=#reflect id=form-submission:reflect-3>reflect</a> the
- respective content attributes of the same name, <a href=#limited-to-only-known-values id=form-submission:limited-to-only-known-values>limited to only known values</a>. The
- <dfn id=dom-fs-encoding><code>encoding</code></dfn> IDL attribute must <a href=#reflect id=form-submission:reflect-4>reflect</a>
- the <code id=form-submission:attr-fs-enctype-4><a href=#attr-fs-enctype>enctype</a></code> content attribute, <a href=#limited-to-only-known-values id=form-submission:limited-to-only-known-values-2>limited to only known
- values</a>. The <dfn id=dom-fs-novalidate><code>noValidate</code></dfn> IDL attribute must
- <a href=#reflect id=form-submission:reflect-5>reflect</a> the <code id=form-submission:attr-fs-novalidate-3><a href=#attr-fs-novalidate>novalidate</a></code> content attribute. The
- <dfn id=dom-fs-formaction><code>formAction</code></dfn> IDL attribute must
- <a href=#reflect id=form-submission:reflect-6>reflect</a> the <code id=form-submission:attr-fs-formaction-3><a href=#attr-fs-formaction>formaction</a></code> content attribute,
- except that on getting, when the content attribute is missing or its value is the empty string,
- <a id="form-submission:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> must be returned instead. The <dfn id=dom-fs-formenctype><code>formEnctype</code></dfn> IDL attribute must <a href=#reflect id=form-submission:reflect-7>reflect</a>
- the <code id=form-submission:attr-fs-formenctype-4><a href=#attr-fs-formenctype>formenctype</a></code> content attribute, <a href=#limited-to-only-known-values id=form-submission:limited-to-only-known-values-3>limited to only
- known values</a>. The <dfn id=dom-fs-formmethod><code>formMethod</code></dfn> IDL
- attribute must <a href=#reflect id=form-submission:reflect-8>reflect</a> the <code id=form-submission:attr-fs-formmethod-4><a href=#attr-fs-formmethod>formmethod</a></code> content
- attribute, <a href=#limited-to-only-known-values id=form-submission:limited-to-only-known-values-4>limited to only known values</a>. The <dfn id=dom-fs-formnovalidate><code>formNoValidate</code></dfn> IDL attribute must
- <a href=#reflect id=form-submission:reflect-9>reflect</a> the <code id=form-submission:attr-fs-formnovalidate-3><a href=#attr-fs-formnovalidate>formnovalidate</a></code> content
- attribute. The <dfn id=dom-fs-formtarget><code>formTarget</code></dfn> IDL attribute must
- <a href=#reflect id=form-submission:reflect-10>reflect</a> the <code id=form-submission:attr-fs-formtarget-3><a href=#attr-fs-formtarget>formtarget</a></code> content attribute.
- </p>
- <h6 id=autofocusing-a-form-control:-the-autofocus-attribute>4.10.19.6.1 Autofocusing a form control: the <code id=autofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute</h6>
-
- <p>The <dfn id=attr-fe-autofocus><code>autofocus</code></dfn> content attribute allows the
- author to indicate that a control is to be focused as soon as the page is loaded or as soon as the
- <code id=autofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element><a href=#the-dialog-element>dialog</a></code> within which it finds itself is shown, allowing the user to just start typing
- without having to manually focus the main control.</p>
- <p>The <code id=autofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute is a <a href=#boolean-attribute id=autofocusing-a-form-control:-the-autofocus-attribute:boolean-attribute>boolean
- attribute</a>.</p>
- <p>An element's <dfn id=nearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root element</dfn> is the element itself
- if the element is a <code id=autofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element, or else is the element's nearest ancestor
- <code id=autofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element-3><a href=#the-dialog-element>dialog</a></code> element, if any, or else is the element's <a href=#root-element id=autofocusing-a-form-control:-the-autofocus-attribute:root-element>root element</a>.</p>
- <p>There must not be two elements with the same <a href=#nearest-ancestor-autofocus-scoping-root-element id=autofocusing-a-form-control:-the-autofocus-attribute:nearest-ancestor-autofocus-scoping-root-element>nearest ancestor autofocus scoping root
- element</a> that both have the <code id=autofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-3><a href=#attr-fe-autofocus>autofocus</a></code> attribute
- specified.</p>
-
- <p>When an element with the <code id=autofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-4><a href=#attr-fe-autofocus>autofocus</a></code> attribute specified
- is <a href=#insert-an-element-into-a-document id=autofocusing-a-form-control:-the-autofocus-attribute:insert-an-element-into-a-document>inserted into a document</a>, user agents
- should run the following steps:</p>
- <ol><li><p>Let <var>target</var> be the element's <a id=autofocusing-a-form-control:-the-autofocus-attribute:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.<li><p>If <var>target</var> has no <a href=#browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:browsing-context>browsing context</a>, abort these
- steps.<li><p>If <var>target</var>'s <a href=#browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:browsing-context-2>browsing context</a> has no <a href=#top-level-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context>top-level
- browsing context</a> (e.g. it is a <a href=#nested-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:nested-browsing-context>nested browsing context</a> with no <a href=#parent-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:parent-browsing-context>parent
- browsing context</a>), abort these steps.<li><p>If <var>target</var>'s <a href=#active-sandboxing-flag-set id=autofocusing-a-form-control:-the-autofocus-attribute:active-sandboxing-flag-set>active sandboxing flag set</a> has the
- <a href=#sandboxed-automatic-features-browsing-context-flag id=autofocusing-a-form-control:-the-autofocus-attribute:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a>, abort these steps.<li><p>If <var>target</var>'s <a href=#origin-2 id=autofocusing-a-form-control:-the-autofocus-attribute:origin-2>origin</a> is not the <a href=#same-origin id=autofocusing-a-form-control:-the-autofocus-attribute:same-origin>same</a> as the <a href=#origin-2 id=autofocusing-a-form-control:-the-autofocus-attribute:origin-2-2>origin</a> of the <a id=autofocusing-a-form-control:-the-autofocus-attribute:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the currently
- focused element in <var>target</var>'s <a href=#top-level-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-2>top-level browsing context</a>, abort
- these steps.<li><p>If <var>target</var>'s <a href=#origin-2 id=autofocusing-a-form-control:-the-autofocus-attribute:origin-2-3>origin</a> is not the <a href=#same-origin id=autofocusing-a-form-control:-the-autofocus-attribute:same-origin-2>same</a> as the <a href=#origin-2 id=autofocusing-a-form-control:-the-autofocus-attribute:origin-2-4>origin</a> of the <a href=#active-document id=autofocusing-a-form-control:-the-autofocus-attribute:active-document>active document</a> of <var>target</var>'s <a href=#top-level-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-3>top-level browsing context</a>, abort these steps.<li><p>If the user agent has already reached the last step of this list of steps in response to
- an element being <a href=#insert-an-element-into-a-document id=autofocusing-a-form-control:-the-autofocus-attribute:insert-an-element-into-a-document-2>inserted</a> into a
- <code id=autofocusing-a-form-control:-the-autofocus-attribute:document><a href=#document>Document</a></code> whose <a href=#top-level-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-4>top-level browsing context</a>'s <a href=#active-document id=autofocusing-a-form-control:-the-autofocus-attribute:active-document-2>active
- document</a> is the same as <var>target</var>'s <a href=#top-level-browsing-context id=autofocusing-a-form-control:-the-autofocus-attribute:top-level-browsing-context-5>top-level browsing
- context</a>'s <a href=#active-document id=autofocusing-a-form-control:-the-autofocus-attribute:active-document-3>active document</a>, abort these steps.<li><p>If the user has indicated (for example, by starting to type in a form control) that he
- does not wish focus to be changed, then optionally abort these steps.<li><p><a href=#queue-a-task id=autofocusing-a-form-control:-the-autofocus-attribute:queue-a-task>Queue a task</a> that runs the <a href=#focusing-steps id=autofocusing-a-form-control:-the-autofocus-attribute:focusing-steps>focusing steps</a> for the element. User
- agents may also change the scrolling position of the document, or perform some other action that
- brings the element to the user's attention. The <a href=#task-source id=autofocusing-a-form-control:-the-autofocus-attribute:task-source>task source</a> for this task is the
- <a href=#user-interaction-task-source id=autofocusing-a-form-control:-the-autofocus-attribute:user-interaction-task-source>user interaction task source</a>.</ol>
- <p class=note>This handles the automatic focusing during document load. The <code id=autofocusing-a-form-control:-the-autofocus-attribute:dom-dialog-show><a href=#dom-dialog-show>show()</a></code> and <code id=autofocusing-a-form-control:-the-autofocus-attribute:dom-dialog-showmodal><a href=#dom-dialog-showmodal>showModal()</a></code>
- methods of <code id=autofocusing-a-form-control:-the-autofocus-attribute:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> elements also processes the <code id=autofocusing-a-form-control:-the-autofocus-attribute:attr-fe-autofocus-5><a href=#attr-fe-autofocus>autofocus</a></code> attribute.</p>
- <p class=note>Focusing the control does not imply that the user agent must focus the browser
- window if it has lost focus.</p>
- <p>The <dfn id=dom-fe-autofocus><code>autofocus</code></dfn> IDL attribute must
- <a href=#reflect id=autofocusing-a-form-control:-the-autofocus-attribute:reflect>reflect</a> the content attribute of the same name.</p>
-
- <div class=example>
- <p>In the following snippet, the text control would be focused when
- the document was loaded.</p>
- <pre><input maxlength="256" name="q" value="" autofocus>
- <input type="submit" value="Search"></pre>
- </div>
- <h5 id=input-modalities:-the-inputmode-attribute>4.10.19.7 Input modalities: the <code id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code> attribute</h5>
-
- <p>The <dfn id=attr-fe-inputmode><code>inputmode</code></dfn> content attribute is an
- <a href=#enumerated-attribute id=input-modalities:-the-inputmode-attribute:enumerated-attribute>enumerated attribute</a> that specifies what kind of input mechanism would be most
- helpful for users entering content into the form control.</p>
-
- <p>User agents must recognise all the keywords and corresponding states given below, but need not
- support all of the corresponding states. If a keyword's state is not supported, the user agent
- must act as if the keyword instead mapped to the given state's fallback state, as defined below.
- This fallback behaviour is transitive.</p>
- <p class=note>For example, if a user agent with a QWERTY keyboard layout does not support text
- prediction and automatic capitalization, then it could treat the <code id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-keyword-latin-prose><a href=#attr-fe-inputmode-keyword-latin-prose>latin-prose</a></code> keyword in the same way as the
- <code id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-keyword-verbatim><a href=#attr-fe-inputmode-keyword-verbatim>verbatim</a></code> keyword, following the chain
- <a href=#attr-fe-inputmode-state-latin-prose id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-prose>Latin Prose</a> → <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin>Latin Text</a> → <a href=#attr-fe-inputmode-state-verbatim id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-verbatim>Latin Verbatim</a>.</p>
-
- <p>The possible keywords and states for the attributes are listed in the following table. The
- keywords are listed in the first column. Each maps to the state given in the cell in the second
- column of that keyword's row, and that state has the fallback state given in the cell in the third
- column of that row.</p>
- <table class=three-column-nowrap><thead><tr><th> Keyword
- <th> State
- <th> Fallback state
- <th> Description
- <tbody><tr><td> <dfn id=attr-fe-inputmode-keyword-verbatim><code>verbatim</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-verbatim>Latin Verbatim</dfn>
- <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default>Default</a>
- <td> Alphanumeric Latin-script input of non-prose content, e.g. usernames, passwords, product codes.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-latin><code>latin</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-latin>Latin Text</dfn>
- <td> <a href=#attr-fe-inputmode-state-verbatim id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-verbatim-2>Latin Verbatim</a>
- <td> Latin-script input in the user's preferred language(s), with some typing aids enabled
- (e.g. text prediction). Intended for human-to-computer communications, e.g. free-form text
- search fields.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-name><code>latin-name</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-latin-name>Latin Name</dfn>
- <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-2>Latin Text</a>
- <td> Latin-script input in the user's preferred language(s), with typing aids intended for
- entering human names enabled (e.g. text prediction from the user's contact list and automatic
- capitalisation at every word). Intended for situations such as customer name fields.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-latin-prose><code>latin-prose</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-latin-prose>Latin Prose</dfn>
- <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-3>Latin Text</a>
- <td> Latin-script input in the user's preferred language(s), with aggressive typing aids
- intended for human-to-human communications enabled (e.g. text prediction and automatic
- capitalisation at the start of sentences). Intended for situations such as e-mails and instant
- messaging.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-full-width-latin><code>full-width-latin</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-full-width-latin>Full-width Latin</dfn>
- <td> <a href=#attr-fe-inputmode-state-latin id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-latin-4>Latin Prose</a>
- <td> Latin-script input in the user's secondary language(s), using full-width characters, with
- aggressive typing aids intended for human-to-human communications enabled (e.g. text prediction
- and automatic capitalisation at the start of sentences). Intended for latin text embedded
- inside CJK text.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-kana><code>kana</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-kana>Kana</dfn>
- <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-2>Default</a>
- <td> Kana or romaji input, typically hiragana input, using full-width characters, with support
- for converting to kanji. Intended for Japanese text input.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-kana-name><code>kana-name</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-kana-name>Kana Name</dfn>
- <td> <a href=#attr-fe-inputmode-state-kana id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana>Kana</a>
- <td> Kana or romaji input, typically hiragana input, using full-width characters, with support
- for converting to kanji, and with typing aids intended for entering human names enabled (e.g.
- text prediction from the user's contact list). Intended for situations such as customer name
- fields.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-katakana><code>katakana</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-katakana>Katakana</dfn>
- <td> <a href=#attr-fe-inputmode-state-kana id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-kana-2>Kana</a>
- <td> Katakana input, using full-width characters, with support for converting to kanji.
- Intended for Japanese text input.
- <tr><td> <dfn id=attr-fe-inputmode-keyword-numeric><code>numeric</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-numeric>Numeric</dfn>
- <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-3>Default</a>
- <td> Numeric input, including keys for the digits 0 to 9, the user's preferred thousands
- separator character, and the character for indicating negative numbers. Intended for numeric
- codes, e.g. credit card numbers. (For numbers, prefer "<code id="input-modalities:-the-inputmode-attribute:number-state-(type=number)"><a href="#number-state-(type=number)"><input type=number></a></code>".)
- <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-tel><code>tel</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-telephone>Telephone</dfn>
- <td> <a href=#attr-fe-inputmode-state-numeric id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-numeric>Numeric</a>
- <td> Telephone number input, including keys for the digits 0 to 9, the "#" character, and the
- "*" character. In some locales, this can also include alphabetic mnemonic labels (e.g. in the
- US, the key labeled "2" is historically also labeled with the letters A, B, and C). <a href=#avoid-inputmode>Rarely necessary</a>; use "<code id="input-modalities:-the-inputmode-attribute:telephone-state-(type=tel)"><a href="#telephone-state-(type=tel)"><input
- type=tel></a></code>" instead.
- <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-email><code>email</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-email>E-mail</dfn>
- <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-4>Default</a>
- <td> Text input in the user's locale, with keys for aiding in the input of e-mail addresses,
- such as that for the "@" character and the "." character. <a href=#avoid-inputmode>Rarely
- necessary</a>; use "<code id="input-modalities:-the-inputmode-attribute:e-mail-state-(type=email)"><a href="#e-mail-state-(type=email)"><input type=email></a></code>" instead.
- <tr class=rare><td> <dfn id=attr-fe-inputmode-keyword-url><code>url</code></dfn>
- <td> <dfn id=attr-fe-inputmode-state-url>URL</dfn>
- <td> <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-5>Default</a>
- <td> Text input in the user's locale, with keys for aiding in the input of Web addresses, such
- as that for the "/" and "." characters and for quick input of strings commonly found in domain
- names such as "www." or ".co.uk". <a href=#avoid-inputmode>Rarely necessary</a>; use "<code id="input-modalities:-the-inputmode-attribute:url-state-(type=url)"><a href="#url-state-(type=url)"><input type=url></a></code>" instead.
- </table>
- <p id=avoid-inputmode>The last three keywords listed above are only provided for completeness,
- and are rarely necessary, as dedicated input controls exist for their usual use cases (as
- described in the table above).</p>
- <p>User agents must all support the <dfn id=attr-fe-inputmode-state-default>Default</dfn> input mode state, which corresponds to the
- user agent's default input modality. This specification does not define how the
- user agent's default modality is to operate. The <i id=input-modalities:-the-inputmode-attribute:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-fe-inputmode-state-default id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-state-default-6>default input mode</a> state.</p>
-
- <p>User agents should use the input modality corresponding to the state of the <code id=input-modalities:-the-inputmode-attribute:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code> attribute when exposing a user interface for editing
- the value of a form control to which the attribute <a href=#concept-input-apply id=input-modalities:-the-inputmode-attribute:concept-input-apply>applies</a>. An input modality corresponding to a state is one
- designed to fit the description of the state in the table above. This value can change
- dynamically; user agents should update their interface as the attribute changes state, unless that
- would go against the user's wishes.</p>
-
- <h5 id=autofill>4.10.19.8 Autofill</h5>
- <h6 id=autofilling-form-controls:-the-autocomplete-attribute>4.10.19.8.1 Autofilling form controls: the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute</h6>
- <p>User agents sometimes have features for helping users fill forms in, for example prefilling the
- user's address based on earlier user input. The <dfn id=attr-fe-autocomplete><code>autocomplete</code></dfn> content attribute can be used to hint
- to the user agent how to, or indeed whether to, provide such a feature.</p>
-
- <p>There are two ways this attribute is used. When wearing the <dfn id=autofill-expectation-mantle>autofill expectation
- mantle</dfn>, the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute describes what
- input is expected from users. When wearing the <dfn id=autofill-anchor-mantle>autofill anchor mantle</dfn>, the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute describes the meaning of the given
- value.</p>
- <p>On an <code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute is
- in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)">Hidden</a> state, the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute wears the <a href=#autofill-anchor-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle>autofill anchor
- mantle</a>. In all other cases, it wears the <a href=#autofill-expectation-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle>autofill expectation mantle</a>.</p>
- <p>When wearing the <a href=#autofill-expectation-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle-2>autofill expectation mantle</a>, the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-5><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute, if specified, must have a value that
- is an ordered <a href=#set-of-space-separated-tokens id=autofilling-form-controls:-the-autocomplete-attribute:set-of-space-separated-tokens>set of space-separated tokens</a> consisting of either a single token that
- is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", or a single token that is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-2>ASCII
- case-insensitive</a> match for the string "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>",
- or <a href=#autofill-detail-tokens id=autofilling-form-controls:-the-autocomplete-attribute:autofill-detail-tokens>autofill detail tokens</a>.</p>
- <p>When wearing the <a href=#autofill-anchor-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-2>autofill anchor
- mantle</a>, the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-6><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute, if specified, must have a value that is an ordered <a href=#set-of-space-separated-tokens id=autofilling-form-controls:-the-autocomplete-attribute:set-of-space-separated-tokens-2>set of
- space-separated tokens</a> consisting of just <a href=#autofill-detail-tokens id=autofilling-form-controls:-the-autocomplete-attribute:autofill-detail-tokens-2>autofill detail tokens</a> (i.e. the
- "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-2><a href=#attr-fe-autocomplete-on>on</a></code>" and "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-off-2><a href=#attr-fe-autocomplete-off>off</a></code>" keywords are not allowed).</p>
- <p><dfn id=autofill-detail-tokens>Autofill detail tokens</dfn> are the following, in the order given below:</p>
- <ol><li>
- <p>Optionally, a token whose first eight characters are an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-3>ASCII case-insensitive</a>
- match for the string "<dfn id=attr-fe-autocomplete-section><code>section-</code></dfn>",
- meaning that the field belongs to the named group.</p>
- <div class=example>
- <p>For example, if there are two shipping addresses in the form, then they could be marked up
- as:</p>
- <pre><fieldset>
- <legend>Ship the blue gift to...</legend>
- <p> <label> Address: <input name=ba autocomplete="section-blue shipping street-address"> </label>
- <p> <label> City: <input name=bc autocomplete="section-blue shipping address-level1"> </label>
- <p> <label> Postal Code: <input name=bp autocomplete="section-blue shipping postal-code"> </label>
- </fieldset>
- <fieldset>
- <legend>Ship the red gift to...</legend>
- <p> <label> Address: <input name=ra autocomplete="section-red shipping street-address"> </label>
- <p> <label> City: <input name=rc autocomplete="section-red shipping address-level1"> </label>
- <p> <label> Postal Code: <input name=rp autocomplete="section-red shipping postal-code"> </label>
- </fieldset></pre>
- </div>
- <li>
- <p>Optionally, a token that is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-4>ASCII case-insensitive</a> match for one of the
- following strings:</p>
- <ul class=brief><li>"<dfn id=attr-fe-autocomplete-shipping><code>shipping</code></dfn>", meaning the field
- is part of the shipping address or contact information
- <li>"<dfn id=attr-fe-autocomplete-billing><code>billing</code></dfn>", meaning the field
- is part of the billing address or contact information
- </ul>
- <li>
- <p>Either of the following two options:</p>
- <ul><li>
- <p>A token that is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-5>ASCII case-insensitive</a> match for one of the following
- <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field>autofill field</a> names, excluding those that are <a href=#inappropriate-for-the-control id=autofilling-form-controls:-the-autocomplete-attribute:inappropriate-for-the-control>inappropriate for the
- control</a>:</p>
- <ul class=brief><li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-honorific-prefix><a href=#attr-fe-autocomplete-honorific-prefix>honorific-prefix</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-additional-name><a href=#attr-fe-autocomplete-additional-name>additional-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-family-name><a href=#attr-fe-autocomplete-family-name>family-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-honorific-suffix><a href=#attr-fe-autocomplete-honorific-suffix>honorific-suffix</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-username><a href=#attr-fe-autocomplete-username>username</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-new-password><a href=#attr-fe-autocomplete-new-password>new-password</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-current-password><a href=#attr-fe-autocomplete-current-password>current-password</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-organization-title><a href=#attr-fe-autocomplete-organization-title>organization-title</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-street-address><a href=#attr-fe-autocomplete-street-address>street-address</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line1><a href=#attr-fe-autocomplete-address-line1>address-line1</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line2><a href=#attr-fe-autocomplete-address-line2>address-line2</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-line3><a href=#attr-fe-autocomplete-address-line3>address-line3</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level4><a href=#attr-fe-autocomplete-address-level4>address-level4</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level3><a href=#attr-fe-autocomplete-address-level3>address-level3</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level2><a href=#attr-fe-autocomplete-address-level2>address-level2</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1><a href=#attr-fe-autocomplete-address-level1>address-level1</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-postal-code><a href=#attr-fe-autocomplete-postal-code>postal-code</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-name><a href=#attr-fe-autocomplete-cc-name>cc-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-given-name><a href=#attr-fe-autocomplete-cc-given-name>cc-given-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-additional-name><a href=#attr-fe-autocomplete-cc-additional-name>cc-additional-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-family-name><a href=#attr-fe-autocomplete-cc-family-name>cc-family-name</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-number><a href=#attr-fe-autocomplete-cc-number>cc-number</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-month><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-year><a href=#attr-fe-autocomplete-cc-exp-year>cc-exp-year</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-csc><a href=#attr-fe-autocomplete-cc-csc>cc-csc</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-type><a href=#attr-fe-autocomplete-cc-type>cc-type</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-transaction-currency><a href=#attr-fe-autocomplete-transaction-currency>transaction-currency</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-transaction-amount><a href=#attr-fe-autocomplete-transaction-amount>transaction-amount</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-day><a href=#attr-fe-autocomplete-bday-day>bday-day</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-month><a href=#attr-fe-autocomplete-bday-month>bday-month</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-bday-year><a href=#attr-fe-autocomplete-bday-year>bday-year</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-photo><a href=#attr-fe-autocomplete-photo>photo</a></code>"
- </ul>
- <p>(See the table below for descriptions of these values.)</p>
- <li>
- <p>The following, in the given order:</p>
- <ol><li>
- <p>Optionally, a token that is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-6>ASCII case-insensitive</a> match for one of the
- following strings:</p>
- <ul class=brief><li>"<dfn id=attr-fe-autocomplete-home><code>home</code></dfn>", meaning the field is
- for contacting someone at their residence
- <li>"<dfn id=attr-fe-autocomplete-work><code>work</code></dfn>", meaning the field is
- for contacting someone at their workplace
- <li>"<dfn id=attr-fe-autocomplete-mobile><code>mobile</code></dfn>", meaning the field is for contacting someone regardless of location
- <li>"<dfn id=attr-fe-autocomplete-fax><code>fax</code></dfn>", meaning the field
- describes a fax machine's contact details
- <li>"<dfn id=attr-fe-autocomplete-pager><code>pager</code></dfn>", meaning the field
- describes a pager's or beeper's contact details
- </ul>
- <li>
- <p>A token that is an <a href=#ascii-case-insensitive id=autofilling-form-controls:-the-autocomplete-attribute:ascii-case-insensitive-7>ASCII case-insensitive</a> match for one of the following
- <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-2>autofill field</a> names, excluding those that are <a href=#inappropriate-for-the-control id=autofilling-form-controls:-the-autocomplete-attribute:inappropriate-for-the-control-2>inappropriate for the
- control</a>:</p>
- <ul class=brief><li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-country-code><a href=#attr-fe-autocomplete-tel-country-code>tel-country-code</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-area-code><a href=#attr-fe-autocomplete-tel-area-code>tel-area-code</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local><a href=#attr-fe-autocomplete-tel-local>tel-local</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local-prefix><a href=#attr-fe-autocomplete-tel-local-prefix>tel-local-prefix</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-local-suffix><a href=#attr-fe-autocomplete-tel-local-suffix>tel-local-suffix</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-tel-extension><a href=#attr-fe-autocomplete-tel-extension>tel-extension</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
- <li>"<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-impp><a href=#attr-fe-autocomplete-impp>impp</a></code>"
- </ul>
- <p>(See the table below for descriptions of these values.)</p>
- </ol>
- </ul>
- </ol>
- <p>As noted earlier, the meaning of the attribute and its keywords depends on the mantle that the
- attribute is wearing.</p>
- <dl class=switch><dt>When wearing the <a href=#autofill-expectation-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-expectation-mantle-3>autofill expectation mantle</a>...
- <dd>
- <p>The "<dfn id=attr-fe-autocomplete-off><code>off</code></dfn>" keyword indicates either
- that the control's input data is particularly sensitive (for example the activation code for a
- nuclear weapon); or that it is a value that will never be reused (for example a one-time-key for a
- bank login) and the user will therefore have to explicitly enter the data each time, instead of
- being able to rely on the UA to prefill the value for him; or that the document provides its own
- autocomplete mechanism and does not want the user agent to provide autocompletion values.</p>
- <p>The "<dfn id=attr-fe-autocomplete-on><code>on</code></dfn>" keyword indicates that the
- user agent is allowed to provide the user with autocompletion values, but does not provide any
- further information about what kind of data the user might be expected to enter. User agents would
- have to use heuristics to decide what autocompletion values to suggest.</p>
- <p>The <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-3>autofill field</a> listed above indicate that the user agent is allowed to
- provide the user with autocompletion values, and specifies what kind of value is expected. The
- meaning of each such keyword is described in the table below.</p>
- <p>If the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-7><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is omitted, the default
- value corresponding to the state of the element's <a href=#form-owner id=autofilling-form-controls:-the-autocomplete-attribute:form-owner>form owner</a>'s <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is used instead (either "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-3><a href=#attr-fe-autocomplete-on>on</a></code>" or "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-off-3><a href=#attr-fe-autocomplete-off>off</a></code>"). If there is no <a href=#form-owner id=autofilling-form-controls:-the-autocomplete-attribute:form-owner-2>form owner</a>, then the
- value "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-on-4><a href=#attr-fe-autocomplete-on>on</a></code>" is used.</p>
- <dt>When wearing the <a href=#autofill-anchor-mantle id=autofilling-form-controls:-the-autocomplete-attribute:autofill-anchor-mantle-3>autofill anchor mantle</a>...
- <dd>
- <p>The <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-4>autofill field</a> listed above indicate that the value of the particular kind
- of value specified is that value provided for this element. The meaning of each such keyword is
- described in the table below.</p>
- <div class=example>
- <p>In this example the page has explicitly specified the currency and amount of the
- transaction. The form requests a credit card and other billing details. The user agent could
- use this information to suggest a credit card that it knows has sufficient balance and that
- supports the relevant currency.</p>
- <pre><form method=post action="step2.cgi">
- <input type=hidden autocomplete=transaction-currency value="CHF">
- <input type=hidden autocomplete=transaction-amount value="15.00">
- <p><label>Credit card number: <input type=text inputmode=numeric autocomplete=cc-number></label>
- <p><label>Expiry Date: <input type=month autocomplete=cc-exp></label>
- <p><input type=submit value="Continue...">
- </form></pre>
- </div>
- </dl>
- <p>The <dfn id=autofill-field>autofill field</dfn> keywords relate to each other as described in the table below. Each field name
- listed on a row of this table corresponds to the meaning given in the cell for that row in the
- column labeled "Meaning". Some fields correspond to subparts of other fields; for example, a
- credit card expiry date can be expressed as one field giving both the month and year of expiry
- ("<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-2><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"), or as two fields, one giving the
- month ("<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-month-2><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>") and one the year
- ("<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-cc-exp-year-2><a href=#attr-fe-autocomplete-cc-exp-year>cc-exp-year</a></code>"). In such cases, the names of
- the broader fields cover multiple rows, in which the narrower fields are defined.</p>
- <p class=note>Generally, authors are encouraged to use the broader fields rather than the
- narrower fields, as the narrower fields tend to expose Western biases. For example, while it is
- common in some Western cultures to have a given name and a family name, in that order (and thus
- often referred to as a <i>first name</i> and a <i>surname</i>), many cultures put the family name
- first and the given name second, and many others simply have one name (a <i>mononym</i>). Having a
- single field is therefore more flexible.</p>
- <p>Some fields are only appropriate for certain form controls. An <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-5>autofill field</a> name
- is <dfn id=inappropriate-for-the-control>inappropriate for a control</dfn> if the control
- does not belong to the group listed for that <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-6>autofill field</a> in the fifth column of
- the first row describing that <a href=#autofill-field id=autofilling-form-controls:-the-autocomplete-attribute:autofill-field-7>autofill field</a> in the table below. What controls fall
- into each group is described below the table.</p>
- <table><thead><tr><th colspan=4> Field name
- <th> Meaning
- <th> Canonical Format
- <th> Canonical Format Example
- <th> Control group
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-name><code>name</code></dfn>"
- <td>Full name
- <td>Free-form text, no newlines
- <td>Sir Timothy John Berners-Lee, OM, KBE, FRS, FREng, FRSA
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text>Text</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=5>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-prefix><code>honorific-prefix</code></dfn>"
- <td>Prefix or title (e.g. "Mr.", "Ms.", "Dr.", "<span lang=fr>M<sup>lle</sup></span>")
- <td>Free-form text, no newlines
- <td>Sir
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-2>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-given-name><code>given-name</code></dfn>"
- <td>Given name (in some Western cultures, also known as the <i>first name</i>)
- <td>Free-form text, no newlines
- <td>Timothy
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-3>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-additional-name><code>additional-name</code></dfn>"
- <td>Additional names (in some Western cultures, also known as <i>middle names</i>, forenames other than the first name)
- <td>Free-form text, no newlines
- <td>John
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-4>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-family-name><code>family-name</code></dfn>"
- <td>Family name (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
- <td>Free-form text, no newlines
- <td>Berners-Lee
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-5>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-honorific-suffix><code>honorific-suffix</code></dfn>"
- <td>Suffix (e.g. "Jr.", "B.Sc.", "MBASW", "II")
- <td>Free-form text, no newlines
- <td>OM, KBE, FRS, FREng, FRSA
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-6>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-nickname><code>nickname</code></dfn>"
- <td>Nickname, screen name, handle: a typically short name used instead of the full name
- <td>Free-form text, no newlines
- <td>Tim
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-7>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization-title><code>organization-title</code></dfn>"
- <td>Job title (e.g. "Software Engineer", "Senior Vice President", "Deputy Managing Director")
- <td>Free-form text, no newlines
- <td>Professor
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-8>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-username><code>username</code></dfn>"
- <td>A username
- <td>Free-form text, no newlines
- <td>timbl
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-9>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-new-password><code>new-password</code></dfn>"
- <td>A new password (e.g. when creating an account or changing a password)
- <td>Free-form text, no newlines
- <td>GUMFXbadyrS3
- <td><a href=#control-group-password id=autofilling-form-controls:-the-autocomplete-attribute:control-group-password>Password</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-current-password><code>current-password</code></dfn>"
- <td>The current password for the account identified by the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-username-2><a href=#attr-fe-autocomplete-username>username</a></code> field (e.g. when logging in)
- <td>Free-form text, no newlines
- <td>qwerty
- <td><a href=#control-group-password id=autofilling-form-controls:-the-autocomplete-attribute:control-group-password-2>Password</a>
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-organization><code>organization</code></dfn>"
- <td>Company name corresponding to the person, address, or contact information in the other fields associated with this field
- <td>Free-form text, no newlines
- <td>World Wide Web Consortium
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-10>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-street-address><code>street-address</code></dfn>"
- <td>Street address (multiple lines, newlines preserved)
- <td>Free-form text
- <td>32 Vassar Street<br>
- MIT Room 32-G524
- <td><a href=#control-group-multiline id=autofilling-form-controls:-the-autocomplete-attribute:control-group-multiline>Multiline</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=3>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-address-line1><code>address-line1</code></dfn>"
- <td rowspan=3>Street address (one line per field)
- <td>Free-form text, no newlines
- <td>32 Vassar Street
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-11>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line2><code>address-line2</code></dfn>"
- <td>Free-form text, no newlines
- <td>MIT Room 32-G524
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-12>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-address-line3><code>address-line3</code></dfn>"
- <td>Free-form text, no newlines
- <td>
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-13>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level4><code>address-level4</code></dfn>"
- <td>The most fine-grained <a href=#more-on-address-levels>administrative level</a>, in
- addresses with four administrative levels
- <td>Free-form text, no newlines
- <td>
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-14>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level3><code>address-level3</code></dfn>"
- <td>The <a href=#more-on-address-levels>third administrative level</a>, in addresses with
- three or more administrative levels
- <td>Free-form text, no newlines
- <td>
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-15>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level2><code>address-level2</code></dfn>"
- <td>The <a href=#more-on-address-levels>second administrative level</a>, in addresses with
- two or more administrative levels; in the countries with two administrative levels, this would
- typically be the city, town, village, or other locality within which the relevant street
- address is found
- <td>Free-form text, no newlines
- <td>Cambridge
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-16>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-address-level1><code>address-level1</code></dfn>"
- <td>The broadest <a href=#more-on-address-levels>administrative level</a> in the address,
- i.e. the province within which the locality is found; for example, in the US, this would be the
- state; in Switzerland it would be the canton; in the UK, the post town
- <td>Free-form text, no newlines
- <td>MA
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-17>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country><code>country</code></dfn>"
- <td>Country code
- <td>Valid <a href=http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm>ISO 3166-1-alpha-2 country code</a> <a href=#refsISO3166>[ISO3166]</a>
- <td>US
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-18>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-country-name><code>country-name</code></dfn>"
- <td>Country name
- <td>Free-form text, no newlines; <a href=#autofill-country>derived from <code>country</code> in some cases</a>
- <td>US
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-19>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-postal-code><code>postal-code</code></dfn>"
- <td>Postal code, post code, ZIP code, CEDEX code (if CEDEX, append "CEDEX", and the <i lang=fr>arrondissement</i>, if relevant, to the <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level2-2><a href=#attr-fe-autocomplete-address-level2>address-level2</a></code> field)
- <td>Free-form text, no newlines
- <td>02139
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-20>Text</a>
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-name><code>cc-name</code></dfn>"
- <td>Full name as given on the payment instrument
- <td>Free-form text, no newlines
- <td>Tim Berners-Lee
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-21>Text</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=3>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-given-name><code>cc-given-name</code></dfn>"
- <td>Given name as given on the payment instrument (in some Western cultures, also known as the <i>first name</i>)
- <td>Free-form text, no newlines
- <td>Tim
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-22>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-additional-name><code>cc-additional-name</code></dfn>"
- <td>Additional names given on the payment instrument (in some Western cultures, also known as <i>middle names</i>, forenames other than the first name)
- <td>Free-form text, no newlines
- <td>
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-23>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-family-name><code>cc-family-name</code></dfn>"
- <td>Family name given on the payment instrument (in some Western cultures, also known as the <i>last name</i> or <i>surname</i>)
- <td>Free-form text, no newlines
- <td>Berners-Lee
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-24>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-number><code>cc-number</code></dfn>"
- <td>Code identifying the payment instrument (e.g. the credit card number, bank account number)
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits>ASCII digits</a>
- <td>4114360123456785
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-25>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-exp><code>cc-exp</code></dfn>"
- <td>Expiration date of the payment instrument
- <td><a href=#valid-month-string id=autofilling-form-controls:-the-autocomplete-attribute:valid-month-string>Valid month string</a>
- <td>2014-12
- <td><a href=#control-group-month id=autofilling-form-controls:-the-autocomplete-attribute:control-group-month>Month</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=2>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-month><code>cc-exp-month</code></dfn>"
- <td>Month component of the expiration date of the payment instrument
- <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer>Valid integer</a> in the range 1..12
- <td>12
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric>Numeric</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-cc-exp-year><code>cc-exp-year</code></dfn>"
- <td>Year component of the expiration date of the payment instrument
- <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-2>Valid integer</a> greater than zero
- <td>2014
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-2>Numeric</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-csc><code>cc-csc</code></dfn>"
- <td>Security code for the payment instrument (also known as the card security code (CSC), card validation code (CVC), card verification value (CVV), signature panel code (SPC), credit card ID (CCID), etc)
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-2>ASCII digits</a>
- <td>419
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-26>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-cc-type><code>cc-type</code></dfn>"
- <td>Type of payment instrument
- <td>Free-form text, no newlines
- <td>Visa
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-27>Text</a>
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-transaction-currency><code>transaction-currency</code></dfn>"
- <td>The currency that the user would prefer the transaction to use
- <td>ISO 4217 currency code <a href=#refsISO4217>[ISO4217]</a>
- <td>GBP
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-28>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-transaction-amount><code>transaction-amount</code></dfn>"
- <td>The amount that the user would like for the transaction (e.g. when entering a bid or sale price)
- <td><a href=#valid-floating-point-number id=autofilling-form-controls:-the-autocomplete-attribute:valid-floating-point-number>Valid floating-point number</a>
- <td>401.00
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-3>Numeric</a>
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-language><code>language</code></dfn>"
- <td>Preferred language
- <td>Valid BCP 47 language tag <a href=#refsBCP47>[BCP47]</a>
- <td>en
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-29>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-bday><code>bday</code></dfn>"
- <td>Birthday
- <td><a href=#valid-date-string id=autofilling-form-controls:-the-autocomplete-attribute:valid-date-string>Valid date string</a>
- <td>1955-06-08
- <td><a href=#control-group-date id=autofilling-form-controls:-the-autocomplete-attribute:control-group-date>Date</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=3>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-bday-day><code>bday-day</code></dfn>"
- <td>Day component of birthday
- <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-3>Valid integer</a> in the range 1..31
- <td>8
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-4>Numeric</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-month><code>bday-month</code></dfn>"
- <td>Month component of birthday
- <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-4>Valid integer</a> in the range 1..12
- <td>6
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-5>Numeric</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-bday-year><code>bday-year</code></dfn>"
- <td>Year component of birthday
- <td><a href=#valid-integer id=autofilling-form-controls:-the-autocomplete-attribute:valid-integer-5>Valid integer</a> greater than zero
- <td>1955
- <td><a href=#control-group-numeric id=autofilling-form-controls:-the-autocomplete-attribute:control-group-numeric-6>Numeric</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-sex><code>sex</code></dfn>"
- <td>Gender identity (e.g. Female, Fa'afafine)
- <td>Free-form text, no newlines
- <td>Male
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-30>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-url><code>url</code></dfn>"
- <td>Home page or other Web page corresponding to the company, person, address, or contact information in the other fields associated with this field
- <td><a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url>Valid URL</a>
- <td>http://www.w3.org/People/Berners-Lee/
- <td><a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url>URL</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-photo><code>photo</code></dfn>"
- <td>Photograph, icon, or other image corresponding to the company, person, address, or contact information in the other fields associated with this field
- <td> <a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url-2>Valid URL</a>
- <td>http://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg
- <td> <a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url-2>URL</a>
- <tbody><tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel><code>tel</code></dfn>"
- <td>Full telephone number, including country code
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-3>ASCII digits</a> and U+0020 SPACE characters, prefixed by a U+002B PLUS SIGN character (+)
- <td>+1 617 253 5702
- <td><a href=#control-group-tel id=autofilling-form-controls:-the-autocomplete-attribute:control-group-tel>Tel</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=6>
- <td colspan=3>"<dfn id=attr-fe-autocomplete-tel-country-code><code>tel-country-code</code></dfn>"
- <td>Country code component of the telephone number
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-4>ASCII digits</a> prefixed by a U+002B PLUS SIGN character (+)
- <td>+1
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-31>Text</a>
- <tr><td colspan=3>"<dfn id=attr-fe-autocomplete-tel-national><code>tel-national</code></dfn>"
- <td>Telephone number without the county code component, with a country-internal prefix applied if applicable
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-5>ASCII digits</a> and U+0020 SPACE characters
- <td>617 253 5702
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-32>Text</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=4>
- <td colspan=2>"<dfn id=attr-fe-autocomplete-tel-area-code><code>tel-area-code</code></dfn>"
- <td>Area code component of the telephone number, with a country-internal prefix applied if applicable
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-6>ASCII digits</a>
- <td>617
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-33>Text</a>
- <tr><td colspan=2>"<dfn id=attr-fe-autocomplete-tel-local><code>tel-local</code></dfn>"
- <td>Telephone number without the country code and area code components
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-7>ASCII digits</a>
- <td>2535702
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-34>Text</a>
- <tr><td class=non-rectangular-cell-indentation rowspan=2>
- <td>"<dfn id=attr-fe-autocomplete-tel-local-prefix><code>tel-local-prefix</code></dfn>"
- <td>First part of the component of the telephone number that follows the area code, when that component is split into two components
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-8>ASCII digits</a>
- <td>253
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-35>Text</a>
- <tr><td>"<dfn id=attr-fe-autocomplete-tel-local-suffix><code>tel-local-suffix</code></dfn>"
- <td>Second part of the component of the telephone number that follows the area code, when that component is split into two components
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-9>ASCII digits</a>
- <td>5702
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-36>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-tel-extension><code>tel-extension</code></dfn>"
- <td>Telephone number internal extension code
- <td><a href=#ascii-digits id=autofilling-form-controls:-the-autocomplete-attribute:ascii-digits-10>ASCII digits</a>
- <td>1000
- <td><a href=#control-group-text id=autofilling-form-controls:-the-autocomplete-attribute:control-group-text-37>Text</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-email><code>email</code></dfn>"
- <td>E-mail address
- <td><a href=#valid-e-mail-address id=autofilling-form-controls:-the-autocomplete-attribute:valid-e-mail-address>Valid e-mail address</a>
- <td>timbl@w3.org
- <td><a href=#control-group-e-mail id=autofilling-form-controls:-the-autocomplete-attribute:control-group-e-mail>E-mail</a>
- <tr><td colspan=4>"<dfn id=attr-fe-autocomplete-impp><code>impp</code></dfn>"
- <td>URL representing an instant messaging protocol endpoint (for example, "<code>aim:goim?screenname=example</code>" or "<code>xmpp:fred@example.net</code>")
- <td><a href=#valid-url id=autofilling-form-controls:-the-autocomplete-attribute:valid-url-3>Valid URL</a>
- <td>irc://example.org/timbl,isuser
- <td><a href=#control-group-url id=autofilling-form-controls:-the-autocomplete-attribute:control-group-url-3>URL</a>
- </table>
- <p>The groups correspond to controls as follows:</p>
- <dl><dt><dfn id=control-group-text>Text</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-2><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-2">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-3><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-4><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-2">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-multiline>Multiline</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-5><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-3">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-2><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-password>Password</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-6><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-4">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-7><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-7><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-3">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-8><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-8><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-4">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-9><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-9><a href=#attr-input-type>type</a></code> attribute is in the <a href="#password-state-(type=password)" id="autofilling-form-controls:-the-autocomplete-attribute:password-state-(type=password)">Password</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-3><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-url>URL</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-10><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-10><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-5">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-11><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-11><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-5">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-12><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-12><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-6">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-13><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-13><a href=#attr-input-type>type</a></code> attribute is in the <a href="#url-state-(type=url)" id="autofilling-form-controls:-the-autocomplete-attribute:url-state-(type=url)">URL</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-4><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-e-mail>E-mail</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-14><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-14><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-6">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-15><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-15><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-7">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-16><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-16><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-8">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-17><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-17><a href=#attr-input-type>type</a></code> attribute is in the <a href="#e-mail-state-(type=email)" id="autofilling-form-controls:-the-autocomplete-attribute:e-mail-state-(type=email)">E-mail</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-5><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-tel>Tel</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-18><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-18><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-7">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-19><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-19><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-9">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-20><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-20><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-10">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-21><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-21><a href=#attr-input-type>type</a></code> attribute is in the <a href="#telephone-state-(type=tel)" id="autofilling-form-controls:-the-autocomplete-attribute:telephone-state-(type=tel)">Telephone</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-6><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-numeric>Numeric</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-22><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-22><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-8">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-23><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-23><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-11">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-24><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-24><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-12">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-25><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-25><a href=#attr-input-type>type</a></code> attribute is in the <a href="#number-state-(type=number)" id="autofilling-form-controls:-the-autocomplete-attribute:number-state-(type=number)">Number</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-7><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-month>Month</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-26><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-26><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-9">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-27><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-27><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-13">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-28><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-28><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-14">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-29><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-29><a href=#attr-input-type>type</a></code> attribute is in the <a href="#month-state-(type=month)" id="autofilling-form-controls:-the-autocomplete-attribute:month-state-(type=month)">Month</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-8><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-8><a href=#the-select-element>select</a></code> elements
- <dt><dfn id=control-group-date>Date</dfn>
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-30><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-30><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="autofilling-form-controls:-the-autocomplete-attribute:hidden-state-(type=hidden)-10">Hidden</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-31><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-31><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-15">Text</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-32><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-32><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="autofilling-form-controls:-the-autocomplete-attribute:text-(type=text)-state-and-search-state-(type=search)-16">Search</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-input-element-33><a href=#the-input-element>input</a></code> elements whose <code id=autofilling-form-controls:-the-autocomplete-attribute:attr-input-type-33><a href=#attr-input-type>type</a></code> attribute is in the <a href="#date-state-(type=date)" id="autofilling-form-controls:-the-autocomplete-attribute:date-state-(type=date)">Date</a> state
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-textarea-element-9><a href=#the-textarea-element>textarea</a></code> elements
- <dd><code id=autofilling-form-controls:-the-autocomplete-attribute:the-select-element-9><a href=#the-select-element>select</a></code> elements
- </dl>
- <p id=more-on-address-levels><strong>Address levels</strong>: The "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1-2><a href=#attr-fe-autocomplete-address-level1>address-level1</a></code>" – "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level4-2><a href=#attr-fe-autocomplete-address-level4>address-level4</a></code>" fields are used to describe
- the locality of the street address. Different locales have different numbers of levels. For
- example, the US uses two levels (state and town), the UK uses one or two depending on the address
- (the post town, and in some cases the locality), and China can use three (province, city,
- district). The "<code id=autofilling-form-controls:-the-autocomplete-attribute:attr-fe-autocomplete-address-level1-3><a href=#attr-fe-autocomplete-address-level1>address-level1</a></code>" field
- represents the widest administrative division. Different locales order the fields in different
- ways; for example, in the US the town (level 2) precedes the state (level 1); while in Japan the
- prefecture (level 1) precedes the city (level 2) which precedes the district (level 3). Authors
- are encouraged to provide forms that are presented in a way that matches the country's conventions
- (hiding, showing, and rearranging fields accordingly as the user changes the country).</p>
-
- <h6 id=processing-model-4>4.10.19.8.2 Processing model</h6>
- <p>Each <code id=processing-model-4:the-input-element><a href=#the-input-element>input</a></code> element to which the <code id=processing-model-4:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute <a href=#concept-input-apply id=processing-model-4:concept-input-apply>applies</a>, each <code id=processing-model-4:the-select-element><a href=#the-select-element>select</a></code> element, and each <code id=processing-model-4:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element, has an
- <dfn id=autofill-hint-set>autofill hint set</dfn>, an <dfn id=autofill-scope>autofill scope</dfn>, an <dfn id=autofill-field-name>autofill field name</dfn>, and
- an <dfn id=idl-exposed-autofill-value>IDL-exposed autofill value</dfn>.</p>
- <p>The <a href=#autofill-field-name id=processing-model-4:autofill-field-name>autofill field name</a> specifies the specific kind of data expected in the field,
- e.g. "<code id=processing-model-4:attr-fe-autocomplete-street-address><a href=#attr-fe-autocomplete-street-address>street-address</a></code>" or "<code id=processing-model-4:attr-fe-autocomplete-cc-exp><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>".</p>
- <p>The <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set>autofill hint set</a> identifies what address or contact information type the user
- agent is to look at, e.g. "<code id=processing-model-4:attr-fe-autocomplete-shipping><a href=#attr-fe-autocomplete-shipping>shipping</a></code> <code id=processing-model-4:attr-fe-autocomplete-fax><a href=#attr-fe-autocomplete-fax>fax</a></code>" or "<code id=processing-model-4:attr-fe-autocomplete-billing><a href=#attr-fe-autocomplete-billing>billing</a></code>".</p>
- <p>The <a href=#autofill-scope id=processing-model-4:autofill-scope>autofill scope</a> identifies the group of fields whose information concerns the
- same subject, and consists of the <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-2>autofill hint set</a> with, if
- applicable, the "<code>section-*</code>" prefix, e.g. "<code>billing</code>",
- "<code>section-parent shipping</code>", or "<code>section-child shipping
- home</code>".</p>
- <p>These values are defined as the result of running the following algorithm:</p>
- <ol><li><p>If the element has no <code id=processing-model-4:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute,
- then jump to the step labeled <i>default</i>.<li><p>Let <var>tokens</var> be the result of <a href=#split-a-string-on-spaces id=processing-model-4:split-a-string-on-spaces>splitting the attribute's value on spaces</a>.<li><p>If <var>tokens</var> is empty, then jump to the step labeled
- <i>default</i>.<li><p>Let <var>index</var> be the index of the last token in <var>tokens</var>.<li>
- <p>If the <var>index</var>th token in <var>tokens</var> is not an <a href=#ascii-case-insensitive id=processing-model-4:ascii-case-insensitive>ASCII
- case-insensitive</a> match for one of the tokens given in the first column of the following
- table, or if the number of tokens in <var>tokens</var> is greater than the maximum
- number given in the cell in the second column of that token's row, then jump to the step labeled
- <i>default</i>. Otherwise, let <var>field</var> be the string given in the cell of the
- first column of the matching row, and let <var>category</var> be the value of the cell
- in the third column of that same row.</p>
- <table><thead><tr><th>Token
- <th>Maximum number of tokens
- <th>Category
- <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>"
- <td>1
- <td>Off
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>"
- <td>1
- <td>Automatic
- <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-name><a href=#attr-fe-autocomplete-name>name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-honorific-prefix><a href=#attr-fe-autocomplete-honorific-prefix>honorific-prefix</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-given-name><a href=#attr-fe-autocomplete-given-name>given-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-additional-name><a href=#attr-fe-autocomplete-additional-name>additional-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-family-name><a href=#attr-fe-autocomplete-family-name>family-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-honorific-suffix><a href=#attr-fe-autocomplete-honorific-suffix>honorific-suffix</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-nickname><a href=#attr-fe-autocomplete-nickname>nickname</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-organization-title><a href=#attr-fe-autocomplete-organization-title>organization-title</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-username><a href=#attr-fe-autocomplete-username>username</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-new-password><a href=#attr-fe-autocomplete-new-password>new-password</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-current-password><a href=#attr-fe-autocomplete-current-password>current-password</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-organization><a href=#attr-fe-autocomplete-organization>organization</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-street-address-2><a href=#attr-fe-autocomplete-street-address>street-address</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line1><a href=#attr-fe-autocomplete-address-line1>address-line1</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line2><a href=#attr-fe-autocomplete-address-line2>address-line2</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-line3><a href=#attr-fe-autocomplete-address-line3>address-line3</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level4><a href=#attr-fe-autocomplete-address-level4>address-level4</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level3><a href=#attr-fe-autocomplete-address-level3>address-level3</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level2><a href=#attr-fe-autocomplete-address-level2>address-level2</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-address-level1><a href=#attr-fe-autocomplete-address-level1>address-level1</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-country><a href=#attr-fe-autocomplete-country>country</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-country-name><a href=#attr-fe-autocomplete-country-name>country-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-postal-code><a href=#attr-fe-autocomplete-postal-code>postal-code</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-name><a href=#attr-fe-autocomplete-cc-name>cc-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-given-name><a href=#attr-fe-autocomplete-cc-given-name>cc-given-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-additional-name><a href=#attr-fe-autocomplete-cc-additional-name>cc-additional-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-family-name><a href=#attr-fe-autocomplete-cc-family-name>cc-family-name</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-number><a href=#attr-fe-autocomplete-cc-number>cc-number</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-exp-2><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-exp-month><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-exp-year><a href=#attr-fe-autocomplete-cc-exp-year>cc-exp-year</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-csc><a href=#attr-fe-autocomplete-cc-csc>cc-csc</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-cc-type><a href=#attr-fe-autocomplete-cc-type>cc-type</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-transaction-currency><a href=#attr-fe-autocomplete-transaction-currency>transaction-currency</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-transaction-amount><a href=#attr-fe-autocomplete-transaction-amount>transaction-amount</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-language><a href=#attr-fe-autocomplete-language>language</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday><a href=#attr-fe-autocomplete-bday>bday</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-day><a href=#attr-fe-autocomplete-bday-day>bday-day</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-month><a href=#attr-fe-autocomplete-bday-month>bday-month</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-bday-year><a href=#attr-fe-autocomplete-bday-year>bday-year</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-sex><a href=#attr-fe-autocomplete-sex>sex</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-url><a href=#attr-fe-autocomplete-url>url</a></code>"
- <td>3
- <td>Normal
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-photo><a href=#attr-fe-autocomplete-photo>photo</a></code>"
- <td>3
- <td>Normal
- <tbody><tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel><a href=#attr-fe-autocomplete-tel>tel</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-country-code><a href=#attr-fe-autocomplete-tel-country-code>tel-country-code</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-national><a href=#attr-fe-autocomplete-tel-national>tel-national</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-area-code><a href=#attr-fe-autocomplete-tel-area-code>tel-area-code</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-local><a href=#attr-fe-autocomplete-tel-local>tel-local</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-local-prefix><a href=#attr-fe-autocomplete-tel-local-prefix>tel-local-prefix</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-local-suffix><a href=#attr-fe-autocomplete-tel-local-suffix>tel-local-suffix</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-tel-extension><a href=#attr-fe-autocomplete-tel-extension>tel-extension</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-email><a href=#attr-fe-autocomplete-email>email</a></code>"
- <td>4
- <td>Contact
- <tr><td>"<code id=processing-model-4:attr-fe-autocomplete-impp><a href=#attr-fe-autocomplete-impp>impp</a></code>"
- <td>4
- <td>Contact
- </table>
- <li><p>If <var>category</var> is Off or Automatic but the element's <code id=processing-model-4:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is wearing the <a href=#autofill-anchor-mantle id=processing-model-4:autofill-anchor-mantle>autofill anchor
- mantle</a>, then jump to the step labeled <i>default</i>.<li><p>If <var>category</var> is Off, let the element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-2>autofill field name</a>
- be the string "<code>off</code>", let its <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-3>autofill hint set</a> be empty, and
- let its <a href=#idl-exposed-autofill-value id=processing-model-4:idl-exposed-autofill-value>IDL-exposed autofill value</a> be the string "<code>off</code>". Then,
- abort these steps.</p>
- <li><p>If <var>category</var> is Automatic, let the element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-3>autofill field
- name</a> be the string "<code>on</code>", let its <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-4>autofill hint set</a> be
- empty, and let its <a href=#idl-exposed-autofill-value id=processing-model-4:idl-exposed-autofill-value-2>IDL-exposed autofill value</a> be the string "<code>on</code>". Then, abort these steps.</p>
- <li><p>Let <var>scope tokens</var> be an empty list.<li><p>Let <var>hint tokens</var> be an empty set.<li><p>Let <var>IDL value</var> have the same value as <var>field</var>.<li><p>If the <var>index</var>th token in <var>tokens</var> is the first entry,
- then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.<li>
- <p>If <var>category</var> is Contact and the <var>index</var>th token in <var>tokens</var> is an <a href=#ascii-case-insensitive id=processing-model-4:ascii-case-insensitive-2>ASCII case-insensitive</a> match for one of the strings in
- the following list, then run the substeps that follow:</p>
- <ul class=brief><li>"<code id=processing-model-4:attr-fe-autocomplete-home><a href=#attr-fe-autocomplete-home>home</a></code>"
- <li>"<code id=processing-model-4:attr-fe-autocomplete-work><a href=#attr-fe-autocomplete-work>work</a></code>"
- <li>"<code id=processing-model-4:attr-fe-autocomplete-mobile><a href=#attr-fe-autocomplete-mobile>mobile</a></code>"
- <li>"<code id=processing-model-4:attr-fe-autocomplete-fax-2><a href=#attr-fe-autocomplete-fax>fax</a></code>"
- <li>"<code id=processing-model-4:attr-fe-autocomplete-pager><a href=#attr-fe-autocomplete-pager>pager</a></code>"
- </ul>
- <p>The substeps are:</p>
- <ol><li><p>Let <var>contact</var> be the matching string from the list above.<li><p>Insert <var>contact</var> at the start of <var>scope
- tokens</var>.<li><p>Add <var>contact</var> to <var>hint tokens</var>.<li><p>Let <var>IDL value</var> be the concatenation of <var>contact</var>, a
- U+0020 SPACE character, and the previous value of <var>IDL value</var> (which at this
- point will always be <var>field</var>).<li><p>If the <var>index</var>th entry in <var>tokens</var> is the first
- entry, then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.</ol>
- <li>
- <p>If the <var>index</var>th token in <var>tokens</var> is an <a href=#ascii-case-insensitive id=processing-model-4:ascii-case-insensitive-3>ASCII
- case-insensitive</a> match for one of the strings in the following list, then run the
- substeps that follow:</p>
- <ul class=brief><li>"<code id=processing-model-4:attr-fe-autocomplete-shipping-2><a href=#attr-fe-autocomplete-shipping>shipping</a></code>"
- <li>"<code id=processing-model-4:attr-fe-autocomplete-billing-2><a href=#attr-fe-autocomplete-billing>billing</a></code>"
- </ul>
- <p>The substeps are:</p>
- <ol><li><p>Let <var>mode</var> be the matching string from the list above.<li><p>Insert <var>mode</var> at the start of <var>scope
- tokens</var>.<li><p>Add <var>mode</var> to <var>hint tokens</var>.<li><p>Let <var>IDL value</var> be the concatenation of <var>mode</var>, a
- U+0020 SPACE character, and the previous value of <var>IDL value</var> (which at this
- point will either be <var>field</var> or the concatenation of <var>contact</var>, a space, and <var>field</var>).<li><p>If the <var>index</var>th entry in <var>tokens</var> is the first
- entry, then skip to the step labeled <i>done</i>.<li><p>Decrement <var>index</var> by one.</ol>
- <li><p>If the <var>index</var>th entry in <var>tokens</var> is not the first entry, then jump to
- the step labeled <i>default</i>.<li><p>If the first eight characters of the <var>index</var>th token in <var>tokens</var> are not
- an <a href=#ascii-case-insensitive id=processing-model-4:ascii-case-insensitive-4>ASCII case-insensitive</a> match for the string "<code id=processing-model-4:attr-fe-autocomplete-section><a href=#attr-fe-autocomplete-section>section-</a></code>", then jump to the step labeled
- <i>default</i>.<li><p>Let <var>section</var> be the <var>index</var>th token in <var>tokens</var>,
- <a href=#converted-to-ascii-lowercase id=processing-model-4:converted-to-ascii-lowercase>converted to ASCII lowercase</a>.<li><p>Insert <var>section</var> at the start of <var>scope tokens</var>.<li><p>Let <var>IDL value</var> be the concatenation of <var>section</var>, a U+0020 SPACE
- character, and the previous value of <var>IDL value</var>.<li><p><i>Done</i>: Let the element's <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-5>autofill hint set</a> be <var>hint
- tokens</var>.</p>
- <li><p>Let the element's <a href=#autofill-scope id=processing-model-4:autofill-scope-2>autofill scope</a> be <var>scope tokens</var>.</p>
- <li><p>Let the element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-4>autofill field name</a> be <var>field</var>.</p>
- <li><p>Let the element's <a href=#idl-exposed-autofill-value id=processing-model-4:idl-exposed-autofill-value-3>IDL-exposed autofill value</a> be <var>IDL value</var>.</p>
- <li><p>Abort these steps.<li><p><i>Default</i>: Let the element's <a href=#idl-exposed-autofill-value id=processing-model-4:idl-exposed-autofill-value-4>IDL-exposed autofill value</a> be the empty
- string, and its <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-6>autofill hint set</a> and <a href=#autofill-scope id=processing-model-4:autofill-scope-3>autofill scope</a> be empty.<li><p>If the element's <code id=processing-model-4:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is
- wearing the <a href=#autofill-anchor-mantle id=processing-model-4:autofill-anchor-mantle-2>autofill anchor mantle</a>, then let the element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-5>autofill field
- name</a> be the empty string and abort these steps.<li><p>Let <var>form</var> be the element's <a href=#form-owner id=processing-model-4:form-owner>form owner</a>, if any, or null
- otherwise.<li>
- <p>If <var>form</var> is not null and <var>form</var>'s <code id=processing-model-4:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute is in the <a href=#attr-form-autocomplete-off-state id=processing-model-4:attr-form-autocomplete-off-state>off</a> state, then let the element's
- <a href=#autofill-field-name id=processing-model-4:autofill-field-name-6>autofill field name</a> be "<code id=processing-model-4:attr-fe-autocomplete-off-2><a href=#attr-fe-autocomplete-off>off</a></code>".</p>
- <p>Otherwise, let the element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-7>autofill field name</a> be "<code id=processing-model-4:attr-fe-autocomplete-on-2><a href=#attr-fe-autocomplete-on>on</a></code>".</p>
- </ol>
- <hr>
- <p>For the purposes of autofill, a <dfn id="control's-data">control's data</dfn> depends on the kind of control:</p>
- <dl><dt>An <code id=processing-model-4:the-input-element-2><a href=#the-input-element>input</a></code> element with its <code id=processing-model-4:attr-input-type><a href=#attr-input-type>type</a></code> attribute
- in the <a href="#e-mail-state-(type=email)" id="processing-model-4:e-mail-state-(type=email)">E-mail</a> state and with the <code id=processing-model-4:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code> attribute specified<dd>The element's <a href=#concept-fe-values id=processing-model-4:concept-fe-values>value<em>s</em></a>.<dt>Any other <code id=processing-model-4:the-input-element-3><a href=#the-input-element>input</a></code> element<dt>A <code id=processing-model-4:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element<dd>The element's <a href=#concept-fe-value id=processing-model-4:concept-fe-value>value</a>.<dt>A <code id=processing-model-4:the-select-element-2><a href=#the-select-element>select</a></code> element with its <code id=processing-model-4:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>
- attribute specified<dd>The <code id=processing-model-4:the-option-element><a href=#the-option-element>option</a></code> elements in the <code id=processing-model-4:the-select-element-3><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=processing-model-4:concept-select-option-list>list of options</a> that have their <a href=#concept-option-selectedness id=processing-model-4:concept-option-selectedness>selectedness</a> set to true.<dt>Any other <code id=processing-model-4:the-select-element-4><a href=#the-select-element>select</a></code> element<dd>The <code id=processing-model-4:the-option-element-2><a href=#the-option-element>option</a></code> element in the <code id=processing-model-4:the-select-element-5><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=processing-model-4:concept-select-option-list-2>list of options</a> that has its <a href=#concept-option-selectedness id=processing-model-4:concept-option-selectedness-2>selectedness</a> set to true.</dl>
- <hr>
- <p>How to process the <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-7>autofill hint set</a>, <a href=#autofill-scope id=processing-model-4:autofill-scope-4>autofill scope</a>, and
- <a href=#autofill-field-name id=processing-model-4:autofill-field-name-8>autofill field name</a> depends on the mantle that the <code id=processing-model-4:attr-fe-autocomplete-5><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is wearing.</p>
- <dl class=switch><dt>When wearing the <a href=#autofill-expectation-mantle id=processing-model-4:autofill-expectation-mantle>autofill expectation mantle</a>...
- <dd>
- <p>When an element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-9>autofill field name</a> is "<code id=processing-model-4:attr-fe-autocomplete-off-3><a href=#attr-fe-autocomplete-off>off</a></code>", the user agent should not remember the <a href="#control's-data" id="processing-model-4:control's-data">control's
- data</a>, and should not offer past values to the user.</p>
- <p class=note>In addition, when an element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-10>autofill field name</a> is "<code id=processing-model-4:attr-fe-autocomplete-off-4><a href=#attr-fe-autocomplete-off>off</a></code>", <a href=#history-autocomplete>values are reset</a>
- when <a href=#traverse-the-history id=processing-model-4:traverse-the-history>traversing the history</a>.</p>
- <div class=example>
- <p>Banks frequently do not want UAs to prefill login information:</p>
- <pre><p><label>Account: <input type="text" name="ac" autocomplete="off"></label></p>
- <p><label>PIN: <input type="password" name="pin" autocomplete="off"></label></p></pre>
- </div>
- <p>When an element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-11>autofill field name</a> is <em>not</em> "<code id=processing-model-4:attr-fe-autocomplete-off-5><a href=#attr-fe-autocomplete-off>off</a></code>", the user agent may store the <a href="#control's-data" id="processing-model-4:control's-data-2">control's
- data</a>, and may offer previously stored values to the user.</p>
- <div class=example>
- <p>For example, suppose a user visits a page with this control:</p>
- <pre><select name="country">
- <option>Afghanistan
- <option>Albania
- <option>Algeria
- <option>Andorra
- <option>Angola
- <option>Antigua and Barbuda
- <option>Argentina
- <option>Armenia
- <!-- <em>...</em> -->
- <option>Yemen
- <option>Zambia
- <option>Zimbabwe
- </select></pre>
- <p>This might render as follows:</p>
- <p><img src=http://images.whatwg.org/select-country-1.png alt="A drop-down control with a long alphabetical list of countries."></p>
- <p>Suppose that on the first visit to this page, the user selects "Zambia". On the second visit,
- the user agent could duplicate the entry for Zambia at the top of the list, so that the interface
- instead looks like this:</p>
- <p><img src=http://images.whatwg.org/select-country-2.png alt="The same drop-down control with the alphabetical list of countries, but with Zambia as an entry at the top."></p>
- </div>
- <p>When the <a href=#autofill-field-name id=processing-model-4:autofill-field-name-12>autofill field name</a> is "<code id=processing-model-4:attr-fe-autocomplete-on-3><a href=#attr-fe-autocomplete-on>on</a></code>", the user agent should attempt to use heuristics to
- determine the most appropriate values to offer the user, e.g. based on the element's <code id=processing-model-4:attr-fe-name><a href=#attr-fe-name>name</a></code> value, the position of the element in the document's DOM, what
- other fields exist in the form, and so forth.</p>
- <p>When the <a href=#autofill-field-name id=processing-model-4:autofill-field-name-13>autofill field name</a> is one of the names of the <a href=#autofill-field id=processing-model-4:autofill-field>autofill fields</a> described above, the user agent should provide suggestions that
- match the meaning of the field name as given in the table earlier in this section. The
- <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-8>autofill hint set</a> should be used to select amongst multiple possible suggestions.</p>
- <p class=example>For example, if a user once entered one address into fields that used the
- "<code id=processing-model-4:attr-fe-autocomplete-shipping-3><a href=#attr-fe-autocomplete-shipping>shipping</a></code>" keyword, and another address into
- fields that used the "<code id=processing-model-4:attr-fe-autocomplete-billing-3><a href=#attr-fe-autocomplete-billing>billing</a></code>" keyword, then in
- subsequent forms only the first address would be suggested for form controls whose <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-9>autofill
- hint set</a> contains the keyword "<code id=processing-model-4:attr-fe-autocomplete-shipping-4><a href=#attr-fe-autocomplete-shipping>shipping</a></code>". Both addresses might be suggested,
- however, for address-related form controls whose <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-10>autofill hint set</a> does not contain
- either keyword.</p>
- <dt>When wearing the <a href=#autofill-anchor-mantle id=processing-model-4:autofill-anchor-mantle-3>autofill anchor mantle</a>...
- <dd>
- <p>When the <a href=#autofill-field-name id=processing-model-4:autofill-field-name-14>autofill field name</a> is not the empty string, then the user agent must
- act as if the user had specified the <a href="#control's-data" id="processing-model-4:control's-data-3">control's data</a> for the given <a href=#autofill-hint-set id=processing-model-4:autofill-hint-set-11>autofill
- hint set</a>, <a href=#autofill-scope id=processing-model-4:autofill-scope-5>autofill scope</a>, and <a href=#autofill-field-name id=processing-model-4:autofill-field-name-15>autofill field name</a>
- combination.</p>
- </dl>
- <p>When the user agent <dfn id=concept-fe-autofill>autofills form controls</dfn>, elements
- with the same <a href=#form-owner id=processing-model-4:form-owner-2>form owner</a> and the same <a href=#autofill-scope id=processing-model-4:autofill-scope-6>autofill scope</a> must use data
- relating to the same person, address, payment instrument, and contact details. <span id=autofill-country>When a user agent autofills "<code id=processing-model-4:attr-fe-autocomplete-country-2><a href=#attr-fe-autocomplete-country>country</a></code>" and "<code id=processing-model-4:attr-fe-autocomplete-country-name-2><a href=#attr-fe-autocomplete-country-name>country-name</a></code>" fields with the same <a href=#form-owner id=processing-model-4:form-owner-3>form
- owner</a> and <a href=#autofill-scope id=processing-model-4:autofill-scope-7>autofill scope</a>, and the user agent has a value for the <code id=processing-model-4:attr-fe-autocomplete-country-3><a href=#attr-fe-autocomplete-country>country</a></code>" field(s), then the "<code id=processing-model-4:attr-fe-autocomplete-country-name-3><a href=#attr-fe-autocomplete-country-name>country-name</a></code>" field(s) must be filled using a
- human-readable name for the same country.</span> When a user agent fills in multiple fields at
- once, all fields with the same <a href=#autofill-field-name id=processing-model-4:autofill-field-name-16>autofill field name</a>, <a href=#form-owner id=processing-model-4:form-owner-4>form owner</a> and
- <a href=#autofill-scope id=processing-model-4:autofill-scope-8>autofill scope</a> must be filled with the same value.</p>
- <p class=example>Suppose a user agent knows of two phone numbers, +1 555 123 1234 and +1 555 666
- 7777. It would not be conforming for the user agent to fill a field with <code>autocomplete="shipping tel-local-prefix"</code> with the value "123" and another field
- in the same form with <code>autocomplete="shipping tel-local-suffix"</code> with the
- value "7777". The only valid prefilled values given the aforementioned information would be "123"
- and "1234", or "666" and "7777", respectively.</p>
- <p class=example>Similarly, if a form for some reason contained both a "<code id=processing-model-4:attr-fe-autocomplete-cc-exp-3><a href=#attr-fe-autocomplete-cc-exp>cc-exp</a></code>" field and a "<code id=processing-model-4:attr-fe-autocomplete-cc-exp-month-2><a href=#attr-fe-autocomplete-cc-exp-month>cc-exp-month</a></code>" field, and the user agent
- prefilled the form, then the month component of the former would have to match the latter.</p>
- <div class=example>
- <p>This requirement interacts with the <a href=#autofill-anchor-mantle id=processing-model-4:autofill-anchor-mantle-4>autofill anchor mantle</a> also. Consider the
- following markup snippet:</p>
- <pre><form>
- <input type=hidden autocomplete="nickname" value="TreePlate">
- <input type=text autocomplete="nickname">
- </form></pre>
- <p>The only value that a conforming user agent could suggest in the text field is
- "TreePlate", the value given by the hidden <code id=processing-model-4:the-input-element-4><a href=#the-input-element>input</a></code> element.</p>
- </div>
- <p>The "<code>section-*</code>" tokens in the <a href=#autofill-scope id=processing-model-4:autofill-scope-9>autofill scope</a> are opaque;
- user agents must not attempt to derive meaning from the precise values of these tokens.</p>
- <p class=example>For example, it would not be conforming if the user agent decided that it
- should offer the address it knows to be the user's daughter's address for "<code>section-child</code>" and the addresses it knows to be the user's spouses' addresses for
- "<code>section-spouse</code>".</p>
- <p>The autocompletion mechanism must be implemented by the user agent acting as if the user had
- modified the <a href="#control's-data" id="processing-model-4:control's-data-4">control's data</a>, and must be done at a time where the element is <i id=processing-model-4:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> (e.g. just after the element has been inserted into the
- document, or when the user agent <a href=#stop-parsing id=processing-model-4:stop-parsing>stops parsing</a>). User agents
- must only prefill controls using values that the user could have entered.</p>
- <p class=example>For example, if a <code id=processing-model-4:the-select-element-6><a href=#the-select-element>select</a></code> element only has <code id=processing-model-4:the-option-element-3><a href=#the-option-element>option</a></code>
- elements with values "Steve" and "Rebecca", "Jay", and "Bob", and has an <a href=#autofill-field-name id=processing-model-4:autofill-field-name-17>autofill field
- name</a> "<code id=processing-model-4:attr-fe-autocomplete-given-name-2><a href=#attr-fe-autocomplete-given-name>given-name</a></code>", but the user
- agent's only idea for what to prefill the field with is "Evan", then the user agent cannot prefill
- the field. It would not be conforming to somehow set the <code id=processing-model-4:the-select-element-7><a href=#the-select-element>select</a></code> element to the value
- "Evan", since the user could not have done so themselves.</p>
- <p>A user agent prefilling a form control's <a href=#concept-fe-value id=processing-model-4:concept-fe-value-2>value</a> must not
- cause that control to <a href=#suffering-from-a-type-mismatch id=processing-model-4:suffering-from-a-type-mismatch>suffer from a type
- mismatch</a>, <a href=#suffering-from-being-too-long id=processing-model-4:suffering-from-being-too-long>suffer from being too long</a>,
- <a href=#suffering-from-being-too-short id=processing-model-4:suffering-from-being-too-short>suffer from being too short</a>, <a href=#suffering-from-an-underflow id=processing-model-4:suffering-from-an-underflow>suffer from an underflow</a>, <a href=#suffering-from-an-overflow id=processing-model-4:suffering-from-an-overflow>suffer from an overflow</a>, or <a href=#suffering-from-a-step-mismatch id=processing-model-4:suffering-from-a-step-mismatch>suffer from a step mismatch</a>. Except when <a href=#concept-fe-autofill id=processing-model-4:concept-fe-autofill>autofilling</a> for <code id=processing-model-4:dom-form-requestautocomplete><a href=#dom-form-requestautocomplete>requestAutocomplete()</a></code>, a user agent prefilling a form
- control's <a href=#concept-fe-value id=processing-model-4:concept-fe-value-3>value</a> must not cause that control to <a href=#suffering-from-a-pattern-mismatch id=processing-model-4:suffering-from-a-pattern-mismatch>suffer from a pattern mismatch</a> either. Where
- possible given the control's constraints, user agents must use the format given as canonical in
- the aforementioned table. Where it's not possible for the canonical format to be used, user agents
- should use heuristics to attempt to convert values so that they can be used.</p>
- <div class=example>
- <p>For example, if the user agent knows that the user's middle name is "Ines", and attempts to
- prefill a form control that looks like this:</p>
- <pre><input name=middle-initial maxlength=1 autocomplete="additional-name"></pre>
- <p>...then the user agent could convert "Ines" to "I" and prefill it that way.</p>
- </div>
- <div class=example>
- <p>A more elaborate example would be with month values. If the user agent knows that the user's
- birthday is the 27th of July 2012, then it might try to prefill all of the following controls
- with slightly different values, all driven from this information:</p>
- <table><tr><td>
- <pre><input name=b type=month autocomplete="bday"></pre>
- <td>
- 2012-07
- <td>
- The day is dropped since the <a href="#month-state-(type=month)" id="processing-model-4:month-state-(type=month)">Month</a> state only accepts a
- month/year combination.
- <tr><td>
- <pre><select name=c autocomplete="bday">
- <option>Jan
- <option>Feb
- <em>...</em>
- <option>Jul
- <option>Aug
- <em>...</em>
- </select></pre>
- <td>
- July
- <td>
- The user agent picks the month from the listed options, either by noticing there are twelve
- options and picking the 7th, or by recognising that one of the strings (three characters "Jul"
- followed by a newline and a space) is a close match for the name of the month (July) in one of
- the user agent's supported languages, or through some other similar mechanism.
- <tr><td>
- <pre><input name=a type=number min=1 max=12 autocomplete="bday-month"></pre>
- <td>
- 7
- <td>
- User agent converts "July" to a month number in the range 1..12, like the field.
- <tr><td>
- <pre><input name=a type=number min=0 max=11 autocomplete="bday-month"></pre>
- <td>
- 6
- <td>
- User agent converts "July" to a month number in the range 0..11, like the field.
- <tr><td>
- <pre><input name=a type=number min=1 max=11 autocomplete="bday-month"></pre>
- <td>
- <td>
- User agent doesn't fill in the field, since it can't make a good guess as to what the form expects.
- </table>
- </div>
- <p>A user agent may allow the user to override an element's <a href=#autofill-field-name id=processing-model-4:autofill-field-name-18>autofill field name</a>, e.g.
- to change it from "<code id=processing-model-4:attr-fe-autocomplete-off-6><a href=#attr-fe-autocomplete-off>off</a></code>" to "<code id=processing-model-4:attr-fe-autocomplete-on-4><a href=#attr-fe-autocomplete-on>on</a></code>" to allow values to be remembered and prefilled despite
- the page author's objections, or to always "<code id=processing-model-4:attr-fe-autocomplete-off-7><a href=#attr-fe-autocomplete-off>off</a></code>",
- never remembering values. However, user agents should not allow users to trivially override the
- <a href=#autofill-field-name id=processing-model-4:autofill-field-name-19>autofill field name</a> from "<code id=processing-model-4:attr-fe-autocomplete-off-8><a href=#attr-fe-autocomplete-off>off</a></code>" to
- "<code id=processing-model-4:attr-fe-autocomplete-on-5><a href=#attr-fe-autocomplete-on>on</a></code>" or other values, as there are significant
- security implications for the user if all values are always remembered, regardless of the site's
- preferences.</p>
- <p>The <dfn id=dom-fe-autocomplete><code>autocomplete</code></dfn> IDL attribute, on getting,
- must return the element's <a href=#idl-exposed-autofill-value id=processing-model-4:idl-exposed-autofill-value-5>IDL-exposed autofill value</a>, and on setting, must
- <a href=#reflect id=processing-model-4:reflect>reflect</a> the content attribute of the same name.</p>
-
-
- <h6 id=user-interface-for-bulk-autofill>4.10.19.8.3 User interface for bulk autofill</h6>
- <p>When the <dfn id=dom-form-requestautocomplete><code>requestAutocomplete()</code></dfn>
- method on a <code id=user-interface-for-bulk-autofill:the-form-element><a href=#the-form-element>form</a></code> element is invoked, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>form</var> be the element on which the method was invoked.<li>
- <p>If any of the following conditions are met, then <a href=#queue-a-task id=user-interface-for-bulk-autofill:queue-a-task>queue a task</a> to <a href=#fail-the-autofill-request id=user-interface-for-bulk-autofill:fail-the-autofill-request>fail the
- autofill request</a> on <var>form</var> with the reason "<code id=user-interface-for-bulk-autofill:dom-autocompleteerrorreason-disabled><a href=#dom-autocompleteerrorreason-disabled>disabled</a></code>", and abort these steps:</p>
- <ul><li><p>the algorithm is not <a href=#allowed-to-show-a-popup id=user-interface-for-bulk-autofill:allowed-to-show-a-popup>allowed to show a popup</a><li><p><var>form</var>'s <a id=user-interface-for-bulk-autofill:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=user-interface-for-bulk-autofill:fully-active>fully
- active</a><li><p><var>form</var>'s <code id=user-interface-for-bulk-autofill:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code>
- attribute is in the <a href=#attr-form-autocomplete-off-state id=user-interface-for-bulk-autofill:attr-form-autocomplete-off-state>off</a> state<li><p>the user has disabled this feature for this <var>form</var>'s
- <a id=user-interface-for-bulk-autofill:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#origin-2 id=user-interface-for-bulk-autofill:origin-2>origin</a><li><p>the user agent does not support this <var>form</var>'s fields (e.g. the form
- has different fields whose <a href=#autofill-scope id=user-interface-for-bulk-autofill:autofill-scope>autofill scope</a> use different "<code>section-*</code>" tokens)<li><p>the <var>form</var> was obtained via unencrypted channels and the user agent
- does not support autofill in such situations<li><p>another instance of this algorithm is already being run for <var>form</var></ul>
- <p class=note>User agents are encouraged to log the precise cause in a developer console, to
- aid debugging.</p>
- <li><p>Let <var>pending autofills</var> be an initially empty list of <a href=#category-submit id=user-interface-for-bulk-autofill:category-submit>submittable elements</a>, each annotated with a string known as the
- <i>original autocomplete value</i>.<li>
- <p>For each element that matches the following criteria, add the element to <var>pending autofills</var>, with the <i>original autocomplete value</i> annotation being
- the value of the element's <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>
- attribute:</p>
- <ul><li><p>the element's <a href=#form-owner id=user-interface-for-bulk-autofill:form-owner>form owner</a> is <var>form</var><li><p>the element is <i id=user-interface-for-bulk-autofill:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i><li><p>the element is an <code id=user-interface-for-bulk-autofill:the-input-element><a href=#the-input-element>input</a></code> element to which the <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute currently <a href=#concept-input-apply id=user-interface-for-bulk-autofill:concept-input-apply>applies</a>, or, the element is a <code id=user-interface-for-bulk-autofill:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
- element, or, the element is a <code id=user-interface-for-bulk-autofill:the-select-element><a href=#the-select-element>select</a></code> element<li><p>the element's <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is
- wearing the <a href=#autofill-expectation-mantle id=user-interface-for-bulk-autofill:autofill-expectation-mantle>autofill expectation mantle</a><li><p>the element's <a href=#autofill-field-name id=user-interface-for-bulk-autofill:autofill-field-name>autofill field name</a> is neither "<code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>" nor "<code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-on><a href=#attr-fe-autocomplete-on>on</a></code>"</ul>
- <li><p>Return, but continue running these steps asynchronously.<li><p>Provide an interface for the user to efficiently fill in some or all of the fields listed
- in <var>pending autofills</var>. Await the user's input. The user agent may include additional
- (immutable) information, e.g. <a href="#control's-data" id="user-interface-for-bulk-autofill:control's-data">data</a> obtained from elements
- with an <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-4><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute wearing the
- <a href=#autofill-anchor-mantle id=user-interface-for-bulk-autofill:autofill-anchor-mantle>autofill anchor mantle</a>.<li>
- <p><a href=#queue-a-task id=user-interface-for-bulk-autofill:queue-a-task-2>Queue a task</a> to run the following steps:</p>
- <ol><li>
- <p>If any of the following conditions are met, then <a href=#fail-the-autofill-request id=user-interface-for-bulk-autofill:fail-the-autofill-request-2>fail the autofill request</a> on
- <var>form</var> with the reason "<code id=user-interface-for-bulk-autofill:dom-autocompleteerrorreason-disabled-2><a href=#dom-autocompleteerrorreason-disabled>disabled</a></code>", and abort these steps:</p>
- <ul><li><p><var>form</var> is no longer <a href=#in-a-document id=user-interface-for-bulk-autofill:in-a-document>in a <code>Document</code></a><li><p><var>form</var>'s <a id=user-interface-for-bulk-autofill:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is no longer <a href=#fully-active id=user-interface-for-bulk-autofill:fully-active-2>fully
- active</a><li><p><var>form</var>'s <code id=user-interface-for-bulk-autofill:attr-form-autocomplete-2><a href=#attr-form-autocomplete>autocomplete</a></code>
- attribute is now in the <a href=#attr-form-autocomplete-off-state id=user-interface-for-bulk-autofill:attr-form-autocomplete-off-state-2>off</a>
- state</ul>
- <p class=note>Again, user agents are encouraged to log the precise cause in a developer
- console, to aid debugging.</p>
- <li><p>If the user canceled the operation, <a href=#fail-the-autofill-request id=user-interface-for-bulk-autofill:fail-the-autofill-request-3>fail the autofill request</a> on <var>form</var> with the reason "<code id=user-interface-for-bulk-autofill:dom-autocompleteerrorreason-cancel><a href=#dom-autocompleteerrorreason-cancel>cancel</a></code>", and abort these steps.<li>
- <p>For each element in <var>pending autofills</var>, run the following steps:</p>
- <ol><li><p>Let <var>candidate</var> be the element in question.<li><p>Let <var>old autocomplete value</var> be the <i>original autocomplete
- value</i> annotation associated with <var>candidate</var> in <var>pending
- autofills</var>.<li>
- <p>If all of the following conditions are met, then <a href=#concept-fe-autofill id=user-interface-for-bulk-autofill:concept-fe-autofill>autofill</a> <var>candidate</var>:</p>
- <ul><li><p><var>candidate</var>'s <a href=#form-owner id=user-interface-for-bulk-autofill:form-owner-2>form owner</a> is <var>form</var><li><p><var>candidate</var> is still <i id=user-interface-for-bulk-autofill:concept-fe-mutable-2><a href=#concept-fe-mutable>mutable</a></i><li><p><var>candidate</var> is an <code id=user-interface-for-bulk-autofill:the-input-element-2><a href=#the-input-element>input</a></code> element to which the <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-5><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute still <a href=#concept-input-apply id=user-interface-for-bulk-autofill:concept-input-apply-2>applies</a>, or, <var>candidate</var> is a
- <code id=user-interface-for-bulk-autofill:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element, or, <var>candidate</var> is a <code id=user-interface-for-bulk-autofill:the-select-element-2><a href=#the-select-element>select</a></code>
- element<li><p>the element's <code id=user-interface-for-bulk-autofill:attr-fe-autocomplete-6><a href=#attr-fe-autocomplete>autocomplete</a></code> attribute is
- still wearing the <a href=#autofill-expectation-mantle id=user-interface-for-bulk-autofill:autofill-expectation-mantle-2>autofill expectation mantle</a><li><p><var>candidate</var>'s <a href=#autofill-field-name id=user-interface-for-bulk-autofill:autofill-field-name-2>autofill field name</a> is still equal to
- <var>old autocomplete value</var><li><p>the user provided a value to autofill <var>candidate</var></ul>
- </ol>
- <li>
- <p><a href=#statically-validate-the-constraints id=user-interface-for-bulk-autofill:statically-validate-the-constraints>Statically validate the constraints</a> of <var>form</var>. If the
- result was negative, then <a href=#fail-the-autofill-request id=user-interface-for-bulk-autofill:fail-the-autofill-request-4>fail the autofill request</a> on <var>form</var>
- with the reason "<code id=user-interface-for-bulk-autofill:dom-autocompleteerrorreason-invalid><a href=#dom-autocompleteerrorreason-invalid>invalid</a></code>", and abort
- these steps.</p>
- <p class=note><a href=#statically-validate-the-constraints id=user-interface-for-bulk-autofill:statically-validate-the-constraints-2>Statically validating the
- constraints</a> of a <code id=user-interface-for-bulk-autofill:the-form-element-2><a href=#the-form-element>form</a></code> involves firing <code id=user-interface-for-bulk-autofill:event-invalid><a href=#event-invalid>invalid</a></code> events to each control that does not <a href=#concept-fv-valid id=user-interface-for-bulk-autofill:concept-fv-valid>satisfy its contraints</a>.</p>
- <li><p><a href=#fire-a-simple-event id=user-interface-for-bulk-autofill:fire-a-simple-event>Fire a simple event</a> that bubbles named <code id=user-interface-for-bulk-autofill:event-autocomplete><a href=#event-autocomplete>autocomplete</a></code> at <var>form</var>.</ol>
- </ol>
- <p>When the user agent is required to <dfn id=fail-the-autofill-request>fail the autofill request</dfn> on a <code id=user-interface-for-bulk-autofill:the-form-element-3><a href=#the-form-element>form</a></code>
- element <var>target</var> with a reason <var>reason</var>, the user agent must
- dispatch an event that uses the <code id=user-interface-for-bulk-autofill:autocompleteerrorevent><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code> interface, with the event type
- <code>autocompleteerror</code>, which bubbles, is not cancelable, has no default action,
- has its <code id=user-interface-for-bulk-autofill:dom-autocompleteerrorevent-reason><a href=#dom-autocompleteerrorevent-reason>reason</a></code> attribute set to <var>reason</var>, and which is <a href=#concept-events-trusted id=user-interface-for-bulk-autofill:concept-events-trusted>trusted</a>, at <var>target</var>.</p>
- <p>The <a href=#task-source id=user-interface-for-bulk-autofill:task-source>task source</a> for the <a href=#concept-task id=user-interface-for-bulk-autofill:concept-task>tasks</a> mentioned in this
- section is the <a href=#dom-manipulation-task-source id=user-interface-for-bulk-autofill:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
-
- <h6 id=the-autocompleteerrorevent-interface>4.10.19.8.4 The <code id=the-autocompleteerrorevent-interface:autocompleteerrorevent><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code> interface</h6>
- <pre class=idl>enum <dfn id=autocompleteerrorreason>AutocompleteErrorReason</dfn> { "" /* <a href=#dom-autocompleteerrorreason-none id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-none>empty string</a> */, "<a href=#dom-autocompleteerrorreason-cancel id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-cancel>cancel</a>", "<a href=#dom-autocompleteerrorreason-disabled id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-disabled>disabled</a>", "<a href=#dom-autocompleteerrorreason-invalid id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-invalid>invalid</a>" };
- [Constructor(DOMString type, optional <a href=#autocompleteerroreventinit id=the-autocompleteerrorevent-interface:autocompleteerroreventinit>AutocompleteErrorEventInit</a> eventInitDict)]
- interface <dfn id=autocompleteerrorevent>AutocompleteErrorEvent</dfn> : <a href=#event id=the-autocompleteerrorevent-interface:event>Event</a> {
- readonly attribute <a href=#autocompleteerrorreason id=the-autocompleteerrorevent-interface:autocompleteerrorreason>AutocompleteErrorReason</a> <a href=#dom-autocompleteerrorevent-reason id=the-autocompleteerrorevent-interface:dom-autocompleteerrorevent-reason>reason</a>;
- };
- dictionary <dfn id=autocompleteerroreventinit>AutocompleteErrorEventInit</dfn> : <a href=#eventinit id=the-autocompleteerrorevent-interface:eventinit>EventInit</a> {
- <a href=#autocompleteerrorreason id=the-autocompleteerrorevent-interface:autocompleteerrorreason-2>AutocompleteErrorReason</a> reason;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-autocompleteerrorevent-interface:dom-autocompleteerrorevent-reason-2><a href=#dom-autocompleteerrorevent-reason>reason</a></code><dd>
- <p>For the <code id=the-autocompleteerrorevent-interface:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> event, returns the
- general reason for the failure of the <code id=the-autocompleteerrorevent-interface:dom-form-requestautocomplete><a href=#dom-form-requestautocomplete>requestAutocomplete()</a></code> method, from the list
- below.</p>
- </dl>
- <p>The defined reason codes are:
- <dl><dt>"<dfn id=dom-autocompleteerrorreason-none><code></code></dfn>" (the empty string)<dd><p>Reason is unknown.<dt>"<dfn id=dom-autocompleteerrorreason-cancel><code>cancel</code></dfn>"<dd><p>The user canceled the autofill interface.<dt>"<dfn id=dom-autocompleteerrorreason-disabled><code>disabled</code></dfn>"<dd>
- <p>The autofill interface is disabled for this form.</p>
- <p>There are many reasons why this might be the case; the precise reason is not given, to
- protect the user's privacy. Amongst these reasons are such factors as:</p>
- <ul class=brief><li><p>The page being delivered over an unencrypted connection (susceptible to
- man-in-the-middle attacks), when the user agent does not want to risk the user's information
- being provided to an attacker.<li><p>The form having a combination of fields for which the user agent does not have a
- dedicated autofill interface.<li><p>The form's <code id=the-autocompleteerrorevent-interface:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code> attribute being in
- the <a href=#attr-form-autocomplete-off-state id=the-autocompleteerrorevent-interface:attr-form-autocomplete-off-state>off</a> state.<li><p>The user having disabled the feature.</ul>
- <dt>"<dfn id=dom-autocompleteerrorreason-invalid><code>invalid</code></dfn>"<dd><p>The fields have been prefilled, but at least one of the controls in the form does not
- <a href=#concept-fv-valid id=the-autocompleteerrorevent-interface:concept-fv-valid>satisfy its constraints</a>.</dl>
-
- <p>The <dfn id=dom-autocompleteerrorevent-reason><code>reason</code></dfn> attribute must
- return the value it was initialised to. When the object is created, this attribute must be
- initialised to the <a href=#dom-autocompleteerrorreason-none id=the-autocompleteerrorevent-interface:dom-autocompleteerrorreason-none-2>empty string</a>. It
- represents the context information for the event.</p>
-
- <h4 id=textFieldSelection>4.10.20 APIs for the text field selections</h4>
-
- <p>The <code id=textFieldSelection:the-input-element><a href=#the-input-element>input</a></code> and <code id=textFieldSelection:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements define the following members in their
- DOM interfaces for handling their selection:</p>
- <pre class="idl extract"> void <a href=#dom-textarea/input-select id=textFieldSelection:dom-textarea/input-select>select</a>();
- attribute unsigned long <a href=#dom-textarea/input-selectionstart id=textFieldSelection:dom-textarea/input-selectionstart>selectionStart</a>;
- attribute unsigned long <a href=#dom-textarea/input-selectionend id=textFieldSelection:dom-textarea/input-selectionend>selectionEnd</a>;
- attribute DOMString <a href=#dom-textarea/input-selectiondirection id=textFieldSelection:dom-textarea/input-selectiondirection>selectionDirection</a>;
- void <a href=#dom-textarea/input-setrangetext id=textFieldSelection:dom-textarea/input-setrangetext>setRangeText</a>(DOMString replacement);
- void <a href=#dom-textarea/input-setrangetext id=textFieldSelection:dom-textarea/input-setrangetext-2>setRangeText</a>(DOMString replacement, unsigned long start, unsigned long end, optional <a href=#selectionmode id=textFieldSelection:selectionmode>SelectionMode</a> selectionMode = "preserve");
- void <a href=#dom-textarea/input-setselectionrange id=textFieldSelection:dom-textarea/input-setselectionrange>setSelectionRange</a>(unsigned long start, unsigned long end, optional DOMString direction = "preserve");</pre>
-
- <p>The <code id=textFieldSelection:dom-textarea/input-setrangetext-3><a href=#dom-textarea/input-setrangetext>setRangeText</a></code> method uses the following
- enumeration:</p>
- <pre class=idl>enum <dfn id=selectionmode>SelectionMode</dfn> {
- "<a href=#dom-selectionmode-select id=textFieldSelection:dom-selectionmode-select>select</a>",
- "<a href=#dom-selectionmode-start id=textFieldSelection:dom-selectionmode-start>start</a>",
- "<a href=#dom-selectionmode-end id=textFieldSelection:dom-selectionmode-end>end</a>",
- "<a href=#dom-selectionmode-preserve id=textFieldSelection:dom-selectionmode-preserve>preserve</a>", // default
- };</pre>
- <p>These methods and attributes expose and control the selection of <code id=textFieldSelection:the-input-element-2><a href=#the-input-element>input</a></code> and
- <code id=textFieldSelection:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> text fields.</p>
- <dl class=domintro><dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-select-2><a href=#dom-textarea/input-select>select</a></code>()<dd>
- <p>Selects everything in the text field.</p>
- <dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-selectionstart-2><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the offset to the start of the selection.</p>
- <p>Can be set, to change the start of the selection.</p>
- <dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-selectionend-2><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the offset to the end of the selection.</p>
- <p>Can be set, to change the end of the selection.</p>
- <dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-selectiondirection-2><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current direction of the selection.</p>
- <p>Can be set, to change the direction of the selection.</p>
- <p>The possible values are "<code>forward</code>", "<code>backward</code>", and "<code>none</code>".</p>
- <dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-setselectionrange-2><a href=#dom-textarea/input-setselectionrange>setSelectionRange</a></code>(<var>start</var>, <var>end</var> [, <var>direction</var>] )<dd>
- <p>Changes the selection to cover the given substring in the given direction. If the direction
- is omitted, it will be reset to be the platform default (none or forward).</p>
- <dt><var>element</var> . <code id=textFieldSelection:dom-textarea/input-setrangetext-4><a href=#dom-textarea/input-setrangetext>setRangeText</a></code>(<var>replacement</var> [, <var>start</var>, <var>end</var> [, <var>selectionMode</var> ] ] )<dd>
- <p>Replaces a range of text with the new text. If the <var>start</var> and <var>end</var> arguments are not provided, the range is assumed to be the selection.</p>
- <p>The final argument determines how the selection should be set after the text has been
- replaced. The possible values are:</p>
- <dl><dt>"<code id=textFieldSelection:dom-selectionmode-select-2><a href=#dom-selectionmode-select>select</a></code>"<dd>Selects the newly inserted text.<dt>"<code id=textFieldSelection:dom-selectionmode-start-2><a href=#dom-selectionmode-start>start</a></code>"<dd>Moves the selection to just before the inserted text.<dt>"<code id=textFieldSelection:dom-selectionmode-end-2><a href=#dom-selectionmode-end>end</a></code>"<dd>Moves the selection to just after the selected text.<dt>"<code id=textFieldSelection:dom-selectionmode-preserve-2><a href=#dom-selectionmode-preserve>preserve</a></code>"<dd>Attempts to preserve the selection. This is the default.</dl>
- </dl>
-
- <p>For <code id=textFieldSelection:the-input-element-3><a href=#the-input-element>input</a></code> elements, calling these methods while they <a href=#do-not-apply id=textFieldSelection:do-not-apply>don't apply</a>, and getting or setting these attributes while they <a href=#do-not-apply id=textFieldSelection:do-not-apply-2>don't apply</a>, must throw an <code id=textFieldSelection:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, they
- must act as described below.</p>
- <p>For <code id=textFieldSelection:the-input-element-4><a href=#the-input-element>input</a></code> elements, these methods and attributes must operate on the element's
- <a href=#concept-fe-value id=textFieldSelection:concept-fe-value>value</a>. For <code id=textFieldSelection:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> elements, these methods and
- attributes must operate on the element's <a href=#concept-textarea-raw-value id=textFieldSelection:concept-textarea-raw-value>raw
- value</a>.</p>
- <p>Where possible, user interface features for changing the text selection in <code id=textFieldSelection:the-input-element-5><a href=#the-input-element>input</a></code>
- and <code id=textFieldSelection:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> elements must be implemented in terms of the DOM API described in this
- section, so that, e.g., all the same events fire.</p>
- <p>The selections of <code id=textFieldSelection:the-input-element-6><a href=#the-input-element>input</a></code> and <code id=textFieldSelection:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code> elements have a
- <i>direction</i>, which is either <i>forward</i>, <i>backward</i>, or <i>none</i>. This direction
- is set when the user manipulates the selection. The exact meaning of the selection direction
- depends on the platform.</p>
- <p class=note>On Windows, the direction indicates the position of the caret relative to the
- selection: a <i>forward</i> selection has the caret at the end of the selection and a
- <i>backward</i> selection has the caret at the start of the selection. Windows has no <i>none</i>
- direction. On Mac, the direction indicates which end of the selection is affected when the user
- adjusts the size of the selection using the arrow keys with the Shift modifier: the forward
- direction means the end of the selection is modified, and the backwards direction means the start
- of the selection is modified. The none direction is the default on Mac, it indicates that no
- particular direction has yet been selected. The user sets the direction implicitly when first
- adjusting the selection, based on which directional arrow key was used.</p>
- <p>The <dfn id=dom-textarea/input-select><code>select()</code></dfn> method must cause the
- contents of the text field to be fully selected, with the selection direction being none, if the
- platform support selections with the direction <i>none</i>, or otherwise <i>forward</i>. The user
- agent must then <a href=#queue-a-task id=textFieldSelection:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=textFieldSelection:fire-a-simple-event>fire a simple event</a> that bubbles named
- <code id=textFieldSelection:event-select><a href=#event-select>select</a></code> at the element, using the <a href=#user-interaction-task-source id=textFieldSelection:user-interaction-task-source>user interaction task
- source</a> as the task source.</p>
- <p>The <dfn id=dom-textarea/input-selectionstart><code>selectionStart</code></dfn> attribute
- must, on getting, return the offset (in logical order) to the character that immediately follows
- the start of the selection. If there is no selection, then it must return the offset (in logical
- order) to the character that immediately follows the text entry cursor.</p>
- <p>On setting, it must act as if the <code id=textFieldSelection:dom-textarea/input-setselectionrange-3><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
- with the new value as the first argument; the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-3><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute as the second argument,
- unless the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-4><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
- is less than the new value, in which case the second argument must also be the new value; and the
- current value of the <code id=textFieldSelection:dom-textarea/input-selectiondirection-3><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code>
- as the third argument.</p>
- <p>The <dfn id=dom-textarea/input-selectionend><code>selectionEnd</code></dfn> attribute
- must, on getting, return the offset (in logical order) to the character that immediately follows
- the end of the selection. If there is no selection, then it must return the offset (in logical
- order) to the character that immediately follows the text entry cursor.</p>
- <p>On setting, it must act as if the <code id=textFieldSelection:dom-textarea/input-setselectionrange-4><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
- with the current value of the <code id=textFieldSelection:dom-textarea/input-selectionstart-3><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute as the first argument,
- the new value as the second argument, and the current value of the <code id=textFieldSelection:dom-textarea/input-selectiondirection-4><a href=#dom-textarea/input-selectiondirection>selectionDirection</a></code> as the third argument.</p>
- <p>The <dfn id=dom-textarea/input-selectiondirection><code>selectionDirection</code></dfn>
- attribute must, on getting, return the string corresponding to the current selection direction: if
- the direction is <i>forward</i>, "<code>forward</code>"; if the direction is
- <i>backward</i>, "<code>backward</code>"; and otherwise, "<code>none</code>".</p>
- <p>On setting, it must act as if the <code id=textFieldSelection:dom-textarea/input-setselectionrange-5><a href=#dom-textarea/input-setselectionrange>setSelectionRange()</a></code> method had been called,
- with the current value of the <code id=textFieldSelection:dom-textarea/input-selectionstart-4><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute as the first argument,
- the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-5><a href=#dom-textarea/input-selectionend>selectionEnd</a></code>
- attribute as the second argument, and the new value as the third argument.</p>
- <p>The <dfn id=dom-textarea/input-setselectionrange><code>setSelectionRange(<var>start</var>, <var>end</var>, <var>direction</var>)</code></dfn> method
- must set the selection of the text field to the sequence of characters starting with the character
- at the <var>start</var>th position (in logical order) and ending with the character at
- the <span>(<var>end</var>-1)</span>th position. Arguments greater than the
- length of the value of the text field must be treated as pointing at the end of the text field. If
- <var>end</var> is less than or equal to <var>start</var> then the start of the
- selection and the end of the selection must both be placed immediately before the character with
- offset <var>end</var>. In UAs where there is no concept of an empty selection, this must
- set the cursor to be just before the character with offset <var>end</var>. The direction
- of the selection must be set to <i>backward</i> if <var>direction</var> is a
- <a href=#case-sensitive id=textFieldSelection:case-sensitive>case-sensitive</a> match for the string "<code>backward</code>", <i>forward</i>
- if <var>direction</var> is a <a href=#case-sensitive id=textFieldSelection:case-sensitive-2>case-sensitive</a> match for the string "<code>forward</code>" or if the platform does not support selections with the direction
- <i>none</i>, and <i>none</i> otherwise (including if the argument is omitted). The user agent must
- then <a href=#queue-a-task id=textFieldSelection:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=textFieldSelection:fire-a-simple-event-2>fire a simple event</a> that bubbles named <code id=textFieldSelection:event-select-2><a href=#event-select>select</a></code> at the element, using the <a href=#user-interaction-task-source id=textFieldSelection:user-interaction-task-source-2>user interaction task
- source</a> as the task source.</p>
- <p>The <dfn id=dom-textarea/input-setrangetext><code>setRangeText(<var>replacement</var>, <var>start</var>, <var>end</var>, <var>selectMode</var>)</code></dfn> method must run the following steps:</p>
- <ol><li>
- <p>If the method has only one argument, then let <var>start</var> and <var>end</var> have the values of the <code id=textFieldSelection:dom-textarea/input-selectionstart-5><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute and the <code id=textFieldSelection:dom-textarea/input-selectionend-6><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute respectively.</p>
- <p>Otherwise, let <var>start</var>, <var>end</var> have the values of the
- second and third arguments respectively.</p>
- <li><p>If <var>start</var> is greater than <var>end</var>, then throw an
- <code id=textFieldSelection:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If <var>start</var> is greater than the length of the value of the text field,
- then set it to the length of the value of the text field.<li><p>If <var>end</var> is greater than the length of the value of the text field,
- then set it to the length of the value of the text field.<li><p>Let <var>selection start</var> be the current value of the <code id=textFieldSelection:dom-textarea/input-selectionstart-6><a href=#dom-textarea/input-selectionstart>selectionStart</a></code> attribute.<li><p>Let <var>selection end</var> be the current value of the <code id=textFieldSelection:dom-textarea/input-selectionend-7><a href=#dom-textarea/input-selectionend>selectionEnd</a></code> attribute.<li><p>If <var>start</var> is less than <var>end</var>, delete the sequence of
- characters starting with the character at the <var>start</var>th position (in logical
- order) and ending with the character at the <span>(<var>end</var>-1)</span>th
- position.<li><p>Insert the value of the first argument into the text of the value of the text field,
- immediately before the <var>start</var>th character.<li><p>Let <var>new length</var> be the length of the value of the first argument.<li><p>Let <var>new end</var> be the sum of <var>start</var> and <var>new length</var>.<li>
- <p>Run the appropriate set of substeps from the following list:</p>
- <dl class=switch><dt>If the fourth argument's value is "<dfn id=dom-selectionmode-select><code>select</code></dfn>"<dd>
- <p>Let <var>selection start</var> be <var>start</var>.</p>
- <p>Let <var>selection end</var> be <var>new end</var>.</p>
- <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-start><code>start</code></dfn>"<dd>
- <p>Let <var>selection start</var> and <var>selection end</var> be <var>start</var>.</p>
- <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-end><code>end</code></dfn>"<dd>
- <p>Let <var>selection start</var> and <var>selection end</var> be <var>new end</var>.</p>
- <dt>If the fourth argument's value is "<dfn id=dom-selectionmode-preserve><code>preserve</code></dfn>" (the default)<dd>
- <ol><li><p>Let <var>old length</var> be <var>end</var> minus <var>start</var>.</p>
- <li><p>Let <var>delta</var> be <var>new length</var> minus <var>old length</var>.</p>
- <li>
- <p>If <var>selection start</var> is greater than <var>end</var>, then
- increment it by <var>delta</var>. (If <var>delta</var> is negative, i.e.
- the new text is shorter than the old text, then this will <em>decrease</em> the value of
- <var>selection start</var>.)</p>
- <p>Otherwise: if <var>selection start</var> is greater than <var>start</var>, then set it to <var>start</var>. (This snaps the start of the
- selection to the start of the new text if it was in the middle of the text that it
- replaced.)</p>
- <li>
- <p>If <var>selection end</var> is greater than <var>end</var>, then
- increment it by <var>delta</var> in the same way.</p>
- <p>Otherwise: if <var>selection end</var> is greater than <var>start</var>, then set it to <var>new end</var>. (This snaps the end of the
- selection to the end of the new text if it was in the middle of the text that it
- replaced.)</p>
- </ol>
- </dl>
- <li>
- <p>Set the selection of the text field to the sequence of characters starting with the character
- at the <var>selection start</var>th position (in logical order) and ending with the
- character at the <span>(<var>selection end</var>-1)</span>th position. In UAs
- where there is no concept of an empty selection, this must set the cursor to be just before the
- character with offset <var>end</var>. The direction of the selection must be set to
- <i>forward</i> if the platform does not support selections with the direction <i>none</i>, and
- <i>none</i> otherwise.</p>
- <li><p><a href=#queue-a-task id=textFieldSelection:queue-a-task-3>Queue a task</a> to <a href=#fire-a-simple-event id=textFieldSelection:fire-a-simple-event-3>fire a simple event</a> that bubbles named <code id=textFieldSelection:event-select-3><a href=#event-select>select</a></code> at the element, using the <a href=#user-interaction-task-source id=textFieldSelection:user-interaction-task-source-3>user interaction task
- source</a> as the task source.</ol>
- <p>All elements to which this API <a href=#concept-input-apply id=textFieldSelection:concept-input-apply>applies</a> have either a
- selection or a text entry cursor position at all times (even for elements that are not <a href=#being-rendered id=textFieldSelection:being-rendered>being
- rendered</a>). User agents should follow platform conventions to determine their initial
- state.</p>
-
- <p>Characters with no visible rendering, such as U+200D ZERO WIDTH JOINER, still count as
- characters. Thus, for instance, the selection can include just an invisible character, and the
- text insertion cursor can be placed to one side or another of such a character.</p>
- <div class=example>
- <p>To obtain the currently selected text, the following JavaScript suffices:</p>
- <pre>var selectionText = control.value.substring(control.selectionStart, control.selectionEnd);</pre>
- <p>...where <var>control</var> is the <code id=textFieldSelection:the-input-element-7><a href=#the-input-element>input</a></code> or <code id=textFieldSelection:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code>
- element.</p>
- </div>
- <div class=example>
- <p>To add some text at the start of a text control, while maintaining the text selection, the
- three attributes must be preserved:</p>
- <pre>var oldStart = control.selectionStart;
- var oldEnd = control.selectionEnd;
- var oldDirection = control.selectionDirection;
- var prefix = "http://";
- control.value = prefix + control.value;
- control.setSelectionRange(oldStart + prefix.length, oldEnd + prefix.length, oldDirection);</pre>
- <p>...where <var>control</var> is the <code id=textFieldSelection:the-input-element-8><a href=#the-input-element>input</a></code> or <code id=textFieldSelection:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code>
- element.</p>
- </div>
- <h4 id=constraints>4.10.21 Constraints</h4>
- <h5 id=definitions>4.10.21.1 Definitions</h5>
-
- <p>A <a href=#category-submit id=definitions:category-submit>submittable element</a> is a <dfn id=candidate-for-constraint-validation>candidate for constraint
- validation</dfn> except when a condition has <dfn id=barred-from-constraint-validation>barred
- the element from constraint validation</dfn>. (For example, an element is <a href=#barred-from-constraint-validation id=definitions:barred-from-constraint-validation>barred from
- constraint validation</a> if it is an <code id=definitions:the-object-element><a href=#the-object-element>object</a></code> element.)</p>
- <p>An element can have a <dfn id=custom-validity-error-message>custom validity error message</dfn> defined. Initially, an element
- must have its <a href=#custom-validity-error-message id=definitions:custom-validity-error-message>custom validity error message</a> set to the empty string. When its value
- is not the empty string, the element is <a href=#suffering-from-a-custom-error id=definitions:suffering-from-a-custom-error>suffering from a custom error</a>. It can be set
- using the <code id=definitions:dom-cva-setcustomvalidity><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method. The user
- agent should use the <a href=#custom-validity-error-message id=definitions:custom-validity-error-message-2>custom validity error message</a> when alerting the user to the
- problem with the control.</p>
- <p>An element can be constrained in various ways. The following is the list of <dfn id=validity-states>validity
- states</dfn> that a form control can be in, making the control invalid for the purposes of
- constraint validation. (The definitions below are non-normative; other parts of this specification
- define more precisely when each state applies or does not.)</p>
- <dl><dt> <dfn id=suffering-from-being-missing>Suffering from being missing</dfn> <dd> <p>When a control has no <a href=#concept-fe-value id=definitions:concept-fe-value>value</a> but has a <code>required</code> attribute (<code id=definitions:the-input-element><a href=#the-input-element>input</a></code> <code id=definitions:attr-input-required><a href=#attr-input-required>required</a></code>, <code id=definitions:the-textarea-element><a href=#the-textarea-element>textarea</a></code> <code id=definitions:attr-textarea-required><a href=#attr-textarea-required>required</a></code>); or, in the case of an element in a <i id=definitions:radio-button-group><a href=#radio-button-group>radio button group</a></i>, any of the other elements in the group has a
- <code id=definitions:attr-input-required-2><a href=#attr-input-required>required</a></code> attribute; or, for <code id=definitions:the-select-element><a href=#the-select-element>select</a></code>
- elements, none of the <code id=definitions:the-option-element><a href=#the-option-element>option</a></code> elements have their <a href=#concept-option-selectedness id=definitions:concept-option-selectedness>selectedness</a> set (<code id=definitions:the-select-element-2><a href=#the-select-element>select</a></code> <code id=definitions:attr-select-required><a href=#attr-select-required>required</a></code>).<dt> <dfn id=suffering-from-a-type-mismatch>Suffering from a type mismatch</dfn> <dd> <p>When a control that allows arbitrary user input has a <a href=#concept-fe-value id=definitions:concept-fe-value-2>value</a> that is not in the correct syntax (<a href="#e-mail-state-(type=email)" id="definitions:e-mail-state-(type=email)">E-mail</a>, <a href="#url-state-(type=url)" id="definitions:url-state-(type=url)">URL</a>).
- <dt> <dfn id=suffering-from-a-pattern-mismatch>Suffering from a pattern mismatch</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-3>value</a> that doesn't satisfy the
- <code id=definitions:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> attribute.<dt> <dfn id=suffering-from-being-too-long>Suffering from being too long</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-4>value</a> that is too long for the
- <a href=#attr-fe-maxlength id=definitions:attr-fe-maxlength>form control <code>maxlength</code> attribute</a>
- (<code id=definitions:the-input-element-2><a href=#the-input-element>input</a></code> <code id=definitions:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>, <code id=definitions:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>
- <code id=definitions:attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>). <dt> <dfn id=suffering-from-being-too-short>Suffering from being too short</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-5>value</a> that is too short for the
- <a href=#attr-fe-minlength id=definitions:attr-fe-minlength>form control <code>minlength</code> attribute</a>
- (<code id=definitions:the-input-element-3><a href=#the-input-element>input</a></code> <code id=definitions:attr-input-minlength><a href=#attr-input-minlength>minlength</a></code>, <code id=definitions:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code>
- <code id=definitions:attr-textarea-minlength><a href=#attr-textarea-minlength>minlength</a></code>). <dt> <dfn id=suffering-from-an-underflow>Suffering from an underflow</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-6>value</a> that is too low for the
- <code id=definitions:attr-input-min><a href=#attr-input-min>min</a></code> attribute.<dt> <dfn id=suffering-from-an-overflow>Suffering from an overflow</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-7>value</a> that is too high for the
- <code id=definitions:attr-input-max><a href=#attr-input-max>max</a></code> attribute.<dt> <dfn id=suffering-from-a-step-mismatch>Suffering from a step mismatch</dfn> <dd> <p>When a control has a <a href=#concept-fe-value id=definitions:concept-fe-value-8>value</a> that doesn't fit the
- rules given by the <code id=definitions:attr-input-step><a href=#attr-input-step>step</a></code> attribute.<dt> <dfn id=suffering-from-bad-input>Suffering from bad input</dfn> <dd> <p>When a control has incomplete input and the user agent does not think the user ought to
- be able to submit the form in its current state.<dt> <dfn id=suffering-from-a-custom-error>Suffering from a custom error</dfn> <dd> <p>When a control's <a href=#custom-validity-error-message id=definitions:custom-validity-error-message-3>custom validity error message</a> (as set by the element's
- <code id=definitions:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method) is not the empty
- string.</p> </dl>
- <p class=note>An element can still suffer from these states even when the element is <a href=#concept-fe-disabled id=definitions:concept-fe-disabled>disabled</a>; thus these states can be represented in the DOM even
- if validating the form during submission wouldn't indicate a problem to the user.</p>
- <p>An element <dfn id=concept-fv-valid>satisfies its constraints</dfn> if it is not suffering
- from any of the above <a href=#validity-states id=definitions:validity-states>validity states</a>.</p>
-
-
- <h5 id=constraint-validation>4.10.21.2 Constraint validation</h5>
- <p>When the user agent is required to <dfn id=statically-validate-the-constraints>statically validate the constraints</dfn> of
- <code id=constraint-validation:the-form-element><a href=#the-form-element>form</a></code> element <var>form</var>, it must run the following steps, which return
- either a <i>positive</i> result (all the controls in the form are valid) or a <i>negative</i>
- result (there are invalid controls) along with a (possibly empty) list of elements that are
- invalid and for which no script has claimed responsibility:</p>
- <ol><li><p>Let <var>controls</var> be a list of all the <a href=#category-submit id=constraint-validation:category-submit>submittable elements</a> whose <a href=#form-owner id=constraint-validation:form-owner>form owner</a> is <var>form</var>, in <a href=#tree-order id=constraint-validation:tree-order>tree order</a>.<li><p>Let <var>invalid controls</var> be an initially empty list of elements.<li>
- <p>For each element <var>field</var> in <var>controls</var>, in <a href=#tree-order id=constraint-validation:tree-order-2>tree
- order</a>, run the following substeps:</p>
- <ol><li><p>If <var>field</var> is not a <a href=#candidate-for-constraint-validation id=constraint-validation:candidate-for-constraint-validation>candidate for constraint validation</a>,
- then move on to the next element.<li><p>Otherwise, if <var>field</var> <a href=#concept-fv-valid id=constraint-validation:concept-fv-valid>satisfies its
- constraints</a>, then move on to the next element.<li><p>Otherwise, add <var>field</var> to <var>invalid
- controls</var>.</ol>
- <li><p>If <var>invalid controls</var> is empty, then return a <i>positive</i> result and
- abort these steps.<li><p>Let <var>unhandled invalid controls</var> be an initially empty list of
- elements.<li>
- <p>For each element <var>field</var> in <var>invalid controls</var>, if any,
- in <a href=#tree-order id=constraint-validation:tree-order-3>tree order</a>, run the following substeps:</p>
- <ol><li><p><a href=#fire-a-simple-event id=constraint-validation:fire-a-simple-event>Fire a simple event</a> named <code id=constraint-validation:event-invalid><a href=#event-invalid>invalid</a></code> that
- is cancelable at <var>field</var>.<li><p>If the event was not canceled, then add <var>field</var> to <var>unhandled invalid controls</var>.</ol>
- <li><p>Return a <i>negative</i> result with the list of elements in the <var>unhandled
- invalid controls</var> list.</ol>
- <p>If a user agent is to <dfn id=interactively-validate-the-constraints>interactively validate the constraints</dfn> of <code id=constraint-validation:the-form-element-2><a href=#the-form-element>form</a></code>
- element <var>form</var>, then the user agent must run the following steps:</p>
- <ol><li><p><a href=#statically-validate-the-constraints id=constraint-validation:statically-validate-the-constraints>Statically validate the constraints</a> of <var>form</var>, and let
- <var>unhandled invalid controls</var> be the list of elements returned if the result was
- <i>negative</i>.<li><p>If the result was <i>positive</i>, then return that result and abort these steps.<li><p>Report the problems with the constraints of at least one of the elements given in
- <var>unhandled invalid controls</var> to the user. User agents may focus one of those elements in
- the process, by running the <a href=#focusing-steps id=constraint-validation:focusing-steps>focusing steps</a> for that element, and may change the
- scrolling position of the document, or perform some other action that brings the element to the
- user's attention. User agents may report more than one constraint violation. User agents may
- coalesce related constraint violation reports if appropriate (e.g. if multiple radio buttons in a
- <a href=#radio-button-group id=constraint-validation:radio-button-group>group</a> are marked as required, only one error need be
- reported). If one of the controls is not <a href=#being-rendered id=constraint-validation:being-rendered>being rendered</a> (e.g. it has the <code id=constraint-validation:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute set) then user agents may report a script
- error.<li><p>Return a <i>negative</i> result.</ol>
-
- <h5 id=the-constraint-validation-api>4.10.21.3 The <dfn>constraint validation API</dfn></h5>
- <dl class=domintro><dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-willvalidate><a href=#dom-cva-willvalidate>willValidate</a></code><dd>
- <p>Returns true if the element will be validated when the form is submitted; false
- otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-setcustomvalidity><a href=#dom-cva-setcustomvalidity>setCustomValidity</a></code>(<var>message</var>)<dd>
- <p>Sets a custom error, so that the element would fail to validate. The given message is the
- message to be shown to the user when reporting the problem to the user.</p>
- <p>If the argument is the empty string, clears the custom error.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-valuemissing><a href=#dom-validitystate-valuemissing>valueMissing</a></code><dd>
- <p>Returns true if the element has no value but is a required field; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-2><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-typemismatch><a href=#dom-validitystate-typemismatch>typeMismatch</a></code><dd>
- <p>Returns true if the element's value is not in the correct syntax; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-3><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-patternmismatch><a href=#dom-validitystate-patternmismatch>patternMismatch</a></code><dd>
- <p>Returns true if the element's value doesn't match the provided pattern; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-4><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-toolong><a href=#dom-validitystate-toolong>tooLong</a></code><dd>
- <p>Returns true if the element's value is longer than the provided maximum length; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-5><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-tooshort><a href=#dom-validitystate-tooshort>tooShort</a></code><dd>
- <p>Returns true if the element's value, if it is not the empty string, is shorter than the
- provided minimum length; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-6><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-rangeunderflow><a href=#dom-validitystate-rangeunderflow>rangeUnderflow</a></code><dd>
- <p>Returns true if the element's value is lower than the provided minimum; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-7><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-rangeoverflow><a href=#dom-validitystate-rangeoverflow>rangeOverflow</a></code><dd>
- <p>Returns true if the element's value is higher than the provided maximum; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-8><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-stepmismatch><a href=#dom-validitystate-stepmismatch>stepMismatch</a></code><dd>
- <p>Returns true if the element's value doesn't fit the rules given by the <code id=the-constraint-validation-api:attr-input-step><a href=#attr-input-step>step</a></code> attribute; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-9><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-badinput><a href=#dom-validitystate-badinput>badInput</a></code><dd>
- <p>Returns true if the user has provided input in the user interface that the user agent is
- unable to convert to a value; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-10><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-customerror><a href=#dom-validitystate-customerror>customError</a></code><dd>
- <p>Returns true if the element has a custom error; false otherwise.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validity-11><a href=#dom-cva-validity>validity</a></code> . <code id=the-constraint-validation-api:dom-validitystate-valid><a href=#dom-validitystate-valid>valid</a></code><dd>
- <p>Returns true if the element's value has no validity problems; false otherwise.</p>
- <dt><var>valid</var> = <var>element</var> . <code id=the-constraint-validation-api:dom-cva-checkvalidity><a href=#dom-cva-checkvalidity>checkValidity</a></code>()<dd>
- <p>Returns true if the element's value has no validity problems; false otherwise. Fires an <code id=the-constraint-validation-api:event-invalid><a href=#event-invalid>invalid</a></code> event at the element in the latter case.</p>
- <dt><var>valid</var> = <var>element</var> . <code id=the-constraint-validation-api:dom-cva-reportvalidity><a href=#dom-cva-reportvalidity>reportValidity</a></code>()<dd>
- <p>Returns true if the element's value has no validity problems; otherwise, returns false, fires
- an <code id=the-constraint-validation-api:event-invalid-2><a href=#event-invalid>invalid</a></code> event at the element, and (if the event isn't
- canceled) reports the problem to the user.</p>
- <dt><var>element</var> . <code id=the-constraint-validation-api:dom-cva-validationmessage><a href=#dom-cva-validationmessage>validationMessage</a></code><dd>
- <p>Returns the error message that would be shown to the user if the element was to be checked
- for validity.</p>
- </dl>
-
- <p>The <dfn id=dom-cva-willvalidate><code>willValidate</code></dfn> attribute must return
- true if an element is a <a href=#candidate-for-constraint-validation id=the-constraint-validation-api:candidate-for-constraint-validation>candidate for constraint validation</a>, and false otherwise
- (i.e. false if any conditions are <a href=#barred-from-constraint-validation id=the-constraint-validation-api:barred-from-constraint-validation>barring it from
- constraint validation</a>).</p>
- <p>The <dfn id=dom-cva-setcustomvalidity><code>setCustomValidity(<var>message</var>)</code></dfn>, when invoked, must set the <a href=#custom-validity-error-message id=the-constraint-validation-api:custom-validity-error-message>custom validity error
- message</a> to the value of the given <var>message</var> argument.</p>
-
- <div class=example>
- <p>In the following example, a script checks the value of a form control each time it is edited,
- and whenever it is not a valid value, uses the <code id=the-constraint-validation-api:dom-cva-setcustomvalidity-2><a href=#dom-cva-setcustomvalidity>setCustomValidity()</a></code> method to set an appropriate
- message.</p>
- <pre><label>Feeling: <input name=f type="text" oninput="check(this)"></label>
- <script>
- function check(input) {
- if (input.value == "good" ||
- input.value == "fine" ||
- input.value == "tired") {
- input.setCustomValidity('"' + input.value + '" is not a feeling.');
- } else {
- // input is fine -- reset the error message
- input.setCustomValidity('');
- }
- }
- </script></pre>
- </div>
-
- <p>The <dfn id=dom-cva-validity><code>validity</code></dfn> attribute must return a
- <code id=the-constraint-validation-api:validitystate><a href=#validitystate>ValidityState</a></code> object that represents the <a href=#validity-states id=the-constraint-validation-api:validity-states>validity states</a> of the element.
- This object is <a href=#live id=the-constraint-validation-api:live>live</a>, and the same object must be returned each time the element's
- <code id=the-constraint-validation-api:dom-cva-validity-12><a href=#dom-cva-validity>validity</a></code> attribute is retrieved.</p>
- <pre class=idl>interface <dfn id=validitystate>ValidityState</dfn> {
- readonly attribute boolean <a href=#dom-validitystate-valuemissing id=the-constraint-validation-api:dom-validitystate-valuemissing-2>valueMissing</a>;
- readonly attribute boolean <a href=#dom-validitystate-typemismatch id=the-constraint-validation-api:dom-validitystate-typemismatch-2>typeMismatch</a>;
- readonly attribute boolean <a href=#dom-validitystate-patternmismatch id=the-constraint-validation-api:dom-validitystate-patternmismatch-2>patternMismatch</a>;
- readonly attribute boolean <a href=#dom-validitystate-toolong id=the-constraint-validation-api:dom-validitystate-toolong-2>tooLong</a>;
- readonly attribute boolean <a href=#dom-validitystate-tooshort id=the-constraint-validation-api:dom-validitystate-tooshort-2>tooShort</a>;
- readonly attribute boolean <a href=#dom-validitystate-rangeunderflow id=the-constraint-validation-api:dom-validitystate-rangeunderflow-2>rangeUnderflow</a>;
- readonly attribute boolean <a href=#dom-validitystate-rangeoverflow id=the-constraint-validation-api:dom-validitystate-rangeoverflow-2>rangeOverflow</a>;
- readonly attribute boolean <a href=#dom-validitystate-stepmismatch id=the-constraint-validation-api:dom-validitystate-stepmismatch-2>stepMismatch</a>;
- readonly attribute boolean <a href=#dom-validitystate-badinput id=the-constraint-validation-api:dom-validitystate-badinput-2>badInput</a>;
- readonly attribute boolean <a href=#dom-validitystate-customerror id=the-constraint-validation-api:dom-validitystate-customerror-2>customError</a>;
- readonly attribute boolean <a href=#dom-validitystate-valid id=the-constraint-validation-api:dom-validitystate-valid-2>valid</a>;
- };</pre>
- <p>A <code id=the-constraint-validation-api:validitystate-2><a href=#validitystate>ValidityState</a></code> object has the following attributes. On getting, they must return
- true if the corresponding condition given in the following list is true, and false otherwise.</p>
- <dl><dt><dfn id=dom-validitystate-valuemissing><code>valueMissing</code></dfn><dd> <p>The control is <a href=#suffering-from-being-missing id=the-constraint-validation-api:suffering-from-being-missing>suffering from being missing</a>.</p> <dt><dfn id=dom-validitystate-typemismatch><code>typeMismatch</code></dfn><dd> <p>The control is <a href=#suffering-from-a-type-mismatch id=the-constraint-validation-api:suffering-from-a-type-mismatch>suffering from a type mismatch</a>.</p> <dt><dfn id=dom-validitystate-patternmismatch><code>patternMismatch</code></dfn><dd> <p>The control is <a href=#suffering-from-a-pattern-mismatch id=the-constraint-validation-api:suffering-from-a-pattern-mismatch>suffering from a pattern mismatch</a>.</p> <dt><dfn id=dom-validitystate-toolong><code>tooLong</code></dfn><dd> <p>The control is <a href=#suffering-from-being-too-long id=the-constraint-validation-api:suffering-from-being-too-long>suffering from being too long</a>.</p> <dt><dfn id=dom-validitystate-tooshort><code>tooShort</code></dfn><dd> <p>The control is <a href=#suffering-from-being-too-short id=the-constraint-validation-api:suffering-from-being-too-short>suffering from being too short</a>.</p> <dt><dfn id=dom-validitystate-rangeunderflow><code>rangeUnderflow</code></dfn><dd> <p>The control is <a href=#suffering-from-an-underflow id=the-constraint-validation-api:suffering-from-an-underflow>suffering from an underflow</a>.</p> <dt><dfn id=dom-validitystate-rangeoverflow><code>rangeOverflow</code></dfn><dd> <p>The control is <a href=#suffering-from-an-overflow id=the-constraint-validation-api:suffering-from-an-overflow>suffering from an overflow</a>.</p> <dt><dfn id=dom-validitystate-stepmismatch><code>stepMismatch</code></dfn><dd> <p>The control is <a href=#suffering-from-a-step-mismatch id=the-constraint-validation-api:suffering-from-a-step-mismatch>suffering from a step mismatch</a>.</p> <dt><dfn id=dom-validitystate-badinput><code>badInput</code></dfn><dd> <p>The control is <a href=#suffering-from-bad-input id=the-constraint-validation-api:suffering-from-bad-input>suffering from bad input</a>.</p> <dt><dfn id=dom-validitystate-customerror><code>customError</code></dfn><dd> <p>The control is <a href=#suffering-from-a-custom-error id=the-constraint-validation-api:suffering-from-a-custom-error>suffering from a custom error</a>.</p> <dt><dfn id=dom-validitystate-valid><code>valid</code></dfn><dd> <p>None of the other conditions are true.</p> </dl>
- <p>When the <dfn id=dom-cva-checkvalidity><code>checkValidity()</code></dfn> method is
- invoked, if the element is a <a href=#candidate-for-constraint-validation id=the-constraint-validation-api:candidate-for-constraint-validation-2>candidate for constraint validation</a> and does not <a href=#concept-fv-valid id=the-constraint-validation-api:concept-fv-valid>satisfy its constraints</a>, the user agent must <a href=#fire-a-simple-event id=the-constraint-validation-api:fire-a-simple-event>fire a simple
- event</a> named <code id=the-constraint-validation-api:event-invalid-3><a href=#event-invalid>invalid</a></code> that is cancelable (but in this case
- has no default action) at the element and return false. Otherwise, it must only return true
- without doing anything else.</p>
- <p>When the <dfn id=dom-cva-reportvalidity><code>reportValidity()</code></dfn> method is
- invoked, if the element is a <a href=#candidate-for-constraint-validation id=the-constraint-validation-api:candidate-for-constraint-validation-3>candidate for constraint validation</a> and does not <a href=#concept-fv-valid id=the-constraint-validation-api:concept-fv-valid-2>satisfy its constraints</a>, the user agent must: <a href=#fire-a-simple-event id=the-constraint-validation-api:fire-a-simple-event-2>fire a simple
- event</a> named <code id=the-constraint-validation-api:event-invalid-4><a href=#event-invalid>invalid</a></code> that is cancelable at the element,
- and if that event is not canceled, report the problems with the constraints of that element to the
- user; then, return false. Otherwise, it must only return true without doing anything else. When
- reporting the problem with the constraints to the user, the user agent may run the <a href=#focusing-steps id=the-constraint-validation-api:focusing-steps>focusing
- steps</a> for that element, and may change the scrolling position of the document, or perform
- some other action that brings the element to the user's attention. User agents may report more
- than one constraint violation, if the element suffers from multiple problems at once. If the
- element is not <a href=#being-rendered id=the-constraint-validation-api:being-rendered>being rendered</a>, then the user agent may, instead of notifying the
- user, report a script error.</p>
- <p>The <dfn id=dom-cva-validationmessage><code>validationMessage</code></dfn> attribute must
- return the empty string if the element is not a <a href=#candidate-for-constraint-validation id=the-constraint-validation-api:candidate-for-constraint-validation-4>candidate for constraint validation</a>
- or if it is one but it <a href=#concept-fv-valid id=the-constraint-validation-api:concept-fv-valid-3>satisfies its constraints</a>; otherwise,
- it must return a suitably localised message that the user agent would show the user if this were
- the only form control with a validity constraint problem. If the user agent would not actually
- show a textual message in such a situation (e.g. it would show a graphical cue instead), then the
- attribute must return a suitably localised message that expresses (one or more of) the validity
- constraint(s) that the control does not satisfy. If the element is a <a href=#candidate-for-constraint-validation id=the-constraint-validation-api:candidate-for-constraint-validation-5>candidate for
- constraint validation</a> and is <a href=#suffering-from-a-custom-error id=the-constraint-validation-api:suffering-from-a-custom-error-2>suffering from a custom error</a>, then the
- <a href=#custom-validity-error-message id=the-constraint-validation-api:custom-validity-error-message-2>custom validity error message</a> should be present in the return value.</p>
-
- <h5 id=security-forms>4.10.21.4 Security</h5>
- <p id=security-0>Servers should not rely on client-side validation. Client-side validation can
- be intentionally bypassed by hostile users, and unintentionally bypassed by users of older user
- agents or automated tools that do not implement these features. The constraint validation features
- are only intended to improve the user experience, not to provide any kind of security
- mechanism.</p>
- <h4 id=form-submission-2>4.10.22 <dfn>Form submission</dfn></h4>
-
- <h5 id=introduction-6>4.10.22.1 Introduction</h5>
-
- <p><i>This section is non-normative.</i></p>
- <p>When a form is submitted, the data in the form is converted into the structure specified by the
- <a href=#concept-fs-enctype id=introduction-6:concept-fs-enctype>enctype</a>, and then sent to the destination specified by the
- <a href=#concept-fs-action id=introduction-6:concept-fs-action>action</a> using the given <a href=#concept-fs-method id=introduction-6:concept-fs-method>method</a>.</p>
- <p>For example, take the following form:</p>
- <pre><form action="/find.cgi" method=get>
- <input type=text name=t>
- <input type=search name=q>
- <input type=submit>
- </form></pre>
- <p>If the user types in "cats" in the first field and "fur" in the second, and then hits the
- submit button, then the user agent will load <code>/find.cgi?t=cats&q=fur</code>.</p>
- <p>On the other hand, consider this form:</p>
- <pre><form action="/find.cgi" method=post enctype="multipart/form-data">
- <input type=text name=t>
- <input type=search name=q>
- <input type=submit>
- </form></pre>
- <p>Given the same user input, the result on submission is quite different: the user agent instead
- does an HTTP POST to the given URL, with as the entity body something like the following text:</p>
- <pre>------kYFrd4jNJEgCervE
- Content-Disposition: form-data; name="t"
- cats
- ------kYFrd4jNJEgCervE
- Content-Disposition: form-data; name="q"
- fur
- ------kYFrd4jNJEgCervE--</pre>
-
- <h5 id=implicit-submission>4.10.22.2 Implicit submission</h5>
- <p>A <code id=implicit-submission:the-form-element><a href=#the-form-element>form</a></code> element's <dfn id=default-button>default button</dfn> is the first <a href=#concept-submit-button id=implicit-submission:concept-submit-button>submit button</a> in <a href=#tree-order id=implicit-submission:tree-order>tree order</a> whose <a href=#form-owner id=implicit-submission:form-owner>form
- owner</a> is that <code id=implicit-submission:the-form-element-2><a href=#the-form-element>form</a></code> element.</p>
- <p>If the user agent supports letting the user submit a form implicitly (for example, on some
- platforms hitting the "enter" key while a text field is <a href=#focused id=implicit-submission:focused>focused</a> implicitly submits the form), then
- doing so for a form whose <a href=#default-button id=implicit-submission:default-button>default button</a> has a defined <a href=#activation-behavior id=implicit-submission:activation-behavior>activation
- behavior</a> must cause the user agent to <a href=#run-synthetic-click-activation-steps id=implicit-submission:run-synthetic-click-activation-steps>run synthetic click activation steps</a> on
- that <a href=#default-button id=implicit-submission:default-button-2>default button</a>.</p>
- <p class=note>Consequently, if the <a href=#default-button id=implicit-submission:default-button-3>default button</a> is <a href=#concept-fe-disabled id=implicit-submission:concept-fe-disabled>disabled</a>, the form is not submitted when such an implicit
- submission mechanism is used. (A button has no <a href=#activation-behavior id=implicit-submission:activation-behavior-2>activation behavior</a> when
- disabled.)</p>
- <p class=note>There are pages on the Web that are only usable if there is a way to implicitly
- submit forms, so user agents are strongly encouraged to support this.</p>
- <p>If the form has
- no <a href=#concept-submit-button id=implicit-submission:concept-submit-button-2>submit button</a>, then the implicit submission
- mechanism must do nothing if the form has more than one <i>field that blocks implicit
- submission</i>, and must <a href=#concept-form-submit id=implicit-submission:concept-form-submit>submit</a> the <code id=implicit-submission:the-form-element-3><a href=#the-form-element>form</a></code>
- element from the <code id=implicit-submission:the-form-element-4><a href=#the-form-element>form</a></code> element itself otherwise.</p>
- <p>For the purpose of the previous paragraph, an element is a <i>field that blocks implicit
- submission</i> of a <code id=implicit-submission:the-form-element-5><a href=#the-form-element>form</a></code> element if it is an <code id=implicit-submission:the-input-element><a href=#the-input-element>input</a></code> element whose
- <a href=#form-owner id=implicit-submission:form-owner-2>form owner</a> is that <code id=implicit-submission:the-form-element-6><a href=#the-form-element>form</a></code> element and whose <code id=implicit-submission:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in one of the following states:
- <a href="#text-(type=text)-state-and-search-state-(type=search)" id="implicit-submission:text-(type=text)-state-and-search-state-(type=search)">Text</a>,
- <a href="#text-(type=text)-state-and-search-state-(type=search)" id="implicit-submission:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>,
- <a href="#url-state-(type=url)" id="implicit-submission:url-state-(type=url)">URL</a>,
- <a href="#telephone-state-(type=tel)" id="implicit-submission:telephone-state-(type=tel)">Telephone</a>,
- <a href="#e-mail-state-(type=email)" id="implicit-submission:e-mail-state-(type=email)">E-mail</a>,
- <a href="#password-state-(type=password)" id="implicit-submission:password-state-(type=password)">Password</a>,
- <a href="#date-and-time-state-(type=datetime)" id="implicit-submission:date-and-time-state-(type=datetime)">Date and Time</a>,
- <a href="#date-state-(type=date)" id="implicit-submission:date-state-(type=date)">Date</a>,
- <a href="#month-state-(type=month)" id="implicit-submission:month-state-(type=month)">Month</a>,
- <a href="#week-state-(type=week)" id="implicit-submission:week-state-(type=week)">Week</a>,
- <a href="#time-state-(type=time)" id="implicit-submission:time-state-(type=time)">Time</a>,
- <a href="#local-date-and-time-state-(type=datetime-local)" id="implicit-submission:local-date-and-time-state-(type=datetime-local)">Local Date and Time</a>,
- <a href="#number-state-(type=number)" id="implicit-submission:number-state-(type=number)">Number</a>
- </p>
-
-
- <h5 id=form-submission-algorithm>4.10.22.3 Form submission algorithm</h5>
- <p>When a <code id=form-submission-algorithm:the-form-element><a href=#the-form-element>form</a></code> element <var>form</var> is <dfn id=concept-form-submit>submitted</dfn> from an element <var>submitter</var>
- (typically a button), optionally with a <var>submitted from <code id=form-submission-algorithm:dom-form-submit><a href=#dom-form-submit>submit()</a></code> method</var> flag set, the user agent must run the
- following steps:</p>
- <ol><li><p>Let <var>form document</var> be the <var>form</var>'s
- <a id=form-submission-algorithm:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.<li id=sandboxSubmitBlocked><p>If <var>form document</var> has no associated
- <a href=#browsing-context id=form-submission-algorithm:browsing-context>browsing context</a> or its <a href=#active-sandboxing-flag-set id=form-submission-algorithm:active-sandboxing-flag-set>active sandboxing flag set</a> has its
- <a href=#sandboxed-forms-browsing-context-flag id=form-submission-algorithm:sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a> set, then abort these steps without doing
- anything.<li><p>Let <var>form browsing context</var> be the <a href=#browsing-context id=form-submission-algorithm:browsing-context-2>browsing context</a> of <var>form document</var>.<li><p>If the <var>submitted from <code id=form-submission-algorithm:dom-form-submit-2><a href=#dom-form-submit>submit()</a></code>
- method</var> flag is not set, and the <var>submitter</var> element's <a href=#concept-fs-novalidate id=form-submission-algorithm:concept-fs-novalidate>no-validate state</a> is false, then <a href=#interactively-validate-the-constraints id=form-submission-algorithm:interactively-validate-the-constraints>interactively
- validate the constraints</a> of <var>form</var> and examine the result: if the result
- is negative (the constraint validation concluded that there were invalid fields and probably
- informed the user of this) then <a href=#fire-a-simple-event id=form-submission-algorithm:fire-a-simple-event>fire a simple event</a> named <code id=form-submission-algorithm:event-invalid><a href=#event-invalid>invalid</a></code> at the <var>form</var> element and then abort these
- steps.<li><p>If the <var>submitted from <code id=form-submission-algorithm:dom-form-submit-3><a href=#dom-form-submit>submit()</a></code>
- method</var> flag is not set, then <a href=#fire-a-simple-event id=form-submission-algorithm:fire-a-simple-event-2>fire a simple event</a> that bubbles and is
- cancelable named <code id=form-submission-algorithm:event-submit><a href=#event-submit>submit</a></code>, at <var>form</var>. If the
- event's default action is prevented (i.e. if the event is canceled) then abort these steps.
- Otherwise, continue (effectively the default action is to perform the submission).<li><p>Let <var>form data set</var> be the result of <a href=#constructing-the-form-data-set id=form-submission-algorithm:constructing-the-form-data-set>constructing the form data
- set</a> for <var>form</var> in the context of <var>submitter</var>.<li><p>Let <var>action</var> be the <var>submitter</var> element's <a href=#concept-fs-action id=form-submission-algorithm:concept-fs-action>action</a>.<li>
- <p>If <var>action</var> is the empty string, let <var>action</var> be
- <a id="form-submission-algorithm:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> of the <var>form document</var>.</p>
-
- <li><p><a href=#resolve-a-url id=form-submission-algorithm:resolve-a-url>Resolve</a> the <a href=#url id=form-submission-algorithm:url>URL</a> <var>action</var>, relative to the <var>submitter</var> element. If this fails,
- abort these steps.<li><p>Let <var>action</var> be the resulting <a href=#absolute-url id=form-submission-algorithm:absolute-url>absolute URL</a>.<li><p>Let <var>action components</var> be the resulting <a href=#parsed-url id=form-submission-algorithm:parsed-url>parsed
- URL</a>.<li><p>Let <var>scheme</var> be the <a href=#concept-url-scheme id=form-submission-algorithm:concept-url-scheme>scheme</a> of
- the resulting <a href=#parsed-url id=form-submission-algorithm:parsed-url-2>parsed URL</a>.<li><p>Let <var>enctype</var> be the <var>submitter</var> element's <a href=#concept-fs-enctype id=form-submission-algorithm:concept-fs-enctype>enctype</a>.<li><p>Let <var>method</var> be the <var>submitter</var> element's <a href=#concept-fs-method id=form-submission-algorithm:concept-fs-method>method</a>.<li><p>Let <var>target</var> be the <var>submitter</var> element's <a href=#concept-fs-target id=form-submission-algorithm:concept-fs-target>target</a>.<li><p>If the user indicated a specific <a href=#browsing-context id=form-submission-algorithm:browsing-context-3>browsing context</a> to use when submitting the
- form, then let <var>target browsing context</var> be that <a href=#browsing-context id=form-submission-algorithm:browsing-context-4>browsing context</a>.
- Otherwise, apply <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=form-submission-algorithm:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing context
- name</a> using <var>target</var> as the name and <var>form browsing
- context</var> as the context in which the algorithm is executed, and let <var>target
- browsing context</var> be the resulting <a href=#browsing-context id=form-submission-algorithm:browsing-context-5>browsing context</a>.<li><p>If <var>target browsing context</var> was created in the previous step, or,
- alternatively, if the <var>form document</var> has not yet <a href=#completely-loaded id=form-submission-algorithm:completely-loaded>completely
- loaded</a> and the <var>submitted from <code id=form-submission-algorithm:dom-form-submit-4><a href=#dom-form-submit>submit()</a></code>
- method</var> flag is set, then let <var>replace</var> be true. Otherwise, let it be
- false.<li>
- <p>If the value of <var>method</var> is <a href=#attr-fs-method-dialog id=form-submission-algorithm:attr-fs-method-dialog>dialog</a> then jump to the <a href=#submit-dialog id=form-submission-algorithm:submit-dialog>submit
- dialog</a> steps.</p>
- <p>Otherwise, select the appropriate row in the table below based on the value of <var>scheme</var> as given by the first cell of each row. Then, select the appropriate cell
- on that row based on the value of <var>method</var> as given in the first cell of each
- column. Then, jump to the steps named in that cell and defined below the table.</p>
- <table><thead><tr><td>
- <th> <a href=#attr-fs-method-get id=form-submission-algorithm:attr-fs-method-get>GET</a>
- <th> <a href=#attr-fs-method-post id=form-submission-algorithm:attr-fs-method-post>POST</a>
- <tbody><tr><th> <code>http</code>
- <td> <a href=#submit-mutate-action id=form-submission-algorithm:submit-mutate-action>Mutate action URL</a>
- <td> <a href=#submit-body id=form-submission-algorithm:submit-body>Submit as entity body</a>
- <tr><th> <code>https</code>
- <td> <a href=#submit-mutate-action id=form-submission-algorithm:submit-mutate-action-2>Mutate action URL</a>
- <td> <a href=#submit-body id=form-submission-algorithm:submit-body-2>Submit as entity body</a>
- <tr><th> <code>ftp</code>
- <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action>Get action URL</a>
- <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-2>Get action URL</a>
- <tr><th> <code>javascript</code>
- <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-3>Get action URL</a>
- <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-4>Get action URL</a>
- <tr><th> <code>data</code>
- <td> <a href=#submit-get-action id=form-submission-algorithm:submit-get-action-5>Get action URL</a>
- <td> <a href=#submit-data-post id=form-submission-algorithm:submit-data-post>Post to data:</a>
- <tr><th> <code>mailto</code>
- <td> <a href=#submit-mailto-headers id=form-submission-algorithm:submit-mailto-headers>Mail with headers</a>
- <td> <a href=#submit-mailto-body id=form-submission-algorithm:submit-mailto-body>Mail as body</a>
- </table>
- <p>If <var>scheme</var> is not one of those listed in this table, then the behavior is
- not defined by this specification. User agents should, in the absence of another specification
- defining this, act in a manner analogous to that defined in this specification for similar
- schemes.</p>
- <p>Each <code id=form-submission-algorithm:the-form-element-2><a href=#the-form-element>form</a></code> element has a <dfn id=planned-navigation>planned navigation</dfn>, which is either null or a
- <a href=#concept-task id=form-submission-algorithm:concept-task>task</a>; when the <code id=form-submission-algorithm:the-form-element-3><a href=#the-form-element>form</a></code> is first created, its
- <a href=#planned-navigation id=form-submission-algorithm:planned-navigation>planned navigation</a> must be set to null. In the behaviours described below, when the
- user agent is required to <dfn id=plan-to-navigate>plan to navigate</dfn> to a particular resource <var>destination</var>, it must run the following steps:</p>
- <ol><li><p>If the <code id=form-submission-algorithm:the-form-element-4><a href=#the-form-element>form</a></code> has a non-null <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-2>planned navigation</a>, remove it from
- its <a href=#task-queue id=form-submission-algorithm:task-queue>task queue</a>.<li>
- <p>Let the <code id=form-submission-algorithm:the-form-element-5><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-3>planned navigation</a> be a new <a href=#concept-task id=form-submission-algorithm:concept-task-2>task</a> that consists of running the following steps:</p>
- <ol><li><p>Let the <code id=form-submission-algorithm:the-form-element-6><a href=#the-form-element>form</a></code>'s <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-4>planned navigation</a> be null.<li><p><a href=#navigate id=form-submission-algorithm:navigate>Navigate</a> <var>target browsing context</var> to
- the particular resource <var>destination</var>. If <var>replace</var> is
- true, then <var>target browsing context</var> must be navigated with
- <a href=#replacement-enabled id=form-submission-algorithm:replacement-enabled>replacement enabled</a>.</p>
- </ol>
- <p>For the purposes of this task, <var>target browsing context</var> and <var>replace</var> are the variables that were set up when the overall form submission
- algorithm was run, with their values as they stood when this <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-5>planned navigation</a>
- was <a href=#queue-a-task id=form-submission-algorithm:queue-a-task>queued</a>.</p>
- <li>
- <p><a href=#queue-a-task id=form-submission-algorithm:queue-a-task-2>Queue the task</a> that is the <code id=form-submission-algorithm:the-form-element-7><a href=#the-form-element>form</a></code>'s new
- <a href=#planned-navigation id=form-submission-algorithm:planned-navigation-6>planned navigation</a>.</p>
- <p>The <a href=#task-source id=form-submission-algorithm:task-source>task source</a> for this task is the <a href=#dom-manipulation-task-source id=form-submission-algorithm:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- </ol>
- <p>The behaviors are as follows:</p>
- <dl><dt><dfn id=submit-mutate-action>Mutate action URL</dfn>
- <dd>
- <p>Let <var>query</var> be the result of encoding the <var>form data
- set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm id=form-submission-algorithm:application/x-www-form-urlencoded-encoding-algorithm><code>application/x-www-form-urlencoded</code> encoding
- algorithm</a>, interpreted as a US-ASCII string.</p>
-
- <p>Set <var>parsed action</var>'s <a href=#concept-url-query id=form-submission-algorithm:concept-url-query>query</a>
- component to <var>query</var>.</p>
- <p>Let <var>destination</var> be a new <a href=#url id=form-submission-algorithm:url-2>URL</a> formed by applying the
- <a href=#concept-url-serialiser id=form-submission-algorithm:concept-url-serialiser>URL serialiser</a> algorithm to <var>parsed action</var>.</p>
- <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate>Plan to navigate</a> to <var>destination</var>.</p>
- <dt><dfn id=submit-body>Submit as entity body</dfn>
- <dd>
- <p>Let <var>entity body</var> be the result of encoding the <var>form data
- set</var> using the <a href=#appropriate-form-encoding-algorithm id=form-submission-algorithm:appropriate-form-encoding-algorithm>appropriate form encoding algorithm</a>.</p>
- <p>Let <var>MIME type</var> be determined as follows:</p>
- <dl><dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code><dd>Let <var>MIME type</var> be "<code id=form-submission-algorithm:application/x-www-form-urlencoded><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code>".<dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code><dd>Let <var>MIME type</var> be the concatenation of the string "<code>multipart/form-data;</code>", a U+0020 SPACE character, the string "<code>boundary=</code>", and the <a href=#multipart/form-data-boundary-string id=form-submission-algorithm:multipart/form-data-boundary-string><code>multipart/form-data</code> boundary
- string</a> generated by the <a href=#multipart/form-data-encoding-algorithm id=form-submission-algorithm:multipart/form-data-encoding-algorithm><code>multipart/form-data</code> encoding
- algorithm</a>.<dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code><dd>Let <var>MIME type</var> be "<code>text/plain</code>".</dl>
-
- <p>Otherwise, <a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-2>plan to navigate</a> to <var>action</var> using the HTTP
- method given by <var>method</var> and with <var>entity body</var> as the
- entity body, of type <var>MIME type</var>.</p>
- <dt><dfn id=submit-get-action>Get action URL</dfn>
- <dd>
- <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-3>Plan to navigate</a> to <var>action</var>.</p>
- <p class=note>The <var>form data set</var> is discarded.</p>
- <dt><dfn id=submit-data-post>Post to data:</dfn>
- <dd>
- <p>Let <var>data</var> be the result of encoding the <var>form data
- set</var> using the <a href=#appropriate-form-encoding-algorithm id=form-submission-algorithm:appropriate-form-encoding-algorithm-2>appropriate form encoding algorithm</a>.</p>
- <p>If <var>action</var> contains the string "<code>%%%%</code>" (four U+0025
- PERCENT SIGN characters), then <a href=#percent-encode id=form-submission-algorithm:percent-encode>percent encode</a> all bytes in <var>data</var> that, if interpreted as US-ASCII, are not characters in the URL
- <a href=#default-encode-set id=form-submission-algorithm:default-encode-set>default encode set</a>, and then, treating the result as a US-ASCII string,
- <a href=#utf-8-percent-encode id=form-submission-algorithm:utf-8-percent-encode>UTF-8 percent encode</a> all the U+0025 PERCENT SIGN characters in the resulting
- string and replace the first occurrence of "<code>%%%%</code>" in <var>action</var> with the resulting doubly-escaped string. <a href=#refsURL>[URL]</a></p>
- <p>Otherwise, if <var>action</var> contains the string "<code>%%</code>"
- (two U+0025 PERCENT SIGN characters in a row, but not four), then <a href=#utf-8-percent-encode id=form-submission-algorithm:utf-8-percent-encode-2>UTF-8 percent
- encode</a> all characters in <var>data</var> that, if interpreted as US-ASCII, are
- not characters in the URL <a href=#default-encode-set id=form-submission-algorithm:default-encode-set-2>default encode set</a>, and then, treating the result as a
- US-ASCII string, replace the first occurrence of "<code>%%</code>" in <var>action</var> with the resulting escaped string. <a href=#refsURL>[URL]</a></p>
- <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-4>Plan to navigate</a> to the potentially modified <var>action</var> (which
- will be a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=form-submission-algorithm:data-protocol data-x-internal=data-protocol><code>data:</code> URL</a>).</p>
- <dt><dfn id=submit-mailto-headers>Mail with headers</dfn>
- <dd>
- <p>Let <var>headers</var> be the resulting encoding the <var>form data
- set</var> using the <a href=#application/x-www-form-urlencoded-encoding-algorithm id=form-submission-algorithm:application/x-www-form-urlencoded-encoding-algorithm-2><code>application/x-www-form-urlencoded</code> encoding
- algorithm</a>, interpreted as a US-ASCII string.</p>
- <p>Replace occurrences of U+002B PLUS SIGN characters (+) in <var>headers</var> with
- the string "<code>%20</code>".</p>
- <p>Let <var>destination</var> consist of all the characters from the first character
- in <var>action</var> to the character immediately before the first U+003F QUESTION
- MARK character (?), if any, or the end of the string if there are none.</p>
- <p>Append a single U+003F QUESTION MARK character (?) to <var>destination</var>.</p>
- <p>Append <var>headers</var> to <var>destination</var>.</p>
- <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-5>Plan to navigate</a> to <var>destination</var>.</p>
- <dt><dfn id=submit-mailto-body>Mail as body</dfn>
- <dd>
- <p>Let <var>body</var> be the resulting of encoding the <var>form data
- set</var> using the <a href=#appropriate-form-encoding-algorithm id=form-submission-algorithm:appropriate-form-encoding-algorithm-3>appropriate form encoding algorithm</a> and then <a href=#percent-encode id=form-submission-algorithm:percent-encode-2>percent encoding</a> all the bytes in the resulting byte string
- that, when interpreted as US-ASCII, are not characters in the URL <a href=#default-encode-set id=form-submission-algorithm:default-encode-set-3>default encode
- set</a>. <a href=#refsURL>[URL]</a></p>
- <p>Let <var>destination</var> have the same value as <var>action</var>.</p>
- <p>If <var>destination</var> does not contain a U+003F QUESTION MARK character (?),
- append a single U+003F QUESTION MARK character (?) to <var>destination</var>.
- Otherwise, append a single U+0026 AMPERSAND character (&).</p>
- <p>Append the string "<code>body=</code>" to <var>destination</var>.</p>
- <p>Append <var>body</var>, interpreted as a US-ASCII string, to <var>destination</var>.</p>
- <p><a href=#plan-to-navigate id=form-submission-algorithm:plan-to-navigate-6>Plan to navigate</a> to <var>destination</var>.</p>
- <dt><dfn id=submit-dialog>Submit dialog</dfn>
- <dd>
- <p>Let <var>subject</var> be the nearest ancestor <code id=form-submission-algorithm:the-dialog-element><a href=#the-dialog-element>dialog</a></code> element of <var>form</var>, if any.</p>
- <p>If there isn't one, or if it does not have an <code id=form-submission-algorithm:attr-dialog-open><a href=#attr-dialog-open>open</a></code>
- attribute, do nothing. Otherwise, proceed as follows:</p>
- <p>If <var>submitter</var> is an <code id=form-submission-algorithm:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=form-submission-algorithm:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="form-submission-algorithm:image-button-state-(type=image)">Image Button</a> state, then let <var>result</var>
- be the string formed by concatenating the <a href=#concept-input-type-image-coordinate id=form-submission-algorithm:concept-input-type-image-coordinate>selected coordinate</a>'s <var>x</var>-component, expressed as a base-ten number using <a href=#ascii-digits id=form-submission-algorithm:ascii-digits>ASCII digits</a>, a
- U+002C COMMA character (,), and the <a href=#concept-input-type-image-coordinate id=form-submission-algorithm:concept-input-type-image-coordinate-2>selected
- coordinate</a>'s <var>y</var>-component, expressed in the same way as the <var>x</var>-component.</p>
- <p>Otherwise, if <var>submitter</var> has a <a href=#concept-fe-value id=form-submission-algorithm:concept-fe-value>value</a>, then let <var>result</var> be that <a href=#concept-fe-value id=form-submission-algorithm:concept-fe-value-2>value</a>.</p>
- <p>Otherwise, there is no <var>result</var>.</p>
- <p>Then, <a href=#close-the-dialog id=form-submission-algorithm:close-the-dialog>close the dialog</a> <var>subject</var>. If there is a <var>result</var>, let that be the return value.</p>
- </dl>
- <p>The <dfn id=appropriate-form-encoding-algorithm>appropriate form encoding algorithm</dfn> is
- determined as follows:</p>
- <dl><dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-urlencoded-2><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code><dd>Use the <a href=#application/x-www-form-urlencoded-encoding-algorithm id=form-submission-algorithm:application/x-www-form-urlencoded-encoding-algorithm-3><code>application/x-www-form-urlencoded</code> encoding
- algorithm</a>.<dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-formdata-2><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code><dd>Use the <a href=#multipart/form-data-encoding-algorithm id=form-submission-algorithm:multipart/form-data-encoding-algorithm-2><code>multipart/form-data</code> encoding algorithm</a>.<dt>If <var>enctype</var> is <code id=form-submission-algorithm:attr-fs-enctype-text-2><a href=#attr-fs-enctype-text>text/plain</a></code><dd>Use the <a href=#text/plain-encoding-algorithm id=form-submission-algorithm:text/plain-encoding-algorithm><code>text/plain</code> encoding algorithm</a>.</dl>
- </ol>
- <h5 id=constructing-form-data-set>4.10.22.4 Constructing the form data set</h5>
- <p>The algorithm to <dfn id=constructing-the-form-data-set>construct the form data set</dfn>
- for a form <var>form</var> optionally in the context of a submitter <var>submitter</var> is as follows. If not specified otherwise, <var>submitter</var>
- is null.</p>
- <ol><li><p>Let <var>controls</var> be a list of all the <a href=#category-submit id=constructing-form-data-set:category-submit>submittable elements</a> whose <a href=#form-owner id=constructing-form-data-set:form-owner>form owner</a> is <var>form</var>, in <a href=#tree-order id=constructing-form-data-set:tree-order>tree order</a>.<li><p>Let the <var>form data set</var> be a list of name-value-type tuples, initially
- empty.<li>
- <p><i>Loop</i>: For each element <var>field</var> in <var>controls</var>, in
- <a href=#tree-order id=constructing-form-data-set:tree-order-2>tree order</a>, run the following substeps:</p>
- <ol><li>
- <p>If any of the following conditions are met, then skip these substeps for this element:</p>
- <ul><li>The <var>field</var> element has a <code id=constructing-form-data-set:the-datalist-element><a href=#the-datalist-element>datalist</a></code> element ancestor.<li>The <var>field</var> element is <a href=#concept-fe-disabled id=constructing-form-data-set:concept-fe-disabled>disabled</a>.<li>The <var>field</var> element is a <a href=#concept-button id=constructing-form-data-set:concept-button>button</a> but
- it is not <var>submitter</var>.<li>The <var>field</var> element is an <code id=constructing-form-data-set:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=constructing-form-data-set:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" id="constructing-form-data-set:checkbox-state-(type=checkbox)">Checkbox</a> state and whose <a href=#concept-fe-checked id=constructing-form-data-set:concept-fe-checked>checkedness</a> is false.<li>The <var>field</var> element is an <code id=constructing-form-data-set:the-input-element-2><a href=#the-input-element>input</a></code> element whose <code id=constructing-form-data-set:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="constructing-form-data-set:radio-button-state-(type=radio)">Radio Button</a> state and whose <a href=#concept-fe-checked id=constructing-form-data-set:concept-fe-checked-2>checkedness</a> is false.<li>The <var>field</var> element is not an <code id=constructing-form-data-set:the-input-element-3><a href=#the-input-element>input</a></code> element whose <code id=constructing-form-data-set:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="constructing-form-data-set:image-button-state-(type=image)">Image Button</a> state, and either the <var>field</var> element does not have a <code id=constructing-form-data-set:attr-fe-name><a href=#attr-fe-name>name</a></code> attribute
- specified, or its <code id=constructing-form-data-set:attr-fe-name-2><a href=#attr-fe-name>name</a></code> attribute's value is the empty
- string.<li>The <var>field</var> element is an <code id=constructing-form-data-set:the-object-element><a href=#the-object-element>object</a></code> element that is not using
- a <a href=#plugin id=constructing-form-data-set:plugin>plugin</a>.</ul>
- <p>Otherwise, process <var>field</var> as follows:</p>
- <li><p>Let <var>type</var> be the value of the <code>type</code> IDL
- attribute of <var>field</var>.<li>
- <p>If the <var>field</var> element is an <code id=constructing-form-data-set:the-input-element-4><a href=#the-input-element>input</a></code> element whose <code id=constructing-form-data-set:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="constructing-form-data-set:image-button-state-(type=image)-2">Image Button</a> state, then run these further nested
- substeps:</p>
- <ol><li><p>If the <var>field</var> element has a <code id=constructing-form-data-set:attr-fe-name-3><a href=#attr-fe-name>name</a></code>
- attribute specified and its value is not the empty string, let <var>name</var> be
- that value followed by a single U+002E FULL STOP character (.). Otherwise, let <var>name</var> be the empty string.<li><p>Let <var>name<sub>x</sub></var> be the string consisting of the
- concatenation of <var>name</var> and a single U+0078 LATIN SMALL LETTER X character
- (x).<li><p>Let <var>name<sub>y</sub></var> be the string consisting of the
- concatenation of <var>name</var> and a single U+0079 LATIN SMALL LETTER Y character
- (y).<li><p>The <var>field</var> element is <var>submitter</var>, and before
- this algorithm was invoked the user <a href=#concept-input-type-image-coordinate id=constructing-form-data-set:concept-input-type-image-coordinate>indicated a coordinate</a>. Let <var>x</var> be the <var>x</var>-component of the coordinate selected by the
- user, and let <var>y</var> be the <var>y</var>-component of the coordinate
- selected by the user.<li><p>Append an entry to the <var>form data set</var> with the name <var>name<sub>x</sub></var>, the value <var>x</var>, and the type <var>type</var>.<li><p>Append an entry to the <var>form data set</var> with the name <var>name<sub>y</sub></var> and the value <var>y</var>, and the type
- <var>type</var>.<li><p>Skip the remaining substeps for this element: if there are any more elements in <var>controls</var>, return to the top of the <i>loop</i> step, otherwise, jump to the
- <i>end</i> step below.</ol>
- <li><p>Let <var>name</var> be the value of the <var>field</var> element's
- <code id=constructing-form-data-set:attr-fe-name-4><a href=#attr-fe-name>name</a></code> attribute.<li><p>If the <var>field</var> element is a <code id=constructing-form-data-set:the-select-element><a href=#the-select-element>select</a></code> element, then for each
- <code id=constructing-form-data-set:the-option-element><a href=#the-option-element>option</a></code> element in the <code id=constructing-form-data-set:the-select-element-2><a href=#the-select-element>select</a></code> element's <a href=#concept-select-option-list id=constructing-form-data-set:concept-select-option-list>list of options</a> whose <a href=#concept-option-selectedness id=constructing-form-data-set:concept-option-selectedness>selectedness</a> is true and that is not <a href=#concept-option-disabled id=constructing-form-data-set:concept-option-disabled>disabled</a>, append an entry to the <var>form data
- set</var> with the <var>name</var> as the name, the <a href=#concept-option-value id=constructing-form-data-set:concept-option-value>value</a> of the <code id=constructing-form-data-set:the-option-element-2><a href=#the-option-element>option</a></code> element as the value, and
- <var>type</var> as the type.<li>
- <p>Otherwise, if the <var>field</var> element is an <code id=constructing-form-data-set:the-input-element-5><a href=#the-input-element>input</a></code> element whose
- <code id=constructing-form-data-set:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" id="constructing-form-data-set:checkbox-state-(type=checkbox)-2">Checkbox</a> state or the <a href="#radio-button-state-(type=radio)" id="constructing-form-data-set:radio-button-state-(type=radio)-2">Radio Button</a> state, then run these further nested
- substeps:</p>
- <ol><li><p>If the <var>field</var> element has a <code id=constructing-form-data-set:attr-input-value><a href=#attr-input-value>value</a></code> attribute specified, then let <var>value</var>
- be the value of that attribute; otherwise, let <var>value</var> be the string "<code>on</code>".<li><p>Append an entry to the <var>form data set</var> with <var>name</var>
- as the name, <var>value</var> as the value, and <var>type</var> as the
- type.</ol>
- <li><p>Otherwise, if the <var>field</var> element is an <code id=constructing-form-data-set:the-input-element-6><a href=#the-input-element>input</a></code> element
- whose <code id=constructing-form-data-set:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute is in the <a href="#file-upload-state-(type=file)" id="constructing-form-data-set:file-upload-state-(type=file)">File Upload</a> state, then for each file <a href=#concept-input-type-file-selected id=constructing-form-data-set:concept-input-type-file-selected>selected</a> in the <code id=constructing-form-data-set:the-input-element-7><a href=#the-input-element>input</a></code> element,
- append an entry to the <var>form data set</var> with the <var>name</var> as
- the name, the file (consisting of the name, the type, and the body) as the value, and <var>type</var> as the type. If there are no <a href=#concept-input-type-file-selected id=constructing-form-data-set:concept-input-type-file-selected-2>selected files</a>, then append an entry to the
- <var>form data set</var> with the <var>name</var> as the name, the empty
- string as the value, and <code id=constructing-form-data-set:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code> as the type.<li><p>Otherwise, if the <var>field</var> element is an <code id=constructing-form-data-set:the-object-element-2><a href=#the-object-element>object</a></code> element:
- try to obtain a form submission value from the <a href=#plugin id=constructing-form-data-set:plugin-2>plugin</a>, and if that is successful,
- append an entry to the <var>form data set</var> with <var>name</var> as the
- name, the returned form submission value as the value, and the string "<code>object</code>" as the type.<li><p>Otherwise, append an entry to the <var>form data set</var> with <var>name</var> as the name, the <a href=#concept-fe-value id=constructing-form-data-set:concept-fe-value>value</a> of the <var>field</var> element as the value, and <var>type</var> as the type.<li>
- <p>If the element has a <code id=constructing-form-data-set:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code> attribute, and that
- attribute's value is not the empty string, then run these substeps:</p>
- <ol><li><p>Let <var>dirname</var> be the value of the element's <code id=constructing-form-data-set:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code> attribute.<li><p>Let <var>dir</var> be the string "<code>ltr</code>" if <a href=#the-directionality id=constructing-form-data-set:the-directionality>the
- directionality</a> of the element is '<a href=#concept-ltr id=constructing-form-data-set:concept-ltr>ltr</a>', and "<code>rtl</code>" otherwise (i.e. when <a href=#the-directionality id=constructing-form-data-set:the-directionality-2>the directionality</a> of the element is
- '<a href=#concept-rtl id=constructing-form-data-set:concept-rtl>rtl</a>').<li><p>Append an entry to the <var>form data set</var> with <var>dirname</var> as the name, <var>dir</var> as the value, and the string
- "<code>direction</code>" as the type.</ol>
- <p class=note>An element can only have a <code id=constructing-form-data-set:attr-fe-dirname-3><a href=#attr-fe-dirname>dirname</a></code>
- attribute if it is a <code id=constructing-form-data-set:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element or an <code id=constructing-form-data-set:the-input-element-8><a href=#the-input-element>input</a></code> element whose
- <code id=constructing-form-data-set:attr-input-type-7><a href=#attr-input-type>type</a></code> attribute is in either the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="constructing-form-data-set:text-(type=text)-state-and-search-state-(type=search)">Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="constructing-form-data-set:text-(type=text)-state-and-search-state-(type=search)-2">Search</a> state.</p>
- </ol>
- <li>
- <p><i>End</i>: For the name of each entry in the <var>form data set</var>, and for the
- value of each entry in the <var>form data set</var> whose type is not "<code>file</code>" or "<code>textarea</code>", replace every occurrence of a U+000D
- CARRIAGE RETURN (CR) character not followed by a U+000A LINE FEED (LF) character, and every
- occurrence of a U+000A LINE FEED (LF) character not preceded by a U+000D CARRIAGE RETURN (CR)
- character, by a two-character string consisting of a U+000D CARRIAGE RETURN U+000A LINE FEED
- (CRLF) character pair.</p>
- <p class=note>In the case of the <a href=#concept-fe-value id=constructing-form-data-set:concept-fe-value-2>value</a> of
- <code id=constructing-form-data-set:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements, this newline normalization is already performed during the
- conversion of the control's <a href=#concept-textarea-raw-value id=constructing-form-data-set:concept-textarea-raw-value>raw value</a> into the
- control's <a href=#concept-fe-value id=constructing-form-data-set:concept-fe-value-3>value</a> (which also performs any necessary line
- wrapping). In the case of <code id=constructing-form-data-set:the-input-element-9><a href=#the-input-element>input</a></code> elements <code id=constructing-form-data-set:attr-input-type-8><a href=#attr-input-type>type</a></code>
- attributes in the <a href="#file-upload-state-(type=file)" id="constructing-form-data-set:file-upload-state-(type=file)-2">File Upload</a> state, the value is not
- normalized.</p>
- <li><p>Return the <var>form data set</var>.</ol>
-
-
- <h5 id=selecting-a-form-submission-encoding>4.10.22.5 Selecting a form submission encoding</h5>
- <p>If the user agent is to <dfn id=picking-an-encoding-for-the-form>pick an encoding for a
- form</dfn>, optionally with an <i>allow non-ASCII-compatible encodings</i> flag set, it must run
- the following substeps:</p>
- <ol><li><p>Let <var>input</var> be the value of the <code id=selecting-a-form-submission-encoding:the-form-element><a href=#the-form-element>form</a></code> element's <code id=selecting-a-form-submission-encoding:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute.<li><p>Let <var>candidate encoding labels</var> be the result of <a href=#split-a-string-on-spaces id=selecting-a-form-submission-encoding:split-a-string-on-spaces>splitting <var>input</var> on spaces</a>.<li><p>Let <var>candidate encodings</var> be an empty list of <a href=#encoding id=selecting-a-form-submission-encoding:encoding>character encodings</a>.<li><p>For each token in <var>candidate encoding labels</var> in turn (in the order in
- which they were found in <var>input</var>), <a href=http://encoding.spec.whatwg.org/#concept-encoding-get id=selecting-a-form-submission-encoding:getting-an-encoding data-x-internal=getting-an-encoding>get an
- encoding</a> for the token and, if this does not result in failure, append the
- <a href=#encoding id=selecting-a-form-submission-encoding:encoding-2>encoding</a> to <var>candidate encodings</var>.<li><p>If the <i>allow non-ASCII-compatible encodings</i> flag is not set, remove any encodings
- that are not <a href=#ascii-compatible-character-encoding id=selecting-a-form-submission-encoding:ascii-compatible-character-encoding>ASCII-compatible character
- encodings</a> from <var>candidate encodings</var>.<li><p>If <var>candidate encodings</var> is empty, return UTF-8 and abort these
- steps.<li>
- <p>Each character encoding in <var>candidate encodings</var> can represent a finite
- number of characters. (For example, UTF-8 can represent all 1.1 million or so Unicode code
- points, while Windows-1252 can only represent 256.)</p>
- <p>For each encoding in <var>candidate encodings</var>, determine how many of the
- characters in the names and values of the entries in the <var>form data set</var> the
- encoding can represent (without ignoring duplicates). Let <var>max</var> be the
- highest such count. (For UTF-8, <var>max</var> would equal the number of characters
- in the names and values of the entries in the <var>form data set</var>.)</p>
- <p>Return the first encoding in <var>candidate encodings</var> that can encode <var>max</var> characters in the names and values of the entries in the <var>form
- data set</var>.</p>
- </ol>
-
- <h5 id=url-encoded-form-data>4.10.22.6 URL-encoded form data</h5>
- <p class=note>This form data set encoding is in many ways an aberrant monstrosity, the result of
- many years of implementation accidents and compromises leading to a set of requirements necessary
- for interoperability, but in no way representing good design practices. In particular, readers are
- cautioned to pay close attention to the twisted details involving repeated (and in some cases
- nested) conversions between character encodings and byte sequences.</p>
-
- <p>The <dfn id=application/x-www-form-urlencoded-encoding-algorithm><code>application/x-www-form-urlencoded</code> encoding algorithm</dfn> is as
- follows:</p>
- <ol><li><p>Let <var>result</var> be the empty string.<li>
- <p>If the <code id=url-encoded-form-data:the-form-element><a href=#the-form-element>form</a></code> element has an <code id=url-encoded-form-data:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
- encoding be the result of <a href=#picking-an-encoding-for-the-form id=url-encoded-form-data:picking-an-encoding-for-the-form>picking an encoding for the form</a>.</p>
- <p>Otherwise, if the <code id=url-encoded-form-data:the-form-element-2><a href=#the-form-element>form</a></code> element has no <code id=url-encoded-form-data:attr-form-accept-charset-2><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, but the <a href="#document's-character-encoding" id="url-encoded-form-data:document's-character-encoding">document's
- character encoding</a> is an <a href=#ascii-compatible-character-encoding id=url-encoded-form-data:ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
- the selected character encoding.</p>
- <p>Otherwise, let the selected character encoding be UTF-8.</p>
- <li><p>Let <var>charset</var> be the <a href=#encoding-name id=url-encoded-form-data:encoding-name>name</a> of the
- selected <a href=#encoding id=url-encoded-form-data:encoding>character encoding</a>.<li>
- <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
- <ol><li><p>If the entry's name is "<code id=url-encoded-form-data:attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its
- type is "<code>hidden</code>", replace its value with <var>charset</var>.<li><p>If the entry's type is "<code>file</code>", replace its value with the file's
- name only.<li><p>For each character in the entry's name and value that cannot be expressed using the
- selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND
- character (&), a U+0023 NUMBER SIGN character (#), one or more <a href=#ascii-digits id=url-encoded-form-data:ascii-digits>ASCII digits</a>
- representing the Unicode code point of the character in base ten, and finally a U+003B
- SEMICOLON character (;).<li>
- <p>Encode the entry's name and value using the <a href=#encoder id=url-encoded-form-data:encoder>encoder</a> for the selected character
- encoding. The entry's name and value are now byte strings.</p>
- <li>
- <p>For each byte in the entry's name and value, apply the appropriate subsubsteps from the
- following list:</p>
- <dl class=switch><dt>If the byte is 0x20 (U+0020 SPACE if interpreted as ASCII)<dd>Replace the byte with a single 0x2B byte (U+002B PLUS SIGN character (+) if interpreted
- as ASCII).<dt>If the byte is in the range 0x2A, 0x2D, 0x2E, 0x30 to 0x39, 0x41 to 0x5A, 0x5F, 0x61 to
- 0x7A<dd><p>Leave the byte as is.<dt>Otherwise<dd>
- <ol><li><p>Let <var>s</var> be a string consisting of a U+0025 PERCENT SIGN character
- (%) followed by <a href=#uppercase-ascii-hex-digits id=url-encoded-form-data:uppercase-ascii-hex-digits>uppercase ASCII hex digits</a> representing the hexadecimal value
- of the byte in question (zero-padded if necessary).<li><p>Encode the string <var>s</var> as US-ASCII, so that it is now a byte
- string.</p>
- <li><p>Replace the byte in question in the name or value being processed by the bytes in
- <var>s</var>, preserving their relative order.</ol>
- </dl>
- <li>
- <p>Interpret the entry's name and value as Unicode strings encoded in US-ASCII. (All of the
- bytes in the string will be in the range 0x00 to 0x7F; the high bit will be zero throughout.)
- The entry's name and value are now Unicode strings again.</p>
- <li><p>If the entry's name is "<code id=url-encoded-form-data:attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>", its type is
- "<code>text</code>", and this is the first entry in the <var>form data
- set</var>, then append the value to <var>result</var> and skip the rest of the
- substeps for this entry, moving on to the next entry, if any, or the next step in the overall
- algorithm otherwise.<li><p>If this is not the first entry, append a single U+0026 AMPERSAND character (&) to
- <var>result</var>.<li><p>Append the entry's name to <var>result</var>.<li><p>Append a single U+003D EQUALS SIGN character (=) to <var>result</var>.<li><p>Append the entry's value to <var>result</var>.</ol>
- <li><p>Encode <var>result</var> as US-ASCII and return the resulting byte
- stream.</ol>
-
- <p>To <dfn id=application/x-www-form-urlencoded-decoding-algorithm>decode
- <code>application/x-www-form-urlencoded</code> payloads</dfn>, the following algorithm should be
- used. This algorithm uses as inputs the payload itself, <var>payload</var>, consisting of
- a Unicode string using only characters in the range U+0000 to U+007F; a default character encoding
- <var>encoding</var>; and optionally an <var>isindex</var> flag indicating that
- the payload is to be processed as if it had been generated for a form containing an <code id=url-encoded-form-data:attr-fe-name-isindex-2><a href=#attr-fe-name-isindex>isindex</a></code> control. The output of this algorithm is a sorted list
- of name-value pairs. If the <var>isindex</var> flag is set and the first control really
- was an <code id=url-encoded-form-data:attr-fe-name-isindex-3><a href=#attr-fe-name-isindex>isindex</a></code> control, then the first name-value pair
- will have as its name the empty string.</p>
- <p>Which default character encoding to use can only be determined on a case-by-case basis, but
- generally the best character encoding to use as a default is the one that was used to encode the
- page on which the form used to create the payload was itself found. In the absence of a better
- default, UTF-8 is suggested.</p>
- <p>The <var>isindex</var> flag is for legacy use only. Forms in conforming HTML documents
- will not generate payloads that need to be decoded with this flag set.</p>
- <ol><li><p>Let <var>strings</var> be the result of <a href=#strictly-split-a-string id=url-encoded-form-data:strictly-split-a-string>strictly splitting the string</a> <var>payload</var> on U+0026 AMPERSAND
- characters (&).<li><p>If the <var>isindex</var> flag is set and the first string in <var>strings</var> does not contain a U+003D EQUALS SIGN character (=), insert a U+003D
- EQUALS SIGN character (=) at the start of the first string in <var>strings</var>.<li><p>Let <var>pairs</var> be an empty list of name-value pairs.<li>
- <p>For each string <var>string</var> in <var>strings</var>, run these
- substeps:</p>
- <ol><li>
- <p>If <var>string</var> contains a U+003D EQUALS SIGN character (=), then let <var>name</var> be the substring of <var>string</var> from the start of <var>string</var> up to but excluding its first U+003D EQUALS SIGN character (=), and let
- <var>value</var> be the substring from the first character, if any, after the first
- U+003D EQUALS SIGN character (=) up to the end of <var>string</var>. If the first
- U+003D EQUALS SIGN character (=) is the first character, then <var>name</var> will be
- the empty string. If it is the last character, then <var>value</var> will be the
- empty string.</p>
- <p>Otherwise, <var>string</var> contains no U+003D EQUALS SIGN characters (=). Let
- <var>name</var> have the value of <var>string</var> and let <var>value</var> be the empty string.</p>
- <li>
- <p>Replace any U+002B PLUS SIGN characters (+) in <var>name</var> and <var>value</var> with U+0020 SPACE characters.</p>
- <li>
- <p>Replace any escape in <var>name</var> and <var>value</var> with the
- character represented by the escape. This replacement must not be recursive.</p>
- <p>An escape is a U+0025 PERCENT SIGN character (%) followed by two <a href=#ascii-hex-digits id=url-encoded-form-data:ascii-hex-digits>ASCII hex
- digits</a>.</p>
- <p>The character represented by an escape is the Unicode character whose code point is equal
- to the value of the two characters after the U+0025 PERCENT SIGN character (%), interpreted as
- a hexadecimal number (in the range 0..255).</p>
- <p class=example>So for instance the string "<code>A%2BC</code>" would become
- "<code>A+C</code>". Similarly, the string "<code>100%25AA%21</code>" becomes
- the string "<code>100%AA!</code>".</p>
- <li><p>Convert the <var>name</var> and <var>value</var> strings to their byte
- representation in ISO-8859-1 (i.e. convert the Unicode string to a byte string, mapping code
- points to byte values directly).<li><p>Add a pair consisting of <var>name</var> and <var>value</var> to <var>pairs</var>.</ol>
- <li><p>If any of the name-value pairs in <var>pairs</var> have a name component
- consisting of the string "<code>_charset_</code>" encoded in US-ASCII, and the value
- component of the first such pair, when decoded as US-ASCII, is the name of a supported character
- encoding, then let <var>encoding</var> be that character encoding (replacing the default
- passed to the algorithm).<li><p>Convert the name and value components of each name-value pair in <var>pairs</var>
- to Unicode by interpreting the bytes according to the encoding <var>encoding</var>.<li><p>Return <var>pairs</var>.</ol>
- <p class=note>Parameters on the <code id=url-encoded-form-data:application/x-www-form-urlencoded><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> MIME type are
- ignored. In particular, this MIME type does not support the <code>charset</code>
- parameter.</p>
- <h5 id=multipart-form-data>4.10.22.7 Multipart form data</h5>
-
-
-
- <p>The <dfn id=multipart/form-data-encoding-algorithm><code>multipart/form-data</code> encoding algorithm</dfn> is as follows:</p>
- <ol><li><p>Let <var>result</var> be the empty string.<li>
- <p>If the algorithm was invoked with an explicit character encoding, let the selected character
- encoding be that encoding. (This algorithm is used by other specifications, which provide an
- explicit character encoding to avoid the dependency on the <code id=multipart-form-data:the-form-element><a href=#the-form-element>form</a></code> element described
- in the next paragraph.)</p>
- <p>Otherwise, if the <code id=multipart-form-data:the-form-element-2><a href=#the-form-element>form</a></code> element has an <code id=multipart-form-data:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
- encoding be the result of <a href=#picking-an-encoding-for-the-form id=multipart-form-data:picking-an-encoding-for-the-form>picking an encoding for the form</a>.</p>
- <p>Otherwise, if the <code id=multipart-form-data:the-form-element-3><a href=#the-form-element>form</a></code> element has no <code id=multipart-form-data:attr-form-accept-charset-2><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, but the <a href="#document's-character-encoding" id="multipart-form-data:document's-character-encoding">document's
- character encoding</a> is an <a href=#ascii-compatible-character-encoding id=multipart-form-data:ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
- the selected character encoding.</p>
- <p>Otherwise, let the selected character encoding be UTF-8.</p>
- <li><p>Let <var>charset</var> be the <a href=#encoding-name id=multipart-form-data:encoding-name>name</a> of the
- selected <a href=#encoding id=multipart-form-data:encoding>character encoding</a>.<li>
- <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
- <ol><li><p>If the entry's name is "<code id=multipart-form-data:attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its
- type is "<code>hidden</code>", replace its value with <var>charset</var>.<li><p>For each character in the entry's name and value that cannot be expressed using the
- selected character encoding, replace the character by a string consisting of a U+0026 AMPERSAND
- character (&), a U+0023 NUMBER SIGN character (#), one or more <a href=#ascii-digits id=multipart-form-data:ascii-digits>ASCII digits</a>
- representing the Unicode code point of the character in base ten, and finally a U+003B
- SEMICOLON character (;).</ol>
- <li>
- <p>Encode the (now mutated) <var>form data set</var> using the rules described by RFC 2388,
- <cite>Returning Values from Forms: <code>multipart/form-data</code></cite>, and return
- the resulting byte stream. <a href=#refsRFC2388>[RFC2388]</a></p>
- <p>Each entry in the <var>form data set</var> is a <i>field</i>, the name of the entry is the
- <i>field name</i> and the value of the entry is the <i>field value</i>.</p>
- <p>The order of parts must be the same as the order of fields in the <var>form data set</var>.
- Multiple entries with the same name must be treated as distinct fields.</p>
- <p class=note>In particular, this means that multiple files submitted as part of a single
- <code><input type=file multiple></code> element will result in each file
- having its own field; the "sets of files" feature ("<code id=multipart-form-data:multipart/mixed><a href=#multipart/mixed>multipart/mixed</a></code>") of RFC 2388
- is not used.</p>
- <p>The parts of the generated <code id=multipart-form-data:multipart/form-data><a href=#multipart/form-data>multipart/form-data</a></code> resource that correspond to
- non-file fields must not have a <code id=multipart-form-data:content-type><a href=#content-type>Content-Type</a></code> header specified. Their names and
- values must be encoded using the character encoding selected above (field names in particular do
- not get converted to a 7-bit safe encoding as suggested in RFC 2388).</p>
- <p>File names included in the generated <code id=multipart-form-data:multipart/form-data-2><a href=#multipart/form-data>multipart/form-data</a></code> resource (as part of
- file fields) must use the character encoding selected above, though the precise name may be
- approximated if necessary (e.g. newlines could be removed from file names, quotes could be
- changed to "%22", and characters not expressible in the selected character encoding could be
- replaced by other characters). User agents must not use the RFC 2231 encoding suggested by RFC
- 2388.</p>
- <p>The boundary used by the user agent in generating the return value of this algorithm is the
- <dfn id=multipart/form-data-boundary-string><code>multipart/form-data</code> boundary string</dfn>. (This value is used to generate the
- MIME type of the form submission payload generated by this algorithm.)</p>
- </ol>
-
- <p>For details on how to interpret <code id=multipart-form-data:multipart/form-data-3><a href=#multipart/form-data>multipart/form-data</a></code> payloads, see RFC 2388. <a href=#refsRFC2388>[RFC2388]</a></p>
- <h5 id=plain-text-form-data>4.10.22.8 Plain text form data</h5>
-
- <p>The <dfn id=text/plain-encoding-algorithm><code>text/plain</code> encoding algorithm</dfn> is as follows:</p>
- <ol><li><p>Let <var>result</var> be the empty string.<li>
-
- <p>If the <code id=plain-text-form-data:the-form-element><a href=#the-form-element>form</a></code> element has an <code id=plain-text-form-data:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, let the selected character
- encoding be the result of <a href=#picking-an-encoding-for-the-form id=plain-text-form-data:picking-an-encoding-for-the-form>picking an encoding for the form</a>, with the <i>allow
- non-ASCII-compatible encodings</i> flag unset.</p>
- <p>Otherwise, if the <code id=plain-text-form-data:the-form-element-2><a href=#the-form-element>form</a></code> element has no <code id=plain-text-form-data:attr-form-accept-charset-2><a href=#attr-form-accept-charset>accept-charset</a></code> attribute, then that is the selected
- character encoding.</p>
- <li><p>Let <var>charset</var> be the <a href=#encoding-name id=plain-text-form-data:encoding-name>name</a> of the
- selected <a href=#encoding id=plain-text-form-data:encoding>character encoding</a>.<li><p>If the entry's name is "<code id=plain-text-form-data:attr-fe-name-charset><a href=#attr-fe-name-charset>_charset_</a></code>" and its type
- is "<code>hidden</code>", replace its value with <var>charset</var>.<li><p>If the entry's type is "<code>file</code>", replace its value with the file's
- name only.<li>
- <p>For each entry in the <var>form data set</var>, perform these substeps:</p>
- <ol><li><p>Append the entry's name to <var>result</var>.<li><p>Append a single U+003D EQUALS SIGN character (=) to <var>result</var>.<li><p>Append the entry's value to <var>result</var>.<li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF) character pair to <var>result</var>.</ol>
- <li><p>Encode <var>result</var> using the <a href=#encoder id=plain-text-form-data:encoder>encoder</a> for the selected
- character encoding and return the resulting byte stream.</ol>
-
- <p>Payloads using the <code id=plain-text-form-data:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code> format are intended to be human readable. They are
- not reliably interpretable by computer, as the format is ambiguous (for example, there is no way
- to distinguish a literal newline in a value from the newline at the end of the value).</p>
-
- <h4 id=resetting-a-form>4.10.23 Resetting a form</h4>
- <p>When a <code id=resetting-a-form:the-form-element><a href=#the-form-element>form</a></code> element <var>form</var> is <dfn id=concept-form-reset>reset</dfn>, the user agent must <a href=#fire-a-simple-event id=resetting-a-form:fire-a-simple-event>fire a simple event</a> named
- <code id=resetting-a-form:event-reset><a href=#event-reset>reset</a></code>, that bubbles and is cancelable, at <var>form</var>, and then, if that event is not canceled, must invoke the <a href=#concept-form-reset-control id=resetting-a-form:concept-form-reset-control>reset algorithm</a> of each <a href=#category-reset id=resetting-a-form:category-reset>resettable element</a> whose <a href=#form-owner id=resetting-a-form:form-owner>form owner</a> is <var>form</var>.</p>
- <p>When the <a href=#concept-form-reset id=resetting-a-form:concept-form-reset>reset</a> algorithm is invoked by the <code id=resetting-a-form:dom-form-reset><a href=#dom-form-reset>reset()</a></code> method, the <code id=resetting-a-form:event-reset-2><a href=#event-reset>reset</a></code> event
- fired by the <a href=#concept-form-reset id=resetting-a-form:concept-form-reset-2>reset</a> algorithm must not be <a href=#concept-events-trusted id=resetting-a-form:concept-events-trusted>trusted</a>.</p>
- <p>Each <a href=#category-reset id=resetting-a-form:category-reset-2>resettable element</a> defines its own <dfn id=concept-form-reset-control>reset algorithm</dfn>. Changes made to form controls as part of
- these algorithms do not count as changes caused by the user (and thus, e.g., do not cause <code id=resetting-a-form:event-input><a href=#event-input>input</a></code> events to fire).</p>
-
- <h3 id=interactive-elements>4.11 Interactive elements</h3>
- <h4 id=the-details-element>4.11.1 The <dfn><code>details</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-details-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-details-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-root id=the-details-element:sectioning-root>Sectioning root</a>.<dd><a href=#interactive-content-2 id=the-details-element:interactive-content-2>Interactive content</a>.<dd><a href=#palpable-content-2 id=the-details-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-details-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-details-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-details-element:concept-element-content-model>Content model</a>:<dd>One <code id=the-details-element:the-summary-element><a href=#the-summary-element>summary</a></code> element followed by <a href=#flow-content-2 id=the-details-element:flow-content-2-3>flow content</a>.<dt><a href=#concept-element-tag-omission id=the-details-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-details-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-details-element:global-attributes>Global attributes</a><dd><code id=the-details-element:attr-details-open><a href=#attr-details-open>open</a></code> — Whether the details are visible<dt><a href=#concept-element-dom id=the-details-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldetailselement>HTMLDetailsElement</dfn> : <a href=#htmlelement id=the-details-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-details-open id=the-details-element:dom-details-open>open</a>;
- };</pre>
- </dl>
- <p>The <code id=the-details-element:the-details-element><a href=#the-details-element>details</a></code> element <a href=#represents id=the-details-element:represents>represents</a> a disclosure widget from which the
- user can obtain additional information or controls.</p>
- <p class=note>The <code id=the-details-element:the-details-element-2><a href=#the-details-element>details</a></code> element is not appropriate for footnotes. Please see <a href=#footnotes>the section on footnotes</a> for details on how to mark up footnotes.</p>
- <p>The first <code id=the-details-element:the-summary-element-2><a href=#the-summary-element>summary</a></code> element child of the element, if any,
- <a href=#represents id=the-details-element:represents-2>represents</a> the summary or legend of the details. If there is no
- child <code id=the-details-element:the-summary-element-3><a href=#the-summary-element>summary</a></code> element, the user agent should provide its own legend (e.g.
- "Details").</p>
- <p>The rest of the element's contents <a href=#represents id=the-details-element:represents-3>represents</a> the additional information or
- controls.</p>
- <p>The <dfn id=attr-details-open><code>open</code></dfn> content attribute is a <a href=#boolean-attribute id=the-details-element:boolean-attribute>boolean
- attribute</a>. If present, it indicates that both the summary and the additional information is
- to be shown to the user. If the attribute is absent, only the summary is to be shown.</p>
-
- <p>When the element is created, if the attribute is absent, the additional information should be
- hidden; if the attribute is present, that information should be shown. Subsequently, if the
- attribute is removed, then the information should be hidden; if the attribute is added, the
- information should be shown.</p>
- <p>The user agent should allow the user to request that the additional information be shown or
- hidden. To honor a request for the details to be shown, the user agent must set the <code id=the-details-element:attr-details-open-2><a href=#attr-details-open>open</a></code> attribute on the element to the value <code>open</code>. To honor a request for the information to be hidden, the user agent must
- remove the <code id=the-details-element:attr-details-open-3><a href=#attr-details-open>open</a></code> attribute from the element.</p>
- <p>Whenever the <code id=the-details-element:attr-details-open-4><a href=#attr-details-open>open</a></code> attribute is added to or removed from
- a <code id=the-details-element:the-details-element-3><a href=#the-details-element>details</a></code> element, the user agent must <a href=#queue-a-task id=the-details-element:queue-a-task>queue a task</a> that runs the
- following steps, which are known as the <dfn id=details-notification-task-steps>details notification task steps</dfn>, for this
- <code id=the-details-element:the-details-element-4><a href=#the-details-element>details</a></code> element:</p>
- <ol><li>
- <p>If another <a href=#concept-task id=the-details-element:concept-task>task</a> has been <a href=#queue-a-task id=the-details-element:queue-a-task-2>queued</a> to run the <a href=#details-notification-task-steps id=the-details-element:details-notification-task-steps>details notification task steps</a> for this
- <code id=the-details-element:the-details-element-5><a href=#the-details-element>details</a></code> element, then abort these steps.</p>
- <p class=note>When the <code id=the-details-element:attr-details-open-5><a href=#attr-details-open>open</a></code> attribute is toggled
- several times in succession, these steps essentially get coalesced so that only one event is
- fired.</p>
- <li><p><a href=#fire-a-simple-event id=the-details-element:fire-a-simple-event>Fire a simple event</a> named <code id=the-details-element:event-toggle><a href=#event-toggle>toggle</a></code> at the
- <code id=the-details-element:the-details-element-6><a href=#the-details-element>details</a></code> element.</ol>
- <p>The <a href=#task-source id=the-details-element:task-source>task source</a> for this task must be the <a href=#dom-manipulation-task-source id=the-details-element:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <p>The <dfn id=dom-details-open><code>open</code></dfn> IDL attribute must
- <a href=#reflect id=the-details-element:reflect>reflect</a> the <code id=the-details-element:attr-details-open-6><a href=#attr-details-open>open</a></code> content attribute.</p>
-
- <div class=example>
- <p>The following example shows the <code id=the-details-element:the-details-element-7><a href=#the-details-element>details</a></code> element being used to hide technical
- details in a progress report.</p>
- <pre><section class="progress window">
- <h1>Copying "Really Achieving Your Childhood Dreams"</h1>
- <details>
- <summary>Copying... <progress max="375505392" value="97543282"></progress> 25%</summary>
- <dl>
- <dt>Transfer rate:</dt> <dd>452KB/s</dd>
- <dt>Local filename:</dt> <dd>/home/rpausch/raycd.m4v</dd>
- <dt>Remote filename:</dt> <dd>/var/www/lectures/raycd.m4v</dd>
- <dt>Duration:</dt> <dd>01:16:27</dd>
- <dt>Colour profile:</dt> <dd>SD (6-1-6)</dd>
- <dt>Dimensions:</dt> <dd>320×240</dd>
- </dl>
- </details>
- </section></pre>
- </div>
- <div class=example>
- <p>The following shows how a <code id=the-details-element:the-details-element-8><a href=#the-details-element>details</a></code> element can be used to hide some controls by
- default:</p>
- <pre><details>
- <summary><label for=fn>Name & Extension:</label></summary>
- <p><input type=text id=fn name=fn value="Pillar Magazine.pdf">
- <p><label><input type=checkbox name=ext checked> Hide extension</label>
- </details></pre>
- <p>One could use this in conjunction with other <code id=the-details-element:the-details-element-9><a href=#the-details-element>details</a></code> in a list to allow the user
- to collapse a set of fields down to a small set of headings, with the ability to open each
- one.</p>
- <p class=details-example><img src=http://images.whatwg.org/sample-details-1.png width=345 alt="" height=611><img src=http://images.whatwg.org/sample-details-2.png width=345 alt="" height=666></p>
- <p>In these examples, the summary really just summarises what the controls can change, and not
- the actual values, which is less than ideal.</p>
- </div>
- <div class=example>
- <p>Because the <code id=the-details-element:attr-details-open-7><a href=#attr-details-open>open</a></code> attribute is added and removed
- automatically as the user interacts with the control, it can be used in CSS to style the element
- differently based on its state. Here, a stylesheet is used to animate the colour of the summary
- when the element is opened or closed:</p>
- <pre><style>
- details > summary { transition: color 1s; color: black; }
- details[open] > summary { color: red; }
- </style>
- <details>
- <summary>Automated Status: Operational</summary>
- <p>Velocity: 12m/s</p>
- <p>Direction: North</p>
- </details></pre>
- </div>
- <h4 id=the-summary-element>4.11.2 The <dfn><code>summary</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-summary-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-summary-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As the first child of a <code id=the-summary-element:the-details-element><a href=#the-details-element>details</a></code> element.<dt><a href=#concept-element-content-model id=the-summary-element:concept-element-content-model>Content model</a>:<dd>Either: <a href=#phrasing-content-2 id=the-summary-element:phrasing-content-2>phrasing content</a>.<dd>Or: one element of <a href=#heading-content-2 id=the-summary-element:heading-content-2>heading content</a>.<dt><a href=#concept-element-tag-omission id=the-summary-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-summary-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-summary-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-summary-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-summary-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-summary-element:the-summary-element><a href=#the-summary-element>summary</a></code> element <a href=#represents id=the-summary-element:represents>represents</a> a summary, caption, or legend for the
- rest of the contents of the <code id=the-summary-element:the-summary-element-2><a href=#the-summary-element>summary</a></code> element's parent <code id=the-summary-element:the-details-element-2><a href=#the-details-element>details</a></code>
- element, if any.</p>
- <h4 id=the-menu-element>4.11.3 The <dfn id=menus><code>menu</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-menu-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-menu-element:flow-content-2>Flow content</a>.<dd>If the element's <code id=the-menu-element:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state id=the-menu-element:toolbar-state>toolbar</a> state: <a href=#palpable-content-2 id=the-menu-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-menu-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-menu-element:flow-content-2-2>flow content</a> is expected.<dd>If the element's <code id=the-menu-element:attr-menu-type-2><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state>popup menu</a> state: as the child of a <code id=the-menu-element:the-menu-element><a href=#the-menu-element>menu</a></code> element whose <code id=the-menu-element:attr-menu-type-3><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-2>popup menu</a> state.<dt><a href=#concept-element-content-model id=the-menu-element:concept-element-content-model>Content model</a>:<dd>If the element's <code id=the-menu-element:attr-menu-type-4><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state id=the-menu-element:toolbar-state-2>toolbar</a> state: either zero or more <code id=the-menu-element:the-li-element><a href=#the-li-element>li</a></code> and <a href=#script-supporting-elements-2 id=the-menu-element:script-supporting-elements-2>script-supporting</a> elements, or, <a href=#flow-content-2 id=the-menu-element:flow-content-2-3>flow content</a>.<dd>If the element's <code id=the-menu-element:attr-menu-type-5><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-3>popup menu</a> state: in any order, zero or more <code id=the-menu-element:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> elements, zero or more <code id=the-menu-element:the-hr-element><a href=#the-hr-element>hr</a></code> elements, zero or more <code id=the-menu-element:the-menu-element-2><a href=#the-menu-element>menu</a></code> elements whose <code id=the-menu-element:attr-menu-type-6><a href=#attr-menu-type>type</a></code> attributes are in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-4>popup menu</a> state, and zero or more <a href=#script-supporting-elements-2 id=the-menu-element:script-supporting-elements-2-2>script-supporting</a> elements.<dt><a href=#concept-element-tag-omission id=the-menu-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-menu-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-menu-element:global-attributes>Global attributes</a><dd><code id=the-menu-element:attr-menu-type-7><a href=#attr-menu-type>type</a></code> — Type of menu<dd><code id=the-menu-element:attr-menu-label><a href=#attr-menu-label>label</a></code> — User-visible label<dt><a href=#concept-element-dom id=the-menu-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlmenuelement>HTMLMenuElement</dfn> : <a href=#htmlelement id=the-menu-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-menu-type id=the-menu-element:dom-menu-type>type</a>;
- attribute DOMString <a href=#dom-menu-label id=the-menu-element:dom-menu-label>label</a>;
- // <a href="#HTMLMenuElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-menu-element:the-menu-element-3><a href=#the-menu-element>menu</a></code> element represents a list of commands.</p>
-
- <p>The <dfn id=attr-menu-type><code>type</code></dfn> attribute is an <a href=#enumerated-attribute id=the-menu-element:enumerated-attribute>enumerated
- attribute</a> indicating the kind of menu being declared. The attribute has two states. The
- "<dfn id=attr-menu-type-popup><code>popup</code></dfn>" keyword maps to the <dfn id=popup-menu-state>popup menu</dfn> state, in which the element is declaring a context menu
- or the menu for a <a href=#attr-button-type-menu-state id=the-menu-element:attr-button-type-menu-state>menu button</a>. The "<dfn id=attr-menu-type-toolbar><code>toolbar</code></dfn>" keyword maps to the <dfn id=toolbar-state>toolbar</dfn> state, in which the element is declaring a toolbar. The attribute may also be
- omitted. The <i id=the-menu-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-5>popup menu</a>
- state if the parent element is a <code id=the-menu-element:the-menu-element-4><a href=#the-menu-element>menu</a></code> element whose <code id=the-menu-element:attr-menu-type-8><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-6>popup
- menu</a> state; otherwise, it is the <a href=#toolbar-state id=the-menu-element:toolbar-state-3>toolbar</a> state.</p>
- <p>If a <code id=the-menu-element:the-menu-element-5><a href=#the-menu-element>menu</a></code> element's <code id=the-menu-element:attr-menu-type-9><a href=#attr-menu-type>type</a></code> attribute is in the
- <a href=#popup-menu-state id=the-menu-element:popup-menu-state-7>popup menu</a> state, then the element <a href=#represents id=the-menu-element:represents>represents</a>
- the commands of a popup menu, and the user can only examine and interact with the commands if that
- popup menu is activated through some other element, either via the <code id=the-menu-element:attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute or the <code id=the-menu-element:the-button-element><a href=#the-button-element>button</a></code> element's <code id=the-menu-element:attr-button-menu><a href=#attr-button-menu>menu</a></code> attribute.</p>
- <p>If a <code id=the-menu-element:the-menu-element-6><a href=#the-menu-element>menu</a></code> element's <code id=the-menu-element:attr-menu-type-10><a href=#attr-menu-type>type</a></code> attribute is in the
- <a href=#toolbar-state id=the-menu-element:toolbar-state-4>toolbar</a> state, then the element <a href=#represents id=the-menu-element:represents-2>represents</a> a
- toolbar consisting of its contents, in the form of either an unordered list of items (represented
- by <code id=the-menu-element:the-li-element-2><a href=#the-li-element>li</a></code> elements), each of which represents a command that the user can perform or
- activate, or, if the element has no <code id=the-menu-element:the-li-element-3><a href=#the-li-element>li</a></code> element children, <a href=#flow-content-2 id=the-menu-element:flow-content-2-4>flow content</a>
- describing available commands.</p>
- <p>The <dfn id=attr-menu-label><code>label</code></dfn> attribute gives the label of the
- menu. It is used by user agents to display nested menus in the UI: a context menu containing
- another menu would use the nested menu's <code id=the-menu-element:attr-menu-label-2><a href=#attr-menu-label>label</a></code> attribute for
- the submenu's menu label. The <code id=the-menu-element:attr-menu-label-3><a href=#attr-menu-label>label</a></code> attribute must only be
- specified on <code id=the-menu-element:the-menu-element-7><a href=#the-menu-element>menu</a></code> elements whose parent element is a <code id=the-menu-element:the-menu-element-8><a href=#the-menu-element>menu</a></code> element whose
- <code id=the-menu-element:attr-menu-type-11><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menu-element:popup-menu-state-8>popup
- menu</a> state.</p>
-
- <hr>
- <p>A <code id=the-menu-element:the-menu-element-9><a href=#the-menu-element>menu</a></code> is a <dfn id=currently-relevant-menu-element>currently relevant <code>menu</code> element</dfn> if it is the
- child of a <a href=#currently-relevant-menu-element id=the-menu-element:currently-relevant-menu-element>currently relevant <code>menu</code> element</a>, or if it is the
- <a href=#designated-pop-up-menu id=the-menu-element:designated-pop-up-menu>designated pop-up menu</a> of a <code id=the-menu-element:the-button-element-2><a href=#the-button-element>button</a></code> element that is not
- <a href=#inert id=the-menu-element:inert>inert</a>, does not have a <code id=the-menu-element:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and is not
- the descendant of an element with a <code id=the-menu-element:the-hidden-attribute-2><a href=#the-hidden-attribute>hidden</a></code> attribute.</p>
- <hr>
- <p>A <dfn id=menu-construct>menu construct</dfn> consists of an ordered list of zero or more <dfn id=menu-item-construct>menu item constructs</dfn>, which can be any of:</p>
- <ul class=brief><li><a href=#concept-command id=the-menu-element:concept-command>Commands</a>, which can be marked as <dfn id=default-command>default commands</dfn> (<code id=the-menu-element:the-menuitem-element-2><a href=#the-menuitem-element>menuitem</a></code>)<li><dfn id=concept-separator>Separators</dfn> (<code id=the-menu-element:the-hr-element-2><a href=#the-hr-element>hr</a></code>)<li>Other <a href=#menu-construct id=the-menu-element:menu-construct>menu constructs</a>, each with an associated <dfn id=submenu-label>submenu label</dfn>, which allows the list to be nested (<code id=the-menu-element:the-menu-element-10><a href=#the-menu-element>menu</a></code>)</ul>
- <p>To <dfn id=build-and-show-a-menu>build and show a menu</dfn> for a particular <code id=the-menu-element:the-menu-element-11><a href=#the-menu-element>menu</a></code> element
- <var>source</var> and with a particular element <var>subject</var> as a subject, the user agent
- must run the following steps:</p>
- <ol><li><p>Let <var>pop-up menu</var> be the <a href=#menu-construct id=the-menu-element:menu-construct-2>menu construct</a> created by the <a href=#build-a-menu-construct id=the-menu-element:build-a-menu-construct>build a
- menu construct</a> algorithm when passed the <var>source</var> element.</p>
- <li>
- <p>Display <var>pop-up menu</var> to the user, and let the algorithm that invoked this one continue.</p>
- <p>If the user selects a <a href=#menu-item-construct id=the-menu-element:menu-item-construct>menu item construct</a> that corresponds to an element that still represents a <a href=#concept-command id=the-menu-element:concept-command-2>command</a> when the user selects it, then the UA must invoke that
- command's <a href=#command-facet-action id=the-menu-element:command-facet-action>Action</a>. If the command's <a href=#command-facet-action id=the-menu-element:command-facet-action-2>Action</a> is defined as <a href=#fire-a-click-event id=the-menu-element:fire-a-click-event>firing
- a <code>click</code> event</a>, either directly or via the <a href=#run-synthetic-click-activation-steps id=the-menu-element:run-synthetic-click-activation-steps>run
- synthetic click activation steps</a> algorithm, then the <code id=the-menu-element:dom-mouseevent-relatedtarget><a href=#dom-mouseevent-relatedtarget>relatedTarget</a></code> attribute of that <code id=the-menu-element:event-click><a href=#event-click>click</a></code> event must be initialised to <var>subject</var>.</p>
- <p>Pop-up menus must not, while being shown, reflect changes in the DOM. The menu is constructed
- from the DOM before being shown, and is then immutable.</p>
- </ol>
- <p>To <dfn id=build-a-menu-construct>build a menu construct</dfn> for an element <var>source</var>, the user agent must run
- the following steps, which return a <a href=#menu-construct id=the-menu-element:menu-construct-3>menu construct</a>:</p>
- <ol><li><p>Let <var>generated menu</var> be an empty <a href=#menu-construct id=the-menu-element:menu-construct-4>menu construct</a>.<li>
- <p>Run the <a href=#menu-item-generator id=the-menu-element:menu-item-generator>menu item generator</a> steps for the <code id=the-menu-element:the-menu-element-12><a href=#the-menu-element>menu</a></code> element using <var>generated menu</var>
- as the output.</p>
- <p>The <dfn id=menu-item-generator>menu item generator</dfn> steps for a <code id=the-menu-element:the-menu-element-13><a href=#the-menu-element>menu</a></code> element using a specific <a href=#menu-construct id=the-menu-element:menu-construct-5>menu construct</a> <var>output</var> as
- output are as follows: For each child node of the <code id=the-menu-element:the-menu-element-14><a href=#the-menu-element>menu</a></code> in <a href=#tree-order id=the-menu-element:tree-order>tree order</a>,
- run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If the child is a <code id=the-menu-element:the-menuitem-element-3><a href=#the-menuitem-element>menuitem</a></code> element that <a href=#concept-command id=the-menu-element:concept-command-3>defines
- a command</a><dd>Append the <a href=#concept-command id=the-menu-element:concept-command-4>command</a> to <var>output</var>, respecting the command's <a href=#concept-facet id=the-menu-element:concept-facet>facets</a>. If the <code id=the-menu-element:the-menuitem-element-4><a href=#the-menuitem-element>menuitem</a></code> element has a <code id=the-menu-element:attr-menuitem-default><a href=#attr-menuitem-default>default</a></code> attribute, mark the <span>command</span> as being a <a href=#default-command id=the-menu-element:default-command>default
- command</a>.<dt>If the child is an <code id=the-menu-element:the-hr-element-3><a href=#the-hr-element>hr</a></code> element<dd>Append a <a href=#concept-separator id=the-menu-element:concept-separator>separator</a> to <var>output</var>.<dt>If the child is a <code id=the-menu-element:the-menu-element-15><a href=#the-menu-element>menu</a></code> element with no <code id=the-menu-element:attr-menu-label-4><a href=#attr-menu-label>label</a></code> attribute<dd>Append a <a href=#concept-separator id=the-menu-element:concept-separator-2>separator</a> to <var>output</var>, then run
- the <a href=#menu-item-generator id=the-menu-element:menu-item-generator-2>menu item generator</a> steps for this child <code id=the-menu-element:the-menu-element-16><a href=#the-menu-element>menu</a></code> element, using
- <var>output</var> as the output, then append another <a href=#concept-separator id=the-menu-element:concept-separator-3>separator</a> to <var>output</var>.<dt>If the child is a <code id=the-menu-element:the-menu-element-17><a href=#the-menu-element>menu</a></code> element with a <code id=the-menu-element:attr-menu-label-5><a href=#attr-menu-label>label</a></code> attribute<dd>Let <var>submenu</var> be the result of running the <a href=#build-a-menu-construct id=the-menu-element:build-a-menu-construct-2>build a menu construct</a> steps for the child <code id=the-menu-element:the-menu-element-18><a href=#the-menu-element>menu</a></code> element. Then, append <var>submenu</var> to <var>output</var>, using the value of the child
- <code id=the-menu-element:the-menu-element-19><a href=#the-menu-element>menu</a></code> element's <code id=the-menu-element:attr-menu-label-6><a href=#attr-menu-label>label</a></code> attribute as the <a href=#submenu-label id=the-menu-element:submenu-label>submenu label</a>.<dt>Otherwise<dd><a href=#ignore id=the-menu-element:ignore>Ignore</a> the child node.</dl>
- <li><p>Remove from <var>output</var> any <a href=#menu-construct id=the-menu-element:menu-construct-6>menu construct</a> whose <a href=#submenu-label id=the-menu-element:submenu-label-2>submenu
- label</a> is the empty string.<li><p>Remove from <var>output</var> any <a href=#menu-item-construct id=the-menu-element:menu-item-construct-2>menu item construct</a> representing a <a href=#concept-command id=the-menu-element:concept-command-5>command</a> whose <a href=#command-facet-label id=the-menu-element:command-facet-label>Label</a> is
- the empty string.<li><p>Collapse all sequences of two or more adjacent <a href=#concept-separator id=the-menu-element:concept-separator-4>separators</a> in <var>output</var> to a single <a href=#concept-separator id=the-menu-element:concept-separator-5>separator</a>.<li><p>If the first <a href=#menu-item-construct id=the-menu-element:menu-item-construct-3>menu item construct</a> in <var>output</var> is a <a href=#concept-separator id=the-menu-element:concept-separator-6>separator</a>, then remove it.<li><p>If the last <a href=#menu-item-construct id=the-menu-element:menu-item-construct-4>menu item construct</a> in <var>output</var> is a <a href=#concept-separator id=the-menu-element:concept-separator-7>separator</a>, then remove it.<li><p>Return <var>output</var>.</ol>
- <hr>
- <p>The <dfn id=dom-menu-type><code>type</code></dfn> IDL attribute must <a href=#reflect id=the-menu-element:reflect>reflect</a>
- the content attribute of the same name, <a href=#limited-to-only-known-values id=the-menu-element:limited-to-only-known-values>limited to only known values</a>.</p>
- <p>The <dfn id=dom-menu-label><code>label</code></dfn> IDL attribute must
- <a href=#reflect id=the-menu-element:reflect-2>reflect</a> the content attribute of the same name.</p>
-
- <div class=example>
- <p>In this example, the <code id=the-menu-element:the-menu-element-20><a href=#the-menu-element>menu</a></code> element is used to describe a toolbar with three menu
- buttons on it, each of which has a dropdown menu with a series of options:</p>
- <pre><menu>
- <li>
- <button type=menu value="File" menu="filemenu">
- <menu id="filemenu" type="popup">
- <menuitem onclick="fnew()" label="New...">
- <menuitem onclick="fopen()" label="Open...">
- <menuitem onclick="fsave()" label="Save">
- <menuitem onclick="fsaveas()" label="Save as...">
- </menu>
- </li>
- <li>
- <button type=menu value="Edit" menu="editmenu">
- <menu id="editmenu" type="popup">
- <menuitem onclick="ecopy()" label="Copy">
- <menuitem onclick="ecut()" label="Cut">
- <menuitem onclick="epaste()" label="Paste">
- </menu>
- </li>
- <li>
- <button type=menu value="Help" menu="helpmenu">
- <menu id="helpmenu" type="popup">
- <menuitem onclick="location='help.html'" label="Help">
- <menuitem onclick="location='about.html'" label="About">
- </menu>
- </li>
- </menu></pre>
- <p>In a supporting user agent, this might look like this (assuming the user has just activated the
- second button):</p>
- <p><img src=http://images.whatwg.org/sample-toolbar-1.png width=303 alt="A toolbar with three buttons, labeled 'File', 'Edit', and 'Help'; where if you select the 'Edit' button you get a drop-down menu with three more options, 'Copy', 'Cut', and 'Paste'." height=101></p>
- </div>
- <h4 id=the-menuitem-element>4.11.4 The <dfn><code>menuitem</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-menuitem-element:concept-element-categories>Categories</a>:<dd>None.<dt><a href=#concept-element-contexts id=the-menuitem-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>As a child of a <code id=the-menuitem-element:the-menu-element><a href=#the-menu-element>menu</a></code> element whose <code id=the-menuitem-element:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-menuitem-element:popup-menu-state>popup menu</a> state.<dt><a href=#concept-element-content-model id=the-menuitem-element:concept-element-content-model>Content model</a>:<dd><a href=#concept-content-nothing id=the-menuitem-element:concept-content-nothing>Nothing</a>.<dt><a href=#concept-element-tag-omission id=the-menuitem-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>No <a href=#syntax-end-tag id=the-menuitem-element:syntax-end-tag>end tag</a>.<dt><a href=#concept-element-attributes id=the-menuitem-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-menuitem-element:global-attributes>Global attributes</a><dd><code id=the-menuitem-element:attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> — Type of command<dd><code id=the-menuitem-element:attr-menuitem-label><a href=#attr-menuitem-label>label</a></code> — User-visible label<dd><code id=the-menuitem-element:attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code> — Icon for the command<dd><code id=the-menuitem-element:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> — Whether the form control is disabled<dd><code id=the-menuitem-element:attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> — Whether the command or control is checked<dd><code id=the-menuitem-element:attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code> — Name of group of commands to treat as a radio button group<dd><code id=the-menuitem-element:attr-menuitem-default><a href=#attr-menuitem-default>default</a></code> — Mark the command as being a default command<dd><code id=the-menuitem-element:attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> — Command definition<dd>Also, the <code id=the-menuitem-element:attr-menuitem-title><a href=#attr-menuitem-title>title</a></code> attribute <a href=#attr-menuitem-title id=the-menuitem-element:attr-menuitem-title-2>has special semantics</a> on this element: Hint describing the command.<dt><a href=#concept-element-dom id=the-menuitem-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlmenuitemelement>HTMLMenuItemElement</dfn> : <a href=#htmlelement id=the-menuitem-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-menuitem-type id=the-menuitem-element:dom-menuitem-type>type</a>;
- attribute DOMString <a href=#dom-menuitem-label id=the-menuitem-element:dom-menuitem-label>label</a>;
- attribute DOMString <a href=#dom-menuitem-icon id=the-menuitem-element:dom-menuitem-icon>icon</a>;
- attribute boolean <a href=#dom-menuitem-disabled id=the-menuitem-element:dom-menuitem-disabled>disabled</a>;
- attribute boolean <a href=#dom-menuitem-checked id=the-menuitem-element:dom-menuitem-checked>checked</a>;
- attribute DOMString <a href=#dom-menuitem-radiogroup id=the-menuitem-element:dom-menuitem-radiogroup>radiogroup</a>;
- attribute boolean <a href=#dom-menuitem-default id=the-menuitem-element:dom-menuitem-default>default</a>;
- readonly attribute <a href=#htmlelement id=the-menuitem-element:htmlelement-2>HTMLElement</a>? <a href=#dom-menuitem-command id=the-menuitem-element:dom-menuitem-command>command</a>;
- };</pre>
- </dl>
- <p>The <code id=the-menuitem-element:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element represents a command that the user can invoke from a popup
- menu (either a <a href=#attr-contextmenu id=the-menuitem-element:attr-contextmenu>context menu</a> or the menu of a <a href=#attr-button-type-menu-state id=the-menuitem-element:attr-button-type-menu-state>menu button</a>).</p>
- <p>A <code id=the-menuitem-element:the-menuitem-element-2><a href=#the-menuitem-element>menuitem</a></code> element that uses one or more of the
- <code id=the-menuitem-element:attr-menuitem-type-2><a href=#attr-menuitem-type>type</a></code>,
- <code id=the-menuitem-element:attr-menuitem-label-2><a href=#attr-menuitem-label>label</a></code>,
- <code id=the-menuitem-element:attr-menuitem-icon-2><a href=#attr-menuitem-icon>icon</a></code>,
- <code id=the-menuitem-element:attr-menuitem-disabled-2><a href=#attr-menuitem-disabled>disabled</a></code>,
- <code id=the-menuitem-element:attr-menuitem-checked-2><a href=#attr-menuitem-checked>checked</a></code>, and
- <code id=the-menuitem-element:attr-menuitem-radiogroup-2><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
- attributes defines a new command.</p>
- <p>A <code id=the-menuitem-element:the-menuitem-element-3><a href=#the-menuitem-element>menuitem</a></code> element that uses the <code id=the-menuitem-element:attr-menuitem-command-2><a href=#attr-menuitem-command>command</a></code> attribute defines a command by reference to another
- one. This allows authors to define a command once, and set its state (e.g. whether it is active or
- disabled) in one place, and have all references to that command in the user interface change at
- the same time.</p>
- <p>If the <code id=the-menuitem-element:attr-menuitem-command-3><a href=#attr-menuitem-command>command</a></code> attribute is specified, the element
- is in the <dfn id=indirect-command>indirect command</dfn> mode. If it is not specified, it is in the <dfn id=explicit-command>explicit
- command</dfn> mode. When the element is in the <a href=#indirect-command id=the-menuitem-element:indirect-command>indirect command</a> mode, the element
- must not have any of the following attributes specified:
- <code id=the-menuitem-element:attr-menuitem-type-3><a href=#attr-menuitem-type>type</a></code>,
- <code id=the-menuitem-element:attr-menuitem-label-3><a href=#attr-menuitem-label>label</a></code>,
- <code id=the-menuitem-element:attr-menuitem-icon-3><a href=#attr-menuitem-icon>icon</a></code>,
- <code id=the-menuitem-element:attr-menuitem-disabled-3><a href=#attr-menuitem-disabled>disabled</a></code>,
- <code id=the-menuitem-element:attr-menuitem-checked-3><a href=#attr-menuitem-checked>checked</a></code>,
- <code id=the-menuitem-element:attr-menuitem-radiogroup-3><a href=#attr-menuitem-radiogroup>radiogroup</a></code>.
- </p>
- <hr>
- <p>The <dfn id=attr-menuitem-type><code>type</code></dfn> attribute indicates the kind of
- command: either a normal command with an associated action, or a state or option that can be
- toggled, or a selection of one item from a list of items.</p>
- <p>The attribute is an <a href=#enumerated-attribute id=the-menuitem-element:enumerated-attribute>enumerated attribute</a> with three keywords and states. The
- "<dfn id=attr-menuitem-type-keyword-command><code>command</code></dfn>" keyword maps to the
- <a href=#attr-menuitem-type-state-command id=the-menuitem-element:attr-menuitem-type-state-command>Command</a> state, the "<dfn id=attr-menuitem-type-keyword-checkbox><code>checkbox</code></dfn>" keyword maps to the <a href=#attr-menuitem-type-state-checkbox id=the-menuitem-element:attr-menuitem-type-state-checkbox>Checkbox</a> state, and the "<dfn id=attr-menuitem-type-keyword-radio><code>radio</code></dfn>" keyword maps to the <a href=#attr-menuitem-type-state-radio id=the-menuitem-element:attr-menuitem-type-state-radio>Radio</a> state. The <i id=the-menuitem-element:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-menuitem-type-state-command id=the-menuitem-element:attr-menuitem-type-state-command-2>Command</a> state.</p>
- <dl><dt>The <dfn id=attr-menuitem-type-state-command>Command</dfn> state<dd><p>The element <a href=#represents id=the-menuitem-element:represents>represents</a> a normal command with an associated action.<dt>The <dfn id=attr-menuitem-type-state-checkbox>Checkbox</dfn> state<dd><p>The element <a href=#represents id=the-menuitem-element:represents-2>represents</a> a state or option that can be toggled.<dt>The <dfn id=attr-menuitem-type-state-radio>Radio</dfn> state<dd><p>The element <a href=#represents id=the-menuitem-element:represents-3>represents</a> a selection of one item from a list of items.</dl>
- <p>The <dfn id=attr-menuitem-label><code>label</code></dfn> attribute gives the name of the
- command, as shown to the user. The <code id=the-menuitem-element:attr-menuitem-label-4><a href=#attr-menuitem-label>label</a></code> attribute must
- be specified if the element is in the <a href=#explicit-command id=the-menuitem-element:explicit-command>explicit command</a> mode. If the attribute is
- specified, it must have a value that is not the empty string.</p>
- <p>The <dfn id=attr-menuitem-icon><code>icon</code></dfn> attribute gives a picture that
- represents the command. If the attribute is specified, the attribute's value must contain a
- <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-menuitem-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid non-empty URL potentially surrounded by spaces</a>. To obtain
- the <a href=#absolute-url id=the-menuitem-element:absolute-url>absolute URL</a> of the icon when the attribute's value is not the empty string, the
- attribute's value must be <a href=#resolve-a-url id=the-menuitem-element:resolve-a-url>resolved</a> relative to the element.
- When the attribute is absent, or its value is the empty string, or <a href=#resolve-a-url id=the-menuitem-element:resolve-a-url-2>resolving</a> its value fails, there is no icon.</p>
- <p>The <dfn id=attr-menuitem-disabled><code>disabled</code></dfn> attribute is a
- <a href=#boolean-attribute id=the-menuitem-element:boolean-attribute>boolean attribute</a> that, if present, indicates that the command is not available in
- the current state.</p>
- <p class=note>The distinction between <code id=the-menuitem-element:attr-menuitem-disabled-4><a href=#attr-menuitem-disabled>disabled</a></code> and
- <code id=the-menuitem-element:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> is subtle. A command would be disabled if, in the same
- context, it could be enabled if only certain aspects of the situation were changed. A command
- would be marked as hidden if, in that situation, the command will never be enabled. For example,
- in the context menu for a water faucet, the command "open" might be disabled if the faucet is
- already open, but the command "eat" would be marked hidden since the faucet could never be
- eaten.</p>
- <p>The <dfn id=attr-menuitem-checked><code>checked</code></dfn> attribute is a <a href=#boolean-attribute id=the-menuitem-element:boolean-attribute-2>boolean
- attribute</a> that, if present, indicates that the command is selected. The attribute must be
- omitted unless the <code id=the-menuitem-element:attr-menuitem-type-4><a href=#attr-menuitem-type>type</a></code> attribute is in either the <a href=#attr-menuitem-type-state-checkbox id=the-menuitem-element:attr-menuitem-type-state-checkbox-2>Checkbox</a> state or the <a href=#attr-menuitem-type-state-radio id=the-menuitem-element:attr-menuitem-type-state-radio-2>Radio</a> state.</p>
- <p>The <dfn id=attr-menuitem-radiogroup><code>radiogroup</code></dfn> attribute gives the
- name of the group of commands that will be toggled when the command itself is toggled, for
- commands whose <code id=the-menuitem-element:attr-menuitem-type-5><a href=#attr-menuitem-type>type</a></code> attribute has the value "<code>radio</code>". The scope of the name is the child list of the parent element. The
- attribute must be omitted unless the <code id=the-menuitem-element:attr-menuitem-type-6><a href=#attr-menuitem-type>type</a></code> attribute is in
- the <a href=#attr-menuitem-type-state-radio id=the-menuitem-element:attr-menuitem-type-state-radio-3>Radio</a> state. When specified, the
- attribute's value must be a non-empty string.</p>
- <hr>
- <p>If a <code id=the-menuitem-element:the-menuitem-element-4><a href=#the-menuitem-element>menuitem</a></code> element <var>slave</var> has a <dfn id=attr-menuitem-command><code>command</code></dfn> attribute, and there is an element in
- <var>slave</var>'s <a href=#home-subtree id=the-menuitem-element:home-subtree>home subtree</a> whose <a href=#concept-id id=the-menuitem-element:concept-id>ID</a> has
- a value equal to the value of <var>slave</var>'s <code id=the-menuitem-element:attr-menuitem-command-4><a href=#attr-menuitem-command>command</a></code> attribute, and the first such element in <a href=#tree-order id=the-menuitem-element:tree-order>tree
- order</a>, hereafter <var>master</var>, itself <a href=#concept-command id=the-menuitem-element:concept-command>defines a
- command</a> and either is not a <code id=the-menuitem-element:the-menuitem-element-5><a href=#the-menuitem-element>menuitem</a></code> element or does not itself have a <code id=the-menuitem-element:attr-menuitem-command-5><a href=#attr-menuitem-command>command</a></code> attribute, then the <dfn id=master-command>master command</dfn> of <var>slave</var> is <var>master</var>.</p>
- <p>A <code id=the-menuitem-element:the-menuitem-element-6><a href=#the-menuitem-element>menuitem</a></code> element with a <code id=the-menuitem-element:attr-menuitem-command-6><a href=#attr-menuitem-command>command</a></code>
- attribute must have a <a href=#master-command id=the-menuitem-element:master-command>master command</a>.</p>
- <p class=note>This effectively defines the syntax of the attribute's value as being the ID of
- another element that <a href=#concept-command id=the-menuitem-element:concept-command-2>defines a command</a>.</p>
- <hr>
- <p>The <dfn id=attr-menuitem-title><code>title</code></dfn> attribute gives a hint describing
- the command, which might be shown to the user to help him.</p>
- <p>The <dfn id=attr-menuitem-default><code>default</code></dfn> attribute indicates, if
- present, that the command is the one that would have been invoked if the user had directly
- activated the menu's subject instead of using the menu. The <code id=the-menuitem-element:attr-menuitem-default-2><a href=#attr-menuitem-default>default</a></code> attribute is a <a href=#boolean-attribute id=the-menuitem-element:boolean-attribute-3>boolean attribute</a>.</p>
- <div class=example>
- <p>In this trivial example, a submit button is given a context menu that has two options, one to
- reset the form, and one to submit the form. The submit command is marked as being the default.</p>
- <pre><form action="dosearch.pl">
- <p><label>Enter search terms: <input type="text" name="terms"></label></p>
- <p><input type=submit contextmenu=formmenu id="submitbutton"></p>
- <p hidden><input type=reset id="resetbutton"></p>
- <menu type=popup id=formmenu>
- <menuitem command="submitbutton" default>
- <menuitem command="resetbutton">
- </menu>
- </form></pre>
- </div>
-
- <hr>
- <p>The <dfn id=dom-menuitem-type><code>type</code></dfn> IDL attribute must
- <a href=#reflect id=the-menuitem-element:reflect>reflect</a> the content attribute of the same name, <a href=#limited-to-only-known-values id=the-menuitem-element:limited-to-only-known-values>limited to only known
- values</a>.</p>
- <p>The <dfn id=dom-menuitem-label><code>label</code></dfn>, <dfn id=dom-menuitem-icon><code>icon</code></dfn>, <dfn id=dom-menuitem-disabled><code>disabled</code></dfn>, <dfn id=dom-menuitem-checked><code>checked</code></dfn>, and <dfn id=dom-menuitem-radiogroup><code>radiogroup</code></dfn>, and <dfn id=dom-menuitem-default><code>default</code></dfn> IDL attributes must <a href=#reflect id=the-menuitem-element:reflect-2>reflect</a>
- the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-menuitem-command><code>command</code></dfn> IDL attribute must return the
- <a href=#master-command id=the-menuitem-element:master-command-2>master command</a>, if any, or null otherwise.</p>
- <hr>
- <p>If the element's <a href=#command-facet-disabledstate id=the-menuitem-element:command-facet-disabledstate>Disabled State</a> is false
- (enabled) then the element's <a href=#activation-behavior id=the-menuitem-element:activation-behavior>activation behavior</a> depends on the element's <code id=the-menuitem-element:attr-menuitem-type-7><a href=#attr-menuitem-type>type</a></code> and <code id=the-menuitem-element:attr-menuitem-command-7><a href=#attr-menuitem-command>command</a></code>
- attributes, as follows:</p>
- <dl class=switch><dt>If the element has a <a href=#master-command id=the-menuitem-element:master-command-3>master command</a> set by its <code id=the-menuitem-element:attr-menuitem-command-8><a href=#attr-menuitem-command>command</a></code> attribute<dd><p>The user agent must <a href=#run-synthetic-click-activation-steps id=the-menuitem-element:run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the element's
- <a href=#master-command id=the-menuitem-element:master-command-4>master command</a>.<dt>If the <code id=the-menuitem-element:attr-menuitem-type-8><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-checkbox id=the-menuitem-element:attr-menuitem-type-state-checkbox-3>Checkbox</a> state<dd><p>If the element has a <code id=the-menuitem-element:attr-menuitem-checked-4><a href=#attr-menuitem-checked>checked</a></code> attribute, the UA
- must remove that attribute. Otherwise, the UA must add a <code id=the-menuitem-element:attr-menuitem-checked-5><a href=#attr-menuitem-checked>checked</a></code> attribute, with the literal value "<code>checked</code>".<dt>If the <code id=the-menuitem-element:attr-menuitem-type-9><a href=#attr-menuitem-type>type</a></code> attribute is in the <a href=#attr-menuitem-type-state-radio id=the-menuitem-element:attr-menuitem-type-state-radio-4>Radio</a> state<dd><p>If the element has a parent, then the UA must walk the list of child nodes of that parent
- element, and for each node that is a <code id=the-menuitem-element:the-menuitem-element-7><a href=#the-menuitem-element>menuitem</a></code> element, if that element has a <code id=the-menuitem-element:attr-menuitem-radiogroup-4><a href=#attr-menuitem-radiogroup>radiogroup</a></code> attribute whose value exactly matches the
- current element's (treating missing <code id=the-menuitem-element:attr-menuitem-radiogroup-5><a href=#attr-menuitem-radiogroup>radiogroup</a></code>
- attributes as if they were the empty string), and has a <code id=the-menuitem-element:attr-menuitem-checked-6><a href=#attr-menuitem-checked>checked</a></code> attribute, must remove that attribute.</p>
- <p>Then, the element's <code id=the-menuitem-element:attr-menuitem-checked-7><a href=#attr-menuitem-checked>checked</a></code> attribute must be set
- to the literal value "<code>checked</code>".<dt>Otherwise<dd><p>The element's <a href=#activation-behavior id=the-menuitem-element:activation-behavior-2>activation behavior</a> is to do nothing.</dl>
- <p class=note>Firing a synthetic <code id=the-menuitem-element:event-click><a href=#event-click>click</a></code> event at the element
- does not cause any of the actions described above to happen.</p>
-
- <p>If the element's <a href=#command-facet-disabledstate id=the-menuitem-element:command-facet-disabledstate-2>Disabled State</a> is true
- (disabled) then the element has no <a href=#activation-behavior id=the-menuitem-element:activation-behavior-3>activation behavior</a>.</p>
-
- <p class=note>The <code id=the-menuitem-element:the-menuitem-element-8><a href=#the-menuitem-element>menuitem</a></code> element is not rendered except as <a href=#the-menu-element id=the-menuitem-element:the-menu-element-2>part of a popup menu</a>.</p>
- <div class=example>
- <p>Here is an example of a pop-up menu button with three options that let the user toggle between
- left, center, and right alignment. One could imagine such a toolbar as part of a text editor. The
- menu also has a separator followed by another menu item labeled "Publish", though that menu item
- is disabled.</p>
- <pre><button type=menu menu=editmenu>Commands...</button>
- <menu type="popup" id="editmenu">
- <menuitem type="radio" radiogroup="alignment" checked="checked"
- label="Left" icon="icons/alL.png" onclick="setAlign('left')">
- <menuitem type="radio" radiogroup="alignment"
- label="Center" icon="icons/alC.png" onclick="setAlign('center')">
- <menuitem type="radio" radiogroup="alignment"
- label="Right" icon="icons/alR.png" onclick="setAlign('right')">
- <hr>
- <menuitem type="command" disabled
- label="Publish" icon="icons/pub.png" onclick="publish()">
- </menu></pre>
- </div>
- <h4 id=context-menus>4.11.5 Context menus</h4>
- <h5 id=declaring-a-context-menu>4.11.5.1 Declaring a context menu</h5>
- <p>The <dfn id=attr-contextmenu><code>contextmenu</code></dfn> attribute gives the element's
- context menu. The value must be the <a href=#concept-id id=declaring-a-context-menu:concept-id>ID</a> of a <code id=declaring-a-context-menu:the-menu-element><a href=#the-menu-element>menu</a></code>
- element in the same <a href=#home-subtree id=declaring-a-context-menu:home-subtree>home subtree</a> whose <code id=declaring-a-context-menu:attr-menu-type><a href=#attr-menu-type>type</a></code>
- attribute is in the <a href=#popup-menu-state id=declaring-a-context-menu:popup-menu-state>popup menu</a> state.</p>
- <p class=note>When a user right-clicks on an element with a <code id=declaring-a-context-menu:attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute, the user agent will first fire a <code id=declaring-a-context-menu:event-contextmenu><a href=#event-contextmenu>contextmenu</a></code> event at the element, and then, if that event is not
- canceled, a <code id=declaring-a-context-menu:event-show><a href=#event-show>show</a></code> event at the <code id=declaring-a-context-menu:the-menu-element-2><a href=#the-menu-element>menu</a></code> element.</p>
- <div class=example>
- <p>Here is an example of a context menu for an input control:</p>
- <pre><form name="npc">
- <label>Character name: <input name=char type=text contextmenu=namemenu required></label>
- <menu type=popup id=namemenu>
- <menuitem label="Pick random name" onclick="document.forms.npc.elements.char.value = getRandomName()">
- <menuitem label="Prefill other fields based on name" onclick="prefillFields(document.forms.npc.elements.char.value)">
- </menu>
- </form></pre>
- <p>This adds two items to the control's context menu, one called "Pick random name", and one
- called "Prefill other fields based on name". They invoke scripts that are not shown in the
- example above.</p>
- </div>
-
- <h5 id=processing-model-5>4.11.5.2 Processing model</h5>
- <p>Each element has an <dfn id=assigned-context-menu>assigned context menu</dfn>, which can be null. If an element <var>A</var> has a <code id=processing-model-5:attr-contextmenu><a href=#attr-contextmenu>contextmenu</a></code> attribute, and there is
- an element with the ID given by <var>A</var>'s <code id=processing-model-5:attr-contextmenu-2><a href=#attr-contextmenu>contextmenu</a></code> attribute's value in <var>A</var>'s
- <a href=#home-subtree id=processing-model-5:home-subtree>home subtree</a>, and the first such element in <a href=#tree-order id=processing-model-5:tree-order>tree order</a> is a
- <code id=processing-model-5:the-menu-element><a href=#the-menu-element>menu</a></code> element whose <code id=processing-model-5:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=processing-model-5:popup-menu-state>popup menu</a> state, then <var>A</var>'s <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu>assigned
- context menu</a> is that element. Otherwise, if <var>A</var> has a parent element,
- then <var>A</var>'s <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-2>assigned context menu</a> is the <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-3>assigned context
- menu</a> of its parent element. Otherwise, <var>A</var>'s <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-4>assigned context
- menu</a> is null.</p>
- <p>When an element's context menu is requested (e.g. by the user right-clicking the element, or
- pressing a context menu key), the user agent must apply the appropriate rules from the following
- list:</p>
- <dl class=switch><dt>If the user requested a context menu using a pointing device<dd><p>The user agent must <a href=#concept-event-fire id=processing-model-5:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=processing-model-5:concept-events-trusted>trusted</a> event with the name <code id=processing-model-5:event-contextmenu><a href=#event-contextmenu>contextmenu</a></code>, that bubbles and is cancelable, and that uses the
- <code id=processing-model-5:mouseevent><a href=#mouseevent>MouseEvent</a></code> interface, at the element for which the menu was requested. The context
- information of the event must be initialised to the same values as the last
- <code id=processing-model-5:mouseevent-2><a href=#mouseevent>MouseEvent</a></code> user interaction event that was fired as part of the gesture that was
- interpreted as a request for the context menu.<dt>Otherwise<dd><p>The user agent must <a href=#fire-a-synthetic-mouse-event id=processing-model-5:fire-a-synthetic-mouse-event>fire a synthetic mouse
- event named <code>contextmenu</code></a> that bubbles and is
- cancelable at the element for which the menu was requested.</dl>
- <p class=note>Typically, therefore, the firing of the <code id=processing-model-5:event-contextmenu-2><a href=#event-contextmenu>contextmenu</a></code> event will be the default action of a <code id=processing-model-5:event-mouseup><a href=#event-mouseup>mouseup</a></code> or <code id=processing-model-5:event-keyup><a href=#event-keyup>keyup</a></code> event. The exact
- sequence of events is UA-dependent, as it will vary based on platform conventions.</p>
- <p>The default action of the <code id=processing-model-5:event-contextmenu-3><a href=#event-contextmenu>contextmenu</a></code> event depends on
- whether or not the element for which the menu was requested has a non-null <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-5>assigned context
- menu</a> when the event dispatch has completed, as follows.</p>
- <p>If the <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-6>assigned context menu</a> of the element for which the menu was requested is
- null, the default action must be for the user agent to show its default context menu, if it has
- one.</p>
- <p>Otherwise, let <var>subject</var> be the element for which the menu was requested, and let
- <var>menu</var> be the <a href=#assigned-context-menu id=processing-model-5:assigned-context-menu-7>assigned context menu</a> of <var>target</var> immediately after
- the <code id=processing-model-5:event-contextmenu-4><a href=#event-contextmenu>contextmenu</a></code> event's dispatch has completed. The user
- agent must <a href=#concept-event-fire id=processing-model-5:concept-event-fire-2>fire</a> a <a href=#concept-events-trusted id=processing-model-5:concept-events-trusted-2>trusted</a> event with the name <code id=processing-model-5:event-show><a href=#event-show>show</a></code> at <var>menu</var>, using the <code id=processing-model-5:relatedevent><a href=#relatedevent>RelatedEvent</a></code> interface,
- with the <code id=processing-model-5:dom-relatedevent-relatedtarget><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code> attribute initialised
- to <var>subject</var>. The event must be cancelable. </p>
- <p>If <em>this</em> event (the <code id=processing-model-5:event-show-2><a href=#event-show>show</a></code> event) is not canceled, then
- the user agent must <a href=#build-and-show-a-menu id=processing-model-5:build-and-show-a-menu>build and show</a> the menu for
- <var>menu</var> with <var>subject</var> as the subject.</p>
- <p>The user agent may also provide access to its default context menu, if any, with the context
- menu shown. For example, it could merge the menu items from the two menus together, or provide the
- page's context menu as a submenu of the default menu. In general, user agents are encouraged to
- de-emphasise their own contextual menu items, so as to give the author's context menu the
- appearance of legitimacy — to allow documents to feel like "applications" rather than "mere
- Web pages".</p>
- <p>User agents may provide means for bypassing the context menu processing model, ensuring that
- the user can always access the UA's default context menus. For example, the user agent could
- handle right-clicks that have the Shift key depressed in such a way that it does not fire the
- <code id=processing-model-5:event-contextmenu-5><a href=#event-contextmenu>contextmenu</a></code> event and instead always shows the default
- context menu.</p>
- <hr>
- <p>The <dfn id=dom-contextmenu><code>contextMenu</code></dfn> IDL attribute must
- <a href=#reflect id=processing-model-5:reflect>reflect</a> the <code id=processing-model-5:attr-contextmenu-3><a href=#attr-contextmenu>contextmenu</a></code> content attribute.</p>
-
- <div class=example>
- <p>In this example, an image of cats is given a context menu with four possible commands:</p>
- <pre><img src="cats.jpeg" alt="Cats" contextmenu=catsmenu>
- <menu type="popup" id="catsmenu">
- <menuitem label="Pet the kittens" onclick="kittens.pet()">
- <menuitem label="Cuddle with the kittens" onclick="kittens.cuddle()">
- <menu label="Feed the kittens">
- <menuitem label="Fish" onclick="kittens.feed(fish)">
- <menuitem label="Chicken" onclick="kittens.feed(chicken)">
- </menu>
- </menu></pre>
- <p>When a user of a mouse-operated visual Web browser right-clicks on the image, the browser
- might pop up a context menu like this:</p>
- <p><img src=http://images.whatwg.org/contextmenu-collapsed.png alt="A context menu, shown over a picture of cats, with four lines: the first two offering the menu items described in the markup above ('Pet the kittens' and 'Cuddle with the kittens'), the third giving a submenu labeled 'Feed the kittens', and the fourth, after a horizontal splitter, consisting of only a downwards-pointing disclosure triangle.">
- <p>When the user clicks the disclosure triangle, such a user agent would expand the context menu
- in place, to show the browser's own commands:</p>
- <p><img src=http://images.whatwg.org/contextmenu-expanded.png alt="This would result in the same basic interface, but with a longer menu; the disclosure triangle having been replaced by items such as 'View Image', 'Copy Image', 'Copy Image Location', and so forth.">
- </div>
- <h5 id=the-relatedevent-interfaces>4.11.5.3 The <code id=the-relatedevent-interfaces:relatedevent><a href=#relatedevent>RelatedEvent</a></code> interfaces</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#relatedeventinit id=the-relatedevent-interfaces:relatedeventinit>RelatedEventInit</a> eventInitDict)]
- interface <dfn id=relatedevent>RelatedEvent</dfn> : <a href=#event id=the-relatedevent-interfaces:event>Event</a> {
- readonly attribute <a href=#eventtarget id=the-relatedevent-interfaces:eventtarget>EventTarget</a>? <a href=#dom-relatedevent-relatedtarget id=the-relatedevent-interfaces:dom-relatedevent-relatedtarget>relatedTarget</a>;
- };
- dictionary <dfn id=relatedeventinit>RelatedEventInit</dfn> : <a href=#eventinit id=the-relatedevent-interfaces:eventinit>EventInit</a> {
- <a href=#eventtarget id=the-relatedevent-interfaces:eventtarget-2>EventTarget</a>? relatedTarget;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-relatedevent-interfaces:dom-relatedevent-relatedtarget-2><a href=#dom-relatedevent-relatedtarget>relatedTarget</a></code><dd>
- <p>Returns the other event target involved in this event. For example, when a <code id=the-relatedevent-interfaces:event-show><a href=#event-show>show</a></code> event fires on a <code id=the-relatedevent-interfaces:the-menu-element><a href=#the-menu-element>menu</a></code> element, the other event
- target involved in the event would be the element for which the menu is being shown.</p>
- </dl>
-
- <p>The <dfn id=dom-relatedevent-relatedtarget><code>relatedTarget</code></dfn> attribute must
- return the value it was initialised to. When the object is created, this attribute must be
- initialised to null. It represents the other event target that is related to the event.</p>
-
- <h4 id=commands>4.11.6 Commands</h4>
- <h5 id=facets-2>4.11.6.1 Facets</h5>
- <p>A <dfn id=concept-command>command</dfn> is the abstraction behind menu items, buttons, and
- links. Once a command is defined, other parts of the interface can refer to the same command,
- allowing many access points to a single feature to share facets such as the <a href=#command-facet-disabledstate id=facets-2:command-facet-disabledstate>Disabled State</a>.</p>
- <p id=facets>Commands are defined to have the following <dfn id=concept-facet>facets</dfn>:</p>
- <dl><dt><dfn id=command-facet-type>Type</dfn><dd>The kind of command: "command", meaning it is a normal command; "radio", meaning that
- triggering the command will, amongst other things, set the <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate>Checked State</a> to true (and probably uncheck some other
- commands); or "checkbox", meaning that triggering the command will, amongst other things, toggle
- the value of the <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate-2>Checked State</a>.<dt><dfn id=command-facet-id>ID</dfn><dd>The name of the command, for referring to the command from the markup or from script. If a
- command has no ID, it is an <dfn id=anonymous-command>anonymous command</dfn>.<dt><dfn id=command-facet-label>Label</dfn><dd>The name of the command as seen by the user.<dt><dfn id=command-facet-hint>Hint</dfn><dd>A helpful or descriptive string that can be shown to the user.<dt><dfn id=command-facet-icon>Icon</dfn><dd>An <a href=#absolute-url id=facets-2:absolute-url>absolute URL</a> identifying a graphical image that represents the action. A
- command might not have an Icon.<dt><dfn id=command-facet-accesskey>Access Key</dfn><dd>A key combination selected by the user agent that triggers the command. A command might not
- have an Access Key.<dt><dfn id=command-facet-hiddenstate>Hidden State</dfn><dd>Whether the command is hidden or not (basically, whether it should be shown in menus).<dt><dfn id=command-facet-disabledstate>Disabled State</dfn><dd>Whether the command is relevant and can be triggered or not.<dt><dfn id=command-facet-checkedstate>Checked State</dfn><dd>Whether the command is checked or not.<dt><dfn id=command-facet-action>Action</dfn><dd>The actual effect that triggering the command will have. This could be a scripted event
- handler, a <a href=#url id=facets-2:url>URL</a> to which to <a href=#navigate id=facets-2:navigate>navigate</a>, or a form submission.</dl>
- <p>These facets are exposed on elements using the <dfn id=command-api>command API</dfn>:</p>
- <dl class=domintro><dt><var>element</var> . <code id=facets-2:dom-command-ro-commandtype><a href=#dom-command-ro-commandtype>commandType</a></code><dd>
- <p>Exposes the <a href=#command-facet-type id=facets-2:command-facet-type>Type</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-element-id><a href=#dom-element-id>id</a></code><dd>
- <p>Exposes the <a href=#command-facet-id id=facets-2:command-facet-id>ID</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandlabel><a href=#dom-command-ro-commandlabel>commandLabel</a></code><dd>
- <p>Exposes the <a href=#command-facet-label id=facets-2:command-facet-label>Label</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-title><a href=#dom-title>title</a></code><dd>
- <p>Exposes the <a href=#command-facet-hint id=facets-2:command-facet-hint>Hint</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandicon><a href=#dom-command-ro-commandicon>commandIcon</a></code><dd>
- <p>Exposes the <a href=#command-facet-icon id=facets-2:command-facet-icon>Icon</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-accesskeylabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code><dd>
- <p>Exposes the <a href=#command-facet-accesskey id=facets-2:command-facet-accesskey>Access Key</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandhidden><a href=#dom-command-ro-commandhidden>commandHidden</a></code><dd>
- <p>Exposes the <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate>Hidden State</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-command-ro-commanddisabled><a href=#dom-command-ro-commanddisabled>commandDisabled</a></code><dd>
- <p>Exposes the <a href=#command-facet-disabledstate id=facets-2:command-facet-disabledstate-2>Disabled State</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-command-ro-commandchecked><a href=#dom-command-ro-commandchecked>commandChecked</a></code><dd>
- <p>Exposes the <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate-3>Checked State</a> facet of the command.</p>
- <dt><var>element</var> . <code id=facets-2:dom-click><a href=#dom-click>click</a></code>()<dd>
- <p>Triggers the <a href=#command-facet-action id=facets-2:command-facet-action>Action</a> of the command.</p>
- </dl>
-
- <p>The <dfn id=dom-command-ro-commandtype><code>commandType</code></dfn> attribute must
- return a string whose value is either "<code>command</code>", "<code>radio</code>", or "<code>checkbox</code>", depending on whether the <a href=#command-facet-type id=facets-2:command-facet-type-2>Type</a> of the command defined by the element is "command",
- "radio", or "checkbox" respectively. If the element does not define a command, it must return
- null.</p>
- <p>The <dfn id=dom-command-ro-commandlabel><code>commandLabel</code></dfn> attribute must
- return the command's <a href=#command-facet-label id=facets-2:command-facet-label-2>Label</a>, or null if the element does
- not define a command or does not specify a <a href=#command-facet-label id=facets-2:command-facet-label-3>Label</a>.</p>
- <p>The <dfn id=dom-command-ro-commandicon><code>commandIcon</code></dfn> attribute must
- return the <a href=#absolute-url id=facets-2:absolute-url-2>absolute URL</a> of the command's <a href=#command-facet-icon id=facets-2:command-facet-icon-2>Icon</a>. If the element does not specify an icon, or if the element
- does not define a command, then the attribute must return null.</p>
- <p>The <dfn id=dom-command-ro-commandhidden><code>commandHidden</code></dfn> attribute must
- return true if the command's <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate-2>Hidden State</a> is that
- the command is hidden, and false if the command is not hidden. If the element does not define a
- command, the attribute must return null.</p>
- <p>The <dfn id=dom-command-ro-commanddisabled><code>commandDisabled</code></dfn> attribute
- must return true if the command's <a href=#command-facet-disabledstate id=facets-2:command-facet-disabledstate-3>Disabled State</a>
- is that the command is disabled, and false if the command is not disabled. This attribute is not
- affected by the command's <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate-3>Hidden State</a>. If the
- element does not define a command, the attribute must return null.</p>
- <p>The <dfn id=dom-command-ro-commandchecked><code>commandChecked</code></dfn> attribute must
- return true if the command's <a href=#command-facet-checkedstate id=facets-2:command-facet-checkedstate-4>Checked State</a> is that
- the command is checked, and false if it is that the command is not checked. If the element does
- not define a command, the attribute must return null.</p>
- <p class=note>The <a href=#command-facet-id id=facets-2:command-facet-id-2>ID</a> facet is exposed by the <code id=facets-2:dom-element-id-2><a href=#dom-element-id>id</a></code> IDL attribute, the <a href=#command-facet-hint id=facets-2:command-facet-hint-2>Hint</a>
- facet is exposed by the <code id=facets-2:dom-title-2><a href=#dom-title>title</a></code> IDL attribute, and the <a href=#command-facet-accesskey id=facets-2:command-facet-accesskey-2>AccessKey</a> facet is exposed by the <code id=facets-2:dom-accesskeylabel-2><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute.</p>
-
- <hr>
- <dl class=domintro><dt><var>document</var> . <code id=facets-2:dom-document-commands><a href=#dom-document-commands>commands</a></code><dd>
- <p>Returns an <code id=facets-2:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> of the elements in the <code id=facets-2:document><a href=#document>Document</a></code> that
- define commands and have IDs.</p>
- </dl>
-
- <p>The <dfn id=dom-document-commands><code>commands</code></dfn> attribute of the document's
- <code id=facets-2:document-2><a href=#document>Document</a></code> interface must return an <code id=facets-2:htmlcollection-2><a href=#htmlcollection>HTMLCollection</a></code> rooted at the
- <code id=facets-2:document-3><a href=#document>Document</a></code> node, whose filter matches only elements that <a href=#concept-command id=facets-2:concept-command>define commands</a> and have <a href=#command-facet-id id=facets-2:command-facet-id-3>IDs</a>.</p>
-
- <hr>
- <p id=expose-commands-in-ui>User agents may expose the <a href=#concept-command id=facets-2:concept-command-2>commands</a> that match the following criteria:</p>
- <ul class=brief><li>The <a href=#command-facet-hiddenstate id=facets-2:command-facet-hiddenstate-4>Hidden State</a> facet is false (visible)<li>The element is <a href=#in-a-document id=facets-2:in-a-document>in a <code>Document</code></a> that has an associated <a href=#browsing-context id=facets-2:browsing-context>browsing
- context</a>.<li>Neither the element nor any of its ancestors has a <code id=facets-2:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code>
- attribute specified.<li>The element is not a <code id=facets-2:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element, or it is a child of a <a href=#currently-relevant-menu-element id=facets-2:currently-relevant-menu-element>currently
- relevant <code>menu</code> element</a>, or it has an <a href=#command-facet-accesskey id=facets-2:command-facet-accesskey-3>Access Key</a>.</ul>
- <p>User agents are encouraged to do this especially for commands that have <a href=#command-facet-accesskey id=facets-2:command-facet-accesskey-4>Access Keys</a>, as a way to advertise those keys to the
- user.</p>
- <p class=example>For example, such commands could be listed in the user agent's menu bar.</p>
-
- <h5 id=using-the-a-element-to-define-a-command>4.11.6.2 <dfn>Using the <code>a</code> element to define a command</dfn></h5>
- <p>An <code id=using-the-a-element-to-define-a-command:the-a-element><a href=#the-a-element>a</a></code> element with an <code id=using-the-a-element-to-define-a-command:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute <a href=#concept-command id=using-the-a-element-to-define-a-command:concept-command>defines a command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-a-element-to-define-a-command:command-facet-type>Type</a> of the command is "command".</p>
- <p>The <a href=#command-facet-id id=using-the-a-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-a-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-a-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-a-element-to-define-a-command:command-facet-label>Label</a> of the command is the string given by the
- element's <code id=using-the-a-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <a href=#command-facet-hint id=using-the-a-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the value of the <code id=using-the-a-element-to-define-a-command:attr-title><a href=#attr-title>title</a></code> attribute of the element. If the attribute is not present, the
- <a href=#command-facet-hint id=using-the-a-element-to-define-a-command:command-facet-hint-2>Hint</a> is the empty string.</p>
- <p>The <a href=#command-facet-icon id=using-the-a-element-to-define-a-command:command-facet-icon>Icon</a> of the command is the <a href=#absolute-url id=using-the-a-element-to-define-a-command:absolute-url>absolute
- URL</a> obtained from <a href=#resolve-a-url id=using-the-a-element-to-define-a-command:resolve-a-url>resolving</a> the value of the <code id=using-the-a-element-to-define-a-command:attr-img-src><a href=#attr-img-src>src</a></code> attribute of the first <code id=using-the-a-element-to-define-a-command:the-img-element><a href=#the-img-element>img</a></code> element descendant of the
- element in <a href=#tree-order id=using-the-a-element-to-define-a-command:tree-order>tree order</a>, relative to that element, if there is such an element and
- resolving its attribute is successful. Otherwise, there is no <a href=#command-facet-icon id=using-the-a-element-to-define-a-command:command-facet-icon-2>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-a-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-a-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-a-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a> of the command is true (hidden)
- if the element has a <code id=using-the-a-element-to-define-a-command:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-a-element-to-define-a-command:command-facet-disabledstate>Disabled State</a> facet of the command is
- true if the element or one of its ancestors is <a href=#inert id=using-the-a-element-to-define-a-command:inert>inert</a>, and false otherwise.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-a-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is always
- false. (The command is never checked.)</p>
- <p>The <a href=#command-facet-action id=using-the-a-element-to-define-a-command:command-facet-action>Action</a> of the command, if the element has a
- defined <a href=#activation-behavior id=using-the-a-element-to-define-a-command:activation-behavior>activation behavior</a>, is to <a href=#run-synthetic-click-activation-steps id=using-the-a-element-to-define-a-command:run-synthetic-click-activation-steps>run synthetic click activation steps</a>
- on the element. Otherwise, it is just to <a href=#fire-a-click-event id=using-the-a-element-to-define-a-command:fire-a-click-event>fire a <code>click</code>
- event</a> at the element.</p>
- <h5 id=using-the-button-element-to-define-a-command>4.11.6.3 <dfn>Using the <code>button</code> element to define a command</dfn></h5>
- <p>A <code id=using-the-button-element-to-define-a-command:the-button-element><a href=#the-button-element>button</a></code> element always <a href=#concept-command id=using-the-button-element-to-define-a-command:concept-command>defines a
- command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-button-element-to-define-a-command:command-facet-type>Type</a>, <a href=#command-facet-id id=using-the-button-element-to-define-a-command:command-facet-id>ID</a>,
- <a href=#command-facet-label id=using-the-button-element-to-define-a-command:command-facet-label>Label</a>, <a href=#command-facet-hint id=using-the-button-element-to-define-a-command:command-facet-hint>Hint</a>,
- <a href=#command-facet-icon id=using-the-button-element-to-define-a-command:command-facet-icon>Icon</a>, <a href=#command-facet-accesskey id=using-the-button-element-to-define-a-command:command-facet-accesskey>Access
- Key</a>, <a href=#command-facet-hiddenstate id=using-the-button-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a>, <a href=#command-facet-checkedstate id=using-the-button-element-to-define-a-command:command-facet-checkedstate>Checked State</a>, and <a href=#command-facet-action id=using-the-button-element-to-define-a-command:command-facet-action>Action</a> facets of the command are determined <a href=#using-the-a-element-to-define-a-command id=using-the-button-element-to-define-a-command:using-the-a-element-to-define-a-command>as for <code>a</code> elements</a> (see the previous section).</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-button-element-to-define-a-command:command-facet-disabledstate>Disabled State</a> of the command is true if
- the element or one of its ancestors is <a href=#inert id=using-the-button-element-to-define-a-command:inert>inert</a>, or if the element's <a href=#concept-fe-disabled id=using-the-button-element-to-define-a-command:concept-fe-disabled>disabled</a> state is set, and false otherwise.</p>
- <h5 id=using-the-input-element-to-define-a-command>4.11.6.4 <dfn>Using the <code>input</code> element to define a command</dfn></h5>
- <p>An <code id=using-the-input-element-to-define-a-command:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=using-the-input-element-to-define-a-command:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in
- one of the <a href="#submit-button-state-(type=submit)" id="using-the-input-element-to-define-a-command:submit-button-state-(type=submit)">Submit Button</a>, <a href="#reset-button-state-(type=reset)" id="using-the-input-element-to-define-a-command:reset-button-state-(type=reset)">Reset Button</a>, <a href="#image-button-state-(type=image)" id="using-the-input-element-to-define-a-command:image-button-state-(type=image)">Image
- Button</a>, <a href="#button-state-(type=button)" id="using-the-input-element-to-define-a-command:button-state-(type=button)">Button</a>, <a href="#radio-button-state-(type=radio)" id="using-the-input-element-to-define-a-command:radio-button-state-(type=radio)">Radio Button</a>, or <a href="#checkbox-state-(type=checkbox)" id="using-the-input-element-to-define-a-command:checkbox-state-(type=checkbox)">Checkbox</a> states <a href=#concept-command id=using-the-input-element-to-define-a-command:concept-command>defines a
- command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-input-element-to-define-a-command:command-facet-type>Type</a> of the command is "radio" if the <code id=using-the-input-element-to-define-a-command:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="using-the-input-element-to-define-a-command:radio-button-state-(type=radio)-2">Radio
- Button</a> state, "checkbox" if the <code id=using-the-input-element-to-define-a-command:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#checkbox-state-(type=checkbox)" id="using-the-input-element-to-define-a-command:checkbox-state-(type=checkbox)-2">Checkbox</a> state, and "command" otherwise.</p>
- <p>The <a href=#command-facet-id id=using-the-input-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-input-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-input-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-input-element-to-define-a-command:command-facet-label>Label</a> of the command depends on the Type of the
- command:</p>
- <p>If the <a href=#command-facet-type id=using-the-input-element-to-define-a-command:command-facet-type-2>Type</a> is "command", then it is the string given
- by the <code id=using-the-input-element-to-define-a-command:attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, and a UA-dependent,
- locale-dependent value that the UA uses to label the button itself if the attribute is absent.</p>
- <p>Otherwise, the <a href=#command-facet-type id=using-the-input-element-to-define-a-command:command-facet-type-3>Type</a> is "radio" or "checkbox". If the
- element is a <a href=#labeled-control id=using-the-input-element-to-define-a-command:labeled-control>labeled control</a>, the <code id=using-the-input-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> of the first
- <code id=using-the-input-element-to-define-a-command:the-label-element><a href=#the-label-element>label</a></code> element in <a href=#tree-order id=using-the-input-element-to-define-a-command:tree-order>tree order</a> whose <a href=#labeled-control id=using-the-input-element-to-define-a-command:labeled-control-2>labeled control</a> is the
- element in question is the <a href=#command-facet-label id=using-the-input-element-to-define-a-command:command-facet-label-2>Label</a> (in DOM terms, this is
- the string given by <code><var>element</var>.labels[0].textContent</code>). Otherwise,
- the value of the <code id=using-the-input-element-to-define-a-command:attr-input-value-2><a href=#attr-input-value>value</a></code> attribute, if present, is the <a href=#command-facet-label id=using-the-input-element-to-define-a-command:command-facet-label-3>Label</a>. Otherwise, the <a href=#command-facet-label id=using-the-input-element-to-define-a-command:command-facet-label-4>Label</a> is the empty string.</p>
- <p>The <a href=#command-facet-hint id=using-the-input-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the value of the <code id=using-the-input-element-to-define-a-command:attr-title><a href=#attr-title>title</a></code> attribute of the <code id=using-the-input-element-to-define-a-command:the-input-element-2><a href=#the-input-element>input</a></code> element. If the attribute is
- not present, the <a href=#command-facet-hint id=using-the-input-element-to-define-a-command:command-facet-hint-2>Hint</a> is the empty string.</p>
- <p>If the element's <code id=using-the-input-element-to-define-a-command:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="using-the-input-element-to-define-a-command:image-button-state-(type=image)-2">Image Button</a> state, and the element has a <code id=using-the-input-element-to-define-a-command:attr-img-src><a href=#attr-img-src>src</a></code> attribute, and that attribute's value can be successfully <a href=#resolve-a-url id=using-the-input-element-to-define-a-command:resolve-a-url>resolved</a> relative to the element, then the <a href=#command-facet-icon id=using-the-input-element-to-define-a-command:command-facet-icon>Icon</a> of the command is the <a href=#absolute-url id=using-the-input-element-to-define-a-command:absolute-url>absolute URL</a> obtained
- from resolving that attribute that way. Otherwise, there is no <a href=#command-facet-icon id=using-the-input-element-to-define-a-command:command-facet-icon-2>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-input-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-input-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-input-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a> of the command is true (hidden)
- if the element has a <code id=using-the-input-element-to-define-a-command:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-input-element-to-define-a-command:command-facet-disabledstate>Disabled State</a> of the command is true if
- the element or one of its ancestors is <a href=#inert id=using-the-input-element-to-define-a-command:inert>inert</a>, or if the element's <a href=#concept-fe-disabled id=using-the-input-element-to-define-a-command:concept-fe-disabled>disabled</a> state is set, and false otherwise.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-input-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is true if the
- command is of <a href=#command-facet-type id=using-the-input-element-to-define-a-command:command-facet-type-4>Type</a> "radio" or "checkbox" and the element
- is <a href=#concept-fe-checked id=using-the-input-element-to-define-a-command:concept-fe-checked>checked</a> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-action id=using-the-input-element-to-define-a-command:command-facet-action>Action</a> of the command, if the element has a
- defined <a href=#activation-behavior id=using-the-input-element-to-define-a-command:activation-behavior>activation behavior</a>, is to <a href=#run-synthetic-click-activation-steps id=using-the-input-element-to-define-a-command:run-synthetic-click-activation-steps>run synthetic click activation steps</a>
- on the element. Otherwise, it is just to <a href=#fire-a-click-event id=using-the-input-element-to-define-a-command:fire-a-click-event>fire a <code>click</code>
- event</a> at the element.</p>
- <h5 id=using-the-option-element-to-define-a-command>4.11.6.5 <dfn>Using the <code>option</code> element to define a command</dfn></h5>
- <p>An <code id=using-the-option-element-to-define-a-command:the-option-element><a href=#the-option-element>option</a></code> element with an ancestor <code id=using-the-option-element-to-define-a-command:the-select-element><a href=#the-select-element>select</a></code> element and either no <code id=using-the-option-element-to-define-a-command:attr-option-value><a href=#attr-option-value>value</a></code> attribute or a <code id=using-the-option-element-to-define-a-command:attr-option-value-2><a href=#attr-option-value>value</a></code>
- attribute that is not the empty string <a href=#concept-command id=using-the-option-element-to-define-a-command:concept-command>defines a command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-option-element-to-define-a-command:command-facet-type>Type</a> of the command is "radio" if the
- <code id=using-the-option-element-to-define-a-command:the-option-element-2><a href=#the-option-element>option</a></code>'s nearest ancestor <code id=using-the-option-element-to-define-a-command:the-select-element-2><a href=#the-select-element>select</a></code> element has no <code id=using-the-option-element-to-define-a-command:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute, and "checkbox" if it does.</p>
- <p>The <a href=#command-facet-id id=using-the-option-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-option-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-option-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-option-element-to-define-a-command:command-facet-label>Label</a> of the command is the value of the
- <code id=using-the-option-element-to-define-a-command:the-option-element-3><a href=#the-option-element>option</a></code> element's <code id=using-the-option-element-to-define-a-command:attr-option-label><a href=#attr-option-label>label</a></code> attribute, if there is
- one, or else the value of <code id=using-the-option-element-to-define-a-command:the-option-element-4><a href=#the-option-element>option</a></code> element's <code id=using-the-option-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> IDL attribute,
- with <a href=#strip-leading-and-trailing-whitespace id=using-the-option-element-to-define-a-command:strip-leading-and-trailing-whitespace>leading and trailing whitespace
- stripped</a>, and with any sequences of two or more <a href=#space-character id=using-the-option-element-to-define-a-command:space-character>space
- characters</a> replaced by a single U+0020 SPACE character.</p>
- <p>The <a href=#command-facet-hint id=using-the-option-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the string given by the
- element's <code id=using-the-option-element-to-define-a-command:attr-title><a href=#attr-title>title</a></code> attribute, if any, and the empty string if the
- attribute is absent.</p>
- <p>There is no <a href=#command-facet-icon id=using-the-option-element-to-define-a-command:command-facet-icon>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-option-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-option-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-option-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a> of the command is true (hidden)
- if the element has a <code id=using-the-option-element-to-define-a-command:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-option-element-to-define-a-command:command-facet-disabledstate>Disabled State</a> of the command is true if
- the element is <a href=#concept-option-disabled id=using-the-option-element-to-define-a-command:concept-option-disabled>disabled</a>, or if its nearest ancestor
- <code id=using-the-option-element-to-define-a-command:the-select-element-3><a href=#the-select-element>select</a></code> element is <a href=#concept-fe-disabled id=using-the-option-element-to-define-a-command:concept-fe-disabled>disabled</a>, or if it or one
- of its ancestors is <a href=#inert id=using-the-option-element-to-define-a-command:inert>inert</a>, and false otherwise.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-option-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is true
- (checked) if the element's <a href=#concept-option-selectedness id=using-the-option-element-to-define-a-command:concept-option-selectedness>selectedness</a> is true,
- and false otherwise.</p>
- <p>The <a href=#command-facet-action id=using-the-option-element-to-define-a-command:command-facet-action>Action</a> of the command depends on its <a href=#command-facet-type id=using-the-option-element-to-define-a-command:command-facet-type-2>Type</a>. If the command is of <a href=#command-facet-type id=using-the-option-element-to-define-a-command:command-facet-type-3>Type</a> "radio" then it must <a href=#concept-select-pick id=using-the-option-element-to-define-a-command:concept-select-pick>pick</a> the <code id=using-the-option-element-to-define-a-command:the-option-element-5><a href=#the-option-element>option</a></code> element. Otherwise, it must <a href=#concept-select-toggle id=using-the-option-element-to-define-a-command:concept-select-toggle>toggle</a> the <code id=using-the-option-element-to-define-a-command:the-option-element-6><a href=#the-option-element>option</a></code> element.</p>
- <h5 id=using-the-menuitem-element-to-define-a-command>4.11.6.6 Using the <dfn><code>menuitem</code></dfn> element to define a
- command</h5>
- <p>A <code id=using-the-menuitem-element-to-define-a-command:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element that does not have a <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-command><a href=#attr-menuitem-command>command</a></code> attribute <a href=#concept-command id=using-the-menuitem-element-to-define-a-command:concept-command>defines a
- command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-menuitem-element-to-define-a-command:command-facet-type>Type</a> of the command is "radio" if the
- <code id=using-the-menuitem-element-to-define-a-command:the-menuitem-element-2><a href=#the-menuitem-element>menuitem</a></code>'s <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute is "<code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-type-keyword-radio><a href=#attr-menuitem-type-keyword-radio>radio</a></code>", "checkbox" if the attribute's value is
- "<code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-type-keyword-checkbox><a href=#attr-menuitem-type-keyword-checkbox>checkbox</a></code>", and "command" otherwise.</p>
- <p>The <a href=#command-facet-id id=using-the-menuitem-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-menuitem-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-menuitem-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-menuitem-element-to-define-a-command:command-facet-label>Label</a> of the command is the value of the element's
- <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-label><a href=#attr-menuitem-label>label</a></code> attribute, if there is one, or the empty string if
- it doesn't.</p>
- <p>The <a href=#command-facet-hint id=using-the-menuitem-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the string given by the
- element's <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-title><a href=#attr-menuitem-title>title</a></code> attribute, if any, and the empty string
- if the attribute is absent.</p>
- <p>The <a href=#command-facet-icon id=using-the-menuitem-element-to-define-a-command:command-facet-icon>Icon</a> for the command is the <a href=#absolute-url id=using-the-menuitem-element-to-define-a-command:absolute-url>absolute
- URL</a> obtained from <a href=#resolve-a-url id=using-the-menuitem-element-to-define-a-command:resolve-a-url>resolving</a> the value of the element's
- <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code> attribute, relative to the element, if it has such an
- attribute and resolving it is successful. Otherwise, there is no <a href=#command-facet-icon id=using-the-menuitem-element-to-define-a-command:command-facet-icon-2>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-menuitem-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-menuitem-element-to-define-a-command:assigned-access-key>assigned access key</a>, if any.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-menuitem-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a> of the command is true (hidden)
- if the element has a <code id=using-the-menuitem-element-to-define-a-command:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-menuitem-element-to-define-a-command:command-facet-disabledstate>Disabled State</a> of the command is true if
- the element or one of its ancestors is <a href=#inert id=using-the-menuitem-element-to-define-a-command:inert>inert</a>, or if the element has a <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-menuitem-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is true
- (checked) if the element has a <code id=using-the-menuitem-element-to-define-a-command:attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute, and
- false otherwise.</p>
- <p>The <a href=#command-facet-action id=using-the-menuitem-element-to-define-a-command:command-facet-action>Action</a> of the command, if the element has a
- defined <a href=#activation-behavior id=using-the-menuitem-element-to-define-a-command:activation-behavior>activation behavior</a>, is to
- <a href=#run-synthetic-click-activation-steps id=using-the-menuitem-element-to-define-a-command:run-synthetic-click-activation-steps>run synthetic click activation steps</a> on the element. Otherwise, it is just to
- <a href=#fire-a-click-event id=using-the-menuitem-element-to-define-a-command:fire-a-click-event>fire a <code>click</code> event</a> at the element.</p>
- <h5 id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly>4.11.6.7 <dfn>Using the <code>command</code> attribute on <code>menuitem</code> elements to define
- a command indirectly</dfn></h5>
- <p>A <code id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element with a <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command>master command</a> <a href=#concept-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:concept-command>defines a command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-type>Type</a> of the command is the <a href=#command-facet-type id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-type-2>Type</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-2>master command</a>.</p>
- <p>The <a href=#command-facet-id id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-id>ID</a> of the command is the value of the <code id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-label>Label</a> of the command is the <a href=#command-facet-label id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-label-2>Label</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-3>master command</a>.</p>
- <p>If the element has a <code id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:attr-title><a href=#attr-title>title</a></code> attribute, then the <a href=#command-facet-hint id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-hint>Hint</a> of the command is the value of that <code id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:attr-title-2><a href=#attr-title>title</a></code> attribute. Otherwise, the <a href=#command-facet-hint id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-hint-2>Hint</a> of the command is the <a href=#command-facet-hint id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-hint-3>Hint</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-4>master command</a>.</p>
- <p>The <a href=#command-facet-icon id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-icon>Icon</a> of the command is the <a href=#command-facet-icon id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-icon-2>Icon</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-5>master command</a>.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:assigned-access-key>assigned access key</a>, if any.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-hiddenstate>Hidden State</a> of the command is the <a href=#command-facet-hiddenstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-hiddenstate-2>Hidden State</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-6>master command</a>.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-disabledstate>Disabled State</a> of the command is the <a href=#command-facet-disabledstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-disabledstate-2>Disabled State</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-7>master command</a>.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-checkedstate>Checked State</a> of the command is the <a href=#command-facet-checkedstate id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-checkedstate-2>Checked State</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-8>master command</a>.</p>
- <p>The <a href=#command-facet-action id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-action>Action</a> of the command is to invoke the <a href=#command-facet-action id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:command-facet-action-2>Action</a> of the <a href=#master-command id=using-the-command-attribute-on-menuitem-elements-to-define-a-command-indirectly:master-command-9>master command</a>.</p>
- <h5 id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command>4.11.6.8 <dfn>Using the <code>accesskey</code> attribute
- on a <code>label</code> element to define a command</dfn></h5>
- <p>A <code id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:the-label-element><a href=#the-label-element>label</a></code> element that has an <a href=#assigned-access-key id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:assigned-access-key>assigned access key</a> and a <a href=#labeled-control id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:labeled-control>labeled
- control</a> and whose <a href=#labeled-control id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:labeled-control-2>labeled control</a> <a href=#concept-command id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:concept-command>defines a
- command</a>, itself <a href=#concept-command id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:concept-command-2>defines a command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-type>Type</a> of the command is "command".</p>
- <p>The <a href=#command-facet-id id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-label>Label</a> of the command is the string given by the
- element's <code id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <a href=#command-facet-hint id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the value of the <code id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:attr-title><a href=#attr-title>title</a></code> attribute of the element.</p>
- <p>There is no <a href=#command-facet-icon id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-icon>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:assigned-access-key-2>assigned access key</a>.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a>, <a href=#command-facet-disabledstate id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-disabledstate>Disabled State</a>, and <a href=#command-facet-action id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-action>Action</a> facets of the command are the same as the respective
- facets of the element's <a href=#labeled-control id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:labeled-control-3>labeled control</a>.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-accesskey-attribute-on-a-label-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is always
- false. (The command is never checked.)</p>
- <h5 id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command>4.11.6.9 <dfn>Using the <code>accesskey</code> attribute
- on a <code>legend</code> element to define a command</dfn></h5>
- <p>A <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element><a href=#the-legend-element>legend</a></code> element that has an <a href=#assigned-access-key id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:assigned-access-key>assigned access key</a> and is a child of a
- <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element that has a descendant that is not a descendant of the
- <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-2><a href=#the-legend-element>legend</a></code> element and is neither a <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-label-element><a href=#the-label-element>label</a></code> element nor a <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-3><a href=#the-legend-element>legend</a></code>
- element but that <a href=#concept-command id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command>defines a command</a>, itself <a href=#concept-command id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command-2>defines a command</a>.</p>
- <p>The <a href=#command-facet-type id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-type>Type</a> of the command is "command".</p>
- <p>The <a href=#command-facet-id id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-id>ID</a> of the command is the value of the <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-label>Label</a> of the command is the string given by the
- element's <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
- <p>The <a href=#command-facet-hint id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-hint>Hint</a> of the command is the value of the <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:attr-title><a href=#attr-title>title</a></code> attribute of the element.</p>
- <p>There is no <a href=#command-facet-icon id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-icon>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:assigned-access-key-2>assigned access key</a>.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-hiddenstate>Hidden State</a>, <a href=#command-facet-disabledstate id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-disabledstate>Disabled State</a>, and <a href=#command-facet-action id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-action>Action</a> facets of the command are the same as the respective
- facets of the first element in <a href=#tree-order id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:tree-order>tree order</a> that is a descendant of the parent of the
- <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-4><a href=#the-legend-element>legend</a></code> element that <a href=#concept-command id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:concept-command-3>defines a command</a> but is not
- a descendant of the <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-5><a href=#the-legend-element>legend</a></code> element and is neither a <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-label-element-2><a href=#the-label-element>label</a></code> nor a
- <code id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:the-legend-element-6><a href=#the-legend-element>legend</a></code> element.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-accesskey-attribute-on-a-legend-element-to-define-a-command:command-facet-checkedstate>Checked State</a> of the command is always
- false. (The command is never checked.)</p>
- <h5 id=using-the-accesskey-attribute-to-define-a-command-on-other-elements>4.11.6.10 <dfn>Using the <code>accesskey</code>
- attribute to define a command on other elements</dfn></h5>
- <p>An element that has an <a href=#assigned-access-key id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:assigned-access-key>assigned access key</a> <a href=#concept-command id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command>defines a
- command</a>.</p>
- <p>If one of the earlier sections that define elements that <a href=#concept-command id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command-2>define
- commands</a> define that this element <a href=#concept-command id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:concept-command-3>defines a command</a>,
- then that section applies to this element, and this section does not. Otherwise, this section
- applies to that element.</p>
- <p>The <a href=#command-facet-type id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-type>Type</a> of the command is "command".</p>
- <p>The <a href=#command-facet-id id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-id>ID</a> of the command is the value of the <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute of the element, if the attribute is present and not empty.
- Otherwise the command is an <a href=#anonymous-command id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:anonymous-command>anonymous command</a>.</p>
- <p>The <a href=#command-facet-label id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label>Label</a> of the command depends on the element. If
- the element is a <a href=#labeled-control id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:labeled-control>labeled control</a>, the <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:textcontent><a href=#textcontent>textContent</a></code> of the first
- <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:the-label-element><a href=#the-label-element>label</a></code> element in <a href=#tree-order id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:tree-order>tree order</a> whose <a href=#labeled-control id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:labeled-control-2>labeled control</a> is the
- element in question is the <a href=#command-facet-label id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label-2>Label</a> (in DOM terms, this is
- the string given by <code><var>element</var>.labels[0].textContent</code>). Otherwise,
- the <a href=#command-facet-label id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-label-3>Label</a> is the <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:textcontent-2><a href=#textcontent>textContent</a></code> of the element
- itself.</p>
- <p>The <a href=#command-facet-hint id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-hint>Hint</a> of the command is the value of the <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:attr-title><a href=#attr-title>title</a></code> attribute of the element. If the attribute is not present, the
- <a href=#command-facet-hint id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-hint-2>Hint</a> is the empty string.</p>
- <p>There is no <a href=#command-facet-icon id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-icon>Icon</a> for the command.</p>
- <p>The <a href=#command-facet-accesskey id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-accesskey>AccessKey</a> of the command is the element's
- <a href=#assigned-access-key id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:assigned-access-key-2>assigned access key</a>.</p>
- <p>The <a href=#command-facet-hiddenstate id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-hiddenstate>Hidden State</a> of the command is true (hidden)
- if the element has a <code id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute, and false otherwise.</p>
- <p>The <a href=#command-facet-disabledstate id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-disabledstate>Disabled State</a> of the command is true if
- the element or one of its ancestors is <a href=#inert id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:inert>inert</a>, and false otherwise.</p>
- <p>The <a href=#command-facet-checkedstate id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-checkedstate>Checked State</a> of the command is always
- false. (The command is never checked.)</p>
- <p>The <a href=#command-facet-action id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:command-facet-action>Action</a> of the command is to run the following
- steps:</p>
- <ol><li>Run the <a href=#focusing-steps id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:focusing-steps>focusing steps</a> for the element.<li>If the element has a defined <a href=#activation-behavior id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:activation-behavior>activation behavior</a>, <a href=#run-synthetic-click-activation-steps id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:run-synthetic-click-activation-steps>run synthetic click
- activation steps</a> on the element.<li>Otherwise, if the element does not have a defined <a href=#activation-behavior id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:activation-behavior-2>activation behavior</a>,
- <a href=#fire-a-click-event id=using-the-accesskey-attribute-to-define-a-command-on-other-elements:fire-a-click-event>fire a <code>click</code> event</a> at the element.</ol>
-
- <h4 id=the-dialog-element>4.11.7 The <dfn><code>dialog</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-dialog-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-dialog-element:flow-content-2>Flow content</a>.<dd><a href=#sectioning-root id=the-dialog-element:sectioning-root>Sectioning root</a>.<dt><a href=#concept-element-contexts id=the-dialog-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#flow-content-2 id=the-dialog-element:flow-content-2-2>flow content</a> is expected.<dt><a href=#concept-element-content-model id=the-dialog-element:concept-element-content-model>Content model</a>:<dd><a href=#flow-content-2 id=the-dialog-element:flow-content-2-3>Flow content</a>.<dt><a href=#concept-element-tag-omission id=the-dialog-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-dialog-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-dialog-element:global-attributes>Global attributes</a><dd><code id=the-dialog-element:attr-dialog-open><a href=#attr-dialog-open>open</a></code> — Whether the dialog box is showing<dt><a href=#concept-element-dom id=the-dialog-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmldialogelement>HTMLDialogElement</dfn> : <a href=#htmlelement id=the-dialog-element:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-dialog-open id=the-dialog-element:dom-dialog-open>open</a>;
- attribute DOMString <a href=#dom-dialog-returnvalue id=the-dialog-element:dom-dialog-returnvalue>returnValue</a>;
- void <a href=#dom-dialog-show id=the-dialog-element:dom-dialog-show>show</a>(optional (<a href=#mouseevent id=the-dialog-element:mouseevent>MouseEvent</a> or <a href=#element id=the-dialog-element:element>Element</a>) anchor);
- void <a href=#dom-dialog-showmodal id=the-dialog-element:dom-dialog-showmodal>showModal</a>(optional (<a href=#mouseevent id=the-dialog-element:mouseevent-2>MouseEvent</a> or <a href=#element id=the-dialog-element:element-2>Element</a>) anchor);
- void <a href=#dom-dialog-close id=the-dialog-element:dom-dialog-close>close</a>(optional DOMString returnValue);
- };</pre>
- </dl>
- <p>The <code id=the-dialog-element:the-dialog-element><a href=#the-dialog-element>dialog</a></code> element represents a part of an application that a user interacts with
- to perform a task, for example a dialog box, inspector, or window.</p>
- <p>The <dfn id=attr-dialog-open><code>open</code></dfn> attribute is a <a href=#boolean-attribute id=the-dialog-element:boolean-attribute>boolean
- attribute</a>. When specified, it indicates that the <code id=the-dialog-element:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element is active and
- that the user can interact with it.</p>
-
- <p>A <code id=the-dialog-element:the-dialog-element-3><a href=#the-dialog-element>dialog</a></code> element without an <code id=the-dialog-element:attr-dialog-open-2><a href=#attr-dialog-open>open</a></code> attribute
- specified should not be shown to the user. This requirement may be implemented indirectly through
- the style layer. For example, user agents that <a href=#renderingUA>support the suggested
- default rendering</a> implement this requirement using the CSS rules described in the <a href=#rendering>rendering section</a>.</p>
-
- <p>The <code id=the-dialog-element:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute must not be specified on
- <code id=the-dialog-element:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> elements.</p>
- <dl class=domintro><dt><var>dialog</var> . <code id=the-dialog-element:dom-dialog-show-2><a href=#dom-dialog-show>show</a></code>( [ <var>anchor</var> ] )<dd>
- <p>Displays the <code id=the-dialog-element:the-dialog-element-5><a href=#the-dialog-element>dialog</a></code> element.</p>
- <p>The argument, if provided, provides an anchor point to which the element will be fixed.</p>
- <dt><var>dialog</var> . <code id=the-dialog-element:dom-dialog-showmodal-2><a href=#dom-dialog-showmodal>showModal</a></code>( [ <var>anchor</var> ] )<dd>
- <p>Displays the <code id=the-dialog-element:the-dialog-element-6><a href=#the-dialog-element>dialog</a></code> element and makes it the top-most modal dialog.</p>
- <p>The argument, if provided, provides an anchor point to which the element will be fixed.</p>
- <p>This method honors the <code id=the-dialog-element:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code> attribute.</p>
- <dt><var>dialog</var> . <code id=the-dialog-element:dom-dialog-close-2><a href=#dom-dialog-close>close</a></code>( [ <var>result</var> ] )<dd>
- <p>Closes the <code id=the-dialog-element:the-dialog-element-7><a href=#the-dialog-element>dialog</a></code> element.</p>
- <p>The argument, if provided, provides a return value.</p>
- <dt><var>dialog</var> . <code id=the-dialog-element:dom-dialog-returnvalue-2><a href=#dom-dialog-returnvalue>returnValue</a></code> [ = <var>result</var> ]<dd>
- <p>Returns the <code id=the-dialog-element:the-dialog-element-8><a href=#the-dialog-element>dialog</a></code>'s return value.</p>
- <p>Can be set, to update the return value.</p>
- </dl>
-
- <p>When the <dfn id=dom-dialog-show><code>show()</code></dfn> method is invoked, the user
- agent must run the following steps:</p>
- <ol><li><p>If the element already has an <code id=the-dialog-element:attr-dialog-open-3><a href=#attr-dialog-open>open</a></code> attribute, then
- abort these steps.<li><p>Add an <code id=the-dialog-element:attr-dialog-open-4><a href=#attr-dialog-open>open</a></code> attribute to the <code id=the-dialog-element:the-dialog-element-9><a href=#the-dialog-element>dialog</a></code>
- element, whose value is the empty string.<li><p>If the <code id=the-dialog-element:dom-dialog-show-3><a href=#dom-dialog-show>show()</a></code> method was invoked with an argument,
- <a href=#set-up-the-position id=the-dialog-element:set-up-the-position>set up the position</a> of the <code id=the-dialog-element:the-dialog-element-10><a href=#the-dialog-element>dialog</a></code> element, using that argument as the
- anchor. Otherwise, set the <code id=the-dialog-element:the-dialog-element-11><a href=#the-dialog-element>dialog</a></code> to the <a href=#normal-alignment id=the-dialog-element:normal-alignment>normal alignment</a> mode.<li><p>Run the <a href=#dialog-focusing-steps id=the-dialog-element:dialog-focusing-steps>dialog focusing steps</a> for the <code id=the-dialog-element:the-dialog-element-12><a href=#the-dialog-element>dialog</a></code> element.</ol>
- <hr>
- <p>Each <code id=the-dialog-element:document><a href=#document>Document</a></code> has a stack of <code id=the-dialog-element:the-dialog-element-13><a href=#the-dialog-element>dialog</a></code> elements known as the
- <dfn id=pending-dialog-stack>pending dialog stack</dfn>. When a <code id=the-dialog-element:document-2><a href=#document>Document</a></code> is created, this stack must be
- initialised to be empty.</p>
- <p>When an element is added to the <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack>pending dialog stack</a>, it must also be added to the
- <a href=#top-layer id=the-dialog-element:top-layer>top layer</a> layer. When an element is removed from the <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-2>pending dialog
- stack</a>, it must be removed from the <a href=#top-layer id=the-dialog-element:top-layer-2>top layer</a>. <a href=#refsFULLSCREEN>[FULLSCREEN]</a></p>
- <p>When the <dfn id=dom-dialog-showmodal><code>showModal()</code></dfn> method is invoked,
- the user agent must run the following steps:</p>
- <ol><li><p>Let <var>subject</var> be the <code id=the-dialog-element:the-dialog-element-14><a href=#the-dialog-element>dialog</a></code> element on which the method was
- invoked.<li><p>If <var>subject</var> already has an <code id=the-dialog-element:attr-dialog-open-5><a href=#attr-dialog-open>open</a></code>
- attribute, then throw an <code id=the-dialog-element:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If <var>subject</var> is not <a href=#in-a-document id=the-dialog-element:in-a-document>in a <code>Document</code></a>, then throw
- an <code id=the-dialog-element:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Add an <code id=the-dialog-element:attr-dialog-open-6><a href=#attr-dialog-open>open</a></code> attribute to <var>subject</var>, whose value is the empty string.<li><p>If the <code id=the-dialog-element:dom-dialog-showmodal-3><a href=#dom-dialog-showmodal>showModal()</a></code> method was invoked with an
- argument, <a href=#set-up-the-position id=the-dialog-element:set-up-the-position-2>set up the position</a> of <var>subject</var>, using that argument
- as the anchor. Otherwise, set the <code id=the-dialog-element:the-dialog-element-15><a href=#the-dialog-element>dialog</a></code> to the <a href=#centered-alignment id=the-dialog-element:centered-alignment>centered alignment</a>
- mode.<li><p>Let <var>subject</var>'s <a id=the-dialog-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> be <a href=#blocked-by-a-modal-dialog id=the-dialog-element:blocked-by-a-modal-dialog>blocked by the modal dialog</a> <var>subject</var>.<li><p>Push <var>subject</var> onto <var>subject</var>'s
- <a id=the-dialog-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-3>pending dialog stack</a>.<li><p>Run the <a href=#dialog-focusing-steps id=the-dialog-element:dialog-focusing-steps-2>dialog focusing steps</a> for <var>subject</var>.</ol>
- <p>The <dfn id=dialog-focusing-steps>dialog focusing steps</dfn> for a <code id=the-dialog-element:the-dialog-element-16><a href=#the-dialog-element>dialog</a></code> element <var>subject</var> are as follows:</p>
- <ol><li><p>If for some reason <var>subject</var> is not a <a href=#control-group-owner id=the-dialog-element:control-group-owner>control group owner</a>
- at this point, or if it is <a href=#inert id=the-dialog-element:inert>inert</a>, abort these steps.<li>
- <p>Let <var>control</var> be the first non-<a href=#inert id=the-dialog-element:inert-2>inert</a> <a href=#focusable-area id=the-dialog-element:focusable-area>focusable area</a> in
- <var>subject</var>'s <a href=#control-group id=the-dialog-element:control-group>control group</a> whose <a href=#dom-anchor id=the-dialog-element:dom-anchor>DOM anchor</a> has an <code id=the-dialog-element:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code> attribute specified.</p>
- <p>If there isn't one, then let <var>control</var> be the first non-<a href=#inert id=the-dialog-element:inert-3>inert</a>
- <a href=#focusable-area id=the-dialog-element:focusable-area-2>focusable area</a> in <var>subject</var>'s <a href=#control-group id=the-dialog-element:control-group-2>control group</a>.</p>
- <p>If there isn't one of those either, then let <var>control</var> be <var>subject</var>.</p>
- <li><p>Run the <a href=#focusing-steps id=the-dialog-element:focusing-steps>focusing steps</a> for <var>control</var>.</ol>
- <p>If at any time a <code id=the-dialog-element:the-dialog-element-17><a href=#the-dialog-element>dialog</a></code> element is <a href=#remove-an-element-from-a-document id=the-dialog-element:remove-an-element-from-a-document>removed from a <code>Document</code></a>, then if that <code id=the-dialog-element:the-dialog-element-18><a href=#the-dialog-element>dialog</a></code> is in that
- <code id=the-dialog-element:document-3><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-4>pending dialog stack</a>, the following steps must be run:</p>
- <ol><li><p>Let <var>subject</var> be that <code id=the-dialog-element:the-dialog-element-19><a href=#the-dialog-element>dialog</a></code> element and <var>document</var> be the <code id=the-dialog-element:document-4><a href=#document>Document</a></code> from which it is being removed.<li><p>Remove <var>subject</var> from <var>document</var>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-5>pending
- dialog stack</a>.<li><p>If <var>document</var>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-6>pending dialog stack</a> is not empty, then let
- <var>document</var> be <a href=#blocked-by-a-modal-dialog id=the-dialog-element:blocked-by-a-modal-dialog-2>blocked by the modal
- dialog</a> that is at the top of <var>document</var>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-7>pending dialog
- stack</a>. Otherwise, let <var>document</var> be no longer <a href=#blocked-by-a-modal-dialog id=the-dialog-element:blocked-by-a-modal-dialog-3>blocked by a modal
- dialog</a> at all.</ol>
- <p>When the <dfn id=dom-dialog-close><code>close()</code></dfn> method is invoked, the user
- agent must <a href=#close-the-dialog id=the-dialog-element:close-the-dialog>close the dialog</a> that the method was invoked on. If the method was invoked
- with an argument, that argument must be used as the return value; otherwise, there is no return
- value.</p>
- <p>When a <code id=the-dialog-element:the-dialog-element-20><a href=#the-dialog-element>dialog</a></code> element <var>subject</var> is to be <dfn id=close-the-dialog>closed</dfn>, optionally with a return value <var>result</var>, the user agent
- must run the following steps:</p>
- <ol><li><p>If <var>subject</var> does not have an <code id=the-dialog-element:attr-dialog-open-7><a href=#attr-dialog-open>open</a></code>
- attribute, then abort these steps.<li><p>Remove <var>subject</var>'s <code id=the-dialog-element:attr-dialog-open-8><a href=#attr-dialog-open>open</a></code>
- attribute.<li><p>If the argument <var>result</var> was provided, then set the <code id=the-dialog-element:dom-dialog-returnvalue-3><a href=#dom-dialog-returnvalue>returnValue</a></code> attribute to the value of <var>result</var>.<li>
- <p>If <var>subject</var> is in its <code id=the-dialog-element:document-5><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-8>pending dialog
- stack</a>, then run these substeps:</p>
- <ol><li><p>Remove <var>subject</var> from that <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-9>pending dialog stack</a>.<li><p>If that <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-10>pending dialog stack</a> is not empty, then let <var>subject</var>'s <a id=the-dialog-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> be <a href=#blocked-by-a-modal-dialog id=the-dialog-element:blocked-by-a-modal-dialog-4>blocked by the modal dialog</a> that is at the top of the <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-11>pending dialog
- stack</a>. Otherwise, let <var>document</var> be no longer <a href=#blocked-by-a-modal-dialog id=the-dialog-element:blocked-by-a-modal-dialog-5>blocked by a modal
- dialog</a> at all.</ol>
- <li><p><a href=#queue-a-task id=the-dialog-element:queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event id=the-dialog-element:fire-a-simple-event>fire a simple event</a> named <code id=the-dialog-element:event-close><a href=#event-close>close</a></code> at <var>subject</var>.</ol>
- <p>The <dfn id=dom-dialog-returnvalue><code>returnValue</code></dfn> IDL attribute, on
- getting, must return the last value to which it was set. On setting, it must be set to the new
- value. When the element is created, it must be set to the empty string.</p>
- <hr>
- <p><strong>Canceling dialogs</strong>: When a <code id=the-dialog-element:document-6><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-12>pending dialog
- stack</a> is not empty, user agents may provide a user interface that, upon activation, <a href=#queue-a-task id=the-dialog-element:queue-a-task-2>queues a task</a> to <a href=#fire-a-simple-event id=the-dialog-element:fire-a-simple-event-2>fire a simple event</a> named <code id=the-dialog-element:event-cancel><a href=#event-cancel>cancel</a></code> that is cancelable at the top <code id=the-dialog-element:the-dialog-element-21><a href=#the-dialog-element>dialog</a></code> element on
- the <code id=the-dialog-element:document-7><a href=#document>Document</a></code>'s <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-13>pending dialog stack</a>. The default action of this event
- must be to check if that element has an <code id=the-dialog-element:attr-dialog-open-9><a href=#attr-dialog-open>open</a></code> attribute, and
- if it does, <a href=#close-the-dialog id=the-dialog-element:close-the-dialog-2>close the dialog</a> with no return value.</p>
- <p class=note>An example of such a UI mechanism would be the user pressing the "Escape" key.</p>
- <hr>
- <p>All <code id=the-dialog-element:the-dialog-element-22><a href=#the-dialog-element>dialog</a></code> elements are always in one of three modes: <dfn id=normal-alignment>normal alignment</dfn>,
- <dfn id=centered-alignment>centered alignment</dfn>, and <dfn id=magic-alignment>magic alignment</dfn>. When a <code id=the-dialog-element:the-dialog-element-23><a href=#the-dialog-element>dialog</a></code> element
- is created, it must be placed in the <a href=#normal-alignment id=the-dialog-element:normal-alignment-2>normal alignment</a> mode. In this mode, normal CSS
- requirements apply to the element. The <a href=#centered-alignment id=the-dialog-element:centered-alignment-2>centered alignment</a> mode is only used for
- <code id=the-dialog-element:the-dialog-element-24><a href=#the-dialog-element>dialog</a></code> elements that are in the <a href=#top-layer id=the-dialog-element:top-layer-3>top layer</a>. <a href=#refsFULLSCREEN>[FULLSCREEN]</a> <a href=#refsCSS>[CSS]</a></p>
- <p>When an element <var>subject</var> is placed in <a href=#centered-alignment id=the-dialog-element:centered-alignment-3>centered alignment</a> mode,
- and when it is in that mode and has new rendering boxes created, the user agent must set up the
- element such that its top static position, for the purposes of calculating the used value of the
- 'top' property, is the value that would place the element's top margin edge as far from the top of
- the viewport as the element's bottom margin edge from the bottom of the viewport, if the element's
- height is less than the height of the viewport, and otherwise is the value that would place the
- element's top margin edge at the top of the viewport.</p>
- <p>If there is a <code id=the-dialog-element:the-dialog-element-25><a href=#the-dialog-element>dialog</a></code> element with <a href=#centered-alignment id=the-dialog-element:centered-alignment-4>centered alignment</a> and that is
- <a href=#being-rendered id=the-dialog-element:being-rendered>being rendered</a> when its <a href=#browsing-context id=the-dialog-element:browsing-context>browsing context</a> changes viewport width (as
- measured in CSS pixels), then the user agent must recreate the element's boxes, recalculating its
- top static position as in the previous paragraph.</p>
- <p>This top static position of a <code id=the-dialog-element:the-dialog-element-26><a href=#the-dialog-element>dialog</a></code> element with <a href=#centered-alignment id=the-dialog-element:centered-alignment-5>centered alignment</a>
- must remain the element's top static position until its boxes are recreated. (The element's static
- position is only used in calculating the used value of the 'top' property in certain situations;
- it's not used, for instance, to position the element if its 'position' property is set to
- 'static'.)</p>
- <p>When a user agent is to <dfn id=set-up-the-position>set up the position</dfn> of an element <var>subject</var> using an anchor <var>anchor</var>, it must run the following
- steps:</p>
- <ol><li>
- <p>If <var>anchor</var> is a <code id=the-dialog-element:mouseevent-3><a href=#mouseevent>MouseEvent</a></code> object, then run these
- substeps:</p>
- <ol><li><p>If <var>anchor</var>'s target element does not have a rendered box, or is in a
- different document than <var>subject</var>, then let <var>subject</var> be
- in the <a href=#centered-alignment id=the-dialog-element:centered-alignment-6>centered alignment</a> mode, and abort the <a href=#set-up-the-position id=the-dialog-element:set-up-the-position-3>set up the position</a>
- steps.<li><p>Let <var>anchor element</var> be an anonymous element rendered as a box with
- zero height and width (so its margin and border boxes both just form a point), positioned so
- that its top and left are at the coordinate identified by the event, and whose properties all
- compute to their initial values.</ol>
- <p>Otherwise, let <var>anchor element</var> be <var>anchor</var>.</p>
- <li><p>Put <var>subject</var> in the <a href=#magic-alignment id=the-dialog-element:magic-alignment>magic alignment</a> mode, aligned to <var>anchor element</var>.</ol>
- <p>While an element <var>A</var> has <a href=#magic-alignment id=the-dialog-element:magic-alignment-2>magic alignment</a>, aligned to an element
- <var>B</var>, the following requirements apply:</p>
- <ul><li>
- <p>If at any time either <var>A</var> or <var>B</var> cease having rendered
- boxes, <var>A</var> and <var>B</var> cease being in the same
- <code id=the-dialog-element:document-8><a href=#document>Document</a></code>, or <var>B</var> ceases being earlier than <var>A</var> in <a href=#tree-order id=the-dialog-element:tree-order>tree order</a>, then, if <var>subject</var> is in the
- <a href=#pending-dialog-stack id=the-dialog-element:pending-dialog-stack-14>pending dialog stack</a>, let <var>subject</var>'s mode become <a href=#centered-alignment id=the-dialog-element:centered-alignment-7>centered
- alignment</a>, otherwise, let <var>subject</var>'s mode become <a href=#normal-alignment id=the-dialog-element:normal-alignment-3>normal
- alignment</a>.</p>
- <li>
- <p><var>A</var>'s 'position' property must compute to the keyword '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored>absolute-anchored</a>' rather than whatever it would
- otherwise compute to (i.e. the 'position' property's specified value is ignored).</p>
- <p class=note>The '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-2>absolute-anchored</a>'
- keyword's requirements are described below.</p>
- <li>
- <p>The anchor points for <var>A</var> and <var>B</var> are defined as per the
- appropriate entry in the following list:</p>
- <dl class=switch><dt>If the computed value of 'anchor-point' is 'none' on both <var>A</var> and <var>B</var>
- <dd>
- <p>The anchor points of <var>A</var> and <var>B</var> are the center points
- of their respective first boxes' border boxes.
- <dt>If the computed value of 'anchor-point' is 'none' on <var>A</var> and a specific
- point on <var>B</var>
- <dd>
- <p>The anchor point of <var>B</var> is the point given by its 'anchor-point'
- property.
- <p>If the anchor point of <var>B</var> is the center point of <var>B</var>'s
- first box's border box, then <var>A</var>'s anchor point is the center point of its
- first box's margin box.
- <p>Otherwise, <var>A</var>'s anchor point is on one of its margin edges. Consider
- four hypothetical half-infinite lines L1, L2, L3, and L4 that each start in the center of <var>B</var>'s first box's border box, and that extend respectively through the top left
- corner, top right corner, bottom right corner, and bottom left corner of <var>B</var>'s first box's border box. <var>A</var>'s anchor point is determined
- by the location of <var>B</var>'s anchor point relative to these four hypothetical
- lines, as follows:
- <p>If the anchor point of <var>B</var> lies on L1 or L2, or inside the area bounded
- by L1 and L2 that also contains the points above <var>B</var>'s first box's border
- box, then let <var>A</var>'s anchor point be the horizontal center of <var>A</var>'s bottom margin edge.</p>
- <p>Otherwise, if the anchor point of <var>B</var> lies on L3 or L4, or inside the
- area bounded by L4 and L4 that also contains the points below <var>B</var>'s first
- box's border box, then let <var>A</var>'s anchor point be the horizontal center of
- <var>A</var>'s top margin edge.</p>
- <p>Otherwise, if the anchor point of <var>B</var> lies inside the area bounded by L4
- and L1 that also contains the points to the left of <var>B</var>'s first box's border
- box, then let <var>A</var>'s anchor point be the vertical center of <var>A</var>'s right margin edge.</p>
- <p>Otherwise, the anchor point of <var>B</var> lies inside the area bounded by L2 and
- L3 that also contains the points to the right of <var>B</var>'s first box's border
- box; let <var>A</var>'s anchor point be the vertical center of <var>A</var>'s left margin edge.</p>
- <dt>If the computed value of 'anchor-point' is a specific point on <var>A</var> and
- 'none' on <var>B</var>
- <dd>
- <p>The anchor point of <var>A</var> is the point given by its 'anchor-point'
- property.
- <p>If the anchor point of <var>A</var> is the center point of <var>A</var>'s
- first box's margin box, then <var>B</var>'s anchor point is the center point of its
- first box's border box.
- <p>Otherwise, <var>B</var>'s anchor point is on one of its border edges. Consider
- four hypothetical half-infinite lines L1, L2, L3, and L4 that each start in the center of <var>A</var>'s first box's margin box, and that extend respectively through the top left
- corner, top right corner, bottom right corner, and bottom left corner of <var>A</var>'s first box's margin box. <var>B</var>'s anchor point is determined
- by the location of <var>A</var>'s anchor point relative to these four hypothetical
- lines, as follows:
- <p>If the anchor point of <var>A</var> lies on L1 or L2, or inside the area bounded
- by L1 and L2 that also contains the points above <var>A</var>'s first box's margin
- box, then let <var>B</var>'s anchor point be the horizontal center of <var>B</var>'s bottom border edge.</p>
- <p>Otherwise, if the anchor point of <var>A</var> lies on L3 or L4, or inside the
- area bounded by L4 and L4 that also contains the points below <var>A</var>'s first
- box's margin box, then let <var>B</var>'s anchor point be the horizontal center of
- <var>B</var>'s top border edge.</p>
- <p>Otherwise, if the anchor point of <var>A</var> lies inside the area bounded by L4
- and L1 that also contains the points to the left of <var>A</var>'s first box's margin
- box, then let <var>B</var>'s anchor point be the vertical center of <var>B</var>'s right border edge.</p>
- <p>Otherwise, the anchor point of <var>A</var> lies inside the area bounded by L2 and
- L3 that also contains the points to the right of <var>A</var>'s first box's margin
- box; let <var>B</var>'s anchor point be the vertical center of <var>B</var>'s left border edge.</p>
- <dt>If the computed value of 'anchor-point' is a specific point on both <var>A</var>
- and <var>B</var>
- <dd>
- <p>The anchor points of <var>A</var> and <var>B</var> are the points given
- by their respective 'anchor-point' properties.
- </dl>
- <p class=note>The rules above generally use <var>A</var>'s <em>margin</em> box, but
- <var>B</var>'s <em>border</em> box. This is because while <var>A</var> always
- has a margin box, and using the margin box allows for the dialog to be positioned offset from
- the box it is annotating, <var>B</var> sometimes does not have a margin box (e.g. if it
- is a table-cell), or has a margin box whose position may be not entirely clear (e.g. in the face
- of margin collapsing and 'clear' handling of in-flow blocks).</p>
- <p>In cases where <var>B</var> does not have a border box but its border box is used by
- the algorithm above, user agents must use its first box's content area instead. (This is in
- particular an issue with boxes in tables that have 'border-collapse' set to 'collapse'.)</p>
- <li>
- <p>When an element's 'position' property computes to '<dfn id=css-position-absolute-anchored>absolute-anchored</dfn>', the 'float' property does not
- apply and must compute to 'none', the 'display' property must compute to a value as described by
- the table in <a href=http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo>the section of CSS
- 2.1 describing the <cite>relationships between 'display', 'position', and 'float'</cite></a>,
- and the element's box must be positioned using the rules for absolute positioning but with its
- static position set such that if the box is positioned in its static position, its anchor point
- is exactly aligned over the anchor point of the element to which it is <a href=#magic-alignment id=the-dialog-element:magic-alignment-3>magically aligned</a>. Elements aligned in this way are <i>absolutely
- positioned</i>. For the purposes of determining the containing block of other elements, the
- '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-3>absolute-anchored</a>' keyword must be treated
- like the 'absolute' keyword.</p>
- </ul>
- <p class=note>The trivial example of an element that does not have a rendered box is one whose
- 'display' property computes to 'none'. However, there are many other cases; e.g. table columns do
- not have boxes (their properties merely affect other boxes).</p>
- <p class=note>If an element to which another element is anchored changes rendering, the anchored
- element will be be repositioned accordingly. (In other words, the requirements above are live,
- they are not just calculated once per anchored element.)</p>
- <p class=note>The '<a href=#css-position-absolute-anchored id=the-dialog-element:css-position-absolute-anchored-4>absolute-anchored</a>'
- keyword is not a keyword that can be specified in CSS; the 'position' property can only compute to
- this value if the <code id=the-dialog-element:the-dialog-element-27><a href=#the-dialog-element>dialog</a></code> element is positioned via the APIs described above.</p>
- <p>User agents in visual interactive media should allow the user to pan the viewport to access all
- parts of a <code id=the-dialog-element:the-dialog-element-28><a href=#the-dialog-element>dialog</a></code> element's border box, even if the element is larger than the
- viewport and the viewport would otherwise not have a scroll mechanism (e.g. because the viewport's
- 'overflow' property is set to 'hidden').</p>
- <hr>
- <p>The <dfn id=dom-dialog-open><code>open</code></dfn> IDL attribute must
- <a href=#reflect id=the-dialog-element:reflect>reflect</a> the <code id=the-dialog-element:attr-dialog-open-10><a href=#attr-dialog-open>open</a></code> content attribute.</p>
-
- <h5 id=anchor-points>4.11.7.1 Anchor points</h5>
- <p class=critical>This section will eventually be moved to a CSS specification; it is specified
- here only on an interim basis until an editor can be found to own this.</p>
- <table class=css-property><caption>'anchor-point'</caption><tr><th>Value:
- <td> none | <position>
- <tr><th>Initial:
- <td> none
- <tr><th>Applies to:
- <td> all elements
- <tr><th>Inherited:
- <td> no
- <tr><th>Percentages:
- <td> refer to width or height of box; see prose
- <tr><th>Media:
- <td> visual
- <tr><th>Computed value:
- <td> The specified value, but with any lengths replaced by their corresponding absolute length
- <tr><th>Animatable:
- <td> no
- <tr><th>Canonical order:
- <td> per grammar
- </table>
- <p>The 'anchor-point' property specifies a point to which dialog boxes are to be aligned.</p>
- <p>If the value is a <position>, the anchor point is the point given by the value, which
- must be interpreted relative to the element's first rendered box's margin box. Percentages must be
- calculated relative to the element's first rendered box's margin box (specifically, its width for
- the horizontal position and its height for the vertical position). <a href=#refsCSSVALUES>[CSSVALUES]</a> <a href=#refsCSS>[CSS]</a></p>
- <p>If the value is the keyword 'none', then no explicit anchor point is defined. The user agent
- will pick an anchor point automatically if necessary (as described in the definition of the
- <code id=anchor-points:dom-dialog-open><a href=#dom-dialog-open>open()</a></code> method above).</p>
- <h3 id=scripting-3>4.12 Scripting</h3>
- <p>Scripts allow authors to add interactivity to their documents.</p>
- <p>Authors are encouraged to use declarative alternatives to scripting where possible, as
- declarative mechanisms are often more maintainable, and many users disable scripting.</p>
- <div class=example>
- <p>For example, instead of using script to show or hide a section to show more details, the
- <code id=scripting-3:the-details-element><a href=#the-details-element>details</a></code> element could be used.</p>
- </div>
- <p>Authors are also encouraged to make their applications degrade gracefully in the absence of
- scripting support.</p>
- <div class=example>
- <p>For example, if an author provides a link in a table header to dynamically resort the table,
- the link could also be made to function without scripts by requesting the sorted table from the
- server.</p>
- </div>
- <h4 id=the-script-element>4.12.1 The <dfn id=script><code>script</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-script-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-script-element:metadata-content-2>Metadata content</a>.<dd><a href=#flow-content-2 id=the-script-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-script-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#script-supporting-elements-2 id=the-script-element:script-supporting-elements-2>Script-supporting element</a>.<dt><a href=#concept-element-contexts id=the-script-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#metadata-content-2 id=the-script-element:metadata-content-2-2>metadata content</a> is expected.<dd>Where <a href=#phrasing-content-2 id=the-script-element:phrasing-content-2-2>phrasing content</a> is expected.<dd>Where <a href=#script-supporting-elements-2 id=the-script-element:script-supporting-elements-2-2>script-supporting elements</a> are expected.<dt><a href=#concept-element-content-model id=the-script-element:concept-element-content-model>Content model</a>:<dd>If there is no <code id=the-script-element:attr-script-src><a href=#attr-script-src>src</a></code>
- attribute, depends on the value of the <code id=the-script-element:attr-script-type><a href=#attr-script-type>type</a></code> attribute, but must match
- <a href=#restrictions-for-contents-of-script-elements id=the-script-element:restrictions-for-contents-of-script-elements>script content restrictions</a>.<dd>If there <em>is</em> a <code id=the-script-element:attr-script-src-2><a href=#attr-script-src>src</a></code>
- attribute, the element must be either empty or contain only
- <a href=#inline-documentation-for-external-scripts id=the-script-element:inline-documentation-for-external-scripts>script documentation</a> that also matches <a href=#restrictions-for-contents-of-script-elements id=the-script-element:restrictions-for-contents-of-script-elements-2>script
- content restrictions</a>.<dt><a href=#concept-element-tag-omission id=the-script-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-script-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-script-element:global-attributes>Global attributes</a><dd><code id=the-script-element:attr-script-src-3><a href=#attr-script-src>src</a></code> — Address of the resource<dd><code id=the-script-element:attr-script-type-2><a href=#attr-script-type>type</a></code> — Type of embedded resource<dd><code id=the-script-element:attr-script-charset><a href=#attr-script-charset>charset</a></code> — Character encoding of the external script resource<dd><code id=the-script-element:attr-script-async><a href=#attr-script-async>async</a></code> — Execute script asynchronously<dd><code id=the-script-element:attr-script-defer><a href=#attr-script-defer>defer</a></code> — Defer script execution<dd><code id=the-script-element:attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code> — How the element handles crossorigin requests<dt><a href=#concept-element-dom id=the-script-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmlscriptelement>HTMLScriptElement</dfn> : <a href=#htmlelement id=the-script-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-script-src id=the-script-element:dom-script-src>src</a>;
- attribute DOMString <a href=#dom-script-type id=the-script-element:dom-script-type>type</a>;
- attribute DOMString <a href=#dom-script-charset id=the-script-element:dom-script-charset>charset</a>;
- attribute boolean <a href=#dom-script-async id=the-script-element:dom-script-async>async</a>;
- attribute boolean <a href=#dom-script-defer id=the-script-element:dom-script-defer>defer</a>;
- attribute DOMString? <a href=#dom-script-crossorigin id=the-script-element:dom-script-crossorigin>crossOrigin</a>;
- attribute DOMString <a href=#dom-script-text id=the-script-element:dom-script-text>text</a>;
- // <a href="#HTMLScriptElement-partial">also has obsolete members</a>
- };</pre>
- </dl>
- <p>The <code id=the-script-element:the-script-element><a href=#the-script-element>script</a></code> element allows authors to include dynamic script and data blocks in
- their documents. The element does not <a href=#represents id=the-script-element:represents>represent</a> content for the
- user.</p>
- <p>When used to include dynamic scripts, the scripts may either be embedded inline or may be
- imported from an external file using the <code id=the-script-element:attr-script-src-4><a href=#attr-script-src>src</a></code> attribute. If
- the language is not that described by "<code>text/javascript</code>", then the <code id=the-script-element:attr-script-type-3><a href=#attr-script-type>type</a></code> attribute must be present, as described below. Whatever
- language is used, the contents of the <code id=the-script-element:the-script-element-2><a href=#the-script-element>script</a></code> element must conform with the
- requirements of that language's specification.</p>
- <p>When used to include data blocks (as opposed to scripts), the data must be embedded inline, the
- format of the data must be given using the <code id=the-script-element:attr-script-type-4><a href=#attr-script-type>type</a></code> attribute,
- the <code id=the-script-element:attr-script-src-5><a href=#attr-script-src>src</a></code> attribute must not be specified, and the contents of
- the <code id=the-script-element:the-script-element-3><a href=#the-script-element>script</a></code> element must conform to the requirements defined for the format used.</p>
- <p>The <dfn id=attr-script-type><code>type</code></dfn> attribute gives the language of the
- script or format of the data. If the attribute is present, its value must be a <a href=#valid-mime-type id=the-script-element:valid-mime-type>valid MIME
- type</a>. The <code>charset</code> parameter must not be specified. The default, which
- is used if the attribute is absent, is "<code>text/javascript</code>".</p>
- <p>The <dfn id=attr-script-src><code>src</code></dfn> attribute, if specified, gives the
- address of the external script resource to use. The value of the attribute must be a <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=the-script-element:valid-non-empty-url-potentially-surrounded-by-spaces>valid
- non-empty URL potentially surrounded by spaces</a> identifying a script resource of the type
- given by the <code id=the-script-element:attr-script-type-5><a href=#attr-script-type>type</a></code> attribute, if the attribute is present, or
- of the type "<code>text/javascript</code>", if the attribute is absent. A resource is a
- script resource of a given type if that type identifies a scripting language and the resource
- conforms with the requirements of that language's specification.</p>
- <p>The <dfn id=attr-script-charset><code>charset</code></dfn> attribute gives the character
- encoding of the external script resource. The attribute must not be specified if the <code id=the-script-element:attr-script-src-6><a href=#attr-script-src>src</a></code> attribute is not present. If the attribute is set, its value
- must be an <a href=#ascii-case-insensitive id=the-script-element:ascii-case-insensitive>ASCII case-insensitive</a> match for one of the <a href=#encoding-label id=the-script-element:encoding-label>labels</a> of an <a href=#encoding id=the-script-element:encoding>encoding</a>, and must specify the same <a href=#encoding id=the-script-element:encoding-2>encoding</a> as
- the <code>charset</code> parameter of the <a href=#content-type id=the-script-element:content-type>Content-Type
- metadata</a> of the external file, if any. <a href=#refsENCODING>[ENCODING]</a></p>
- <p>The <dfn id=attr-script-async><code>async</code></dfn> and <dfn id=attr-script-defer><code>defer</code></dfn> attributes are <a href=#boolean-attribute id=the-script-element:boolean-attribute>boolean attributes</a> that indicate how the script should be executed. The <code id=the-script-element:attr-script-defer-2><a href=#attr-script-defer>defer</a></code> and <code id=the-script-element:attr-script-async-2><a href=#attr-script-async>async</a></code> attributes
- must not be specified if the <code id=the-script-element:attr-script-src-7><a href=#attr-script-src>src</a></code> attribute is not
- present.</p>
- <p>There are three possible modes that can be selected using these attributes. If the <code id=the-script-element:attr-script-async-3><a href=#attr-script-async>async</a></code> attribute is present, then the script will be executed
- asynchronously, as soon as it is available. If the <code id=the-script-element:attr-script-async-4><a href=#attr-script-async>async</a></code>
- attribute is not present but the <code id=the-script-element:attr-script-defer-3><a href=#attr-script-defer>defer</a></code> attribute is
- present, then the script is executed when the page has finished parsing. If neither attribute is
- present, then the script is fetched and executed immediately, before the user agent continues
- parsing the page.</p>
- <p class=note>The exact processing details for these attributes are, for mostly historical
- reasons, somewhat non-trivial, involving a number of aspects of HTML. The implementation
- requirements are therefore by necessity scattered throughout the specification. The algorithms
- below (in this section) describe the core of this processing, but these algorithms reference and
- are referenced by the parsing rules for <code id=the-script-element:the-script-element-4><a href=#the-script-element>script</a></code> <a href=#scriptTag>start</a> and <a href=#scriptEndTag>end</a> tags in HTML, <a href=#scriptForeignEndTag>in foreign content</a>,
- and <a href=#scriptTagXML>in XML</a>, the rules for the <code id=the-script-element:dom-document-write><a href=#dom-document-write>document.write()</a></code> method, the handling of <a href=#scripting>scripting</a>, etc.</p>
- <p>The <code id=the-script-element:attr-script-defer-4><a href=#attr-script-defer>defer</a></code> attribute may be specified even if the <code id=the-script-element:attr-script-async-5><a href=#attr-script-async>async</a></code> attribute is specified, to cause legacy Web browsers that
- only support <code id=the-script-element:attr-script-defer-5><a href=#attr-script-defer>defer</a></code> (and not <code id=the-script-element:attr-script-async-6><a href=#attr-script-async>async</a></code>) to fall back to the <code id=the-script-element:attr-script-defer-6><a href=#attr-script-defer>defer</a></code> behavior instead of the synchronous blocking behavior that
- is the default.</p>
- <p>The <dfn id=attr-script-crossorigin><code>crossorigin</code></dfn> attribute is a
- <a href=#cors-settings-attribute id=the-script-element:cors-settings-attribute>CORS settings attribute</a>. It controls, for scripts that are obtained from other <a href=#origin-2 id=the-script-element:origin-2>origins</a>, whether error information will be exposed.</p>
- <p>Changing the <code id=the-script-element:attr-script-src-8><a href=#attr-script-src>src</a></code>, <code id=the-script-element:attr-script-type-6><a href=#attr-script-type>type</a></code>, <code id=the-script-element:attr-script-charset-2><a href=#attr-script-charset>charset</a></code>, <code id=the-script-element:attr-script-async-7><a href=#attr-script-async>async</a></code>, <code id=the-script-element:attr-script-defer-7><a href=#attr-script-defer>defer</a></code>, and <code id=the-script-element:attr-script-crossorigin-2><a href=#attr-script-crossorigin>crossorigin</a></code> attributes dynamically has no direct effect;
- these attribute are only used at specific times described below.</p>
-
- <p>A <code id=the-script-element:the-script-element-5><a href=#the-script-element>script</a></code> element has several associated pieces of state.</p>
- <p>The first is a flag indicating whether or not the script block has been <dfn id=already-started>"already
- started"</dfn>. Initially, <code id=the-script-element:the-script-element-6><a href=#the-script-element>script</a></code> elements must have this flag unset (script blocks,
- when created, are not "already started"). The <a href=#concept-node-clone-ext id=the-script-element:concept-node-clone-ext>cloning
- steps</a> for <code id=the-script-element:the-script-element-7><a href=#the-script-element>script</a></code> elements must set the "already started" flag on the copy if
- it is set on the element being cloned.</p>
- <p>The second is a flag indicating whether the element was <dfn id=parser-inserted>"parser-inserted"</dfn>.
- Initially, <code id=the-script-element:the-script-element-8><a href=#the-script-element>script</a></code> elements must have this flag unset. It is set by the <a href=#html-parser id=the-script-element:html-parser>HTML
- parser</a> and the <a href=#xml-parser id=the-script-element:xml-parser>XML parser</a> on <code id=the-script-element:the-script-element-9><a href=#the-script-element>script</a></code> elements they insert and
- affects the processing of those elements.</p>
- <p>The third is a flag indicating whether the element will <dfn id=force-async>"force-async"</dfn>. Initially,
- <code id=the-script-element:the-script-element-10><a href=#the-script-element>script</a></code> elements must have this flag set. It is unset by the <a href=#html-parser id=the-script-element:html-parser-2>HTML parser</a>
- and the <a href=#xml-parser id=the-script-element:xml-parser-2>XML parser</a> on <code id=the-script-element:the-script-element-11><a href=#the-script-element>script</a></code> elements they insert. In addition, whenever
- a <code id=the-script-element:the-script-element-12><a href=#the-script-element>script</a></code> element whose <a href=#force-async id=the-script-element:force-async>"force-async"</a> flag is set has a <code id=the-script-element:attr-script-async-8><a href=#attr-script-async>async</a></code> content attribute added, the element's
- <a href=#force-async id=the-script-element:force-async-2>"force-async"</a> flag must be unset.</p>
- <p>The fourth is a flag indicating whether or not the script block is <dfn id=ready-to-be-parser-executed>"ready to be
- parser-executed"</dfn>. Initially, <code id=the-script-element:the-script-element-13><a href=#the-script-element>script</a></code> elements must have this flag unset (script
- blocks, when created, are not "ready to be parser-executed"). This flag is used only for elements
- that are also <a href=#parser-inserted id=the-script-element:parser-inserted>"parser-inserted"</a>, to let the parser know when to execute the
- script.</p>
- <p>The last few pieces of state are <dfn id=concept-script-type><var>the script block's
- type</var></dfn>, <dfn id=concept-script-encoding><var>the script block's character
- encoding</var></dfn>, and <dfn id=concept-script-fallback-encoding><var>the script block's
- fallback character encoding</var></dfn>. They are determined when the script is prepared, based on
- the attributes on the element at that time, and the
- <code id=the-script-element:the-script-element-14><a href=#the-script-element>script</a></code> element's <a id=the-script-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
- <p>When a <code id=the-script-element:the-script-element-15><a href=#the-script-element>script</a></code> element that is not marked as being <a href=#parser-inserted id=the-script-element:parser-inserted-2>"parser-inserted"</a>
- experiences one of the events listed in the following list, the user agent must synchronously
- <a href=#prepare-a-script id=the-script-element:prepare-a-script>prepare</a> the <code id=the-script-element:the-script-element-16><a href=#the-script-element>script</a></code> element:</p>
- <ul><li>The <code id=the-script-element:the-script-element-17><a href=#the-script-element>script</a></code> element gets <a href=#insert-an-element-into-a-document id=the-script-element:insert-an-element-into-a-document>inserted
- into a document</a>, at the time the <a href=#nodes-are-inserted id=the-script-element:nodes-are-inserted>node is inserted</a>
- according to the DOM, after any other <code id=the-script-element:the-script-element-18><a href=#the-script-element>script</a></code> elements inserted at the same time that
- are earlier in the <code id=the-script-element:document><a href=#document>Document</a></code> in <a href=#tree-order id=the-script-element:tree-order>tree order</a>.<li>The <code id=the-script-element:the-script-element-19><a href=#the-script-element>script</a></code> element is <a href=#in-a-document id=the-script-element:in-a-document>in a <code>Document</code></a> and a node or
- document fragment is <a href=#nodes-are-inserted id=the-script-element:nodes-are-inserted-2>inserted</a> into the
- <code id=the-script-element:the-script-element-20><a href=#the-script-element>script</a></code> element, after any <code id=the-script-element:the-script-element-21><a href=#the-script-element>script</a></code> elements <a href=#nodes-are-inserted id=the-script-element:nodes-are-inserted-3>inserted</a> at that time.<li>The <code id=the-script-element:the-script-element-22><a href=#the-script-element>script</a></code> element is <a href=#in-a-document id=the-script-element:in-a-document-2>in a <code>Document</code></a> and has a <code id=the-script-element:attr-script-src-9><a href=#attr-script-src>src</a></code> attribute set where previously the element had no such
- attribute.</ul>
- <p>To <dfn id=prepare-a-script>prepare a script</dfn>, the user agent must act as
- follows:</p>
- <ol><li>
- <p>If the <code id=the-script-element:the-script-element-23><a href=#the-script-element>script</a></code> element is marked as having <a href=#already-started id=the-script-element:already-started>"already started"</a>, then
- the user agent must abort these steps at this point. The script is not executed.</p>
- <li>
- <p>If the element has its <a href=#parser-inserted id=the-script-element:parser-inserted-3>"parser-inserted"</a> flag set, then set <var>was-parser-inserted</var> to true and unset the element's
- <a href=#parser-inserted id=the-script-element:parser-inserted-4>"parser-inserted"</a> flag. Otherwise, set <var>was-parser-inserted</var> to
- false.</p>
- <p class=note>This is done so that if parser-inserted <code id=the-script-element:the-script-element-24><a href=#the-script-element>script</a></code> elements fail to run
- when the parser tries to run them, e.g. because they are empty or specify an unsupported
- scripting language, another script can later mutate them and cause them to run again.</p>
-
- <li>
- <p>If <var>was-parser-inserted</var> is true and the element does not have an <code id=the-script-element:attr-script-async-9><a href=#attr-script-async>async</a></code> attribute, then set the element's
- <a href=#force-async id=the-script-element:force-async-3>"force-async"</a> flag to true.</p>
- <p class=note>This is done so that if a parser-inserted <code id=the-script-element:the-script-element-25><a href=#the-script-element>script</a></code> element fails to
- run when the parser tries to run it, but it is later executed after a script dynamically updates
- it, it will execute asynchronously even if the <code id=the-script-element:attr-script-async-10><a href=#attr-script-async>async</a></code>
- attribute isn't set.</p>
- <li id=script-processing-empty>
- <p>If the element has no <code id=the-script-element:attr-script-src-10><a href=#attr-script-src>src</a></code> attribute, and its child
- nodes, if any, consist only of comment nodes and empty <code id=the-script-element:text><a href=#text>Text</a></code> nodes, then the user
- agent must abort these steps at this point. The script is not executed.</p>
- <li>
- <p>If the element is not <a href=#in-a-document id=the-script-element:in-a-document-3>in a <code>Document</code></a>, then the user agent must abort
- these steps at this point. The script is not executed.</p>
- <li id=script-processing-prepare>
- <p>If either:</p>
- <ul class=brief><li>the <code id=the-script-element:the-script-element-26><a href=#the-script-element>script</a></code> element has a <code id=the-script-element:attr-script-type-7><a href=#attr-script-type>type</a></code> attribute
- and its value is the empty string, or<li>the <code id=the-script-element:the-script-element-27><a href=#the-script-element>script</a></code> element has no <code id=the-script-element:attr-script-type-8><a href=#attr-script-type>type</a></code> attribute
- but it has a <code id=the-script-element:attr-script-language><a href=#attr-script-language>language</a></code> attribute and <em>that</em>
- attribute's value is the empty string, or<li>the <code id=the-script-element:the-script-element-28><a href=#the-script-element>script</a></code> element has neither a <code id=the-script-element:attr-script-type-9><a href=#attr-script-type>type</a></code>
- attribute nor a <code id=the-script-element:attr-script-language-2><a href=#attr-script-language>language</a></code> attribute, then</ul>
- <p>...let <var id=the-script-element:concept-script-type><a href=#concept-script-type>the script block's type</a></var> for this
- <code id=the-script-element:the-script-element-29><a href=#the-script-element>script</a></code> element be "<code>text/javascript</code>".</p>
- <p>Otherwise, if the <code id=the-script-element:the-script-element-30><a href=#the-script-element>script</a></code> element has a <code id=the-script-element:attr-script-type-10><a href=#attr-script-type>type</a></code> attribute, let <var id=the-script-element:concept-script-type-2><a href=#concept-script-type>the
- script block's type</a></var> for this <code id=the-script-element:the-script-element-31><a href=#the-script-element>script</a></code> element be the value of that attribute
- with any leading or trailing sequences of <a href=#space-character id=the-script-element:space-character>space characters</a>
- removed.</p>
- <p>Otherwise, the element has a non-empty <code id=the-script-element:attr-script-language-3><a href=#attr-script-language>language</a></code>
- attribute; let <var id=the-script-element:concept-script-type-3><a href=#concept-script-type>the script block's type</a></var> for this
- <code id=the-script-element:the-script-element-32><a href=#the-script-element>script</a></code> element be the concatenation of the string "<code>text/</code>"
- followed by the value of the <code id=the-script-element:attr-script-language-4><a href=#attr-script-language>language</a></code> attribute.</p>
-
- <p class=note>The <code id=the-script-element:attr-script-language-5><a href=#attr-script-language>language</a></code> attribute is never
- conforming, and is always ignored if there is a <code id=the-script-element:attr-script-type-11><a href=#attr-script-type>type</a></code>
- attribute present.</p>
- <li>
- <p>If the user agent does not <a href=#support-the-scripting-language id=the-script-element:support-the-scripting-language>support the scripting language</a> given by <var id=the-script-element:concept-script-type-4><a href=#concept-script-type>the script block's type</a></var> for this <code id=the-script-element:the-script-element-33><a href=#the-script-element>script</a></code> element,
- then the user agent must abort these steps at this point. The script is not executed.</p>
- <li>
- <p>If <var>was-parser-inserted</var> is true, then flag the element as
- <a href=#parser-inserted id=the-script-element:parser-inserted-5>"parser-inserted"</a> again, and set the element's <a href=#force-async id=the-script-element:force-async-4>"force-async"</a> flag to
- false.</p>
- <li id=script-processing-start>
- <p>The user agent must set the element's <a href=#already-started id=the-script-element:already-started-2>"already started"</a> flag.</p>
- <p class=note>The state of the element at this moment <a href=#establish-script-block-source>is later used</a> to determine the script source.</p>
- <li>
- <p>If the element is flagged as <a href=#parser-inserted id=the-script-element:parser-inserted-6>"parser-inserted"</a>, but the element's
- <a id=the-script-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not the <code id=the-script-element:document-2><a href=#document>Document</a></code> of the parser that created the element,
- then abort these steps.</p>
- <li id=script-processing-noscript>
- <p>If <a href=#concept-n-noscript id=the-script-element:concept-n-noscript>scripting is disabled</a> for the <code id=the-script-element:the-script-element-34><a href=#the-script-element>script</a></code>
- element, then the user agent must abort these steps at this point. The script is not
- executed.</p>
- <p class=note>The definition of <a href=#concept-n-noscript id=the-script-element:concept-n-noscript-2>scripting is disabled</a>
- means that, amongst others, the following scripts will not execute: scripts in
- <code id=the-script-element:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code>'s <code id=the-script-element:dom-xmlhttprequest-responsexml><a href=#dom-xmlhttprequest-responsexml>responseXML</a></code>
- documents, scripts in <code id=the-script-element:domparser><a data-x-internal=domparser href=http://domparsing.spec.whatwg.org/#the-domparser-interface>DOMParser</a></code>-created documents, scripts in documents created by
- <code id=the-script-element:xsltprocessor><a href=#xsltprocessor>XSLTProcessor</a></code>'s <code id=the-script-element:dom-xsltprocessor-transformtodocument><a href=#dom-xsltprocessor-transformtodocument>transformToDocument</a></code> feature, and scripts
- that are first inserted by a script into a <code id=the-script-element:document-3><a href=#document>Document</a></code> that was created using the
- <code id=the-script-element:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> API. <a href=#refsXHR>[XHR]</a>
- <a href=#refsDOMPARSING>[DOMPARSING]</a> <a href=#refsDOM>[DOM]</a></p>
- <li id=script-processing-for>
- <p>If the <code id=the-script-element:the-script-element-35><a href=#the-script-element>script</a></code> element has an <code id=the-script-element:attr-script-event><a href=#attr-script-event>event</a></code>
- attribute and a <code id=the-script-element:attr-script-for><a href=#attr-script-for>for</a></code> attribute, then run these substeps:</p>
- <ol><li><p>Let <var>for</var> be the value of the <code id=the-script-element:attr-script-for-2><a href=#attr-script-for>for</a></code>
- attribute.<li><p>Let <var>event</var> be the value of the <code id=the-script-element:attr-script-event-2><a href=#attr-script-event>event</a></code> attribute.<li><p><a href=#strip-leading-and-trailing-whitespace id=the-script-element:strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var>event</var> and
- <var>for</var>.<li><p>If <var>for</var> is not an <a href=#ascii-case-insensitive id=the-script-element:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the
- string "<code>window</code>", then the user agent must abort these steps at this
- point. The script is not executed.<li><p>If <var>event</var> is not an <a href=#ascii-case-insensitive id=the-script-element:ascii-case-insensitive-3>ASCII case-insensitive</a> match for
- either the string "<code>onload</code>" or the string "<code>onload()</code>", then the user agent must abort these steps at this point. The script
- is not executed.</ol>
- <li id=script-processing-encoding>
- <p>If the <code id=the-script-element:the-script-element-36><a href=#the-script-element>script</a></code> element has a <code id=the-script-element:attr-script-charset-3><a href=#attr-script-charset>charset</a></code>
- attribute, then let <var id=the-script-element:concept-script-encoding><a href=#concept-script-encoding>the script block's character
- encoding</a></var> for this <code id=the-script-element:the-script-element-37><a href=#the-script-element>script</a></code> element be the result of <a id=the-script-element:getting-an-encoding href=http://encoding.spec.whatwg.org/#concept-encoding-get data-x-internal=getting-an-encoding>getting an
- encoding</a> from the value of the <code id=the-script-element:attr-script-charset-4><a href=#attr-script-charset>charset</a></code>
- attribute.</p>
- <p>Otherwise, let <var id=the-script-element:concept-script-fallback-encoding><a href=#concept-script-fallback-encoding>the script block's fallback
- character encoding</a></var> for this <code id=the-script-element:the-script-element-38><a href=#the-script-element>script</a></code> element be the same as <a href="#document's-character-encoding" id="the-script-element:document's-character-encoding">the encoding of the document itself</a>.</p>
- <p class=note>Only one of these two pieces of state is set.</p>
- <li id=script-processing-src-prepare>
- <p>If the element has a <code id=the-script-element:attr-script-src-11><a href=#attr-script-src>src</a></code> content attribute, run these
- substeps:</p>
- <ol><li><p>Let <var>src</var> be the value of the element's <code id=the-script-element:attr-script-src-12><a href=#attr-script-src>src</a></code> attribute.<li><p>If <var>src</var> is the empty string, <a href=#queue-a-task id=the-script-element:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event>fire
- a simple event</a> named <code id=the-script-element:event-error><a href=#event-error>error</a></code> at the element, and abort
- these steps.<li><p><a href=#resolve-a-url id=the-script-element:resolve-a-url>Resolve</a> <var>src</var> relative to the
- element.<li><p>If the previous step failed, <a href=#queue-a-task id=the-script-element:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-2>fire a simple
- event</a> named <code id=the-script-element:event-error-2><a href=#event-error>error</a></code> at the element, and abort these
- steps.<li>
- <p>Do a <a href=#potentially-cors-enabled-fetch id=the-script-element:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the resulting
- <a href=#absolute-url id=the-script-element:absolute-url>absolute URL</a>, with the <i>mode</i> being the current state of the element's <code id=the-script-element:attr-script-crossorigin-3><a href=#attr-script-crossorigin>crossorigin</a></code> content attribute, the <i>origin</i> being
- the <a href=#origin-2 id=the-script-element:origin-2-2>origin</a> of the <code id=the-script-element:the-script-element-39><a href=#the-script-element>script</a></code> element's <a id=the-script-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>, and the
- <i>default origin behaviour</i> set to <i>taint</i>.</p>
- <p>The resource obtained in this fashion can be either <a href=#cors-same-origin id=the-script-element:cors-same-origin>CORS-same-origin</a> or
- <a href=#cors-cross-origin id=the-script-element:cors-cross-origin>CORS-cross-origin</a>. This only affects how error reporting happens.</p>
- <p>For performance reasons, user agents may start fetching the script (as defined above) as
- soon as the <code id=the-script-element:attr-script-src-13><a href=#attr-script-src>src</a></code> attribute is set, instead, in the hope
- that the element will be inserted into the document (and that the <code id=the-script-element:attr-script-crossorigin-4><a href=#attr-script-crossorigin>crossorigin</a></code> attribute won't change value in the
- meantime). Either way, once the element is <a href=#insert-an-element-into-a-document id=the-script-element:insert-an-element-into-a-document-2>inserted into the document</a>, the load must have started as described in this
- step. If the UA performs such prefetching, but the element is never inserted in the document,
- or the <code id=the-script-element:attr-script-src-14><a href=#attr-script-src>src</a></code> attribute is dynamically changed, or the <code id=the-script-element:attr-script-crossorigin-5><a href=#attr-script-crossorigin>crossorigin</a></code> attribute is dynamically changed, then the
- user agent will not execute the script so obtained, and the fetching process will have been
- effectively wasted.</p>
- </ol>
- <li>
- <p>Then, the first of the following options that describes the situation must be followed:</p>
- <dl class=switch><dt id=script-processing-defer>If the element has a <code id=the-script-element:attr-script-src-15><a href=#attr-script-src>src</a></code>
- attribute, and the element has a <code id=the-script-element:attr-script-defer-8><a href=#attr-script-defer>defer</a></code> attribute, and
- the element has been flagged as <a href=#parser-inserted id=the-script-element:parser-inserted-7>"parser-inserted"</a>, and the element does not have
- an <code id=the-script-element:attr-script-async-11><a href=#attr-script-async>async</a></code> attribute<dd>
- <p>The element must be added to the end of the <dfn id=list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the
- document has finished parsing</dfn> associated with the <code id=the-script-element:document-4><a href=#document>Document</a></code> of the parser
- that created the element.</p>
- <p>The <a href=#concept-task id=the-script-element:concept-task>task</a> that the <a href=#networking-task-source id=the-script-element:networking-task-source>networking task source</a>
- places on the <a href=#task-queue id=the-script-element:task-queue>task queue</a> once the <a href=#fetch id=the-script-element:fetch>fetching algorithm</a>
- has completed must set the element's <a href=#ready-to-be-parser-executed id=the-script-element:ready-to-be-parser-executed>"ready to be parser-executed"</a> flag. The
- parser will handle executing the script.</p>
- <dt id=script-processing-parser-inserted>If the element has a <code id=the-script-element:attr-script-src-16><a href=#attr-script-src>src</a></code> attribute, and the element has been flagged as
- <a href=#parser-inserted id=the-script-element:parser-inserted-8>"parser-inserted"</a>, and the element does not have an <code id=the-script-element:attr-script-async-12><a href=#attr-script-async>async</a></code> attribute<dd>
- <p>The element is the <a href=#pending-parsing-blocking-script id=the-script-element:pending-parsing-blocking-script>pending parsing-blocking script</a> of the
- <code id=the-script-element:document-5><a href=#document>Document</a></code> of the parser that created the element. (There can only be one such
- script per <code id=the-script-element:document-6><a href=#document>Document</a></code> at a time.)</p>
- <p>The <a href=#concept-task id=the-script-element:concept-task-2>task</a> that the <a href=#networking-task-source id=the-script-element:networking-task-source-2>networking task source</a>
- places on the <a href=#task-queue id=the-script-element:task-queue-2>task queue</a> once the <a href=#fetch id=the-script-element:fetch-2>fetching algorithm</a>
- has completed must set the element's <a href=#ready-to-be-parser-executed id=the-script-element:ready-to-be-parser-executed-2>"ready to be parser-executed"</a> flag. The
- parser will handle executing the script.</p>
- <dt id=script-processing-style-delayed>If the element does not have a <code id=the-script-element:attr-script-src-17><a href=#attr-script-src>src</a></code> attribute, and the element has been flagged as
- <a href=#parser-inserted id=the-script-element:parser-inserted-9>"parser-inserted"</a>, and either the parser that created the <code id=the-script-element:the-script-element-40><a href=#the-script-element>script</a></code> is
- an <a href=#xml-parser id=the-script-element:xml-parser-3>XML parser</a> or it's an <a href=#html-parser id=the-script-element:html-parser-3>HTML parser</a> whose <a href=#script-nesting-level id=the-script-element:script-nesting-level>script nesting
- level</a> is not greater than one, and the <code id=the-script-element:document-7><a href=#document>Document</a></code> of the <a href=#html-parser id=the-script-element:html-parser-4>HTML
- parser</a> or <a href=#xml-parser id=the-script-element:xml-parser-4>XML parser</a> that created the <code id=the-script-element:the-script-element-41><a href=#the-script-element>script</a></code> element <a href=#has-a-style-sheet-that-is-blocking-scripts id=the-script-element:has-a-style-sheet-that-is-blocking-scripts>has
- a style sheet that is blocking scripts</a><dd>
- <p>The element is the <a href=#pending-parsing-blocking-script id=the-script-element:pending-parsing-blocking-script-2>pending parsing-blocking script</a> of the
- <code id=the-script-element:document-8><a href=#document>Document</a></code> of the parser that created the element. (There can only be one such
- script per <code id=the-script-element:document-9><a href=#document>Document</a></code> at a time.)</p>
- <p>Set the element's <a href=#ready-to-be-parser-executed id=the-script-element:ready-to-be-parser-executed-3>"ready to be parser-executed"</a> flag. The parser will handle
- executing the script.</p>
- <dt id=script-processing-src-sync>If the element has a <code id=the-script-element:attr-script-src-18><a href=#attr-script-src>src</a></code> attribute, does not have an <code id=the-script-element:attr-script-async-13><a href=#attr-script-async>async</a></code> attribute, and does not have the
- <a href=#force-async id=the-script-element:force-async-5>"force-async"</a> flag set<dd>
- <p>The element must be added to the end of the <dfn id=list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order
- as soon as possible</dfn> associated with the <a id=the-script-element:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the <code id=the-script-element:the-script-element-42><a href=#the-script-element>script</a></code>
- element at the time the <a href=#prepare-a-script id=the-script-element:prepare-a-script-2>prepare a script</a> algorithm started.</p>
- <p>The <a href=#concept-task id=the-script-element:concept-task-3>task</a> that the <a href=#networking-task-source id=the-script-element:networking-task-source-3>networking task source</a>
- places on the <a href=#task-queue id=the-script-element:task-queue-3>task queue</a> once the <a href=#fetch id=the-script-element:fetch-3>fetching algorithm</a>
- has completed must run the following steps:</p>
- <ol><li><p>If the element is not now the first element in the <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible id=the-script-element:list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will
- execute in order as soon as possible</a> to which it was added above, then mark the
- element as ready but abort these steps without executing the script yet.<li><p><i>Execution</i>: <a href=#execute-the-script-block id=the-script-element:execute-the-script-block>Execute the script block</a> corresponding to the first
- script element in this <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible id=the-script-element:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-2>list of scripts that will execute in order as soon as
- possible</a>.<li><p>Remove the first element from this <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible id=the-script-element:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-3>list of scripts that will execute in order as
- soon as possible</a>.<li><p>If this <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible id=the-script-element:list-of-scripts-that-will-execute-in-order-as-soon-as-possible-4>list of scripts that will execute in order as soon as possible</a> is
- still not empty and the first entry has already been marked as ready, then jump back to the
- step labeled <i>execution</i>.</ol>
- <dt id=script-processing-src>If the element has a <code id=the-script-element:attr-script-src-19><a href=#attr-script-src>src</a></code>
- attribute<dd>
- <p>The element must be added to the <dfn id=set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as
- possible</dfn> of the <a id=the-script-element:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the <code id=the-script-element:the-script-element-43><a href=#the-script-element>script</a></code> element at the time the
- <a href=#prepare-a-script id=the-script-element:prepare-a-script-3>prepare a script</a> algorithm started.</p>
- <p>The <a href=#concept-task id=the-script-element:concept-task-4>task</a> that the <a href=#networking-task-source id=the-script-element:networking-task-source-4>networking task source</a>
- places on the <a href=#task-queue id=the-script-element:task-queue-4>task queue</a> once the <a href=#fetch id=the-script-element:fetch-4>fetching algorithm</a>
- has completed must <a href=#execute-the-script-block id=the-script-element:execute-the-script-block-2>execute the script block</a> and then remove the element from the
- <a href=#set-of-scripts-that-will-execute-as-soon-as-possible id=the-script-element:set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon as possible</a>.</p>
- <dt id=script-processing-inline>Otherwise<dd>The user agent must immediately <a href=#execute-the-script-block id=the-script-element:execute-the-script-block-3>execute the script block</a>, even if other
- scripts are already executing.</dl>
- </ol>
-
- <p>Fetching an external script must <a href=#delay-the-load-event id=the-script-element:delay-the-load-event>delay the load event</a> of the element's <a id=the-script-element:node-document-6 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>
- until the <a href=#concept-task id=the-script-element:concept-task-5>task</a> that is <a href=#queue-a-task id=the-script-element:queue-a-task-3>queued</a>
- by the <a href=#networking-task-source id=the-script-element:networking-task-source-5>networking task source</a> once the resource has been <a href=#fetch id=the-script-element:fetch-5>fetched</a> (defined above) has been run.</p>
- <p>The <dfn id=pending-parsing-blocking-script>pending parsing-blocking script</dfn> of a <code id=the-script-element:document-10><a href=#document>Document</a></code> is used by the
- <code id=the-script-element:document-11><a href=#document>Document</a></code>'s parser(s).</p>
- <p class=note>If a <code id=the-script-element:the-script-element-44><a href=#the-script-element>script</a></code> element that blocks a parser gets moved to another
- <code id=the-script-element:document-12><a href=#document>Document</a></code> before it would normally have stopped blocking that parser, it nonetheless
- continues blocking that parser until the condition that causes it to be blocking the parser no
- longer applies (e.g. if the script is a <a href=#pending-parsing-blocking-script id=the-script-element:pending-parsing-blocking-script-3>pending parsing-blocking script</a> because there
- was <a href=#a-style-sheet-that-is-blocking-scripts id=the-script-element:a-style-sheet-that-is-blocking-scripts>a style sheet that is blocking scripts</a> when it was parsed, but then the script is
- moved to another <code id=the-script-element:document-13><a href=#document>Document</a></code> before the style sheet loads, the script still blocks the
- parser until the style sheets are all loaded, at which time the script executes and the parser is
- unblocked).</p>
-
- <p>When the user agent is required to <dfn id=execute-the-script-block>execute a script
- block</dfn>, it must run the following steps:</p>
- <ol><li>
- <p>If the element is flagged as <a href=#parser-inserted id=the-script-element:parser-inserted-10>"parser-inserted"</a>, but the element's
- <a id=the-script-element:node-document-7 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not the <code id=the-script-element:document-14><a href=#document>Document</a></code> of the parser that created the element,
- then abort these steps.</p>
- <li>
- <p>Jump to the appropriate set of steps from the list below:</p>
- <dl class=switch><dt>If the load resulted in an error (for example a DNS error, or an HTTP 404 error)<dd><p>Executing the script block must just consist of <a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-3>firing
- a simple event</a> named <code id=the-script-element:event-error-3><a href=#event-error>error</a></code> at the element.<dt>If the load was successful<dd>
- <p>Executing the script block must consist of running the following steps. For the purposes of
- these steps, the script is considered to be from an <i>external file</i> if, while the
- <a href=#prepare-a-script id=the-script-element:prepare-a-script-4>prepare a script</a> algorithm above was running for this script, the
- <code id=the-script-element:the-script-element-45><a href=#the-script-element>script</a></code> element had a <code id=the-script-element:attr-script-src-20><a href=#attr-script-src>src</a></code> attribute
- specified.</p>
- <ol><li id=establish-script-block-source>
- <p>Initialise <dfn id=concept-script-source><var>the script block's source</var></dfn>
- as follows:</p>
- <dl class=switch><dt>If the script is from an external file and <var id=the-script-element:concept-script-type-5><a href=#concept-script-type>the script
- block's type</a></var> is a text-based language<dd>
- <p>The contents of that file, interpreted as a Unicode string, are the script source.</p>
- <p>To obtain the Unicode string, the user agent run the following steps:</p>
- <ol><li><p>If the resource's <a href=#content-type id=the-script-element:content-type-2>Content Type metadata</a>, if any,
- specifies a character encoding, and the user agent supports that encoding, then let <var>character encoding</var> be that encoding, and jump to the bottom step in this
- series of steps.<li><p>If the algorithm above set <var id=the-script-element:concept-script-encoding-2><a href=#concept-script-encoding>the script
- block's character encoding</a></var>, then let <var>character encoding</var> be
- that encoding, and jump to the bottom step in this series of steps.<li><p>Let <var>character encoding</var> be <var id=the-script-element:concept-script-fallback-encoding-2><a href=#concept-script-fallback-encoding>the script block's fallback character
- encoding</a></var>.<li>
- <p>If the specification for <var id=the-script-element:concept-script-type-6><a href=#concept-script-type>the script block's
- type</a></var> gives specific rules for decoding files in that format to Unicode, follow
- them, using <var>character encoding</var> as the character encoding specified by
- higher-level protocols, if necessary.</p>
- <p>Otherwise, <a href=#decode id=the-script-element:decode>decode</a> the file to Unicode, using <var>character
- encoding</var> as the fallback encoding.</p>
- <p class=note>The <a href=#decode id=the-script-element:decode-2>decode</a> algorithm overrides <var>character
- encoding</var> if the file contains a BOM.</p>
- </ol>
- <dt>If the script is from an external file and <var id=the-script-element:concept-script-type-7><a href=#concept-script-type>the script
- block's type</a></var> is an XML-based language<dd>
- <p>The external file is the script source. When it is later executed, it must be
- interpreted in a manner consistent with the specification defining the language given by
- <var id=the-script-element:concept-script-type-8><a href=#concept-script-type>the script block's type</a></var>.</p>
- <dt>If the script is inline and <var id=the-script-element:concept-script-type-9><a href=#concept-script-type>the script block's
- type</a></var> is a text-based language<dd>
- <p>The value of the <code id=the-script-element:dom-script-text-2><a href=#dom-script-text>text</a></code> IDL attribute at the time
- the element's <a href=#already-started id=the-script-element:already-started-3>"already started"</a> flag was last set is the script source.</p>
- <dt>If the script is inline and <var id=the-script-element:concept-script-type-10><a href=#concept-script-type>the script block's
- type</a></var> is an XML-based language<dd>
- <p>The child nodes of the <code id=the-script-element:the-script-element-46><a href=#the-script-element>script</a></code> element at the time the element's
- <a href=#already-started id=the-script-element:already-started-4>"already started"</a> flag was last set are the script source.</p>
- </dl>
- <li>
- <p><a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-4>Fire a simple event</a> named <code id=the-script-element:event-beforescriptexecute><a href=#event-beforescriptexecute>beforescriptexecute</a></code> that bubbles and is cancelable
- at the <code id=the-script-element:the-script-element-47><a href=#the-script-element>script</a></code> element.</p>
- <p>If the event is canceled, then abort these steps.</p>
- <li>
- <p>If the script is from an external file, then increment the
- <a href=#ignore-destructive-writes-counter id=the-script-element:ignore-destructive-writes-counter>ignore-destructive-writes counter</a> of the <code id=the-script-element:the-script-element-48><a href=#the-script-element>script</a></code> element's
- <a id=the-script-element:node-document-8 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>. Let <var>neutralised doc</var> be that
- <code id=the-script-element:document-15><a href=#document>Document</a></code>.</p>
- <li>
- <p>Let <var>old script element</var> be the value to which the <code id=the-script-element:the-script-element-49><a href=#the-script-element>script</a></code>
- element's <a id=the-script-element:node-document-9 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <code id=the-script-element:dom-document-currentscript><a href=#dom-document-currentscript>currentScript</a></code> object was most recently
- initialized.</p>
- <li>
- <p>Initialise the <code id=the-script-element:the-script-element-50><a href=#the-script-element>script</a></code> element's <a id=the-script-element:node-document-10 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <code id=the-script-element:dom-document-currentscript-2><a href=#dom-document-currentscript>currentScript</a></code> object to the <code id=the-script-element:the-script-element-51><a href=#the-script-element>script</a></code>
- element.</p>
- <li>
- <p><a href=#create-a-script id=the-script-element:create-a-script>Create a script</a>, using <var id=the-script-element:concept-script-source><a href=#concept-script-source>the script
- block's source</a></var>, the <a href=#url id=the-script-element:url>URL</a> from which the script was obtained, <var id=the-script-element:concept-script-type-11><a href=#concept-script-type>the script block's type</a></var> as the scripting language, and
- the <a href=#script-settings-object id=the-script-element:script-settings-object>script settings object</a> of the <code id=the-script-element:the-script-element-52><a href=#the-script-element>script</a></code> element's
- <a id=the-script-element:node-document-11 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <code id=the-script-element:window><a href=#window>Window</a></code> object.</p>
- <p>If the script came from a resource that was <a href=#fetch id=the-script-element:fetch-6>fetched</a> in the
- steps above, and the resource was <a href=#cors-cross-origin id=the-script-element:cors-cross-origin-2>CORS-cross-origin</a>, then pass the <var>muted errors</var> flag to the <a href=#create-a-script id=the-script-element:create-a-script-2>create a script</a> algorithm as well.</p>
- <p class=note>This is where the script is compiled and actually executed.</p>
- <li>
- <p>Initialise the <code id=the-script-element:the-script-element-53><a href=#the-script-element>script</a></code> element's <a id=the-script-element:node-document-12 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <code id=the-script-element:dom-document-currentscript-3><a href=#dom-document-currentscript>currentScript</a></code> object to <var>old script
- element</var>.</p>
- <li>
- <p>Decrement the <a href=#ignore-destructive-writes-counter id=the-script-element:ignore-destructive-writes-counter-2>ignore-destructive-writes counter</a> of <var>neutralised doc</var>, if it was incremented in the earlier step.</p>
- <li>
- <p><a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-5>Fire a simple event</a> named <code id=the-script-element:event-afterscriptexecute><a href=#event-afterscriptexecute>afterscriptexecute</a></code> that bubbles (but is not
- cancelable) at the <code id=the-script-element:the-script-element-54><a href=#the-script-element>script</a></code> element.</p>
- <li>
- <p>If the script is from an external file, <a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-6>fire a simple event</a> named <code id=the-script-element:event-load><a href=#event-load>load</a></code> at the <code id=the-script-element:the-script-element-55><a href=#the-script-element>script</a></code> element.</p>
- <p>Otherwise, the script is internal; <a href=#queue-a-task id=the-script-element:queue-a-task-4>queue a task</a> to <a href=#fire-a-simple-event id=the-script-element:fire-a-simple-event-7>fire a simple
- event</a> named <code id=the-script-element:event-load-2><a href=#event-load>load</a></code> at the <code id=the-script-element:the-script-element-56><a href=#the-script-element>script</a></code>
- element.</p>
- </ol>
- </dl>
- </ol>
- <p>The IDL attributes <dfn id=dom-script-src><code>src</code></dfn>, <dfn id=dom-script-type><code>type</code></dfn>, <dfn id=dom-script-charset><code>charset</code></dfn>, <dfn id=dom-script-defer><code>defer</code></dfn>, each must <a href=#reflect id=the-script-element:reflect>reflect</a> the respective
- content attributes of the same name.</p>
- <p>The <dfn id=dom-script-crossorigin><code>crossOrigin</code></dfn> IDL attribute must
- <a href=#reflect id=the-script-element:reflect-2>reflect</a> the <code id=the-script-element:attr-script-crossorigin-6><a href=#attr-script-crossorigin>crossorigin</a></code> content attribute.</p>
- <p>The <dfn id=dom-script-async><code>async</code></dfn> IDL attribute controls whether the
- element will execute asynchronously or not. If the element's <a href=#force-async id=the-script-element:force-async-6>"force-async"</a> flag is
- set, then, on getting, the <code id=the-script-element:dom-script-async-2><a href=#dom-script-async>async</a></code> IDL attribute must return
- true, and on setting, the <a href=#force-async id=the-script-element:force-async-7>"force-async"</a> flag must first be unset, and then the
- content attribute must be removed if the IDL attribute's new value is false, and must be set to
- the empty string if the IDL attribute's new value is true. If the element's
- <a href=#force-async id=the-script-element:force-async-8>"force-async"</a> flag is <em>not</em> set, the IDL attribute must <a href=#reflect id=the-script-element:reflect-3>reflect</a>
- the <code id=the-script-element:attr-script-async-14><a href=#attr-script-async>async</a></code> content attribute.</p>
-
- <dl class=domintro><dt><var>script</var> . <code id=the-script-element:dom-script-text-3><a href=#dom-script-text>text</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the contents of the element, ignoring child nodes that aren't <code id=the-script-element:text-2><a href=#text>Text</a></code>
- nodes.</p>
- <p>Can be set, to replace the element's children with the given value.</p>
- </dl>
-
- <p>The IDL attribute <dfn id=dom-script-text><code>text</code></dfn> must return a
- concatenation of the contents of all the <code id=the-script-element:text-3><a href=#text>Text</a></code> nodes that are children of the
- <code id=the-script-element:the-script-element-57><a href=#the-script-element>script</a></code> element (ignoring any other nodes such as comments or elements), in tree
- order. On setting, it must act the same way as the <code id=the-script-element:textcontent><a href=#textcontent>textContent</a></code> IDL attribute.</p>
-
- <p class=note>When inserted using the <code id=the-script-element:dom-document-write-2><a href=#dom-document-write>document.write()</a></code>
- method, <code id=the-script-element:the-script-element-58><a href=#the-script-element>script</a></code> elements execute (typically synchronously), but when inserted using
- <code id=the-script-element:dom-innerhtml><a href=#dom-innerhtml>innerHTML</a></code> and <code id=the-script-element:dom-outerhtml><a href=#dom-outerhtml>outerHTML</a></code>
- attributes, they do not execute at all.</p>
- <div class=example>
- <p>In this example, two <code id=the-script-element:the-script-element-59><a href=#the-script-element>script</a></code> elements are used. One embeds an external script, and
- the other includes some data.</p>
- <pre><script src="game-engine.js"></script>
- <script type="text/x-game-map">
- ........U.........e
- o............A....e
- .....A.....AAA....e
- .A..AAA...AAAAA...e
- </script></pre>
- <p>The data in this case might be used by the script to generate the map of a video game. The
- data doesn't have to be used that way, though; maybe the map data is actually embedded in other
- parts of the page's markup, and the data block here is just used by the site's search engine to
- help users who are looking for particular features in their game maps.</p>
- </div>
- <div class=example>
- <p>The following sample shows how a script element can be used to define a function that is then
- used by other parts of the document. It also shows how a <code id=the-script-element:the-script-element-60><a href=#the-script-element>script</a></code> element can be used
- to invoke script while the document is being parsed, in this case to initialise the form's
- output.</p>
- <pre><script>
- function calculate(form) {
- var price = 52000;
- if (form.elements.brakes.checked)
- price += 1000;
- if (form.elements.radio.checked)
- price += 2500;
- if (form.elements.turbo.checked)
- price += 5000;
- if (form.elements.sticker.checked)
- price += 250;
- form.elements.result.value = price;
- }
- </script>
- <form name="pricecalc" onsubmit="return false" onchange="calculate(this)">
- <fieldset>
- <legend>Work out the price of your car</legend>
- <p>Base cost: £52000.</p>
- <p>Select additional options:</p>
- <ul>
- <li><label><input type=checkbox name=brakes> Ceramic brakes (£1000)</label></li>
- <li><label><input type=checkbox name=radio> Satellite radio (£2500)</label></li>
- <li><label><input type=checkbox name=turbo> Turbo charger (£5000)</label></li>
- <li><label><input type=checkbox name=sticker> "XZ" sticker (£250)</label></li>
- </ul>
- <p>Total: £<output name=result></output></p>
- </fieldset>
- <script>
- calculate(document.forms.pricecalc);
- </script>
- </form></pre>
- </div>
- <h5 id=scriptingLanguages>4.12.1.1 Scripting languages</h5>
-
- <p>A user agent is said to <dfn id=support-the-scripting-language>support the scripting language</dfn> if each component of <var id=scriptingLanguages:concept-script-type><a href=#concept-script-type>the script block's type</a></var> is an <a href=#ascii-case-insensitive id=scriptingLanguages:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the corresponding component in the <a href=#mime-type id=scriptingLanguages:mime-type>MIME type</a> string
- of a scripting language that the user agent implements.</p>
-
- <p>The following lists the <a href=#mime-type id=scriptingLanguages:mime-type-2>MIME type</a> strings that user agents must recognize, and the
- languages to which they refer:</p>
- <dl><dt><code id=scriptingLanguages:application/ecmascript><a href=#application/ecmascript>application/ecmascript</a></code><dt><code id=scriptingLanguages:application/javascript><a href=#application/javascript>application/javascript</a></code><dt><code id=scriptingLanguages:application/x-ecmascript><a href=#application/x-ecmascript>application/x-ecmascript</a></code><dt><code id=scriptingLanguages:application/x-javascript><a href=#application/x-javascript>application/x-javascript</a></code><dt><code id=scriptingLanguages:text/ecmascript><a href=#text/ecmascript>text/ecmascript</a></code><dt><code id=scriptingLanguages:text/javascript><a href=#text/javascript>text/javascript</a></code><dt><code id=scriptingLanguages:text/javascript1.0><a href=#text/javascript1.0>text/javascript1.0</a></code><dt><code id=scriptingLanguages:text/javascript1.1><a href=#text/javascript1.1>text/javascript1.1</a></code><dt><code id=scriptingLanguages:text/javascript1.2><a href=#text/javascript1.2>text/javascript1.2</a></code><dt><code id=scriptingLanguages:text/javascript1.3><a href=#text/javascript1.3>text/javascript1.3</a></code><dt><code id=scriptingLanguages:text/javascript1.4><a href=#text/javascript1.4>text/javascript1.4</a></code><dt><code id=scriptingLanguages:text/javascript1.5><a href=#text/javascript1.5>text/javascript1.5</a></code><dt><code id=scriptingLanguages:text/jscript><a href=#text/jscript>text/jscript</a></code><dt><code id=scriptingLanguages:text/livescript><a href=#text/livescript>text/livescript</a></code><dt><code id=scriptingLanguages:text/x-ecmascript><a href=#text/x-ecmascript>text/x-ecmascript</a></code><dt><code id=scriptingLanguages:text/x-javascript><a href=#text/x-javascript>text/x-javascript</a></code><dd>JavaScript. <a href=#refsECMA262>[ECMA262]</a></dl>
-
- <p>User agents may support other <a href=#mime-type id=scriptingLanguages:mime-type-3>MIME types</a> for other languages,
- but must not support other <a href=#mime-type id=scriptingLanguages:mime-type-4>MIME types</a> for the languages in the list
- above. User agents are not required to support the languages listed above.</p>
- <p>The following <a href=#mime-type id=scriptingLanguages:mime-type-5>MIME types</a> (with or without parameters) must not
- be interpreted as scripting languages:</p>
- <ul class=brief><li><code id=scriptingLanguages:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>
- <li><code id=scriptingLanguages:text/xml><a href=#text/xml>text/xml</a></code>
-
- <li><code id=scriptingLanguages:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>
- <li><code id=scriptingLanguages:application/xml><a href=#application/xml>application/xml</a></code>
-
-
-
- </ul>
- <p class=note>These types are explicitly listed here because they are poorly-defined types that
- are nonetheless likely to be used as formats for data blocks, and it would be problematic if they
- were suddenly to be interpreted as script by a user agent.</p>
-
- <p>When examining types to determine if they represent supported languages, user agents must not
- ignore MIME parameters. Types are to be compared including all parameters.</p>
- <p class=note>For example, types that include the <code>charset</code> parameter will
- not be recognised as referencing any of the scripting languages listed above.</p>
-
- <h5 id=restrictions-for-contents-of-script-elements>4.12.1.2 <dfn>Restrictions for contents of <code>script</code> elements</dfn></h5>
- <p class=note>The easiest and safest way to avoid the rather strange restrictions described in
- this section is to always escape "<code><!--</code>" as "<code><\!--</code>", "<code><script</code>" as "<code><\script</code>", and "<code></script</code>" as "<code><\/script</code>" when these sequences appear in literals in scripts (e.g. in
- strings, regular expressions, or comments), and to avoid writing code that uses such constructs in
- expressions. Doing so avoids the pitfalls that the restrictions in this section are prone to
- triggering: namely, that, for historical reasons, parsing of <code id=restrictions-for-contents-of-script-elements:the-script-element><a href=#the-script-element>script</a></code> blocks in HTML is
- a strange and exotic practice that acts unintuitively in the face of these sequences.</p>
- <p>The <code id=restrictions-for-contents-of-script-elements:textcontent><a href=#textcontent>textContent</a></code> of a <code id=restrictions-for-contents-of-script-elements:the-script-element-2><a href=#the-script-element>script</a></code> element must match the <code>script</code> production in the following ABNF, the character set for which is Unicode.
- <a href=#refsABNF>[ABNF]</a></p>
- <pre>script = outer *( comment-open inner comment-close outer )
- outer = < any string that doesn't contain a substring that matches not-in-outer >
- not-in-outer = comment-open
- inner = < any string that doesn't contain a substring that matches not-in-inner >
- not-in-inner = comment-close / script-open
- comment-open = "<!--"
- comment-close = "-->"
- script-open = "<" s c r i p t tag-end
- s = %x0053 ; U+0053 LATIN CAPITAL LETTER S
- s =/ %x0073 ; U+0073 LATIN SMALL LETTER S
- c = %x0043 ; U+0043 LATIN CAPITAL LETTER C
- c =/ %x0063 ; U+0063 LATIN SMALL LETTER C
- r = %x0052 ; U+0052 LATIN CAPITAL LETTER R
- r =/ %x0072 ; U+0072 LATIN SMALL LETTER R
- i = %x0049 ; U+0049 LATIN CAPITAL LETTER I
- i =/ %x0069 ; U+0069 LATIN SMALL LETTER I
- p = %x0050 ; U+0050 LATIN CAPITAL LETTER P
- p =/ %x0070 ; U+0070 LATIN SMALL LETTER P
- t = %x0054 ; U+0054 LATIN CAPITAL LETTER T
- t =/ %x0074 ; U+0074 LATIN SMALL LETTER T
- tag-end = %x0009 ; U+0009 CHARACTER TABULATION (tab)
- tag-end =/ %x000A ; U+000A LINE FEED (LF)
- tag-end =/ %x000C ; U+000C FORM FEED (FF)
- tag-end =/ %x0020 ; U+0020 SPACE
- tag-end =/ %x002F ; U+002F SOLIDUS (/)
- tag-end =/ %x003E ; U+003E GREATER-THAN SIGN (>)</pre>
- <p>When a <code id=restrictions-for-contents-of-script-elements:the-script-element-3><a href=#the-script-element>script</a></code> element contains <a href=#inline-documentation-for-external-scripts id=restrictions-for-contents-of-script-elements:inline-documentation-for-external-scripts>script documentation</a>, there are
- further restrictions on the contents of the element, as described in the section below.</p>
- <div class=example>
- <p>The following script illustrates this issue. Suppose you have a script that contains a string,
- as in:</p>
- <pre>var example = 'Consider this string: <!-- <script>';
- console.log(example);</pre>
- <p>If one were to put this string directly in a <code id=restrictions-for-contents-of-script-elements:the-script-element-4><a href=#the-script-element>script</a></code> block, it would violate the
- restrictions above:</p>
- <pre><script>
- var example = 'Consider this string: <!-- <script>';
- console.log(example);
- </script></pre>
- <p>The bigger problem, though, and the reason why it would violate those restrictions, is that
- actually the script would get parsed weirdly: <em>the script block above is not terminated</em>.
- That is, what looks like a "<code></script></code>" end tag in this snippet is
- actually still part of the <code id=restrictions-for-contents-of-script-elements:the-script-element-5><a href=#the-script-element>script</a></code> block. The script doesn't execute (since it's not
- terminated); if it somehow were to execute, as it might if the markup looked as follows, it would
- fail because the script (highlighted here) is not valid JavaScript:</p>
- <pre><script><mark>
- var example = 'Consider this string: <!-- <script>';
- console.log(example);
- </script>
- <!-- despite appearances, this is actually part of the script still! -->
- <script>
- ... // this is the same script block still...
- </mark></script></pre>
- <p>What is going on here is that for legacy reasons, "<code><!--</code>" and "<code><script</code>" strings in <code id=restrictions-for-contents-of-script-elements:the-script-element-6><a href=#the-script-element>script</a></code> elements in HTML need to be balanced
- in order for the parser to consider closing the block.</p>
- <p>By escaping the problematic strings as mentioned at the top of this section, the problem is
- avoided entirely:</p>
- <pre><script><mark>
- var example = 'Consider this string: <\!-- <\script>';
- console.log(example);
- </mark></script>
- <!-- this is just a comment between script blocks -->
- <script><mark>
- ... // this is a new script block
- </mark></script></pre>
- <p>It is possible for these sequences to naturally occur in script expressions, as in the
- following examples:</p>
- <pre>if (x<!--y) { ... }
- if ( player<script ) { ... }</pre>
- <p>In such cases the characters cannot be escaped, but the expressions can be rewritten so that
- the sequences don't occur, as in:</p>
- <pre>if (x < !--y) { ... }
- if (!--y > x) { ... }
- if (!(--y) > x) { ... }
- if (player < script) { ... }
- if (script > player) { ... }</pre>
- <p>Doing this also avoids a different pitfall as well: for related historical reasons, the string
- "<!--" in JavaScript is actually treated as a line comment start, just like "//".</p>
- </div>
- <h5 id=inline-documentation-for-external-scripts>4.12.1.3 <dfn>Inline documentation for external scripts</dfn></h5>
- <p>If a <code id=inline-documentation-for-external-scripts:the-script-element><a href=#the-script-element>script</a></code> element's <code id=inline-documentation-for-external-scripts:attr-script-src><a href=#attr-script-src>src</a></code> attribute is
- specified, then the contents of the <code id=inline-documentation-for-external-scripts:the-script-element-2><a href=#the-script-element>script</a></code> element, if any, must be such that the
- value of the <code id=inline-documentation-for-external-scripts:dom-script-text><a href=#dom-script-text>text</a></code> IDL attribute, which is derived from the
- element's contents, matches the <code>documentation</code> production in the following
- ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
- <pre>documentation = *( *( space / tab / comment ) [ line-comment ] newline )
- comment = slash star *( not-star / star not-slash ) 1*star slash
- line-comment = slash slash *not-newline
- ; characters
- tab = %x0009 ; U+0009 CHARACTER TABULATION (tab)
- newline = %x000A ; U+000A LINE FEED (LF)
- space = %x0020 ; U+0020 SPACE
- star = %x002A ; U+002A ASTERISK (*)
- slash = %x002F ; U+002F SOLIDUS (/)
- not-newline = %x0000-0009 / %x000B-10FFFF
- ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character>Unicode character</a> other than U+000A LINE FEED (LF)
- not-star = %x0000-0029 / %x002B-10FFFF
- ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character-2>Unicode character</a> other than U+002A ASTERISK (*)
- not-slash = %x0000-002E / %x0030-10FFFF
- ; a <a href=#unicode-character id=inline-documentation-for-external-scripts:unicode-character-3>Unicode character</a> other than U+002F SOLIDUS (/)</pre>
- <p class=note>This corresponds to putting the contents of the element in JavaScript
- comments.</p>
- <p class=note>This requirement is in addition to the earlier restrictions on the syntax of
- contents of <code id=inline-documentation-for-external-scripts:the-script-element-3><a href=#the-script-element>script</a></code> elements.</p>
- <div class=example>
- <p>This allows authors to include documentation, such as license information or API information,
- inside their documents while still referring to external script files. The syntax is constrained
- so that authors don't accidentally include what looks like valid script while also providing a
- <code id=inline-documentation-for-external-scripts:attr-script-src-2><a href=#attr-script-src>src</a></code> attribute.</p>
- <pre><script src="cool-effects.js">
- // create new instances using:
- // var e = new Effect();
- // start the effect using .play, stop using .stop:
- // e.play();
- // e.stop();
- </script></pre>
- </div>
-
- <h5 id=scriptTagXSLT>4.12.1.4 Interaction of <code id=scriptTagXSLT:the-script-element><a href=#the-script-element>script</a></code> elements and XSLT</h5>
- <p><i>This section is non-normative.</i></p>
- <p>This specification does not define how XSLT interacts with the <code id=scriptTagXSLT:the-script-element-2><a href=#the-script-element>script</a></code> element.
- However, in the absence of another specification actually defining this, here are some guidelines
- for implementors, based on existing implementations:</p>
- <ul><li><p>When an XSLT transformation program is triggered by an <code><?xml-stylesheet?></code> processing instruction and the browser implements a
- direct-to-DOM transformation, <code id=scriptTagXSLT:the-script-element-3><a href=#the-script-element>script</a></code> elements created by the XSLT processor need to
- be marked <a href=#parser-inserted id=scriptTagXSLT:parser-inserted>"parser-inserted"</a> and run in document order (modulo scripts marked <code id=scriptTagXSLT:attr-script-defer><a href=#attr-script-defer>defer</a></code> or <code id=scriptTagXSLT:attr-script-async><a href=#attr-script-async>async</a></code>),
- asynchronously while the transformation is occurring.<li><p>The <code id=scriptTagXSLT:dom-xsltprocessor-transformtodocument><a href=#dom-xsltprocessor-transformtodocument>XSLTProcessor.transformToDocument()</a></code> method
- adds elements to a <code id=scriptTagXSLT:document><a href=#document>Document</a></code> that is not in a <a href=#browsing-context id=scriptTagXSLT:browsing-context>browsing context</a>, and,
- accordingly, any <code id=scriptTagXSLT:the-script-element-4><a href=#the-script-element>script</a></code> elements they create need to have their <a href=#already-started id=scriptTagXSLT:already-started>"already
- started"</a> flag set in the <a href=#prepare-a-script id=scriptTagXSLT:prepare-a-script>prepare a script</a> algorithm and never get executed
- (<a href=#concept-bc-noscript id=scriptTagXSLT:concept-bc-noscript>scripting is disabled</a>). Such <code id=scriptTagXSLT:the-script-element-5><a href=#the-script-element>script</a></code>
- elements still need to be marked <a href=#parser-inserted id=scriptTagXSLT:parser-inserted-2>"parser-inserted"</a>, though, such that their <code id=scriptTagXSLT:dom-script-async><a href=#dom-script-async>async</a></code> IDL attribute will return false in the absence of an <code id=scriptTagXSLT:attr-script-async-2><a href=#attr-script-async>async</a></code> content attribute.<li><p>The <code id=scriptTagXSLT:dom-xsltprocessor-transformtofragment><a href=#dom-xsltprocessor-transformtofragment>XSLTProcessor.transformToFragment()</a></code> method
- needs to create a fragment that is equivalent to one built manually by creating the elements
- using <code id=scriptTagXSLT:dom-document-createelementns><a href=#dom-document-createelementns>document.createElementNS()</a></code>. For instance,
- it needs to create <code id=scriptTagXSLT:the-script-element-6><a href=#the-script-element>script</a></code> elements that aren't <a href=#parser-inserted id=scriptTagXSLT:parser-inserted-3>"parser-inserted"</a> and
- that don't have their <a href=#already-started id=scriptTagXSLT:already-started-2>"already started"</a> flag set, so that they will execute when the
- fragment is inserted into a document.</ul>
- <p>The main distinction between the first two cases and the last case is that the first two
- operate on <code id=scriptTagXSLT:document-2><a href=#document>Document</a></code>s and the last operates on a fragment.</p>
-
- <h4 id=the-noscript-element>4.12.2 The <dfn><code>noscript</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-noscript-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-noscript-element:metadata-content-2>Metadata content</a>.<dd><a href=#flow-content-2 id=the-noscript-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-noscript-element:phrasing-content-2>Phrasing content</a>.<dt><a href=#concept-element-contexts id=the-noscript-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>In a <code id=the-noscript-element:the-head-element><a href=#the-head-element>head</a></code> element of an <a href=#html-documents id=the-noscript-element:html-documents>HTML document</a>, if there are no ancestor <code id=the-noscript-element:the-noscript-element><a href=#the-noscript-element>noscript</a></code> elements.<dd>Where <a href=#phrasing-content-2 id=the-noscript-element:phrasing-content-2-2>phrasing content</a> is expected in <a href=#html-documents id=the-noscript-element:html-documents-2>HTML documents</a>, if there are no ancestor <code id=the-noscript-element:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code> elements.<dt><a href=#concept-element-content-model id=the-noscript-element:concept-element-content-model>Content model</a>:<dd>When <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript>scripting is disabled</a>, in a <code id=the-noscript-element:the-head-element-2><a href=#the-head-element>head</a></code> element: in any order, zero or more <code id=the-noscript-element:the-link-element><a href=#the-link-element>link</a></code> elements, zero or more <code id=the-noscript-element:the-style-element><a href=#the-style-element>style</a></code> elements, and zero or more <code id=the-noscript-element:the-meta-element><a href=#the-meta-element>meta</a></code> elements.<dd>When <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript-2>scripting is disabled</a>, not in a <code id=the-noscript-element:the-head-element-3><a href=#the-head-element>head</a></code> element: <a href=#transparent id=the-noscript-element:transparent>transparent</a>, but there must be no <code id=the-noscript-element:the-noscript-element-3><a href=#the-noscript-element>noscript</a></code> element descendants.<dd>Otherwise: text that conforms to the requirements given in the prose.<dt><a href=#concept-element-tag-omission id=the-noscript-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-noscript-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-noscript-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-noscript-element:concept-element-dom>DOM interface</a>:<dd>Uses <code id=the-noscript-element:htmlelement><a href=#htmlelement>HTMLElement</a></code>.</dl>
- <p>The <code id=the-noscript-element:the-noscript-element-4><a href=#the-noscript-element>noscript</a></code> element <a href=#represents id=the-noscript-element:represents>represents</a> nothing if <a href=#concept-n-script id=the-noscript-element:concept-n-script>scripting is enabled</a>, and <a href=#represents id=the-noscript-element:represents-2>represents</a> its children if
- <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript-3>scripting is disabled</a>. It is used to present different
- markup to user agents that support scripting and those that don't support scripting, by affecting
- how the document is parsed.</p>
- <p>When used in <a href=#html-documents id=the-noscript-element:html-documents-3>HTML documents</a>, the allowed content model is as follows:</p>
- <dl><dt>In a <code id=the-noscript-element:the-head-element-4><a href=#the-head-element>head</a></code> element, if <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript-4>scripting is
- disabled</a> for the <code id=the-noscript-element:the-noscript-element-5><a href=#the-noscript-element>noscript</a></code> element<dd><p>The <code id=the-noscript-element:the-noscript-element-6><a href=#the-noscript-element>noscript</a></code> element must contain only <code id=the-noscript-element:the-link-element-2><a href=#the-link-element>link</a></code>, <code id=the-noscript-element:the-style-element-2><a href=#the-style-element>style</a></code>,
- and <code id=the-noscript-element:the-meta-element-2><a href=#the-meta-element>meta</a></code> elements.<dt>In a <code id=the-noscript-element:the-head-element-5><a href=#the-head-element>head</a></code> element, if <a href=#concept-n-script id=the-noscript-element:concept-n-script-2>scripting is enabled</a>
- for the <code id=the-noscript-element:the-noscript-element-7><a href=#the-noscript-element>noscript</a></code> element<dd><p>The <code id=the-noscript-element:the-noscript-element-8><a href=#the-noscript-element>noscript</a></code> element must contain only text, except that invoking the
- <a href=#html-fragment-parsing-algorithm id=the-noscript-element:html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a> with
- the <code id=the-noscript-element:the-noscript-element-9><a href=#the-noscript-element>noscript</a></code> element as the <var id=the-noscript-element:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var>
- element and the text contents as the <var>input</var> must result in a list of nodes
- that consists only of <code id=the-noscript-element:the-link-element-3><a href=#the-link-element>link</a></code>, <code id=the-noscript-element:the-style-element-3><a href=#the-style-element>style</a></code>, and <code id=the-noscript-element:the-meta-element-3><a href=#the-meta-element>meta</a></code> elements that
- would be conforming if they were children of the <code id=the-noscript-element:the-noscript-element-10><a href=#the-noscript-element>noscript</a></code> element, and no <a href=#parse-error id=the-noscript-element:parse-error>parse errors</a>.<dt>Outside of <code id=the-noscript-element:the-head-element-6><a href=#the-head-element>head</a></code> elements, if <a href=#concept-n-noscript id=the-noscript-element:concept-n-noscript-5>scripting is
- disabled</a> for the <code id=the-noscript-element:the-noscript-element-11><a href=#the-noscript-element>noscript</a></code> element<dd><p>The <code id=the-noscript-element:the-noscript-element-12><a href=#the-noscript-element>noscript</a></code> element's content model is <a href=#transparent id=the-noscript-element:transparent-2>transparent</a>, with the
- additional restriction that a <code id=the-noscript-element:the-noscript-element-13><a href=#the-noscript-element>noscript</a></code> element must not have a <code id=the-noscript-element:the-noscript-element-14><a href=#the-noscript-element>noscript</a></code>
- element as an ancestor (that is, <code id=the-noscript-element:the-noscript-element-15><a href=#the-noscript-element>noscript</a></code> can't be nested).<dt>Outside of <code id=the-noscript-element:the-head-element-7><a href=#the-head-element>head</a></code> elements, if <a href=#concept-n-script id=the-noscript-element:concept-n-script-3>scripting is
- enabled</a> for the <code id=the-noscript-element:the-noscript-element-16><a href=#the-noscript-element>noscript</a></code> element<dd>
- <p>The <code id=the-noscript-element:the-noscript-element-17><a href=#the-noscript-element>noscript</a></code> element must contain only text, except that the text must be such
- that running the following algorithm results in a conforming document with no
- <code id=the-noscript-element:the-noscript-element-18><a href=#the-noscript-element>noscript</a></code> elements and no <code id=the-noscript-element:the-script-element><a href=#the-script-element>script</a></code> elements, and such that no step in the
- algorithm throws an exception or causes an <a href=#html-parser id=the-noscript-element:html-parser>HTML parser</a> to flag a <a href=#parse-error id=the-noscript-element:parse-error-2>parse
- error</a>:</p>
-
-
- <ol><li>Remove every <code id=the-noscript-element:the-script-element-2><a href=#the-script-element>script</a></code> element from the document.<li>Make a list of every <code id=the-noscript-element:the-noscript-element-19><a href=#the-noscript-element>noscript</a></code> element in the document. For every
- <code id=the-noscript-element:the-noscript-element-20><a href=#the-noscript-element>noscript</a></code> element in that list, perform the following steps:
- <ol><li>Let <var>s</var> be the concatenation of all the <code id=the-noscript-element:text><a href=#text>Text</a></code> node
- children of the <code id=the-noscript-element:the-noscript-element-21><a href=#the-noscript-element>noscript</a></code> element.<li>Set the <code id=the-noscript-element:dom-outerhtml><a href=#dom-outerhtml>outerHTML</a></code> attribute of the
- <code id=the-noscript-element:the-noscript-element-22><a href=#the-noscript-element>noscript</a></code> element to the value of <var>s</var>. (This, as a
- side-effect, causes the <code id=the-noscript-element:the-noscript-element-23><a href=#the-noscript-element>noscript</a></code> element to be removed from the document.) <a href=#refsDOMPARSING>[DOMPARSING]</a></ol>
- </ol>
- </dl>
- <p class=note>All these contortions are required because, for historical reasons, the
- <code id=the-noscript-element:the-noscript-element-24><a href=#the-noscript-element>noscript</a></code> element is handled differently by the <a href=#html-parser id=the-noscript-element:html-parser-2>HTML parser</a> based on
- whether <a href=#scripting-flag id=the-noscript-element:scripting-flag>scripting was enabled or not</a> when the parser was
- invoked.</p>
- <p>The <code id=the-noscript-element:the-noscript-element-25><a href=#the-noscript-element>noscript</a></code> element must not be used in <a href=#xml-documents id=the-noscript-element:xml-documents>XML documents</a>.</p>
- <p class=note>The <code id=the-noscript-element:the-noscript-element-26><a href=#the-noscript-element>noscript</a></code> element is only effective in <a href=#syntax id=the-noscript-element:syntax>the HTML
- syntax</a>, it has no effect in <a href=#the-xhtml-syntax id=the-noscript-element:the-xhtml-syntax>the XHTML syntax</a>. This is because the way it works
- is by essentially "turning off" the parser when scripts are enabled, so that the contents of the
- element are treated as pure text and not as real elements. XML does not define a mechanism by
- which to do this.</p>
-
- <p>The <code id=the-noscript-element:the-noscript-element-27><a href=#the-noscript-element>noscript</a></code> element has no other requirements. In particular, children of the
- <code id=the-noscript-element:the-noscript-element-28><a href=#the-noscript-element>noscript</a></code> element are not exempt from <a href=#form-submission-2 id=the-noscript-element:form-submission-2>form submission</a>, scripting, and so
- forth, even when <a href=#concept-n-script id=the-noscript-element:concept-n-script-4>scripting is enabled</a> for the element.</p>
-
- <div class=example>
- <p>In the following example, a <code id=the-noscript-element:the-noscript-element-29><a href=#the-noscript-element>noscript</a></code> element is
- used to provide fallback for a script.</p>
- <pre><form action="calcSquare.php">
- <p>
- <label for=x>Number</label>:
- <input id="x" name="x" type="number">
- </p>
- <script>
- var x = document.getElementById('x');
- var output = document.createElement('p');
- output.textContent = 'Type a number; it will be squared right then!';
- x.form.appendChild(output);
- x.form.onsubmit = function () { return false; }
- x.oninput = function () {
- var v = x.valueAsNumber;
- output.textContent = v + ' squared is ' + v * v;
- };
- </script>
- <noscript>
- <input type=submit value="Calculate Square">
- </noscript>
- </form></pre>
- <p>When script is disabled, a button appears to do the calculation on the server side. When
- script is enabled, the value is computed on-the-fly instead.</p>
- <p>The <code id=the-noscript-element:the-noscript-element-30><a href=#the-noscript-element>noscript</a></code> element is a blunt instrument. Sometimes, scripts might be enabled,
- but for some reason the page's script might fail. For this reason, it's generally better to avoid
- using <code id=the-noscript-element:the-noscript-element-31><a href=#the-noscript-element>noscript</a></code>, and to instead design the script to change the page from being a
- scriptless page to a scripted page on the fly, as in the next example:</p>
- <pre><form action="calcSquare.php">
- <p>
- <label for=x>Number</label>:
- <input id="x" name="x" type="number">
- </p>
- <strong><input id="submit" type=submit value="Calculate Square"></strong>
- <script>
- var x = document.getElementById('x');
- var output = document.createElement('p');
- output.textContent = 'Type a number; it will be squared right then!';
- x.form.appendChild(output);
- x.form.onsubmit = function () { return false; }
- x.oninput = function () {
- var v = x.valueAsNumber;
- output.textContent = v + ' squared is ' + v * v;
- };
- <strong> var submit = document.getElementById('submit');
- submit.parentNode.removeChild(submit);</strong>
- </script>
- </form></pre>
- <p>The above technique is also useful in XHTML, since <code id=the-noscript-element:the-noscript-element-32><a href=#the-noscript-element>noscript</a></code> is not supported in
- <a href=#the-xhtml-syntax id=the-noscript-element:the-xhtml-syntax-2>the XHTML syntax</a>.</p>
- </div>
- <h4 id=the-template-element>4.12.3 The <dfn><code>template</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-template-element:concept-element-categories>Categories</a>:<dd><a href=#metadata-content-2 id=the-template-element:metadata-content-2>Metadata content</a>.<dd><a href=#flow-content-2 id=the-template-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-template-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#script-supporting-elements-2 id=the-template-element:script-supporting-elements-2>Script-supporting element</a>.<dt><a href=#concept-element-contexts id=the-template-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#metadata-content-2 id=the-template-element:metadata-content-2-2>metadata content</a> is expected.<dd>Where <a href=#phrasing-content-2 id=the-template-element:phrasing-content-2-2>phrasing content</a> is expected.<dd>Where <a href=#script-supporting-elements-2 id=the-template-element:script-supporting-elements-2-2>script-supporting elements</a> are expected.<dd>As a child of a <code id=the-template-element:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element that doesn't have a <code id=the-template-element:attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute.<dt><a href=#concept-element-content-model id=the-template-element:concept-element-content-model>Content model</a>:<dd>Either: <a href=#metadata-content-2 id=the-template-element:metadata-content-2-3>Metadata content</a>.<dd>Or: <a href=#flow-content-2 id=the-template-element:flow-content-2-2>Flow content</a>.<dd>Or: The content model of <code id=the-template-element:the-ol-element><a href=#the-ol-element>ol</a></code> and <code id=the-template-element:the-ul-element><a href=#the-ul-element>ul</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-dl-element><a href=#the-dl-element>dl</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-figure-element><a href=#the-figure-element>figure</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-ruby-element><a href=#the-ruby-element>ruby</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-object-element><a href=#the-object-element>object</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-video-element><a href=#the-video-element>video</a></code> and <code id=the-template-element:the-audio-element><a href=#the-audio-element>audio</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-table-element><a href=#the-table-element>table</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-thead-element><a href=#the-thead-element>thead</a></code>, <code id=the-template-element:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, and <code id=the-template-element:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-tr-element><a href=#the-tr-element>tr</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-select-element><a href=#the-select-element>select</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-details-element><a href=#the-details-element>details</a></code> elements.<dd>Or: The content model of <code id=the-template-element:the-menu-element><a href=#the-menu-element>menu</a></code> elements whose <code id=the-template-element:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#popup-menu-state id=the-template-element:popup-menu-state>popup menu state</a>.<dt><a href=#concept-element-tag-omission id=the-template-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-template-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-template-element:global-attributes>Global attributes</a><dt><a href=#concept-element-dom id=the-template-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>interface <dfn id=htmltemplateelement>HTMLTemplateElement</dfn> : <a href=#htmlelement id=the-template-element:htmlelement>HTMLElement</a> {
- readonly attribute <a href=#documentfragment id=the-template-element:documentfragment>DocumentFragment</a> <a href=#dom-template-content id=the-template-element:dom-template-content>content</a>;
- };</pre>
- </dl>
- <p>The <code id=the-template-element:the-template-element><a href=#the-template-element>template</a></code> element is used to declare fragments of HTML that can be cloned and
- inserted in the document by script.</p>
- <p>In a rendering, the <code id=the-template-element:the-template-element-2><a href=#the-template-element>template</a></code> element <a href=#represents id=the-template-element:represents>represents</a> nothing.</p>
- <dl class=domintro><dt><var>template</var> . <code id=the-template-element:dom-template-content-2><a href=#dom-template-content>content</a></code><dd>
- <p>Returns the contents of the <code id=the-template-element:the-template-element-3><a href=#the-template-element>template</a></code>, which are stored in a
- <code id=the-template-element:documentfragment-2><a href=#documentfragment>DocumentFragment</a></code> associated with a different <code id=the-template-element:document><a href=#document>Document</a></code> so as to avoid
- the <code id=the-template-element:the-template-element-4><a href=#the-template-element>template</a></code> contents interfering with the main <code id=the-template-element:document-2><a href=#document>Document</a></code>. (For
- example, this avoids form controls from being submitted, scripts from executing, and so
- forth.)</p>
- </dl>
-
- <p>Each <code id=the-template-element:the-template-element-5><a href=#the-template-element>template</a></code> element has an associated <code id=the-template-element:documentfragment-3><a href=#documentfragment>DocumentFragment</a></code> object that
- is its <dfn id=template-contents>template contents</dfn>. When a <code id=the-template-element:the-template-element-6><a href=#the-template-element>template</a></code> element is created, the user
- agent must run the following steps to establish the <a href=#template-contents id=the-template-element:template-contents>template contents</a>:</p>
- <ol><li><p>Let <var>doc</var> be the <code id=the-template-element:the-template-element-7><a href=#the-template-element>template</a></code> element's <a id=the-template-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#appropriate-template-contents-owner-document id=the-template-element:appropriate-template-contents-owner-document>appropriate template contents owner
- document</a>.<li><p>Create a <code id=the-template-element:documentfragment-4><a href=#documentfragment>DocumentFragment</a></code> object whose <a id=the-template-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is <var>doc</var>.<li><p>Set the <code id=the-template-element:the-template-element-8><a href=#the-template-element>template</a></code> element's <a href=#template-contents id=the-template-element:template-contents-2>template contents</a> to the newly
- created <code id=the-template-element:documentfragment-5><a href=#documentfragment>DocumentFragment</a></code> object.</ol>
- <p>A <code id=the-template-element:document-3><a href=#document>Document</a></code> <var>doc</var>'s <dfn id=appropriate-template-contents-owner-document>appropriate template contents owner
- document</dfn> is the <code id=the-template-element:document-4><a href=#document>Document</a></code> returned by the following algorithm:</p>
- <ol><li>
- <p>If <var>doc</var> is not a <code id=the-template-element:document-5><a href=#document>Document</a></code> created by this algorithm, run
- these substeps:</p>
- <ol><li>
- <p>If <var>doc</var> does not yet have an <dfn id=associated-inert-template-document>associated inert template
- document</dfn> then run these substeps:</p>
- <ol><li><p>Let <var>new doc</var> be a new <code id=the-template-element:document-6><a href=#document>Document</a></code> (that does not have a
- <a href=#browsing-context id=the-template-element:browsing-context>browsing context</a>). This is "a <code id=the-template-element:document-7><a href=#document>Document</a></code> created by this algorithm"
- for the purposes of the step above.<li><p>If <var>doc</var> is an <a href=#html-documents id=the-template-element:html-documents>HTML document</a>, mark
- <var>new doc</var> as an <a href=#html-documents id=the-template-element:html-documents-2>HTML document</a>
- also.<li><p>Let <var>doc</var>'s <a href=#associated-inert-template-document id=the-template-element:associated-inert-template-document>associated inert template document</a> be <var>new doc</var>.</ol>
- <li><p>Set <var>doc</var> to <var>doc</var>'s <a href=#associated-inert-template-document id=the-template-element:associated-inert-template-document-2>associated inert
- template document</a>.</ol>
- <p class=note>Each <code id=the-template-element:document-8><a href=#document>Document</a></code> not created by this algorithm thus gets a single
- <code id=the-template-element:document-9><a href=#document>Document</a></code> to act as its proxy for owning the <a href=#template-contents id=the-template-element:template-contents-3>template contents</a> of all
- its <code id=the-template-element:the-template-element-9><a href=#the-template-element>template</a></code> elements, so that they aren't in a <a href=#browsing-context id=the-template-element:browsing-context-2>browsing context</a> and
- thus remain inert (e.g. scripts do not run). Meanwhile, <code id=the-template-element:the-template-element-10><a href=#the-template-element>template</a></code> elements inside
- <code id=the-template-element:document-10><a href=#document>Document</a></code> objects that <em>are</em> created by this algorithm just reuse the same
- <code id=the-template-element:document-11><a href=#document>Document</a></code> owner for their contents.</p>
- <li><p>Return <var>doc</var>.</ol>
- <p>When a <code id=the-template-element:the-template-element-11><a href=#the-template-element>template</a></code> element's <a id=the-template-element:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> changes, the user agent must run the following
- steps:</p>
- <ol><li><p>Let <var>doc</var> be the <code id=the-template-element:the-template-element-12><a href=#the-template-element>template</a></code> element's new <a id=the-template-element:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#appropriate-template-contents-owner-document id=the-template-element:appropriate-template-contents-owner-document-2>appropriate template contents owner
- document</a>.<li><p><a href=#concept-node-adopt id=the-template-element:concept-node-adopt>Adopt</a> the <code id=the-template-element:the-template-element-13><a href=#the-template-element>template</a></code> element's
- <a href=#template-contents id=the-template-element:template-contents-4>template contents</a> (a <code id=the-template-element:documentfragment-6><a href=#documentfragment>DocumentFragment</a></code> object) into <var>doc</var>.</ol>
- <p>The <dfn id=dom-template-content><code>content</code></dfn> IDL attribute must return the
- <code id=the-template-element:the-template-element-14><a href=#the-template-element>template</a></code> element's <a href=#template-contents id=the-template-element:template-contents-5>template contents</a>.</p>
- <hr>
- <p>The <a href=#concept-node-clone-ext id=the-template-element:concept-node-clone-ext>cloning steps</a> for a <code id=the-template-element:the-template-element-15><a href=#the-template-element>template</a></code>
- element <var>node</var> being cloned to a copy <var>copy</var> must run the
- following steps:</p>
- <ol><li><p>If the <var>clone children flag</var> is not set in the calling <a href=#concept-node-clone id=the-template-element:concept-node-clone>clone</a> algorithm, abort these steps.<li><p>Let <var>copied contents</var> be the result of <a href=#concept-node-clone id=the-template-element:concept-node-clone-2>cloning</a> all the children of <var>node</var>'s
- <a href=#template-contents id=the-template-element:template-contents-6>template contents</a>, with <var>document</var> set to <var>copy</var>'s <a href=#template-contents id=the-template-element:template-contents-7>template contents</a>'s <a id=the-template-element:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node
- document</a>, and with the <var>clone children
- flag</var> set.<li><p>Append <var>copied contents</var> to <var>copy</var>'s <a href=#template-contents id=the-template-element:template-contents-8>template
- contents</a>.</ol>
-
- <div class=example>
- <p>In this example, a script populates a table four-column with data from a data structure, using
- a <code id=the-template-element:the-template-element-16><a href=#the-template-element>template</a></code> to provide the element structure instead of manually generating the
- structure from markup.</p>
- <pre><!DOCTYPE html>
- <title>Cat data</title>
- <script>
- // Data is hard-coded here, but could come from the server
- var data = [
- { name: 'Pillar', color: 'Ticked Tabby', sex: 'Female (neutered)', legs: 3 },
- { name: 'Hedral', color: 'Tuxedo', sex: 'Male (neutered)', legs: 4 },
- ];
- </script>
- <table>
- <thead>
- <tr>
- <th>Name <th>Colour <th>Sex <th>Legs
- <tbody>
- <template id="row">
- <tr><td><td><td><td>
- </template>
- </table>
- <script>
- var template = document.querySelector('#row');
- for (var i = 0; i < data.length; i += 1) {
- var cat = data[i];
- var clone = template.content.cloneNode(true);
- var cells = clone.querySelectorAll('td');
- cells[0].textContent = cat.name;
- cells[1].textContent = cat.color;
- cells[2].textContent = cat.sex;
- cells[3].textContent = cat.legs;
- template.parentNode.appendChild(clone);
- }
- </script></pre>
- </div>
-
- <h5 id=template-XSLT-XPath>4.12.3.1 Interaction of <code id=template-XSLT-XPath:the-template-element><a href=#the-template-element>template</a></code> elements with XSLT and XPath</h5>
- <p><i>This section is non-normative.</i></p>
- <p>This specification does not define how XSLT and XPath interact with the <code id=template-XSLT-XPath:the-template-element-2><a href=#the-template-element>template</a></code>
- element. However, in the absence of another specification actually defining this, here are some
- guidelines for implementors, which are intended to be consistent with other processing described
- in this specification:</p>
- <ul><li><p>An XSLT processor based on an XML parser that acts <a href=#xml-parser id=template-XSLT-XPath:xml-parser>as described
- in this specification</a> needs to act as if <code id=template-XSLT-XPath:the-template-element-3><a href=#the-template-element>template</a></code> elements contain as
- descendants their <a href=#template-contents id=template-XSLT-XPath:template-contents>template contents</a> for the purposes of the transform.<li><p>An XSLT processor that outputs a DOM needs to ensure that nodes that would go into a
- <code id=template-XSLT-XPath:the-template-element-4><a href=#the-template-element>template</a></code> element are instead placed into the element's <a href=#template-contents id=template-XSLT-XPath:template-contents-2>template
- contents</a>.<li><p>XPath evaluation using the XPath DOM API when applied to a <code id=template-XSLT-XPath:document><a href=#document>Document</a></code> parsed
- using the <a href=#html-parser id=template-XSLT-XPath:html-parser>HTML parser</a> or the <a href=#xml-parser id=template-XSLT-XPath:xml-parser-2>XML parser</a> described in this specification
- needs to ignore <a href=#template-contents id=template-XSLT-XPath:template-contents-3>template contents</a>.</p>
- </ul>
-
- <h4 id=the-canvas-element>4.12.4 The <dfn id=canvas><code>canvas</code></dfn> element</h4>
- <dl class=element><dt><a href=#concept-element-categories id=the-canvas-element:concept-element-categories>Categories</a>:<dd><a href=#flow-content-2 id=the-canvas-element:flow-content-2>Flow content</a>.<dd><a href=#phrasing-content-2 id=the-canvas-element:phrasing-content-2>Phrasing content</a>.<dd><a href=#embedded-content-category id=the-canvas-element:embedded-content-category>Embedded content</a>.<dd><a href=#palpable-content-2 id=the-canvas-element:palpable-content-2>Palpable content</a>.<dt><a href=#concept-element-contexts id=the-canvas-element:concept-element-contexts>Contexts in which this element can be used</a>:<dd>Where <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-2>embedded content</a> is expected.<dt><a href=#concept-element-content-model id=the-canvas-element:concept-element-content-model>Content model</a>:<dd><a href=#transparent id=the-canvas-element:transparent>Transparent</a>, but with no <a href=#interactive-content-2 id=the-canvas-element:interactive-content-2>interactive content</a> descendants except for <code id=the-canvas-element:the-a-element><a href=#the-a-element>a</a></code> elements, <code id=the-canvas-element:the-img-element><a href=#the-img-element>img</a></code> elements with <code id=the-canvas-element:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attributes, <code id=the-canvas-element:the-button-element><a href=#the-button-element>button</a></code> elements, <code id=the-canvas-element:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=the-canvas-element:attr-input-type><a href=#attr-input-type>type</a></code> attribute are in the <a href="#checkbox-state-(type=checkbox)" id="the-canvas-element:checkbox-state-(type=checkbox)">Checkbox</a> or <a href="#radio-button-state-(type=radio)" id="the-canvas-element:radio-button-state-(type=radio)">Radio Button</a> states, <code id=the-canvas-element:the-input-element-2><a href=#the-input-element>input</a></code> elements that are <a href=#concept-button id=the-canvas-element:concept-button>buttons</a>, <code id=the-canvas-element:the-select-element><a href=#the-select-element>select</a></code> elements with a <code id=the-canvas-element:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute or a <a href=#concept-select-size id=the-canvas-element:concept-select-size>display size</a> greater than 1, <a href=#sorting-interface-th-element id=the-canvas-element:sorting-interface-th-element>sorting interface <code>th</code> elements</a>, and elements that would not be <a href=#interactive-content-2 id=the-canvas-element:interactive-content-2-2>interactive content</a> except for having the <code id=the-canvas-element:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute specified.<dt><a href=#concept-element-tag-omission id=the-canvas-element:concept-element-tag-omission>Tag omission in text/html</a>:<dd>Neither tag is omissible.<dt><a href=#concept-element-attributes id=the-canvas-element:concept-element-attributes>Content attributes</a>:<dd><a href=#global-attributes id=the-canvas-element:global-attributes>Global attributes</a><dd><code id=the-canvas-element:attr-canvas-width><a href=#attr-canvas-width>width</a></code> — Horizontal dimension<dd><code id=the-canvas-element:attr-canvas-height><a href=#attr-canvas-height>height</a></code> — Vertical dimension<dt><a href=#concept-element-dom id=the-canvas-element:concept-element-dom>DOM interface</a>:<dd>
- <pre class=idl>typedef (<a href=#canvasrenderingcontext2d id=the-canvas-element:canvasrenderingcontext2d>CanvasRenderingContext2D</a> or <a href=#webglrenderingcontext id=the-canvas-element:webglrenderingcontext>WebGLRenderingContext</a>) <dfn id=renderingcontext>RenderingContext</dfn>;
- interface <dfn id=htmlcanvaselement>HTMLCanvasElement</dfn> : <a href=#htmlelement id=the-canvas-element:htmlelement>HTMLElement</a> {
- attribute unsigned long <a href=#dom-canvas-width id=the-canvas-element:dom-canvas-width>width</a>;
- attribute unsigned long <a href=#dom-canvas-height id=the-canvas-element:dom-canvas-height>height</a>;
- <a href=#renderingcontext id=the-canvas-element:renderingcontext>RenderingContext</a>? <a href=#dom-canvas-getcontext id=the-canvas-element:dom-canvas-getcontext>getContext</a>(DOMString contextId, any... arguments);
- boolean <a href=#dom-canvas-probablysupportscontext id=the-canvas-element:dom-canvas-probablysupportscontext>probablySupportsContext</a>(DOMString contextId, any... arguments);
- void <a href=#dom-canvas-setcontext id=the-canvas-element:dom-canvas-setcontext>setContext</a>(<a href=#renderingcontext id=the-canvas-element:renderingcontext-2>RenderingContext</a> context);
- <a href=#canvasproxy id=the-canvas-element:canvasproxy>CanvasProxy</a> <a href=#dom-canvas-transfercontroltoproxy id=the-canvas-element:dom-canvas-transfercontroltoproxy>transferControlToProxy</a>();
- DOMString <a href=#dom-canvas-todataurl id=the-canvas-element:dom-canvas-todataurl>toDataURL</a>(optional DOMString type, any... arguments);
- void <a href=#dom-canvas-toblob id=the-canvas-element:dom-canvas-toblob>toBlob</a>(<a href=#filecallback id=the-canvas-element:filecallback>FileCallback</a>? _callback, optional DOMString type, any... arguments);
- };</pre>
- </dl>
- <p>The <code id=the-canvas-element:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element provides scripts with a resolution-dependent bitmap canvas,
- which can be used for rendering graphs, game graphics, art, or other visual images on the fly.</p>
- <p>Authors should not use the <code id=the-canvas-element:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element in a document when a more suitable
- element is available. For example, it is inappropriate to use a <code id=the-canvas-element:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element to
- render a page heading: if the desired presentation of the heading is graphically intense, it
- should be marked up using appropriate elements (typically <code id=the-canvas-element:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using
- CSS and supporting technologies such as Web Components.</p>
- <p>When authors use the <code id=the-canvas-element:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code> element, they must also provide content that, when
- presented to the user, conveys essentially the same function or purpose as the
- <code id=the-canvas-element:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code>' bitmap. This content may be placed as content of the <code id=the-canvas-element:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code>
- element. The contents of the <code id=the-canvas-element:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> element, if any, are the element's <a href=#fallback-content id=the-canvas-element:fallback-content>fallback
- content</a>.</p>
- <hr>
- <p>In interactive visual media, if <a href=#concept-n-script id=the-canvas-element:concept-n-script>scripting is enabled</a> for
- the <code id=the-canvas-element:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code> element, and if support for <code id=the-canvas-element:the-canvas-element-9><a href=#the-canvas-element>canvas</a></code> elements has been enabled,
- the <code id=the-canvas-element:the-canvas-element-10><a href=#the-canvas-element>canvas</a></code> element <a href=#represents id=the-canvas-element:represents>represents</a> <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-3>embedded content</a> consisting
- of a dynamically created image, the element's bitmap.</p>
- <p>In non-interactive, static, visual media, if the <code id=the-canvas-element:the-canvas-element-11><a href=#the-canvas-element>canvas</a></code> element has been
- previously associated with a rendering context (e.g. if the page was viewed in an interactive
- visual medium and is now being printed, or if some script that ran during the page layout process
- painted on the element), then the <code id=the-canvas-element:the-canvas-element-12><a href=#the-canvas-element>canvas</a></code> element <a href=#represents id=the-canvas-element:represents-2>represents</a>
- <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-4>embedded content</a> with the element's current bitmap and size. Otherwise, the element
- represents its <a href=#fallback-content id=the-canvas-element:fallback-content-2>fallback content</a> instead.</p>
- <p>In non-visual media, and in visual media if <a href=#concept-n-noscript id=the-canvas-element:concept-n-noscript>scripting is
- disabled</a> for the <code id=the-canvas-element:the-canvas-element-13><a href=#the-canvas-element>canvas</a></code> element or if support for <code id=the-canvas-element:the-canvas-element-14><a href=#the-canvas-element>canvas</a></code> elements
- has been disabled, the <code id=the-canvas-element:the-canvas-element-15><a href=#the-canvas-element>canvas</a></code> element <a href=#represents id=the-canvas-element:represents-3>represents</a> its <a href=#fallback-content id=the-canvas-element:fallback-content-3>fallback
- content</a> instead.</p>
-
- <p>When a <code id=the-canvas-element:the-canvas-element-16><a href=#the-canvas-element>canvas</a></code> element <a href=#represents id=the-canvas-element:represents-4>represents</a> <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-5>embedded content</a>, the
- user can still focus descendants of the <code id=the-canvas-element:the-canvas-element-17><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content id=the-canvas-element:fallback-content-4>fallback
- content</a>). When an element is <a href=#focused id=the-canvas-element:focused>focused</a>, it is the target of keyboard interaction
- events (even though the element itself is not visible). This allows authors to make an interactive
- canvas keyboard-accessible: authors should have a one-to-one mapping of interactive regions to <i id=the-canvas-element:focusable-area><a href=#focusable-area>focusable areas</a></i> in the <a href=#fallback-content id=the-canvas-element:fallback-content-5>fallback content</a>. (Focus has no
- effect on mouse interaction events.) <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>An element whose nearest <code id=the-canvas-element:the-canvas-element-18><a href=#the-canvas-element>canvas</a></code> element ancestor is <a href=#being-rendered id=the-canvas-element:being-rendered>being rendered</a>
- and <a href=#represents id=the-canvas-element:represents-5>represents</a> <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-6>embedded content</a> is an element that is <dfn id=being-used-as-relevant-canvas-fallback-content>being used as
- relevant canvas fallback content</dfn>.</p>
- <hr>
- <p>The <code id=the-canvas-element:the-canvas-element-19><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the size of the element's bitmap:
- <dfn id=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height><code>height</code></dfn>. These attributes, when specified, must have
- values that are <a href=#valid-non-negative-integer id=the-canvas-element:valid-non-negative-integer>valid non-negative integers</a>. The <a href=#rules-for-parsing-non-negative-integers id=the-canvas-element:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> must be used to obtain their
- numeric values. If an attribute is missing, or if parsing its value returns an error, then the
- default value must be used instead. The <code id=the-canvas-element:attr-canvas-width-2><a href=#attr-canvas-width>width</a></code>
- attribute defaults to 300, and the <code id=the-canvas-element:attr-canvas-height-2><a href=#attr-canvas-height>height</a></code> attribute
- defaults to 150.</p>
- <p>The intrinsic dimensions of the <code id=the-canvas-element:the-canvas-element-20><a href=#the-canvas-element>canvas</a></code> element when it <a href=#represents id=the-canvas-element:represents-6>represents</a>
- <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-7>embedded content</a> are equal to the dimensions of the element's bitmap.</p>
- <p>The user agent must use a square pixel density consisting of one pixel of image data per
- coordinate space unit for the bitmaps of a <code id=the-canvas-element:the-canvas-element-21><a href=#the-canvas-element>canvas</a></code> and its rendering contexts.</p>
- <p class=note>A <code id=the-canvas-element:the-canvas-element-22><a href=#the-canvas-element>canvas</a></code> element can be sized arbitrarily by a style sheet, its
- bitmap is then subject to the 'object-fit' CSS property. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
-
- <hr>
- <p>The bitmaps of <code id=the-canvas-element:the-canvas-element-23><a href=#the-canvas-element>canvas</a></code> elements, as well as some of the bitmaps of rendering
- contexts, such as those described in the section on the <code id=the-canvas-element:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
- object below, have an <dfn id=concept-canvas-origin-clean>origin-clean</dfn> flag, which can
- be set to true or false. Initially, when the <code id=the-canvas-element:the-canvas-element-24><a href=#the-canvas-element>canvas</a></code> element is created, its bitmap's
- <a href=#concept-canvas-origin-clean id=the-canvas-element:concept-canvas-origin-clean>origin-clean</a> flag must be set to true.</p>
- <p>A <code id=the-canvas-element:the-canvas-element-25><a href=#the-canvas-element>canvas</a></code> bitmap can also have a <a href=#hit-region-list id=the-canvas-element:hit-region-list>hit region list</a>, as described in the
- <code id=the-canvas-element:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> section below.</p>
- <p>A <code id=the-canvas-element:the-canvas-element-26><a href=#the-canvas-element>canvas</a></code> element can have a rendering context bound to it. Initially, it does not
- have a bound rendering context. To keep track of whether it has a rendering context or not, and
- what kind of rendering context it is, a <code id=the-canvas-element:the-canvas-element-27><a href=#the-canvas-element>canvas</a></code> also has a <dfn id=concept-canvas-context-mode>canvas context mode</dfn>, which is initially <dfn id=concept-canvas-none>none</dfn> but can be changed to either <dfn id=concept-canvas-direct-2d>direct-2d</dfn>, <dfn id=concept-canvas-direct-webgl>direct-webgl</dfn>, <dfn id=concept-canvas-indirect>indirect</dfn>, or <dfn id=concept-canvas-proxied>proxied</dfn> by algorithms defined in this specification.</p>
- <p>When its <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode>canvas context mode</a> is <a href=#concept-canvas-none id=the-canvas-element:concept-canvas-none>none</a>, a <code id=the-canvas-element:the-canvas-element-28><a href=#the-canvas-element>canvas</a></code> element has no rendering context,
- and its bitmap must be fully transparent black with an intrinsic width equal to the numeric value
- of the element's <code id=the-canvas-element:attr-canvas-width-3><a href=#attr-canvas-width>width</a></code> attribute and an intrinsic height
- equal to the numeric value of the element's <code id=the-canvas-element:attr-canvas-height-3><a href=#attr-canvas-height>height</a></code>
- attribute, those values being interpreted in CSS pixels, and being updated as the attributes are
- set, changed, or removed.</p>
- <p>When a <code id=the-canvas-element:the-canvas-element-29><a href=#the-canvas-element>canvas</a></code> element represents <a href=#embedded-content-category id=the-canvas-element:embedded-content-category-8>embedded content</a>, it <a href=#provides-a-paint-source id=the-canvas-element:provides-a-paint-source>provides
- a paint source</a> whose width is the element's intrinsic width, whose height is the element's
- intrinsic height, and whose appearance is the element's bitmap.</p>
- <p>Whenever the <code id=the-canvas-element:attr-canvas-width-4><a href=#attr-canvas-width>width</a></code> and <code id=the-canvas-element:attr-canvas-height-4><a href=#attr-canvas-height>height</a></code> content attributes are set, removed, changed, or
- redundantly set to the value they already have, if the <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-2>canvas context mode</a> is <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d>direct-2d</a>, the user agent must <a href=#concept-canvas-set-bitmap-dimensions id=the-canvas-element:concept-canvas-set-bitmap-dimensions>set bitmap dimensions</a> to the numeric values of
- the <code id=the-canvas-element:attr-canvas-width-5><a href=#attr-canvas-width>width</a></code> and <code id=the-canvas-element:attr-canvas-height-5><a href=#attr-canvas-height>height</a></code> content attributes.</p>
- <p>The <dfn id=dom-canvas-width><code>width</code></dfn> and <dfn id=dom-canvas-height><code>height</code></dfn> IDL attributes must <a href=#reflect id=the-canvas-element:reflect>reflect</a> the
- respective content attributes of the same name, with the same defaults.</p>
-
- <hr>
-
- <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=the-canvas-element:dom-canvas-getcontext-2><a href=#dom-canvas-getcontext>getContext</a></code>(<var>contextId</var> [, ... ] )<dd>
- <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
- the desired API, either "<code id=the-canvas-element:canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" or "<code id=the-canvas-element:canvas-context-webgl><a href=#canvas-context-webgl>webgl</a></code>". Subsequent arguments are handled by that API.</p>
- <p>This specification defines the "<code id=the-canvas-element:canvas-context-2d-2><a href=#canvas-context-2d>2d</a></code>" context below.
- There is also a specification that defines a "<code id=the-canvas-element:canvas-context-webgl-2><a href=#canvas-context-webgl>webgl</a></code>"
- context. <a href=#refsWEBGL>[WEBGL]</a></p>
- <p>Returns null if the given context ID is not supported, if the canvas has already been
- initialised with the other context type (e.g. trying to get a "<code id=the-canvas-element:canvas-context-2d-3><a href=#canvas-context-2d>2d</a></code>" context after getting a "<code id=the-canvas-element:canvas-context-webgl-3><a href=#canvas-context-webgl>webgl</a></code>" context).</p>
- <p>Throws an <code id=the-canvas-element:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=the-canvas-element:dom-canvas-setcontext-2><a href=#dom-canvas-setcontext>setContext()</a></code> or <code id=the-canvas-element:dom-canvas-transfercontroltoproxy-2><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
- used.</p>
- <dt><var>supported</var> = <var>canvas</var> . <code id=the-canvas-element:dom-canvas-probablysupportscontext-2><a href=#dom-canvas-probablysupportscontext>probablySupportsContext</a></code>(<var>contextId</var> [, ... ] )<dd>
- <p>Returns false if calling <code id=the-canvas-element:dom-canvas-getcontext-3><a href=#dom-canvas-getcontext>getContext()</a></code> with the
- same arguments would definitely return null, and true otherwise.</p>
- <p>This return value is not a guarantee that <code id=the-canvas-element:dom-canvas-getcontext-4><a href=#dom-canvas-getcontext>getContext()</a></code> will or will not return an object, as
- conditions (e.g. availability of system resources) can vary over time.</p>
- <p>Throws an <code id=the-canvas-element:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=the-canvas-element:dom-canvas-setcontext-3><a href=#dom-canvas-setcontext>setContext()</a></code> or <code id=the-canvas-element:dom-canvas-transfercontroltoproxy-3><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
- used.</p>
- <dt><var>canvas</var> . <code id=the-canvas-element:dom-canvas-setcontext-4><a href=#dom-canvas-setcontext>setContext</a></code>(<var>context</var>)<dd>
- <p>Sets the <code id=the-canvas-element:the-canvas-element-30><a href=#the-canvas-element>canvas</a></code>' rendering context to the given object.</p>
- <p>Throws an <code id=the-canvas-element:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=the-canvas-element:dom-canvas-getcontext-5><a href=#dom-canvas-getcontext>getContext()</a></code> or <code id=the-canvas-element:dom-canvas-transfercontroltoproxy-4><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy()</a></code> methods have been
- used.</p>
- </dl>
-
- <p>There are two ways for a <code id=the-canvas-element:the-canvas-element-31><a href=#the-canvas-element>canvas</a></code> element to acquire a rendering context: the
- <code id=the-canvas-element:the-canvas-element-32><a href=#the-canvas-element>canvas</a></code> element can provide one via the <code id=the-canvas-element:dom-canvas-getcontext-6><a href=#dom-canvas-getcontext>getContext()</a></code> method, and one can be assigned to it via the
- <code id=the-canvas-element:dom-canvas-setcontext-5><a href=#dom-canvas-setcontext>setContext()</a></code> method. In addition, the whole issue of a
- rendering context can be taken out of the <code id=the-canvas-element:the-canvas-element-33><a href=#the-canvas-element>canvas</a></code> element's hands and passed to a
- <code id=the-canvas-element:canvasproxy-2><a href=#canvasproxy>CanvasProxy</a></code> object, which itself can then be assigned a rendering context using its
- <code id=the-canvas-element:dom-canvasproxy-setcontext><a href=#dom-canvasproxy-setcontext>setContext()</a></code> method.</p>
- <p>These three methods are mutually exclusive; calling any of the three makes the other two start
- throwing <code id=the-canvas-element:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code> exceptions when called.</p>
- <p>Each rendering context has a <dfn id=concept-canvas-context-bitmap-mode>context bitmap
- mode</dfn>, which is one of <dfn id=concept-canvas-fixed>fixed</dfn>, <dfn id=concept-canvas-unbound>unbound</dfn>, or <dfn id=concept-canvas-bound>bound</dfn>.
- Initially, rendering contexts must be in the <a href=#concept-canvas-bound id=the-canvas-element:concept-canvas-bound>unbound</a>
- mode.</p>
- <hr>
- <p>The <dfn id=dom-canvas-getcontext><code>getContext(<var>contextId</var>, <var>arguments...</var>)</code></dfn> method of the <code id=the-canvas-element:the-canvas-element-34><a href=#the-canvas-element>canvas</a></code> element, when invoked,
- must run the steps in the cell of the following table whose column header describes the
- <code id=the-canvas-element:the-canvas-element-35><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-3>canvas context mode</a>
- and whose row header describes the method's first argument.</p>
- <table><thead><tr><td>
- <th><a href=#concept-canvas-none id=the-canvas-element:concept-canvas-none-2>none</a>
- <th><a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-2>direct-2d</a>
- <th><a href=#concept-canvas-direct-webgl id=the-canvas-element:concept-canvas-direct-webgl>direct-webgl</a>
- <th><a href=#concept-canvas-indirect id=the-canvas-element:concept-canvas-indirect>indirect</a>
- <th><a href=#concept-canvas-proxied id=the-canvas-element:concept-canvas-proxied>proxied</a>
- <tbody><tr><th>"<dfn id=canvas-context-2d><code>2d</code></dfn>"
- <td>
- Set the <code id=the-canvas-element:the-canvas-element-36><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-4>context
- mode</a> to <a href=#concept-canvas-direct-2d id=the-canvas-element:concept-canvas-direct-2d-3>direct-2d</a>; follow the <a href=#2d-context-creation-algorithm id=the-canvas-element:2d-context-creation-algorithm>2D
- context creation algorithm</a> defined in the section below, passing it the
- <code id=the-canvas-element:the-canvas-element-37><a href=#the-canvas-element>canvas</a></code> element, to obtain a <code id=the-canvas-element:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object; set
- that object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode>context bitmap mode</a> to
- <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed>fixed</a>, and return the
- <code id=the-canvas-element:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
- <td>
- Return the same object as was return the last time the method was invoked with this same
- argument.
- <td>
- Return null.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-6><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <tr><th>"<dfn id=canvas-context-webgl><code>webgl</code></dfn>", if the user agent supports the WebGL feature in its current configuration
- <td>
- Follow the instructions given in the WebGL specification's <i>Context Creation</i> section to
- obtain either a <code id=the-canvas-element:webglrenderingcontext-2><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> or null; if the returned value is null,
- then return null and abort these steps, otherwise, set the <code id=the-canvas-element:the-canvas-element-38><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-5>context mode</a> to <a href=#concept-canvas-direct-webgl id=the-canvas-element:concept-canvas-direct-webgl-2>direct-webgl</a>, set the new
- <code id=the-canvas-element:webglrenderingcontext-3><a href=#webglrenderingcontext>WebGLRenderingContext</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-2>context bitmap mode</a> to <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed-2>fixed</a>, and return the <code id=the-canvas-element:webglrenderingcontext-4><a href=#webglrenderingcontext>WebGLRenderingContext</a></code>
- object‡ <a href=#refsWEBGL>[WEBGL]</a>
- <td>
- Return null.
- <td>
- Return the same object as was return the last time the method was invoked with this same
- argument.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-8><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <tr><th>A vendor-specific extension*
- <td>
- Behave as defined for the extension.
- <td>
- Behave as defined for the extension.
- <td>
- Behave as defined for the extension.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-9><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-10><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <tr><th>An unsupported value†
- <td>
- Return null.
- <td>
- Return null.
- <td>
- Return null.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-11><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- <td>
- Throw an <code id=the-canvas-element:invalidstateerror-12><a href=#invalidstateerror>InvalidStateError</a></code> exception.
- </table>
- <p class=tablenote><small>* Vendors may define experimental contexts using the syntax <code><var>vendorname</var>-<var>context</var></code>, for example, <code>moz-3d</code>.</small></p>
- <p class=tablenote><small>† For example, the "<code id=the-canvas-element:canvas-context-webgl-4><a href=#canvas-context-webgl>webgl</a></code>" value in the case of a user agent having exhausted the
- graphics hardware's abilities and having no software fallback implementation.</small></p>
- <p class=tablenote><small>‡ The second (and subsequent) argument(s) to the method, if
- any, are ignored in all cases except this one. See the WebGL specification for
- details.</small></p>
- <hr>
- <p>The <dfn id=dom-canvas-probablysupportscontext><code>probablySupportsContext(<var>contextId</var>,
- <var>arguments...</var>)</code></dfn> method of the <code id=the-canvas-element:the-canvas-element-39><a href=#the-canvas-element>canvas</a></code> element, when
- invoked, must return false if calling <code id=the-canvas-element:dom-canvas-getcontext-7><a href=#dom-canvas-getcontext>getContext()</a></code> on
- the same object and with the same arguments would definitely return null at this time, and true
- otherwise.</p>
- <hr>
- <p>The <dfn id=dom-canvas-setcontext><code>setContext(<var>context</var>)</code></dfn> method of the <code id=the-canvas-element:the-canvas-element-40><a href=#the-canvas-element>canvas</a></code> element, when invoked, must
- run the following steps:</p>
- <ol><li><p>If the <code id=the-canvas-element:the-canvas-element-41><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-6>canvas
- context mode</a> is neither <a href=#concept-canvas-none id=the-canvas-element:concept-canvas-none-3>none</a> nor <a href=#concept-canvas-indirect id=the-canvas-element:concept-canvas-indirect-2>indirect</a>, throw an <code id=the-canvas-element:invalidstateerror-13><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.<li><p>If <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-3>context
- bitmap mode</a> is <a href=#concept-canvas-fixed id=the-canvas-element:concept-canvas-fixed-3>fixed</a>, then throw an
- <code id=the-canvas-element:invalidstateerror-14><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-4>context
- bitmap mode</a> is <a href=#concept-canvas-bound id=the-canvas-element:concept-canvas-bound-2>bound</a>, then run <var>context</var>'s <a href=#concept-canvas-unbinding-steps id=the-canvas-element:concept-canvas-unbinding-steps>unbinding steps</a> and
- set its <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-5>context
- bitmap mode</a> to <a href=#concept-canvas-unbound id=the-canvas-element:concept-canvas-unbound>unbound</a>.<li><p>Run <var>context</var>'s <a href=#concept-canvas-binding-steps id=the-canvas-element:concept-canvas-binding-steps>binding
- steps</a> to bind it to this <code id=the-canvas-element:the-canvas-element-42><a href=#the-canvas-element>canvas</a></code> element.<li><p>Set the <code id=the-canvas-element:the-canvas-element-43><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=the-canvas-element:concept-canvas-context-mode-7>context
- mode</a> to <a href=#concept-canvas-indirect id=the-canvas-element:concept-canvas-indirect-3>indirect</a> and the <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=the-canvas-element:concept-canvas-context-bitmap-mode-6>context bitmap
- mode</a> to <a href=#concept-canvas-bound id=the-canvas-element:concept-canvas-bound-3>bound</a>.</ol>
- <hr>
-
- <dl class=domintro><dt><var>url</var> = <var>canvas</var> . <code id=the-canvas-element:dom-canvas-todataurl-2><a href=#dom-canvas-todataurl>toDataURL</a></code>( [ <var>type</var>, ... ] )<dd>
- <p>Returns a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=the-canvas-element:data-protocol data-x-internal=data-protocol><code>data:</code> URL</a> for the image in the
- canvas.</p>
- <p>The first argument, if provided, controls the type of the image to be returned (e.g. PNG or
- JPEG). The default is <code>image/png</code>; that type is also used if the given type
- isn't supported. The other arguments are specific to the type, and control the way that the
- image is generated, as given <a href=#canvas-serialisation-arguments>in the table
- below</a>.</p>
- <p>When trying to use types other than "<code id=the-canvas-element:image/png><a href=#image/png>image/png</a></code>", authors can check if the image
- was really returned in the requested format by checking to see if the returned string starts
- with one of the exact strings "<code>data:image/png,</code>" or "<code>data:image/png;</code>". If it does, the image is PNG, and thus the requested type was
- not supported. (The one exception to this is if the canvas has either no height or no width, in
- which case the result might simply be "<code>data:,</code>".)</p>
- <dt><var>canvas</var> . <code id=the-canvas-element:dom-canvas-toblob-2><a href=#dom-canvas-toblob>toBlob</a></code>(<var>callback</var> [, <var>type</var>, ... ] )<dd>
- <p>Creates a <code id=the-canvas-element:blob><a href=#blob>Blob</a></code> object representing a file containing the image in the canvas,
- and invokes a callback with a handle to that object.</p>
- <p>The second argument, if provided, controls the type of the image to be returned (e.g. PNG or
- JPEG). The default is <code>image/png</code>; that type is also used if the given type
- isn't supported. The other arguments are specific to the type, and control the way that the
- image is generated, as given <a href=#canvas-serialisation-arguments>in the table
- below</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-canvas-todataurl><code>toDataURL()</code></dfn> method must run the
- following steps:</p>
- <ol><li><p>If the <code id=the-canvas-element:the-canvas-element-44><a href=#the-canvas-element>canvas</a></code> element's bitmap's <a href=#concept-canvas-origin-clean id=the-canvas-element:concept-canvas-origin-clean-2>origin-clean</a> flag is set to false, throw a
- <code id=the-canvas-element:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
- <li><p>If the <code id=the-canvas-element:the-canvas-element-45><a href=#the-canvas-element>canvas</a></code> element's bitmap has no pixels (i.e. either its horizontal
- dimension or its vertical dimension is zero) then return the string "<code>data:,</code>" and abort these steps. (This is the shortest <a href=http://tools.ietf.org/html/rfc2397#section-2 id=the-canvas-element:data-protocol-2 data-x-internal=data-protocol><code>data:</code> URL</a>; it represents the empty string in a <code>text/plain</code> resource.)<li><p>Let <var>file</var> be <a href=#a-serialisation-of-the-bitmap-as-a-file id=the-canvas-element:a-serialisation-of-the-bitmap-as-a-file>a
- serialisation of the <code>canvas</code> element's bitmap as a file</a>, using the method's
- arguments (if any) as the <var>arguments</var>.<li><p>Return a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=the-canvas-element:data-protocol-3 data-x-internal=data-protocol><code>data:</code> URL</a> representing
- <var>file</var>. <a href=#refsRFC2397>[RFC2397]</a></p>
-
- </ol>
- <p>The <dfn id=dom-canvas-toblob><code>toBlob()</code></dfn> method must run the following
- steps:</p>
- <ol><li><p>If the <code id=the-canvas-element:the-canvas-element-46><a href=#the-canvas-element>canvas</a></code> element's bitmap's <a href=#concept-canvas-origin-clean id=the-canvas-element:concept-canvas-origin-clean-3>origin-clean</a> flag is set to false, throw a
- <code id=the-canvas-element:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
- <li><p>Let <var>callback</var> be the first argument.<li><p>Let <var>arguments</var> be the second and subsequent arguments to the method, if
- any.<li>
- <p>If the <code id=the-canvas-element:the-canvas-element-47><a href=#the-canvas-element>canvas</a></code> element's bitmap has no pixels (i.e. either its horizontal
- dimension or its vertical dimension is zero) then let <var>result</var> be null.</p>
- <p>Otherwise, let <var>result</var> be a <code id=the-canvas-element:blob-2><a href=#blob>Blob</a></code> object representing <a href=#a-serialisation-of-the-bitmap-as-a-file id=the-canvas-element:a-serialisation-of-the-bitmap-as-a-file-2>a serialisation of the <code>canvas</code> element's
- bitmap as a file</a>, using <var>arguments</var>. <a href=#refsFILEAPI>[FILEAPI]</a> </p>
- <li><p>Return, but continue running these steps asynchronously.<li><p>If <var>callback</var> is null, abort these steps.<li><p><a href=#queue-a-task id=the-canvas-element:queue-a-task>Queue a task</a> to invoke the <code id=the-canvas-element:filecallback-2><a href=#filecallback>FileCallback</a></code> <var>callback</var> with
- <var>result</var> as its argument. The <a href=#task-source id=the-canvas-element:task-source>task source</a> for this task is the <dfn id=canvas-blob-serialisation-task-source>canvas
- blob serialisation task source</dfn>.</ol>
-
-
-
- <h5 id=proxying-canvases-to-workers>4.12.4.1 Proxying canvases to workers</h5>
- <p>Since DOM nodes cannot be accessed across worker boundaries, a proxy object is needed to enable
- workers to render to <code id=proxying-canvases-to-workers:the-canvas-element><a href=#the-canvas-element>canvas</a></code> elements in <code id=proxying-canvases-to-workers:document><a href=#document>Document</a></code>s.</p>
- <pre class=idl>[Exposed=(Window,Worker)]
- interface <dfn id=canvasproxy>CanvasProxy</dfn> {
- void <a href=#dom-canvasproxy-setcontext id=proxying-canvases-to-workers:dom-canvasproxy-setcontext>setContext</a>(<a href=#renderingcontext id=proxying-canvases-to-workers:renderingcontext>RenderingContext</a> context);
- };
- // <a href=#canvasproxy id=proxying-canvases-to-workers:canvasproxy>CanvasProxy</a> implements <a href=#transferable id=proxying-canvases-to-workers:transferable>Transferable</a>;</pre>
- <dl class=domintro><dt><var>canvasProxy</var> = <var>canvas</var> . <code id=proxying-canvases-to-workers:dom-canvas-transfercontroltoproxy><a href=#dom-canvas-transfercontroltoproxy>transferControlToProxy</a></code>()<dd>
- <p>Returns a <code id=proxying-canvases-to-workers:canvasproxy-2><a href=#canvasproxy>CanvasProxy</a></code> object that can be used to transfer control for this
- canvas over to another document (e.g. an <code id=proxying-canvases-to-workers:the-iframe-element><a href=#the-iframe-element>iframe</a></code> from another <a href=#origin-2 id=proxying-canvases-to-workers:origin-2>origin</a>)
- or to a worker.</p>
- <p>Throws an <code id=proxying-canvases-to-workers:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=proxying-canvases-to-workers:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext()</a></code> or <code id=proxying-canvases-to-workers:dom-canvas-setcontext><a href=#dom-canvas-setcontext>setContext()</a></code> methods have been used.</p>
- <dt><var>canvasProxy</var> . <code id=proxying-canvases-to-workers:dom-canvasproxy-setcontext-2><a href=#dom-canvasproxy-setcontext>setContext</a></code>(<var>context</var>)<dd>
- <p>Sets the <code id=proxying-canvases-to-workers:canvasproxy-3><a href=#canvasproxy>CanvasProxy</a></code> object's <code id=proxying-canvases-to-workers:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element's rendering context to
- the given object.</p>
- <p>Throws an <code id=proxying-canvases-to-workers:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=proxying-canvases-to-workers:canvasproxy-4><a href=#canvasproxy>CanvasProxy</a></code> has been
- <a href=#transfer-a-transferable-object id=proxying-canvases-to-workers:transfer-a-transferable-object>transfered</a>.</p>
- </dl>
- <hr>
- <p>The <dfn id=dom-canvas-transfercontroltoproxy><code>transferControlToProxy()</code></dfn>
- method of the <code id=proxying-canvases-to-workers:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element, when invoked, must run the following steps:</p>
- <ol><li><p>If the <code id=proxying-canvases-to-workers:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=proxying-canvases-to-workers:concept-canvas-context-mode>canvas
- context mode</a> is not <a href=#concept-canvas-none id=proxying-canvases-to-workers:concept-canvas-none>none</a>, throw an
- <code id=proxying-canvases-to-workers:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Set the <code id=proxying-canvases-to-workers:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element's <a href=#concept-canvas-context-mode id=proxying-canvases-to-workers:concept-canvas-context-mode-2>context
- mode</a> to <a href=#concept-canvas-proxied id=proxying-canvases-to-workers:concept-canvas-proxied>proxied</a>.<li><p>Return a <code id=proxying-canvases-to-workers:canvasproxy-5><a href=#canvasproxy>CanvasProxy</a></code> object bound to this <code id=proxying-canvases-to-workers:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code>
- element.</ol>
- <p>A <code id=proxying-canvases-to-workers:canvasproxy-6><a href=#canvasproxy>CanvasProxy</a></code> object can be <a href=#concept-transferable-neutered id=proxying-canvases-to-workers:concept-transferable-neutered>neutered</a> (like any <code id=proxying-canvases-to-workers:transferable-2><a href=#transferable>Transferable</a></code> object),
- meaning it can no longer be <a href=#transfer-a-transferable-object id=proxying-canvases-to-workers:transfer-a-transferable-object-2>transferred</a>, and
- can be <dfn id=concept-canvasproxy-disabled>disabled</dfn>, meaning it can no longer be bound
- to rendering contexts. When first created, a <code id=proxying-canvases-to-workers:canvasproxy-7><a href=#canvasproxy>CanvasProxy</a></code> object must be neither.</p>
- <p>A <code id=proxying-canvases-to-workers:canvasproxy-8><a href=#canvasproxy>CanvasProxy</a></code> is created with a link to a <code id=proxying-canvases-to-workers:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> element. A
- <code id=proxying-canvases-to-workers:canvasproxy-9><a href=#canvasproxy>CanvasProxy</a></code> object that has not been <a href=#concept-canvasproxy-disabled id=proxying-canvases-to-workers:concept-canvasproxy-disabled>disabled</a> must have a strong reference to its canvas
- element.</p>
- <p>The <dfn id=dom-canvasproxy-setcontext><code>setContext(<var>context</var>)</code></dfn> method of <code id=proxying-canvases-to-workers:canvasproxy-10><a href=#canvasproxy>CanvasProxy</a></code> objects, when invoked,
- must run the following steps:</p>
- <ol><li><p>If the <code id=proxying-canvases-to-workers:canvasproxy-11><a href=#canvasproxy>CanvasProxy</a></code> object has been <a href=#concept-canvasproxy-disabled id=proxying-canvases-to-workers:concept-canvasproxy-disabled-2>disabled</a>, throw an <code id=proxying-canvases-to-workers:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.<li><p>If the <code id=proxying-canvases-to-workers:canvasproxy-12><a href=#canvasproxy>CanvasProxy</a></code> object has not been <a href=#concept-transferable-neutered id=proxying-canvases-to-workers:concept-transferable-neutered-2>neutered</a>, then <a href=#concept-transferable-neutered id=proxying-canvases-to-workers:concept-transferable-neutered-3>neuter</a> it.<li><p>If <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=proxying-canvases-to-workers:concept-canvas-context-bitmap-mode>context
- bitmap mode</a> is <a href=#concept-canvas-fixed id=proxying-canvases-to-workers:concept-canvas-fixed>fixed</a>, then throw an
- <code id=proxying-canvases-to-workers:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=proxying-canvases-to-workers:concept-canvas-context-bitmap-mode-2>context
- bitmap mode</a> is <a href=#concept-canvas-bound id=proxying-canvases-to-workers:concept-canvas-bound>bound</a>, then run <var>context</var>'s <a href=#concept-canvas-unbinding-steps id=proxying-canvases-to-workers:concept-canvas-unbinding-steps>unbinding steps</a> and
- set its <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=proxying-canvases-to-workers:concept-canvas-context-bitmap-mode-3>context
- bitmap mode</a> to <a href=#concept-canvas-unbound id=proxying-canvases-to-workers:concept-canvas-unbound>unbound</a>.<li><p>Run <var>context</var>'s <a href=#concept-canvas-binding-steps id=proxying-canvases-to-workers:concept-canvas-binding-steps>binding
- steps</a> to bind it to this <code id=proxying-canvases-to-workers:canvasproxy-13><a href=#canvasproxy>CanvasProxy</a></code> object's <code id=proxying-canvases-to-workers:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code>
- element.<li><p>Set the <var>context</var>'s <a href=#concept-canvas-context-bitmap-mode id=proxying-canvases-to-workers:concept-canvas-context-bitmap-mode-4>context bitmap mode</a> to <a href=#concept-canvas-bound id=proxying-canvases-to-workers:concept-canvas-bound-2>bound</a>.</ol>
- <p id=transferCanvasProxy>To <a href=#transfer-a-transferable-object id=proxying-canvases-to-workers:transfer-a-transferable-object-3>transfer</a> a
- <code id=proxying-canvases-to-workers:canvasproxy-14><a href=#canvasproxy>CanvasProxy</a></code> object <var>old</var> to a new owner <var>owner</var>,
- a user agent must create a new <code id=proxying-canvases-to-workers:canvasproxy-15><a href=#canvasproxy>CanvasProxy</a></code> object linked to the same
- <code id=proxying-canvases-to-workers:the-canvas-element-9><a href=#the-canvas-element>canvas</a></code> element as <var>old</var>, thus obtaining <var>new</var>,
- must <a href=#concept-transferable-neutered id=proxying-canvases-to-workers:concept-transferable-neutered-4>neuter</a> and <a href=#concept-canvasproxy-disabled id=proxying-canvases-to-workers:concept-canvasproxy-disabled-3>disable</a> the <var>old</var> object, and must
- finally return <var>new</var>.</p>
- <div class=example>
- <p>Here is a clock implemented on a worker. First, the main page:</p>
- <pre><!DOCTYPE HTML>
- <title>Clock</title>
- <canvas></canvas>
- <script>
- var canvas = document.getElementsByTagName('canvas')[0];
- var proxy = canvas.transferControlToProxy();
- var worker = new Worker('clock.js');
- worker.postMessage(proxy, [proxy]);
- </script></pre>
- <p>Second, the worker:</p>
- <pre>onmessage = function (event) {
- var context = new CanvasRenderingContext2D();
- event.data.setContext(context); // event.data is the CanvasProxy object
- setInterval(function () {
- context.clearRect(0, 0, context.width, context.height);
- context.fillText(new Date(), 0, 100);
- context.commit();
- }, 1000);
- };</pre>
- </div>
-
- <h5 id=2dcontext>4.12.4.2 The 2D rendering context</h5>
-
- <pre class=idl>typedef (<a href=#htmlimageelement id=2dcontext:htmlimageelement>HTMLImageElement</a> or
- <a href=#htmlvideoelement id=2dcontext:htmlvideoelement>HTMLVideoElement</a> or
- <a href=#htmlcanvaselement id=2dcontext:htmlcanvaselement>HTMLCanvasElement</a> or
- <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
- <a href=#imagebitmap id=2dcontext:imagebitmap>ImageBitmap</a>) <dfn id=canvasimagesource>CanvasImageSource</dfn>;
- enum <dfn id=canvasfillrule>CanvasFillRule</dfn> { "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero>nonzero</a>", "<a href=#dom-context-2d-fillrule-evenodd id=2dcontext:dom-context-2d-fillrule-evenodd>evenodd</a>" };
- [<a href=#dom-context-2d id=2dcontext:dom-context-2d>Constructor</a>(optional unsigned long width, unsigned long height), Exposed=(Window,Worker)]
- interface <dfn id=canvasrenderingcontext2d>CanvasRenderingContext2D</dfn> {
- // back-reference to the canvas
- readonly attribute <a href=#htmlcanvaselement id=2dcontext:htmlcanvaselement-2>HTMLCanvasElement</a> <a href=#dom-context-2d-canvas id=2dcontext:dom-context-2d-canvas>canvas</a>;
- // canvas dimensions
- attribute unsigned long <a href=#dom-context-2d-width id=2dcontext:dom-context-2d-width>width</a>;
- attribute unsigned long <a href=#dom-context-2d-height id=2dcontext:dom-context-2d-height>height</a>;
- // for contexts that aren't directly <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed>fixed</a> to a specific canvas
- void <a href=#dom-context-2d-commit id=2dcontext:dom-context-2d-commit>commit</a>(); // push the image to the <a href=#output-bitmap id=2dcontext:output-bitmap>output bitmap</a>
- // state
- void <a href=#dom-context-2d-save id=2dcontext:dom-context-2d-save>save</a>(); // push state on state stack
- void <a href=#dom-context-2d-restore id=2dcontext:dom-context-2d-restore>restore</a>(); // pop state stack and restore state
- // transformations (default transform is the identity matrix)
- attribute <a href=#svgmatrix id=2dcontext:svgmatrix>SVGMatrix</a> <a href=#dom-context-2d-currenttransform id=2dcontext:dom-context-2d-currenttransform>currentTransform</a>;
- void <a href=#dom-context-2d-scale id=2dcontext:dom-context-2d-scale>scale</a>(unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-rotate id=2dcontext:dom-context-2d-rotate>rotate</a>(unrestricted double angle);
- void <a href=#dom-context-2d-translate id=2dcontext:dom-context-2d-translate>translate</a>(unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-transform id=2dcontext:dom-context-2d-transform>transform</a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void <a href=#dom-context-2d-settransform id=2dcontext:dom-context-2d-settransform>setTransform</a>(unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
- void <a href=#dom-context-2d-resettransform id=2dcontext:dom-context-2d-resettransform>resetTransform</a>();
- // compositing
- attribute unrestricted double <a href=#dom-context-2d-globalalpha id=2dcontext:dom-context-2d-globalalpha>globalAlpha</a>; // (default 1.0)
- attribute DOMString <a href=#dom-context-2d-globalcompositeoperation id=2dcontext:dom-context-2d-globalcompositeoperation>globalCompositeOperation</a>; // (default source-over)
- // image smoothing
- attribute boolean <a href=#dom-context-2d-imagesmoothingenabled id=2dcontext:dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a>; // (default true)
- // colours and styles (see also the <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles>CanvasDrawingStyles</a> interface)
- attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-strokestyle id=2dcontext:dom-context-2d-strokestyle>strokeStyle</a>; // (default black)
- attribute (DOMString or CanvasGradient or CanvasPattern) <a href=#dom-context-2d-fillstyle id=2dcontext:dom-context-2d-fillstyle>fillStyle</a>; // (default black)
- <a href=#canvasgradient id=2dcontext:canvasgradient>CanvasGradient</a> <a href=#dom-context-2d-createlineargradient id=2dcontext:dom-context-2d-createlineargradient>createLinearGradient</a>(double x0, double y0, double x1, double y1);
- <a href=#canvasgradient id=2dcontext:canvasgradient-2>CanvasGradient</a> <a href=#dom-context-2d-createradialgradient id=2dcontext:dom-context-2d-createradialgradient>createRadialGradient</a>(double x0, double y0, double r0, double x1, double y1, double r1);
- <a href=#canvaspattern id=2dcontext:canvaspattern>CanvasPattern</a> <a href=#dom-context-2d-createpattern id=2dcontext:dom-context-2d-createpattern>createPattern</a>(<a href=#canvasimagesource id=2dcontext:canvasimagesource>CanvasImageSource</a> image, [TreatNullAs=EmptyString] DOMString repetition);
- // shadows
- attribute unrestricted double <a href=#dom-context-2d-shadowoffsetx id=2dcontext:dom-context-2d-shadowoffsetx>shadowOffsetX</a>; // (default 0)
- attribute unrestricted double <a href=#dom-context-2d-shadowoffsety id=2dcontext:dom-context-2d-shadowoffsety>shadowOffsetY</a>; // (default 0)
- attribute unrestricted double <a href=#dom-context-2d-shadowblur id=2dcontext:dom-context-2d-shadowblur>shadowBlur</a>; // (default 0)
- attribute DOMString <a href=#dom-context-2d-shadowcolor id=2dcontext:dom-context-2d-shadowcolor>shadowColor</a>; // (default transparent black)
- // rects
- void <a href=#dom-context-2d-clearrect id=2dcontext:dom-context-2d-clearrect>clearRect</a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void <a href=#dom-context-2d-fillrect id=2dcontext:dom-context-2d-fillrect>fillRect</a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void <a href=#dom-context-2d-strokerect id=2dcontext:dom-context-2d-strokerect>strokeRect</a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- // path API (see also <a href=#canvaspathmethods id=2dcontext:canvaspathmethods>CanvasPathMethods</a>)
- void <a href=#dom-context-2d-beginpath id=2dcontext:dom-context-2d-beginpath>beginPath</a>();
- void <a href=#dom-context-2d-fill id=2dcontext:dom-context-2d-fill>fill</a>(optional <a href=#canvasfillrule id=2dcontext:canvasfillrule>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-2>nonzero</a>");
- void <a href=#dom-context-2d-fill id=2dcontext:dom-context-2d-fill-2>fill</a>(<a href=#path2d id=2dcontext:path2d>Path2D</a> path, optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-2>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-3>nonzero</a>");
- void <a href=#dom-context-2d-stroke id=2dcontext:dom-context-2d-stroke>stroke</a>();
- void <a href=#dom-context-2d-stroke id=2dcontext:dom-context-2d-stroke-2>stroke</a>(<a href=#path2d id=2dcontext:path2d-2>Path2D</a> path);
- void <a href=#dom-context-2d-drawsystemfocusring id=2dcontext:dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a>(<a href=#element id=2dcontext:element>Element</a> element);
- void <a href=#dom-context-2d-drawsystemfocusring id=2dcontext:dom-context-2d-drawsystemfocusring-2>drawSystemFocusRing</a>(<a href=#path2d id=2dcontext:path2d-3>Path2D</a> path, <a href=#element id=2dcontext:element-2>Element</a> element);
- boolean <a href=#dom-context-2d-drawcustomfocusring id=2dcontext:dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a>(<a href=#element id=2dcontext:element-3>Element</a> element);
- boolean <a href=#dom-context-2d-drawcustomfocusring id=2dcontext:dom-context-2d-drawcustomfocusring-2>drawCustomFocusRing</a>(<a href=#path2d id=2dcontext:path2d-4>Path2D</a> path, <a href=#element id=2dcontext:element-4>Element</a> element);
- void <a href=#dom-context-2d-scrollpathintoview id=2dcontext:dom-context-2d-scrollpathintoview>scrollPathIntoView</a>();
- void <a href=#dom-context-2d-scrollpathintoview id=2dcontext:dom-context-2d-scrollpathintoview-2>scrollPathIntoView</a>(<a href=#path2d id=2dcontext:path2d-5>Path2D</a> path);
- void <a href=#dom-context-2d-clip id=2dcontext:dom-context-2d-clip>clip</a>(optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-3>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-4>nonzero</a>");
- void <a href=#dom-context-2d-clip id=2dcontext:dom-context-2d-clip-2>clip</a>(<a href=#path2d id=2dcontext:path2d-6>Path2D</a> path, optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-4>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-5>nonzero</a>");
- void <a href=#dom-context-2d-resetclip id=2dcontext:dom-context-2d-resetclip>resetClip</a>();
- boolean <a href=#dom-context-2d-ispointinpath id=2dcontext:dom-context-2d-ispointinpath>isPointInPath</a>(unrestricted double x, unrestricted double y, optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-5>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-6>nonzero</a>");
- boolean <a href=#dom-context-2d-ispointinpath id=2dcontext:dom-context-2d-ispointinpath-2>isPointInPath</a>(<a href=#path2d id=2dcontext:path2d-7>Path2D</a> path, unrestricted double x, unrestricted double y, optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-6>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-7>nonzero</a>");
- boolean <a href=#dom-context-2d-ispointinstroke id=2dcontext:dom-context-2d-ispointinstroke>isPointInStroke</a>(unrestricted double x, unrestricted double y);
- boolean <a href=#dom-context-2d-ispointinstroke id=2dcontext:dom-context-2d-ispointinstroke-2>isPointInStroke</a>(<a href=#path2d id=2dcontext:path2d-8>Path2D</a> path, unrestricted double x, unrestricted double y);
- // text (see also the <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-2>CanvasDrawingStyles</a> interface)
- void <a href=#dom-context-2d-filltext id=2dcontext:dom-context-2d-filltext>fillText</a>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void <a href=#dom-context-2d-stroketext id=2dcontext:dom-context-2d-stroketext>strokeText</a>(DOMString text, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- <a href=#textmetrics id=2dcontext:textmetrics>TextMetrics</a> <a href=#dom-context-2d-measuretext id=2dcontext:dom-context-2d-measuretext>measureText</a>(DOMString text);
- // drawing images
- void <a href=#dom-context-2d-drawimage id=2dcontext:dom-context-2d-drawimage>drawImage</a>(<a href=#canvasimagesource id=2dcontext:canvasimagesource-2>CanvasImageSource</a> image, unrestricted double dx, unrestricted double dy);
- void <a href=#dom-context-2d-drawimage id=2dcontext:dom-context-2d-drawimage-2>drawImage</a>(<a href=#canvasimagesource id=2dcontext:canvasimagesource-3>CanvasImageSource</a> image, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
- void <a href=#dom-context-2d-drawimage id=2dcontext:dom-context-2d-drawimage-3>drawImage</a>(<a href=#canvasimagesource id=2dcontext:canvasimagesource-4>CanvasImageSource</a> image, unrestricted double sx, unrestricted double sy, unrestricted double sw, unrestricted double sh, unrestricted double dx, unrestricted double dy, unrestricted double dw, unrestricted double dh);
- // hit regions
- void <a href=#dom-context-2d-addhitregion id=2dcontext:dom-context-2d-addhitregion>addHitRegion</a>(optional <a href=#hitregionoptions id=2dcontext:hitregionoptions>HitRegionOptions</a> options);
- void <a href=#dom-context-2d-removehitregion id=2dcontext:dom-context-2d-removehitregion>removeHitRegion</a>(DOMString id);
- void <a href=#dom-context-2d-clearhitregions id=2dcontext:dom-context-2d-clearhitregions>clearHitRegions</a>();
- // <a href=#pixel-manipulation id=2dcontext:pixel-manipulation>pixel manipulation</a>
- <a href=#imagedata id=2dcontext:imagedata>ImageData</a> <a href=#dom-context-2d-createimagedata id=2dcontext:dom-context-2d-createimagedata>createImageData</a>(double sw, double sh);
- <a href=#imagedata id=2dcontext:imagedata-2>ImageData</a> <a href=#dom-context-2d-createimagedata id=2dcontext:dom-context-2d-createimagedata-2>createImageData</a>(<a href=#imagedata id=2dcontext:imagedata-3>ImageData</a> imagedata);
- <a href=#imagedata id=2dcontext:imagedata-4>ImageData</a> <a href=#dom-context-2d-getimagedata id=2dcontext:dom-context-2d-getimagedata>getImageData</a>(double sx, double sy, double sw, double sh);
- void <a href=#dom-context-2d-putimagedata id=2dcontext:dom-context-2d-putimagedata>putImageData</a>(<a href=#imagedata id=2dcontext:imagedata-5>ImageData</a> imagedata, double dx, double dy);
- void <a href=#dom-context-2d-putimagedata id=2dcontext:dom-context-2d-putimagedata-2>putImageData</a>(<a href=#imagedata id=2dcontext:imagedata-6>ImageData</a> imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight);
- };
- <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d-2>CanvasRenderingContext2D</a> implements <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-3>CanvasDrawingStyles</a>;
- <a href=#canvasrenderingcontext2d id=2dcontext:canvasrenderingcontext2d-3>CanvasRenderingContext2D</a> implements <a href=#canvaspathmethods id=2dcontext:canvaspathmethods-2>CanvasPathMethods</a>;
- [NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=canvasdrawingstyles>CanvasDrawingStyles</dfn> {
- // line caps/joins
- attribute unrestricted double <a href=#dom-context-2d-linewidth id=2dcontext:dom-context-2d-linewidth>lineWidth</a>; // (default 1)
- attribute DOMString <a href=#dom-context-2d-linecap id=2dcontext:dom-context-2d-linecap>lineCap</a>; // "butt", "round", "square" (default "butt")
- attribute DOMString <a href=#dom-context-2d-linejoin id=2dcontext:dom-context-2d-linejoin>lineJoin</a>; // "round", "bevel", "miter" (default "miter")
- attribute unrestricted double <a href=#dom-context-2d-miterlimit id=2dcontext:dom-context-2d-miterlimit>miterLimit</a>; // (default 10)
- // dashed lines
- void <a href=#dom-context-2d-setlinedash id=2dcontext:dom-context-2d-setlinedash>setLineDash</a>(sequence<unrestricted double> segments); // default empty
- sequence<unrestricted double> <a href=#dom-context-2d-getlinedash id=2dcontext:dom-context-2d-getlinedash>getLineDash</a>();
- attribute unrestricted double <a href=#dom-context-2d-linedashoffset id=2dcontext:dom-context-2d-linedashoffset>lineDashOffset</a>;
- // text
- attribute DOMString <a href=#dom-context-2d-font id=2dcontext:dom-context-2d-font>font</a>; // (default 10px sans-serif)
- attribute DOMString <a href=#dom-context-2d-textalign id=2dcontext:dom-context-2d-textalign>textAlign</a>; // "start", "end", "left", "right", "center" (default: "start")
- attribute DOMString <a href=#dom-context-2d-textbaseline id=2dcontext:dom-context-2d-textbaseline>textBaseline</a>; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic")
- attribute DOMString <a href=#dom-context-2d-direction id=2dcontext:dom-context-2d-direction>direction</a>; // "ltr", "rtl", "inherit" (default: "inherit")
- };
- [NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=canvaspathmethods>CanvasPathMethods</dfn> {
- // shared path API methods
- void <a href=#dom-context-2d-closepath id=2dcontext:dom-context-2d-closepath>closePath</a>();
- void <a href=#dom-context-2d-moveto id=2dcontext:dom-context-2d-moveto>moveTo</a>(unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-lineto id=2dcontext:dom-context-2d-lineto>lineTo</a>(unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-quadraticcurveto id=2dcontext:dom-context-2d-quadraticcurveto>quadraticCurveTo</a>(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-beziercurveto id=2dcontext:dom-context-2d-beziercurveto>bezierCurveTo</a>(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
- void <a href=#dom-context-2d-arcto id=2dcontext:dom-context-2d-arcto>arcTo</a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
- void <a href=#dom-context-2d-arcto id=2dcontext:dom-context-2d-arcto-2>arcTo</a>(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation);
- void <a href=#dom-context-2d-rect id=2dcontext:dom-context-2d-rect>rect</a>(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
- void <a href=#dom-context-2d-arc id=2dcontext:dom-context-2d-arc>arc</a>(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
- void <a href=#dom-context-2d-ellipse id=2dcontext:dom-context-2d-ellipse>ellipse</a>(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
- };
- [Exposed=(Window,Worker)]
- interface <dfn id=canvasgradient>CanvasGradient</dfn> {
- // opaque object
- void <a href=#dom-canvasgradient-addcolorstop id=2dcontext:dom-canvasgradient-addcolorstop>addColorStop</a>(double offset, DOMString color);
- };
- [Exposed=(Window,Worker)]
- interface <dfn id=canvaspattern>CanvasPattern</dfn> {
- // opaque object
- void <a href=#dom-canvaspattern-settransform id=2dcontext:dom-canvaspattern-settransform>setTransform</a>(<a href=#svgmatrix id=2dcontext:svgmatrix-2>SVGMatrix</a> transform);
- };
- [Exposed=(Window,Worker)]
- interface <dfn id=textmetrics>TextMetrics</dfn> {
- // x-direction
- readonly attribute double <a href=#dom-textmetrics-width id=2dcontext:dom-textmetrics-width>width</a>; // advance width
- readonly attribute double <a href=#dom-textmetrics-actualboundingboxleft id=2dcontext:dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft</a>;
- readonly attribute double <a href=#dom-textmetrics-actualboundingboxright id=2dcontext:dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a>;
- // y-direction
- readonly attribute double <a href=#dom-textmetrics-fontboundingboxascent id=2dcontext:dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent</a>;
- readonly attribute double <a href=#dom-textmetrics-fontboundingboxdescent id=2dcontext:dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent</a>;
- readonly attribute double <a href=#dom-textmetrics-actualboundingboxascent id=2dcontext:dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a>;
- readonly attribute double <a href=#dom-textmetrics-actualboundingboxdescent id=2dcontext:dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent</a>;
- readonly attribute double <a href=#dom-textmetrics-emheightascent id=2dcontext:dom-textmetrics-emheightascent>emHeightAscent</a>;
- readonly attribute double <a href=#dom-textmetrics-emheightdescent id=2dcontext:dom-textmetrics-emheightdescent>emHeightDescent</a>;
- readonly attribute double <a href=#dom-textmetrics-hangingbaseline id=2dcontext:dom-textmetrics-hangingbaseline>hangingBaseline</a>;
- readonly attribute double <a href=#dom-textmetrics-alphabeticbaseline id=2dcontext:dom-textmetrics-alphabeticbaseline>alphabeticBaseline</a>;
- readonly attribute double <a href=#dom-textmetrics-ideographicbaseline id=2dcontext:dom-textmetrics-ideographicbaseline>ideographicBaseline</a>;
- };
- dictionary <dfn id=hitregionoptions>HitRegionOptions</dfn> {
- <a href=#path2d id=2dcontext:path2d-9>Path2D</a>? <a href=#dom-hitregionoptions-path id=2dcontext:dom-hitregionoptions-path>path</a> = null;
- <a href=#canvasfillrule id=2dcontext:canvasfillrule-7>CanvasFillRule</a> <a href=#dom-hitregionoptions-fillrule id=2dcontext:dom-hitregionoptions-fillrule>fillRule</a> = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-8>nonzero</a>";
- DOMString <a href=#dom-hitregionoptions-id id=2dcontext:dom-hitregionoptions-id>id</a> = "";
- DOMString? <a href=#dom-hitregionoptions-parentid id=2dcontext:dom-hitregionoptions-parentid>parentID</a> = null;
- DOMString <a href=#dom-hitregionoptions-cursor id=2dcontext:dom-hitregionoptions-cursor>cursor</a> = "inherit";
- // for control-backed regions:
- <a href=#element id=2dcontext:element-5>Element</a>? <a href=#dom-hitregionoptions-control id=2dcontext:dom-hitregionoptions-control>control</a> = null;
- // for unbacked regions:
- DOMString? <a href=#dom-hitregionoptions-label id=2dcontext:dom-hitregionoptions-label>label</a> = null;
- DOMString? <a href=#dom-hitregionoptions-role id=2dcontext:dom-hitregionoptions-role>role</a> = null;
- };
- [<a href=#dom-imagedata id=2dcontext:dom-imagedata>Constructor</a>(unsigned long sw, unsigned long sh),
- <a href=#dom-imagedata id=2dcontext:dom-imagedata-2>Constructor</a>(<a href=#uint8clampedarray id=2dcontext:uint8clampedarray>Uint8ClampedArray</a> data, unsigned long sw, optional unsigned long sh),
- Exposed=(Window,Worker)]
- interface <dfn id=imagedata>ImageData</dfn> {
- readonly attribute unsigned long <a href=#dom-imagedata-width id=2dcontext:dom-imagedata-width>width</a>;
- readonly attribute unsigned long <a href=#dom-imagedata-height id=2dcontext:dom-imagedata-height>height</a>;
- readonly attribute <a href=#uint8clampedarray id=2dcontext:uint8clampedarray-2>Uint8ClampedArray</a> <a href=#dom-imagedata-data id=2dcontext:dom-imagedata-data>data</a>;
- };
- [<a href=#dom-drawingstyle id=2dcontext:dom-drawingstyle>Constructor</a>(optional <a href=#element id=2dcontext:element-6>Element</a> scope), Exposed=(Window,Worker)]
- interface <dfn id=drawingstyle>DrawingStyle</dfn> { };
- <a href=#drawingstyle id=2dcontext:drawingstyle>DrawingStyle</a> implements <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-4>CanvasDrawingStyles</a>;
- [<a href=#dom-path2d id=2dcontext:dom-path2d>Constructor</a>,
- <a href=#dom-path2d-copy id=2dcontext:dom-path2d-copy>Constructor</a>(<a href=#path2d id=2dcontext:path2d-10>Path2D</a> path),
- <a href=#dom-path2d-merge id=2dcontext:dom-path2d-merge>Constructor</a>(<a href=#path2d id=2dcontext:path2d-11>Path2D</a>[] paths, optional <a href=#canvasfillrule id=2dcontext:canvasfillrule-8>CanvasFillRule</a> fillRule = "<a href=#dom-context-2d-fillrule-nonzero id=2dcontext:dom-context-2d-fillrule-nonzero-9>nonzero</a>"),
- <a href=#dom-path2d-withdata id=2dcontext:dom-path2d-withdata>Constructor</a>(DOMString d), Exposed=(Window,Worker)]
- interface <dfn id=path2d>Path2D</dfn> {
- void <a href=#dom-path2d-addpath id=2dcontext:dom-path2d-addpath>addPath</a>(<a href=#path2d id=2dcontext:path2d-12>Path2D</a> path, optional <a href=#svgmatrix id=2dcontext:svgmatrix-3>SVGMatrix</a>? transformation = null);
- void <a href=#dom-path2d-addpathbystrokingpath id=2dcontext:dom-path2d-addpathbystrokingpath>addPathByStrokingPath</a>(<a href=#path2d id=2dcontext:path2d-13>Path2D</a> path, <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-5>CanvasDrawingStyles</a> styles, optional <a href=#svgmatrix id=2dcontext:svgmatrix-4>SVGMatrix</a>? transformation = null);
- void <a href=#dom-path2d-addtext id=2dcontext:dom-path2d-addtext>addText</a>(DOMString text, <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-6>CanvasDrawingStyles</a> styles, <a href=#svgmatrix id=2dcontext:svgmatrix-5>SVGMatrix</a>? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void <a href=#dom-path2d-addpathbystrokingtext id=2dcontext:dom-path2d-addpathbystrokingtext>addPathByStrokingText</a>(DOMString text, <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-7>CanvasDrawingStyles</a> styles, <a href=#svgmatrix id=2dcontext:svgmatrix-6>SVGMatrix</a>? transformation, unrestricted double x, unrestricted double y, optional unrestricted double maxWidth);
- void <a href=#dom-path2d-addtext id=2dcontext:dom-path2d-addtext-2>addText</a>(DOMString text, <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-8>CanvasDrawingStyles</a> styles, <a href=#svgmatrix id=2dcontext:svgmatrix-7>SVGMatrix</a>? transformation, <a href=#path2d id=2dcontext:path2d-14>Path2D</a> path, optional unrestricted double maxWidth);
- void <a href=#dom-path2d-addpathbystrokingtext id=2dcontext:dom-path2d-addpathbystrokingtext-2>addPathByStrokingText</a>(DOMString text, <a href=#canvasdrawingstyles id=2dcontext:canvasdrawingstyles-9>CanvasDrawingStyles</a> styles, <a href=#svgmatrix id=2dcontext:svgmatrix-8>SVGMatrix</a>? transformation, <a href=#path2d id=2dcontext:path2d-15>Path2D</a> path, optional unrestricted double maxWidth);
- };
- <a href=#path2d id=2dcontext:path2d-16>Path2D</a> implements <a href=#canvaspathmethods id=2dcontext:canvaspathmethods-3>CanvasPathMethods</a>;</pre>
-
- <dl class=domintro><dt><var>context</var> = <var>canvas</var> . <code id=2dcontext:dom-canvas-getcontext><a href=#dom-canvas-getcontext>getContext</a></code>('2d')<dd>
- <p>Returns a <code id=2dcontext:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object that is permanently bound to a
- particular <code id=2dcontext:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element.</p>
- <dt><var>context</var> = new <code id=2dcontext:dom-context-2d-2><a href=#dom-context-2d>CanvasRenderingContext2D</a></code>( [ <var>width</var>, <var>height</var> ] )<dd>
- <p>Returns an unbound <code id=2dcontext:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object with an implied bitmap with
- the given dimensions in CSS pixels (300x150, if the arguments are omitted).</p>
- <dt><var>context</var> . <code id=2dcontext:dom-context-2d-canvas-2><a href=#dom-context-2d-canvas>canvas</a></code><dd>
- <p>Returns the <code id=2dcontext:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element, if the rendering context was obtained using the
- <code id=2dcontext:dom-canvas-getcontext-2><a href=#dom-canvas-getcontext>getContext()</a></code> method.</p>
- <dt><var>context</var> . <code id=2dcontext:dom-context-2d-width-2><a href=#dom-context-2d-width>width</a></code><dt><var>context</var> . <code id=2dcontext:dom-context-2d-height-2><a href=#dom-context-2d-height>height</a></code><dd>
- <p>Return the dimensions of the bitmap, in CSS pixels.</p>
- <p>Can be set, to update the bitmap's dimensions. If the rendering context is bound to a canvas,
- this will also update the canvas' intrinsic dimensions.</p>
- <dt><var>context</var> . <code id=2dcontext:dom-context-2d-commit-2><a href=#dom-context-2d-commit>commit</a></code>()<dd>
- <p>If the rendering context is bound to a <code id=2dcontext:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code>, display the current frame.</p>
- </dl>
-
- <p>A <code id=2dcontext:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object can be obtained in two ways: the <code id=2dcontext:dom-canvas-getcontext-3><a href=#dom-canvas-getcontext>getContext()</a></code> method on a <code id=2dcontext:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code> element (which
- invokes the <a href=#2d-context-creation-algorithm id=2dcontext:2d-context-creation-algorithm>2D context creation algorithm</a>), and the <code id=2dcontext:dom-context-2d-3><a href=#dom-context-2d>CanvasRenderingContext2D()</a></code> constructor.</p>
- <p>A <code id=2dcontext:canvasrenderingcontext2d-7><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object has a <dfn id=scratch-bitmap>scratch bitmap</dfn> and can be bound
- to an <dfn id=output-bitmap>output bitmap</dfn>. These are initialised when the object is created, and can be
- subsequently adjusted when the rendering context is <a href=#concept-canvas-binding-steps id=2dcontext:concept-canvas-binding-steps>bound</a> or <a href=#concept-canvas-unbinding-steps id=2dcontext:concept-canvas-unbinding-steps>unbound</a>. In some cases, these bitmaps are the same
- underlying bitmap. In general, the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap>scratch bitmap</a> is what scripts interact with, and
- the <a href=#output-bitmap id=2dcontext:output-bitmap-2>output bitmap</a> is what is being displayed. These bitmaps always have the same
- dimensions.</p>
- <p>Each such bitmap has an <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean>origin-clean</a> flag,
- which can be set to true or false. Initially, when one of these bitmaps is created, its <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-2>origin-clean</a> flag must be set to true.</p>
- <p>These bitmaps also have a <a href=#hit-region-list id=2dcontext:hit-region-list>hit region list</a>, which is described in a later section.
- Initially, this list is empty. <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-2>Scratch bitmaps</a> also have a
- <dfn id=list-of-pending-interface-actions>list of pending interface actions</dfn>, which can contain instructions to draw the user's
- attention to a location on the bitmap, and instructions to scroll to a location on the bitmap.
- Initially, this list is also empty.</p>
- <p>The <code id=2dcontext:canvasrenderingcontext2d-8><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> 2D rendering context represents a flat linear
- Cartesian surface whose origin (0,0) is at the top left corner, with the coordinate space having
- <var>x</var> values increasing when going right, and <var>y</var> values
- increasing when going down. The <var>x</var>-coordinate of the right-most edge is equal to
- the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-3>scratch bitmap</a> in CSS pixels; similarly, the
- <var>y</var>-coordinate of the bottom-most edge is equal to the height of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-4>scratch bitmap</a> in CSS pixels.</p>
- <p>The size of the coordinate space does not necessarily represent the size of the actual bitmaps
- that the user agent will use internally or during rendering. On high-definition displays, for
- instance, the user agent may internally use bitmaps with two device pixels per unit in the
- coordinate space, so that the rendering remains at high quality throughout. Anti-aliasing can
- similarly be implemented using over-sampling with bitmaps of a higher resolution than the final
- image on the display.</p>
- <hr>
- <p>The <dfn id=2d-context-creation-algorithm>2D context creation algorithm</dfn>, which is passed a <var>target</var> (a
- <code id=2dcontext:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element), consists of running the following steps:</p>
- <ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-9><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-3><a href=#dom-context-2d-canvas>canvas</a></code> attribute to point to
- <var>target</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-10><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-3>output bitmap</a> and
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-5>scratch bitmap</a> both be the same bitmap as <var>target</var>'s bitmap (so
- that they are shared).<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions>Set bitmap dimensions</a> to the
- numeric values of <var>target</var>'s <code id=2dcontext:attr-canvas-width><a href=#attr-canvas-width>width</a></code> and
- <code id=2dcontext:attr-canvas-height><a href=#attr-canvas-height>height</a></code> content attributes.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-11><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
- <hr>
- <p>The <dfn id=dom-context-2d><code>CanvasRenderingContext2D()</code></dfn> constructor, when
- invoked, must run the following steps:</p>
- <ol><li><p>Create a new <code id=2dcontext:canvasrenderingcontext2d-12><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.<li><p>Initialise its <code id=2dcontext:dom-context-2d-canvas-4><a href=#dom-context-2d-canvas>canvas</a></code> attribute to
- null.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-13><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-6>scratch bitmap</a> be
- a new bitmap.<li><p>If the constructor was called with arguments, let <var>width</var> and <var>height</var> be the first and second arguments, respectively. Otherwise, let <var>width</var> and <var>height</var> be 300 and 150, respectively.<li><p><a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-2>Set bitmap dimensions</a> to <var>width</var> and <var>height</var>.<li><p>Let the new <code id=2dcontext:canvasrenderingcontext2d-14><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-4>output
- bitmap</a>.<li><p>Return the new <code id=2dcontext:canvasrenderingcontext2d-15><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</ol>
- <hr>
- <p>When the user agent is required to <dfn id=commit-the-scratch-bitmap>commit the scratch bitmap</dfn> for a rendering
- context, it must run the following steps:
- <ol><li><p>Let <var>bitmap copy</var> be a copy of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-7>scratch
- bitmap</a>.<li><p>Let <var>origin-clean flag copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-8>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-3>origin-clean</a>
- flag.<li><p>Let <var>hit region list copy</var> be a copy of the rendering context's
- <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-9>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-2>hit region list</a>.<li><p>Let <var>list of pending interface actions copy</var> be a copy of the rendering
- context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-10>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions>list of pending interface actions</a>.<li><p>Empty the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-11>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-2>list of pending interface actions</a>.<li><p>If the rendering context has no <a href=#output-bitmap id=2dcontext:output-bitmap-5>output bitmap</a>, abort these steps.<li><p>Let <var>output bitmap</var> be the rendering context's <a href=#output-bitmap id=2dcontext:output-bitmap-6>output
- bitmap</a>.<li><p>Let <var>canvas</var> be the <code id=2dcontext:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code> element to which the rendering
- context was most recently <a href=#concept-canvas-binding-steps id=2dcontext:concept-canvas-binding-steps-2>bound</a>.<li>
- <p><a href=#queue-a-task id=2dcontext:queue-a-task>Queue a task</a> associated with <var>canvas</var>' <code id=2dcontext:document><a href=#document>Document</a></code>
- to perform the following substeps:</p>
- <ol><li><p>Overwrite <var>output bitmap</var> with <var>bitmap
- copy</var>.<li><p>Overwrite <var>output bitmap</var>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-4>origin-clean</a> flag with <var>origin-clean
- flag copy</var>.<li><p>Overwrite <var>output bitmap</var>'s <a href=#hit-region-list id=2dcontext:hit-region-list-3>hit region list</a> with <var>hit region list copy</var>.<li><p>Follow the directions in the <var>list of pending interface actions
- copy</var>.</ol>
- </ol>
- <p>The algorithm above must use the <dfn id=canvas-updating-task-source>canvas updating task source</dfn> (which is just used by
- this algorithm).</p>
- <p>The <dfn id=dom-context-2d-commit><code>commit()</code></dfn> method must run the
- following steps:</p>
- <ol><li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode>context bitmap
- mode</a> is <a href=#concept-canvas-bound id=2dcontext:concept-canvas-bound>fixed</a>, throw an
- <code id=2dcontext:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p><a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap>Commit the scratch bitmap</a> for the rendering context.</ol>
- <p class=note>The <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-12>scratch bitmap</a> is only <a href=#commit-the-scratch-bitmap id=2dcontext:commit-the-scratch-bitmap-2>committed</a> when the <code id=2dcontext:dom-context-2d-commit-3><a href=#dom-context-2d-commit>commit()</a></code> method is
- called. (This doesn't matter for <code id=2dcontext:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> elements in <a href=#concept-canvas-direct-2d id=2dcontext:concept-canvas-direct-2d>direct-2d</a> mode, since there the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-13>scratch
- bitmap</a> is also the <code id=2dcontext:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code> element's bitmap so every drawing operation is
- immediately drawn.)</p>
- <hr>
- <p>When the user agent is to <dfn id=concept-canvas-set-bitmap-dimensions>set bitmap
- dimensions</dfn> to <var>width</var> and <var>height</var>, it must run the
- following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-14>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-4>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-3>list of
- pending interface actions</a>.<li><p>Resize the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-15>scratch bitmap</a> to the new <var>width</var> and <var>height</var> and clear it to fully transparent black.<li><p>If the rendering context has an <a href=#output-bitmap id=2dcontext:output-bitmap-7>output bitmap</a>, and the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-16>scratch
- bitmap</a> is a different bitmap than the <a href=#output-bitmap id=2dcontext:output-bitmap-8>output bitmap</a>, then resize the
- <a href=#output-bitmap id=2dcontext:output-bitmap-9>output bitmap</a> to the new <var>width</var> and <var>height</var>
- and clear it to fully transparent black.<li>
- <p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-2>context bitmap
- mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-2>fixed</a>, then run these substeps:</p>
- <ol><li><p>Let <var>canvas</var> be the <code id=2dcontext:the-canvas-element-9><a href=#the-canvas-element>canvas</a></code> element to which the rendering
- context's <code id=2dcontext:dom-context-2d-canvas-5><a href=#dom-context-2d-canvas>canvas</a></code> attribute was initialized.<li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-3>context
- bitmap mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-3>fixed</a> and the numeric value of
- the <var>canvas</var>' <code id=2dcontext:attr-canvas-width-2><a href=#attr-canvas-width>width</a></code> content attribute
- differs from <var>width</var>, then set <var>canvas</var>' <code id=2dcontext:attr-canvas-width-3><a href=#attr-canvas-width>width</a></code> content attribute to the shortest possible string
- representing <var>width</var> as a <a href=#valid-non-negative-integer id=2dcontext:valid-non-negative-integer>valid non-negative integer</a>.<li><p>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-4>context
- bitmap mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-4>fixed</a> and the numeric value of
- the <var>canvas</var>' <code id=2dcontext:attr-canvas-height-2><a href=#attr-canvas-height>height</a></code> content attribute
- differs from <var>height</var>, then set <var>canvas</var>' <code id=2dcontext:attr-canvas-height-3><a href=#attr-canvas-height>height</a></code> content attribute to the shortest possible string
- representing <var>height</var> as a <a href=#valid-non-negative-integer id=2dcontext:valid-non-negative-integer-2>valid non-negative integer</a>.</ol>
- </ol>
- <div class=example>
- <p>Only one square appears to be drawn in the following example:</p>
- <pre>// canvas is a reference to a <canvas> element
- var context = canvas.getContext('2d');
- context.fillRect(0,0,50,50);
- canvas.setAttribute('width', '300'); // clears the canvas
- context.fillRect(0,100,50,50);
- canvas.width = canvas.width; // clears the canvas
- context.fillRect(100,0,50,50); // only this square remains</pre>
- </div>
- <hr>
- <p>When the user agent is to run the <dfn id=concept-canvas-unbinding-steps>unbinding
- steps</dfn> for a rendering context, it must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-2>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-17>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-5>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-4>list of
- pending interface actions</a>.<li><p>Clear the <code id=2dcontext:canvasrenderingcontext2d-16><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-18>scratch bitmap</a> to a
- transparent black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-17><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-19>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-5>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-18><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object have no <a href=#output-bitmap id=2dcontext:output-bitmap-10>output
- bitmap</a>.</ol>
- <p>When the user agent is to run the <dfn id=concept-canvas-binding-steps>binding steps</dfn>
- to bind the rendering context to the <code id=2dcontext:the-canvas-element-10><a href=#the-canvas-element>canvas</a></code> element <var>target</var>, it
- must run the following steps:</p>
- <ol><li><p><a href=#reset-the-rendering-context-to-its-default-state id=2dcontext:reset-the-rendering-context-to-its-default-state-3>Reset the rendering context to its default state</a>.<li><p>Clear the <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-20>scratch bitmap</a>'s <a href=#hit-region-list id=2dcontext:hit-region-list-6>hit region list</a> and its <a href=#list-of-pending-interface-actions id=2dcontext:list-of-pending-interface-actions-5>list of
- pending interface actions</a>.<li><p>Resize the <code id=2dcontext:canvasrenderingcontext2d-19><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-21>scratch bitmap</a> to
- the dimensions of <var>target</var>'s bitmap and clear it to fully transparent
- black.<li><p>Set the <code id=2dcontext:canvasrenderingcontext2d-20><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-22>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=2dcontext:concept-canvas-origin-clean-6>origin-clean</a> flag to true.<li><p>Let the <code id=2dcontext:canvasrenderingcontext2d-21><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#output-bitmap id=2dcontext:output-bitmap-11>output bitmap</a> be <var>target</var>'s bitmap.</ol>
- <hr>
- <p>The <dfn id=dom-context-2d-canvas><code>canvas</code></dfn> attribute must return the
- value it was initialised to when the object was created.</p>
- <p>The <dfn id=dom-context-2d-width><code>width</code></dfn> attribute, on getting, must
- return the width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-23>scratch bitmap</a>, in CSS pixels. On
- setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-3>set bitmap dimensions</a>
- to the new value and the current height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-24>scratch bitmap</a> in
- CSS pixels, respectively.</p>
- <p>The <dfn id=dom-context-2d-height><code>height</code></dfn> attribute, on getting, must
- return the height of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-25>scratch bitmap</a>, in CSS pixels. On
- setting, it must <a href=#concept-canvas-set-bitmap-dimensions id=2dcontext:concept-canvas-set-bitmap-dimensions-4>set bitmap dimensions</a>
- to the current width of the rendering context's <a href=#scratch-bitmap id=2dcontext:scratch-bitmap-26>scratch bitmap</a> in CSS pixels and the
- new value, respectively.</p>
- <hr>
- <p>Except where otherwise specified, for the 2D context interface, <strong>any method call with a
- numeric argument whose value is infinite or a NaN value must be ignored</strong>.</p>
-
- <p>Whenever the CSS value <code>currentColor</code> is used as a colour in the
- <code id=2dcontext:canvasrenderingcontext2d-22><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> API, the "computed value of the 'color' property" for the
- purposes of determining the computed value of the <code>currentColor</code> keyword is
- the value described by the appropriate entry in the following list:</p>
- <dl><dt>If the rendering context's <a href=#concept-canvas-context-bitmap-mode id=2dcontext:concept-canvas-context-bitmap-mode-5>context bitmap
- mode</a> is <a href=#concept-canvas-fixed id=2dcontext:concept-canvas-fixed-5>fixed</a> and the <code id=2dcontext:the-canvas-element-11><a href=#the-canvas-element>canvas</a></code>
- element is <a href=#being-rendered id=2dcontext:being-rendered>being rendered</a><dd><p>The "computed value of the 'color' property" for the purposes of determining the computed
- value of the <code>currentColor</code> keyword is the computed value of the 'color'
- property on the <code id=2dcontext:the-canvas-element-12><a href=#the-canvas-element>canvas</a></code> element at the time that the colour is specified (e.g. when
- the appropriate attribute is set, or when the method is called; not when the colour is rendered or
- otherwise used). <a href=#refsCSSCOLOR>[CSSCOLOR]</a><dt>In all other cases<dd><p>The "computed value of the 'color' property" for the purposes of determining the computed
- value of the <code>currentColor</code> keyword is fully opaque black. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></dl>
- <p>In the case of <code id=2dcontext:dom-canvasgradient-addcolorstop-2><a href=#dom-canvasgradient-addcolorstop>addColorStop()</a></code> on
- <code id=2dcontext:canvasgradient-3><a href=#canvasgradient>CanvasGradient</a></code>, the "computed value of the 'color' property" for the purposes of
- determining the computed value of the <code>currentColor</code> keyword is always fully
- opaque black (there is no associated element). <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
- <p class=note>This is because <code id=2dcontext:canvasgradient-4><a href=#canvasgradient>CanvasGradient</a></code> objects are
- <code id=2dcontext:the-canvas-element-13><a href=#the-canvas-element>canvas</a></code>-neutral — a <code id=2dcontext:canvasgradient-5><a href=#canvasgradient>CanvasGradient</a></code> object created by one
- <code id=2dcontext:the-canvas-element-14><a href=#the-canvas-element>canvas</a></code> can be used by another, and there is therefore no way to know which is the
- "element in question" at the time that the colour is specified.</p>
- <p class=note>Similar concerns exist with font-related properties; the rules for those are
- described in detail in the relevant section below.</p>
-
- <hr>
- <p>The <code id=2dcontext:canvasfillrule-9><a href=#canvasfillrule>CanvasFillRule</a></code> enumeration is used to select the <dfn id=fill-rule>fill rule</dfn>
- algorithm by which to determine if a point is inside or outside a path.</p>
- <p>The value "<dfn id=dom-context-2d-fillrule-nonzero><code>nonzero</code></dfn>" value
- indicates the non-zero winding rule, wherein
- a point is considered to be outside a shape if the number of times a half-infinite straight
- line drawn from that point crosses the shape's path going in one direction is equal to the
- number of times it crosses the path going in the other direction.
- </p>
- <p>The "<dfn id=dom-context-2d-fillrule-evenodd><code>evenodd</code></dfn>" value indicates
- the even-odd rule, wherein
- a point is considered to be outside a shape if the number of times a half-infinite straight
- line drawn from that point crosses the shape's path is even.
- </p>
- <p>If a point is not outside a shape, it is inside the shape.</p>
- <h6 id=implementation-notes>4.12.4.2.1 Implementation notes</h6>
- <p><i>This section is non-normative.</i></p>
- <p>Although the way the specification is written it might sound like an implementation needs to
- track up to four bitmaps per canvas or rendering context — one <a href=#scratch-bitmap id=implementation-notes:scratch-bitmap>scratch bitmap</a>,
- one <a href=#output-bitmap id=implementation-notes:output-bitmap>output bitmap</a> for the rendering context, one bitmap for the <code id=implementation-notes:the-canvas-element><a href=#the-canvas-element>canvas</a></code>,
- and one bitmap for the actually currently rendered image — user agents can in fact generally
- optimise this to only one or two.</p>
- <p>The <a href=#scratch-bitmap id=implementation-notes:scratch-bitmap-2>scratch bitmap</a>, when it isn't the same bitmap as the <a href=#output-bitmap id=implementation-notes:output-bitmap-2>output
- bitmap</a>, is only directly observable if it is read, and therefore implementations can,
- instead of updating this bitmap, merely remember the sequence of drawing operations that have been
- applied to it until such time as the bitmap's actual data is needed (for example because of a call
- to <code id=implementation-notes:dom-context-2d-commit><a href=#dom-context-2d-commit>commit()</a></code>, <code id=implementation-notes:dom-context-2d-drawimage><a href=#dom-context-2d-drawimage>drawImage()</a></code>, or the <code id=implementation-notes:dom-createimagebitmap><a href=#dom-createimagebitmap>createImageBitmap()</a></code>
- factory method). In many cases, this will be more memory efficient.</p>
- <p>The bitmap of a <code id=implementation-notes:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element is the one bitmap that's pretty much always going
- to be needed in practice. The <a href=#output-bitmap id=implementation-notes:output-bitmap-3>output bitmap</a> of a rendering context, when it has one,
- is always just an alias to a <code id=implementation-notes:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element's bitmap.</p>
- <p>Additional bitmaps are sometimes needed, e.g. to enable fast drawing when the canvas is being
- painted at a different size than its intrinsic size, or to enable double buffering so that the
- rendering commands from the <a href=#scratch-bitmap id=implementation-notes:scratch-bitmap-3>scratch bitmap</a> can be applied without the rendering being
- updated midway.</p>
- <h6 id=the-canvas-state>4.12.4.2.2 The canvas state</h6>
- <p>Each <code id=the-canvas-state:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> rendering context maintains a stack of drawing
- states. <dfn id=drawing-state>Drawing states</dfn> consist of:</p>
- <ul class=brief><li>The current <a href=#transformations id=the-canvas-state:transformations>transformation matrix</a>.<li>The current <a href=#clipping-region id=the-canvas-state:clipping-region>clipping region</a>.<li>The current values of the following attributes: <code id=the-canvas-state:dom-context-2d-strokestyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>, <code id=the-canvas-state:dom-context-2d-fillstyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, <code id=the-canvas-state:dom-context-2d-globalalpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>, <code id=the-canvas-state:dom-context-2d-linewidth><a href=#dom-context-2d-linewidth>lineWidth</a></code>, <code id=the-canvas-state:dom-context-2d-linecap><a href=#dom-context-2d-linecap>lineCap</a></code>, <code id=the-canvas-state:dom-context-2d-linejoin><a href=#dom-context-2d-linejoin>lineJoin</a></code>, <code id=the-canvas-state:dom-context-2d-miterlimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code>, <code id=the-canvas-state:dom-context-2d-linedashoffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code>, <code id=the-canvas-state:dom-context-2d-shadowoffsetx><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code>, <code id=the-canvas-state:dom-context-2d-shadowoffsety><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code>, <code id=the-canvas-state:dom-context-2d-shadowblur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>, <code id=the-canvas-state:dom-context-2d-shadowcolor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>, <code id=the-canvas-state:dom-context-2d-globalcompositeoperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>, <code id=the-canvas-state:dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code id=the-canvas-state:dom-context-2d-textalign><a href=#dom-context-2d-textalign>textAlign</a></code>, <code id=the-canvas-state:dom-context-2d-textbaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code>, <code id=the-canvas-state:dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code>, <code id=the-canvas-state:dom-context-2d-imagesmoothingenabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code>.<li>The current <a href=#dash-list id=the-canvas-state:dash-list>dash list</a>.</ul>
- <p class=note>The <a href=#current-default-path id=the-canvas-state:current-default-path>current default path</a> and the rendering context's bitmaps are not
- part of the drawing state. The <a href=#current-default-path id=the-canvas-state:current-default-path-2>current default path</a> is persistent, and can only be
- reset using the <code id=the-canvas-state:dom-context-2d-beginpath><a href=#dom-context-2d-beginpath>beginPath()</a></code> method. The bitmaps
- depend on whether and how the rendering context is bound to a <code id=the-canvas-state:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element.</p>
- <dl class=domintro><dt><var>context</var> . <code id=the-canvas-state:dom-context-2d-save><a href=#dom-context-2d-save>save</a></code>()<dd>
- <p>Pushes the current state onto the stack.</p>
- <dt><var>context</var> . <code id=the-canvas-state:dom-context-2d-restore><a href=#dom-context-2d-restore>restore</a></code>()<dd>
- <p>Pops the top state on the stack, restoring the context to that state.</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-save><code>save()</code></dfn> method must push a copy of the
- current drawing state onto the drawing state stack.</p>
- <p>The <dfn id=dom-context-2d-restore><code>restore()</code></dfn> method must pop the top
- entry in the drawing state stack, and reset the drawing state it describes. If there is no saved
- state, the method must do nothing.</p>
- <p>When the user agent is to <dfn id=reset-the-rendering-context-to-its-default-state>reset the rendering context to its default state</dfn>, it must
- clear the drawing state stack and everything that <a href=#drawing-state id=the-canvas-state:drawing-state>drawing state</a> consists of to
- initial values.</p>
-
-
- <h6 id=drawingstyle-objects>4.12.4.2.3 <code id=drawingstyle-objects:drawingstyle><a href=#drawingstyle>DrawingStyle</a></code> objects</h6>
- <p>All the line styles (line width, caps, joins, and dash patterns) and text styles (fonts)
- described in the next two sections apply to <code id=drawingstyle-objects:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects and to
- <code id=drawingstyle-objects:drawingstyle-2><a href=#drawingstyle>DrawingStyle</a></code> objects. This section defines the constructor used to obtain a
- <code id=drawingstyle-objects:drawingstyle-3><a href=#drawingstyle>DrawingStyle</a></code> object. This object is then used by methods on <code id=drawingstyle-objects:path2d><a href=#path2d>Path2D</a></code>
- objects to control how text and paths are rasterised and stroked.</p>
- <dl class=domintro><dt><var>styles</var> = new <code id=drawingstyle-objects:dom-drawingstyle><a href=#dom-drawingstyle>DrawingStyle</a></code>( [ <var>element</var> ] )<dd>
- <p>Creates a new <code id=drawingstyle-objects:drawingstyle-4><a href=#drawingstyle>DrawingStyle</a></code> object, optionally using a specific element for
- resolving relative keywords and sizes in font specifications.</p>
- </dl>
-
- <p>Each <code id=drawingstyle-objects:drawingstyle-5><a href=#drawingstyle>DrawingStyle</a></code> object can have a <dfn id=styles-scope-object>styles scope object</dfn>.</p>
- <p>The <dfn id=dom-drawingstyle><code>DrawingStyle()</code></dfn> constructor, when invoked,
- must return a newly created <code id=drawingstyle-objects:drawingstyle-6><a href=#drawingstyle>DrawingStyle</a></code> object. If the constructor was passed an
- argument, then the <code id=drawingstyle-objects:drawingstyle-7><a href=#drawingstyle>DrawingStyle</a></code> object's <a href=#styles-scope-object id=drawingstyle-objects:styles-scope-object>styles scope object</a> is that
- element. Otherwise, if the <a href=#javascript-global-environment id=drawingstyle-objects:javascript-global-environment>JavaScript global environment</a> is a <a href=#document-environment id=drawingstyle-objects:document-environment>document
- environment</a>, the object's <a href=#styles-scope-object id=drawingstyle-objects:styles-scope-object-2>styles scope object</a> is the <code id=drawingstyle-objects:document><a href=#document>Document</a></code>
- object of the <a href=#active-document id=drawingstyle-objects:active-document>active document</a> of the <a href=#browsing-context id=drawingstyle-objects:browsing-context>browsing context</a> of the
- <code id=drawingstyle-objects:window><a href=#window>Window</a></code> object on which the interface object of the invoked constructor is found.
- Otherwise, the <a href=#javascript-global-environment id=drawingstyle-objects:javascript-global-environment-2>JavaScript global environment</a> is a <a href=#worker-environment id=drawingstyle-objects:worker-environment>worker environment</a>,
- and the <a href=#styles-scope-object id=drawingstyle-objects:styles-scope-object-3>styles scope object</a> is the worker.</p>
-
- <h6 id=line-styles>4.12.4.2.4 Line styles</h6>
- <dl class=domintro><dt><var>context</var> . <code id=line-styles:dom-context-2d-linewidth><a href=#dom-context-2d-linewidth>lineWidth</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=line-styles:dom-context-2d-linewidth-2><a href=#dom-context-2d-linewidth>lineWidth</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current line width.</p>
- <p>Can be set, to change the line width. Values that are not finite values greater than zero are
- ignored.</p>
- <dt><var>context</var> . <code id=line-styles:dom-context-2d-linecap><a href=#dom-context-2d-linecap>lineCap</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=line-styles:dom-context-2d-linecap-2><a href=#dom-context-2d-linecap>lineCap</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current line cap style.</p>
- <p>Can be set, to change the line cap style.</p>
- <p>The possible line cap styles are "<code>butt"</code>", "<code>round"</code>", and "<code>square"</code>". Other values are ignored.</p>
- <dt><var>context</var> . <code id=line-styles:dom-context-2d-linejoin><a href=#dom-context-2d-linejoin>lineJoin</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=line-styles:dom-context-2d-linejoin-2><a href=#dom-context-2d-linejoin>lineJoin</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current line join style.</p>
- <p>Can be set, to change the line join style.</p>
- <p>The possible line join styles are "<code>bevel"</code>", "<code>round"</code>", and "<code>miter"</code>". Other values are ignored.</p>
- <dt><var>context</var> . <code id=line-styles:dom-context-2d-miterlimit><a href=#dom-context-2d-miterlimit>miterLimit</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=line-styles:dom-context-2d-miterlimit-2><a href=#dom-context-2d-miterlimit>miterLimit</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current miter limit ratio.</p>
- <p>Can be set, to change the miter limit ratio. Values that are not finite values greater than
- zero are ignored.</p>
- <dt><var>context</var> . <code id=line-styles:dom-context-2d-setlinedash><a href=#dom-context-2d-setlinedash>setLineDash</a></code>(<var>segments</var>)<dt><var>styles</var> . <code id=line-styles:dom-context-2d-setlinedash-2><a href=#dom-context-2d-setlinedash>setLineDash</a></code>(<var>segments</var>)<dd>
- <p>Sets the current line dash pattern (as used when stroking). The argument is a list of
- distances for which to alternately have the line on and the line off.</p>
- <dt><var>segments</var> = <var>context</var> . <code id=line-styles:dom-context-2d-getlinedash><a href=#dom-context-2d-getlinedash>getLineDash</a></code>()<dt><var>segments</var> = <var>styles</var> . <code id=line-styles:dom-context-2d-getlinedash-2><a href=#dom-context-2d-getlinedash>getLineDash</a></code>()<dd>
- <p>Returns a copy of the current line dash pattern. The array returned will always have an even
- number of entries (i.e. the pattern is normalized).</p>
- <dt><var>context</var> . <code id=line-styles:dom-context-2d-linedashoffset><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code><dt><var>styles</var> . <code id=line-styles:dom-context-2d-linedashoffset-2><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code><dd>
- <p>Returns the phase offset (in the same units as the line dash pattern).</p>
- <p>Can be set, to change the phase offset. Values that are not finite values are ignored.</p>
- </dl>
-
- <p>Objects that implement the <code id=line-styles:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface have attributes and
- methods (defined in this section) that control how lines are treated by the object.</p>
- <p>The <dfn id=dom-context-2d-linewidth><code>lineWidth</code></dfn> attribute gives the
- width of lines, in coordinate space units. On getting, it must return the current value. On
- setting, zero, negative, infinite, and NaN values must be ignored, leaving the value unchanged;
- other values must change the current value to the new value.</p>
- <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- <code id=line-styles:dom-context-2d-linewidth-3><a href=#dom-context-2d-linewidth>lineWidth</a></code> attribute must initially have the value
- 1.0.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-linecap><code>lineCap</code></dfn> attribute defines the type
- of endings that UAs will place on the end of lines. The three valid values are "<code>butt"</code>", "<code>round"</code>", and "<code>square"</code>".</p>
- <p>On getting, it must return the current value. On setting, if the new value is one of the
- literal strings "<code>butt"</code>", "<code>round"</code>", and "<code>square"</code>", then the current value must be changed to the new value; other values
- must ignored, leaving the value unchanged.</p>
- <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-3><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- <code id=line-styles:dom-context-2d-linecap-3><a href=#dom-context-2d-linecap>lineCap</a></code> attribute must initially have the value
- "<code>butt"</code>".</p>
- <hr>
- <p>The <dfn id=dom-context-2d-linejoin><code>lineJoin</code></dfn> attribute defines the type
- of corners that UAs will place where two lines meet. The three valid values are
- "<code>bevel"</code>", "<code>round"</code>", and "<code>miter"</code>".</p>
- <p>On getting, it must return the current value. On setting, if the new value is one of the
- literal strings "<code>bevel"</code>", "<code>round"</code>", and "<code>miter"</code>", then the current value must be changed to the new value; other values
- must be ignored, leaving the value unchanged.</p>
- <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-4><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- <code id=line-styles:dom-context-2d-linejoin-3><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute must initially have the value
- "<code>miter"</code>".</p>
- <hr>
- <p>When the <code id=line-styles:dom-context-2d-linejoin-4><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute has the value "<code>miter"</code>", strokes use the miter limit ratio to decide how to render joins. The
- miter limit ratio can be explicitly set using the <dfn id=dom-context-2d-miterlimit><code>miterLimit</code></dfn> attribute. On getting, it must return
- the current value. On setting, zero, negative, infinite, and NaN values must be ignored, leaving
- the value unchanged; other values must change the current value to the new value.</p>
-
- <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-5><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- <code id=line-styles:dom-context-2d-miterlimit-3><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute must initially have the value
- 10.0.</p>
- <hr>
- <p>Each <code id=line-styles:canvasdrawingstyles-6><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object has a <dfn id=dash-list>dash list</dfn>, which is either empty
- or consists of an even number of non-negative numbers. Initially, the <a href=#dash-list id=line-styles:dash-list>dash list</a> must
- be empty.</p>
- <p>When the <dfn id=dom-context-2d-setlinedash><code>setLineDash()</code></dfn> method is
- invoked, it must run the following steps:</p>
- <ol><li><p>Let <var>a</var> be the argument.<li><p>If any value in <var>a</var> is not finite (e.g. an Infinity or a NaN value), or
- if any value is negative (less than zero), then abort these steps (without throwing an exception;
- user agents could show a message on a developer console, though, as that would be helpful for
- debugging).<li><p>If the number of elements in <var>a</var> is odd, then let <var>a</var>
- be the concatentation of two copies of <var>a</var>.<li><p>Let the object's <a href=#dash-list id=line-styles:dash-list-2>dash list</a> be <var>a</var>.</ol>
- <p>When the <dfn id=dom-context-2d-getlinedash><code>getLineDash()</code></dfn> method is
- invoked, it must return a sequence whose values are the values of the object's <a href=#dash-list id=line-styles:dash-list-3>dash
- list</a>, in the same order.</p>
- <p>It is sometimes useful to change the "phase" of the dash pattern, e.g. to achieve a "marching
- ants" effect. The phase can be set using the <dfn id=dom-context-2d-linedashoffset><code>lineDashOffset</code></dfn> attribute. On getting, it must
- return the current value. On setting, infinite and NaN values must be ignored, leaving the value
- unchanged; other values must change the current value to the new value.</p>
- <p>When the object implementing the <code id=line-styles:canvasdrawingstyles-7><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- <code id=line-styles:dom-context-2d-linedashoffset-3><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code> attribute must initially have
- the value 0.0.</p>
- <hr>
- <p>When a user agent is to <dfn id=trace-a-path>trace a path</dfn>, given an object <var>style</var>
- that implements the <code id=line-styles:canvasdrawingstyles-8><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface, it must run the following
- algorithm. This algorithm returns a new <a href=#concept-path id=line-styles:concept-path>path</a>.</p>
- <ol><li><p>Let <var>path</var> be a copy of the path being traced.<li><p>Prune all zero-length <a href=#line-segments id=line-styles:line-segments>line segments</a> from <var>path</var>.<li><p>Remove from <var>path</var> any subpaths containing no lines (i.e. subpaths with
- just one point).<li><p>Replace each point in each subpath of <var>path</var> other than the first point
- and the last point of each subpath by a <i>join</i> that joins the line leading to that point to
- the line leading out of that point, such that the subpaths all consist of two points (a starting
- point with a line leading out of it, and an ending point with a line leading into it), one or
- more lines (connecting the points and the joins), and zero or more joins (each connecting one
- line to another), connected together such that each subpath is a series of one or more lines with
- a join between each one and a point on each end.<li><p>Add a straight closing line to each closed subpath in <var>path</var> connecting
- the last point and the first point of that subpath; change the last point to a join (from the
- previously last line to the newly added closing line), and change the first point to a join (from
- the newly added closing line to the first line).</p>
- <li><p>If the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-4>dash list</a> is empty, jump to the step
- labeled <i>convert</i>.<li><p>Let <var>pattern width</var> be the concatenation of all the entries of the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-5>dash list</a>, in coordinate space units.</p>
- <li><p>For each subpath <var>subpath</var> in <var>path</var>, run the
- following substeps. These substeps mutate the subpaths in <var>path</var> <i>in
- vivo</i>.</p>
- <ol><li><p>Let <var>subpath width</var> be the length of all the lines of <var>subpath</var>, in coordinate space units.</p>
- <li><p>Let <var>offset</var> be the value of the <var>styles</var> <code id=line-styles:dom-context-2d-linedashoffset-4><a href=#dom-context-2d-linedashoffset>lineDashOffset</a></code>, in coordinate space
- units.<li>
- <p>While <var>offset</var> is greater than <var>pattern width</var>,
- decrement it by <var>pattern width</var>.</p>
- <p>While <var>offset</var> is less than zero, increment it by <var>pattern
- width</var>.</p>
- <li><p>Define <var>L</var> to be a linear coordinate line defined along all lines in
- <var>subpath</var>, such that the start of the first line in the subpath is defined
- as coordinate 0, and the end of the last line in the subpath is defined as coordinate <var>subpath width</var>.<li><p>Let <var>position</var> be zero minus <var>offset</var>.<li><p>Let <var>index</var> be 0.<li><p>Let <var>current state</var> be <i>off</i> (the other states being <i>on</i>
- and <i>zero-on</i>).<li><p><i>Dash on</i>: Let <var>segment length</var> be
- the value of the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-6>dash
- list</a>'s <var>index</var>th entry.<li><p>Increment <var>position</var> by <var>segment length</var>.<li><p>If <var>position</var> is greater than <var>subpath width</var>,
- then end these substeps for this subpath and start them again for the next subpath; if there
- are no more subpaths, then jump to the step labeled <i>convert</i> instead.<li><p>If <var>segment length</var> is non-zero, let <var>current state</var> be <i>on</i>.<li><p>Increment <var>index</var> by one.<li><p><i>Dash off</i>: Let <var>segment
- length</var> be the value of the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-7>dash list</a>'s <var>index</var>th entry.<li><p>Let <var>start</var> be the offset <var>position</var> on <var>L</var>.<li><p>Increment <var>position</var> by <var>segment length</var>.<li><p>If <var>position</var> is less than zero, then jump to the step labeled
- <i>post-cut</i>.<li><p>If <var>start</var> is less than zero, then let <var>start</var> be
- zero.<li><p>If <var>position</var> is greater than <var>subpath width</var>,
- then let <var>end</var> be the offset <var>subpath width</var> on <var>L</var>. Otherwise, let <var>end</var> be the offset <var>position</var> on <var>L</var>.<li>
- <p>Jump to the first appropriate step:</p>
- <dl class=switch><dt>If <var>segment length</var> is zero and <var>current state</var> is
- <i>off</i><dd>
- <p>Do nothing, just continue to the next step.</p>
- <dt>If <var>current state</var> is <i>off</i><dd>
- <p>Cut the line on which <var>end</var> finds itself short at <var>end</var> and place a point there, cutting the subpath that it was in in two;
- remove all line segments, joins, points, and subpaths that are between <var>start</var> and <var>end</var>; and finally place a single point at <var>start</var> with no lines connecting to it.</p>
- <p>The point has a <i>directionality</i> for the purposes of drawing line caps (see below).
- The directionality is the direction that the original line had at that point (i.e. when <var>L</var> was defined above).</p>
- <dt>Otherwise<dd>
- <p>Cut the line on which <var>start</var> finds itself into two at <var>start</var> and place a point there, cutting the subpath that it was in in two, and
- similarly cut the line on which <var>end</var> finds itself short at <var>end</var> and place a point there, cutting the subpath that <em>it</em> was in in
- two, and then remove all line segments, joins, points, and subpaths that are between <var>start</var> and <var>end</var>.</p>
- <p>If <var>start</var> and <var>end</var> are the same point, then this
- results in just the line being cut in two and two points being inserted there, with nothing
- being removed, unless a join also happens to be at that point, in which case the join must
- be removed.</p>
- </dl>
- <li><p><i>Post-cut</i>: If <var>position</var> is greater than <var>subpath width</var>, then jump to the step labeled <i>convert</i>.<li><p>If <var>segment length</var> is greater than zero, let <var>positioned-at-on-dash</var> be false.<li><p>Increment <var>index</var> by one. If it is equal to the number of entries in
- the <var>styles</var> <a href=#dash-list id=line-styles:dash-list-8>dash list</a>, then let <var>index</var> be
- 0.<li><p>Return to the step labeled <i>dash on</i>.</ol>
- <li>
- <p><i>Convert</i>: This is the step that converts the path to a new path that represents its
- stroke.</p>
- <p>Create a new <a href=#concept-path id=line-styles:concept-path-2>path</a> that describes the edge of the areas
- that would be covered if a straight line of length equal to the <var>styles</var>
- <code id=line-styles:dom-context-2d-linewidth-4><a href=#dom-context-2d-linewidth>lineWidth</a></code> was swept along each subpath in <var>path</var> while being kept at an angle such that the line is orthogonal to the path
- being swept, replacing each point with the end cap necessary to satisfy the <var>styles</var> <code id=line-styles:dom-context-2d-linecap-4><a href=#dom-context-2d-linecap>lineCap</a></code> attribute as
- described previously and elaborated below, and replacing each join with the join necessary to
- satisfy the <var>styles</var> <code id=line-styles:dom-context-2d-linejoin-5><a href=#dom-context-2d-linejoin>lineJoin</a></code>
- type, as defined below.</p>
- <p><strong>Caps</strong>: Each point has a flat edge perpendicular to the direction of the line
- coming out of it. This is them augmented according to the value of the <var>styles</var> <code id=line-styles:dom-context-2d-linecap-5><a href=#dom-context-2d-linecap>lineCap</a></code>. The "<code>butt"</code>" value means that no additional line cap is added. The "<code>round"</code>" value means that a semi-circle with the diameter equal to the <var>styles</var> <code id=line-styles:dom-context-2d-linewidth-5><a href=#dom-context-2d-linewidth>lineWidth</a></code> width must
- additionally be placed on to the line coming out of each point. The "<code>square"</code>" value means that a rectangle with the length of the <var>styles</var> <code id=line-styles:dom-context-2d-linewidth-6><a href=#dom-context-2d-linewidth>lineWidth</a></code> width and the
- width of half the <var>styles</var> <code id=line-styles:dom-context-2d-linewidth-7><a href=#dom-context-2d-linewidth>lineWidth</a></code> width, placed flat against the edge
- perpendicular to the direction of the line coming out of the point, must be added at each
- point.</p>
- <p>Points with no lines coming out of them must have two caps placed back-to-back as if it was
- really two points connected to each other by an infinitesimally short straight line in the
- direction of the point's <i>directionality</i> (as defined above).</p>
- <p><strong>Joins</strong>: In addition to the point where a join occurs, two additional points
- are relevant to each join, one for each line: the two corners found half the line width away
- from the join point, one perpendicular to each line, each on the side furthest from the other
- line.</p>
- <p>A triangle connecting these two opposite corners with a straight line, with the third point
- of the triangle being the join point, must be added at all joins. The <code id=line-styles:dom-context-2d-linejoin-6><a href=#dom-context-2d-linejoin>lineJoin</a></code> attribute controls whether anything else is
- rendered. The three aforementioned values have the following meanings:</p>
- <p>The "<code>bevel"</code>" value means that this is all that is rendered at
- joins.</p>
- <p>The "<code>round"</code>" value means that an arc connecting the two aforementioned
- corners of the join, abutting (and not overlapping) the aforementioned triangle, with the
- diameter equal to the line width and the origin at the point of the join, must be added at
- joins.</p>
- <p>The "<code>miter"</code>" value means that a second triangle must (if it can given
- the miter length) be added at the join, with one line being the line between the two
- aforementioned corners, abutting the first triangle, and the other two being continuations of
- the outside edges of the two joining lines, as long as required to intersect without going over
- the miter length.</p>
- <p>The miter length is the distance from the point where the join occurs to the intersection of
- the line edges on the outside of the join. The miter limit ratio is the maximum allowed ratio of
- the miter length to half the line width. If the miter length would cause the miter limit ratio
- (as set by the <var>style</var> <code id=line-styles:dom-context-2d-miterlimit-4><a href=#dom-context-2d-miterlimit>miterLimit</a></code> attribute) to be exceeded, this second
- triangle must not be added.</p>
- <p>The subpaths in the newly created path must be oriented such that for any point, the number
- of times a half-infinite straight line drawn from that point crosses a subpath is even if and
- only if the number of times a half-infinite straight line drawn from that same point crosses a
- subpath going in one direction is equal to the number of times it crosses a subpath going in the
- other direction.</p>
- <li><p>Return the newly created path.</ol>
-
- <h6 id=text-styles>4.12.4.2.5 Text styles</h6>
- <dl class=domintro><dt><var>context</var> . <code id=text-styles:dom-context-2d-font><a href=#dom-context-2d-font>font</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=text-styles:dom-context-2d-font-2><a href=#dom-context-2d-font>font</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current font settings.</p>
- <p>Can be set, to change the font. The syntax is the same as for the CSS 'font' property; values
- that cannot be parsed as CSS font values are ignored.</p>
- <p>Relative keywords and lengths are computed relative to the font of the <code id=text-styles:the-canvas-element><a href=#the-canvas-element>canvas</a></code>
- element.</p>
- <dt><var>context</var> . <code id=text-styles:dom-context-2d-textalign><a href=#dom-context-2d-textalign>textAlign</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=text-styles:dom-context-2d-textalign-2><a href=#dom-context-2d-textalign>textAlign</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current text alignment settings.</p>
- <p>Can be set, to change the alignment. The possible values are and their meanings are given
- below. Other values are ignored. The default is "<code>start</code>".</p>
- <dt><var>context</var> . <code id=text-styles:dom-context-2d-textbaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=text-styles:dom-context-2d-textbaseline-2><a href=#dom-context-2d-textbaseline>textBaseline</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current baseline alignment settings.</p>
- <p>Can be set, to change the baseline alignment. The possible values and their meanings are
- given below. Other values are ignored. The default is "<code id=text-styles:dom-context-2d-textbaseline-alphabetic><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>".</p>
- <dt><var>context</var> . <code id=text-styles:dom-context-2d-direction><a href=#dom-context-2d-direction>direction</a></code> [ = <var>value</var> ]<dt><var>styles</var> . <code id=text-styles:dom-context-2d-direction-2><a href=#dom-context-2d-direction>direction</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current directionality.</p>
- <p>Can be set, to change the directionality. The possible values and their meanings are given
- below. Other values are ignored. The default is "<code id=text-styles:dom-context-2d-direction-inherit><a href=#dom-context-2d-direction-inherit>inherit</a></code>".</p>
- </dl>
-
- <p>Objects that implement the <code id=text-styles:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface have attributes (defined
- in this section) that control how text is laid out (rasterised or outlined) by the object. Such
- objects can also have a <dfn id=font-style-source-object>font style source object</dfn>. For
- <code id=text-styles:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects whose <a href=#concept-canvas-context-bitmap-mode id=text-styles:concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed id=text-styles:concept-canvas-fixed>fixed</a>, this is their <code id=text-styles:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element; for other
- <code id=text-styles:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects, if the <a href=#javascript-global-environment id=text-styles:javascript-global-environment>JavaScript global environment</a>
- is a <a href=#document-environment id=text-styles:document-environment>document environment</a>, the object's <a href=#font-style-source-object id=text-styles:font-style-source-object>font style source object</a> is the
- <code id=text-styles:document><a href=#document>Document</a></code> object of the <a href=#active-document id=text-styles:active-document>active document</a> of the <a href=#browsing-context id=text-styles:browsing-context>browsing
- context</a> of the <code id=text-styles:window><a href=#window>Window</a></code> object on which the interface object of the
- <code id=text-styles:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is found; otherwise the <a href=#javascript-global-environment id=text-styles:javascript-global-environment-2>JavaScript global
- environment</a> is a <a href=#worker-environment id=text-styles:worker-environment>worker environment</a> and the <a href=#font-style-source-object id=text-styles:font-style-source-object-2>font style source
- object</a> is the worker. For <code id=text-styles:drawingstyle><a href=#drawingstyle>DrawingStyle</a></code> objects, it's the <a href=#styles-scope-object id=text-styles:styles-scope-object>styles scope
- object</a>.</p>
- <p>The <dfn id=dom-context-2d-font><code>font</code></dfn> IDL attribute, on setting, must
- be parsed the same way as the 'font' property of CSS (but without supporting property-independent
- style sheet syntax like 'inherit'), and the resulting font must be assigned to the context, with
- the 'line-height' component forced to 'normal', with the 'font-size' component converted to CSS
- pixels, and with system fonts being computed to explicit values. If the new value is syntactically
- incorrect (including using property-independent style sheet syntax like 'inherit' or 'initial'),
- then it must be ignored, without assigning a new font value. <a href=#refsCSS>[CSS]</a></p>
- <p>Font family names must be interpreted in the context of the <a href=#font-style-source-object id=text-styles:font-style-source-object-3>font style source
- object</a> when the font is to be used; any fonts embedded using <code>@font-face</code> or loaded using <code id=text-styles:fontface><a href=#fontface>FontFace</a></code> objects that are visible to the
- <a href=#font-style-source-object id=text-styles:font-style-source-object-4>font style source object</a> must therefore be available once they are loaded. (Each <a href=#font-style-source-object id=text-styles:font-style-source-object-5>font style source
- object</a> has a <a id=text-styles:font-source href=http://dev.w3.org/csswg/css-font-loading/#font-source data-x-internal=font-source>font source</a>, which determines what fonts are available.) If a font
- is used before it is fully loaded, or if the <a href=#font-style-source-object id=text-styles:font-style-source-object-6>font style source object</a> does not have
- that font in scope at the time the font is to be used, then it must be treated as if it was an
- unknown font, falling back to another as described by the relevant CSS specifications. <a href=#refsCSSFONTS>[CSSFONTS]</a> <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
- <p>On getting, the <code id=text-styles:dom-context-2d-font-3><a href=#dom-context-2d-font>font</a></code> attribute must return the <a href=#serialising-a-css-value id=text-styles:serialising-a-css-value>serialised form</a> of the current font of the context (with
- no 'line-height' component). <a href=#refsCSSOM>[CSSOM]</a></p>
- <div class=example>
- <p>For example, after the following statement:</p>
- <pre>context.font = 'italic 400 12px/2 Unknown Font, sans-serif';</pre>
- <p>...the expression <code>context.font</code> would evaluate to the string "<code>italic 12px "Unknown Font", sans-serif</code>". The "400"
- font-weight doesn't appear because that is the default value. The line-height doesn't appear
- because it is forced to "normal", the default value.</p>
- </div>
- <p>When the object implementing the <code id=text-styles:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the
- font of the context must be set to 10px sans-serif. When the 'font-size' component is set to
- lengths using percentages, 'em' or 'ex' units, or the 'larger' or 'smaller' keywords, these must
- be interpreted relative to the computed value of the 'font-size' property of the <a href=#font-style-source-object id=text-styles:font-style-source-object-7>font style
- source object</a> at the time that the attribute is set, if it is an element. When the
- 'font-weight' component is set to the relative values 'bolder' and 'lighter', these must be
- interpreted relative to the computed value of the 'font-weight' property of the <a href=#font-style-source-object id=text-styles:font-style-source-object-8>font style
- source object</a> at the time that the attribute is set, if it is an element. If the computed
- values are undefined for a particular case (e.g. because the <a href=#font-style-source-object id=text-styles:font-style-source-object-9>font style source object</a>
- is not an element or is not <a href=#being-rendered id=text-styles:being-rendered>being rendered</a>), then the relative keywords must be
- interpreted relative to the normal-weight 10px sans-serif default.</p>
- <p>The <dfn id=dom-context-2d-textalign><code>textAlign</code></dfn> IDL attribute, on
- getting, must return the current value. On setting, if the value is one of <code id=text-styles:dom-context-2d-textalign-start><a href=#dom-context-2d-textalign-start>start</a></code>, <code id=text-styles:dom-context-2d-textalign-end><a href=#dom-context-2d-textalign-end>end</a></code>, <code id=text-styles:dom-context-2d-textalign-left><a href=#dom-context-2d-textalign-left>left</a></code>, <code id=text-styles:dom-context-2d-textalign-right><a href=#dom-context-2d-textalign-right>right</a></code>, or <code id=text-styles:dom-context-2d-textalign-center><a href=#dom-context-2d-textalign-center>center</a></code>, then the value must be changed to the new
- value. Otherwise, the new value must be ignored. When the object implementing the
- <code id=text-styles:canvasdrawingstyles-3><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code id=text-styles:dom-context-2d-textalign-3><a href=#dom-context-2d-textalign>textAlign</a></code> attribute must initially have the value <code id=text-styles:dom-context-2d-textalign-start-2><a href=#dom-context-2d-textalign-start>start</a></code>.</p>
- <p>The <dfn id=dom-context-2d-textbaseline><code>textBaseline</code></dfn> IDL attribute, on
- getting, must return the current value. On setting, if the value is one of <code id=text-styles:dom-context-2d-textbaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code>, <code id=text-styles:dom-context-2d-textbaseline-hanging><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code>, <code id=text-styles:dom-context-2d-textbaseline-middle><a href=#dom-context-2d-textbaseline-middle>middle</a></code>, <code id=text-styles:dom-context-2d-textbaseline-alphabetic-2><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>, <code id=text-styles:dom-context-2d-textbaseline-ideographic><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code>, or <code id=text-styles:dom-context-2d-textbaseline-bottom><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code>, then the value must be changed to the
- new value. Otherwise, the new value must be ignored. When the object implementing the
- <code id=text-styles:canvasdrawingstyles-4><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code id=text-styles:dom-context-2d-textbaseline-3><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute must initially have the value
- <code id=text-styles:dom-context-2d-textbaseline-alphabetic-3><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code>.</p>
- <p>The <dfn id=dom-context-2d-direction><code>direction</code></dfn> IDL attribute, on
- getting, must return the current value. On setting, if the value is one of "<code id=text-styles:dom-context-2d-direction-ltr><a href=#dom-context-2d-direction-ltr>ltr</a></code>", "<code id=text-styles:dom-context-2d-direction-rtl><a href=#dom-context-2d-direction-rtl>rtl</a></code>", or "<code id=text-styles:dom-context-2d-direction-inherit-2><a href=#dom-context-2d-direction-inherit>inherit</a></code>", then the value must be changed to the
- new value. Otherwise, the new value must be ignored. When the object implementing the
- <code id=text-styles:canvasdrawingstyles-5><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> interface is created, the <code id=text-styles:dom-context-2d-direction-3><a href=#dom-context-2d-direction>direction</a></code> attribute must initially have the value "<code id=text-styles:dom-context-2d-direction-inherit-3><a href=#dom-context-2d-direction-inherit>inherit</a></code>".</p>
-
- <p>The <code id=text-styles:dom-context-2d-textalign-4><a href=#dom-context-2d-textalign>textAlign</a></code> attribute's allowed keywords are
- as follows:</p>
- <dl><dt><dfn id=dom-context-2d-textalign-start><code>start</code></dfn>
- <dd><p>Align to the start edge of the text (left side in left-to-right text, right side in
- right-to-left text).<dt><dfn id=dom-context-2d-textalign-end><code>end</code></dfn>
- <dd><p>Align to the end edge of the text (right side in left-to-right text, left side in
- right-to-left text).<dt><dfn id=dom-context-2d-textalign-left><code>left</code></dfn>
- <dd><p>Align to the left.<dt><dfn id=dom-context-2d-textalign-right><code>right</code></dfn>
- <dd><p>Align to the right.<dt><dfn id=dom-context-2d-textalign-center><code>center</code></dfn>
- <dd><p>Align to the center.</dl>
- <p>The <code id=text-styles:dom-context-2d-textbaseline-4><a href=#dom-context-2d-textbaseline>textBaseline</a></code>
- attribute's allowed keywords correspond to alignment points in the
- font:</p>
- <p><img src=http://images.whatwg.org/baselines.png width=738 alt="The top of the em square is roughly at the top of the glyphs in a font, the hanging baseline is where some glyphs like आ are anchored, the middle is half-way between the top of the em square and the bottom of the em square, the alphabetic baseline is where characters like Á, ÿ, f, and Ω are anchored, the ideographic baseline is where glyphs like 私 and 達 are anchored, and the bottom of the em square is roughly at the bottom of the glyphs in a font. The top and bottom of the bounding box can be far from these baselines, due to glyphs extending far outside the em square." height=300></p>
- <p>The keywords map to these alignment points as follows:</p>
- <dl><dt><dfn id=dom-context-2d-textbaseline-top><code>top</code></dfn>
- <dd>The top of the em square<dt><dfn id=dom-context-2d-textbaseline-hanging><code>hanging</code></dfn>
- <dd>The hanging baseline<dt><dfn id=dom-context-2d-textbaseline-middle><code>middle</code></dfn>
- <dd>The middle of the em square<dt><dfn id=dom-context-2d-textbaseline-alphabetic><code>alphabetic</code></dfn>
- <dd>The alphabetic baseline<dt><dfn id=dom-context-2d-textbaseline-ideographic><code>ideographic</code></dfn>
- <dd>The ideographic baseline<dt><dfn id=dom-context-2d-textbaseline-bottom><code>bottom</code></dfn>
- <dd>The bottom of the em square</dl>
- <p>The <code id=text-styles:dom-context-2d-direction-4><a href=#dom-context-2d-direction>direction</a></code> attribute's allowed keywords are
- as follows:</p>
- <dl><dt><dfn id=dom-context-2d-direction-ltr><code>ltr</code></dfn>
- <dd><p>Treat input to the <a href=#text-preparation-algorithm id=text-styles:text-preparation-algorithm>text preparation algorithm</a> as left-to-right text.<dt><dfn id=dom-context-2d-direction-rtl><code>rtl</code></dfn>
- <dd><p>Treat input to the <a href=#text-preparation-algorithm id=text-styles:text-preparation-algorithm-2>text preparation algorithm</a> as right-to-left text.<dt><dfn id=dom-context-2d-direction-inherit><code>inherit</code></dfn>
- <dd><p>Default to the directionality of the <code id=text-styles:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element or <code id=text-styles:document-2><a href=#document>Document</a></code>
- as appropriate.</dl>
- <p>The <dfn id=text-preparation-algorithm>text preparation algorithm</dfn> is as follows. It takes as input a string <var>text</var>, a <code id=text-styles:canvasdrawingstyles-6><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object <var>target</var>, and an
- optional length <var>maxWidth</var>. It returns an array of glyph shapes, each positioned
- on a common coordinate space, a <var>physical alignment</var> whose value is one of
- <i>left</i>, <i>right</i>, and <i>center</i>, and an inline box. (Most callers of this
- algorithm ignore the <var>physical alignment</var> and the inline box.)</p>
- <ol><li><p>If <var>maxWidth</var> was provided but is less than or equal to zero, return an
- empty array.<li><p>Replace all the <a href=#space-character id=text-styles:space-character>space characters</a> in <var>text</var> with U+0020 SPACE characters.<li><p>Let <var>font</var> be the current font of <var>target</var>, as given
- by that object's <code id=text-styles:dom-context-2d-font-4><a href=#dom-context-2d-font>font</a></code> attribute.<li>
- <p>Apply the appropriate step from the following list to determine the value of <var>direction</var>:</p>
- <dl class=switch><dt>If the <var>target</var> object's <code id=text-styles:dom-context-2d-direction-5><a href=#dom-context-2d-direction>direction</a></code> attribute has the value "<code id=text-styles:dom-context-2d-direction-ltr-2><a href=#dom-context-2d-direction-ltr>ltr</a></code>"<dd>Let <var>direction</var> be '<a href=#concept-ltr id=text-styles:concept-ltr>ltr</a>'.<dt>If the <var>target</var> object's <code id=text-styles:dom-context-2d-direction-6><a href=#dom-context-2d-direction>direction</a></code> attribute has the value "<code id=text-styles:dom-context-2d-direction-rtl-2><a href=#dom-context-2d-direction-rtl>rtl</a></code>"<dd>Let <var>direction</var> be '<a href=#concept-rtl id=text-styles:concept-rtl>rtl</a>'.<dt>If the <var>target</var> object's <a href=#font-style-source-object id=text-styles:font-style-source-object-10>font style source object</a> is an
- element<dd>Let <var>direction</var> be <a href=#the-directionality id=text-styles:the-directionality>the directionality</a> of the <var>target</var> object's <a href=#font-style-source-object id=text-styles:font-style-source-object-11>font style source object</a>.<dt>If the <var>target</var> object's <a href=#font-style-source-object id=text-styles:font-style-source-object-12>font style source object</a> is a
- <code id=text-styles:document-3><a href=#document>Document</a></code> and that <code id=text-styles:document-4><a href=#document>Document</a></code> has a root element child<dd>Let <var>direction</var> be <a href=#the-directionality id=text-styles:the-directionality-2>the directionality</a> of the <var>target</var> object's <a href=#font-style-source-object id=text-styles:font-style-source-object-13>font style source object</a>'s root element child.<dt>Otherwise<dd>Let <var>direction</var> be '<a href=#concept-ltr id=text-styles:concept-ltr-2>ltr</a>'.</dl>
- <li><p>Form a hypothetical infinitely-wide CSS line box containing a single inline box containing
- the text <var>text</var>, with all the properties at their initial values except the
- 'font' property of the inline box set to <var>font</var>, the 'direction' property of
- the inline box set to <var>direction</var>, and the 'white-space' property set to 'pre'.
- <a href=#refsCSS>[CSS]</a><li><p>If <var>maxWidth</var> was provided and the hypothetical width of the inline box
- in the hypothetical line box is greater than <var>maxWidth</var> CSS pixels, then change
- <var>font</var> to have a more condensed font (if one is available or if a reasonably
- readable one can be synthesized by applying a horizontal scale factor to the font) or a smaller
- font, and return to the previous step.<li>
- <p>The <var>anchor point</var> is a point on the inline box, and the <var>physical alignment</var> is one of the values <i>left</i>, <i>right</i>, and <i>center</i>. These variables are determined by the <code id=text-styles:dom-context-2d-textalign-5><a href=#dom-context-2d-textalign>textAlign</a></code> and <code id=text-styles:dom-context-2d-textbaseline-5><a href=#dom-context-2d-textbaseline>textBaseline</a></code> values as follows:</p>
- <p>Horizontal position:</p>
- <dl><dt>If <code id=text-styles:dom-context-2d-textalign-6><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-left-2><a href=#dom-context-2d-textalign-left>left</a></code><dt>If <code id=text-styles:dom-context-2d-textalign-7><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-start-3><a href=#dom-context-2d-textalign-start>start</a></code> and <var>direction</var> is
- 'ltr'<dt>If <code id=text-styles:dom-context-2d-textalign-8><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-end-2><a href=#dom-context-2d-textalign-end>end</a></code> and <var>direction</var> is 'rtl'<dd>Let the <var>anchor point</var>'s horizontal position be the left edge of the
- inline box, and let <var>physical alignment</var> be <i>left</i>.<dt>If <code id=text-styles:dom-context-2d-textalign-9><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-right-2><a href=#dom-context-2d-textalign-right>right</a></code><dt>If <code id=text-styles:dom-context-2d-textalign-10><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-end-3><a href=#dom-context-2d-textalign-end>end</a></code> and <var>direction</var> is 'ltr'<dt>If <code id=text-styles:dom-context-2d-textalign-11><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-start-4><a href=#dom-context-2d-textalign-start>start</a></code> and <var>direction</var> is
- 'rtl'<dd>Let the <var>anchor point</var>'s horizontal position be the right edge of the
- inline box, and let <var>physical alignment</var> be <i>right</i>.<dt>If <code id=text-styles:dom-context-2d-textalign-12><a href=#dom-context-2d-textalign>textAlign</a></code> is <code id=text-styles:dom-context-2d-textalign-center-2><a href=#dom-context-2d-textalign-center>center</a></code><dd>Let the <var>anchor point</var>'s horizontal position be half way between the left
- and right edges of the inline box, and let <var>physical alignment</var> be <i>center</i>.</dl>
- <p>Vertical position:</p>
- <dl><dt>If <code id=text-styles:dom-context-2d-textbaseline-6><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-top-2><a href=#dom-context-2d-textbaseline-top>top</a></code><dd>Let the <var>anchor point</var>'s vertical position be the top of the em box of
- the first available font of the inline box.<dt>If <code id=text-styles:dom-context-2d-textbaseline-7><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-hanging-2><a href=#dom-context-2d-textbaseline-hanging>hanging</a></code><dd>Let the <var>anchor point</var>'s vertical position be the hanging baseline of the
- first available font of the inline box.<dt>If <code id=text-styles:dom-context-2d-textbaseline-8><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-middle-2><a href=#dom-context-2d-textbaseline-middle>middle</a></code><dd>Let the <var>anchor point</var>'s vertical position be half way between the bottom
- and the top of the em box of the first available font of the inline box.<dt>If <code id=text-styles:dom-context-2d-textbaseline-9><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-alphabetic-4><a href=#dom-context-2d-textbaseline-alphabetic>alphabetic</a></code><dd>Let the <var>anchor point</var>'s vertical position be the alphabetic baseline of
- the first available font of the inline box.<dt>If <code id=text-styles:dom-context-2d-textbaseline-10><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-ideographic-2><a href=#dom-context-2d-textbaseline-ideographic>ideographic</a></code><dd>Let the <var>anchor point</var>'s vertical position be the ideographic baseline of
- the first available font of the inline box.<dt>If <code id=text-styles:dom-context-2d-textbaseline-11><a href=#dom-context-2d-textbaseline>textBaseline</a></code> is <code id=text-styles:dom-context-2d-textbaseline-bottom-2><a href=#dom-context-2d-textbaseline-bottom>bottom</a></code><dd>Let the <var>anchor point</var>'s vertical position be the bottom of the em box of
- the first available font of the inline box.</dl>
- <li>
- <p>Let <var>result</var> be an array constructed by iterating over each glyph in the
- inline box from left to right (if any), adding to the array, for each glyph, the shape of the
- glyph as it is in the inline box, positioned on a coordinate space using CSS pixels with its
- origin is at the <var>anchor point</var>.</p>
- <li><p>Return <var>result</var>, <var>physical alignment</var>, and the inline
- box.</ol>
- <h6 id=building-paths>4.12.4.2.6 Building paths</h6>
- <p>Each object implementing the <code id=building-paths:canvaspathmethods><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface has a <a href=#concept-path id=building-paths:concept-path>path</a>. A <dfn id=concept-path>path</dfn> has a list of zero or
- more subpaths. Each subpath consists of a list of one or more points, connected by straight or
- curved <dfn id=line-segments>line segments</dfn>, and a flag indicating whether the subpath is closed or not. A
- closed subpath is one where the last point of the subpath is connected to the first point of the
- subpath by a straight line. Subpaths with only one point are ignored when painting the path.</p>
- <p><a href=#concept-path id=building-paths:concept-path-2>Paths</a> have a <dfn id=need-new-subpath>need new subpath</dfn> flag. When this
- flag is set, certain APIs create a new subpath rather than extending the previous one. When a
- <a href=#concept-path id=building-paths:concept-path-3>path</a> is created, its <a href=#need-new-subpath id=building-paths:need-new-subpath>need new subpath</a> flag must be
- set.</p>
- <p>When an object implementing the <code id=building-paths:canvaspathmethods-2><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface is created, its <a href=#concept-path id=building-paths:concept-path-4>path</a> must be initialised to zero subpaths.</p>
- <dl class=domintro><dt><var>context</var> . <code id=building-paths:dom-context-2d-moveto><a href=#dom-context-2d-moveto>moveTo</a></code>(<var>x</var>, <var>y</var>)<dt><var>path</var> . <code id=building-paths:dom-context-2d-moveto-2><a href=#dom-context-2d-moveto>moveTo</a></code>(<var>x</var>, <var>y</var>)<dd>
- <p>Creates a new subpath with the given point.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-closepath><a href=#dom-context-2d-closepath>closePath</a></code>()<dt><var>path</var> . <code id=building-paths:dom-context-2d-closepath-2><a href=#dom-context-2d-closepath>closePath</a></code>()<dd>
- <p>Marks the current subpath as closed, and starts a new subpath with a point the same as the
- start and end of the newly closed subpath.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-lineto><a href=#dom-context-2d-lineto>lineTo</a></code>(<var>x</var>, <var>y</var>)<dt><var>path</var> . <code id=building-paths:dom-context-2d-lineto-2><a href=#dom-context-2d-lineto>lineTo</a></code>(<var>x</var>, <var>y</var>)<dd>
- <p>Adds the given point to the current subpath, connected to the previous one by a straight
- line.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-quadraticcurveto><a href=#dom-context-2d-quadraticcurveto>quadraticCurveTo</a></code>(<var>cpx</var>, <var>cpy</var>, <var>x</var>, <var>y</var>)<dt><var>path</var> . <code id=building-paths:dom-context-2d-quadraticcurveto-2><a href=#dom-context-2d-quadraticcurveto>quadraticCurveTo</a></code>(<var>cpx</var>, <var>cpy</var>, <var>x</var>, <var>y</var>)<dd>
- <p>Adds the given point to the current subpath, connected to the previous one by a quadratic
- Bézier curve with the given control point.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-beziercurveto><a href=#dom-context-2d-beziercurveto>bezierCurveTo</a></code>(<var>cp1x</var>, <var>cp1y</var>, <var>cp2x</var>, <var>cp2y</var>, <var>x</var>, <var>y</var>)<dt><var>path</var> . <code id=building-paths:dom-context-2d-beziercurveto-2><a href=#dom-context-2d-beziercurveto>bezierCurveTo</a></code>(<var>cp1x</var>, <var>cp1y</var>, <var>cp2x</var>, <var>cp2y</var>, <var>x</var>, <var>y</var>)<dd>
- <p>Adds the given point to the current subpath, connected to the previous one by a cubic
- Bézier curve with the given control points.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-arcto><a href=#dom-context-2d-arcto>arcTo</a></code>(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>radiusX</var> [, <var>radiusY</var>, <var>rotation</var> ] )<dt><var>path</var> . <code id=building-paths:dom-context-2d-arcto-2><a href=#dom-context-2d-arcto>arcTo</a></code>(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>radiusX</var> [, <var>radiusY</var>, <var>rotation</var> ] )<dd>
- <p>Adds an arc with the given control points and radius to the current subpath, connected to the
- previous point by a straight line.</p>
- <p>If two radii are provided, the first controls the width of the arc's ellipse, and the second
- controls the height. If only one is provided, or if they are the same, the arc is from a circle.
- In the case of an ellipse, the rotation argument controls the clockwise inclination of the
- ellipse relative to the x-axis.</p>
- <p>Throws an <code id=building-paths:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
- <figure class=diagrams>
-
- <img width=357 src=http://images.whatwg.org/arcTo1.png height=254 alt="">
- <img width=468 src=http://images.whatwg.org/arcTo2.png height=310 alt="">
- <img width=513 src=http://images.whatwg.org/arcTo3.png height=233 alt="">
- </figure>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-arc><a href=#dom-context-2d-arc>arc</a></code>(<var>x</var>, <var>y</var>, <var>radius</var>, <var>startAngle</var>, <var>endAngle</var> [, <var>anticlockwise</var> ] )<dt><var>path</var> . <code id=building-paths:dom-context-2d-arc-2><a href=#dom-context-2d-arc>arc</a></code>(<var>x</var>, <var>y</var>, <var>radius</var>, <var>startAngle</var>, <var>endAngle</var> [, <var>anticlockwise</var> ] )<dd>
- <p>Adds points to the subpath such that the arc described by the circumference of the circle
- described by the arguments, starting at the given start angle and ending at the given end angle,
- going in the given direction (defaulting to clockwise), is added to the path, connected to the
- previous point by a straight line.</p>
- <p>Throws an <code id=building-paths:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
- <figure class=diagrams>
-
- <img width=590 src=http://images.whatwg.org/arc1.png height=255 alt="">
- </figure>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-ellipse><a href=#dom-context-2d-ellipse>ellipse</a></code>(<var>x</var>, <var>y</var>, <var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>, <var>endAngle</var> [, <var>anticlockwise</var>] )<dt><var>path</var> . <code id=building-paths:dom-context-2d-ellipse-2><a href=#dom-context-2d-ellipse>ellipse</a></code>(<var>x</var>, <var>y</var>, <var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>, <var>endAngle</var> [, <var>anticlockwise</var>] )<dd>
- <p>Adds points to the subpath such that the arc described by the circumference of the ellipse
- described by the arguments, starting at the given start angle and ending at the given end angle,
- going in the given direction (defaulting to clockwise), is added to the path, connected to the
- previous point by a straight line.</p>
- <p>Throws an <code id=building-paths:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given radius is negative.</p>
- <dt><var>context</var> . <code id=building-paths:dom-context-2d-rect><a href=#dom-context-2d-rect>rect</a></code>(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)<dt><var>path</var> . <code id=building-paths:dom-context-2d-rect-2><a href=#dom-context-2d-rect>rect</a></code>(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)<dd>
- <p>Adds a new closed subpath to the path, representing the given rectangle.</p>
- </dl>
-
- <p>The following methods allow authors to manipulate the <a href=#concept-path id=building-paths:concept-path-5>paths</a>
- of objects implementing the <code id=building-paths:canvaspathmethods-3><a href=#canvaspathmethods>CanvasPathMethods</a></code> interface.</p>
- <p>For <code id=building-paths:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects, the points passed to the methods, and the
- resulting lines added to <a href=#current-default-path id=building-paths:current-default-path>current default path</a> by these methods, must be transformed
- according to the <a href=#transformations id=building-paths:transformations>current transformation matrix</a>
- before being added to the path.</p>
- <p>The <dfn id=dom-context-2d-moveto><code>moveTo(<var>x</var>, <var>y</var>)</code></dfn> method must create a new subpath with the specified point as its
- first (and only) point.</p>
- <p>When the user agent is to <dfn id=ensure-there-is-a-subpath>ensure there is a subpath</dfn> for a coordinate (<var>x</var>, <var>y</var>) on a <a href=#concept-path id=building-paths:concept-path-6>path</a>, the user
- agent must check to see if the <a href=#concept-path id=building-paths:concept-path-7>path</a> has its <a href=#need-new-subpath id=building-paths:need-new-subpath-2>need new
- subpath</a> flag set. If it does, the user agent must create a new subpath with the point (<var>x</var>, <var>y</var>) as its first (and only) point, as if the <code id=building-paths:dom-context-2d-moveto-3><a href=#dom-context-2d-moveto>moveTo()</a></code> method had been called, and must then unset the
- <a href=#concept-path id=building-paths:concept-path-8>path</a>'s <a href=#need-new-subpath id=building-paths:need-new-subpath-3>need new subpath</a> flag.</p>
- <p>The <dfn id=dom-context-2d-closepath><code>closePath()</code></dfn> method must do nothing
- if the object's path has no subpaths. Otherwise, it must mark the last subpath as closed, create a
- new subpath whose first point is the same as the previous subpath's first point, and finally add
- this new subpath to the path.</p>
- <p class=note>If the last subpath had more than one point in its list of points, then this is
- equivalent to adding a straight line connecting the last point back to the first point, thus
- "closing" the shape, and then repeating the last (possibly implied) <code id=building-paths:dom-context-2d-moveto-4><a href=#dom-context-2d-moveto>moveTo()</a></code> call.</p>
- <p>New points and the lines connecting them are added to subpaths using the methods described
- below. In all cases, the methods only modify the last subpath in the object's path.</p>
- <p>The <dfn id=dom-context-2d-lineto><code>lineTo(<var>x</var>, <var>y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath id=building-paths:ensure-there-is-a-subpath>ensure there is a subpath</a> for <span>(<var>x</var>, <var>y</var>)</span> if the object's path has no
- subpaths. Otherwise, it must connect the last point in the subpath to the given point (<var>x</var>, <var>y</var>) using a straight line, and must then add the given point
- (<var>x</var>, <var>y</var>) to the subpath.</p>
- <p>The <dfn id=dom-context-2d-quadraticcurveto><code>quadraticCurveTo(<var>cpx</var>, <var>cpy</var>, <var>x</var>, <var>y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath id=building-paths:ensure-there-is-a-subpath-2>ensure there is a subpath</a> for <span>(<var>cpx</var>, <var>cpy</var>)</span>, and then must connect the last
- point in the subpath to the given point (<var>x</var>, <var>y</var>) using a
- quadratic Bézier curve with control point (<var>cpx</var>, <var>cpy</var>), and must then add the given point (<var>x</var>, <var>y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>
- <p>The <dfn id=dom-context-2d-beziercurveto><code>bezierCurveTo(<var>cp1x</var>,
- <var>cp1y</var>, <var>cp2x</var>, <var>cp2y</var>, <var>x</var>, <var>y</var>)</code></dfn> method must <a href=#ensure-there-is-a-subpath id=building-paths:ensure-there-is-a-subpath-3>ensure there is a
- subpath</a> for <span>(<var>cp1x</var>, <var>cp1y</var>)</span>, and
- then must connect the last point in the subpath to the given point (<var>x</var>, <var>y</var>) using a cubic Bézier curve with control points (<var>cp1x</var>,
- <var>cp1y</var>) and (<var>cp2x</var>, <var>cp2y</var>). Then, it must
- add the point (<var>x</var>, <var>y</var>) to the subpath. <a href=#refsBEZIER>[BEZIER]</a></p>
- <hr>
- <p>The <dfn id=dom-context-2d-arcto><code>arcTo(<var>x1</var>, <var>y1</var>, <var>x2</var>, <var>y2</var>, <var>radiusX</var>,
- <var>radiusY</var>, <var>rotation</var>)</code></dfn> method must first
- <a href=#ensure-there-is-a-subpath id=building-paths:ensure-there-is-a-subpath-4>ensure there is a subpath</a> for <span>(<var>x1</var>, <var>y1</var>)</span>. Then, the behavior depends on the arguments and the last point in the
- subpath, as described below.</p>
- <p>Negative values for <var>radiusX</var> or <var>radiusY</var> must cause the
- implementation to throw an <code id=building-paths:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception. If <var>radiusY</var>
- is omitted, user agents must act as if it had the same value as <var>radiusX</var>.</p>
- <p>Let the point (<var>x0</var>, <var>y0</var>) be the last point in the
- subpath, transformed by the inverse of the <a href=#transformations id=building-paths:transformations-2>current
- transformation matrix</a> (so that it is in the same coordinate system as the points passed to
- the method).</p>
- <p>If the point (<var>x0</var>, <var>y0</var>) is equal to the point (<var>x1</var>, <var>y1</var>), or if the point (<var>x1</var>, <var>y1</var>) is equal to the point (<var>x2</var>, <var>y2</var>), or if
- both <var>radiusX</var> and <var>radiusY</var> are zero, then the method must
- add the point (<var>x1</var>, <var>y1</var>) to the subpath, and connect that
- point to the previous point (<var>x0</var>, <var>y0</var>) by a straight
- line.</p>
- <p>Otherwise, if the points (<var>x0</var>, <var>y0</var>), (<var>x1</var>, <var>y1</var>), and (<var>x2</var>, <var>y2</var>)
- all lie on a single straight line, then the method must add the point (<var>x1</var>,
- <var>y1</var>) to the subpath, and connect that point to the previous point (<var>x0</var>, <var>y0</var>) by a straight line.</p>
- <p>Otherwise, let <var>The Arc</var> be the shortest arc given by circumference of the
- ellipse that has radius <var>radiusX</var> on the major axis and radius <var>radiusY</var> on the minor axis, and whose semi-major axis is rotated <var>rotation</var> radians clockwise from the positive x-axis, and that has one point tangent
- to the half-infinite line that crosses the point (<var>x0</var>, <var>y0</var>)
- and ends at the point (<var>x1</var>, <var>y1</var>), and that has a different
- point tangent to the half-infinite line that ends at the point (<var>x1</var>, <var>y1</var>) and crosses the point (<var>x2</var>, <var>y2</var>). The
- points at which this ellipse touches these two lines are called the start and end tangent points
- respectively. The method must connect the point (<var>x0</var>, <var>y0</var>)
- to the start tangent point by a straight line, adding the start tangent point to the subpath, and
- then must connect the start tangent point to the end tangent point by <var>The Arc</var>,
- adding the end tangent point to the subpath.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-arc><code>arc(<var>x</var>, <var>y</var>,
- <var>radius</var>, <var>startAngle</var>, <var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> and <dfn id=dom-context-2d-ellipse><code>ellipse(<var>x</var>, <var>y</var>, <var>radiusX</var>, <var>radiusY</var>, <var>rotation</var>, <var>startAngle</var>, <var>endAngle</var>, <var>anticlockwise</var>)</code></dfn> methods draw arcs.</p>
- <p>The <code id=building-paths:dom-context-2d-arc-3><a href=#dom-context-2d-arc>arc()</a></code> method is equivalent to the <code id=building-paths:dom-context-2d-ellipse-3><a href=#dom-context-2d-ellipse>ellipse()</a></code> method in the case where the two radii are equal.
- When the <code id=building-paths:dom-context-2d-arc-4><a href=#dom-context-2d-arc>arc()</a></code> method is invoked, it must act as if the
- <code id=building-paths:dom-context-2d-ellipse-4><a href=#dom-context-2d-ellipse>ellipse()</a></code> method had been invoked with the <var>radiusX</var> and <var>radiusY</var> arguments set to the value of the <var>radius</var> argument, the <var>rotation</var> argument set to zero, and the
- other arguments set to the same values as their identically named arguments on the <code id=building-paths:dom-context-2d-arc-5><a href=#dom-context-2d-arc>arc()</a></code> method.</p>
- <p>When the <code id=building-paths:dom-context-2d-ellipse-5><a href=#dom-context-2d-ellipse>ellipse()</a></code> method is invoked, it must
- proceed as follows. First, if the object's path has any subpaths, then the method must add a
- straight line from the last point in the subpath to the start point of the arc. Then, it must add
- the start and end points of the arc to the subpath, and connect them with an arc. The arc and its
- start and end points are defined as follows:</p>
- <p>Consider an ellipse that has its origin at (<var>x</var>, <var>y</var>), that
- has a major-axis radius <var>radiusX</var> and a minor-axis radius <var>radiusY</var>, and that is rotated about its origin such that its semi-major axis is
- inclined <var>rotation</var> radians clockwise from the x-axis.</p>
- <p>If the <var>anticlockwise</var> argument is false and <span><var>endAngle</var>-<var>startAngle</var></span> is equal to or greater than <span>2π</span>, or, if the <var>anticlockwise</var> argument is <em>true</em>
- and <span><var>startAngle</var>-<var>endAngle</var></span> is equal
- to or greater than <span>2π</span>, then the arc is the whole circumference of this
- ellipse, and the point at <var>startAngle</var> along this circle's circumference,
- measured in radians clockwise from the ellipse's semi-major axis, acts as both the start point and
- the end point.</p>
- <p>Otherwise, the points at <var>startAngle</var> and <var>endAngle</var>
- along this circle's circumference, measured in radians clockwise from the ellipse's semi-major
- axis, are the start and end points respectively, and the arc is the path along the circumference
- of this ellipse from the start point to the end point, going anti-clockwise if the <var>anticlockwise</var> argument is true, and clockwise otherwise. Since the points are on
- the ellipse, as opposed to being simply angles from zero, the arc can never cover an angle greater
- than <span>2π</span> radians.</p>
- <p class=note>Even if the arc covers the entire circumference of the ellipse and there are no
- other points in the subpath, the path is not closed unless the <code id=building-paths:dom-context-2d-closepath-3><a href=#dom-context-2d-closepath>closePath()</a></code> method is appropriately invoked.</p>
- <p>Negative values for <var>radiusX</var> or <var>radiusY</var> must cause the
- implementation to throw an <code id=building-paths:indexsizeerror-5><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-rect><code>rect(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)</code></dfn> method must create
- a new subpath containing just the four points (<var>x</var>, <var>y</var>),
- (<var>x</var>+<var>w</var>, <var>y</var>), (<var>x</var>+<var>w</var>, <var>y</var>+<var>h</var>), (<var>x</var>, <var>y</var>+<var>h</var>), in that order, with those four
- points connected by straight lines, and must then mark the subpath as closed. It must then create
- a new subpath with the point (<var>x</var>, <var>y</var>) as the only point in
- the subpath.</p>
-
-
- <h6 id=path2d-objects>4.12.4.2.7 <code id=path2d-objects:path2d><a href=#path2d>Path2D</a></code> objects</h6>
- <p><code id=path2d-objects:path2d-2><a href=#path2d>Path2D</a></code> objects can be used to declare paths that are then later used on
- <code id=path2d-objects:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects. In addition to many of the APIs described in
- earlier sections, <code id=path2d-objects:path2d-3><a href=#path2d>Path2D</a></code> objects have methods to combine paths, and to add text to
- paths.</p>
- <dl class=domintro><dt><var>path</var> = new <code id=path2d-objects:dom-path2d><a href=#dom-path2d>Path2D</a></code>()<dd>
- <p>Creates a new empty <code id=path2d-objects:path2d-4><a href=#path2d>Path2D</a></code> object.</p>
- <dt><var>path</var> = new <code id=path2d-objects:dom-path2d-copy><a href=#dom-path2d-copy>Path2D</a></code>(<var>path</var>)<dd>
- <p>Creates a new <code id=path2d-objects:path2d-5><a href=#path2d>Path2D</a></code> object that is a copy of the argument.</p>
- <dt><var>path</var> = new <code id=path2d-objects:dom-path2d-merge><a href=#dom-path2d-merge>Path2D</a></code>(<var>paths</var> [, <var>fillRule</var> ] )<dd>
- <p>Creates a new <code id=path2d-objects:path2d-6><a href=#path2d>Path2D</a></code> object that describes a path that outlines the given <var>paths</var>, using the given fill rule.</p>
- <dt><var>path</var> = new <code id=path2d-objects:dom-path2d-withdata><a href=#dom-path2d-withdata>Path2D</a></code>(<var>d</var>)<dd>
- <p>Creates a new path with the path described by the argument, interpreted as SVG path data. <a href=#refsSVG>[SVG]</a></p>
- <dt><var>path</var> . <code id=path2d-objects:dom-path2d-addpath><a href=#dom-path2d-addpath>addPath</a></code>(<var>path</var> [, <var>transform</var> ] )<dt><var>path</var> . <code id=path2d-objects:dom-path2d-addpathbystrokingpath><a href=#dom-path2d-addpathbystrokingpath>addPathByStrokingPath</a></code>(<var>path</var>, <var>styles</var> [, <var>transform</var> ] )<dd>
- <p>Adds to the path the path given by the argument.</p>
- <p>In the case of the stroking variants, the line styles are taken from the <var>styles</var> argument, which can be either a <code id=path2d-objects:drawingstyle><a href=#drawingstyle>DrawingStyle</a></code> object or a
- <code id=path2d-objects:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>
- <dt><var>path</var> . <code id=path2d-objects:dom-path2d-addtext><a href=#dom-path2d-addtext>addText</a></code>(<var>text</var>, <var>styles</var>, <var>transform</var>, <var>x</var>, <var>y</var> [, <var>maxWidth</var> ] )<dt><var>path</var> . <code id=path2d-objects:dom-path2d-addtext-2><a href=#dom-path2d-addtext>addText</a></code>(<var>text</var>, <var>styles</var>, <var>transform</var>, <var>path</var> [, <var>maxWidth</var> ] )<dt><var>path</var> . <code id=path2d-objects:dom-path2d-addpathbystrokingtext><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText</a></code>(<var>text</var>, <var>styles</var>, <var>transform</var>, <var>x</var>, <var>y</var> [, <var>maxWidth</var> ] )<dt><var>path</var> . <code id=path2d-objects:dom-path2d-addpathbystrokingtext-2><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText</a></code>(<var>text</var>, <var>styles</var>, <var>transform</var>, <var>path</var> [, <var>maxWidth</var> ] )<dd>
- <p>Adds to the path a series of subpaths corresponding to the given text. If the arguments give
- a coordinate, the text is drawn horizontally at the given coordinates. If the arguments give a
- path, the text is drawn along the path. If a maximum width is provided, the text will be scaled
- to fit that width if necessary.</p>
- <p>The font, and in the case of the stroking variants, the line styles, are taken from the <var>styles</var> argument, which can be either a <code id=path2d-objects:drawingstyle-2><a href=#drawingstyle>DrawingStyle</a></code> object or a
- <code id=path2d-objects:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object.</p>
- </dl>
-
- <p>The <dfn id=dom-path2d><code>Path2D()</code></dfn> constructor, when invoked, must return a
- newly created <code id=path2d-objects:path2d-7><a href=#path2d>Path2D</a></code> object.</p>
- <hr>
- <p>The <dfn id=dom-path2d-copy><code>Path2D(<var>path</var>)</code></dfn>
- constructor, when invoked, must return a newly created <code id=path2d-objects:path2d-8><a href=#path2d>Path2D</a></code> object, to which the
- subpaths of the argument are added. (In other words, it returns a copy of the argument.)</p>
- <hr>
- <p>The <dfn id=dom-path2d-merge><code>Path2D(<var>paths</var>, <var>fillRule</var>)</code></dfn> constructor, when invoked, must run the following
- steps:</p>
- <ol><li>
- <p>Run the appropriate step from the following list, based on the constructor's sectond
- argument:</p>
- <dl class=switch><dt>If it is "nonzero"<dd>
- <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path>path</a> that
- consists of a set of non-overlapping subpaths that exactly outline the points from which, in
- any of the <a href=#concept-path id=path2d-objects:concept-path-2>paths</a> provided in the constructor's first
- argument, the number of times a half-infinite straight line drawn from that point crosses a
- subpath going in one direction is not equal to the number of times it crosses a subpath going
- in the other direction.</p>
- <dt>If it is "evenodd"<dd>
- <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-3>path</a> that
- consists of a set of non-overlapping subpaths that exactly outline the points from which, in
- any of the <a href=#concept-path id=path2d-objects:concept-path-4>paths</a> provided in the constructor's first
- argument, the number of times a half-infinite straight line drawn from that point crosses that
- path is odd.</p>
- </dl>
- <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
- the number of times a half-infinite straight line drawn from that point crosses a subpath is
- even if and only if the number of times a half-infinite straight line drawn from that same point
- crosses a subpath going in one direction is equal to the number of times it crosses a subpath
- going in the other direction.</p>
- <li><p>Add all the subpaths in <var>merged path</var> to the <code id=path2d-objects:path2d-9><a href=#path2d>Path2D</a></code>
- object.<li><p>Set the <code id=path2d-objects:path2d-10><a href=#path2d>Path2D</a></code> object's <a href=#need-new-subpath id=path2d-objects:need-new-subpath>need new subpath</a> flag.</ol>
- <hr>
- <p>The <dfn id=dom-path2d-withdata><code>Path2D(<var>d</var>)</code></dfn>
- constructor must run the following steps:</p>
- <ol><li>
- <p>Parse and interpret the <var>d</var> argument according to the SVG specification's
- rules for path data, thus obtaining an SVG path. <a href=#refsSVG>[SVG]</a></p>
- <p class=note>The resulting path could be empty. SVG defines error handling rules for parsing
- and applying path data.</p>
- <li><p>Let (<var>x</var>, <var>y</var>) be the last point in the SVG
- path.<li><p>Create a new <code id=path2d-objects:path2d-11><a href=#path2d>Path2D</a></code> object and add all the subpaths in the SVG path, if any,
- to that <code id=path2d-objects:path2d-12><a href=#path2d>Path2D</a></code> object. </p>
- <li><p>Create a new subpath in the <code id=path2d-objects:path2d-13><a href=#path2d>Path2D</a></code> object with (<var>x</var>, <var>y</var>) as the only point in the subpath.<li><p>Return the <code id=path2d-objects:path2d-14><a href=#path2d>Path2D</a></code> object as the constructed object.</ol>
- <hr>
- <p>The <dfn id=dom-path2d-addpath><code>addPath(<var>b</var>, <var>transform</var>)</code></dfn> method, when invoked on a <code id=path2d-objects:path2d-15><a href=#path2d>Path2D</a></code> object <var>a</var>, must run the following steps:</p>
- <ol><li><p>If the <code id=path2d-objects:path2d-16><a href=#path2d>Path2D</a></code> object <var>b</var> has no subpaths, abort these
- steps.<li><p>Create a copy of all the subpaths in <var>b</var>. Let this copy be known as <var>c</var>.<li><p>Transform all the coordinates and lines in <var>c</var> by the transform matrix
- <var>transform</var>, if it is not null.<li><p>Let (<var>x</var>, <var>y</var>) be the last point in the last subpath
- of <var>c</var>.<li><p>Add all the subpaths in <var>c</var> to <var>a</var>.<li><p>Create a new subpath in <var>a</var> with (<var>x</var>, <var>y</var>) as the only point in the subpath.</ol>
- <hr>
- <p>The <dfn id=dom-path2d-addpathbystrokingpath><code>addPathByStrokingPath(<var>b</var>, <var>styles</var>, <var>transform</var>)</code></dfn>
- method, when invoked on a <code id=path2d-objects:path2d-17><a href=#path2d>Path2D</a></code> object <var>a</var>, must run the
- following steps:</p>
- <ol><li><p>If the <code id=path2d-objects:path2d-18><a href=#path2d>Path2D</a></code> object <var>b</var> has no subpaths, abort these
- steps.<li><p>Create a copy of all the subpaths in <var>b</var>. Let this copy be known as <var>c</var>.<li><p>Transform all the coordinates and lines in <var>c</var> by transformation matrix
- <var>transform</var>, if it is not null.<li><p>Let a new list of subpaths <var>d</var> be the result of <a href=#trace-a-path id=path2d-objects:trace-a-path>tracing</a> <var>c</var>, using the <var>styles</var> argument for the
- line styles.</p>
- <li><p>Let (<var>x</var>, <var>y</var>) be the last point in the last subpath
- of <var>d</var>.<li><p>Add all the subpaths in <var>d</var> to <var>a</var>.<li><p>Create a new subpath in <var>a</var> with (<var>x</var>, <var>y</var>) as the only point in the subpath.</ol>
- <hr>
- <p>The <dfn id=dom-path2d-addtext><code>addText()</code></dfn> and <dfn id=dom-path2d-addpathbystrokingtext><code>addPathByStrokingText()</code></dfn> methods each
- come in two variants: one rendering text at a given coordinate, and one rendering text along a
- given path. In both cases, the methods take a <code id=path2d-objects:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for
- the text and (if appropriate) line styles to use, an <code id=path2d-objects:svgmatrix><a href=#svgmatrix>SVGMatrix</a></code> object <var>transform</var> (which can be null), and a maximum width can optionally be provided.</p>
- <p>When one of the <code id=path2d-objects:dom-path2d-addtext-3><a href=#dom-path2d-addtext>addText()</a></code> and <code id=path2d-objects:dom-path2d-addpathbystrokingtext-3><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText()</a></code> variants that take as
- argument an (<var>x</var>, <var>y</var>) coordinate is invoked, the method
- must run the following algorithm:</p>
- <ol><li><p>Run the <a href=#text-preparation-algorithm id=path2d-objects:text-preparation-algorithm>text preparation algorithm</a>, passing it <var>text</var>, the
- <code id=path2d-objects:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var>maxWidth</var>
- argument was provided, that argument. Let <var>glyphs</var> be the result.</p>
- <li><p>Move all the shapes in <var>glyphs</var> to the right by <var>x</var>
- CSS pixels and down by <var>y</var> CSS pixels.<li><p>Let <var>glyph paths</var> be a list of <a href=#concept-path id=path2d-objects:concept-path-5>paths</a>
- describing the shapes given in <var>glyphs</var>, with each CSS pixel in the coordinate
- space of <var>glyphs</var> mapped to one coordinate space unit in <var>glyph
- paths</var>. Subpaths in <var>glyph paths</var> must wind clockwise, regardless of how
- the user agent's font subsystem renders fonts and regardless of how the fonts themselves are
- defined.</p>
- <li><p>Transform all the coordinates and lines in <var>glyph paths</var> by the
- transformation matrix <var>transform</var>, if it is not null.<li><p>If the method is <code id=path2d-objects:dom-path2d-addpathbystrokingtext-4><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText()</a></code>, replace <var>glyph paths</var> by the result of <a href=#trace-a-path id=path2d-objects:trace-a-path-2>tracing</a> each
- <a href=#concept-path id=path2d-objects:concept-path-6>path</a> in <var>glyph paths</var>, using the
- <code id=path2d-objects:canvasdrawingstyles-3><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for the line styles.</p>
- <li id=mergeGlyphs>
- <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-7>path</a> that
- consists of a set of non-overlapping subpaths that exactly outline the points from which, in any
- of the <a href=#concept-path id=path2d-objects:concept-path-8>paths</a> in <var>glyph paths</var>, the number
- of times a half-infinite straight line drawn from that point crosses that path is odd.</p>
- <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
- the number of times a half-infinite straight line drawn from that point crosses a subpath is
- even if and only if the number of times a half-infinite straight line drawn from that same point
- crosses a subpath going in one direction is equal to the number of times it crosses a subpath
- going in the other direction.</p>
- <div class=example>
- <p>For example, suppose <var>text</var> consists of two overlapping glyphs "Q" and
- "p" (maybe the "Q" has a flourish that crosses into the tail of the "p"). The <var>glyph paths</var> therefore consist of two paths, each with two subpaths: one for the
- outside of the letter shape, and one for the inside of the letter shape. There are points that,
- according to the even-odd fill rule, are filled in both shapes simultaneously: where they
- overlap. As such, the subpaths from the two glyphs actually cross each other.</p>
- <p><img src=http://images.whatwg.org/Qp-overlap.png alt=""></p>
-
- <p>The resulting <var>merged path</var> in such a situation would have just one path
- for these two letters, with a total of just three subpaths (one big outer outline, one for the
- inside of the "Q", and one for inside of the "p"). This single path would have no subpaths that
- cross each other.</p>
- <p><img src=http://images.whatwg.org/Qp-overlap-outline.png alt=""></p>
-
- </div>
- <li><p>Add all the subpaths in <var>merged path</var> to the <code id=path2d-objects:path2d-19><a href=#path2d>Path2D</a></code>
- object.<li><p>Set the <code id=path2d-objects:path2d-20><a href=#path2d>Path2D</a></code> object's <a href=#need-new-subpath id=path2d-objects:need-new-subpath-2>need new subpath</a> flag.</ol>
- <p>When one of the <code id=path2d-objects:dom-path2d-addtext-4><a href=#dom-path2d-addtext>addText()</a></code> and <code id=path2d-objects:dom-path2d-addpathbystrokingtext-5><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText()</a></code> variants that take as
- argument a <code id=path2d-objects:path2d-21><a href=#path2d>Path2D</a></code> object is invoked, the method must run the following algorithm:</p>
- <ol><li><p>Let <var>target</var> be the <code id=path2d-objects:path2d-22><a href=#path2d>Path2D</a></code> object on which the method was
- invoked.<li><p>Let <var>path</var> be the <code id=path2d-objects:path2d-23><a href=#path2d>Path2D</a></code> object that was provided in the
- method's arguments.<li><p>Run the <a href=#text-preparation-algorithm id=path2d-objects:text-preparation-algorithm-2>text preparation algorithm</a>, passing it <var>text</var>, the
- <code id=path2d-objects:canvasdrawingstyles-4><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument, and, if the <var>maxWidth</var>
- argument was provided, that argument. Let <var>glyphs</var> be the resulting array, and
- <var>physical alignment</var> be the resulting alignment value.</p>
- <li><p>Let <var>width</var> be the aggregate length of all the subpaths in <var>path</var>, including the distances from the last point of each closed subpath to the
- first point of that subpath.<li><p>Define <var>L</var> to be a linear coordinate line for of all the subpaths in
- <var>path</var>, with additional lines drawn between the last point and the first point
- of each closed subpath, such that the first point of the first subpath is defined as point 0, and
- the last point of the last subpath, if the last subpath is not closed, or the second occurrence
- first point of that subpath, if it is closed, is defined as point <var>width</var>.<li>
- <p>Let <var>offset</var> be determined according to the appropriate step below:</p>
- <dl class=switch><dt>If <var>physical alignment</var> is <i>left</i><dd>Let <var>offset</var> be zero.<dt>If <var>physical alignment</var> is <i>right</i><dd>Let <var>offset</var> be <var>width</var>.<dt>If <var>physical alignment</var> is <i>center</i><dd>Let <var>offset</var> be half of <var>width</var>.</dl>
- <li><p>Move all the shapes in <var>glyphs</var> to the right by <var>offset</var> CSS pixels.<li><p>Let <var>transformed path list</var> be an empty list of paths.<li>
- <p>For each glyph <var>glyph</var> in the <var>glyphs</var> array, run these
- substeps:</p>
- <ol><li><p>Let <var>dx</var> be the <var>x</var>-coordinate of the horizontal
- center of the bounding box of the shape described by <var>glyph</var>, in CSS
- pixels.<li><p>If <var>dx</var> is negative or greater than <var>width</var>, skip
- the remainder of these substeps for this glyph.<li><p>Recast <var>dx</var> to coordinate spaces units in <var>path</var>.
- (This just changes the dimensionality of <var>dx</var>, not its numeric value.)</p>
-
- <li><p>Find the point <var>p</var> on <var>path</var> (or implied closing
- lines in <var>path</var>) that corresponds to the position <var>dx</var> on
- the coordinate line <var>L</var>.</p>
- <li><p>Let <var>θ</var> be the clockwise angle from the positive x-axis to the
- side of the line that is tangential to <var>path</var> at the point <var>p</var> that is going in the same direction as the line at point <var>p</var>.<li><p>Rotate the shape described by <var>glyph</var> clockwise by <var>θ</var> about the point that is at the <var>dx</var> coordinate
- horizontally and the zero coordinate vertically.<li><p>Let (<var>x</var>, <var>y</var>) be the coordinate of the point <var>p</var>.<li><p>Move the shape described by <var>glyph</var> to the right by <var>x</var> and down by <var>y</var>.<li><p>Let <var>glyph subpaths</var> be a list of subpaths describing the shape given
- in <var>glyph</var>, with each CSS pixel in the coordinate space of <var>glyph</var> mapped to one coordinate space unit in <var>glyph subpaths</var>.
- Subpaths in <var>glyph subpaths</var> must wind clockwise, regardless of how the user
- agent's font subsystem renders fonts and regardless of how the fonts themselves are
- defined.</p>
- <li><p>Transform all the coordinates and lines in <var>glyph subpaths</var> by the
- transformation matrix <var>transform</var>, if it is not null.<li><p>If the method is <code id=path2d-objects:dom-path2d-addpathbystrokingtext-6><a href=#dom-path2d-addpathbystrokingtext>addPathByStrokingText()</a></code>, replace <var>glyph subpaths</var> by the result of <a href=#trace-a-path id=path2d-objects:trace-a-path-3>tracing</a> <var>glyph subpaths</var>, using the <code id=path2d-objects:canvasdrawingstyles-5><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> object argument for
- the line styles.</p>
- <li><p>Add all the subpaths in <var>glyph subpaths</var> to <var>transformed path list</var>.</ol>
- <li>
- <p>Let <var>merged path</var> be a <a href=#concept-path id=path2d-objects:concept-path-9>path</a> that
- consists of a set of non-overlapping subpaths that exactly outline the points from which, in any
- of the <a href=#concept-path id=path2d-objects:concept-path-10>paths</a> in <var>transformed path list</var>,
- the number of times a half-infinite straight line drawn from that point crosses that path is
- odd.</p>
- <p>The subpaths in <var>merged path</var> must be oriented such that for any point,
- the number of times a half-infinite straight line drawn from that point crosses a subpath is
- even if and only if the number of times a half-infinite straight line drawn from that same point
- crosses a subpath going in one direction is equal to the number of times it crosses a subpath
- going in the other direction.</p>
- <p class=note>See <a href=#mergeGlyphs>the equivalent step in the earlier algorithm</a> for
- an example of this step. It's even more likely that there will be overlap with this method,
- since neighboring glyphs are likely to be rotated relative to each other.</p>
- <li><p>Add all the subpaths in <var>merged path</var> to <var>target</var>.<li><p>Set the <code id=path2d-objects:path2d-24><a href=#path2d>Path2D</a></code> object's <a href=#need-new-subpath id=path2d-objects:need-new-subpath-3>need new subpath</a> flag.</ol>
-
- <h6 id=transformations>4.12.4.2.8 <dfn>Transformations</dfn></h6>
- <p>Each <code id=transformations:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object has a <i>current transformation matrix</i>,
- as well as methods (described in this section) to manipulate it. When a
- <code id=transformations:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, its transformation matrix must be
- initialised to the identity transform.</p>
- <p>The transformation matrix is applied to coordinates when creating the <a href=#current-default-path id=transformations:current-default-path>current default
- path</a>, and when painting text, shapes, and <code id=transformations:path2d><a href=#path2d>Path2D</a></code> objects, on
- <code id=transformations:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> objects.</p>
- <p class=note>Most of the API uses <code id=transformations:svgmatrix><a href=#svgmatrix>SVGMatrix</a></code> objects rather than this API. This API
- remains mostly for historical reasons.</p>
-
- <p>The transformations must be performed in reverse order.</p>
- <p class=note>For instance, if a scale transformation that doubles the width is applied to the
- canvas, followed by a rotation transformation that rotates drawing operations by a quarter turn,
- and a rectangle twice as wide as it is tall is then drawn on the canvas, the actual result will be
- a square.</p>
-
- <dl class=domintro><dt><var>context</var> . <code id=transformations:dom-context-2d-currenttransform><a href=#dom-context-2d-currenttransform>currentTransform</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the transformation matrix, as an <code id=transformations:svgmatrix-2><a href=#svgmatrix>SVGMatrix</a></code> object.</p>
- <p>Can be set, to change the transformation matrix.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-scale><a href=#dom-context-2d-scale>scale</a></code>(<var>x</var>, <var>y</var>)<dd>
- <p>Changes the transformation matrix to apply a scaling transformation with the given characteristics.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-rotate><a href=#dom-context-2d-rotate>rotate</a></code>(<var>angle</var>)<dd>
- <p>Changes the transformation matrix to apply a rotation transformation with the given characteristics. The angle is in radians.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-translate><a href=#dom-context-2d-translate>translate</a></code>(<var>x</var>, <var>y</var>)<dd>
- <p>Changes the transformation matrix to apply a translation transformation with the given characteristics.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-transform><a href=#dom-context-2d-transform>transform</a></code>(<var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)<dd>
- <p>Changes the transformation matrix to apply the matrix given by the arguments as described below.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-settransform><a href=#dom-context-2d-settransform>setTransform</a></code>(<var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)<dd>
- <p>Changes the transformation matrix <em>to</em> the matrix given by the arguments as described below.</p>
- <dt><var>context</var> . <code id=transformations:dom-context-2d-resettransform><a href=#dom-context-2d-resettransform>resetTransform</a></code>()<dd>
- <p>Changes the transformation matrix to the identity transform.</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-currenttransform><code>currentTransform</code></dfn>, on
- getting, must return the last object that it was set to. On setting, its value must be changed to
- the new value, and the transformation matrix must be updated to match the matrix described by the
- new value. When the <code id=transformations:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, the <code id=transformations:dom-context-2d-currenttransform-2><a href=#dom-context-2d-currenttransform>currentTransform</a></code> attribute must be set a newly
- created <code id=transformations:svgmatrix-3><a href=#svgmatrix>SVGMatrix</a></code> object. When the transformation matrix is mutated by the methods
- described in this section, the last <code id=transformations:svgmatrix-4><a href=#svgmatrix>SVGMatrix</a></code> object to which the attribute has been
- set must be mutated in a corresponding fashion.</p>
- <p>The <dfn id=dom-context-2d-scale><code>scale(<var>x</var>, <var>y</var>)</code></dfn>
- method must add the scaling transformation described by the arguments to the transformation
- matrix. The <var>x</var> argument represents the scale factor in the horizontal direction and the
- <var>y</var> argument represents the scale factor in the vertical direction. The factors are
- multiples.</p>
- <p>The <dfn id=dom-context-2d-rotate><code>rotate(<var>angle</var>)</code></dfn> method must
- add the rotation transformation described by the argument to the transformation matrix. The
- <var>angle</var> argument represents a clockwise rotation angle expressed in radians.</p>
- <p>The <dfn id=dom-context-2d-translate><code>translate(<var>x</var>,
- <var>y</var>)</code></dfn> method must add the translation transformation described by the
- arguments to the transformation matrix. The <var>x</var> argument represents the translation
- distance in the horizontal direction and the <var>y</var> argument represents the translation
- distance in the vertical direction. The arguments are in coordinate space units.</p>
- <p>The <dfn id=dom-context-2d-transform><code>transform(<var>a</var>, <var>b</var>,
- <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)</code></dfn> method must replace the
- current transformation matrix with the result of multiplying the current transformation matrix
- with the matrix described by:</p>
-
- <table class=matrix><tr><td><var>a</var><td><var>c</var><td><var>e</var><tr><td><var>b</var><td><var>d</var><td><var>f</var><tr><td>0<td>0<td>1</table>
- <p class=note>The arguments <var>a</var>, <var>b</var>, <var>c</var>, <var>d</var>,
- <var>e</var>, and <var>f</var> are sometimes called <var>m11</var>, <var>m12</var>,
- <var>m21</var>, <var>m22</var>, <var>dx</var>, and <var>dy</var> or <var>m11</var>,
- <var>m21</var>, <var>m12</var>, <var>m22</var>, <var>dx</var>, and <var>dy</var>. Care should be
- taken in particular with the order of the second and third arguments (<var>b</var> and
- <var>c</var>) as their order varies from API to API and APIs sometimes use the notation
- <var>m12</var>/<var>m21</var> and sometimes <var>m21</var>/<var>m12</var> for those positions.</p>
-
- <p>The <dfn id=dom-context-2d-settransform><code>setTransform(<var>a</var>, <var>b</var>,
- <var>c</var>, <var>d</var>, <var>e</var>, <var>f</var>)</code></dfn> method must reset the current
- transform to the identity matrix, and then invoke the <code><a href=#dom-context-2d-transform id=transformations:dom-context-2d-transform-2>transform</a>(<var>a</var>, <var>b</var>, <var>c</var>,
- <var>d</var>, <var>e</var>, <var>f</var>)</code> method with the same arguments.</p>
- <p>The <dfn id=dom-context-2d-resettransform><code>resetTransform()</code></dfn> method must
- reset the current transform to the identity matrix.</p>
-
- <h6 id=image-sources-for-2d-rendering-contexts>4.12.4.2.9 Image sources for 2D rendering contexts</h6>
- <p>Several methods in the <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> API take the union type
- <code id=image-sources-for-2d-rendering-contexts:canvasimagesource><a href=#canvasimagesource>CanvasImageSource</a></code> as an argument.</p>
- <p>This union type allows objects implementing any of the following interfaces to be used as image
- sources:</p>
- <ul><li><code id=image-sources-for-2d-rendering-contexts:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code> (<code id=image-sources-for-2d-rendering-contexts:the-img-element><a href=#the-img-element>img</a></code> elements)<li><code id=image-sources-for-2d-rendering-contexts:htmlvideoelement><a href=#htmlvideoelement>HTMLVideoElement</a></code> (<code id=image-sources-for-2d-rendering-contexts:the-video-element><a href=#the-video-element>video</a></code> elements)<li><code id=image-sources-for-2d-rendering-contexts:htmlcanvaselement><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> (<code id=image-sources-for-2d-rendering-contexts:the-canvas-element><a href=#the-canvas-element>canvas</a></code> elements)<li><code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code><li><code id=image-sources-for-2d-rendering-contexts:imagebitmap><a href=#imagebitmap>ImageBitmap</a></code></ul>
- <p class=note>The <code id=image-sources-for-2d-rendering-contexts:imagebitmap-2><a href=#imagebitmap>ImageBitmap</a></code> interface can be created from a number of other
- image-representing types, including <code id=image-sources-for-2d-rendering-contexts:imagedata><a href=#imagedata>ImageData</a></code>.</p>
- <p>When a user agent is required to <dfn id=check-the-usability-of-the-image-argument>check the usability of the <var>image</var>
- argument</dfn>, where <var>image</var> is a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-2><a href=#canvasimagesource>CanvasImageSource</a></code> object, the
- user agent must run these steps, which return either <i>good</i>, <i>bad</i>, or
- <i>aborted</i>:</p>
- <ol><li><p>If the <var>image</var> argument is an <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-2><a href=#htmlimageelement>HTMLImageElement</a></code> object that
- is in the <a href=#img-error id=image-sources-for-2d-rendering-contexts:img-error>broken</a> state, then throw an
- <code id=image-sources-for-2d-rendering-contexts:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception, return <i>aborted</i>, and abort these steps.</p>
- <li><p>If the <var>image</var> argument is an <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-3><a href=#htmlimageelement>HTMLImageElement</a></code> object that
- is not <a href=#img-good id=image-sources-for-2d-rendering-contexts:img-good>fully decodable</a>, or if the <var>image</var>
- argument is an <code id=image-sources-for-2d-rendering-contexts:htmlvideoelement-2><a href=#htmlvideoelement>HTMLVideoElement</a></code> object whose <code id=image-sources-for-2d-rendering-contexts:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> attribute is either <code id=image-sources-for-2d-rendering-contexts:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code id=image-sources-for-2d-rendering-contexts:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then return <i>bad</i> and abort these
- steps.<li><p>If the <var>image</var> argument is an <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-4><a href=#htmlimageelement>HTMLImageElement</a></code> object with
- an intrinsic width or intrinsic height (or both) equal to zero, then return <i>bad</i> and abort
- these steps.</p>
- <li><p>If the <var>image</var> argument is an <code id=image-sources-for-2d-rendering-contexts:htmlcanvaselement-2><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> object with
- either a horizontal dimension or a vertical dimension equal to zero, then return <i>bad</i> and
- abort these steps.</p>
- <li><p>Return <i>good</i>.</ol>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-3><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-5><a href=#htmlimageelement>HTMLImageElement</a></code>, the
- element's image must be used as the source image.</p>
- <p>Specifically, when a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-4><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an animated image in an
- <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-6><a href=#htmlimageelement>HTMLImageElement</a></code>, the user agent must use the default image of the animation (the
- one that the format defines is to be used when animation is not supported or is disabled), or, if
- there is no such image, the first frame of the animation, when rendering the image for
- <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> APIs.</p>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-5><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code id=image-sources-for-2d-rendering-contexts:htmlvideoelement-3><a href=#htmlvideoelement>HTMLVideoElement</a></code>, then
- the frame at the <a href=#current-playback-position id=image-sources-for-2d-rendering-contexts:current-playback-position>current playback position</a> when the method with the argument is
- invoked must be used as the source image when rendering the image for
- <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> APIs, and the source image's dimensions must be the <a href=#concept-video-intrinsic-width id=image-sources-for-2d-rendering-contexts:concept-video-intrinsic-width>intrinsic width</a> and <a href=#concept-video-intrinsic-height id=image-sources-for-2d-rendering-contexts:concept-video-intrinsic-height>intrinsic height</a> of the <a href=#media-resource id=image-sources-for-2d-rendering-contexts:media-resource>media resource</a>
- (i.e. after any aspect-ratio correction has been applied).</p>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-6><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code id=image-sources-for-2d-rendering-contexts:htmlcanvaselement-3><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>, the
- element's bitmap must be used as the source image.</p>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-7><a href=#canvasimagesource>CanvasImageSource</a></code> object represents a <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>, the
- object's <a href=#scratch-bitmap id=image-sources-for-2d-rendering-contexts:scratch-bitmap>scratch bitmap</a> must be used as the source image.</p>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-8><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an element that is <a href=#being-rendered id=image-sources-for-2d-rendering-contexts:being-rendered>being
- rendered</a> and that element has been resized, the original image data of the source image
- must be used, not the image as it is rendered (e.g. <code id=image-sources-for-2d-rendering-contexts:attr-dim-width><a href=#attr-dim-width>width</a></code> and
- <code id=image-sources-for-2d-rendering-contexts:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes on the source element have no effect on how
- the object is interpreted when rendering the image for <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
- APIs).</p>
- <p>When a <code id=image-sources-for-2d-rendering-contexts:canvasimagesource-9><a href=#canvasimagesource>CanvasImageSource</a></code> object represents an <code id=image-sources-for-2d-rendering-contexts:imagebitmap-3><a href=#imagebitmap>ImageBitmap</a></code>, the
- object's bitmap image data must be used as the source image.</p>
- <p><dfn id=the-image-argument-is-not-origin-clean>The <var>image argument</var> is not origin-clean</dfn> if it is an
- <code id=image-sources-for-2d-rendering-contexts:htmlimageelement-7><a href=#htmlimageelement>HTMLImageElement</a></code> or <code id=image-sources-for-2d-rendering-contexts:htmlvideoelement-4><a href=#htmlvideoelement>HTMLVideoElement</a></code> whose <a href=#origin-2 id=image-sources-for-2d-rendering-contexts:origin-2>origin</a> is not
- the <a href=#same-origin id=image-sources-for-2d-rendering-contexts:same-origin>same</a> as the <a href=#origin-2 id=image-sources-for-2d-rendering-contexts:origin-2-2>origin</a> specified by the <a href=#entry-settings-object id=image-sources-for-2d-rendering-contexts:entry-settings-object>entry
- settings object</a>, or if it is an <code id=image-sources-for-2d-rendering-contexts:htmlcanvaselement-4><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> whose bitmap's <a href=#concept-canvas-origin-clean id=image-sources-for-2d-rendering-contexts:concept-canvas-origin-clean>origin-clean</a> flag is false, or if it is a
- <code id=image-sources-for-2d-rendering-contexts:canvasrenderingcontext2d-7><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose <a href=#scratch-bitmap id=image-sources-for-2d-rendering-contexts:scratch-bitmap-2>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=image-sources-for-2d-rendering-contexts:concept-canvas-origin-clean-2>origin-clean</a> flag is false.</p>
- <h6 id=fill-and-stroke-styles>4.12.4.2.10 Fill and stroke styles</h6>
- <dl class=domintro><dt><var>context</var> . <code id=fill-and-stroke-styles:dom-context-2d-fillstyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current style used for filling shapes.</p>
- <p>Can be set, to change the fill style.</p>
- <p>The style can be either a string containing a CSS colour, or a <code id=fill-and-stroke-styles:canvasgradient><a href=#canvasgradient>CanvasGradient</a></code> or
- <code id=fill-and-stroke-styles:canvaspattern><a href=#canvaspattern>CanvasPattern</a></code> object. Invalid values are ignored.</p>
- <dt><var>context</var> . <code id=fill-and-stroke-styles:dom-context-2d-strokestyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current style used for stroking shapes.</p>
- <p>Can be set, to change the stroke style.</p>
- <p>The style can be either a string containing a CSS colour, or a <code id=fill-and-stroke-styles:canvasgradient-2><a href=#canvasgradient>CanvasGradient</a></code> or
- <code id=fill-and-stroke-styles:canvaspattern-2><a href=#canvaspattern>CanvasPattern</a></code> object. Invalid values are ignored.</p>
- </dl>
-
-
- <p>The <dfn id=dom-context-2d-fillstyle><code>fillStyle</code></dfn> attribute represents the
- colour or style to use inside shapes, and the <dfn id=dom-context-2d-strokestyle><code>strokeStyle</code></dfn> attribute represents the colour
- or style to use for the lines around the shapes.</p>
- <p>Both attributes can be either strings, <code id=fill-and-stroke-styles:canvasgradient-3><a href=#canvasgradient>CanvasGradient</a></code>s, or
- <code id=fill-and-stroke-styles:canvaspattern-3><a href=#canvaspattern>CanvasPattern</a></code>s. On setting, strings must be <a href=#parsed-as-a-css-color-value id=fill-and-stroke-styles:parsed-as-a-css-color-value>parsed as CSS <color> values</a> and the colour assigned, and
- <code id=fill-and-stroke-styles:canvasgradient-4><a href=#canvasgradient>CanvasGradient</a></code> and <code id=fill-and-stroke-styles:canvaspattern-4><a href=#canvaspattern>CanvasPattern</a></code> objects must be assigned themselves. <a href=#refsCSSCOLOR>[CSSCOLOR]</a> If the value is a string but cannot be <a href=#parsed-as-a-css-color-value id=fill-and-stroke-styles:parsed-as-a-css-color-value-2>parsed as a CSS
- <color> value</a>, then it must be ignored, and the attribute must retain its previous
- value.
- If the new value is a <code id=fill-and-stroke-styles:canvaspattern-5><a href=#canvaspattern>CanvasPattern</a></code> object that is marked as <a href=#concept-canvas-pattern-not-origin-clean id=fill-and-stroke-styles:concept-canvas-pattern-not-origin-clean>not origin-clean</a>, then the <a href=#scratch-bitmap id=fill-and-stroke-styles:scratch-bitmap>scratch
- bitmap</a>'s <a href=#concept-canvas-origin-clean id=fill-and-stroke-styles:concept-canvas-origin-clean>origin-clean</a> flag must be set to
- false.
- </p>
- <p>When set to a <code id=fill-and-stroke-styles:canvaspattern-6><a href=#canvaspattern>CanvasPattern</a></code> or <code id=fill-and-stroke-styles:canvasgradient-5><a href=#canvasgradient>CanvasGradient</a></code> object, the assignment
- is <a href=#live id=fill-and-stroke-styles:live>live</a>, meaning that changes made to the object after the assignment do affect
- subsequent stroking or filling of shapes.</p>
- <p>On getting, if the value is a colour, then the <a href=#serialisation-of-a-colour id=fill-and-stroke-styles:serialisation-of-a-colour>serialisation of the colour</a> must be returned. Otherwise, if it is not a colour but a
- <code id=fill-and-stroke-styles:canvasgradient-6><a href=#canvasgradient>CanvasGradient</a></code> or <code id=fill-and-stroke-styles:canvaspattern-7><a href=#canvaspattern>CanvasPattern</a></code>, then the respective object must be
- returned. (Such objects are opaque and therefore only useful for assigning to other attributes or
- for comparison to other gradients or patterns.)</p>
- <p>The <dfn id=serialisation-of-a-colour>serialisation of a colour</dfn> for a colour value is a string, computed as follows: if
- it has alpha equal to 1.0, then the string is a lowercase six-digit hex value, prefixed with a "#"
- character (U+0023 NUMBER SIGN), with the first two digits representing the red component, the next
- two digits representing the green component, and the last two digits representing the blue
- component, the digits being <a href=#lowercase-ascii-hex-digits id=fill-and-stroke-styles:lowercase-ascii-hex-digits>lowercase ASCII hex digits</a>. Otherwise, the colour value
- has alpha less than 1.0, and the string is the colour value in the CSS <code>rgba()</code>
- functional-notation format: the literal string "<code>rgba</code>" (U+0072 U+0067 U+0062
- U+0061) followed by a U+0028 LEFT PARENTHESIS, a base-ten integer in the range 0-255 representing
- the red component (using <a href=#ascii-digits id=fill-and-stroke-styles:ascii-digits>ASCII digits</a> in the shortest form possible), a literal
- U+002C COMMA and U+0020 SPACE, an integer for the green component, a comma and a space, an integer
- for the blue component, another comma and space, a U+0030 DIGIT ZERO, if the alpha value is
- greater than zero then a U+002E FULL STOP (representing the decimal point), if the alpha value is
- greater than zero then one or more <a href=#ascii-digits id=fill-and-stroke-styles:ascii-digits-2>ASCII digits</a> representing the fractional part of
- the alpha, and finally a U+0029
- RIGHT PARENTHESIS. User agents must express the fractional part of the alpha value, if any, with
- the level of precision necessary for the alpha value, when reparsed, to be interpreted as the same
- alpha value.</p>
- <p>When the context is created, the <code id=fill-and-stroke-styles:dom-context-2d-fillstyle-2><a href=#dom-context-2d-fillstyle>fillStyle</a></code> and <code id=fill-and-stroke-styles:dom-context-2d-strokestyle-2><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attributes
- must initially have the string value <code>#000000</code>.</p>
- <p>When the value is a colour, it must not be affected by the transformation matrix when used to
- draw on bitmaps.</p>
-
- <hr>
- <p>There are two types of gradients, linear gradients and radial gradients, both represented by
- objects implementing the opaque <code id=fill-and-stroke-styles:canvasgradient-7><a href=#canvasgradient>CanvasGradient</a></code> interface.</p>
- <p id=interpolation>Once a gradient has been created (see below), stops are placed along it to
- define how the colours are distributed along the gradient. The colour of the
- gradient at each stop is the colour specified for that stop. Between each such stop, the colours and
- the alpha component must be linearly interpolated over the RGBA space without premultiplying the
- alpha value to find the colour to use at that offset. Before the first stop, the colour must be the
- colour of the first stop. After the last stop, the colour must be the colour of the last stop. When
- there are no stops, the gradient is transparent black.</p>
- <dl class=domintro><dt><var>gradient</var> . <code id=fill-and-stroke-styles:dom-canvasgradient-addcolorstop><a href=#dom-canvasgradient-addcolorstop>addColorStop</a></code>(<var>offset</var>, <var>color</var>)<dd>
- <p>Adds a colour stop with the given colour to the gradient at the given offset. 0.0 is the offset
- at one end of the gradient, 1.0 is the offset at the other end.</p>
- <p>Throws an <code id=fill-and-stroke-styles:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if the offset is out of range. Throws a
- <code id=fill-and-stroke-styles:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception if the colour cannot be parsed.</p>
- <dt><var>gradient</var> = <var>context</var> . <code id=fill-and-stroke-styles:dom-context-2d-createlineargradient><a href=#dom-context-2d-createlineargradient>createLinearGradient</a></code>(<var>x0</var>, <var>y0</var>, <var>x1</var>, <var>y1</var>)<dd>
- <p>Returns a <code id=fill-and-stroke-styles:canvasgradient-8><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
- linear gradient that paints along the line given by the
- coordinates represented by the arguments.</p>
- <dt><var>gradient</var> = <var>context</var> . <code id=fill-and-stroke-styles:dom-context-2d-createradialgradient><a href=#dom-context-2d-createradialgradient>createRadialGradient</a></code>(<var>x0</var>, <var>y0</var>, <var>r0</var>, <var>x1</var>, <var>y1</var>, <var>r1</var>)<dd>
- <p>Returns a <code id=fill-and-stroke-styles:canvasgradient-9><a href=#canvasgradient>CanvasGradient</a></code> object that represents a
- radial gradient that paints along the cone given by the circles
- represented by the arguments.</p>
- <p>If either of the radii are negative, throws an
- <code id=fill-and-stroke-styles:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception.</p>
- </dl>
-
- <p>The <dfn id=dom-canvasgradient-addcolorstop><code>addColorStop(<var>offset</var>,
- <var>color</var>)</code></dfn> method on the <code id=fill-and-stroke-styles:canvasgradient-10><a href=#canvasgradient>CanvasGradient</a></code> interface adds a
- new stop to a gradient. If the <var>offset</var> is less than 0 or greater than 1 then an
- <code id=fill-and-stroke-styles:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown. If the <var>color</var> cannot be
- <a href=#parsed-as-a-css-color-value id=fill-and-stroke-styles:parsed-as-a-css-color-value-3>parsed as a CSS <color> value</a>, then a <code id=fill-and-stroke-styles:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception must
- be thrown. Otherwise, the gradient must have a new stop placed, at offset <var>offset</var> relative to the whole gradient, and with the colour obtained by parsing <var>color</var> as a CSS <color> value. If multiple stops are added at the same offset
- on a gradient, they must be placed in the order added, with the first one closest to the start of
- the gradient, and each subsequent one infinitesimally further along towards the end point (in
- effect causing all but the first and last stop added at each point to be ignored).</p>
- <p>The <dfn id=dom-context-2d-createlineargradient><code>createLinearGradient(<var>x0</var>, <var>y0</var>, <var>x1</var>, <var>y1</var>)</code></dfn> method takes four arguments that represent the start point (<var>x0</var>, <var>y0</var>) and end point (<var>x1</var>, <var>y1</var>) of the gradient. The method must return a linear <code id=fill-and-stroke-styles:canvasgradient-11><a href=#canvasgradient>CanvasGradient</a></code>
- initialised with the specified line.</p>
- <p>Linear gradients must be rendered such that all points on a line perpendicular to the line that
- crosses the start and end points have the colour at the point where those two lines cross (with the
- colours coming from the <a href=#interpolation>interpolation and extrapolation</a> described
- above). The points in the linear gradient must be transformed as described by the <a href=#transformations id=fill-and-stroke-styles:transformations>current transformation matrix</a> when rendering.</p>
- <p>If <span><var>x0</var> = <var>x1</var></span> and <span><var>y0</var> = <var>y1</var></span>, then the linear
- gradient must paint nothing.</p>
- <p>The <dfn id=dom-context-2d-createradialgradient><code>createRadialGradient(<var>x0</var>, <var>y0</var>, <var>r0</var>, <var>x1</var>, <var>y1</var>, <var>r1</var>)</code></dfn> method takes six arguments, the first
- three representing the start circle with origin (<var>x0</var>, <var>y0</var>)
- and radius <var>r0</var>, and the last three representing the end circle with origin
- (<var>x1</var>, <var>y1</var>) and radius <var>r1</var>. The values are
- in coordinate space units. If either of <var>r0</var> or <var>r1</var> are
- negative, an <code id=fill-and-stroke-styles:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception must be thrown. Otherwise, the method must
- return a radial <code id=fill-and-stroke-styles:canvasgradient-12><a href=#canvasgradient>CanvasGradient</a></code> initialised with the two specified circles.</p>
- <p>Radial gradients must be rendered by following these steps:</p>
- <ol><li><p>If <span><var>x<sub>0</sub></var> = <var>x<sub>1</sub></var></span> and <span><var>y<sub>0</sub></var> = <var>y<sub>1</sub></var></span> and <span><var>r<sub>0</sub></var> = <var>r<sub>1</sub></var></span>, then the radial gradient must
- paint nothing. Abort these steps.<li>
- <p>Let <span>x(<var>ω</var>) = (<var>x<sub>1</sub></var>-<var>x<sub>0</sub></var>)<var>ω</var> + <var>x<sub>0</sub></var></span></p>
- <p>Let <span>y(<var>ω</var>) = (<var>y<sub>1</sub></var>-<var>y<sub>0</sub></var>)<var>ω</var> + <var>y<sub>0</sub></var></span></p>
- <p>Let <span>r(<var>ω</var>) = (<var>r<sub>1</sub></var>-<var>r<sub>0</sub></var>)<var>ω</var> + <var>r<sub>0</sub></var></span></p>
- <p>Let the colour at <var>ω</var> be the colour at that position on the gradient
- (with the colours coming from the <a href=#interpolation>interpolation and extrapolation</a>
- described above).</p>
- <li><p>For all values of <var>ω</var> where <span>r(<var>ω</var>) > 0</span>, starting with the value of <var>ω</var> nearest to positive infinity and ending with the value of <var>ω</var> nearest to negative infinity, draw the circumference of the circle with
- radius <span>r(<var>ω</var>)</span> at position (<span>x(<var>ω</var>)</span>, <span>y(<var>ω</var>)</span>), with the
- colour at <var>ω</var>, but only painting on the parts of the bitmap that have not
- yet been painted on by earlier circles in this step for this rendering of the gradient.</ol>
- <p class=note>This effectively creates a cone, touched by the two circles defined in the
- creation of the gradient, with the part of the cone before the start circle (0.0) using the colour
- of the first offset, the part of the cone after the end circle (1.0) using the colour of the last
- offset, and areas outside the cone untouched by the gradient (transparent black).</p>
- <p>The resulting radial gradient must then be transformed as described by the <a href=#transformations id=fill-and-stroke-styles:transformations-2>current transformation matrix</a> when rendering.</p>
- <p>Gradients must be painted only where the relevant stroking or filling effects requires that
- they be drawn.</p>
-
- <hr>
- <p>Patterns are represented by objects implementing the opaque <code id=fill-and-stroke-styles:canvaspattern-8><a href=#canvaspattern>CanvasPattern</a></code>
- interface.</p>
- <dl class=domintro><dt><var>pattern</var> = <var>context</var> . <code id=fill-and-stroke-styles:dom-context-2d-createpattern><a href=#dom-context-2d-createpattern>createPattern</a></code>(<var>image</var>, <var>repetition</var>)<dd>
- <p>Returns a <code id=fill-and-stroke-styles:canvaspattern-9><a href=#canvaspattern>CanvasPattern</a></code> object that uses the given image and repeats in the
- direction(s) given by the <var>repetition</var> argument.</p>
- <p>The allowed values for <var>repetition</var> are <code>repeat</code> (both
- directions), <code>repeat-x</code> (horizontal only), <code>repeat-y</code>
- (vertical only), and <code>no-repeat</code> (neither). If the <var>repetition</var> argument is empty, the value <code>repeat</code> is used.</p>
- <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no
- data, throws an <code id=fill-and-stroke-styles:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
- <dt><var>pattern</var> . <code id=fill-and-stroke-styles:dom-canvaspattern-settransform><a href=#dom-canvaspattern-settransform>setTransform</a></code>(<var>transform</var>)<dd>
- <p>Sets the transformation matrix that will be used when rendering the pattern during a fill or
- stroke painting operation.</p>
- </dl>
-
- <p>To create objects of this type, the <dfn id=dom-context-2d-createpattern><code>createPattern(<var>image</var>, <var>repetition</var>)</code></dfn> method is used. When the method is invoked, the user agent
- must run the following steps:</p>
- <ol><li><p>Let <var>image</var> be the first argument and <var>repetition</var> be
- the second argument.<li><p><a href=#check-the-usability-of-the-image-argument id=fill-and-stroke-styles:check-the-usability-of-the-image-argument>Check the usability of the <var>image</var> argument</a>. If this
- returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
- abort these steps. If it returns <i>bad</i>, then return null and abort these steps. Otherwise it
- returns <i>good</i>; continue with these steps.<li><p>If <var>repetition</var> is the empty string, let it be "<code>repeat</code>".</p>
- <li><p>If <var>repetition</var> is not a <a href=#case-sensitive id=fill-and-stroke-styles:case-sensitive>case-sensitive</a> match for one of
- "<code>repeat</code>", "<code>repeat-x</code>", "<code>repeat-y</code>", or "<code>no-repeat</code>", throw a <code id=fill-and-stroke-styles:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code>
- exception and abort these steps.<li><p>Create a new <code id=fill-and-stroke-styles:canvaspattern-10><a href=#canvaspattern>CanvasPattern</a></code> object with the image <var>image</var>
- and the repetition behavior given by <var>repetition</var>.<li><p>If <a href=#the-image-argument-is-not-origin-clean id=fill-and-stroke-styles:the-image-argument-is-not-origin-clean>the <var>image argument</var> is not origin-clean</a>, then mark the
- <code id=fill-and-stroke-styles:canvaspattern-11><a href=#canvaspattern>CanvasPattern</a></code> object as <dfn id=concept-canvas-pattern-not-origin-clean>not
- origin-clean</dfn>.<li><p>Return the <code id=fill-and-stroke-styles:canvaspattern-12><a href=#canvaspattern>CanvasPattern</a></code> object.</ol>
- <p>Modifying the <var>image</var> used when creating a <code id=fill-and-stroke-styles:canvaspattern-13><a href=#canvaspattern>CanvasPattern</a></code> object
- after calling the <code id=fill-and-stroke-styles:dom-context-2d-createpattern-2><a href=#dom-context-2d-createpattern>createPattern()</a></code> method must
- not affect the pattern(s) rendered by the <code id=fill-and-stroke-styles:canvaspattern-14><a href=#canvaspattern>CanvasPattern</a></code> object.</p>
- <p>Patterns have a transformation matrix, which controls how the pattern is used when it is
- painted. Initially, a pattern's transformation matrix must be the identity transform.</p>
- <p>When the <dfn id=dom-canvaspattern-settransform><code>setTransform()</code></dfn> method
- is invoked on the pattern, the user agent must replace the pattern's transformation matrix with
- the one described by the <code id=fill-and-stroke-styles:svgmatrix><a href=#svgmatrix>SVGMatrix</a></code> object provided as an argument to the method.</p>
- <p>When a pattern is to be rendered within an area, the user agent must run the following steps to
- determine what is rendered:</p>
- <ol><li><p>Create an infinite transparent black bitmap.<li>
- <p>Place a copy of the image on the bitmap, anchored such that its top left corner is at the
- origin of the coordinate space, with one coordinate space unit per CSS pixel of the image, then
- place repeated copies of this image horizontally to the left and right, if the repetition
- behavior is "<code>repeat-x</code>", or vertically up and down, if the repetition
- behavior is "<code>repeat-y</code>", or in all four directions all over the bitmap, if
- the repetition behavior is "<code>repeat</code>".</p>
- <p>If the original image data is a bitmap image, the value painted at a point in the area of the
- repetitions is computed by filtering the original image data. When scaling up, if the <code id=fill-and-stroke-styles:dom-context-2d-imagesmoothingenabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> attribute is set to
- false, the image must be rendered using nearest-neighbor interpolation. Otherwise, the user agent
- may use any filtering algorithm (for example bilinear interpolation or nearest-neighbor). When
- such a filtering algorithm requires a pixel value from outside the original image data, it must
- instead use the value from wrapping the pixel's coordinates to the original image's dimensions.
- (That is, the filter uses 'repeat' behavior, regardless of the value of the pattern's repetition
- behavior.)</p>
-
- <li><p>Transform the resulting bitmap according to the pattern's transformation matrix.<li><p>Transform the resulting bitmap again, this time according to the <a href=#transformations id=fill-and-stroke-styles:transformations-3>current transformation matrix</a>.<li><p>Replace any part of the image outside the area in which the pattern is to be rendered with
- transparent black.<li><p>The resulting bitmap is what is to be rendered, with the same origin and same
- scale.</ol>
- <hr>
- <p>If a radial gradient or repeated pattern is used when the transformation matrix is singular,
- the resulting style must be transparent black (otherwise the gradient or pattern would be
- collapsed to a point or line, leaving the other pixels undefined). Linear gradients and solid
- colours always define all points even with singular tranformation matrices.</p>
-
- <h6 id=drawing-rectangles-to-the-bitmap>4.12.4.2.11 Drawing rectangles to the bitmap</h6>
- <p>There are three methods that immediately draw rectangles to the bitmap. They each take four
- arguments; the first two give the <var>x</var> and <var>y</var> coordinates of
- the top left of the rectangle, and the second two give the width <var>w</var> and height
- <var>h</var> of the rectangle, respectively.</p>
-
- <p>The <a href=#transformations id=drawing-rectangles-to-the-bitmap:transformations>current transformation matrix</a> must be
- applied to the following four coordinates, which form the path that must then be closed to get the
- specified rectangle: <span>(<var>x</var>, <var>y</var>)</span>, <span>(<span><var>x</var>+<var>w</var></span>, <var>y</var>)</span>, <span>(<span><var>x</var>+<var>w</var></span>, <span><var>y</var>+<var>h</var></span>)</span>, <span>(<var>x</var>, <span><var>y</var>+<var>h</var></span>)</span>.</p>
- <p>Shapes are painted without affecting the <a href=#current-default-path id=drawing-rectangles-to-the-bitmap:current-default-path>current default path</a>, and are subject to
- the <a href=#clipping-region id=drawing-rectangles-to-the-bitmap:clipping-region>clipping region</a>, and, with the exception of <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-clearrect><a href=#dom-context-2d-clearrect>clearRect()</a></code>, also <a href=#shadows id=drawing-rectangles-to-the-bitmap:shadows>shadow
- effects</a>, <a href=#dom-context-2d-globalalpha id=drawing-rectangles-to-the-bitmap:dom-context-2d-globalalpha>global alpha</a>, and <a href=#dom-context-2d-globalcompositeoperation id=drawing-rectangles-to-the-bitmap:dom-context-2d-globalcompositeoperation>global composition operators</a>.</p>
-
- <dl class=domintro><dt><var>context</var> . <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-clearrect-2><a href=#dom-context-2d-clearrect>clearRect</a></code>(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)<dd>
- <p>Clears all pixels on the bitmap in the given rectangle to transparent black.</p>
- <dt><var>context</var> . <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-fillrect><a href=#dom-context-2d-fillrect>fillRect</a></code>(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)<dd>
- <p>Paints the given rectangle onto the bitmap, using the current fill style.</p>
- <dt><var>context</var> . <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-strokerect><a href=#dom-context-2d-strokerect>strokeRect</a></code>(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)<dd>
- <p>Paints the box that outlines the given rectangle onto the bitmap, using the current stroke
- style.</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-clearrect><code>clearRect(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)</code></dfn> method must run the
- following steps:</p>
- <ol><li><p>Let <var>pixels</var> be the set of pixels in the specified rectangle that also
- intersect the current <a href=#clipping-region id=drawing-rectangles-to-the-bitmap:clipping-region-2>clipping region</a>.<li><p>Clear the pixels in <var>pixels</var> to a fully transparent black, erasing any
- previous image.<li><p><a href=#clear-regions-that-cover-the-pixels id=drawing-rectangles-to-the-bitmap:clear-regions-that-cover-the-pixels>Clear regions that cover the pixels</a> in <var>pixels</var> on the
- <a href=#scratch-bitmap id=drawing-rectangles-to-the-bitmap:scratch-bitmap>scratch bitmap</a>.</ol>
- <p class=note>If either height or width are zero, this method has no effect, since the set of
- pixels would be empty.</p>
- <p>The <dfn id=dom-context-2d-fillrect><code>fillRect(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)</code></dfn> method must paint the
- specified rectangular area using the <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-fillstyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>. If
- either height or width are zero, this method has no effect.</p>
- <p>The <dfn id=dom-context-2d-strokerect><code>strokeRect(<var>x</var>, <var>y</var>, <var>w</var>, <var>h</var>)</code></dfn> method must take the
- result of <a href=#trace-a-path id=drawing-rectangles-to-the-bitmap:trace-a-path>tracing the path</a> described below, using the
- <code id=drawing-rectangles-to-the-bitmap:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's line styles, and fill it with the <code id=drawing-rectangles-to-the-bitmap:dom-context-2d-strokestyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code>.</p>
- <p>If both <var>w</var> and <var>h</var> are zero, the path has a single subpath
- with just one point (<var>x</var>, <var>y</var>), and no lines, and this method
- thus has no effect (the <a href=#trace-a-path id=drawing-rectangles-to-the-bitmap:trace-a-path-2>trace a path</a> algorithm returns an empty path in that
- case).</p>
- <p>If just one of either <var>w</var> or <var>h</var> is zero, then the path has
- a single subpath consisting of two points, with coordinates (<span><var>x</var></span>, <span><var>y</var></span>) and (<span><var>x</var>+<var>w</var></span>, <span><var>y</var></span>+<var>h</var>), in that order, connected by a single straight line.</p>
- <p>Otherwise, the path has a single subpath consisting of four points, with coordinates (<span><var>x</var></span>, <span><var>y</var></span>), (<span><var>x</var>+<var>w</var></span>, <span><var>y</var></span>), (<span><var>x</var>+<var>w</var></span>,
- <span><var>y</var></span>+<var>h</var>), and (<span><var>x</var></span>, <span><var>y</var>+<var>h</var></span>),
- connected to each other in that order by straight lines.</p>
-
- <h6 id=drawing-text-to-the-bitmap>4.12.4.2.12 Drawing text to the bitmap</h6>
- <dl class=domintro><dt><var>context</var> . <code id=drawing-text-to-the-bitmap:dom-context-2d-filltext><a href=#dom-context-2d-filltext>fillText</a></code>(<var>text</var>, <var>x</var>, <var>y</var> [, <var>maxWidth</var> ] )<dt><var>context</var> . <code id=drawing-text-to-the-bitmap:dom-context-2d-stroketext><a href=#dom-context-2d-stroketext>strokeText</a></code>(<var>text</var>, <var>x</var>, <var>y</var> [, <var>maxWidth</var> ] )<dd>
- <p>Fills or strokes (respectively) the given text at the given position. If a maximum width is
- provided, the text will be scaled to fit that width if necessary.</p>
- <dt><var>metrics</var> = <var>context</var> . <code id=drawing-text-to-the-bitmap:dom-context-2d-measuretext><a href=#dom-context-2d-measuretext>measureText</a></code>(<var>text</var>)<dd>
- <p>Returns a <code id=drawing-text-to-the-bitmap:textmetrics><a href=#textmetrics>TextMetrics</a></code> object with the metrics of the given text in the current
- font.</p>
- <dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-width><a href=#dom-textmetrics-width>width</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxleft><a href=#dom-textmetrics-actualboundingboxleft>actualBoundingBoxLeft</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxright><a href=#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-fontboundingboxascent><a href=#dom-textmetrics-fontboundingboxascent>fontBoundingBoxAscent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-fontboundingboxdescent><a href=#dom-textmetrics-fontboundingboxdescent>fontBoundingBoxDescent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent><a href=#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxdescent><a href=#dom-textmetrics-actualboundingboxdescent>actualBoundingBoxDescent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-emheightascent><a href=#dom-textmetrics-emheightascent>emHeightAscent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-emheightdescent><a href=#dom-textmetrics-emheightdescent>emHeightDescent</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-hangingbaseline><a href=#dom-textmetrics-hangingbaseline>hangingBaseline</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-alphabeticbaseline><a href=#dom-textmetrics-alphabeticbaseline>alphabeticBaseline</a></code><dt><var>metrics</var> . <code id=drawing-text-to-the-bitmap:dom-textmetrics-ideographicbaseline><a href=#dom-textmetrics-ideographicbaseline>ideographicBaseline</a></code><dd>
- <p>Returns the measurement described below.</p>
- </dl>
-
- <p>The <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> interface provides the following methods for
- rendering text.</p>
- <p>The <dfn id=dom-context-2d-filltext><code>fillText()</code></dfn> and <dfn id=dom-context-2d-stroketext><code>strokeText()</code></dfn> methods take three or four
- arguments, <var>text</var>, <var>x</var>, <var>y</var>, and optionally
- <var>maxWidth</var>, and render the given <var>text</var> at the given (<var>x</var>, <var>y</var>) coordinates ensuring that the text isn't wider than <var>maxWidth</var> if specified, using the current <code id=drawing-text-to-the-bitmap:dom-context-2d-font><a href=#dom-context-2d-font>font</a></code>, <code id=drawing-text-to-the-bitmap:dom-context-2d-textalign><a href=#dom-context-2d-textalign>textAlign</a></code>,
- and <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline><a href=#dom-context-2d-textbaseline>textBaseline</a></code> values. Specifically, when the
- methods are called, the user agent must run the following steps:</p>
- <ol><li><p>Run the <a href=#text-preparation-algorithm id=drawing-text-to-the-bitmap:text-preparation-algorithm>text preparation algorithm</a>, passing it <var>text</var>, the
- <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, and, if the <var>maxWidth</var> argument
- was provided, that argument. Let <var>glyphs</var> be the result.</p>
- <li><p>Move all the shapes in <var>glyphs</var> to the right by <var>x</var>
- CSS pixels and down by <var>y</var> CSS pixels.<li>
- <p>Paint the shapes given in <var>glyphs</var>, as transformed by the <a href=#transformations id=drawing-text-to-the-bitmap:transformations>current transformation matrix</a>, with each CSS pixel
- in the coordinate space of <var>glyphs</var> mapped to one coordinate space unit.</p>
- <p>For <code id=drawing-text-to-the-bitmap:dom-context-2d-filltext-2><a href=#dom-context-2d-filltext>fillText()</a></code>, <code id=drawing-text-to-the-bitmap:dom-context-2d-fillstyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code> must be applied to the shapes and <code id=drawing-text-to-the-bitmap:dom-context-2d-strokestyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> must be ignored. For <code id=drawing-text-to-the-bitmap:dom-context-2d-stroketext-2><a href=#dom-context-2d-stroketext>strokeText()</a></code>, the reverse holds: <code id=drawing-text-to-the-bitmap:dom-context-2d-strokestyle-2><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> must be applied to the result of <a href=#trace-a-path id=drawing-text-to-the-bitmap:trace-a-path>tracing</a> the shapes using the <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
- object for the line styles, and <code id=drawing-text-to-the-bitmap:dom-context-2d-fillstyle-2><a href=#dom-context-2d-fillstyle>fillStyle</a></code> must be
- ignored.</p>
- <p>These shapes are painted without affecting the current path, and are subject to <a href=#shadows id=drawing-text-to-the-bitmap:shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha id=drawing-text-to-the-bitmap:dom-context-2d-globalalpha>global
- alpha</a>, the <a href=#clipping-region id=drawing-text-to-the-bitmap:clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation id=drawing-text-to-the-bitmap:dom-context-2d-globalcompositeoperation>global composition operators</a>.</p>
- <li><p>If the <a href=#text-preparation-algorithm id=drawing-text-to-the-bitmap:text-preparation-algorithm-2>text preparation algorithm</a> used a font that has an <a href=#origin-2 id=drawing-text-to-the-bitmap:origin-2>origin</a>
- that is not the <a href=#same-origin id=drawing-text-to-the-bitmap:same-origin>same</a> as the <a href=#origin-2 id=drawing-text-to-the-bitmap:origin-2-2>origin</a> specified by
- the <a href=#entry-settings-object id=drawing-text-to-the-bitmap:entry-settings-object>entry settings object</a> (even if "using a font" means just checking if that font
- has a particular glyph in it before falling back to another font), then set the <a href=#scratch-bitmap id=drawing-text-to-the-bitmap:scratch-bitmap>scratch
- bitmap</a>'s <a href=#concept-canvas-origin-clean id=drawing-text-to-the-bitmap:concept-canvas-origin-clean>origin-clean</a> flag to
- false.</ol>
- <p>The <dfn id=dom-context-2d-measuretext><code>measureText()</code></dfn> method takes one
- argument, <var>text</var>. When the method is invoked, the user agent must run the
- <a href=#text-preparation-algorithm id=drawing-text-to-the-bitmap:text-preparation-algorithm-3>text preparation algorithm</a>, passing it <var>text</var> and the
- <code id=drawing-text-to-the-bitmap:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, and then using the returned inline box must create a
- new <code id=drawing-text-to-the-bitmap:textmetrics-2><a href=#textmetrics>TextMetrics</a></code> object with its attributes set as described in the following list.
- If doing these measurements requires using a font that has an <a href=#origin-2 id=drawing-text-to-the-bitmap:origin-2-3>origin</a> that is not the
- <a href=#same-origin id=drawing-text-to-the-bitmap:same-origin-2>same</a> as that of the <code id=drawing-text-to-the-bitmap:document><a href=#document>Document</a></code> object that owns the
- <code id=drawing-text-to-the-bitmap:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element (even if "using a font" means just checking if that font has a
- particular glyph in it before falling back to another font), then the method must throw a
- <code id=drawing-text-to-the-bitmap:securityerror><a href=#securityerror>SecurityError</a></code> exception.
- Otherwise, it must return the new <code id=drawing-text-to-the-bitmap:textmetrics-3><a href=#textmetrics>TextMetrics</a></code> object.
- <a href=#refsCSS>[CSS]</a>
- <a href=#fingerprinting-vector id=drawing-text-to-the-bitmap:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
-
- <dl><dt><dfn id=dom-textmetrics-width><code>width</code></dfn> attribute<dd><p>The width of that inline box, in CSS pixels. (The text's advance width.)<dt><dfn id=dom-textmetrics-actualboundingboxleft><code>actualBoundingBoxLeft</code></dfn> attribute<dd>
- <p>The distance parallel to the baseline from the alignment point given by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textalign-2><a href=#dom-context-2d-textalign>textAlign</a></code> attribute to the left side of the bounding
- rectangle of the given text, in CSS pixels; positive numbers indicating a distance going left
- from the given alignment point.
- <p class=note>The sum of this value and the next (<code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxright-2><a href=#dom-textmetrics-actualboundingboxright>actualBoundingBoxRight</a></code>) can be wider than
- the width of the inline box (<code id=drawing-text-to-the-bitmap:dom-textmetrics-width-2><a href=#dom-textmetrics-width>width</a></code>), in particular
- with slanted fonts where characters overhang their advance width.</p>
- <dt><dfn id=dom-textmetrics-actualboundingboxright><code>actualBoundingBoxRight</code></dfn> attribute<dd>
- <p>The distance parallel to the baseline from the alignment point given by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textalign-3><a href=#dom-context-2d-textalign>textAlign</a></code> attribute to the right side of the bounding
- rectangle of the given text, in CSS pixels; positive numbers indicating a distance going right
- from the given alignment point.</p>
- <dt><dfn id=dom-textmetrics-fontboundingboxascent><code>fontBoundingBoxAscent</code></dfn> attribute<dd>
- <p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-2><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the top of the highest
- bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers
- indicating a distance going up from the given baseline.</p>
- <p class=note>This value and the next are useful when rendering a background that must have a
- consistent height even if the exact text being rendered changes. The <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent-2><a href=#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a></code> attribute (and
- its corresponding attribute for the descent) are useful when drawing a bounding box around
- specific text.</p>
- <dt><dfn id=dom-textmetrics-fontboundingboxdescent><code>fontBoundingBoxDescent</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-3><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the bottom of the lowest
- bounding rectangle of all the fonts used to render the text, in CSS pixels; positive numbers
- indicating a distance going down from the given baseline.<dt><dfn id=dom-textmetrics-actualboundingboxascent><code>actualBoundingBoxAscent</code></dfn> attribute<dd>
- <p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-4><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the top of the bounding
- rectangle of the given text, in CSS pixels; positive numbers indicating a distance going up from
- the given baseline.
- <p class=note>This number can vary greatly based on the input text, even if the first font
- specified covers all the characters in the input. For example, the <code id=drawing-text-to-the-bitmap:dom-textmetrics-actualboundingboxascent-3><a href=#dom-textmetrics-actualboundingboxascent>actualBoundingBoxAscent</a></code> of a lowercase
- "o" from an alphabetic baseline would be less than that of an uppercase "F". The value can
- easily be negative; for example, the distance from the top of the em box (<code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-5><a href=#dom-context-2d-textbaseline>textBaseline</a></code> value "<code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-top><a href=#dom-context-2d-textbaseline-top>top</a></code>") to the top of the bounding rectangle when
- the given text is just a single comma "<code>,</code>" would likely (unless the font is
- quite unusual) be negative.</p>
- <dt><dfn id=dom-textmetrics-actualboundingboxdescent><code>actualBoundingBoxDescent</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-6><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the bottom of the bounding
- rectangle of the given text, in CSS pixels; positive numbers indicating a distance going down
- from the given baseline.<dt><dfn id=dom-textmetrics-emheightascent><code>emHeightAscent</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-7><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the highest top of the em
- squares in the line box, in CSS pixels; positive numbers indicating that the given baseline is
- below the top of that em square (so this value will usually be positive). Zero if the given
- baseline is the top of that em square; half the font size if the given baseline is the middle of
- that em square.<dt><dfn id=dom-textmetrics-emheightdescent><code>emHeightDescent</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-8><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the lowest bottom of the em
- squares in the line box, in CSS pixels; positive numbers indicating that the given baseline is
- below the bottom of that em square (so this value will usually be negative). (Zero if the given
- baseline is the top of that em square.)<dt><dfn id=dom-textmetrics-hangingbaseline><code>hangingBaseline</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-9><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the hanging baseline of the
- line box, in CSS pixels; positive numbers indicating that the given baseline is below the hanging
- baseline. (Zero if the given baseline is the hanging baseline.)<dt><dfn id=dom-textmetrics-alphabeticbaseline><code>alphabeticBaseline</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-10><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the alphabetic baseline of
- the line box, in CSS pixels; positive numbers indicating that the given baseline is below the
- alphabetic baseline. (Zero if the given baseline is the alphabetic baseline.)<dt><dfn id=dom-textmetrics-ideographicbaseline><code>ideographicBaseline</code></dfn> attribute<dd><p>The distance from the horizontal line indicated by the <code id=drawing-text-to-the-bitmap:dom-context-2d-textbaseline-11><a href=#dom-context-2d-textbaseline>textBaseline</a></code> attribute to the ideographic baseline of
- the line box, in CSS pixels; positive numbers indicating that the given baseline is below the
- ideographic baseline. (Zero if the given baseline is the ideographic baseline.)</dl>
- <p class=note>Glyphs rendered using <code id=drawing-text-to-the-bitmap:dom-context-2d-filltext-3><a href=#dom-context-2d-filltext>fillText()</a></code> and
- <code id=drawing-text-to-the-bitmap:dom-context-2d-stroketext-3><a href=#dom-context-2d-stroketext>strokeText()</a></code> can spill out of the box given by the
- font size (the em square size) and the width returned by <code id=drawing-text-to-the-bitmap:dom-context-2d-measuretext-2><a href=#dom-context-2d-measuretext>measureText()</a></code> (the text width). Authors are encouraged
- to use the bounding box values described above if this is an issue.</p>
- <p class=note>A future version of the 2D context API may provide a way to render fragments of
- documents, rendered using CSS, straight to the canvas. This would be provided in preference to a
- dedicated way of doing multiline layout.</p>
- <h6 id=drawing-paths-to-the-canvas>4.12.4.2.13 Drawing paths to the canvas</h6>
- <p>The context always has a <dfn id=current-default-path>current default path</dfn>. There is only one <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path>current
- default path</a>, it is not part of the <a href=#drawing-state id=drawing-paths-to-the-canvas:drawing-state>drawing state</a>. The <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-2>current default
- path</a> is a <a href=#concept-path id=drawing-paths-to-the-canvas:concept-path>path</a>, as described above.</p>
- <dl class=domintro><dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-beginpath><a href=#dom-context-2d-beginpath>beginPath</a></code>()<dd>
- <p>Resets the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-3>current default path</a>.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-fill><a href=#dom-context-2d-fill>fill</a></code>( [ <var>fillRule</var> ] )<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-fill-2><a href=#dom-context-2d-fill>fill</a></code>(<var>path</var> [, <var>fillRule</var> ] )<dd>
- <p>Fills the subpaths of the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-4>current default path</a> or the given path with the
- current fill style, obeying the given fill rule.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-stroke><a href=#dom-context-2d-stroke>stroke</a></code>()<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-stroke-2><a href=#dom-context-2d-stroke>stroke</a></code>(<var>path</var>)<dd>
- <p>Strokes the subpaths of the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-5>current default path</a> or the given path with the
- current stroke style.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-drawsystemfocusring><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var>element</var>)<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-drawsystemfocusring-2><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing</a></code>(<var>path</var>, <var>element</var>)<dd>
- <p>If the given element is <a href=#focused id=drawing-paths-to-the-canvas:focused>focused</a>, draws a focus ring around the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-6>current
- default path</a> or the given path, following the platform conventions for focus rings.</p>
- <dt><var>shouldDraw</var> = <var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-drawcustomfocusring><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var>element</var>)<dt><var>shouldDraw</var> = <var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-drawcustomfocusring-2><a href=#dom-context-2d-drawcustomfocusring>drawCustomFocusRing</a></code>(<var>path</var>, <var>element</var>)<dd>
- <p>If the given element is <a href=#focused id=drawing-paths-to-the-canvas:focused-2>focused</a>, and the user has configured his system to draw
- focus rings in a particular manner (for example, high contrast focus rings), draws a focus ring
- around the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-7>current default path</a> or the given path and returns false.</p>
- <p>Otherwise, returns true if the given element is <a href=#focused id=drawing-paths-to-the-canvas:focused-3>focused</a>, and false otherwise.
- This can thus be used to determine when to draw a focus ring (see <a href=#drawCustomFocusRingExample>the example</a> below).</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-scrollpathintoview><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>()<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-scrollpathintoview-2><a href=#dom-context-2d-scrollpathintoview>scrollPathIntoView</a></code>(<var>path</var>)<dd>
- <p>Scrolls the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-8>current default path</a> or the given path into view. This is especially
- useful on devices with small screens, where the whole canvas might not be visible at once.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-clip><a href=#dom-context-2d-clip>clip</a></code>( [ <var>fillRule</var> ] )<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-clip-2><a href=#dom-context-2d-clip>clip</a></code>(<var>path</var> [, <var>fillRule</var> ] )<dd>
- <p>Further constrains the clipping region to the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-9>current default path</a> or the given
- path, using the given fill rule to determine what points are in the path.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-resetclip><a href=#dom-context-2d-resetclip>resetClip</a></code>()<dd>
- <p>Unconstrains the clipping region.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-ispointinpath><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var>x</var>, <var>y</var> [, <var>fillRule</var> ] )<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-ispointinpath-2><a href=#dom-context-2d-ispointinpath>isPointInPath</a></code>(<var>path</var>, <var>x</var>, <var>y</var> [, <var>fillRule</var> ] )<dd>
- <p>Returns true if the given point is in the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-10>current default path</a> or the given
- path, using the given fill rule to determine what points are in the path.</p>
- <dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-ispointinstroke><a href=#dom-context-2d-ispointinstroke>isPointInStroke</a></code>(<var>x</var>, <var>y</var>)<dt><var>context</var> . <code id=drawing-paths-to-the-canvas:dom-context-2d-ispointinstroke-2><a href=#dom-context-2d-ispointinstroke>isPointInStroke</a></code>(<var>path</var>, <var>x</var>, <var>y</var>)<dd>
- <p>Returns true if the given point would be in the region covered by the stroke of the
- <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-11>current default path</a> or the given path, given the current stroke style.</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-beginpath><code>beginPath()</code></dfn> method must empty the
- list of subpaths in the context's <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-12>current default path</a> so that the it once again has
- zero subpaths.</p>
- <p>Where the following method definitions use the term <i>intended path</i>, it means the
- <code id=drawing-paths-to-the-canvas:path2d><a href=#path2d>Path2D</a></code> argument, if one was provided, or the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-13>current default path</a>
- otherwise.</p>
- <p>When the intended path is a <code id=drawing-paths-to-the-canvas:path2d-2><a href=#path2d>Path2D</a></code> object, the coordinates and lines of its
- subpaths must be transformed according to the <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#transformations id=drawing-paths-to-the-canvas:transformations>current transformation matrix</a> when used by these
- methods (without affecting the <code id=drawing-paths-to-the-canvas:path2d-3><a href=#path2d>Path2D</a></code> object itself). When the intended path is the
- <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-14>current default path</a>, it is not affected by the transform. (This is because
- transformations already affect the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-15>current default path</a> when it is constructed, so
- applying it when it is painted as well would result in a double transformation.)</p>
- <p>The <dfn id=dom-context-2d-fill><code>fill()</code></dfn> method must fill all the
- subpaths of the intended path, using <code id=drawing-paths-to-the-canvas:dom-context-2d-fillstyle><a href=#dom-context-2d-fillstyle>fillStyle</a></code>, and
- using the <a href=#fill-rule id=drawing-paths-to-the-canvas:fill-rule>fill rule</a> indicated by the <var>fillRule</var> argument. Open
- subpaths must be implicitly closed when being filled (without affecting the actual subpaths).</p>
- <p>The <dfn id=dom-context-2d-stroke><code>stroke()</code></dfn> method must <a href=#trace-a-path id=drawing-paths-to-the-canvas:trace-a-path>trace</a> the intended path, using the
- <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object for the line styles, and then fill the resulting path
- using the <code id=drawing-paths-to-the-canvas:dom-context-2d-strokestyle><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute, using the <a href=#dom-context-2d-fillrule-nonzero id=drawing-paths-to-the-canvas:dom-context-2d-fillrule-nonzero>non-zero winding rule</a>.</p>
- <p class=note>As a result of how the algorithm to <a href=#trace-a-path id=drawing-paths-to-the-canvas:trace-a-path-2>trace a path</a> is defined,
- overlapping parts of the paths in one stroke operation are treated as if their union was what was
- painted.</p>
- <p class=note>The stroke <em>style</em> is affected by the transformation during painting, even
- if the intended path is the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-16>current default path</a>.</p>
- <p>Paths, when filled or stroked, must be painted without affecting the <a href=#current-default-path id=drawing-paths-to-the-canvas:current-default-path-17>current default
- path</a> or any <code id=drawing-paths-to-the-canvas:path2d-4><a href=#path2d>Path2D</a></code> objects, and must be subject to <a href=#shadows id=drawing-paths-to-the-canvas:shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha id=drawing-paths-to-the-canvas:dom-context-2d-globalalpha>global
- alpha</a>, the <a href=#clipping-region id=drawing-paths-to-the-canvas:clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation id=drawing-paths-to-the-canvas:dom-context-2d-globalcompositeoperation>global composition operators</a>. (The effect
- of transformations is described above and varies based on which path is being used.)</p>
- <hr>
- <p id=dom-context-2d-drawosfocusring>The <dfn id=dom-context-2d-drawsystemfocusring><code>drawSystemFocusRing(<var>element</var>)</code></dfn> method, when invoked, must run the following steps:</p>
- <ol><li><p>If <var>element</var> is not <a href=#focused id=drawing-paths-to-the-canvas:focused-4>focused</a> or is not a descendant of the element with
- whose context the method is associated, then abort these steps.<li>
- <p>If the user has requested the use of particular focus rings (e.g. high-contrast focus rings),
- or if the <var>element</var> would have a focus ring drawn around it, then draw a focus
- ring of the appropriate style along the intended path, following platform conventions.</p>
- <p class=note>Some platforms only draw focus rings around elements that have been focused from
- the keyboard, and not those focused from the mouse. Other platforms simply don't draw focus
- rings around some elements at all unless relevant accessibility features are enabled. This API
- is intended to follow these conventions. User agents that implement distinctions based on the
- manner in which the element was focused are encouraged to classify focus driven by the <code id=drawing-paths-to-the-canvas:dom-focus><a href=#dom-focus>focus()</a></code> method based on the kind of user interaction event from which
- the call was triggered (if any).</p>
- <p>The focus ring should not be subject to the <a href=#shadows id=drawing-paths-to-the-canvas:shadows-2>shadow effects</a>, the
- <a href=#dom-context-2d-globalalpha id=drawing-paths-to-the-canvas:dom-context-2d-globalalpha-2>global alpha</a>, the <a href=#dom-context-2d-globalcompositeoperation id=drawing-paths-to-the-canvas:dom-context-2d-globalcompositeoperation-2>global composition operators</a>, the <code id=drawing-paths-to-the-canvas:dom-context-2d-fillstyle-2><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute, the <code id=drawing-paths-to-the-canvas:dom-context-2d-strokestyle-2><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute, or any of the
- <code id=drawing-paths-to-the-canvas:canvasdrawingstyles><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> members, but <em>should</em> be subject to the <a href=#clipping-region id=drawing-paths-to-the-canvas:clipping-region-2>clipping
- region</a>. (The effect of transformations is described above and varies based on which path
- is being used.)</p>
- <li>
- <p>Optionally, run the appropriate step from the following list:</p>
- <dl><dt>If the <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=drawing-paths-to-the-canvas:concept-canvas-context-bitmap-mode>context bitmap mode</a> is <a href=#concept-canvas-fixed id=drawing-paths-to-the-canvas:concept-canvas-fixed>fixed</a><dd><p><a href=#inform>Inform the user</a> that the focus is at the location given by the
- intended path. User agents may wait until the next time the <a href=#event-loop id=drawing-paths-to-the-canvas:event-loop>event loop</a> reaches its
- <i>update the rendering</i> step to optionally inform the user.<dt>Otherwise<dd><p>Add instructions to the <a href=#scratch-bitmap id=drawing-paths-to-the-canvas:scratch-bitmap>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=drawing-paths-to-the-canvas:list-of-pending-interface-actions>list of pending interface
- actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
- the bitmap given by the intended path.</dl>
- </ol>
- <p>The <dfn id=dom-context-2d-drawcustomfocusring><code>drawCustomFocusRing(<var>element</var>)</code></dfn> method, when invoked, must run the following steps:</p>
- <ol><li><p>If <var>element</var> is not <a href=#focused id=drawing-paths-to-the-canvas:focused-5>focused</a> or is not a descendant of the element with
- whose context the method is associated, then return false and abort these steps.<li><p>Let <var>result</var> be true.<li>
- <p>If the user has requested the use of particular focus rings (e.g. high-contrast focus rings),
- then draw a focus ring of the appropriate style along the intended path, and set <var>result</var> to false.</p>
- <p>The focus ring should not be subject to the <a href=#shadows id=drawing-paths-to-the-canvas:shadows-3>shadow effects</a>, the
- <a href=#dom-context-2d-globalalpha id=drawing-paths-to-the-canvas:dom-context-2d-globalalpha-3>global alpha</a>, the <a href=#dom-context-2d-globalcompositeoperation id=drawing-paths-to-the-canvas:dom-context-2d-globalcompositeoperation-3>global composition operators</a>, the <code id=drawing-paths-to-the-canvas:dom-context-2d-fillstyle-3><a href=#dom-context-2d-fillstyle>fillStyle</a></code> attribute, the <code id=drawing-paths-to-the-canvas:dom-context-2d-strokestyle-3><a href=#dom-context-2d-strokestyle>strokeStyle</a></code> attribute, or any of the
- <code id=drawing-paths-to-the-canvas:canvasdrawingstyles-2><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code> members, but <em>should</em> be subject to the <a href=#clipping-region id=drawing-paths-to-the-canvas:clipping-region-3>clipping
- region</a>. (The effect of transformations is described above and varies based on which path
- is being used.)</p>
- <li>
- <p>Optionally, run the appropriate step from the following list:</p>
- <dl><dt>If the <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=drawing-paths-to-the-canvas:concept-canvas-context-bitmap-mode-2>context bitmap mode</a> is <a href=#concept-canvas-fixed id=drawing-paths-to-the-canvas:concept-canvas-fixed-2>fixed</a><dd><p><a href=#inform>Inform the user</a> that the focus is at the location given by the
- intended path. The user agent may wait until the next time the <a href=#event-loop id=drawing-paths-to-the-canvas:event-loop-2>event loop</a> reaches
- its <i>update the rendering</i> step to optionally inform the user.<dt>Otherwise<dd><p>Add instructions to the <a href=#scratch-bitmap id=drawing-paths-to-the-canvas:scratch-bitmap-2>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=drawing-paths-to-the-canvas:list-of-pending-interface-actions-2>list of pending interface
- actions</a> that <a href=#inform>inform the user</a> that the focus is at the location of
- the bitmap given by the intended path.</dl>
- <li><p>Return <var>result</var>.</ol>
- <p>User agents should not implicitly close open subpaths in the intended path when drawing the
- focus ring.</p>
- <p class=note>This might be a moot point, however. For example, if the focus ring is drawn as an
- axis-aligned bounding rectangle around the points in the intended path, then whether the subpaths
- are closed or not has no effect. This specification intentionally does not specify precisely how
- focus rings are to be drawn: user agents are expected to honor their platform's native
- conventions.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-scrollpathintoview><code>scrollPathIntoView()</code></dfn>
- method, when invoked, if the <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=drawing-paths-to-the-canvas:concept-canvas-context-bitmap-mode-3>context bitmap mode</a> is <a href=#concept-canvas-fixed id=drawing-paths-to-the-canvas:concept-canvas-fixed-3>fixed</a>, must run the following steps; and otherwise, must add
- instructions to the <a href=#scratch-bitmap id=drawing-paths-to-the-canvas:scratch-bitmap-3>scratch bitmap</a>'s <a href=#list-of-pending-interface-actions id=drawing-paths-to-the-canvas:list-of-pending-interface-actions-3>list of pending interface actions</a>
- that run the following steps:</p>
- <ol><li><p>Let <var>the specified rectangle</var> be the rectangle of the bounding box of
- the intended path.<li><p>Let <var>notional child</var> be a hypothetical element that is a rendered child
- of the <code id=drawing-paths-to-the-canvas:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element whose dimensions are those of <var>the specified
- rectangle</var>.<li><p><a href=#scroll-an-element-into-view id=drawing-paths-to-the-canvas:scroll-an-element-into-view>Scroll <var>notional child</var> into
- view</a> with the <var>align to top flag</var> set.</p>
- <li><p>Optionally, <a href=#inform>inform the user</a> that the caret or selection (or both)
- cover <var>the specified rectangle</var> of the canvas. If the
- <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#concept-canvas-context-bitmap-mode id=drawing-paths-to-the-canvas:concept-canvas-context-bitmap-mode-4>context bitmap mode</a> was <a href=#concept-canvas-fixed id=drawing-paths-to-the-canvas:concept-canvas-fixed-4>fixed</a> when the method was invoked, the user agent may wait
- until the next time the <a href=#event-loop id=drawing-paths-to-the-canvas:event-loop-3>event loop</a> reaches its <i>update the rendering</i> step to
- optionally inform the user.</ol>
- <p id=inform>"Inform the user", as used in this section, does not imply any persistent state
- change. It could mean, for instance, calling a system accessibility API to notify assistive
- technologies such as magnification tools so that the user's magnifier moves to the given area of
- the canvas. However, it does not associate the path with the element, or provide a region for
- tactile feedback, etc. To persistently associate a region with information provided to
- accessibility tools, use the <code id=drawing-paths-to-the-canvas:dom-context-2d-addhitregion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>
- API.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-clip><code>clip()</code></dfn> method must create a new
- <dfn id=clipping-region>clipping region</dfn> by calculating the intersection of the current clipping region and the
- area described by the intended path, using the <a href=#fill-rule id=drawing-paths-to-the-canvas:fill-rule-2>fill rule</a> indicated by the <var>fillRule</var> argument. Open subpaths must be implicitly closed when computing the
- clipping region, without affecting the actual subpaths. The new clipping region replaces the
- current clipping region.</p>
- <p>When the context is initialized, the clipping region must be set to the largest infinite
- surface (i.e. by default, no clipping occurs).</p>
-
- <p>The <dfn id=dom-context-2d-resetclip><code>resetClip()</code></dfn> method must create a
- new <a href=#clipping-region id=drawing-paths-to-the-canvas:clipping-region-4>clipping region</a> that is the largest infinite surface. The new clipping region
- replaces the current clipping region.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-ispointinpath><code>isPointInPath()</code></dfn> method must
- return true if the point given by the <var>x</var> and <var>y</var> coordinates
- passed to the method, when treated as coordinates in the canvas coordinate space unaffected by the
- current transformation, is inside the intended path as determined by the <a href=#fill-rule id=drawing-paths-to-the-canvas:fill-rule-3>fill rule</a>
- indicated by the <var>fillRule</var> argument; and must return false otherwise. Open
- subpaths must be implicitly closed when computing the area inside the path, without affecting the
- actual subpaths. Points on the path itself must be considered to be inside the path. If either of
- the arguments is infinite or NaN, then the method must return false.</p>
- <hr>
- <p>The <dfn id=dom-context-2d-ispointinstroke><code>isPointInStroke()</code></dfn> method
- must return true if the point given by the <var>x</var> and <var>y</var>
- coordinates passed to the method, when treated as coordinates in the canvas coordinate space
- unaffected by the current transformation, is inside the path that results from <a href=#trace-a-path id=drawing-paths-to-the-canvas:trace-a-path-3>tracing</a> the intended path, using the <a href=#dom-context-2d-fillrule-nonzero id=drawing-paths-to-the-canvas:dom-context-2d-fillrule-nonzero-2>non-zero winding rule</a>, and using the
- <code id=drawing-paths-to-the-canvas:canvasrenderingcontext2d-7><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object for the line styles; and must return false otherwise.
- Points on the resulting path must be considered to be inside the path. If either of the arguments
- is infinite or NaN, then the method must return false.</p>
- <hr>
-
- <div id=drawCustomFocusRingExample class=example>
- <p>This <code id=drawing-paths-to-the-canvas:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element has a couple of checkboxes. The path-related commands are
- highlighted:</p>
- <pre><canvas height=400 width=750>
- <label><input type=checkbox id=showA> Show As</label>
- <label><input type=checkbox id=showB> Show Bs</label>
- <!-- ... -->
- </canvas>
- <script>
- function drawCheckbox(context, element, x, y, paint) {
- context.save();
- context.font = '10px sans-serif';
- context.textAlign = 'left';
- context.textBaseline = 'middle';
- var metrics = context.measureText(element.labels[0].textContent);
- if (paint) {
- <strong> context.beginPath();
- context.strokeStyle = 'black';
- context.rect(x-5, y-5, 10, 10);
- context.stroke();
- context.addHitRegion({ control: element });
- </strong> if (element.checked) {
- <strong> context.fillStyle = 'black';
- context.fill();
- </strong> }
- context.fillText(element.labels[0].textContent, x+5, y);
- }
- <strong> context.beginPath();
- context.rect(x-7, y-7, 12 + metrics.width+2, 14);
- if (paint && context.drawCustomFocusRing(element)) {
- context.strokeStyle = 'silver';
- context.stroke();
- }
- </strong> context.restore();
- }
- function drawBase() { /* ... */ }
- function drawAs() { /* ... */ }
- function drawBs() { /* ... */ }
- function redraw() {
- var canvas = document.getElementsByTagName('canvas')[0];
- var context = canvas.getContext('2d');
- context.clearRect(0, 0, canvas.width, canvas.height);
- drawCheckbox(context, document.getElementById('showA'), 20, 40, true);
- drawCheckbox(context, document.getElementById('showB'), 20, 60, true);
- drawBase();
- if (document.getElementById('showA').checked)
- drawAs();
- if (document.getElementById('showB').checked)
- drawBs();
- }
- function processClick(event) {
- var canvas = document.getElementsByTagName('canvas')[0];
- var context = canvas.getContext('2d');
- var x = event.clientX;
- var y = event.clientY;
- var node = event.target;
- while (node) {
- x -= node.offsetLeft - node.scrollLeft;
- y -= node.offsetTop - node.scrollTop;
- node = node.offsetParent;
- }
- drawCheckbox(context, document.getElementById('showA'), 20, 40, false);
- if (<strong>context.isPointInPath(x, y)</strong>)
- document.getElementById('showA').checked = !(document.getElementById('showA').checked);
- drawCheckbox(context, document.getElementById('showB'), 20, 60, false);
- if (<strong>context.isPointInPath(x, y)</strong>)
- document.getElementById('showB').checked = !(document.getElementById('showB').checked);
- redraw();
- }
- document.getElementsByTagName('canvas')[0].addEventListener('focus', redraw, true);
- document.getElementsByTagName('canvas')[0].addEventListener('blur', redraw, true);
- document.getElementsByTagName('canvas')[0].addEventListener('change', redraw, true);
- document.getElementsByTagName('canvas')[0].addEventListener('click', processClick, false);
- redraw();
- </script></pre>
- </div>
- <h6 id=drawing-images>4.12.4.2.14 Drawing images</h6>
- <p>To draw images, the <dfn id=dom-context-2d-drawimage><code>drawImage</code></dfn> method
- can be used.</p>
-
- <p>This method can be invoked with three different sets of arguments:</p>
- <ul class=brief><li><code>drawImage(<var>image</var>, <var>dx</var>, <var>dy</var>)</code>
- <li><code>drawImage(<var>image</var>, <var>dx</var>, <var>dy</var>, <var>dw</var>, <var>dh</var>)</code>
- <li><code>drawImage(<var>image</var>, <var>sx</var>, <var>sy</var>, <var>sw</var>, <var>sh</var>, <var>dx</var>, <var>dy</var>, <var>dw</var>, <var>dh</var>)</code>
- </ul>
-
- <dl class=domintro><dt><var>context</var> . <code id=drawing-images:dom-context-2d-drawimage><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var>image</var>, <var>dx</var>, <var>dy</var>)<dt><var>context</var> . <code id=drawing-images:dom-context-2d-drawimage-2><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var>image</var>, <var>dx</var>, <var>dy</var>, <var>dw</var>, <var>dh</var>)<dt><var>context</var> . <code id=drawing-images:dom-context-2d-drawimage-3><a href=#dom-context-2d-drawimage>drawImage</a></code>(<var>image</var>, <var>sx</var>, <var>sy</var>, <var>sw</var>, <var>sh</var>, <var>dx</var>, <var>dy</var>, <var>dw</var>, <var>dh</var>)<dd>
- <p>Draws the given image onto the canvas. The arguments are
- interpreted as follows:</p>
- <p><img src=http://images.whatwg.org/drawImage.png width=356 alt="The sx and sy parameters give the x and y coordinates of the source rectangle; the sw and sh arguments give the width and height of the source rectangle; the dx and dy give the x and y coordinates of the destination rectangle; and the dw and dh arguments give the width and height of the destination rectangle." height=356></p>
- <p>If the image isn't yet fully decoded, then nothing is drawn. If the image is a canvas with no
- data, throws an <code id=drawing-images:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
- </dl>
-
- <p>When the <code id=drawing-images:dom-context-2d-drawimage-4><a href=#dom-context-2d-drawimage>drawImage()</a></code> method is invoked, the user
- agent must run the following steps:</p>
- <ol><li><p><a href=#check-the-usability-of-the-image-argument id=drawing-images:check-the-usability-of-the-image-argument>Check the usability of the <var>image</var> argument</a>. If this
- returns <i>aborted</i>, then an exception has been thrown and the method doesn't return anything;
- abort these steps. If it returns <i>bad</i>, then abort these steps without drawing anything.
- Otherwise it returns <i>good</i>; continue with these steps.<li>
- <p>Establish the source and destination rectangles as follows:</p>
- <p>If not specified, the <var>dw</var> and <var>dh</var> arguments must default to the values of
- <var>sw</var> and <var>sh</var>, interpreted such that one CSS pixel in the image is treated as
- one unit in the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap>scratch bitmap</a>'s coordinate space. If the <var>sx</var>,
- <var>sy</var>, <var>sw</var>, and <var>sh</var> arguments are omitted, they must default to 0,
- 0, the image's intrinsic width in image pixels, and the image's intrinsic height in image
- pixels, respectively. If the image has no intrinsic dimensions, the <i>concrete object size</i>
- must be used instead, as determined using the CSS "<a href=http://dev.w3.org/csswg/css3-images/#default-sizing>Concrete Object Size Resolution</a>"
- algorithm, with the <i>specified size</i> having neither a definite width nor height, nor any
- additional contraints, the object's intrinsic properties being those of the <var>image</var>
- argument, and the <a href=#default-object-size id=drawing-images:default-object-size>default object size</a> being the size of the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-2>scratch
- bitmap</a>. <a href=#refsCSSIMAGES>[CSSIMAGES]</a></p>
- <p>The source rectangle is the rectangle whose corners are the four points (<var>sx</var>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>, <span><var>sy</var>+<var>sh</var></span>),
- (<var>sx</var>, <span><var>sy</var>+<var>sh</var></span>).</p>
- <p>The destination rectangle is the rectangle whose corners are the four points (<var>dx</var>, <var>dy</var>), (<span><var>dx</var>+<var>dw</var></span>, <var>dy</var>), (<span><var>dx</var>+<var>dw</var></span>, <span><var>dy</var>+<var>dh</var></span>),
- (<var>dx</var>, <span><var>dy</var>+<var>dh</var></span>).</p>
- <p>When the source rectangle is outside the source image, the source rectangle must be clipped
- to the source image and the destination rectangle must be clipped in the same proportion.</p>
- <p class=note>When the destination rectangle is outside the destination image (the
- <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-3>scratch bitmap</a>), the pixels that land outside the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-4>scratch bitmap</a> are
- discarded, as if the destination was an infinite canvas whose rendering was clipped to the
- dimensions of the <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-5>scratch bitmap</a>.</p>
- <li><p>If one of the <var>sw</var> or <var>sh</var> arguments is zero, abort
- these steps. Nothing is painted.<li>
- <p>Paint the region of the <var>image</var> argument specified by the source rectangle
- on the region of the rendering context's <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-6>scratch bitmap</a> specified by the
- destination rectangle, after applying the <a href=#transformations id=drawing-images:transformations>current
- transformation matrix</a> to the destination rectangle.</p>
- <p>The image data must be processed in the original direction, even if the dimensions given are
- negative. </p>
- <p>When scaling up, if the <code id=drawing-images:dom-context-2d-imagesmoothingenabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> attribute is set to
- true, the user agent should attempt to apply a smoothing algorithm to the image data when it is
- scaled. Otherwise, the image must be rendered using nearest-neighbor interpolation.</p>
- <p class=note>This specification does not define the precise algorithm to use when scaling an
- image down, or when scaling an image up when the <code id=drawing-images:dom-context-2d-imagesmoothingenabled-2><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> attribute is set to
- true.</p>
- <p class=note>When a <code id=drawing-images:the-canvas-element><a href=#the-canvas-element>canvas</a></code> or <code id=drawing-images:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is
- drawn onto itself, the <a href=#drawing-model id=drawing-images:drawing-model>drawing model</a> requires the source to be copied before the
- image is drawn, so it is possible to copy parts of a <code id=drawing-images:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> or <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-7>scratch
- bitmap</a> onto overlapping parts of itself.</p>
- <p>If the original image data is a bitmap image, the value painted at a point in the destination
- rectangle is computed by filtering the original image data. The user agent may use any filtering
- algorithm (for example bilinear interpolation or nearest-neighbor). When the filtering algorithm
- requires a pixel value from outside the original image data, it must instead use the value from
- the nearest edge pixel. (That is, the filter uses 'clamp-to-edge' behavior.) When the filtering
- algorithm requires a pixel value from outside the source rectangle but inside the original image
- data, then the value from the original image data must be used.</p>
-
-
- <p class=note>Thus, scaling an image in parts or in whole will have the same effect. This does
- mean that when sprites coming from a single sprite sheet are to be scaled, adjacent images in
- the sprite sheet can interfere. This can be avoided by ensuring each sprite in the sheet is
- surrounded by a border of transparent black, or by copying sprites to be scaled into temporary
- <code id=drawing-images:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> elements and drawing the scaled sprites from there.</p>
- <p>Images are painted without affecting the current path, and are subject to <a href=#shadows id=drawing-images:shadows>shadow effects</a>, <a href=#dom-context-2d-globalalpha id=drawing-images:dom-context-2d-globalalpha>global
- alpha</a>, the <a href=#clipping-region id=drawing-images:clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation id=drawing-images:dom-context-2d-globalcompositeoperation>global composition operators</a>.</p>
- <li><p>If <a href=#the-image-argument-is-not-origin-clean id=drawing-images:the-image-argument-is-not-origin-clean>the <var>image argument</var> is not origin-clean</a>, set the
- <a href=#scratch-bitmap id=drawing-images:scratch-bitmap-8>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=drawing-images:concept-canvas-origin-clean>origin-clean</a> flag
- to false.</ol>
-
- <h6 id=hit-regions>4.12.4.2.15 Hit regions</h6>
- <p>A <dfn id=hit-region-list>hit region list</dfn> is a list of <a href=#hit-region id=hit-regions:hit-region>hit regions</a> for a
- bitmap.</p>
- <p>Each <dfn id=hit-region>hit region</dfn> consists of the following information:</p>
- <ul><li><p>A <dfn id="hit-region's-set-of-pixels">set of pixels</dfn> on the bitmap for which this
- region is responsible.<li><p>A <dfn id="hit-region's-bounding-circumference">bounding circumference</dfn> on the
- bitmap that surrounds the <a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels">hit region's set of pixels</a> as they stood when it was
- created.<li><p>Optionally, a non-empty string representing an <dfn id="hit-region's-id">ID</dfn> for
- distinguishing the region from others.<li><p>Optionally, a reference to another region that acts as the <dfn id="hit-region's-parent">parent</dfn> for this one.<li><p>A count of regions that have this one as their <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent">parent</a>, known as the <dfn id="hit-region's-child-count">hit region's child count</dfn>.<li><p>A <dfn id="hit-region's-cursor-specification">cursor specification</dfn>, in the form
- of either a CSS cursor value, or the string "<code>inherit</code>" meaning that the
- cursor of the <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-2">hit region's parent</a>, if any, or of the <code id=hit-regions:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element, if
- not, is to be used instead.<li>
- <p>Optionally, either a <a href="#hit-region's-control" id="hit-regions:hit-region's-control">control</a>, or an <a href="#hit-region's-unbacked-region-description" id="hit-regions:hit-region's-unbacked-region-description">unbacked region description</a>.</p>
- <p>A <dfn id="hit-region's-control">control</dfn> is a reference to an <code id=hit-regions:element><a href=#element>Element</a></code>
- node, to which, in certain conditions, the user agent will route events, and from which the user
- agent will determine the state of the hit region for the purposes of accessibility tools. (The
- control is ignored when it is not a descendant of the <code id=hit-regions:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element.)</p>
- <p>An <dfn id="hit-region's-unbacked-region-description">unbacked region description</dfn>
- consists of the following:</p>
- <ul class=brief><li><p>Optionally, a <dfn id="hit-region's-label">label</dfn>.</p>
- <li><p>An <dfn id="hit-region's-aria-role">ARIA role</dfn>, which, if the <a href="#hit-region's-unbacked-region-description" id="hit-regions:hit-region's-unbacked-region-description-2">unbacked region description</a> also has a label,
- could be the empty string.</ul>
- </ul>
- <dl class=domintro><dt><var>context</var> . <code id=hit-regions:dom-context-2d-addhitregion><a href=#dom-context-2d-addhitregion>addHitRegion</a></code>(<var>options</var>)<dd>
- <p>Adds a hit region to the bitmap. The argument is an object with the following members:</p>
- <dl><dt><dfn id=dom-hitregionoptions-path><code>path</code></dfn> (default null)<dd>A <code id=hit-regions:path2d><a href=#path2d>Path2D</a></code> object that describes the pixels that form part of the region. If
- this member is not provided or is set to null, the <a href=#current-default-path id=hit-regions:current-default-path>current default path</a> is used
- instead.<dt><dfn id=dom-hitregionoptions-fillrule><code>fillRule</code></dfn> (default "<code id=hit-regions:dom-context-2d-fillrule-nonzero><a href=#dom-context-2d-fillrule-nonzero>nonzero</a></code>")<dd>The <a href=#fill-rule id=hit-regions:fill-rule>fill rule</a> to use when determining which pixels are inside the path.<dt><dfn id=dom-hitregionoptions-id><code>id</code></dfn> (default empty string) <dd>The ID to use for this region. This is used in <code id=hit-regions:mouseevent><a href=#mouseevent>MouseEvent</a></code> events on the
- <code id=hit-regions:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> (<code id=hit-regions:dom-mouseevent-region><a href=#dom-mouseevent-region>event.region</a></code>) and as a way to
- reference this region in later calls to <code id=hit-regions:dom-context-2d-addhitregion-2><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.<dt><dfn id=dom-hitregionoptions-parentid><code>parentID</code></dfn> (default null)<dd>The ID of the parent region, for purposes of navigation by accessibility tools and for
- cursor fallback.<dt><dfn id=dom-hitregionoptions-cursor><code>cursor</code></dfn> (default "<code>inherit</code>")<dd>The cursor to use when the mouse is over this region. The value "<code>inherit</code>" means to use the cursor for the parent region (as specified by the
- <code id=hit-regions:dom-hitregionoptions-parentid><a href=#dom-hitregionoptions-parentid>parentID</a></code> member), if any, or to use the
- <code id=hit-regions:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code> element's cursor if the region has no parent.<dt><dfn id=dom-hitregionoptions-control><code>control</code></dfn> (default null)<dd>An element (that is a descendant of the <code id=hit-regions:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code>) to which events are to be
- routed, and which accessibility tools are to use as a surrogate for describing and interacting
- with this region.<dt><dfn id=dom-hitregionoptions-label><code>label</code></dfn> (default null)<dd>A text label for accessibility tools to use as a description of this region, if there is no
- control.<dt><dfn id=dom-hitregionoptions-role><code>role</code></dfn> (default null)<dd>An ARIA role for accessibility tools to use to determine how to represent this region, if
- there is no control.</dl>
- <p>Hit regions can be used for a variety of purposes:</p>
- <ul><li>With an ID, they can make hit detection easier by having the user agent check which region
- the mouse is over and include the ID in the mouse events.<li>With a control, they can make routing events to DOM elements automatic, allowing e.g.
- clicks on a <code id=hit-regions:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code> to automatically submit a form via a <code id=hit-regions:the-button-element><a href=#the-button-element>button</a></code>
- element.<li>With a label, they can make it easier for users to explore a <code id=hit-regions:the-canvas-element-7><a href=#the-canvas-element>canvas</a></code> without
- seeing it, e.g. by touch on a mobile device.<li>With a cursor, they can make it easier for different regions of the <code id=hit-regions:the-canvas-element-8><a href=#the-canvas-element>canvas</a></code> to
- have different cursors, with the user agent automatically switching between them.</ul>
- <dt><var>context</var> . <code id=hit-regions:dom-context-2d-removehitregion><a href=#dom-context-2d-removehitregion>removeHitRegion</a></code>(<var>id</var>)<dd>
- <p>Removes a hit region (and all its descendants) from the canvas bitmap. The argument is the ID
- of a region added using <code id=hit-regions:dom-context-2d-addhitregion-3><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>.</p>
- <p>The pixels that were covered by this region and its descendants are effectively cleared by
- this operation, leaving the regions non-interactive. In particular, regions that occupied the
- same pixels before the removed regions were added, overlapping them, do not resume their
- previous role.</p>
- <dt><var>context</var> . <code id=hit-regions:dom-context-2d-clearhitregions><a href=#dom-context-2d-clearhitregions>clearHitRegions</a></code>()<dd>
- <p>Removes all hit regions from the canvas bitmap.</p>
- </dl>
-
- <p>A <a href=#hit-region id=hit-regions:hit-region-2>hit region</a> <var>A</var> is an <dfn id=ancestor-region>ancestor region</dfn> of a <a href=#hit-region id=hit-regions:hit-region-3>hit
- region</a> <var>B</var> if <var>B</var> has a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-3">parent</a> and its <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-4">parent</a> is either <var>A</var> or another <a href=#hit-region id=hit-regions:hit-region-4>hit region</a> for which <var>A</var> is an
- <a href=#ancestor-region id=hit-regions:ancestor-region>ancestor region</a>.</p>
- <p><dfn id=the-region-identified-by-the-id>The region identified by the ID</dfn> <var>ID</var> in a bitmap <var>bitmap</var> is the value returned by the following algorithm (which can return a
- <a href=#hit-region id=hit-regions:hit-region-5>hit region</a> or nothing):</p>
- <ol><li><p>If <var>ID</var> is null, return nothing and abort these steps.<li><p>Let <var>list</var> be the <a href=#hit-region-list id=hit-regions:hit-region-list>hit region list</a> associated with <var>bitmap</var>.<li><p>If there is a <a href=#hit-region id=hit-regions:hit-region-6>hit region</a> in <var>list</var> whose <a href="#hit-region's-id" id="hit-regions:hit-region's-id">ID</a> is a <a href=#case-sensitive id=hit-regions:case-sensitive>case-sensitive</a> match for <var>ID</var>, then
- return that <a href=#hit-region id=hit-regions:hit-region-7>hit region</a> and abort these steps.<li><p>Otherwise, return nothing.</ol>
- <p><dfn id=the-region-representing-the-control>The region representing the control</dfn> <var>control</var> for a bitmap <var>bitmap</var> is the value returned by the following algorithm (which can return a
- <a href=#hit-region id=hit-regions:hit-region-8>hit region</a> or nothing):</p>
- <ol><li><p>Let <var>list</var> be the <a href=#hit-region-list id=hit-regions:hit-region-list-2>hit region list</a> associated with <var>bitmap</var>.<li><p>If there is a <a href=#hit-region id=hit-regions:hit-region-9>hit region</a> in <var>list</var> whose <a href="#hit-region's-control" id="hit-regions:hit-region's-control-2">control</a> is <var>control</var>, then return that <a href=#hit-region id=hit-regions:hit-region-10>hit
- region</a> and abort these steps.<li><p>Otherwise, return nothing.</ol>
- <p><dfn id=the-control-represented-by-a-region>The control represented by a region</dfn> <var>region</var> for a
- <code id=hit-regions:the-canvas-element-9><a href=#the-canvas-element>canvas</a></code> element <var>ancestor</var> is the value returned by the following
- algorithm (which can return an element or nothing):</p>
- <ol><li><p>If <var>region</var> has no <a href="#hit-region's-control" id="hit-regions:hit-region's-control-3">control</a>,
- return nothing and abort these steps.<li><p>Let <var>control</var> be <var>region</var>'s <a href="#hit-region's-control" id="hit-regions:hit-region's-control-4">control</a>.<li><p>If <var>control</var> is not a descendant of <var>ancestor</var>, then
- return nothing and abort these steps.<li><p>If <var>control</var> is no longer a <a href=#supported-interactive-canvas-fallback-element id=hit-regions:supported-interactive-canvas-fallback-element>supported interactive canvas fallback
- element</a>, then return nothing and abort these steps.<li><p>Otherwise, return <var>control</var>.</ol>
- <p><dfn id=the-cursor-for-a-hit-region>The cursor for a hit region</dfn> <var>region</var> of a <code id=hit-regions:the-canvas-element-10><a href=#the-canvas-element>canvas</a></code>
- element <var>ancestor</var> is the value returned by the following algorithm:</p>
- <ol><li><p><i>Loop</i>: If <var>region</var> has a <a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification">cursor specification</a> other than "<code>inherit</code>", then
- return that <a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification-2">hit region's cursor specification</a> and abort these steps.<li><p>If <var>region</var> has a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-5">parent</a>, then
- let <var>region</var> be that <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-6">hit region's parent</a>, and return to the step
- labeled <i>loop</i>.<li><p>Otherwise, return the used value of the 'cursor' property for the <code id=hit-regions:the-canvas-element-11><a href=#the-canvas-element>canvas</a></code>
- element, if any; if there isn't one, return 'auto'. <a href=#refsCSSUI>[CSSUI]</a></ol>
- <p><dfn id=the-region-for-a-pixel>The region for a pixel</dfn> <var>pixel</var> on a bitmap <var>bitmap</var> is the value returned by the following algorithm (which can return a
- <a href=#hit-region id=hit-regions:hit-region-11>hit region</a> or nothing):</p>
- <ol><li><p>Let <var>list</var> be the <a href=#hit-region-list id=hit-regions:hit-region-list-3>hit region list</a> associated with <var>bitmap</var>.<li><p>If there is a <a href=#hit-region id=hit-regions:hit-region-12>hit region</a> in <var>list</var> whose <a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels-2">set of pixels</a> contains <var>pixel</var>, then return that
- <a href=#hit-region id=hit-regions:hit-region-13>hit region</a> and abort these steps.<li><p>Otherwise, return nothing.</ol>
- <p>To <dfn id=clear-regions-that-cover-the-pixels>clear regions that cover the pixels</dfn> <var>pixels</var> on a bitmap <var>bitmap</var>, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>list</var> be the <a href=#hit-region-list id=hit-regions:hit-region-list-4>hit region list</a> associated with <var>bitmap</var>.<li><p>Remove all pixels in <var>pixels</var> from the <a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels-3">set of pixels</a> of each <a href=#hit-region id=hit-regions:hit-region-14>hit region</a> in <var>list</var>.<li><p><a href=#garbage-collect-the-regions id=hit-regions:garbage-collect-the-regions>Garbage-collect the regions</a> of <var>bitmap</var>.</ol>
- <p>To <dfn id=garbage-collect-the-regions>garbage-collect the regions</dfn> of a bitmap <var>bitmap</var>, the user
- agent must run the following steps:</p>
- <ol><li><p>Let <var>list</var> be the <a href=#hit-region-list id=hit-regions:hit-region-list-5>hit region list</a> associated with <var>bitmap</var>.<li><p><i>Loop</i>: Let <var>victim</var> be the first <a href=#hit-region id=hit-regions:hit-region-15>hit region</a> in <var>list</var> to have an empty <a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels-4">set of
- pixels</a> and a zero <a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count">child count</a>, if any. If
- there is no such <a href=#hit-region id=hit-regions:hit-region-16>hit region</a>, abort these steps.<li><p>If <var>victim</var> has a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-7">parent</a>, then
- decrement that <a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-2">hit region's child count</a> by one.<li><p>Remove <var>victim</var> from <var>list</var>.<li><p>Jump back to the step labeled <i>loop</i>.</ol>
- <p class=note>Adding a new region and calling <code id=hit-regions:dom-context-2d-clearrect><a href=#dom-context-2d-clearrect>clearRect()</a></code> are the two ways this clearing algorithm can
- be invoked. The <a href=#hit-region-list id=hit-regions:hit-region-list-6>hit region list</a> itself is also reset when the rendering context is
- reset, e.g. when a <code id=hit-regions:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is bound to or unbound from a
- <code id=hit-regions:the-canvas-element-12><a href=#the-canvas-element>canvas</a></code>, or when the dimensions of the bitmap are changed.</p>
- <hr>
- <p>An element is a <dfn id=supported-interactive-canvas-fallback-element>supported interactive canvas fallback element</dfn> if it is one of the
- following:</p>
- <ul class=brief><li><p>an <code id=hit-regions:the-a-element><a href=#the-a-element>a</a></code> element that <a href=#represents id=hit-regions:represents>represents</a> a
- <a href=#hyperlink id=hit-regions:hyperlink>hyperlink</a> and that does not have any <code id=hit-regions:the-img-element><a href=#the-img-element>img</a></code> descendants<li><p>a <code id=hit-regions:the-button-element-2><a href=#the-button-element>button</a></code> element<li><p>an <code id=hit-regions:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=hit-regions:attr-input-type><a href=#attr-input-type>type</a></code>
- attribute is in one of the <a href="#checkbox-state-(type=checkbox)" id="hit-regions:checkbox-state-(type=checkbox)">Checkbox</a> or <a href="#radio-button-state-(type=radio)" id="hit-regions:radio-button-state-(type=radio)">Radio Button</a> states<li><p>an <code id=hit-regions:the-input-element-2><a href=#the-input-element>input</a></code> element that is a <a href=#concept-button id=hit-regions:concept-button>button</a> but
- its <code id=hit-regions:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is not in the <a href="#image-button-state-(type=image)" id="hit-regions:image-button-state-(type=image)">Image Button</a> state<li><p>a <code id=hit-regions:the-select-element><a href=#the-select-element>select</a></code> element with a <code id=hit-regions:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute or a <a href=#concept-select-size id=hit-regions:concept-select-size>display size</a> greater than 1<li><p>an <code id=hit-regions:the-option-element><a href=#the-option-element>option</a></code> element that is in a <a href=#concept-select-option-list id=hit-regions:concept-select-option-list>list of options</a> of a <code id=hit-regions:the-select-element-2><a href=#the-select-element>select</a></code> element
- with a <code id=hit-regions:attr-select-multiple-2><a href=#attr-select-multiple>multiple</a></code> attribute or a <a href=#concept-select-size id=hit-regions:concept-select-size-2>display size</a> greater than 1<li><p>a <a href=#sorting-interface-th-element id=hit-regions:sorting-interface-th-element>sorting interface <code>th</code> element</a><li><p>an element that would not be <a href=#interactive-content-2 id=hit-regions:interactive-content-2>interactive content</a> except for having the
- <code id=hit-regions:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute specified<li><p>a non-<a href=#interactive-content-2 id=hit-regions:interactive-content-2-2>interactive</a> <code id=hit-regions:the-table-element><a href=#the-table-element>table</a></code>,
- <code id=hit-regions:the-caption-element><a href=#the-caption-element>caption</a></code>, <code id=hit-regions:the-thead-element><a href=#the-thead-element>thead</a></code>, <code id=hit-regions:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=hit-regions:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=hit-regions:the-tr-element><a href=#the-tr-element>tr</a></code>, <code id=hit-regions:the-td-element><a href=#the-td-element>td</a></code>, or <code id=hit-regions:the-th-element><a href=#the-th-element>th</a></code> element</ul>
- <hr>
- <p>When the <dfn id=dom-context-2d-addhitregion><code>addHitRegion()</code></dfn> method is
- invoked, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>arguments</var> be the dictionary object provided as the method's
- argument.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-path><a href=#dom-hitregionoptions-path>path</a></code> member is not null, let <var>source
- path</var> be the <code id=hit-regions:dom-hitregionoptions-path-2><a href=#dom-hitregionoptions-path>path</a></code> member's value. Otherwise,
- let it be the <code id=hit-regions:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#current-default-path id=hit-regions:current-default-path-2>current default
- path</a>.<li><p>Transform all the coordinates and lines in <var>source path</var> by the current
- transform matrix, if the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-path-3><a href=#dom-hitregionoptions-path>path</a></code> member is not null.<li><p>Let <var>specified pixels</var> be the pixels contained in <var>source
- path</var>, using the <a href=#fill-rule id=hit-regions:fill-rule-2>fill rule</a> indicated by the <code id=hit-regions:dom-hitregionoptions-fillrule><a href=#dom-hitregionoptions-fillrule>fillRule</a></code> member.<li><p>Remove from <var>specified pixels</var> any pixels not contained within the
- <a href=#clipping-region id=hit-regions:clipping-region>clipping region</a>.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-id><a href=#dom-hitregionoptions-id>id</a></code> member is the empty string, let it be null
- instead.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-id-2><a href=#dom-hitregionoptions-id>id</a></code> member is not null, then let <var>previous
- region for this ID</var> be <a href=#the-region-identified-by-the-id id=hit-regions:the-region-identified-by-the-id>the region identified by the ID</a> given by the <code id=hit-regions:dom-hitregionoptions-id-3><a href=#dom-hitregionoptions-id>id</a></code> member's value in this <a href=#scratch-bitmap id=hit-regions:scratch-bitmap>scratch bitmap</a>, if
- any. If the <code id=hit-regions:dom-hitregionoptions-id-4><a href=#dom-hitregionoptions-id>id</a></code> member is null or no such region
- currently exists, let <var>previous region for this ID</var> be null.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-parentid-2><a href=#dom-hitregionoptions-parentid>parentID</a></code> member is the empty string, let it be null
- instead.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-parentid-3><a href=#dom-hitregionoptions-parentid>parentID</a></code> member is not null, then let <var>parent region</var> be <a href=#the-region-identified-by-the-id id=hit-regions:the-region-identified-by-the-id-2>the region identified by the ID</a> given by the <code id=hit-regions:dom-hitregionoptions-parentid-4><a href=#dom-hitregionoptions-parentid>parentID</a></code> member's value in the <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-2>scratch
- bitmap</a>, if any. If the <code id=hit-regions:dom-hitregionoptions-parentid-5><a href=#dom-hitregionoptions-parentid>parentID</a></code> member
- is null or no such region currently exists, let <var>parent region</var> be
- null.<li><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-label><a href=#dom-hitregionoptions-label>label</a></code> member is the empty string, let it be null
- instead.<li>
- <p>If any of the following conditions are met, throw a <code id=hit-regions:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception
- and abort these steps.</p>
- <ul class=brief><li><p>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-control><a href=#dom-hitregionoptions-control>control</a></code> and <code id=hit-regions:dom-hitregionoptions-label-2><a href=#dom-hitregionoptions-label>label</a></code> members are both non-null.<li><p>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-control-2><a href=#dom-hitregionoptions-control>control</a></code> and <code id=hit-regions:dom-hitregionoptions-role><a href=#dom-hitregionoptions-role>role</a></code> members are both non-null.<li><p>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-role-2><a href=#dom-hitregionoptions-role>role</a></code> member's value is the empty string, and the
- <code id=hit-regions:dom-hitregionoptions-label-3><a href=#dom-hitregionoptions-label>label</a></code> member's value is either null or the
- empty string.<li><p>The <var>specified pixels</var> has no pixels.<li><p>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-control-3><a href=#dom-hitregionoptions-control>control</a></code> member is neither null nor a
- <a href=#supported-interactive-canvas-fallback-element id=hit-regions:supported-interactive-canvas-fallback-element-2>supported interactive canvas fallback element</a>.<li><p>The <var>parent region</var> is not null but has a <a href="#hit-region's-control" id="hit-regions:hit-region's-control-5">control</a>.<li><p>The <var>previous region for this ID</var> is the same <a href=#hit-region id=hit-regions:hit-region-17>hit region</a> as
- the <var>parent region</var>.<li><p>The <var>previous region for this ID</var> is an <a href=#ancestor-region id=hit-regions:ancestor-region-2>ancestor region</a>
- of the <var>parent region</var>.</ul>
- <li><p>If the <code id=hit-regions:dom-hitregionoptions-parentid-6><a href=#dom-hitregionoptions-parentid>parentID</a></code> member is not null but
- <var>parent region</var> is null, then throw a <code id=hit-regions:notfounderror><a href=#notfounderror>NotFoundError</a></code> exception and
- abort these steps.<li>
- <p>If any of the following conditions are met, throw a <code id=hit-regions:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and
- abort these steps.</p>
- <ul class=brief><li>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-cursor><a href=#dom-hitregionoptions-cursor>cursor</a></code> member is not null but is neither an
- <a href=#ascii-case-insensitive id=hit-regions:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>inherit</code>", nor a
- valid CSS 'cursor' property value. <a href=#refsCSSUI>[CSSUI]</a><li>The <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-role-3><a href=#dom-hitregionoptions-role>role</a></code> member is not null but its value is not an
- <a href=#ordered-set-of-unique-space-separated-tokens id=hit-regions:ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</a> whose tokens are all
- <a href=#case-sensitive id=hit-regions:case-sensitive-2>case-sensitive</a> matches for names of non-abstract WAI-ARIA roles. <a href=#refsARIA>[ARIA]</a></ul>
- <li>
- <p>Let <var>region</var> be a newly created <a href=#hit-region id=hit-regions:hit-region-18>hit region</a>, with its
- information configured as follows:</p>
- <dl><dt><a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels-5">Hit region's set of pixels</a>
- <dd><p>The <var>specified pixels</var>
- <dt><a href="#hit-region's-bounding-circumference" id="hit-regions:hit-region's-bounding-circumference">Hit region's bounding circumference</a>
- <dd><p>A user-agent-defined shape that wraps the pixels contained in <var>source
- path</var>. (In the simplest case, this can just be the bounding rectangle; this specification
- allows it to be any shape in order to allow other interfaces.)
- <dt><a href="#hit-region's-id" id="hit-regions:hit-region's-id-2">Hit region's ID</a>
- <dd><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-id-5><a href=#dom-hitregionoptions-id>id</a></code> member is not null: the value of the <code id=hit-regions:dom-hitregionoptions-id-6><a href=#dom-hitregionoptions-id>id</a></code> member. Otherwise, <var>region</var> has no
- <a href="#hit-region's-id" id="hit-regions:hit-region's-id-3">id</a>.
- <dt><a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-8">Hit region's parent</a>
- <dd><p>If <var>parent region</var> is not null: <var>parent region</var>.
- Otherwise, <var>region</var> has no <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-9">parent</a>.
- <dt><a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-3">Hit region's child count</a>
- <dd><p>Initially zero.
- <dt><a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification-3">Hit region's cursor specification</a>
- <dd><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-cursor-2><a href=#dom-hitregionoptions-cursor>cursor</a></code> member is not null: the value of the <code id=hit-regions:dom-hitregionoptions-cursor-3><a href=#dom-hitregionoptions-cursor>cursor</a></code> member. Otherwise, the string "<code>inherit</code>".
- <dt><a href="#hit-region's-control" id="hit-regions:hit-region's-control-6">Hit region's control</a>
- <dd><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-control-4><a href=#dom-hitregionoptions-control>control</a></code> member is not null: the value of the <code id=hit-regions:dom-hitregionoptions-control-5><a href=#dom-hitregionoptions-control>control</a></code> member. Otherwise, <var>region</var> has no <a href="#hit-region's-control" id="hit-regions:hit-region's-control-7">control</a>.
- <dt><a href="#hit-region's-label" id="hit-regions:hit-region's-label">Hit region's label</a>
- <dd><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-label-4><a href=#dom-hitregionoptions-label>label</a></code> member is not null: the value of the <code id=hit-regions:dom-hitregionoptions-label-5><a href=#dom-hitregionoptions-label>label</a></code> member. Otherwise, <var>region</var>
- has no <a href="#hit-region's-label" id="hit-regions:hit-region's-label-2">label</a>.
- <dt><a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role">Hit region's ARIA role</a>
- <dd><p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-role-4><a href=#dom-hitregionoptions-role>role</a></code> member is not null: the value of the <code id=hit-regions:dom-hitregionoptions-role-5><a href=#dom-hitregionoptions-role>role</a></code> member (which might be the empty string).
- Otherwise, if the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-label-6><a href=#dom-hitregionoptions-label>label</a></code> member is not null: the empty string.
- Otherwise, <var>region</var> has no <a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role-2">ARIA
- role</a>.
- </dl>
- <li>
- <p>If the <var>arguments</var> object's <code id=hit-regions:dom-hitregionoptions-cursor-4><a href=#dom-hitregionoptions-cursor>cursor</a></code> member is not null, then act as if a CSS rule
- for the <code id=hit-regions:the-canvas-element-13><a href=#the-canvas-element>canvas</a></code> element setting its 'cursor' property had been seen, whose value was
- the <a href="#hit-region's-cursor-specification" id="hit-regions:hit-region's-cursor-specification-4">hit region's cursor specification</a>.</p>
- <p class=note>For example, if the user agent prefetches cursor values, this would cause that
- to happen in response to an appropriately-formed <code id=hit-regions:dom-context-2d-addhitregion-4><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code> call.</p>
- <li><p>If there is a <var>previous region with this ID</var>, remove it, and all <a href=#hit-region id=hit-regions:hit-region-19>hit regions</a> for which it is an <a href=#ancestor-region id=hit-regions:ancestor-region-3>ancestor region</a>, from the
- <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-3>scratch bitmap</a>'s <a href=#hit-region-list id=hit-regions:hit-region-list-7>hit region list</a>; then, if it had a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-10">parent</a> region, decrement that <a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-4">hit region's child count</a> by
- one.<li><p>If there is a <var>parent region</var>, increment its <a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-5">hit region's child
- count</a> by one.<li><p><a href=#clear-regions-that-cover-the-pixels id=hit-regions:clear-regions-that-cover-the-pixels>Clear regions that cover the pixels</a> in <var>region</var>'s <a href="#hit-region's-set-of-pixels" id="hit-regions:hit-region's-set-of-pixels-6">set of pixels</a> on this <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-4>scratch
- bitmap</a>.<li><p>Add <var>region</var> to the <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-5>scratch bitmap</a>'s element's <a href=#hit-region-list id=hit-regions:hit-region-list-8>hit
- region list</a>.</ol>
- <p>When the <dfn id=dom-context-2d-removehitregion><code>removeHitRegion()</code></dfn>
- method is invoked, the user agent must run the following steps:</p>
- <ol><li>
- <p>Let <var>region</var> be <a href=#the-region-identified-by-the-id id=hit-regions:the-region-identified-by-the-id-3>the region identified by the ID</a> given by the
- method's argument in the rendering context's <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-6>scratch bitmap</a>. If no such region
- currently exists, abort these steps.</p>
- <p class=note>If the method's argument is the empty string, then no region will match.</p>
- <li><p>Remove <var>region</var>, and all <a href=#hit-region id=hit-regions:hit-region-20>hit regions</a> for
- which it is an <a href=#ancestor-region id=hit-regions:ancestor-region-4>ancestor region</a>, from the rendering context's <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-7>scratch
- bitmap</a>'s <a href=#hit-region-list id=hit-regions:hit-region-list-9>hit region list</a>; then, if it had a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-11">parent</a> region, decrement that <a href="#hit-region's-child-count" id="hit-regions:hit-region's-child-count-6">hit region's child count</a> by
- one.<li><p><a href=#garbage-collect-the-regions id=hit-regions:garbage-collect-the-regions-2>Garbage-collect the regions</a> of the rendering context's <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-8>scratch
- bitmap</a>.</ol>
- <p>When the <dfn id=dom-context-2d-clearhitregions><code>clearHitRegions()</code></dfn>
- method is invoked, the user agent must remove all the <a href=#hit-region id=hit-regions:hit-region-21>hit regions</a>
- from the rendering context's <a href=#scratch-bitmap id=hit-regions:scratch-bitmap-9>scratch bitmap</a>'s <a href=#hit-region-list id=hit-regions:hit-region-list-10>hit region list</a>.</p>
-
- <hr>
- <p>The <code id=hit-regions:mouseevent-2><a href=#mouseevent>MouseEvent</a></code> interface is extended to support hit regions:</p>
- <pre class=idl>partial interface <a href=#mouseevent id=MouseEvent-partial>MouseEvent</a> {
- readonly attribute DOMString? <a href=#dom-mouseevent-region id=hit-regions:dom-mouseevent-region-2>region</a>;
- };
- partial dictionary <a href=#mouseeventinit id=hit-regions:mouseeventinit>MouseEventInit</a> {
- DOMString? region;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=hit-regions:dom-mouseevent-region-3><a href=#dom-mouseevent-region>region</a></code><dd>
- <p>If the mouse was over a <a href=#hit-region id=hit-regions:hit-region-22>hit region</a>, then this returns the <a href="#hit-region's-id" id="hit-regions:hit-region's-id-4">hit region's
- ID</a>, if it has one.</p>
- <p>Otherwise, returns null.</p>
- </dl>
-
- <p>The <dfn id=dom-mouseevent-region><code>region</code></dfn> attribute on
- <code id=hit-regions:mouseevent-3><a href=#mouseevent>MouseEvent</a></code> objects must return the value it was initialised to. When the object is
- created, this attribute must be initialised to null. It represents the <a href="#hit-region's-id" id="hit-regions:hit-region's-id-5">hit region's
- ID</a> if the mouse was over a hit region when the event was fired.</p>
- <p>When a <code id=hit-regions:mouseevent-4><a href=#mouseevent>MouseEvent</a></code> is to be fired at a <code id=hit-regions:the-canvas-element-14><a href=#the-canvas-element>canvas</a></code> element by the user
- agent in response to a pointing device action other than a click (e.g. a <code id=hit-regions:event-mousedown><a href=#event-mousedown>mousedown</a></code> event or a <code id=hit-regions:event-mousemove><a href=#event-mousemove>mousemove</a></code> event), the user agent must run the <a href=#canvas-mouseevent-rerouting-steps id=hit-regions:canvas-mouseevent-rerouting-steps>canvas
- <code>MouseEvent</code> rerouting steps</a> immediately prior to dispatching the event. This does not affect default actions (so for instance, if the
- event gets rerouted to an element that has a default action for <code id=hit-regions:event-mousemove-2><a href=#event-mousemove>mousemove</a></code> events, this default action doesn't trigger).</p>
- <p class=note>Actual clicks are handled by the <a href=#run-authentic-click-activation-steps id=hit-regions:run-authentic-click-activation-steps>run authentic click activation
- steps</a>, which also invoke these steps.</p>
- <p>The <dfn id=canvas-mouseevent-rerouting-steps>canvas <code>MouseEvent</code> rerouting steps</dfn> are as follows. If these steps
- say to <i>act as normal</i>, that means that the event must be fired as it would have had these
- requirements not been applied.</p>
- <ol><li><p>If the pointing device is not indicating a pixel on the <code id=hit-regions:the-canvas-element-15><a href=#the-canvas-element>canvas</a></code>, then act as
- normal and abort these steps.<li><p>If the <code id=hit-regions:the-canvas-element-16><a href=#the-canvas-element>canvas</a></code> element has no <a href=#hit-region-list id=hit-regions:hit-region-list-11>hit region list</a>, then act as normal
- and abort these steps.<li><p>Let <var>pixel</var> be the pixel indicated by the pointing device.<li><p>Let <var>region</var> be the <a href=#hit-region id=hit-regions:hit-region-23>hit region</a> that is <a href=#the-region-for-a-pixel id=hit-regions:the-region-for-a-pixel>the region for the pixel</a> <var>pixel</var> on this
- <code id=hit-regions:the-canvas-element-17><a href=#the-canvas-element>canvas</a></code> element's bitmap, if any.<li><p>If there is no <var>region</var>, then act as normal and abort these
- steps.<li><p>Let <var>id</var> be the <var>region</var>'s <a href="#hit-region's-id" id="hit-regions:hit-region's-id-6">ID</a>, if any.<li><p>If there is an <var>id</var>, then initialise the event object's <code id=hit-regions:dom-mouseevent-region-4><a href=#dom-mouseevent-region>region</a></code> attribute to <var>id</var>.<li><p>Let <var>control</var> be the <a href=#the-control-represented-by-a-region id=hit-regions:the-control-represented-by-a-region>control represented by</a> <var>region</var> for this <code id=hit-regions:the-canvas-element-18><a href=#the-canvas-element>canvas</a></code>
- element, if any.<li><p>If there is a <var>control</var>, then target the event object at <var>control</var> instead of the <code id=hit-regions:the-canvas-element-19><a href=#the-canvas-element>canvas</a></code> element.<li><p>Continue dispatching the event, but with the updated event object and target as given in
- the above steps.</ol>
- <hr>
-
- <p>The <code id=hit-regions:touch><a href=#touch>Touch</a></code> interface is extended to support hit regions also: <a href=#refsTOUCH>[TOUCH]</a></p>
- <pre class=idl>partial interface <a href=#touch id=Touch-partial>Touch</a> {
- readonly attribute DOMString? <a href=#dom-touch-region id=hit-regions:dom-touch-region>region</a>;
- };</pre>
- <dl class=domintro><dt><var>touch</var> . <code id=hit-regions:dom-touch-region-2><a href=#dom-touch-region>region</a></code><dd>
- <p>If the <a href=#touch-point id=hit-regions:touch-point>touch point</a> was over a <a href=#hit-region id=hit-regions:hit-region-24>hit region</a> when it was first placed
- on the surface, then this returns the <a href="#hit-region's-id" id="hit-regions:hit-region's-id-7">hit region's ID</a>, if it has one.</p>
- <p>Otherwise, returns null.</p>
- </dl>
-
- <p>The <dfn id=dom-touch-region><code>region</code></dfn> attribute on a <code id=hit-regions:touch-2><a href=#touch>Touch</a></code>
- object representing a <a href=#touch-point id=hit-regions:touch-point-2>touch point</a> <var>T</var> must return the value
- obtained by running the following algorithm when <var>T</var> was first placed on the
- surface: <a href=#refsTOUCH>[TOUCH]</a></p>
- <ol><li><p>If the <a href=#touch-point id=hit-regions:touch-point-3>touch point</a> is not on a pixel on the <code id=hit-regions:the-canvas-element-20><a href=#the-canvas-element>canvas</a></code>, then return
- null and abort these steps.<li><p>If the <code id=hit-regions:the-canvas-element-21><a href=#the-canvas-element>canvas</a></code> element has no <a href=#hit-region-list id=hit-regions:hit-region-list-12>hit region list</a>, then return null
- and abort these steps.<li><p>Let <var>pixel</var> be the pixel that the <a href=#touch-point id=hit-regions:touch-point-4>touch point</a> is
- on.<li><p>Let <var>region</var> be the <a href=#hit-region id=hit-regions:hit-region-25>hit region</a> that is <a href=#the-region-for-a-pixel id=hit-regions:the-region-for-a-pixel-2>the region for the pixel</a> <var>pixel</var> on this
- <code id=hit-regions:the-canvas-element-22><a href=#the-canvas-element>canvas</a></code> element's bitmap, if any.<li><p>If there is no <var>region</var>, then return null and abort these
- steps.<li><p>Let <var>id</var> be the <var>region</var>'s <a href="#hit-region's-id" id="hit-regions:hit-region's-id-8">ID</a>, if any, or else null.<li><p>Return <var>id</var>.</ol>
-
-
- <hr>
- <p>When a user's pointing device cursor is positioned over a <code id=hit-regions:the-canvas-element-23><a href=#the-canvas-element>canvas</a></code> element, user
- agents should render the pointing device cursor according to the cursor specification described by
- <a href=#the-cursor-for-a-hit-region id=hit-regions:the-cursor-for-a-hit-region>the cursor for the hit region</a> that is <a href=#the-region-for-a-pixel id=hit-regions:the-region-for-a-pixel-3>the region for the pixel</a> that the pointing device designates
- on the <code id=hit-regions:the-canvas-element-24><a href=#the-canvas-element>canvas</a></code> element's bitmap.</p>
- <hr>
- <p>User agents are encouraged to make use of the information present in a <code id=hit-regions:the-canvas-element-25><a href=#the-canvas-element>canvas</a></code>
- element's <a href=#hit-region-list id=hit-regions:hit-region-list-13>hit region list</a> to improve the accessibility of <code id=hit-regions:the-canvas-element-26><a href=#the-canvas-element>canvas</a></code>
- elements.</p>
- <p>Each <a href=#hit-region id=hit-regions:hit-region-26>hit region</a> should be handled in a fashion equivalent to a node in a virtual
- DOM tree rooted at the <code id=hit-regions:the-canvas-element-27><a href=#the-canvas-element>canvas</a></code> element. The hierarchy of this virtual DOM tree must
- match the hierarchy of the <a href=#hit-region id=hit-regions:hit-region-27>hit regions</a>, as described by the <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-12">parent</a> of each region. Regions without a <a href="#hit-region's-parent" id="hit-regions:hit-region's-parent-13">parent</a> must be treated as children of the <code id=hit-regions:the-canvas-element-28><a href=#the-canvas-element>canvas</a></code> element for
- the purpose of this virtual DOM tree. For each node in such a DOM tree, the <a href="#hit-region's-bounding-circumference" id="hit-regions:hit-region's-bounding-circumference-2">hit region's
- bounding circumference</a> gives the region of the screen to use when representing the node (if
- appropriate).</p>
- <p>The semantics of a <a href=#hit-region id=hit-regions:hit-region-28>hit region</a> for the purposes of this virtual DOM tree are those
- of the <a href=#the-control-represented-by-a-region id=hit-regions:the-control-represented-by-a-region-2>the control represented by the
- region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
- that given by the <a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role-3">hit region's ARIA role</a>, and whose textual representation, if any,
- is given by the <a href="#hit-region's-label" id="hit-regions:hit-region's-label-3">hit region's label</a>.</p>
- <p>For the purposes of accessibility tools, when an element <var>C</var> is a descendant
- of a <code id=hit-regions:the-canvas-element-29><a href=#the-canvas-element>canvas</a></code> element and there is <a href=#the-region-representing-the-control id=hit-regions:the-region-representing-the-control>a
- region representing the control</a> <var>C</var> for that <code id=hit-regions:the-canvas-element-30><a href=#the-canvas-element>canvas</a></code>
- element's bitmap, then the element's position relative to the document should be presented as if
- it was that region in the <code id=hit-regions:the-canvas-element-31><a href=#the-canvas-element>canvas</a></code> element's virtual DOM tree.</p>
- <p>The semantics of a <a href=#hit-region id=hit-regions:hit-region-29>hit region</a> for the purposes of this virtual DOM tree are those
- of the <a href=#the-control-represented-by-a-region id=hit-regions:the-control-represented-by-a-region-3>the control represented by the
- region</a>, if it has one, or else of a non-interactive element whose ARIA role, if any, is
- that given by the <a href="#hit-region's-aria-role" id="hit-regions:hit-region's-aria-role-4">hit region's ARIA role</a>, and whose textual representation, if any,
- is given by the <a href="#hit-region's-label" id="hit-regions:hit-region's-label-4">hit region's label</a>.</p>
- <p class=note>Thus, for instance, a user agent on a touch-screen device could provide haptic
- feedback when the user croses over a <a href="#hit-region's-bounding-circumference" id="hit-regions:hit-region's-bounding-circumference-3">hit region's bounding circumference</a>, and then
- read the <a href="#hit-region's-label" id="hit-regions:hit-region's-label-5">hit region's label</a> to the user. Similarly, a desktop user agent with a
- virtual accessibility focus separate from the keyboard input focus could allow the user to
- navigate through the hit regions, using the virtual DOM tree described above to enable
- hierarchical navigation. When an interactive control inside the <code id=hit-regions:the-canvas-element-32><a href=#the-canvas-element>canvas</a></code> element
- <a href=#gains-focus id=hit-regions:gains-focus>gains focus</a>, if the control has a corresponding region, then that <a href="#hit-region's-bounding-circumference" id="hit-regions:hit-region's-bounding-circumference-4">hit region's
- bounding circumference</a> could be used to determine what area of the display to magnify.</p>
-
- <h6 id=pixel-manipulation>4.12.4.2.16 <dfn>Pixel manipulation</dfn></h6>
- <dl class=domintro><dt><var>imagedata</var> = new <code id=pixel-manipulation:dom-imagedata><a href=#dom-imagedata>ImageData</a></code>(<var>sw</var>, <var>sh</var>)<dt><var>imagedata</var> = <var>context</var> . <code id=pixel-manipulation:dom-context-2d-createimagedata><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var>sw</var>, <var>sh</var>)<dd>
- <p>Returns an <code id=pixel-manipulation:imagedata><a href=#imagedata>ImageData</a></code> object with the given dimensions. All the pixels in the
- returned object are transparent black.</p>
- <p>Throws an <code id=pixel-manipulation:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception if either of the width or height
- arguments are zero.</p>
- <dt><var>imagedata</var> = <var>context</var> . <code id=pixel-manipulation:dom-context-2d-createimagedata-2><a href=#dom-context-2d-createimagedata>createImageData</a></code>(<var>imagedata</var>)<dd>
- <p>Returns an <code id=pixel-manipulation:imagedata-2><a href=#imagedata>ImageData</a></code> object with the same dimensions as the argument. All the
- pixels in the returned object are transparent black.</p>
- <dt><var>imagedata</var> = new <code id=pixel-manipulation:dom-imagedata-2><a href=#dom-imagedata>ImageData</a></code>(<var>data</var>, <var>sw</var> [, <var>sh</var> ] )<dd>
- <p>Returns an <code id=pixel-manipulation:imagedata-3><a href=#imagedata>ImageData</a></code> object using the data provided in the <code id=pixel-manipulation:uint8clampedarray><a href=#uint8clampedarray>Uint8ClampedArray</a></code> argument, interpreted using the given dimensions.</p>
- <p>As each pixel in the data is represented by four numbers, the length of the data needs to be
- a multiple of four times the given width. If the height is provided as well, then the length
- needs to be exactly the width times the height times 4.</p>
- <p>Throws an <code id=pixel-manipulation:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception if the given data and dimensions can't be
- interpreted consistently, or if either dimension is zero.</p>
- <dt><var>imagedata</var> = <var>context</var> . <code id=pixel-manipulation:dom-context-2d-getimagedata><a href=#dom-context-2d-getimagedata>getImageData</a></code>(<var>sx</var>, <var>sy</var>, <var>sw</var>, <var>sh</var>)<dd>
- <p>Returns an <code id=pixel-manipulation:imagedata-4><a href=#imagedata>ImageData</a></code> object containing the image data for the given rectangle of
- the bitmap.</p>
- <p>Throws an <code id=pixel-manipulation:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception if the either of the width or height
- arguments are zero.</p>
- <dt><var>imagedata</var> . <code id=pixel-manipulation:dom-imagedata-width><a href=#dom-imagedata-width>width</a></code><dt><var>imagedata</var> . <code id=pixel-manipulation:dom-imagedata-height><a href=#dom-imagedata-height>height</a></code><dd>
- <p>Returns the actual dimensions of the data in the <code id=pixel-manipulation:imagedata-5><a href=#imagedata>ImageData</a></code> object, in
- pixels.</p>
- <dt><var>imagedata</var> . <code id=pixel-manipulation:dom-imagedata-data><a href=#dom-imagedata-data>data</a></code><dd>
- <p>Returns the one-dimensional array containing the data in RGBA order, as integers in the range
- 0 to 255.</p>
- <dt><var>context</var> . <code id=pixel-manipulation:dom-context-2d-putimagedata><a href=#dom-context-2d-putimagedata>putImageData</a></code>(<var>imagedata</var>, <var>dx</var>, <var>dy</var> [, <var>dirtyX</var>, <var>dirtyY</var>, <var>dirtyWidth</var>, <var>dirtyHeight</var> ] )<dd>
- <p>Paints the data from the given <code id=pixel-manipulation:imagedata-6><a href=#imagedata>ImageData</a></code> object onto the bitmap. If a dirty
- rectangle is provided, only the pixels from that rectangle are painted.</p>
- <p>The <code id=pixel-manipulation:dom-context-2d-globalalpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and <code id=pixel-manipulation:dom-context-2d-globalcompositeoperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> attributes, as
- well as the shadow attributes, are ignored for the purposes of this method call; pixels in the
- canvas are replaced wholesale, with no composition, alpha blending, no shadows, etc.</p>
- <p>Throws a <code id=pixel-manipulation:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception if any of the arguments are not finite.</p>
- <p>Throws an <code id=pixel-manipulation:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <var>imagedata</var>
- object's data has been <a href=#concept-transferable-neutered id=pixel-manipulation:concept-transferable-neutered>neutered</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-imagedata><code>ImageData()</code></dfn> constructors and the <dfn id=dom-context-2d-createimagedata><code>createImageData()</code></dfn> methods are used to
- instantiate new <code id=pixel-manipulation:imagedata-7><a href=#imagedata>ImageData</a></code> objects.</p>
- <p>When the <code id=pixel-manipulation:dom-imagedata-3><a href=#dom-imagedata>ImageData()</a></code> constructor is invoked with two
- numeric arguments <var>sw</var> and <var>sh</var>, it must return a new
- <code id=pixel-manipulation:imagedata-8><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with a width equal to
- <var>sw</var> and a height equal to <var>sh</var>, if both <var>sw</var> and <var>sh</var> are non-zero. If one or both of <var>sw</var> and <var>sh</var> are zero, then the constructor must throw an
- <code id=pixel-manipulation:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception instead.</p>
- <p>When the <code id=pixel-manipulation:dom-imagedata-4><a href=#dom-imagedata>ImageData()</a></code> constructor is invoked with its first
- argument being an <code id=pixel-manipulation:uint8clampedarray-2><a href=#uint8clampedarray>Uint8ClampedArray</a></code> <var>source</var> and its second and
- (optionally) third argument(s) being numeric arguments <var>sw</var> and <var>sh</var>, it must run the following steps:
- <ol><li><p>Let <var>length</var> be the number of bytes in <var>source</var>.<li><p>If <var>length</var> is not a non-zero integral multiple of four, throw an
- <code id=pixel-manipulation:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Let <var>length</var> be <var>length</var> divided by four.</p>
- <li>
- <p>If <var>length</var> is not an integral multiple of <var>sw</var>,
- throw an <code id=pixel-manipulation:indexsizeerror-5><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.</p>
- <p class=note>At this step, the length is guaranteed to be greater than zero (otherwise the
- second step above would have aborted the steps), so if <var>sw</var> is zero, this
- step will throw the exception and abort these steps.</p>
- <li><p>Let <var>height</var> be <var>length</var> divided by <var>sw</var>.<li><p>If the <var>sh</var> argument was not omitted, and its value is not equal to
- <var>height</var>, then throw an <code id=pixel-manipulation:indexsizeerror-6><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these
- steps.<li>
- <p>Return a new <code id=pixel-manipulation:imagedata-9><a href=#imagedata>ImageData</a></code> object whose width is <var>sw</var>, whose
- height is <var>height</var>, and whose data is <var>source</var>.</p>
- <p class=note>The resulting object's data is not a <em>copy</em> of <var>source</var>, it's the actual <code id=pixel-manipulation:uint8clampedarray-3><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object passed as the
- first argument to the constructor.</p>
- </ol>
- <p>When the <code id=pixel-manipulation:dom-context-2d-createimagedata-3><a href=#dom-context-2d-createimagedata>createImageData()</a></code> method is
- invoked with two numeric arguments <var>sw</var> and <var>sh</var>, it must
- return a new <code id=pixel-manipulation:imagedata-10><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with a width
- equal to the absolute magnitude of <var>sw</var> and a height equal to the absolute
- magnitude of <var>sh</var>, if both <var>sw</var> and <var>sh</var>
- are non-zero. If one or both of <var>sw</var> and <var>sh</var> are zero, then
- the constructor must throw an <code id=pixel-manipulation:indexsizeerror-7><a href=#indexsizeerror>IndexSizeError</a></code> exception instead.</p>
- <p>When the <code id=pixel-manipulation:dom-context-2d-createimagedata-4><a href=#dom-context-2d-createimagedata>createImageData()</a></code> method is
- invoked with a single <var>imagedata</var> argument, it must return a new
- <code id=pixel-manipulation:imagedata-11><a href=#imagedata>ImageData</a></code> object representing a transparent black rectangle with the same dimensions
- as the <code id=pixel-manipulation:imagedata-12><a href=#imagedata>ImageData</a></code> object passed as the argument.</p>
- <p>The <dfn id=dom-context-2d-getimagedata><code>getImageData(<var>sx</var>,
- <var>sy</var>, <var>sw</var>, <var>sh</var>)</code></dfn> method must,
- if either the <var>sw</var> or <var>sh</var> arguments are zero, throw an
- <code id=pixel-manipulation:indexsizeerror-8><a href=#indexsizeerror>IndexSizeError</a></code> exception; otherwise,
-
- if the <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap>scratch bitmap</a>'s <a href=#concept-canvas-origin-clean id=pixel-manipulation:concept-canvas-origin-clean>origin-clean</a>
- flag is set to false, it must throw a <code id=pixel-manipulation:securityerror><a href=#securityerror>SecurityError</a></code> exception;
-
- otherwise, it must return an <code id=pixel-manipulation:imagedata-13><a href=#imagedata>ImageData</a></code> object with width <var>sw</var> and
- height <var>sh</var> representing the <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-2>scratch bitmap</a> for the area of that
- bitmap denoted by the rectangle whose corners are the four points (<var>sx</var>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>,
- <span><var>sy</var>+<var>sh</var></span>), (<var>sx</var>,
- <span><var>sy</var>+<var>sh</var></span>), in the bitmap's
- coordinate space units. Pixels outside the <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-3>scratch bitmap</a> must be returned as
- transparent black. Pixels must be returned as non-premultiplied alpha values.</p>
- <p>New <code id=pixel-manipulation:imagedata-14><a href=#imagedata>ImageData</a></code> objects must be initialised so that their <dfn id=dom-imagedata-width><code>width</code></dfn> attribute is set to the number of pixels per
- row in the image data, their <dfn id=dom-imagedata-height><code>height</code></dfn>
- attribute is set to the number of rows in the image data, and their <dfn id=dom-imagedata-data><code>data</code></dfn> attribute, except where an existing array is
- provided, is initialised to a new <code id=pixel-manipulation:uint8clampedarray-4><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object. The
- <code id=pixel-manipulation:uint8clampedarray-5><a href=#uint8clampedarray>Uint8ClampedArray</a></code> object must use a new <a href=#canvas-pixel-arraybuffer id=pixel-manipulation:canvas-pixel-arraybuffer>Canvas Pixel
- <code>ArrayBuffer</code></a> for its storage, and must have a zero start offset and a length
- equal to the length of its storage, in bytes. The <a href=#canvas-pixel-arraybuffer id=pixel-manipulation:canvas-pixel-arraybuffer-2>Canvas Pixel
- <code>ArrayBuffer</code></a> must contain the image data. At least one pixel's worth of image
- data must be returned. <a href=#refsECMA262>[ECMA262]</a></p>
- <p>A <dfn id=canvas-pixel-arraybuffer>Canvas Pixel <code>ArrayBuffer</code></dfn> is an <code id=pixel-manipulation:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> whose data is
- represented in left-to-right order, row by row top to bottom, starting with the top left, with
- each pixel's red, green, blue, and alpha components being given in that order for each pixel. Each
- component of each pixel represented in this array must be in the range 0..255, representing the 8
- bit value for that component. The components must be assigned consecutive indices starting with 0
- for the top left pixel's red component. <a href=#refsECMA262>[ECMA262]</a></p>
- <p>The <dfn id=dom-context-2d-putimagedata><code>putImageData()</code></dfn> method writes
- data from <code id=pixel-manipulation:imagedata-15><a href=#imagedata>ImageData</a></code> structures back to the rendering context's <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-4>scratch
- bitmap</a>. Its arguments are: <var>imagedata</var>, <var>dx</var>, <var>dy</var>, <var>dirtyX</var>, <var>dirtyY</var>, <var>dirtyWidth</var>, and <var>dirtyHeight</var>.</p>
- <p>When the last four arguments to this method are omitted, they must be assumed to have the
- values 0, 0, the <code id=pixel-manipulation:dom-imagedata-width-2><a href=#dom-imagedata-width>width</a></code> member of the <var>imagedata</var> structure, and the <code id=pixel-manipulation:dom-imagedata-height-2><a href=#dom-imagedata-height>height</a></code>
- member of the <var>imagedata</var> structure, respectively.</p>
- <p>When invoked, the method must act as follows:</p>
- <ol><li>
- <p>If the <var>imagedata</var> argument's <code id=pixel-manipulation:dom-imagedata-data-2><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered id=pixel-manipulation:concept-transferable-neutered-2>neutered</a>, throw an <code id=pixel-manipulation:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.</p>
- <li>
- <p>If <var>dirtyWidth</var> is negative, let <var>dirtyX</var> be <span><var>dirtyX</var>+<var>dirtyWidth</var></span>, and let <var>dirtyWidth</var> be equal to the absolute magnitude of <var>dirtyWidth</var>.</p>
- <p>If <var>dirtyHeight</var> is negative, let <var>dirtyY</var> be <span><var>dirtyY</var>+<var>dirtyHeight</var></span>, and let <var>dirtyHeight</var> be equal to the absolute magnitude of <var>dirtyHeight</var>.</p>
- <li>
- <p>If <var>dirtyX</var> is negative, let <var>dirtyWidth</var> be <span><var>dirtyWidth</var>+<var>dirtyX</var></span>, and let <var>dirtyX</var> be zero.</p>
- <p>If <var>dirtyY</var> is negative, let <var>dirtyHeight</var> be <span><var>dirtyHeight</var>+<var>dirtyY</var></span>, and let <var>dirtyY</var> be zero.</p>
- <li>
- <p>If <span><var>dirtyX</var>+<var>dirtyWidth</var></span> is greater
- than the <code id=pixel-manipulation:dom-imagedata-width-3><a href=#dom-imagedata-width>width</a></code> attribute of the <var>imagedata</var> argument, let <var>dirtyWidth</var> be the value of that <code id=pixel-manipulation:dom-imagedata-width-4><a href=#dom-imagedata-width>width</a></code> attribute, minus the value of <var>dirtyX</var>.</p>
- <p>If <span><var>dirtyY</var>+<var>dirtyHeight</var></span> is
- greater than the <code id=pixel-manipulation:dom-imagedata-height-3><a href=#dom-imagedata-height>height</a></code> attribute of the <var>imagedata</var> argument, let <var>dirtyHeight</var> be the value of that
- <code id=pixel-manipulation:dom-imagedata-height-4><a href=#dom-imagedata-height>height</a></code> attribute, minus the value of <var>dirtyY</var>.</p>
- <li>
- <p>If, after those changes, either <var>dirtyWidth</var> or <var>dirtyHeight</var> is negative or zero, stop these steps without affecting any
- bitmaps.</p>
- <li><p>For all integer values of <var>x</var> and <var>y</var> where <span><var>dirtyX</var> ≤ <var>x</var> < <span><var>dirtyX</var>+<var>dirtyWidth</var></span></span> and <span><var>dirtyY</var> ≤ <var>y</var> < <span><var>dirtyY</var>+<var>dirtyHeight</var></span></span>, copy the
- four channels of the pixel with coordinate (<var>x</var>, <var>y</var>) in
- the <var>imagedata</var> data structure's <a href=#canvas-pixel-arraybuffer id=pixel-manipulation:canvas-pixel-arraybuffer-3>Canvas Pixel
- <code>ArrayBuffer</code></a> to the pixel with coordinate (<span><var>dx</var>+<var>x</var></span>, <span><var>dy</var>+<var>y</var></span>) in the rendering context's <a href=#scratch-bitmap id=pixel-manipulation:scratch-bitmap-5>scratch bitmap</a>.</ol>
- <p>The handling of pixel rounding when the specified coordinates are not integers is not defined
- by this specification, except that the following must result in no visible changes to the
- rendering:</p>
- <pre>context.putImageData(context.getImageData(x, y, w, h), p, q);</pre>
- <p>...for any value of <var>x</var>, <var>y</var>, <var>w</var>, and
- <var>h</var> and where <var>p</var> is the smaller of <var>x</var>
- and the sum of <var>x</var> and <var>w</var>, and <var>q</var> is
- the smaller of <var>y</var> and the sum of <var>y</var> and <var>h</var>; and except that the following two calls:</p>
- <pre>context.createImageData(w, h);
- context.getImageData(0, 0, w, h);</pre>
- <p>...must return <code id=pixel-manipulation:imagedata-16><a href=#imagedata>ImageData</a></code> objects with the same dimensions as each other, for any
- value of <var>w</var> and <var>h</var>. In other words, while user agents may
- round the arguments of these methods, any rounding performed must be performed consistently for
- all of the methods described in this section. (The constructors only work with integer
- values.)</p>
- <p class=note>Due to the lossy nature of converting to and from premultiplied alpha colour
- values, pixels that have just been set using <code id=pixel-manipulation:dom-context-2d-putimagedata-2><a href=#dom-context-2d-putimagedata>putImageData()</a></code> might be returned to an equivalent
- <code id=pixel-manipulation:dom-context-2d-getimagedata-2><a href=#dom-context-2d-getimagedata>getImageData()</a></code> as different values.</p>
- <p>The current path, <a href=#transformations id=pixel-manipulation:transformations>transformation matrix</a>,
- <a href=#shadows id=pixel-manipulation:shadows>shadow attributes</a>, <a href=#dom-context-2d-globalalpha id=pixel-manipulation:dom-context-2d-globalalpha-2>global
- alpha</a>, the <a href=#clipping-region id=pixel-manipulation:clipping-region>clipping region</a>, and <a href=#dom-context-2d-globalcompositeoperation id=pixel-manipulation:dom-context-2d-globalcompositeoperation-2>global composition operator</a> must not
- affect the methods described in this section.</p>
-
- <div class=example>
- <p>In the following example, the script generates an <code id=pixel-manipulation:imagedata-17><a href=#imagedata>ImageData</a></code> object so that it can
- draw onto it.</p>
- <pre>// canvas is a reference to a <canvas> element
- var context = canvas.getContext('2d');
- // create a blank slate
- var data = context.createImageData(canvas.width, canvas.height);
- // create some plasma
- FillPlasma(data, 'green'); // green plasma
- // add a cloud to the plasma
- AddCloud(data, data.width/2, data.height/2); // put a cloud in the middle
- // paint the plasma+cloud on the canvas
- context.putImageData(data, 0, 0);
- // support methods
- function FillPlasma(data, color) { ... }
- function AddCloud(data, x, y) { ... }</pre>
- </div>
- <div class=example>
- <p>Here is an example of using <code id=pixel-manipulation:dom-context-2d-getimagedata-3><a href=#dom-context-2d-getimagedata>getImageData()</a></code> and <code id=pixel-manipulation:dom-context-2d-putimagedata-3><a href=#dom-context-2d-putimagedata>putImageData()</a></code> to implement an edge detection
- filter.</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Edge detection demo</title>
- <script>
- var image = new Image();
- function init() {
- image.onload = demo;
- image.src = "image.jpeg";
- }
- function demo() {
- var canvas = document.getElementsByTagName('canvas')[0];
- var context = canvas.getContext('2d');
- // draw the image onto the canvas
- context.drawImage(image, 0, 0);
- // get the image data to manipulate
- var input = context.getImageData(0, 0, canvas.width, canvas.height);
- // get an empty slate to put the data into
- var output = context.createImageData(canvas.width, canvas.height);
- // alias some variables for convenience
- // notice that we are using input.width and input.height here
- // as they might not be the same as canvas.width and canvas.height
- // (in particular, they might be different on high-res displays)
- var w = input.width, h = input.height;
- var inputData = input.data;
- var outputData = output.data;
- // edge detection
- for (var y = 1; y < h-1; y += 1) {
- for (var x = 1; x < w-1; x += 1) {
- for (var c = 0; c < 3; c += 1) {
- var i = (y*w + x)*4 + c;
- outputData[i] = 127 + -inputData[i - w*4 - 4] - inputData[i - w*4] - inputData[i - w*4 + 4] +
- -inputData[i - 4] + 8*inputData[i] - inputData[i + 4] +
- -inputData[i + w*4 - 4] - inputData[i + w*4] - inputData[i + w*4 + 4];
- }
- outputData[(y*w + x)*4 + 3] = 255; // alpha
- }
- }
- // put the image data back after manipulation
- context.putImageData(output, 0, 0);
- }
- </script>
- </head>
- <body onload="init()">
- <canvas></canvas>
- </body>
- </html></pre>
- </div>
- <h6 id=compositing>4.12.4.2.17 Compositing</h6>
- <dl class=domintro><dt><var>context</var> . <code id=compositing:dom-context-2d-globalalpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current alpha value applied to rendering operations.</p>
- <p>Can be set, to change the alpha value. Values outside of the range 0.0 .. 1.0 are
- ignored.</p>
- <dt><var>context</var> . <code id=compositing:dom-context-2d-globalcompositeoperation><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current composition operation, from the values defined in the Compositing and
- Blending specification. <a href=#refsCOMPOSITE>[COMPOSITE]</a>.</p>
- <p>Can be set, to change the composition operation. Unknown values are ignored.</p>
- </dl>
-
- <p>All drawing operations are affected by the global compositing attributes, <code id=compositing:dom-context-2d-globalalpha-2><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and <code id=compositing:dom-context-2d-globalcompositeoperation-2><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code>.</p>
-
- <p>The <dfn id=dom-context-2d-globalalpha><code>globalAlpha</code></dfn> attribute gives an
- alpha value that is applied to shapes and images before they are composited onto the <a href=#scratch-bitmap id=compositing:scratch-bitmap>scratch
- bitmap</a>. The value must be in the range from 0.0 (fully transparent) to 1.0 (no additional
- transparency). If an attempt is made to set the attribute to a value outside this range, including
- Infinity and Not-a-Number (NaN) values, the attribute must retain its previous value. When the
- context is created, the <code id=compositing:dom-context-2d-globalalpha-3><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> attribute must
- initially have the value 1.0.</p>
- <p>The <dfn id=dom-context-2d-globalcompositeoperation><code>globalCompositeOperation</code></dfn> attribute
- sets the current composition operator, which controls how shapes and images are drawn onto the
- <a href=#scratch-bitmap id=compositing:scratch-bitmap-2>scratch bitmap</a>, once they have had <code id=compositing:dom-context-2d-globalalpha-4><a href=#dom-context-2d-globalalpha>globalAlpha</a></code> and the current transformation matrix
- applied. The possible values are those defined in the Compositing and Blending specification, and
- include the values <dfn id=gcop-source-over><code>source-over</code></dfn>
- and <dfn id=gcop-copy><code>copy</code></dfn>.
- <a href=#refsCOMPOSITE>[COMPOSITE]</a></p>
- <p>These values are all case-sensitive — they must be used exactly as defined. User agents
- must not recognise values that are not a <a href=#case-sensitive id=compositing:case-sensitive>case-sensitive</a> match for one of the values
- given in the Compositing and Blending specification. <a href=#refsCOMPOSITE>[COMPOSITE]</a></p>
- <p>On setting, if the user agent does not recognise the specified value, it must be ignored,
- leaving the value of <code id=compositing:dom-context-2d-globalcompositeoperation-3><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> unaffected.
- Otherwise, the attribute must be set to the given new value.</p>
- <p>When the context is created, the <code id=compositing:dom-context-2d-globalcompositeoperation-4><a href=#dom-context-2d-globalcompositeoperation>globalCompositeOperation</a></code> attribute must
- initially have the value <code id=compositing:gcop-source-over><a href=#gcop-source-over>source-over</a></code>.</p>
-
- <h6 id=image-smoothing>4.12.4.2.18 Image smoothing</h6>
- <dl class=domintro><dt><var>context</var> . <code id=image-smoothing:dom-context-2d-imagesmoothingenabled><a href=#dom-context-2d-imagesmoothingenabled>imageSmoothingEnabled</a></code> [ = <var>value</var> ]<dd>
- <p>Returns whether pattern fills and the <code id=image-smoothing:dom-context-2d-drawimage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method will attempt to smooth images if
- their pixels don't line up exactly with the display, when scaling images up.</p>
- <p>Can be set, to change whether images are smoothed (true) or not (false).</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-imagesmoothingenabled><code>imageSmoothingEnabled</code></dfn>
- attribute, on getting, must return the last value it was set to. On setting, it must be set to the
- new value. When the <code id=image-smoothing:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object is created, the attribute must be
- set to true.</p>
-
- <h6 id=shadows>4.12.4.2.19 <dfn>Shadows</dfn></h6>
- <p>All drawing operations are affected by the four global shadow attributes.</p>
- <dl class=domintro><dt><var>context</var> . <code id=shadows:dom-context-2d-shadowcolor><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current shadow colour.</p>
- <p>Can be set, to change the shadow colour. Values that cannot be parsed as CSS colours are ignored.</p>
- <dt><var>context</var> . <code id=shadows:dom-context-2d-shadowoffsetx><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> [ = <var>value</var> ]<dt><var>context</var> . <code id=shadows:dom-context-2d-shadowoffsety><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current shadow offset.</p>
- <p>Can be set, to change the shadow offset. Values that are not finite numbers are ignored.</p>
- <dt><var>context</var> . <code id=shadows:dom-context-2d-shadowblur><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current level of blur applied to shadows.</p>
- <p>Can be set, to change the blur level. Values that are not finite numbers greater than or
- equal to zero are ignored.</p>
- </dl>
-
- <p>The <dfn id=dom-context-2d-shadowcolor><code>shadowColor</code></dfn> attribute sets the
- colour of the shadow.</p>
- <p>When the context is created, the <code id=shadows:dom-context-2d-shadowcolor-2><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>
- attribute initially must be fully-transparent black.</p>
- <p>On getting, the <a href=#serialisation-of-a-colour id=shadows:serialisation-of-a-colour>serialisation of the colour</a>
- must be returned.</p>
- <p>On setting, the new value must be <a href=#parsed-as-a-css-color-value id=shadows:parsed-as-a-css-color-value>parsed as a CSS <color> value</a> and the
- colour assigned. If the value cannot be parsed as a CSS <color> value then it must be
- ignored, and the attribute must retain its previous value. <a href=#refsCSSCOLOR>[CSSCOLOR]</a></p>
- <p>The <dfn id=dom-context-2d-shadowoffsetx><code>shadowOffsetX</code></dfn> and <dfn id=dom-context-2d-shadowoffsety><code>shadowOffsetY</code></dfn> attributes specify the distance
- that the shadow will be offset in the positive horizontal and positive vertical distance
- respectively. Their values are in coordinate space units. They are not affected by the current
- transformation matrix.</p>
- <p>When the context is created, the shadow offset attributes must initially have the value
- 0.</p>
- <p>On getting, they must return their current value. On setting, the attribute being set must be
- set to the new value, except if the value is infinite or NaN, in which case the new value must be
- ignored.</p>
- <p>The <dfn id=dom-context-2d-shadowblur><code>shadowBlur</code></dfn> attribute specifies
- the level of the blurring effect. (The units do not map to coordinate space units, and are not
- affected by the current transformation matrix.)</p>
- <p>When the context is created, the <code id=shadows:dom-context-2d-shadowblur-2><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>
- attribute must initially have the value 0.</p>
- <p>On getting, the attribute must return its current value. On setting the attribute must be set
- to the new value, except if the value is negative, infinite or NaN, in which case the new value
- must be ignored.</p>
- <p><dfn id=when-shadows-are-drawn>Shadows are only drawn if</dfn> the opacity component of
- the alpha component of the colour of <code id=shadows:dom-context-2d-shadowcolor-3><a href=#dom-context-2d-shadowcolor>shadowColor</a></code> is
- non-zero and either the <code id=shadows:dom-context-2d-shadowblur-3><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is non-zero, or
- the <code id=shadows:dom-context-2d-shadowoffsetx-2><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> is non-zero, or the <code id=shadows:dom-context-2d-shadowoffsety-2><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> is non-zero.</p>
- <p class=critical>It is likely that this will change: browser vendors have indicated an interest
- in changing the processing model for shadows such that they only draw when the composition
- operator is "source-over" (the default). <a href=http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2011-May/thread.html#31457>Read
- more...</a></p>
- <p><a href=#when-shadows-are-drawn id=shadows:when-shadows-are-drawn>When shadows are drawn</a>, they must be rendered as follows:</p>
- <ol><li><p>Let <var>A</var> be an infinite transparent black bitmap on which the source
- image for which a shadow is being created has been rendered.<li><p>Let <var>B</var> be an infinite transparent black bitmap, with a coordinate
- space and an origin identical to <var>A</var>.<li><p>Copy the alpha channel of <var>A</var> to <var>B</var>, offset by <code id=shadows:dom-context-2d-shadowoffsetx-3><a href=#dom-context-2d-shadowoffsetx>shadowOffsetX</a></code> in the positive <var>x</var>
- direction, and <code id=shadows:dom-context-2d-shadowoffsety-3><a href=#dom-context-2d-shadowoffsety>shadowOffsetY</a></code> in the positive
- <var>y</var> direction.<li>
- <p>If <code id=shadows:dom-context-2d-shadowblur-4><a href=#dom-context-2d-shadowblur>shadowBlur</a></code> is greater than 0:</p>
- <ol><li> <p>Let <var>σ</var> be half the value of <code id=shadows:dom-context-2d-shadowblur-5><a href=#dom-context-2d-shadowblur>shadowBlur</a></code>.<li> <p>Perform a 2D Gaussian Blur on <var>B</var>, using <var>σ</var>
- as the standard deviation.</p> </ol>
- <p>User agents may limit values of <var>σ</var> to an implementation-specific
- maximum value to avoid exceeding hardware limitations during the Gaussian blur operation.</p>
- <li><p>Set the red, green, and blue components of every pixel in <var>B</var> to the
- red, green, and blue components (respectively) of the colour of <code id=shadows:dom-context-2d-shadowcolor-4><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.<li><p>Multiply the alpha component of every pixel in <var>B</var> by the alpha
- component of the colour of <code id=shadows:dom-context-2d-shadowcolor-5><a href=#dom-context-2d-shadowcolor>shadowColor</a></code>.<li><p>The shadow is in the bitmap <var>B</var>, and is rendered as part of the
- <a href=#drawing-model id=shadows:drawing-model>drawing model</a> described below.</ol>
-
- <p>If the current composition operation is <code id=shadows:gcop-copy><a href=#gcop-copy>copy</a></code>, shadows
- effectively won't render (since the shape will overwrite the shadow).</p>
-
- <h6 id=drawing-model>4.12.4.2.20 <dfn>Drawing model</dfn></h6>
- <p>When a shape or image is painted, user agents must follow these steps, in the order given (or
- act as if they do):</p>
- <ol><li><p>Render the shape or image onto an infinite transparent black bitmap, creating image <var>A</var>, as described in the previous sections. For shapes, the current fill, stroke,
- and line styles must be honored, and the stroke must itself also be subjected to the current
- transformation matrix.<li><p><a href=#when-shadows-are-drawn id=drawing-model:when-shadows-are-drawn>When shadows are drawn</a>, render the shadow from image <var>A</var>,
- using the current shadow styles, creating image <var>B</var>.<li><p><a href=#when-shadows-are-drawn id=drawing-model:when-shadows-are-drawn-2>When shadows are drawn</a>, multiply the alpha component of every pixel in <var>B</var> by <code id=drawing-model:dom-context-2d-globalalpha><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.<li><p><a href=#when-shadows-are-drawn id=drawing-model:when-shadows-are-drawn-3>When shadows are drawn</a>, composite <var>B</var> within the
- <a href=#clipping-region id=drawing-model:clipping-region>clipping region</a> over the current <a href=#scratch-bitmap id=drawing-model:scratch-bitmap>scratch bitmap</a> using the current
- composition operator.<li><p>Multiply the alpha component of every pixel in <var>A</var> by <code id=drawing-model:dom-context-2d-globalalpha-2><a href=#dom-context-2d-globalalpha>globalAlpha</a></code>.<li><p>Composite <var>A</var> within the <a href=#clipping-region id=drawing-model:clipping-region-2>clipping region</a> over the current
- <a href=#scratch-bitmap id=drawing-model:scratch-bitmap-2>scratch bitmap</a> using the current composition operator.</ol>
- <p>When compositing onto the <a href=#scratch-bitmap id=drawing-model:scratch-bitmap-3>scratch bitmap</a>, pixels that would fall outside of the
- <a href=#scratch-bitmap id=drawing-model:scratch-bitmap-4>scratch bitmap</a> must be discarded.</p>
-
- <h6 id=best-practices>4.12.4.2.21 Best practices</h6>
- <p><i>This section is non-normative.</i></p>
- <p>When a canvas is interactive, authors should include focusable elements in the element's
- fallback content corresponding to each focusable part of the canvas, as in the <a href=#drawCustomFocusRingExample>example above</a>.</p>
- <p>To expose text and interactive content on a <code id=best-practices:the-canvas-element><a href=#the-canvas-element>canvas</a></code> to users of accessibility
- tools, authors should use the <code id=best-practices:dom-context-2d-addhitregion><a href=#dom-context-2d-addhitregion>addHitRegion()</a></code>
- API. When rendering focus rings, to ensure that focus rings have the appearance of native focus
- rings, authors should use the <code id=best-practices:dom-context-2d-drawsystemfocusring><a href=#dom-context-2d-drawsystemfocusring>drawSystemFocusRing()</a></code> method, passing it the
- element for which a ring is being drawn. This method only draws the focus ring if the element is
- <a href=#focused id=best-practices:focused>focused</a>, so that it can simply be called whenever drawing the element, without
- checking whether the element is focused or not first.</p>
- <p id=no-text-editing-in-canvas-please>Authors should avoid implementing text editing controls
- using the <code id=best-practices:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element. Doing so has a large number of disadvantages:</p>
- <ul><li>Mouse placement of the caret has to be reimplemented.<li>Keyboard movement of the caret has to be reimplemented (possibly across lines, for multiline
- text input).<li>Scrolling of the text field has to be implemented (horizontally for long lines, vertically
- for multiline input).<li>Native features such as copy-and-paste have to be reimplemented.<li>Native features such as spell-checking have to be reimplemented.<li>Native features such as drag-and-drop have to be reimplemented.<li>Native features such as page-wide text search have to be reimplemented.<li>Native features specific to the user, for example custom text services, have to be
- reimplemented. This is close to impossible since each user might have different services
- installed, and there is an unbounded set of possible such services.<li>Bidirectional text editing has to be reimplemented.<li>For multiline text editing, line wrapping has to be implemented for all relevant
- languages.<li>Text selection has to be reimplemented.<li>Dragging of bidirectional text selections has to be reimplemented.<li>Platform-native keyboard shortcuts have to be reimplemented.<li>Platform-native input method editors (IMEs) have to be reimplemented.<li>Undo and redo functionality has to be reimplemented.<li>Accessibility features such as magnification following the caret or selection have to be
- reimplemented.</ul>
- <p>This is a huge amount of work, and authors are most strongly encouraged to avoid doing any of
- it by instead using the <code id=best-practices:the-input-element><a href=#the-input-element>input</a></code> element, the <code id=best-practices:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element, or the
- <code id=best-practices:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> attribute.</p>
- <h6 id=examples>4.12.4.2.22 Examples</h6>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>Here is an example of a script that uses canvas to draw <a href="data:text/html;charset=utf-8;base64,PCFET0NUWVBFIEhUTUw%2BDQo8aHRtbCBsYW5nPSJlbiI%2BDQogPGhlYWQ%2BDQogIDx0aXRsZT5QcmV0dHkgR2xvd2luZyBMaW5lczwvdGl0bGU%2BDQogPC9oZWFkPg0KIDxib2R5Pg0KPGNhbnZhcyB3aWR0aD0iODAwIiBoZWlnaHQ9IjQ1MCI%2BPC9jYW52YXM%2BDQo8c2NyaXB0Pg0KDQogdmFyIGNvbnRleHQgPSBkb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnY2FudmFzJylbMF0uZ2V0Q29udGV4dCgnMmQnKTsNCg0KIHZhciBsYXN0WCA9IGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKTsNCiB2YXIgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KIHZhciBodWUgPSAwOw0KIGZ1bmN0aW9uIGxpbmUoKSB7DQogICBjb250ZXh0LnNhdmUoKTsNCiAgIGNvbnRleHQudHJhbnNsYXRlKGNvbnRleHQuY2FudmFzLndpZHRoLzIsIGNvbnRleHQuY2FudmFzLmhlaWdodC8yKTsNCiAgIGNvbnRleHQuc2NhbGUoMC45LCAwLjkpOw0KICAgY29udGV4dC50cmFuc2xhdGUoLWNvbnRleHQuY2FudmFzLndpZHRoLzIsIC1jb250ZXh0LmNhbnZhcy5oZWlnaHQvMik7DQogICBjb250ZXh0LmJlZ2luUGF0aCgpOw0KICAgY29udGV4dC5saW5lV2lkdGggPSA1ICsgTWF0aC5yYW5kb20oKSAqIDEwOw0KICAgY29udGV4dC5tb3ZlVG8obGFzdFgsIGxhc3RZKTsNCiAgIGxhc3RYID0gY29udGV4dC5jYW52YXMud2lkdGggKiBNYXRoLnJhbmRvbSgpOw0KICAgbGFzdFkgPSBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpOw0KICAgY29udGV4dC5iZXppZXJDdXJ2ZVRvKGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGNvbnRleHQuY2FudmFzLndpZHRoICogTWF0aC5yYW5kb20oKSwNCiAgICAgICAgICAgICAgICAgICAgICAgICBjb250ZXh0LmNhbnZhcy5oZWlnaHQgKiBNYXRoLnJhbmRvbSgpLA0KICAgICAgICAgICAgICAgICAgICAgICAgIGxhc3RYLCBsYXN0WSk7DQoNCiAgIGh1ZSA9IGh1ZSArIDEwICogTWF0aC5yYW5kb20oKTsNCiAgIGNvbnRleHQuc3Ryb2tlU3R5bGUgPSAnaHNsKCcgKyBodWUgKyAnLCA1MCUsIDUwJSknOw0KICAgY29udGV4dC5zaGFkb3dDb2xvciA9ICd3aGl0ZSc7DQogICBjb250ZXh0LnNoYWRvd0JsdXIgPSAxMDsNCiAgIGNvbnRleHQuc3Ryb2tlKCk7DQogICBjb250ZXh0LnJlc3RvcmUoKTsNCiB9DQogc2V0SW50ZXJ2YWwobGluZSwgNTApOw0KDQogZnVuY3Rpb24gYmxhbmsoKSB7DQogICBjb250ZXh0LmZpbGxTdHlsZSA9ICdyZ2JhKDAsMCwwLDAuMSknOw0KICAgY29udGV4dC5maWxsUmVjdCgwLCAwLCBjb250ZXh0LmNhbnZhcy53aWR0aCwgY29udGV4dC5jYW52YXMuaGVpZ2h0KTsNCiB9DQogc2V0SW50ZXJ2YWwoYmxhbmssIDQwKTsNCg0KPC9zY3JpcHQ%2BDQogPC9ib2R5Pg0KPC9odG1sPg0K">pretty glowing lines</a>.</p>
- <pre><canvas width="800" height="450"></canvas>
- <script>
- var context = document.getElementsByTagName('canvas')[0].getContext('2d');
- var lastX = context.canvas.width * Math.random();
- var lastY = context.canvas.height * Math.random();
- var hue = 0;
- function line() {
- context.save();
- context.translate(context.canvas.width/2, context.canvas.height/2);
- context.scale(0.9, 0.9);
- context.translate(-context.canvas.width/2, -context.canvas.height/2);
- context.beginPath();
- context.lineWidth = 5 + Math.random() * 10;
- context.moveTo(lastX, lastY);
- lastX = context.canvas.width * Math.random();
- lastY = context.canvas.height * Math.random();
- context.bezierCurveTo(context.canvas.width * Math.random(),
- context.canvas.height * Math.random(),
- context.canvas.width * Math.random(),
- context.canvas.height * Math.random(),
- lastX, lastY);
- hue = hue + 10 * Math.random();
- context.strokeStyle = 'hsl(' + hue + ', 50%, 50%)';
- context.shadowColor = 'white';
- context.shadowBlur = 10;
- context.stroke();
- context.restore();
- }
- setInterval(line, 50);
- function blank() {
- context.fillStyle = 'rgba(0,0,0,0.1)';
- context.fillRect(0, 0, context.canvas.width, context.canvas.height);
- }
- setInterval(blank, 40);
- </script></pre>
- </div>
- <div class=example>
- <p>The 2D rendering context for <code id=examples:the-canvas-element><a href=#the-canvas-element>canvas</a></code> is often used for sprite-based games. The
- following example demonstrates this:</p>
- <iframe src=/demos/canvas/blue-robot/index-idle.html width=396 height=216></iframe>
- <p>Here is the source for this example:</p>
- <pre><!DOCTYPE HTML>
- <title>Blue Robot Demo</title>
- <base href="http://www.whatwg.org/demos/canvas/blue-robot/">
- <style>
- html { overflow: hidden; min-height: 200px; min-width: 380px; }
- body { height: 200px; position: relative; margin: 8px; }
- .buttons { position: absolute; bottom: 0px; left: 0px; margin: 4px; }
- </style>
- <canvas width="380" height="200"></canvas>
- <script>
- var Landscape = function (context, width, height) {
- this.offset = 0;
- this.width = width;
- this.advance = function (dx) {
- this.offset += dx;
- };
- this.horizon = height * 0.7;
- // This creates the sky gradient (from a darker blue to white at the bottom)
- this.sky = context.createLinearGradient(0, 0, 0, this.horizon);
- this.sky.addColorStop(0.0, 'rgb(55,121,179)');
- this.sky.addColorStop(0.7, 'rgb(121,194,245)');
- this.sky.addColorStop(1.0, 'rgb(164,200,214)');
- // this creates the grass gradient (from a darker green to a lighter green)
- this.earth = context.createLinearGradient(0, this.horizon, 0, height);
- this.earth.addColorStop(0.0, 'rgb(81,140,20)');
- this.earth.addColorStop(1.0, 'rgb(123,177,57)');
- this.paintBackground = function (context, width, height) {
- // first, paint the sky and grass rectangles
- context.fillStyle = this.sky;
- context.fillRect(0, 0, width, this.horizon);
- context.fillStyle = this.earth;
- context.fillRect(0, this.horizon, width, height-this.horizon);
- // then, draw the cloudy banner
- // we make it cloudy by having the draw text off the top of the
- // canvas, and just having the blurred shadow shown on the canvas
- context.save();
- context.translate(width-((this.offset+(this.width*3.2)) % (this.width*4.0))+0, 0);
- context.shadowColor = 'white';
- context.shadowOffsetY = 30+this.horizon/3; // offset down on canvas
- context.shadowBlur = '5';
- context.fillStyle = 'white';
- context.textAlign = 'left';
- context.textBaseline = 'top';
- context.font = '20px sans-serif';
- context.fillText('WHATWG ROCKS', 10, -30); // text up above canvas
- context.restore();
- // then, draw the background tree
- context.save();
- context.translate(width-((this.offset+(this.width*0.2)) % (this.width*1.5))+30, 0);
- context.beginPath();
- context.fillStyle = 'rgb(143,89,2)';
- context.lineStyle = 'rgb(10,10,10)';
- context.lineWidth = 2;
- context.rect(0, this.horizon+5, 10, -50); // trunk
- context.fill();
- context.stroke();
- context.beginPath();
- context.fillStyle = 'rgb(78,154,6)';
- context.arc(5, this.horizon-60, 30, 0, Math.PI*2); // leaves
- context.fill();
- context.stroke();
- context.restore();
- };
- this.paintForeground = function (context, width, height) {
- // draw the box that goes in front
- context.save();
- context.translate(width-((this.offset+(this.width*0.7)) % (this.width*1.1))+0, 0);
- context.beginPath();
- context.rect(0, this.horizon - 5, 25, 25);
- context.fillStyle = 'rgb(220,154,94)';
- context.lineStyle = 'rgb(10,10,10)';
- context.lineWidth = 2;
- context.fill();
- context.stroke();
- context.restore();
- };
- };
- </script>
- <script>
- var BlueRobot = function () {
- this.sprites = new Image();
- this.sprites.src = 'blue-robot.png'; // this sprite sheet has 8 cells
- this.targetMode = 'idle';
- this.walk = function () {
- this.targetMode = 'walk';
- };
- this.stop = function () {
- this.targetMode = 'idle';
- };
- this.frameIndex = {
- 'idle': [0], // first cell is the idle frame
- 'walk': [1,2,3,4,5,6], // the walking animation is cells 1-6
- 'stop': [7], // last cell is the stopping animation
- };
- this.mode = 'idle';
- this.frame = 0; // index into frameIndex
- this.tick = function () {
- // this advances the frame and the robot
- // the return value is how many pixels the robot has moved
- this.frame += 1;
- if (this.frame >= this.frameIndex[this.mode].length) {
- // we've reached the end of this animation cycle
- this.frame = 0;
- if (this.mode != this.targetMode) {
- // switch to next cycle
- if (this.mode == 'walk') {
- // we need to stop walking before we decide what to do next
- this.mode = 'stop';
- } else if (this.mode == 'stop') {
- if (this.targetMode == 'walk')
- this.mode = 'walk';
- else
- this.mode = 'idle';
- } else if (this.mode == 'idle') {
- if (this.targetMode == 'walk')
- this.mode = 'walk';
- }
- }
- }
- if (this.mode == 'walk')
- return 8;
- return 0;
- },
- this.paint = function (context, x, y) {
- if (!this.sprites.complete) return;
- // draw the right frame out of the sprite sheet onto the canvas
- // we assume each frame is as high as the sprite sheet
- // the x,y coordinates give the position of the bottom center of the sprite
- context.drawImage(this.sprites,
- this.frameIndex[this.mode][this.frame] * this.sprites.height, 0, this.sprites.height, this.sprites.height,
- x-this.sprites.height/2, y-this.sprites.height, this.sprites.height, this.sprites.height);
- };
- };
- </script>
- <script>
- var canvas = document.getElementsByTagName('canvas')[0];
- var context = canvas.getContext('2d');
- var landscape = new Landscape(context, canvas.width, canvas.height);
- var blueRobot = new BlueRobot();
- // paint when the browser wants us to, using requestAnimationFrame()
- function paint() {
- context.clearRect(0, 0, canvas.width, canvas.height);
- landscape.paintBackground(context, canvas.width, canvas.height);
- blueRobot.paint(context, canvas.width/2, landscape.horizon*1.1);
- landscape.paintForeground(context, canvas.width, canvas.height);
- requestAnimationFrame(paint);
- }
- paint();
- // but tick every 150ms, so that we don't slow down when we don't paint
- setInterval(function () {
- var dx = blueRobot.tick();
- landscape.advance(dx);
- }, 100);
- </script>
- <p class="buttons">
- <input type=button value="Walk" onclick="blueRobot.walk()">
- <input type=button value="Stop" onclick="blueRobot.stop()">
- <footer>
- <small> Blue Robot Player Sprite by <a href="http://johncolburn.deviantart.com/">JohnColburn</a>.
- Licensed under the terms of the Creative Commons Attribution Share-Alike 3.0 Unported license.</small>
- <small> This work is itself licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative
- Commons Attribution-ShareAlike 3.0 Unported License</a>.</small>
- </footer>
- </pre>
- </div>
-
- <h5 id=colour-spaces-and-colour-correction>4.12.4.3 Colour spaces and colour correction</h5>
- <p>The <code id=colour-spaces-and-colour-correction:the-canvas-element><a href=#the-canvas-element>canvas</a></code> APIs must perform colour correction at only two points: when rendering
- images with their own gamma correction and colour space information onto a bitmap, to convert the
- image to the colour space used by the bitmaps (e.g. using the 2D Context's <code id=colour-spaces-and-colour-correction:dom-context-2d-drawimage><a href=#dom-context-2d-drawimage>drawImage()</a></code> method with an <code id=colour-spaces-and-colour-correction:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code>
- object), and when rendering the actual canvas bitmap to the output device.</p>
- <p class=note>Thus, in the 2D context, colours used to draw shapes onto the canvas will exactly
- match colours obtained through the <code id=colour-spaces-and-colour-correction:dom-context-2d-getimagedata><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method.</p>
- <p>The <code id=colour-spaces-and-colour-correction:dom-canvas-todataurl><a href=#dom-canvas-todataurl>toDataURL()</a></code> method must not include colour space
- information in the resources they return. Where the output format allows it, the colour of pixels
- in resources created by <code id=colour-spaces-and-colour-correction:dom-canvas-todataurl-2><a href=#dom-canvas-todataurl>toDataURL()</a></code> must match those
- returned by the <code id=colour-spaces-and-colour-correction:dom-context-2d-getimagedata-2><a href=#dom-context-2d-getimagedata>getImageData()</a></code> method.</p>
- <p>In user agents that support CSS, the colour space used by a <code id=colour-spaces-and-colour-correction:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> element must
- match the colour space used for processing any colours for that element in CSS.</p>
- <p>The gamma correction and colour space information of images must be handled in such a way that
- an image rendered directly using an <code id=colour-spaces-and-colour-correction:the-img-element><a href=#the-img-element>img</a></code> element would use the same colours as one
- painted on a <code id=colour-spaces-and-colour-correction:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element that is then itself rendered. Furthermore, the rendering
- of images that have no colour correction information (such as those returned by the <code id=colour-spaces-and-colour-correction:dom-canvas-todataurl-3><a href=#dom-canvas-todataurl>toDataURL()</a></code> method) must be rendered with no colour
- correction.</p>
- <p class=note>Thus, in the 2D context, calling the <code id=colour-spaces-and-colour-correction:dom-context-2d-drawimage-2><a href=#dom-context-2d-drawimage>drawImage()</a></code> method to render the output of the <code id=colour-spaces-and-colour-correction:dom-canvas-todataurl-4><a href=#dom-canvas-todataurl>toDataURL()</a></code> method to the canvas, given the appropriate
- dimensions, has no visible effect.</p>
-
- <h5 id=serialising-bitmaps-to-a-file>4.12.4.4 Serialising bitmaps to a file</h5>
-
- <p>When a user agent is to create <dfn id=a-serialisation-of-the-bitmap-as-a-file>a serialisation of the bitmap as a file</dfn>, optionally
- with some given <var>arguments</var>, and optionally with a <var>native</var> flag set, it must
- create an image file in the format given by the first value of <var>arguments</var>, or, if there
- are no <var>arguments</var>, in the PNG format. <a href=#refsPNG>[PNG]</a></p>
- <p>If the <var>native</var> flag is set, or if the bitmap has one pixel per coordinate space unit,
- then the image file must have the same pixel data (before compression, if applicable) as the
- bitmap, and if the file format used supports encoding resolution metadata, the resolution of that
- bitmap (device pixels per coordinate space units being interpreted as image pixels per CSS pixel)
- must be given as well.</p>
- <p>Otherwise, the image file's pixel data must be the bitmap's pixel data scaled to one image
- pixel per coordinate space unit, and if the file format used supports encoding resolution
- metadata, the resolution must be given as 96dpi (one image pixel per CSS pixel).</p>
- <p>If <var>arguments</var> is not empty, the first value must be interpreted as a <a href=#mime-type id=serialising-bitmaps-to-a-file:mime-type>MIME type</a> giving the format to use. If the type has any parameters, it
- must be treated as not supported.</p>
- <p class=example>For example, the value "<code id=serialising-bitmaps-to-a-file:image/png><a href=#image/png>image/png</a></code>" would mean to generate a PNG
- image, the value "<code id=serialising-bitmaps-to-a-file:image/jpeg><a href=#image/jpeg>image/jpeg</a></code>" would mean to generate a JPEG image, and the value
- "<code id=serialising-bitmaps-to-a-file:image/svg+xml><a href=#image/svg+xml>image/svg+xml</a></code>" would mean to generate an SVG image (which would require that the
- user agent track how the bitmap was generated, an unlikely, though potentially awesome,
- feature).</p>
- <p>User agents must support PNG ("<code id=serialising-bitmaps-to-a-file:image/png-2><a href=#image/png>image/png</a></code>"). User agents may support other types.
- If the user agent does not support the requested type, it must create the file using the PNG
- format. <a href=#refsPNG>[PNG]</a></p>
- <p>User agents must <a href=#converted-to-ascii-lowercase id=serialising-bitmaps-to-a-file:converted-to-ascii-lowercase>convert the provided type to ASCII
- lowercase</a> before establishing if they support that type.</p>
- <p>For image types that do not support an alpha channel, the serialised image must be the bitmap
- image composited onto a solid black background using the source-over operator.</p>
- <p>If the first argument in <var>arguments</var> gives a type corresponding to one of the
- types given in the first column of the following table, and the user agent supports that type,
- then the subsequent arguments, if any, must be treated as described in the second cell of that
- row.</p>
-
- <table id=canvas-serialisation-arguments><caption>Arguments for serialisation methods</caption><thead><tr><th> Type <th> Other arguments <th> Reference
- <tbody><tr><td> <code id=serialising-bitmaps-to-a-file:image/jpeg-2><a href=#image/jpeg>image/jpeg</a></code>
- <td> The second argument, if it is a number in the range 0.0 to 1.0
- inclusive, must be treated as the desired quality level. If it is not a number or is outside that range, the user agent must use its
- default value, as if the argument had been omitted.
- <td> <a href=#refsJPEG>[JPEG]</a>
- </table>
-
- <p>For the purposes of these rules, an argument is considered to be a number if it is converted to
- an IDL double value by the rules for handling arguments of type <code>any</code> in the
- Web IDL specification. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <p>Other arguments must be ignored and must not cause the user agent to throw an exception. A
- future version of this specification will probably define other parameters to be passed to these
- methods to allow authors to more carefully control compression settings, image metadata, etc.</p>
-
-
- <h5 id=security-with-canvas-elements>4.12.4.5 Security with <code id=security-with-canvas-elements:the-canvas-element><a href=#the-canvas-element>canvas</a></code> elements</h5>
- <p><i>This section is non-normative.</i></p>
- <p><strong>Information leakage</strong> can occur if scripts from one <a href=#origin-2 id=security-with-canvas-elements:origin-2>origin</a> can
- access information (e.g. read pixels) from images from another origin (one that isn't the <a href=#same-origin id=security-with-canvas-elements:same-origin>same</a>).</p>
- <p>To mitigate this, bitmaps used with <code id=security-with-canvas-elements:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> elements are defined to have a flag
- indicating whether they are <a href=#concept-canvas-origin-clean id=security-with-canvas-elements:concept-canvas-origin-clean>origin-clean</a>. All
- bitmaps start with their <a href=#concept-canvas-origin-clean id=security-with-canvas-elements:concept-canvas-origin-clean-2>origin-clean</a> set to
- true. The flag is set to false when cross-origin images or fonts are used.</p>
- <p>The <code id=security-with-canvas-elements:dom-canvas-todataurl><a href=#dom-canvas-todataurl>toDataURL()</a></code>, <code id=security-with-canvas-elements:dom-canvas-toblob><a href=#dom-canvas-toblob>toBlob()</a></code>, and <code id=security-with-canvas-elements:dom-context-2d-getimagedata><a href=#dom-context-2d-getimagedata>getImageData()</a></code> methods check the flag and will
- throw a <code id=security-with-canvas-elements:securityerror><a href=#securityerror>SecurityError</a></code> exception rather than leak cross-origin data.</p>
- <p>The flag can be reset in certain situations; for example, when a
- <code id=security-with-canvas-elements:canvasrenderingcontext2d><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> is bound to a new <code id=security-with-canvas-elements:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code>, the bitmap is cleared
- and its flag reset.</p>
-
- <h3 id=common-idioms>4.13 Common idioms without dedicated elements</h3>
- <h4 id=the-main-part-of-the-content>4.13.1 The main part of the content</h4>
- <p>The main content of a page — not including headers and footers, navigation links,
- sidebars, advertisements, and so forth — can be marked up in a variety of ways, depending on
- the needs of the author.</p>
- <p>The simplest solution is to not mark up the main content at all, and just leave it as implicit.
- Another way to think of this is that the <code id=the-main-part-of-the-content:the-body-element><a href=#the-body-element>body</a></code> elements marks up the main content of
- the page, and the bits that aren't main content are excluded through the use of more appropriate
- elements like <code id=the-main-part-of-the-content:the-aside-element><a href=#the-aside-element>aside</a></code> and <code id=the-main-part-of-the-content:the-nav-element><a href=#the-nav-element>nav</a></code>.</p>
- <div class=example>
- <p>Here is a short Web page marked up along this minimalistic school of thought. The main content
- is highlighted. Notice how all the <em>other</em> content in the <code id=the-main-part-of-the-content:the-body-element-2><a href=#the-body-element>body</a></code> is marked up
- with elements to indicate that it's not part of the main content, in this case
- <code id=the-main-part-of-the-content:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-main-part-of-the-content:the-nav-element-2><a href=#the-nav-element>nav</a></code>, and <code id=the-main-part-of-the-content:the-footer-element><a href=#the-footer-element>footer</a></code>.</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title> My Toys </title>
- </head>
- <body>
- <header>
- <h1>My toys</h1>
- </header>
- <nav>
- <p><a href="/">Home</a></p>
- <p><a href="/contact">Contact</a></p>
- </nav>
- <strong> <p>I really like my chained book and my telephone. I'm not such a
- fan of my big ball.</p>
- <p>Another toy I like is my mirror.</p></strong>
- <footer>
- <p>© copyright 2010 by the boy</p>
- </footer>
- </body>
- </html></pre>
- </div>
- <p>If the main content is an independent unit of content that one could imagine syndicating
- independently, then the <code id=the-main-part-of-the-content:the-article-element><a href=#the-article-element>article</a></code> element would be appropriate to mark up the main
- content of the document.</p>
- <div class=example>
- <p>The document in the previous example is here recast as a blog post:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title> The Boy Blog: My Toys </title>
- </head>
- <body>
- <header>
- <h1>The Boy Blog</h1>
- </header>
- <nav>
- <p><a href="/">Home</a></p>
- <p><a href="/contact">Contact</a></p>
- </nav>
- <strong> <article>
- <header>
- <h1>My toys</h1>
- <p>Published August 4th</p>
- </header>
- <p>I really like my chained book and my telephone. I'm not such a
- fan of my big ball.</p>
- <p>Another toy I like is my mirror.</p>
- </article></strong>
- <footer>
- <p>© copyright 2010 by the boy</p>
- </footer>
- </body>
- </html></pre>
- </div>
- <p>If the main content is not an independent unit of content so much as a section of a larger
- work, for instance a chapter, then the <code id=the-main-part-of-the-content:the-section-element><a href=#the-section-element>section</a></code> element would be appropriate to mark
- up the main content of the document.</p>
- <div class=example>
- <p>Here is the same document, but as a chapter in an online book:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title> Chapter 2: My Toys — The Book of the Boy </title>
- </head>
- <body>
- <header>
- <hgroup>
- <h1>The Book of the Boy</h1>
- <h2>A book about boy stuff</h2>
- </hgroup>
- </header>
- <nav>
- <p><a href="/">Front Page</a></p>
- <p><a href="/toc">Table of Contents</a></p>
- <p><a href="/c1">Chapter 1</a> — <a href="/c3">Chapter 3</a></p>
- </nav>
- <strong> <section>
- <h1>Chapter 2: My Toys</h1>
- <p>I really like my chained book and my telephone. I'm not such a
- fan of my big ball.</p>
- <p>Another toy I like is my mirror.</p>
- </section></strong>
- </body>
- </html></pre>
- </div>
- <p>If neither <code id=the-main-part-of-the-content:the-article-element-2><a href=#the-article-element>article</a></code> nor <code id=the-main-part-of-the-content:the-section-element-2><a href=#the-section-element>section</a></code> would be appropriate, but the main
- content still needs an explicit element, for example for styling purposes, then the
- <code id=the-main-part-of-the-content:the-main-element><a href=#the-main-element>main</a></code> element can be used.</p>
- <div class=example>
- <p>This is the same as the original example, but using <code id=the-main-part-of-the-content:the-main-element-2><a href=#the-main-element>main</a></code> for the main content
- instead of leaving it implied:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title> My Toys </title>
- <style>
- body > main { background: navy; color: yellow; }
- </style>
- </head>
- <body>
- <header>
- <h1>My toys</h1>
- </header>
- <nav>
- <p><a href="/">Home</a></p>
- <p><a href="/contact">Contact</a></p>
- </nav>
- <strong> <main>
- <p>I really like my chained book and my telephone. I'm not such a
- fan of my big ball.</p>
- <p>Another toy I like is my mirror.</p>
- </main></strong>
- <footer>
- <p>© copyright 2010 by the boy</p>
- </footer>
- </body>
- </html></pre>
- </div>
- <h4 id=rel-up>4.13.2 Bread crumb navigation</h4>
- <p>This specification does not provide a machine-readable way of describing bread-crumb navigation
- menus. Authors are encouraged to just use a series of links in a paragraph. The <code id=rel-up:the-nav-element><a href=#the-nav-element>nav</a></code>
- element can be used to mark the section containing these paragraphs as being navigation
- blocks.</p>
-
- <div class=example>
- <p>In the following example, the current page can be reached via two paths.</p>
- <pre><nav>
- <p>
- <a href="/">Main</a> ▸
- <a href="/products/">Products</a> ▸
- <a href="/products/dishwashers/">Dishwashers</a> ▸
- <a>Second hand</a>
- </p>
- <p>
- <a href="/">Main</a> ▸
- <a href="/second-hand/">Second hand</a> ▸
- <a>Dishwashers</a>
- </p>
- </nav></pre>
- </div>
- <h4 id=tag-clouds>4.13.3 Tag clouds</h4>
- <p id=tag-cloud>This specification does not define any markup specifically for marking up lists
- of keywords that apply to a group of pages (also known as <i>tag clouds</i>). In general, authors
- are encouraged to either mark up such lists using <code id=tag-clouds:the-ul-element><a href=#the-ul-element>ul</a></code> elements with explicit inline
- counts that are then hidden and turned into a presentational effect using a style sheet, or to use
- SVG.</p>
- <div class=example>
- <p>Here, three tags are included in a short tag cloud:</p>
- <pre><style>
- @media screen, print, handheld, tv {
- /* should be ignored by non-visual browsers */
- .tag-cloud > li > span { display: none; }
- .tag-cloud > li { display: inline; }
- .tag-cloud-1 { font-size: 0.7em; }
- .tag-cloud-2 { font-size: 0.9em; }
- .tag-cloud-3 { font-size: 1.1em; }
- .tag-cloud-4 { font-size: 1.3em; }
- .tag-cloud-5 { font-size: 1.5em; }
- }
- </style>
- ...
- <ul class="tag-cloud">
- <li class="tag-cloud-4"><a title="28 instances" href="/t/apple">apple</a> <span>(popular)</span>
- <li class="tag-cloud-2"><a title="6 instances" href="/t/kiwi">kiwi</a> <span>(rare)</span>
- <li class="tag-cloud-5"><a title="41 instances" href="/t/pear">pear</a> <span>(very popular)</span>
- </ul></pre>
- <p>The actual frequency of each tag is given using the <code id=tag-clouds:attr-title><a href=#attr-title>title</a></code>
- attribute. A CSS style sheet is provided to convert the markup into a cloud of differently-sized
- words, but for user agents that do not support CSS or are not visual, the markup contains
- annotations like "(popular)" or "(rare)" to categorise the various tags by frequency, thus
- enabling all users to benefit from the information.</p>
- <p>The <code id=tag-clouds:the-ul-element-2><a href=#the-ul-element>ul</a></code> element is used (rather than <code id=tag-clouds:the-ol-element><a href=#the-ol-element>ol</a></code>) because the order is not
- particularly important: while the list is in fact ordered alphabetically, it would convey the
- same information if ordered by, say, the length of the tag.</p>
- <p>The <code id=tag-clouds:link-type-tag><a href=#link-type-tag>tag</a></code> <code id=tag-clouds:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>-keyword is
- <em>not</em> used on these <code id=tag-clouds:the-a-element><a href=#the-a-element>a</a></code> elements because they do not represent tags that apply
- to the page itself; they are just part of an index listing the tags themselves.</p>
- </div>
- <h4 id=conversations>4.13.4 Conversations</h4>
-
- <p>This specification does not define a specific element for marking up conversations, meeting
- minutes, chat transcripts, dialogues in screenplays, instant message logs, and other situations
- where different players take turns in discourse.</p>
- <p>Instead, authors are encouraged to mark up conversations using <code id=conversations:the-p-element><a href=#the-p-element>p</a></code> elements and
- punctuation. Authors who need to mark the speaker for styling purposes are encouraged to use
- <code id=conversations:the-span-element><a href=#the-span-element>span</a></code> or <code id=conversations:the-b-element><a href=#the-b-element>b</a></code>. Paragraphs with their text wrapped in the <code id=conversations:the-i-element><a href=#the-i-element>i</a></code>
- element can be used for marking up stage directions.</p>
- <div class=example>
- <p>This example demonstrates this using an extract from Abbot and Costello's famous sketch,
- <cite>Who's on first</cite>:</p>
- <pre><p> Costello: Look, you gotta first baseman?
- <p> Abbott: Certainly.
- <p> Costello: Who's playing first?
- <p> Abbott: That's right.
- <p> Costello becomes exasperated.
- <p> Costello: When you pay off the first baseman every month, who gets the money?
- <p> Abbott: Every dollar of it.</pre>
- </div>
- <div class=example>
- <p>The following extract shows how an IM conversation log could be marked up, using the
- <code id=conversations:the-data-element><a href=#the-data-element>data</a></code> element to provide Unix timestamps for each line. Note that the timestamps are
- provided in a format that the <code id=conversations:the-time-element><a href=#the-time-element>time</a></code> element does not support, so the
- <code id=conversations:the-data-element-2><a href=#the-data-element>data</a></code> element is used instead (namely, Unix <code>time_t</code> timestamps).
- Had the author wished to mark up the data using one of the date and time formats supported by the
- <code id=conversations:the-time-element-2><a href=#the-time-element>time</a></code> element, that element could have been used instead of <code id=conversations:the-data-element-3><a href=#the-data-element>data</a></code>. This
- could be advantageous as it would allow data analysis tools to detect the timestamps
- unambiguously, without coordination with the page author.</p>
- <pre><p> <data value="1319898155">14:22</data> <b>egof</b> I'm not that nerdy, I've only seen 30% of the star trek episodes
- <p> <data value="1319898192">14:23</data> <b>kaj</b> if you know what percentage of the star trek episodes you have seen, you are inarguably nerdy
- <p> <data value="1319898200">14:23</data> <b>egof</b> it's unarguably
- <p> <data value="1319898228">14:23</data> <i>* kaj blinks</i>
- <p> <data value="1319898260">14:24</data> <b>kaj</b> you are not helping your case</pre>
-
- </div>
- <div class=example>
- <p>HTML does not have a good way to mark up graphs, so descriptions of interactive conversations
- from games are more difficult to mark up. This example shows one possible convention using
- <code id=conversations:the-dl-element><a href=#the-dl-element>dl</a></code> elements to list the possible responses at each point in the conversation.
- Another option to consider is describing the conversation in the form of a DOT file, and
- outputting the result as an SVG image to place in the document. <a href=#refsDOT>[DOT]</a></p>
- <pre><p> Next, you meet a fisherman. You can say one of several greetings:
- <dl>
- <dt> "Hello there!"
- <dd>
- <p> He responds with "Hello, how may I help you?"; you can respond with:
- <dl>
- <dt> "I would like to buy a fish."
- <dd> <p> He sells you a fish and the conversation finishes.
- <dt> "Can I borrow your boat?"
- <dd>
- <p> He is surprised and asks "What are you offering in return?".
- <dl>
- <dt> "Five gold." (if you have enough)
- <dt> "Ten gold." (if you have enough)
- <dt> "Fifteen gold." (if you have enough)
- <dd> <p> He lends you his boat. The conversation ends.
- <dt> "A fish." (if you have one)
- <dt> "A newspaper." (if you have one)
- <dt> "A pebble." (if you have one)
- <dd> <p> "No thanks", he replies. Your conversation options
- at this point are the same as they were after asking to borrow
- his boat, minus any options you've suggested before.
- </dl>
- </dd>
- </dl>
- </dd>
- <dt> "Vote for me in the next election!"
- <dd> <p> He turns away. The conversation finishes.
- <dt> "Sir, are you aware that your fish are running away?"
- <dd>
- <p> He looks at you skeptically and says "Fish cannot run, sir".
- <dl>
- <dt> "You got me!"
- <dd> <p> The fisherman sighs and the conversation ends.
- <dt> "Only kidding."
- <dd> <p> "Good one!" he retorts. Your conversation options at this
- point are the same as those following "Hello there!" above.
- <dt> "Oh, then what are they doing?"
- <dd> <p> He looks at his fish, giving you an opportunity to steal
- his boat, which you do. The conversation ends.
- </dl>
- </dd>
- </dl></pre>
- </div>
- <div class=example>
- <p>In some games, conversations are simpler: each character merely has a fixed set of lines that
- they say. In this example, a game FAQ/walkthrough lists some of the known possible responses for
- each character:</p>
- <pre><section>
- <h1>Dialogue</h1>
- <p><small>Some characters repeat their lines in order each time you interact
- with them, others randomly pick from amongst their lines. Those who respond in
- order have numbered entries in the lists below.</small>
- <h2>The Shopkeeper</h2>
- <ul>
- <li>How may I help you?
- <li>Fresh apples!
- <li>A loaf of bread for madam?
- </ul>
- <h2>The pilot</h2>
- <p>Before the accident:
- <ul>
- </li>I'm about to fly out, sorry!
- </li>Sorry, I'm just waiting for flight clearance and then I'll be off!
- </ul>
- <p>After the accident:
- <ol>
- <li>I'm about to fly out, sorry!
- <li>Ok, I'm not leaving right now, my plane is being cleaned.
- <li>Ok, it's not being cleaned, it needs a minor repair first.
- <li>Ok, ok, stop bothering me! Truth is, I had a crash.
- </ol>
- <h2>Clan Leader</h2>
- <p>During the first clan meeting:
- <ul>
- <li>Hey, have you seen my daughter? I bet she's up to something nefarious again...
- <li>Nice weather we're having today, eh?
- <li>The name is Bailey, Jeff Bailey. How can I help you today?
- <li>A glass of water? Fresh from the well!
- </ul>
- <p>After the earthquake:
- <ol>
- <li>Everyone is safe in the shelter, we just have to put out the fire!
- <li>I'll go and tell the fire brigade, you keep hosing it down!
- </ol>
- </section></pre>
- </div>
- <h4 id=footnotes>4.13.5 Footnotes</h4>
- <p>HTML does not have a dedicated mechanism for marking up footnotes. Here are the suggested
- alternatives.</p>
- <hr>
- <p>For short inline annotations, the <code id=footnotes:attr-title><a href=#attr-title>title</a></code> attribute could be used.</p>
- <div class=example>
- <p>In this example, two parts of a dialogue are annotated with footnote-like content using the
- <code id=footnotes:attr-title-2><a href=#attr-title>title</a></code> attribute.</p>
- <pre><p> <b>Customer</b>: Hello! I wish to register a complaint. Hello. Miss?
- <p> <b>Shopkeeper</b>: <strong><span title="Colloquial pronunciation of 'What do you'"</strong>
- >Watcha</span> mean, miss?
- <p> <b>Customer</b>: Uh, I'm sorry, I have a cold. I wish to make a complaint.
- <p> <b>Shopkeeper</b>: Sorry, <span <strong>title="This is, of course, a lie."</strong>>we're
- closing for lunch</span>.</pre>
- </div>
-
- <p class=note>Unfortunately, relying on the <code id=footnotes:attr-title-3><a href=#attr-title>title</a></code> attribute is
- currently discouraged as many user agents do not expose the attribute in an accessible manner as
- required by this specification (e.g. requiring a pointing device such as a mouse to cause a
- tooltip to appear, which excludes keyboard-only users and touch-only users, such as anyone with a
- modern phone or tablet).</p>
- <p class=note>If the <code id=footnotes:attr-title-4><a href=#attr-title>title</a></code> attribute is used, CSS can used to
- draw the reader's attention to the elements with the attribute.</p>
- <div class=example>
- <p>For example, the following CSS places a dashed line below elements that have a <code id=footnotes:attr-title-5><a href=#attr-title>title</a></code> attribute.</p>
- <pre>[title] { border-bottom: thin dashed; }</pre>
- </div>
- <hr>
- <p>For longer annotations, the <code id=footnotes:the-a-element><a href=#the-a-element>a</a></code> element should be used, pointing to an element later
- in the document. The convention is that the contents of the link be a number in square
- brackets.</p>
- <div class=example>
- <p>In this example, a footnote in the dialogue links to a paragraph below the dialogue. The
- paragraph then reciprocally links back to the dialogue, allowing the user to return to the
- location of the footnote.</p>
- <pre><p> Announcer: Number 16: The <i>hand</i>.
- <p> Interviewer: Good evening. I have with me in the studio tonight
- Mr Norman St John Polevaulter, who for the past few years has been
- contradicting people. Mr Polevaulter, why <em>do</em> you
- contradict people?
- <p> Norman: I don't. <sup><a href="#fn1" id="r1">[1]</a></sup>
- <p> Interviewer: You told me you did!
- <em>...</em>
- <section>
- <p id="fn1"><a href="#r1">[1]</a> This is, naturally, a lie,
- but paradoxically if it were true he could not say so without
- contradicting the interviewer and thus making it false.</p>
- </section></pre>
- </div>
- <hr>
- <p>For side notes, longer annotations that apply to entire sections of the text rather than just
- specific words or sentences, the <code id=footnotes:the-aside-element><a href=#the-aside-element>aside</a></code> element should be used.</p>
- <div class=example>
- <p>In this example, a sidebar is given after a dialogue, giving it some context.</p>
- <pre><p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
- <p> <span class="speaker">Shopkeeper</span>: I'm sorry?
- <p> <span class="speaker">Customer</span>: I will not buy this record, it is scratched.
- <p> <span class="speaker">Shopkeeper</span>: No no no, this's'a tobacconist's.
- <aside>
- <p>In 1970, the British Empire lay in ruins, and foreign
- nationalists frequented the streets — many of them Hungarians
- (not the streets — the foreign nationals). Sadly, Alexander
- Yalt has been publishing incompetently-written phrase books.
- </aside></pre>
- </div>
- <hr>
- <p>For figures or tables, footnotes can be included in the relevant <code id=footnotes:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code> or
- <code id=footnotes:the-caption-element><a href=#the-caption-element>caption</a></code> element, or in surrounding prose.</p>
- <div class=example>
- <p>In this example, a table has cells with footnotes that are given in prose. A
- <code id=footnotes:the-figure-element><a href=#the-figure-element>figure</a></code> element is used to give a single legend to the combination of the table and
- its footnotes.</p>
- <pre><figure>
- <figcaption>Table 1. Alternative activities for knights.</figcaption>
- <table>
- <tr>
- <th> Activity
- <th> Location
- <th> Cost
- <tr>
- <td> Dance
- <td> Wherever possible
- <td> £0<sup><a href="#fn1">1</a></sup>
- <tr>
- <td> Routines, chorus scenes<sup><a href="#fn2">2</a></sup>
- <td> Undisclosed
- <td> Undisclosed
- <tr>
- <td> Dining<sup><a href="#fn3">3</a></sup>
- <td> Camelot
- <td> Cost of ham, jam, and spam<sup><a href="#fn4">4</a></sup>
- </table>
- <p id="fn1">1. Assumed.</p>
- <p id="fn2">2. Footwork impeccable.</p>
- <p id="fn3">3. Quality described as "well".</p>
- <p id="fn4">4. A lot.</p>
- </figure></pre>
- </div>
- <h3 id=disabled-elements>4.14 Disabled elements</h3>
- <p>An element is said to be <dfn id=concept-element-disabled>actually disabled</dfn> if it
- one of the following:</p>
- <ul><li>a <code id=disabled-elements:the-button-element><a href=#the-button-element>button</a></code> element that is <a href=#concept-fe-disabled id=disabled-elements:concept-fe-disabled>disabled</a><li>an <code id=disabled-elements:the-input-element><a href=#the-input-element>input</a></code> element that is <a href=#concept-fe-disabled id=disabled-elements:concept-fe-disabled-2>disabled</a><li>a <code id=disabled-elements:the-select-element><a href=#the-select-element>select</a></code> element that is <a href=#concept-fe-disabled id=disabled-elements:concept-fe-disabled-3>disabled</a><li>a <code id=disabled-elements:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element that is <a href=#concept-fe-disabled id=disabled-elements:concept-fe-disabled-4>disabled</a><li>an <code id=disabled-elements:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element that has a <code id=disabled-elements:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute<li>an <code id=disabled-elements:the-option-element><a href=#the-option-element>option</a></code> element that is <a href=#concept-option-disabled id=disabled-elements:concept-option-disabled>disabled</a><li>a <code id=disabled-elements:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element that has a <code id=disabled-elements:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute<li>a <code id=disabled-elements:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element that is a <a href=#concept-fieldset-disabled id=disabled-elements:concept-fieldset-disabled>disabled fieldset</a></ul>
- <p class=note>This definition is used to determine what elements <a href=#specially-focusable id=disabled-elements:specially-focusable>can be focused</a> and which elements match the <code id=disabled-elements:selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-class.</p>
-
- <h3 id=selectors>4.15 Matching HTML elements using selectors</h3>
- <h4 id=case-sensitivity>4.15.1 Case-sensitivity</h4>
- <p>The Selectors specification leaves the case-sensitivity of element names, attribute names, and
- attribute values to be defined by the host language. <a href=#refsSELECTORS>[SELECTORS]</a></p>
- <p class=note>The Selectors specification defines that ID and class selectors, when matched
- against elements in documents that are in <a href=#quirks-mode id=case-sensitivity:quirks-mode>quirks mode</a>, will be work in an <a href=#ascii-case-insensitive id=case-sensitivity:ascii-case-insensitive>ASCII
- case-insensitive</a>.</p>
- <p>When comparing a CSS element type selector to the names of <a href=#html-elements id=case-sensitivity:html-elements>HTML elements</a> in
- <a href=#html-documents id=case-sensitivity:html-documents>HTML documents</a>, the CSS element type selector must first be <a href=#converted-to-ascii-lowercase id=case-sensitivity:converted-to-ascii-lowercase>converted to ASCII
- lowercase</a>. The same selector when compared to other elements must be compared according to
- its original case. In both cases, the comparison is <a href=#case-sensitive id=case-sensitivity:case-sensitive>case-sensitive</a>.</p>
-
- <p>When comparing the name part of a CSS attribute selector to the names of namespace-less
- attributes on <a href=#html-elements id=case-sensitivity:html-elements-2>HTML elements</a> in <a href=#html-documents id=case-sensitivity:html-documents-2>HTML documents</a>, the name part of the CSS
- attribute selector must first be <a href=#converted-to-ascii-lowercase id=case-sensitivity:converted-to-ascii-lowercase-2>converted to ASCII lowercase</a>. The same selector when
- compared to other attributes must be compared according to its original case. In both cases, the
- comparison is <a href=#case-sensitive id=case-sensitivity:case-sensitive-2>case-sensitive</a>.</p>
-
- <p>Everything else (attribute values on <a href=#html-elements id=case-sensitivity:html-elements-3>HTML elements</a>, IDs and classes in
- <a href=#no-quirks-mode id=case-sensitivity:no-quirks-mode>no-quirks mode</a> and <a href=#limited-quirks-mode id=case-sensitivity:limited-quirks-mode>limited-quirks mode</a>, and element names, attribute
- names, and attribute values in <a href=#xml-documents id=case-sensitivity:xml-documents>XML documents</a>) must be treated as
- <a href=#case-sensitive id=case-sensitivity:case-sensitive-3>case-sensitive</a> for the purposes of selector matching.</p>
- <h4 id=pseudo-classes>4.15.2 Pseudo-classes</h4>
- <p>There are a number of dynamic selectors that can be used with HTML. This section defines when
- these selectors match HTML elements. <a href=#refsSELECTORS>[SELECTORS]</a> <a href=#refsCSSUI>[CSSUI]</a></p>
- <dl><dt><dfn id=selector-link><code>:link</code></dfn><dt><dfn id=selector-visited><code>:visited</code></dfn><dd>
- <p>All <code id=pseudo-classes:the-a-element><a href=#the-a-element>a</a></code> elements that have an <code id=pseudo-classes:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
- attribute, all <code id=pseudo-classes:the-area-element><a href=#the-area-element>area</a></code> elements that have an <code id=pseudo-classes:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute, and all <code id=pseudo-classes:the-link-element><a href=#the-link-element>link</a></code> elements that have
- an <code id=pseudo-classes:attr-link-href><a href=#attr-link-href>href</a></code> attribute, must match one of <code id=pseudo-classes:selector-link><a href=#selector-link>:link</a></code> and <code id=pseudo-classes:selector-visited><a href=#selector-visited>:visited</a></code>.</p>
- <p>Other specifications might apply more specific rules regarding how these elements are to
- match these pseudo-classes, to mitigate some privacy concerns that apply with straightforward
- implementations of this requirement.</p>
- <dt><dfn id=selector-active><code>:active</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-active><a href=#selector-active>:active</a></code> pseudo-class is defined to match an element
- <q cite=http://dev.w3.org/csswg/selectors3/#the-user-action-pseudo-classes-hover-act>while an
- element is <i>being activated</i> by the user</q>. For the purposes of defining the <code id=pseudo-classes:selector-active-2><a href=#selector-active>:active</a></code> pseudo-class only, an HTML user agent must consider an
- element as <i>being activated</i> if it is:</p>
- <ul><li>
- <p>An element falling into one of the following categories between the time the user begins to
- indicate an intent to trigger the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior>activation behavior</a> and either the
- time the user stops indicating an intent to trigger the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior-2>activation
- behavior</a>, or the time the element's <a href=#activation-behavior id=pseudo-classes:activation-behavior-3>activation behavior</a> has finished
- running, which ever comes first:</p>
- <ul><li><code id=pseudo-classes:the-a-element-2><a href=#the-a-element>a</a></code> elements that have an <code id=pseudo-classes:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code>
- attribute<li><code id=pseudo-classes:the-area-element-2><a href=#the-area-element>area</a></code> elements that have an <code id=pseudo-classes:attr-hyperlink-href-4><a href=#attr-hyperlink-href>href</a></code>
- attribute<li><code id=pseudo-classes:the-link-element-2><a href=#the-link-element>link</a></code> elements that have an <code id=pseudo-classes:attr-link-href-2><a href=#attr-link-href>href</a></code>
- attribute<li><code id=pseudo-classes:the-button-element><a href=#the-button-element>button</a></code> elements that are not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled>disabled</a><li><code id=pseudo-classes:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type><a href=#attr-input-type>type</a></code> attribute is
- in the <a href="#submit-button-state-(type=submit)" id="pseudo-classes:submit-button-state-(type=submit)">Submit Button</a>, <a href="#image-button-state-(type=image)" id="pseudo-classes:image-button-state-(type=image)">Image Button</a>, <a href="#reset-button-state-(type=reset)" id="pseudo-classes:reset-button-state-(type=reset)">Reset
- Button</a>, or <a href="#button-state-(type=button)" id="pseudo-classes:button-state-(type=button)">Button</a> state<li><code id=pseudo-classes:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> elements that do not have a <code id=pseudo-classes:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code> attribute<li>elements that have their <a href=#specially-focusable id=pseudo-classes:specially-focusable>tabindex focus flag</a> set</ul>
- <p class=example>For example, if the user is using a keyboard to push a <code id=pseudo-classes:the-button-element-2><a href=#the-button-element>button</a></code>
- element by pressing the space bar, the element would match this pseudo-class in between the
- time that the element received the <code id=pseudo-classes:event-keydown><a href=#event-keydown>keydown</a></code> event and the
- time the element received the <code id=pseudo-classes:event-keyup><a href=#event-keyup>keyup</a></code> event.</p>
- <li>
- <p>An element that the user indicates using a pointing device while that pointing device is in
- the "down" state (e.g. for a mouse, between the time the mouse button is pressed and the time
- it is depressed).</p>
- <li>
- <p>An element that has a descendant that is currently matching the <code id=pseudo-classes:selector-active-3><a href=#selector-active>:active</a></code> pseudo-class.</p>
- </ul>
- <dt><dfn id=selector-hover><code>:hover</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-hover><a href=#selector-hover>:hover</a></code> pseudo-class is defined to match an element <q cite=http://dev.w3.org/csswg/selectors3/#the-user-action-pseudo-classes-hover-act>while the
- user <i>designates</i> an element with a pointing device</q>. For the purposes of defining the
- <code id=pseudo-classes:selector-hover-2><a href=#selector-hover>:hover</a></code> pseudo-class only, an HTML user agent must consider
- an element as being one that the user <i>designates</i> if it is:</p>
- <ul><li>
- <p>An element that the user indicates using a pointing device.</p>
- <li>
- <p>An element that has a descendant that the user indicates using a pointing device.</p>
- <li>
- <p>An element that is the <a href=#labeled-control id=pseudo-classes:labeled-control>labeled control</a> of a <code id=pseudo-classes:the-label-element><a href=#the-label-element>label</a></code> element that is
- currently matching <a href=#selector-hover id=pseudo-classes:selector-hover-3>:hover</a>.</p>
- </ul>
- <div class=example>
- <p>Consider in particular a fragment such as:</p>
- <pre><p> <label for=c> <input id=a> </label> <span id=b> <input id=c> </span> </p></pre>
- <p>If the user designates the element with ID "<code>a</code>" with their pointing
- device, then the <code id=pseudo-classes:the-p-element><a href=#the-p-element>p</a></code> element (and all its ancestors not shown in the snippet above),
- the <code id=pseudo-classes:the-label-element-2><a href=#the-label-element>label</a></code> element, the element with ID "<code>a</code>", and the element
- with ID "<code>c</code>" will match the <a href=#selector-hover id=pseudo-classes:selector-hover-4>:hover</a>
- pseudo-class. The element with ID "<code>a</code>" matches it from condition 1, the
- <code id=pseudo-classes:the-label-element-3><a href=#the-label-element>label</a></code> and <code id=pseudo-classes:the-p-element-2><a href=#the-p-element>p</a></code> elements match it because of condition 2 (one of their
- descendants is designated), and the element with ID "<code>c</code>" matches it
- through condition 3 (its <code id=pseudo-classes:the-label-element-4><a href=#the-label-element>label</a></code> element matches <a href=#selector-hover id=pseudo-classes:selector-hover-5>:hover</a>). However, the element with ID "<code>b</code>"
- does <em>not</em> match <a href=#selector-hover id=pseudo-classes:selector-hover-6>:hover</a>: its descendant is not
- designated, even though it matches <a href=#selector-hover id=pseudo-classes:selector-hover-7>:hover</a>.</p>
- </div>
- <dt><dfn id=selector-focus><code>:focus</code></dfn><dd>
- <p>For the purposes of the CSS ':focus' pseudo-class, an <dfn id=element-has-the-focus>element has the focus</dfn> when
- its <a href=#top-level-browsing-context id=pseudo-classes:top-level-browsing-context>top-level browsing context</a> has the system focus, it is not itself a
- <a href=#browsing-context-container id=pseudo-classes:browsing-context-container>browsing context container</a>, and it is one of the elements listed in the <a href=#focus-chain id=pseudo-classes:focus-chain>focus
- chain</a> of the <a href=#currently-focused-area-of-a-top-level-browsing-context id=pseudo-classes:currently-focused-area-of-a-top-level-browsing-context>currently focused area of the top-level browsing context</a>.</p>
- <dt><dfn id=selector-enabled><code>:enabled</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-enabled><a href=#selector-enabled>:enabled</a></code> pseudo-class must match any element
- that is one of the following:</p>
- <ul><li>an <code id=pseudo-classes:the-a-element-3><a href=#the-a-element>a</a></code> element that has an <code id=pseudo-classes:attr-hyperlink-href-5><a href=#attr-hyperlink-href>href</a></code> attribute<li>an <code id=pseudo-classes:the-area-element-3><a href=#the-area-element>area</a></code> element that has an <code id=pseudo-classes:attr-hyperlink-href-6><a href=#attr-hyperlink-href>href</a></code> attribute<li>a <code id=pseudo-classes:the-link-element-3><a href=#the-link-element>link</a></code> element that has an <code id=pseudo-classes:attr-link-href-3><a href=#attr-link-href>href</a></code> attribute<li>a <code id=pseudo-classes:the-button-element-3><a href=#the-button-element>button</a></code> element that is not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-2>disabled</a><li>an <code id=pseudo-classes:the-input-element-2><a href=#the-input-element>input</a></code> element that is not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-3>disabled</a><li>a <code id=pseudo-classes:the-select-element><a href=#the-select-element>select</a></code> element that is not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-4>disabled</a><li>a <code id=pseudo-classes:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element that is not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-5>disabled</a><li>an <code id=pseudo-classes:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element that does not have a <code id=pseudo-classes:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code> attribute<li>an <code id=pseudo-classes:the-option-element><a href=#the-option-element>option</a></code> element that is not <a href=#concept-option-disabled id=pseudo-classes:concept-option-disabled>disabled</a><li>a <code id=pseudo-classes:the-menuitem-element-2><a href=#the-menuitem-element>menuitem</a></code> element that does not have a <code id=pseudo-classes:attr-menuitem-disabled-2><a href=#attr-menuitem-disabled>disabled</a></code> attribute<li>a <code id=pseudo-classes:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> element that is not a <a href=#concept-fieldset-disabled id=pseudo-classes:concept-fieldset-disabled>disabled fieldset</a></ul>
- <dt><dfn id=selector-disabled><code>:disabled</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-disabled><a href=#selector-disabled>:disabled</a></code> pseudo-class must match any element that
- is <a href=#concept-element-disabled id=pseudo-classes:concept-element-disabled>actually disabled</a>.</p>
- <dt><dfn id=selector-checked><code>:checked</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-checked><a href=#selector-checked>:checked</a></code> pseudo-class must match any element
- falling into one of the following categories:</p>
- <ul><li><code id=pseudo-classes:the-input-element-3><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#checkbox-state-(type=checkbox)" id="pseudo-classes:checkbox-state-(type=checkbox)">Checkbox</a> state and whose <a href=#concept-fe-checked id=pseudo-classes:concept-fe-checked>checkedness</a> state is true<li><code id=pseudo-classes:the-input-element-4><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#radio-button-state-(type=radio)" id="pseudo-classes:radio-button-state-(type=radio)">Radio Button</a> state and whose <a href=#concept-fe-checked id=pseudo-classes:concept-fe-checked-2>checkedness</a> state is true<li><code id=pseudo-classes:the-option-element-2><a href=#the-option-element>option</a></code> elements whose <a href=#concept-option-selectedness id=pseudo-classes:concept-option-selectedness>selectedness</a> is true<li><code id=pseudo-classes:the-menuitem-element-3><a href=#the-menuitem-element>menuitem</a></code> elements whose <code id=pseudo-classes:attr-menuitem-type><a href=#attr-menuitem-type>type</a></code> attribute
- is in the <a href=#attr-menuitem-type-state-checkbox id=pseudo-classes:attr-menuitem-type-state-checkbox>Checkbox</a> state and that have a
- <code id=pseudo-classes:attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code> attribute<li><code id=pseudo-classes:the-menuitem-element-4><a href=#the-menuitem-element>menuitem</a></code> elements whose <code id=pseudo-classes:attr-menuitem-type-2><a href=#attr-menuitem-type>type</a></code> attribute
- is in the <a href=#attr-menuitem-type-state-radio id=pseudo-classes:attr-menuitem-type-state-radio>Radio</a> state and that have a <code id=pseudo-classes:attr-menuitem-checked-2><a href=#attr-menuitem-checked>checked</a></code> attribute</ul>
- <dt><dfn id=selector-indeterminate><code>:indeterminate</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-indeterminate><a href=#selector-indeterminate>:indeterminate</a></code> pseudo-class must match any
- element falling into one of the following categories:</p>
- <ul><li><code id=pseudo-classes:the-input-element-5><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#checkbox-state-(type=checkbox)" id="pseudo-classes:checkbox-state-(type=checkbox)-2">Checkbox</a> state and whose <code id=pseudo-classes:dom-input-indeterminate><a href=#dom-input-indeterminate>indeterminate</a></code> IDL attribute is set to true<li><code id=pseudo-classes:the-input-element-6><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#radio-button-state-(type=radio)" id="pseudo-classes:radio-button-state-(type=radio)-2">Radio Button</a> state and whose <a href=#radio-button-group id=pseudo-classes:radio-button-group>radio button
- group</a> contains no <code id=pseudo-classes:the-input-element-7><a href=#the-input-element>input</a></code> elements whose <a href=#concept-fe-checked id=pseudo-classes:concept-fe-checked-3>checkedness</a> state is true.<li><code id=pseudo-classes:the-progress-element><a href=#the-progress-element>progress</a></code> elements with no <code id=pseudo-classes:attr-progress-value><a href=#attr-progress-value>value</a></code>
- content attribute</ul>
- <dt><dfn id=selector-default><code>:default</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-default><a href=#selector-default>:default</a></code> pseudo-class must match any element
- falling into one of the following categories:</p>
- <ul><li><code id=pseudo-classes:the-button-element-4><a href=#the-button-element>button</a></code> elements that are their form's <a href=#default-button id=pseudo-classes:default-button>default button</a><li><code id=pseudo-classes:the-input-element-8><a href=#the-input-element>input</a></code> elements whose <code id=pseudo-classes:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute is in
- the <a href="#submit-button-state-(type=submit)" id="pseudo-classes:submit-button-state-(type=submit)-2">Submit Button</a> or <a href="#image-button-state-(type=image)" id="pseudo-classes:image-button-state-(type=image)-2">Image Button</a> state, and that are their form's
- <a href=#default-button id=pseudo-classes:default-button-2>default button</a><li><code id=pseudo-classes:the-input-element-9><a href=#the-input-element>input</a></code> elements to which the <code id=pseudo-classes:attr-input-checked><a href=#attr-input-checked>checked</a></code>
- attribute applies and that have a <code id=pseudo-classes:attr-input-checked-2><a href=#attr-input-checked>checked</a></code>
- attribute<li><code id=pseudo-classes:the-option-element-3><a href=#the-option-element>option</a></code> elements that have a <code id=pseudo-classes:attr-option-selected><a href=#attr-option-selected>selected</a></code>
- attribute</ul>
- <dt><dfn id=selector-valid><code>:valid</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-valid><a href=#selector-valid>:valid</a></code> pseudo-class must match any element falling
- into one of the following categories:</p>
- <ul><li>elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation>candidates for
- constraint validation</a> and that <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid>satisfy their
- constraints</a><li><code id=pseudo-classes:the-form-element><a href=#the-form-element>form</a></code> elements that are not the <a href=#form-owner id=pseudo-classes:form-owner>form owner</a> of any elements that
- themselves are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-2>candidates for constraint
- validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-2>satisfy their
- constraints</a><li><code id=pseudo-classes:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code> elements that have no descendant elements that themselves are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-3>candidates for constraint validation</a> but do
- not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-3>satisfy their constraints</a></ul>
- <dt><dfn id=selector-invalid><code>:invalid</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-invalid><a href=#selector-invalid>:invalid</a></code> pseudo-class must match any element
- falling into one of the following categories:</p>
- <ul><li>elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-4>candidates for
- constraint validation</a> but that do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-4>satisfy their
- constraints</a><li><code id=pseudo-classes:the-form-element-2><a href=#the-form-element>form</a></code> elements that are the <a href=#form-owner id=pseudo-classes:form-owner-2>form owner</a> of one or more elements
- that themselves are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-5>candidates for constraint
- validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-5>satisfy their
- constraints</a><li><code id=pseudo-classes:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code> elements that have of one or more descendant elements that themselves
- are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-6>candidates for constraint
- validation</a> but do not <a href=#concept-fv-valid id=pseudo-classes:concept-fv-valid-6>satisfy their
- constraints</a></ul>
- <dt><dfn id=selector-in-range><code>:in-range</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-in-range><a href=#selector-in-range>:in-range</a></code> pseudo-class must match all elements
- that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-7>candidates for constraint
- validation</a>, <a href=#have-range-limitations id=pseudo-classes:have-range-limitations>have range limitations</a>, and that are neither <a href=#suffering-from-an-underflow id=pseudo-classes:suffering-from-an-underflow>suffering
- from an underflow</a> nor <a href=#suffering-from-an-overflow id=pseudo-classes:suffering-from-an-overflow>suffering from an overflow</a>.</p>
- <dt><dfn id=selector-out-of-range><code>:out-of-range</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-out-of-range><a href=#selector-out-of-range>:out-of-range</a></code> pseudo-class must match all
- elements that are <a href=#candidate-for-constraint-validation id=pseudo-classes:candidate-for-constraint-validation-8>candidates for constraint
- validation</a>, <a href=#have-range-limitations id=pseudo-classes:have-range-limitations-2>have range limitations</a>, and that are either <a href=#suffering-from-an-underflow id=pseudo-classes:suffering-from-an-underflow-2>suffering from
- an underflow</a> or <a href=#suffering-from-an-overflow id=pseudo-classes:suffering-from-an-overflow-2>suffering from an overflow</a>.</p>
- <dt><dfn id=selector-required><code>:required</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-required><a href=#selector-required>:required</a></code> pseudo-class must match any element
- falling into one of the following categories:</p>
- <ul><li><code id=pseudo-classes:the-input-element-10><a href=#the-input-element>input</a></code> elements that are <i id=pseudo-classes:concept-input-required><a href=#concept-input-required>required</a></i><li><code id=pseudo-classes:the-select-element-2><a href=#the-select-element>select</a></code> elements that have a <code id=pseudo-classes:attr-select-required><a href=#attr-select-required>required</a></code>
- attribute<li><code id=pseudo-classes:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements that have a <code id=pseudo-classes:attr-textarea-required><a href=#attr-textarea-required>required</a></code> attribute</ul>
- <dt><dfn id=selector-optional><code>:optional</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-optional><a href=#selector-optional>:optional</a></code> pseudo-class must match any element
- falling into one of the following categories:</p>
- <ul><li><code id=pseudo-classes:the-input-element-11><a href=#the-input-element>input</a></code> elements to which the <code id=pseudo-classes:attr-input-required><a href=#attr-input-required>required</a></code>
- attribute applies that are not <i id=pseudo-classes:concept-input-required-2><a href=#concept-input-required>required</a></i><li><code id=pseudo-classes:the-select-element-3><a href=#the-select-element>select</a></code> elements that do not have a <code id=pseudo-classes:attr-select-required-2><a href=#attr-select-required>required</a></code> attribute<li><code id=pseudo-classes:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code id=pseudo-classes:attr-textarea-required-2><a href=#attr-textarea-required>required</a></code> attribute</ul>
- <dt><dfn id=selector-read-only><code>:read-only</code></dfn><dt><dfn id=selector-read-write><code>:read-write</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-read-write><a href=#selector-read-write>:read-write</a></code> pseudo-class must match any element
- falling into one of the following categories, which for the purposes of Selectors are thus
- considered <i>user-alterable</i>: <a href=#refsSELECTORS>[SELECTORS]</a></p>
- <ul><li><code id=pseudo-classes:the-input-element-12><a href=#the-input-element>input</a></code> elements to which the <code id=pseudo-classes:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>
- attribute applies, and that are <i id=pseudo-classes:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> (i.e. that do not
- have the <code id=pseudo-classes:attr-input-readonly-2><a href=#attr-input-readonly>readonly</a></code> attribute specified and that are not
- <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-6>disabled</a>)<li><code id=pseudo-classes:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> elements that do not have a <code id=pseudo-classes:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute, and that are not <a href=#concept-fe-disabled id=pseudo-classes:concept-fe-disabled-7>disabled</a><li>elements that are <a href=#editing-host id=pseudo-classes:editing-host>editing hosts</a> or <a href=#editable id=pseudo-classes:editable>editable</a>
- and are neither <code id=pseudo-classes:the-input-element-13><a href=#the-input-element>input</a></code> elements nor <code id=pseudo-classes:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code> elements</ul>
- <p>The <code id=pseudo-classes:selector-read-only><a href=#selector-read-only>:read-only</a></code> pseudo-class must match all other
- <a href=#html-elements id=pseudo-classes:html-elements>HTML elements</a>.</p>
- <dt><dfn id=selector-ltr><code>:dir(ltr)</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-ltr><a href=#selector-ltr>:dir(ltr)</a></code> pseudo-class must match all elements whose
- <a href=#the-directionality id=pseudo-classes:the-directionality>directionality</a> is '<a href=#concept-ltr id=pseudo-classes:concept-ltr>ltr</a>'.</p>
- <dt><dfn id=selector-rtl><code>:dir(rtl)</code></dfn><dd>
- <p>The <code id=pseudo-classes:selector-rtl><a href=#selector-rtl>:dir(rtl)</a></code> pseudo-class must match all elements whose
- <a href=#the-directionality id=pseudo-classes:the-directionality-2>directionality</a> is '<a href=#concept-rtl id=pseudo-classes:concept-rtl>rtl</a>'.</p>
- </dl>
- <p class=note>Another section of this specification defines the <i id=pseudo-classes:target-element><a href=#target-element>target element</a></i> used with the <code id=pseudo-classes:selector-target><a href=#selector-target>:target</a></code>
- pseudo-class.</p>
- <p class=note>This specification does not define when an element matches the <code>:lang()</code> dynamic pseudo-class, as it is defined in sufficient
- detail in a language-agnostic fashion in the Selectors specification. <a href=#refsSELECTORS>[SELECTORS]</a></p>
-
- <h2 id=microdata>5 <dfn>Microdata</dfn></h2>
- <h3 id=introduction-7>5.1 Introduction</h3>
- <h4 id=overview>5.1.1 Overview</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Sometimes, it is desirable to annotate content with specific machine-readable labels, e.g. to
- allow generic scripts to provide services that are customised to the page, or to enable content
- from a variety of cooperating authors to be processed by a single script in a consistent
- manner.</p>
- <p>For this purpose, authors can use the microdata features described in this section. Microdata
- allows nested groups of name-value pairs to be added to documents, in parallel with the existing
- content.</p>
- <h4 id=the-basic-syntax>5.1.2 The basic syntax</h4>
- <p><i>This section is non-normative.</i></p>
- <p>At a high level, microdata consists of a group of name-value pairs. The groups are called <a href=#concept-item id=the-basic-syntax:concept-item>items</a>, and each name-value pair is a property. Items and properties
- are represented by regular elements.</p>
- <p>To create an item, the <code id=the-basic-syntax:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is used.</p>
- <p>To add a property to an item, the <code id=the-basic-syntax:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is used
- on one of the <a href=#concept-item id=the-basic-syntax:concept-item-2>item's</a> descendants.</p>
- <div class=example>
- <p>Here there are two items, each of which has the property "name":</p>
- <pre><div itemscope>
- <p>My name is <span itemprop="name">Elizabeth</span>.</p>
- </div>
- <div itemscope>
- <p>My name is <span itemprop="name">Daniel</span>.</p>
- </div></pre>
- </div>
- <p>Markup without the microdata-related attributes does not have any effect on the microdata
- model.</p>
- <div class=example>
- <p>These two examples are exactly equivalent, at a microdata level, as the previous two examples
- respectively:</p>
- <pre><div itemscope>
- <p>My <em>name</em> is <span itemprop="name">E<strong>liz</strong>abeth</span>.</p>
- </div>
- <section>
- <div itemscope>
- <aside>
- <p>My name is <span itemprop="name"><a href="/?user=daniel">Daniel</a></span>.</p>
- </aside>
- </div>
- </section></pre>
- </div>
- <p>Properties generally have values that are strings.</p>
- <div class=example>
- <p>Here the item has three properties:</p>
- <pre><div itemscope>
- <p>My name is <span itemprop="name">Neil</span>.</p>
- <p>My band is called <span itemprop="band">Four Parts Water</span>.</p>
- <p>I am <span itemprop="nationality">British</span>.</p>
- </div></pre>
- </div>
- <p>When a string value is a <a href=#url id=the-basic-syntax:url>URL</a>, it is expressed using the <code id=the-basic-syntax:the-a-element><a href=#the-a-element>a</a></code> element and
- its <code id=the-basic-syntax:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute, the <code id=the-basic-syntax:the-img-element><a href=#the-img-element>img</a></code> element and its
- <code id=the-basic-syntax:attr-img-src><a href=#attr-img-src>src</a></code> attribute, or other elements that link to or embed external
- resources.</p>
- <div class=example>
- <p>In this example, the item has one property, "image", whose value is a URL:</p>
- <pre><div itemscope>
- <img itemprop="image" src="google-logo.png" alt="Google">
- </div></pre>
- </div>
- <p>When a string value is in some machine-readable format unsuitable for human consumption, it is
- expressed using the <code id=the-basic-syntax:attr-data-value><a href=#attr-data-value>value</a></code> attribute of the <code id=the-basic-syntax:the-data-element><a href=#the-data-element>data</a></code>
- element, with the human-readable version given in the element's contents.</p>
- <div class=example>
- <p>Here, there is an item with a property whose value is a product ID. The ID is not
- human-friendly, so the product's name is used the human-visible text instead of the ID.</p>
- <pre><h1 itemscope>
- <data itemprop="product-id" value="9678AOU879">The Instigator 2000</data>
- </h1></pre>
- </div>
- <p>For numeric data, the <code id=the-basic-syntax:the-meter-element><a href=#the-meter-element>meter</a></code> element and its <code id=the-basic-syntax:attr-meter-value><a href=#attr-meter-value>value</a></code> attribute can be used instead.</p>
- <div class=example>
- <p>Here a rating is given using a <code id=the-basic-syntax:the-meter-element-2><a href=#the-meter-element>meter</a></code> element.</p>
- <pre><div itemscope itemtype="http://schema.org/Product">
- <span itemprop="name">Panasonic White 60L Refrigerator</span>
- <img src="panasonic-fridge-60l-white.jpg" alt="">
- <div itemprop="aggregateRating"
- itemscope itemtype="http://schema.org/AggregateRating">
- <meter itemprop="ratingValue" min=0 value=3.5 max=5>Rated 3.5/5</meter>
- (based on <span itemprop="reviewCount">11</span> customer reviews)
- </div>
- </div></pre>
- </div>
- <p>Similarly, for date- and time-related data, the <code id=the-basic-syntax:the-time-element><a href=#the-time-element>time</a></code> element and its <code id=the-basic-syntax:attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> attribute can be used instead.</p>
- <div class=example>
- <p>In this example, the item has one property, "birthday", whose value is a date:</p>
- <pre><div itemscope>
- I was born on <time itemprop="birthday" datetime="2009-05-10">May 10th 2009</time>.
- </div></pre>
- </div>
- <p>Properties can also themselves be groups of name-value pairs, by putting the <code id=the-basic-syntax:attr-itemscope-2><a href=#attr-itemscope>itemscope</a></code> attribute on the element that declares the property.</p>
- <p>Items that are not part of others are called <a href=#top-level-microdata-items id=the-basic-syntax:top-level-microdata-items>top-level microdata items</a>.</p>
- <div class=example>
- <p>In this example, the outer item represents a person, and the inner one represents a band:</p>
- <pre><div itemscope>
- <p>Name: <span itemprop="name">Amanda</span></p>
- <p>Band: <span itemprop="band" itemscope> <span itemprop="name">Jazz Band</span> (<span itemprop="size">12</span> players)</span></p>
- </div></pre>
- <p>The outer item here has two properties, "name" and "band". The "name" is "Amanda", and the
- "band" is an item in its own right, with two properties, "name" and "size". The "name" of the
- band is "Jazz Band", and the "size" is "12".</p>
- <p>The outer item in this example is a top-level microdata item.</p>
- </div>
- <p>Properties that are not descendants of the element with the <code id=the-basic-syntax:attr-itemscope-3><a href=#attr-itemscope>itemscope</a></code> attribute can be associated with the <a href=#concept-item id=the-basic-syntax:concept-item-3>item</a> using the <code id=the-basic-syntax:attr-itemref><a href=#attr-itemref>itemref</a></code> attribute.
- This attribute takes a list of IDs of elements to crawl in addition to crawling the children of
- the element with the <code id=the-basic-syntax:attr-itemscope-4><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
- <div class=example>
- <p>This example is the same as the previous one, but all the properties are separated from their
- <a href=#concept-item id=the-basic-syntax:concept-item-4>items</a>:</p>
- <pre><div itemscope id="amanda" itemref="a b"></div>
- <p id="a">Name: <span itemprop="name">Amanda</span></p>
- <div id="b" itemprop="band" itemscope itemref="c"></div>
- <div id="c">
- <p>Band: <span itemprop="name">Jazz Band</span></p>
- <p>Size: <span itemprop="size">12</span> players</p>
- </div></pre>
- <p>This gives the same result as the previous example. The first item has two properties, "name",
- set to "Amanda", and "band", set to another item. That second item has two further properties,
- "name", set to "Jazz Band", and "size", set to "12".</p>
- </div>
- <p>An <a href=#concept-item id=the-basic-syntax:concept-item-5>item</a> can have multiple properties with the same name and
- different values.</p>
- <div class=example>
- <p>This example describes an ice cream, with two flavors:</p>
- <pre><div itemscope>
- <p>Flavors in my favorite ice cream:</p>
- <ul>
- <li itemprop="flavor">Lemon sorbet</li>
- <li itemprop="flavor">Apricot sorbet</li>
- </ul>
- </div></pre>
- <p>This thus results in an item with two properties, both "flavor", having the values "Lemon
- sorbet" and "Apricot sorbet".</p>
- </div>
- <p>An element introducing a property can also introduce multiple properties at once, to avoid
- duplication when some of the properties have the same value.</p>
- <div class=example>
- <p>Here we see an item with two properties, "favorite-color" and "favorite-fruit", both set to
- the value "orange":</p>
- <pre><div itemscope>
- <span itemprop="favorite-color favorite-fruit">orange</span>
- </div></pre>
- </div>
- <p>It's important to note that there is no relationship between the microdata and the content of
- the document where the microdata is marked up.</p>
- <div class=example>
- <p>There is no semantic difference, for instance, between the following two examples:</p>
- <pre><figure>
- <img src="castle.jpeg">
- <figcaption><span itemscope><span itemprop="name">The Castle</span></span> (1986)</figcaption>
- </figure></pre>
- <pre><span itemscope><meta itemprop="name" content="The Castle"></span>
- <figure>
- <img src="castle.jpeg">
- <figcaption>The Castle (1986)</figcaption>
- </figure></pre>
- <p>Both have a figure with a caption, and both, completely unrelated to the figure, have an item
- with a name-value pair with the name "name" and the value "The Castle". The only difference is
- that if the user drags the caption out of the document, in the former case, the item will be
- included in the drag-and-drop data. In neither case is the image in any way associated with the
- item.</p>
- </div>
- <h4 id=typed-items>5.1.3 Typed items</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The examples in the previous section show how information could be marked up on a page that
- doesn't expect its microdata to be re-used. Microdata is most useful, though, when it is used in
- contexts where other authors and readers are able to cooperate to make new uses of the markup.</p>
- <p>For this purpose, it is necessary to give each <a href=#concept-item id=typed-items:concept-item>item</a> a type,
- such as "http://example.com/person", or "http://example.org/cat", or "http://band.example.net/".
- Types are identified as <a href=#url id=typed-items:url>URLs</a>.</p>
- <p>The type for an <a href=#concept-item id=typed-items:concept-item-2>item</a> is given as the value of an <code id=typed-items:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute on the same element as the <code id=typed-items:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
- <div class=example>
- <p>Here, the item's type is "http://example.org/animals#cat":</p>
- <pre><section itemscope itemtype="http://example.org/animals#cat">
- <h1 itemprop="name">Hedral</h1>
- <p itemprop="desc">Hedral is a male american domestic
- shorthair, with a fluffy black fur with white paws and belly.</p>
- <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
- </section></pre>
- <p>In this example the "http://example.org/animals#cat" item has three properties, a "name"
- ("Hedral"), a "desc" ("Hedral is..."), and an "img" ("hedral.jpeg").</p>
- </div>
- <p>The type gives the context for the properties, thus selecting a vocabulary: a property named
- "class" given for an item with the type "http://census.example/person" might refer to the economic
- class of an individual, while a property named "class" given for an item with the type
- "http://example.com/school/teacher" might refer to the classroom a teacher has been assigned.
- Several types can share a vocabulary. For example, the types "<code>http://example.org/people/teacher</code>" and "<code>http://example.org/people/engineer</code>" could be defined to use the same vocabulary
- (though maybe some properties would not be especially useful in both cases, e.g. maybe the "<code>http://example.org/people/engineer</code>" type might not typically be used with the
- "<code>classroom</code>" property). Multiple types defined to use the same vocabulary can
- be given for a single item by listing the URLs as a space-separated list in the attribute' value.
- An item cannot be given two types if they do not use the same vocabulary, however.</p>
- <h4 id=global-identifiers-for-items>5.1.4 Global identifiers for items</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Sometimes, an <a href=#concept-item id=global-identifiers-for-items:concept-item>item</a> gives information about a topic that has a
- global identifier. For example, books can be identified by their ISBN number.</p>
- <p>Vocabularies (as identified by the <code id=global-identifiers-for-items:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute) can
- be designed such that <a href=#concept-item id=global-identifiers-for-items:concept-item-2>items</a> get associated with their global
- identifier in an unambiguous way by expressing the global identifiers as <a href=#url id=global-identifiers-for-items:url>URLs</a> given in an <code id=global-identifiers-for-items:attr-itemid><a href=#attr-itemid>itemid</a></code> attribute.</p>
- <p>The exact meaning of the <a href=#url id=global-identifiers-for-items:url-2>URLs</a> given in <code id=global-identifiers-for-items:attr-itemid-2><a href=#attr-itemid>itemid</a></code> attributes depends on the vocabulary used.</p>
- <div class=example>
- <p>Here, an item is talking about a particular book:</p>
- <pre><dl itemscope
- itemtype="http://vocab.example.net/book"
- <strong>itemid="urn:isbn:0-330-34032-8"</strong>>
- <dt>Title
- <dd itemprop="title">The Reality Dysfunction
- <dt>Author
- <dd itemprop="author">Peter F. Hamilton
- <dt>Publication date
- <dd><time itemprop="pubdate" datetime="1996-01-26">26 January 1996</time>
- </dl></pre>
- <p>The "<code>http://vocab.example.net/book</code>" vocabulary in this example would
- define that the <code id=global-identifiers-for-items:attr-itemid-3><a href=#attr-itemid>itemid</a></code> attribute takes a <code id=global-identifiers-for-items:urn-protocol><a data-x-internal=urn-protocol href=http://tools.ietf.org/html/rfc2141#section-2>urn:</a></code> <a href=#url id=global-identifiers-for-items:url-3>URL</a> pointing to the ISBN of the book.</p>
- </div>
-
- <h4 id=selecting-names-when-defining-vocabularies>5.1.5 Selecting names when defining vocabularies</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Using microdata means using a vocabulary. For some purposes, an ad-hoc vocabulary is adequate.
- For others, a vocabulary will need to be designed. Where possible, authors are encouraged to
- re-use existing vocabularies, as this makes content re-use easier.</p>
- <p>When designing new vocabularies, identifiers can be created either using <a href=#url id=selecting-names-when-defining-vocabularies:url>URLs</a>, or, for properties, as plain words (with no dots or colons). For URLs,
- conflicts with other vocabularies can be avoided by only using identifiers that correspond to
- pages that the author has control over.</p>
- <div class=example>
- <p>For instance, if Jon and Adam both write content at <code>example.com</code>, at <code>http://example.com/~jon/...</code> and <code>http://example.com/~adam/...</code> respectively, then
- they could select identifiers of the form
- "http://example.com/~jon/name" and "http://example.com/~adam/name"
- respectively.</p>
- </div>
- <p>Properties whose names are just plain words can only be used within the context of the types
- for which they are intended; properties named using URLs can be reused in items of any type. If an
- item has no type, and is not part of another item, then if its properties have names that are just
- plain words, they are not intended to be globally unique, and are instead only intended for
- limited use. Generally speaking, authors are encouraged to use either properties with globally
- unique names (URLs) or ensure that their items are typed.</p>
- <div class=example>
- <p>Here, an item is an "http://example.org/animals#cat", and most of the properties have names
- that are words defined in the context of that type. There are also a few additional properties
- whose names come from other vocabularies.</p>
- <pre><section itemscope itemtype="http://example.org/animals#cat">
- <h1 itemprop="name http://example.com/fn">Hedral</h1>
- <p itemprop="desc">Hedral is a male american domestic
- shorthair, with a fluffy <span
- itemprop="http://example.com/color">black</span> fur with <span
- itemprop="http://example.com/color">white</span> paws and belly.</p>
- <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
- </section></pre>
- <p>This example has one item with the type "http://example.org/animals#cat" and the following
- properties:</p>
- <table><thead><tr><td>Property
- <td>Value
- <tbody><tr><td>name
- <td>Hedral
- <tr><td>http://example.com/fn
- <td>Hedral
- <tr><td>desc
- <td>Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.
- <tr><td>http://example.com/color
- <td>black
- <tr><td>http://example.com/color
- <td>white
- <tr><td>img
- <td>.../hedral.jpeg
- </table>
- </div>
- <h4 id=using-the-microdata-dom-api>5.1.6 Using the microdata DOM API</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The microdata becomes even more useful when scripts can use it to expose information to the
- user, for example offering it in a form that can be used by other applications.</p>
- <p>The <code id=using-the-microdata-dom-api:dom-document-getitems><a href=#dom-document-getitems>document.getItems(<var>typeNames</var>)</a></code>
- method provides access to the <a href=#top-level-microdata-items id=using-the-microdata-dom-api:top-level-microdata-items>top-level microdata items</a>. It returns a
- <code id=using-the-microdata-dom-api:nodelist><a href=#nodelist>NodeList</a></code> containing the items with the specified types, or all types if no argument
- is specified.</p>
- <p>Each <a href=#concept-item id=using-the-microdata-dom-api:concept-item>item</a> is represented in the DOM by the element on which
- the relevant <code id=using-the-microdata-dom-api:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is found. These elements have
- their <code id=using-the-microdata-dom-api:dom-itemscope><a href=#dom-itemscope>element.itemScope</a></code> IDL attribute set to true.</p>
- <p>The type(s) of <a href=#concept-item id=using-the-microdata-dom-api:concept-item-2>items</a> can be obtained using the <code id=using-the-microdata-dom-api:dom-itemtype><a href=#dom-itemtype>element.itemType</a></code> IDL attribute on the element with the <code id=using-the-microdata-dom-api:attr-itemscope-2><a href=#attr-itemscope>itemscope</a></code> attribute.</p>
- <div class=example>
- <p>This sample shows how the <code id=using-the-microdata-dom-api:dom-document-getitems-2><a href=#dom-document-getitems>getItems()</a></code> method can be
- used to obtain a list of all the top-level microdata items of a particular type given in the
- document:</p>
- <pre>var cats = document.getItems("http://example.com/feline");</pre>
- </div>
- <p>Once an element representing an <a href=#concept-item id=using-the-microdata-dom-api:concept-item-3>item</a> has been obtained, its
- properties can be extracted using the <code id=using-the-microdata-dom-api:dom-properties><a href=#dom-properties>properties</a></code> IDL
- attribute. This attribute returns an <code id=using-the-microdata-dom-api:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code>, which can be
- enumerated to go through each element that adds one or more properties to the item. It can also be
- indexed by name, which will return an object with a list of the elements that add properties with
- that name.</p>
- <p>Each element that adds a property also has an <code id=using-the-microdata-dom-api:dom-itemvalue><a href=#dom-itemvalue>itemValue</a></code> IDL
- attribute that returns its value.</p>
- <div class=example>
- <p>This sample gets the first item of type "http://example.net/user" and then pops up an alert
- using the "name" property from that item.</p>
- <pre>var user = document.getItems('http://example.net/user')[0];
- alert('Hello ' + user.properties['name'][0].itemValue + '!');</pre>
- </div>
- <p>The <code id=using-the-microdata-dom-api:htmlpropertiescollection-2-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object, when indexed by name in this way, actually
- returns a <code id=using-the-microdata-dom-api:propertynodelist><a href=#propertynodelist>PropertyNodeList</a></code> object with all the matching properties. The
- <code id=using-the-microdata-dom-api:propertynodelist-2><a href=#propertynodelist>PropertyNodeList</a></code> object can be used to obtain all the values at once using
- <em>its</em> <code id=using-the-microdata-dom-api:dom-propertynodelist-getvalues><a href=#dom-propertynodelist-getvalues>getValues</a></code> method, which returns
- an array of all the values.</p>
- <div class=example>
- <p>In an earlier example, a "http://example.org/animals#cat" item had two
- "http://example.com/color" values. This script looks up the first such item and then lists all
- its values.</p>
- <pre>var cat = document.getItems('http://example.org/animals#cat')[0];
- var colors = cat.properties['http://example.com/color'].getValues();
- var result;
- if (colors.length == 0) {
- result = 'Colour unknown.';
- } else if (colors.length == 1) {
- result = 'Colour: ' + colors[0];
- } else {
- result = 'Colours:';
- for (var i = 0; i < colors.length; i += 1)
- result += ' ' + colors[i];
- }</pre>
- </div>
- <p>It's also possible to get a list of all the <a href=#property-names id=using-the-microdata-dom-api:property-names>property names</a> using the object's
- <code id=using-the-microdata-dom-api:dom-htmlpropertiescollection-names><a href=#dom-htmlpropertiescollection-names>names</a></code> IDL attribute.</p>
- <div class=example>
- <p>This example creates a big list with a nested list for each item on the page, each with all of
- the property names used in that item.</p>
- <pre>var outer = document.createElement('ul');
- var items = document.getItems();
- for (var item = 0; item < items.length; item += 1) {
- var itemLi = document.createElement('li');
- var inner = document.createElement('ul');
- for (var name = 0; name < items[item].properties.names.length; name += 1) {
- var propLi = document.createElement('li');
- propLi.appendChild(document.createTextNode(items[item].properties.names[name]));
- inner.appendChild(propLi);
- }
- itemLi.appendChild(inner);
- outer.appendChild(itemLi);
- }
- document.body.appendChild(outer);</pre>
- <p>If faced with the following from an earlier example:</p>
- <pre><section itemscope itemtype="http://example.org/animals#cat">
- <h1 itemprop="name http://example.com/fn">Hedral</h1>
- <p itemprop="desc">Hedral is a male american domestic
- shorthair, with a fluffy <span
- itemprop="http://example.com/color">black</span> fur with <span
- itemprop="http://example.com/color">white</span> paws and belly.</p>
- <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
- </section></pre>
- <p>...it would result in the following output:</p>
- <ul><li>
- <ul><li>name<li>http://example.com/fn<li>desc<li>http://example.com/color<li>img</ul>
- </ul>
- <p>(The duplicate occurrence of "http://example.com/color" is not included in the list.)</p>
- </div>
- <h3 id=encoding-microdata>5.2 Encoding microdata</h3>
- <h4 id=the-microdata-model>5.2.1 The microdata model</h4>
- <p>The microdata model consists of groups of name-value pairs known as <a href=#concept-item id=the-microdata-model:concept-item>items</a>.</p>
- <p>Each group is known as an <a href=#concept-item id=the-microdata-model:concept-item-2>item</a>. Each <a href=#concept-item id=the-microdata-model:concept-item-3>item</a> can have <a href=#item-types id=the-microdata-model:item-types>item types</a>, a <a href=#global-identifier id=the-microdata-model:global-identifier>global
- identifier</a> (if the vocabulary specified by the <a href=#item-types id=the-microdata-model:item-types-2>item types</a> <a href=#support-global-identifiers-for-items id=the-microdata-model:support-global-identifiers-for-items>support global
- identifiers for items</a>), and a list of name-value pairs. Each name in the name-value pair is
- known as a <a href=#the-properties-of-an-item id=the-microdata-model:the-properties-of-an-item>property</a>, and each <a href=#the-properties-of-an-item id=the-microdata-model:the-properties-of-an-item-2>property</a> has one or more <a href=#concept-property-value id=the-microdata-model:concept-property-value>values</a>. Each <a href=#concept-property-value id=the-microdata-model:concept-property-value-2>value</a> is either a string or itself a group of name-value
- pairs (an <a href=#concept-item id=the-microdata-model:concept-item-4>item</a>). The names are unordered relative to each other,
- but if a particular name has multiple values, they do have a relative order.</p>
- <h4 id=items>5.2.2 Items</h4>
- <p>Every <a href=#html-elements id=items:html-elements>HTML element</a> may have an <dfn id=attr-itemscope><code>itemscope</code></dfn> attribute specified. The <code id=items:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute is a <a href=#boolean-attribute id=items:boolean-attribute>boolean attribute</a>.</p>
- <p>An element with the <code id=items:attr-itemscope-2><a href=#attr-itemscope>itemscope</a></code> attribute specified creates a
- new <dfn id=concept-item>item</dfn>, a group of name-value pairs.</p>
- <hr>
- <p>Elements with an <code id=items:attr-itemscope-3><a href=#attr-itemscope>itemscope</a></code> attribute may have an <dfn id=attr-itemtype><code>itemtype</code></dfn> attribute specified, to give the <a href=#item-types id=items:item-types>item
- types</a> of the <a href=#concept-item id=items:concept-item>item</a>.</p>
- <p>The <code id=items:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute, if specified, must have a value that
- is an <a href=#unordered-set-of-unique-space-separated-tokens id=items:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are
- <a href=#case-sensitive id=items:case-sensitive>case-sensitive</a>, each of which is a <a href=#valid-url id=items:valid-url>valid URL</a> that is an <a href=#absolute-url id=items:absolute-url>absolute
- URL</a>, and all of which are defined to use the same vocabulary. The attribute's value must
- have at least one token.</p>
- <p>The <dfn id=item-types>item types</dfn> of an <a href=#concept-item id=items:concept-item-2>item</a> are the tokens obtained
- by <a href=#split-a-string-on-spaces id=items:split-a-string-on-spaces>splitting the element's <code>itemtype</code> attribute's value on spaces</a>. If the <code id=items:attr-itemtype-2><a href=#attr-itemtype>itemtype</a></code> attribute is missing or parsing it in this way finds no
- tokens, the <a href=#concept-item id=items:concept-item-3>item</a> is said to have no <a href=#item-types id=items:item-types-2>item types</a>.</p>
- <p>The <a href=#item-types id=items:item-types-3>item types</a> must all be types defined in <a href=#other-applicable-specifications id=items:other-applicable-specifications>applicable specifications</a> and must all be defined to use the same
- vocabulary.</p>
-
- <p>Except if otherwise specified by that specification, the <a href=#url id=items:url>URLs</a> given
- as the <a href=#item-types id=items:item-types-4>item types</a> should not be automatically dereferenced.</p>
- <p class=note>A specification could define that its <a href=#item-types id=items:item-types-5>item type</a>
- can be derefenced to provide the user with help information, for example. In fact, vocabulary
- authors are encouraged to provide useful information at the given <a href=#url id=items:url-2>URL</a>.</p>
- <p><a href=#item-types id=items:item-types-6>Item types</a> are opaque identifiers, and user agents must not dereference unknown
- <a href=#item-types id=items:item-types-7>item types</a>, or otherwise deconstruct them, in order to determine how to process
- <a href=#concept-item id=items:concept-item-4>items</a> that use them.</p>
-
- <p>The <code id=items:attr-itemtype-3><a href=#attr-itemtype>itemtype</a></code> attribute must not be specified on elements
- that do not have an <code id=items:attr-itemscope-4><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
- <hr>
- <p>An <a href=#concept-item id=items:concept-item-5>item</a> is said to be a <dfn id=typed-item>typed item</dfn> when either it
- has an <a href=#item-types id=items:item-types-8>item type</a>, or it is the <a href=#concept-property-value id=items:concept-property-value>value</a> of a <a href=#the-properties-of-an-item id=items:the-properties-of-an-item>property</a> of a <a href=#typed-item id=items:typed-item>typed item</a>. The <dfn id=relevant-types>relevant types</dfn> for a
- <a href=#typed-item id=items:typed-item-2>typed item</a> is the <a href=#concept-item id=items:concept-item-6>item</a>'s <a href=#item-types id=items:item-types-9>item types</a>,
- if it has any, or else is the <a href=#relevant-types id=items:relevant-types>relevant types</a> of the <a href=#concept-item id=items:concept-item-7>item</a> for which it is a <a href=#the-properties-of-an-item id=items:the-properties-of-an-item-2>property</a>'s <a href=#concept-property-value id=items:concept-property-value-2>value</a>.</p>
- <hr>
- <p>Elements with an <code id=items:attr-itemscope-5><a href=#attr-itemscope>itemscope</a></code> attribute and an <code id=items:attr-itemtype-4><a href=#attr-itemtype>itemtype</a></code> attribute that references a vocabulary that is defined to
- <dfn id=support-global-identifiers-for-items>support global identifiers for items</dfn> may also have an <dfn id=attr-itemid><code>itemid</code></dfn> attribute specified, to give a global identifier for
- the <a href=#concept-item id=items:concept-item-8>item</a>, so that it can be related to other <a href=#concept-item id=items:concept-item-9>items</a> on pages elsewhere on the Web.</p>
- <p>The <code id=items:attr-itemid><a href=#attr-itemid>itemid</a></code> attribute, if specified, must have a value that is
- a <a href=#valid-url-potentially-surrounded-by-spaces id=items:valid-url-potentially-surrounded-by-spaces>valid URL potentially surrounded by spaces</a>.</p>
- <p>The <dfn id=global-identifier>global identifier</dfn> of an <a href=#concept-item id=items:concept-item-10>item</a> is the value of
- its element's <code id=items:attr-itemid-2><a href=#attr-itemid>itemid</a></code> attribute, if it has one, <a href=#resolve-a-url id=items:resolve-a-url>resolved</a> relative to the element on which the attribute is specified.
- If the <code id=items:attr-itemid-3><a href=#attr-itemid>itemid</a></code> attribute is missing or if resolving it fails, it
- is said to have no <a href=#global-identifier id=items:global-identifier>global identifier</a>.</p>
- <p>The <code id=items:attr-itemid-4><a href=#attr-itemid>itemid</a></code> attribute must not be specified on elements that do
- not have both an <code id=items:attr-itemscope-6><a href=#attr-itemscope>itemscope</a></code> attribute and an <code id=items:attr-itemtype-5><a href=#attr-itemtype>itemtype</a></code> attribute specified, and must not be specified on elements
- with an <code id=items:attr-itemscope-7><a href=#attr-itemscope>itemscope</a></code> attribute whose <code id=items:attr-itemtype-6><a href=#attr-itemtype>itemtype</a></code> attribute specifies a vocabulary that does not <a href=#support-global-identifiers-for-items id=items:support-global-identifiers-for-items>support
- global identifiers for items</a>, as defined by that vocabulary's specification.</p>
- <p>The exact meaning of a <a href=#global-identifier id=items:global-identifier-2>global identifier</a> is determined by the vocabulary's
- specification. It is up to such specifications to define whether multiple items with the same
- global identifier (whether on the same page or on different pages) are allowed to exist, and what
- the processing rules for that vocabulary are with respect to handling the case of multiple items
- with the same ID.</p>
- <hr>
- <p>Elements with an <code id=items:attr-itemscope-8><a href=#attr-itemscope>itemscope</a></code> attribute may have an <dfn id=attr-itemref><code>itemref</code></dfn> attribute specified, to give a list of additional
- elements to crawl to find the name-value pairs of the <a href=#concept-item id=items:concept-item-11>item</a>.</p>
- <p>The <code id=items:attr-itemref><a href=#attr-itemref>itemref</a></code> attribute, if specified, must have a value that
- is an <a href=#unordered-set-of-unique-space-separated-tokens id=items:unordered-set-of-unique-space-separated-tokens-2>unordered set of unique space-separated tokens</a> that are
- <a href=#case-sensitive id=items:case-sensitive-2>case-sensitive</a>, consisting of <a href=#concept-id id=items:concept-id>IDs</a> of elements in the
- same <a href=#home-subtree id=items:home-subtree>home subtree</a>.</p>
- <p>The <code id=items:attr-itemref-2><a href=#attr-itemref>itemref</a></code> attribute must not be specified on elements that
- do not have an <code id=items:attr-itemscope-9><a href=#attr-itemscope>itemscope</a></code> attribute specified.</p>
- <p class=note>The <code id=items:attr-itemref-3><a href=#attr-itemref>itemref</a></code> attribute is not part of the
- microdata data model. It is merely a syntactic construct to aid authors in adding annotations to
- pages where the data to be annotated does not follow a convenient tree structure. For example, it
- allows authors to mark up data in a table so that each column defines a separate <a href=#concept-item id=items:concept-item-12>item</a>, while keeping the properties in the cells.</p>
- <div class=example>
- <p>This example shows a simple vocabulary used to describe the products of a model railway
- manufacturer. The vocabulary has just five property names:</p>
- <dl><dt>product-code<dd>An integer that names the product in the manufacturer's catalog.<dt>name<dd>A brief description of the product.<dt>scale<dd>One of "HO", "1", or "Z" (potentially with leading or trailing
- whitespace), indicating the scale of the product.<dt>digital<dd>If present, one of "Digital", "Delta", or "Systems"
- (potentially with leading or trailing whitespace) indicating that
- the product has a digital decoder of the given type.<dt>track-type<dd>For track-specific products, one of "K", "M", "C" (potentially
- with leading or trailing whitespace) indicating the type of track
- for which the product is intended.</dl>
- <p>This vocabulary has four defined <a href=#item-types id=items:item-types-10>item types</a>:</p>
- <dl><dt>http://md.example.com/loco<dd>Rolling stock with an engine<dt>http://md.example.com/passengers<dd>Passenger rolling stock<dt>http://md.example.com/track<dd>Track pieces<dt>http://md.example.com/lighting<dd>Equipment with lighting</dl>
- <p>Each <a href=#concept-item id=items:concept-item-13>item</a> that uses this vocabulary can be given one or more
- of these types, depending on what the product is.</p>
- <p>Thus, a locomotive might be marked up as:</p>
- <pre><dl itemscope itemtype="http://md.example.com/loco
- http://md.example.com/lighting">
- <dt>Name:
- <dd itemprop="name">Tank Locomotive (DB 80)
- <dt>Product code:
- <dd itemprop="product-code">33041
- <dt>Scale:
- <dd itemprop="scale">HO
- <dt>Digital:
- <dd itemprop="digital">Delta
- </dl></pre>
- <p>A turnout lantern retrofit kit might be marked up as:</p>
- <pre><dl itemscope itemtype="http://md.example.com/track
- http://md.example.com/lighting">
- <dt>Name:
- <dd itemprop="name">Turnout Lantern Kit
- <dt>Product code:
- <dd itemprop="product-code">74470
- <dt>Purpose:
- <dd>For retrofitting 2 <span itemprop="track-type">C</span> Track
- turnouts. <meta itemprop="scale" content="HO">
- </dl></pre>
- <p>A passenger car with no lighting might be marked up as:</p>
- <pre><dl itemscope itemtype="http://md.example.com/passengers">
- <dt>Name:
- <dd itemprop="name">Express Train Passenger Car (DB Am 203)
- <dt>Product code:
- <dd itemprop="product-code">8710
- <dt>Scale:
- <dd itemprop="scale">Z
- </dl></pre>
- <p>Great care is necessary when creating new vocabularies. Often, a hierarchical approach to
- types can be taken that results in a vocabulary where each item only ever has a single type,
- which is generally much simpler to manage.</p>
- </div>
- <h4 id=names:-the-itemprop-attribute>5.2.3 Names: the <dfn><code>itemprop</code></dfn> attribute</h4>
- <p>Every <a href=#html-elements id=names:-the-itemprop-attribute:html-elements>HTML element</a> may have an <code id=names:-the-itemprop-attribute:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute specified, if doing so <a href=#the-properties-of-an-item id=names:-the-itemprop-attribute:the-properties-of-an-item>adds one or more properties</a> to one or more <a href=#concept-item id=names:-the-itemprop-attribute:concept-item>items</a> (as defined below).</p>
- <p>The <code id=names:-the-itemprop-attribute:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute, if specified, must have a value that
- is an <a href=#unordered-set-of-unique-space-separated-tokens id=names:-the-itemprop-attribute:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are
- <a href=#case-sensitive id=names:-the-itemprop-attribute:case-sensitive>case-sensitive</a>, representing the names of the name-value pairs that it adds. The
- attribute's value must have at least one token.</p>
- <p>Each token must be either:</p>
- <ul><li>If the item is a <a href=#typed-item id=names:-the-itemprop-attribute:typed-item>typed item</a>: a <dfn id=defined-property-name>defined property name</dfn> allowed in this
- situation according to the specification that defines the <a href=#relevant-types id=names:-the-itemprop-attribute:relevant-types>relevant types</a> for the
- item, or<li>A <a href=#valid-url id=names:-the-itemprop-attribute:valid-url>valid URL</a> that is an <a href=#absolute-url id=names:-the-itemprop-attribute:absolute-url>absolute URL</a> defined as an item property
- name allowed in this situation by a vocabulary specification, or<li>A <a href=#valid-url id=names:-the-itemprop-attribute:valid-url-2>valid URL</a> that is an <a href=#absolute-url id=names:-the-itemprop-attribute:absolute-url-2>absolute URL</a>, used as a proprietary item
- property name (i.e. one used by the author for private purposes, not defined in a public
- specification), or<li>If the item is not a <a href=#typed-item id=names:-the-itemprop-attribute:typed-item-2>typed item</a>: a string that contains no U+002E FULL STOP
- characters (.) and no U+003A COLON characters (:), used as a proprietary item property name (i.e.
- one used by the author for private purposes, not defined in a public specification).</ul>
- <p>Specifications that introduce <a href=#defined-property-name id=names:-the-itemprop-attribute:defined-property-name>defined property names</a>
- must ensure all such property names contain no U+002E FULL STOP characters (.), no U+003A COLON
- characters (:), and no <a href=#space-character id=names:-the-itemprop-attribute:space-character>space characters</a>.</p>
- <p class=note>The rules above disallow U+003A COLON characters (:) in non-URL values because
- otherwise they could not be distinguished from URLs. Values with U+002E FULL STOP characters (.)
- are reserved for future extensions. <a href=#space-character id=names:-the-itemprop-attribute:space-character-2>Space characters</a> are
- disallowed because otherwise the values would would be parsed as multiple tokens.</p>
- <p>When an element with an <code id=names:-the-itemprop-attribute:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute <a href=#the-properties-of-an-item id=names:-the-itemprop-attribute:the-properties-of-an-item-2>adds a property</a> to multiple <a href=#concept-item id=names:-the-itemprop-attribute:concept-item-2>items</a>,
- the requirement above regarding the tokens applies for each <a href=#concept-item id=names:-the-itemprop-attribute:concept-item-3>item</a>
- individually.</p>
-
- <p>The <dfn id=property-names>property names</dfn> of an element are the tokens that the element's <code id=names:-the-itemprop-attribute:names:-the-itemprop-attribute-4><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is found to contain when its value is <a href=#split-a-string-on-spaces id=names:-the-itemprop-attribute:split-a-string-on-spaces>split on spaces</a>, with the order preserved but with
- duplicates removed (leaving only the first occurrence of each name).</p>
- <p>Within an <a href=#concept-item id=names:-the-itemprop-attribute:concept-item-4>item</a>, the properties are unordered with respect to
- each other, except for properties with the same name, which are ordered in the order they are
- given by the algorithm that defines <a href=#the-properties-of-an-item id=names:-the-itemprop-attribute:the-properties-of-an-item-3>the properties of an item</a>.</p>
- <div class=example>
- <p>In the following example, the "a" property has the values "1" and "2", <em>in that order</em>,
- but whether the "a" property comes before the "b" property or not is not important:</p>
- <pre><div itemscope>
- <p itemprop="a">1</p>
- <p itemprop="a">2</p>
- <p itemprop="b">test</p>
- </div></pre>
- <p>Thus, the following is equivalent:</p>
- <pre><div itemscope>
- <p itemprop="b">test</p>
- <p itemprop="a">1</p>
- <p itemprop="a">2</p>
- </div></pre>
- <p>As is the following:</p>
- <pre><div itemscope>
- <p itemprop="a">1</p>
- <p itemprop="b">test</p>
- <p itemprop="a">2</p>
- </div></pre>
- <p>And the following:</p>
- <pre><div id="x">
- <p itemprop="a">1</p>
- </div>
- <div itemscope itemref="x">
- <p itemprop="b">test</p>
- <p itemprop="a">2</p>
- </div>
- </pre>
- </div>
- <h4 id=values>5.2.4 Values</h4>
- <p>The <dfn id=concept-property-value>property value</dfn> of a name-value pair added by an
- element with an <code id=values:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is as given for the first
- matching case in the following list:</p>
- <dl class=switch><dt>If the element also has an <code id=values:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute<dd>
- <p>The value is the <a href=#concept-item id=values:concept-item>item</a> created by the element.</p>
- <dt>If the element is a <code id=values:the-meta-element><a href=#the-meta-element>meta</a></code> element<dd>
- <p>The value is the value of the element's <code id=values:attr-meta-content><a href=#attr-meta-content>content</a></code>
- attribute, if any, or the empty string if there is no such attribute.</p>
- <dt>If the element is an <code id=values:the-audio-element><a href=#the-audio-element>audio</a></code>, <code id=values:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=values:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=values:the-img-element><a href=#the-img-element>img</a></code>, <code id=values:the-source-element><a href=#the-source-element>source</a></code>, <code id=values:the-track-element><a href=#the-track-element>track</a></code>, or <code id=values:the-video-element><a href=#the-video-element>video</a></code> element<dd>
- <p>The value is the <a href=#absolute-url id=values:absolute-url>absolute URL</a> that results from <a href=#resolve-a-url id=values:resolve-a-url>resolving</a> the value of the element's <code>src</code> attribute relative to
- the element at the time the attribute is set, or the empty string if there is no such attribute
- or if <a href=#resolve-a-url id=values:resolve-a-url-2>resolving</a> it results in an error.</p>
- <dt>If the element is an <code id=values:the-a-element><a href=#the-a-element>a</a></code>, <code id=values:the-area-element><a href=#the-area-element>area</a></code>, or <code id=values:the-link-element><a href=#the-link-element>link</a></code> element<dd>
- <p>The value is the <a href=#absolute-url id=values:absolute-url-2>absolute URL</a> that results from <a href=#resolve-a-url id=values:resolve-a-url-3>resolving</a> the value of the element's <code>href</code> attribute relative
- to the element at the time the attribute is set, or the empty string if there is no such
- attribute or if <a href=#resolve-a-url id=values:resolve-a-url-4>resolving</a> it results in an error.</p>
- <dt>If the element is an <code id=values:the-object-element><a href=#the-object-element>object</a></code> element<dd>
- <p>The value is the <a href=#absolute-url id=values:absolute-url-3>absolute URL</a> that results from <a href=#resolve-a-url id=values:resolve-a-url-5>resolving</a> the value of the element's <code>data</code> attribute relative
- to the element at the time the attribute is set, or the empty string if there is no such
- attribute or if <a href=#resolve-a-url id=values:resolve-a-url-6>resolving</a> it results in an error.</p>
- <dt>If the element is a <code id=values:the-data-element><a href=#the-data-element>data</a></code> element<dd>
- <p>The value is the value of the element's <code id=values:attr-data-value><a href=#attr-data-value>value</a></code> attribute,
- if it has one, or the empty string otherwise.</p>
- <dt>If the element is a <code id=values:the-meter-element><a href=#the-meter-element>meter</a></code> element<dd>
- <p>The value is the value of the element's <code id=values:attr-meter-value><a href=#attr-meter-value>value</a></code> attribute,
- if it has one, or the empty string otherwise.</p>
- <dt>If the element is a <code id=values:the-time-element><a href=#the-time-element>time</a></code> element<dd>
- <p>The value is the element's <a href=#datetime-value id=values:datetime-value>datetime value</a>.</p>
- <dt>Otherwise<dd>
- <p>The value is the element's <code id=values:textcontent><a href=#textcontent>textContent</a></code>.</p>
- </dl>
- <p>The <dfn id=url-property-elements>URL property elements</dfn> are the <code id=values:the-a-element-2><a href=#the-a-element>a</a></code>, <code id=values:the-area-element-2><a href=#the-area-element>area</a></code>,
- <code id=values:the-audio-element-2><a href=#the-audio-element>audio</a></code>, <code id=values:the-embed-element-2><a href=#the-embed-element>embed</a></code>, <code id=values:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>, <code id=values:the-img-element-2><a href=#the-img-element>img</a></code>, <code id=values:the-link-element-2><a href=#the-link-element>link</a></code>,
- <code id=values:the-object-element-2><a href=#the-object-element>object</a></code>, <code id=values:the-source-element-2><a href=#the-source-element>source</a></code>, <code id=values:the-track-element-2><a href=#the-track-element>track</a></code>, and <code id=values:the-video-element-2><a href=#the-video-element>video</a></code> elements.</p>
- <p>If a property's <a href=#concept-property-value id=values:concept-property-value>value</a>, as defined by the property's
- definition, is an <a href=#absolute-url id=values:absolute-url-4>absolute URL</a>, the property must be specified using a <a href=#url-property-elements id=values:url-property-elements>URL property element</a>.</p>
- <p class=note>These requirements do not apply just because a property value happens to match the
- syntax for a URL. They only apply if the property is explicitly defined as taking such a
- value.</p>
- <p class=example>For example, a book about the first moon landing could be
- called "mission:moon". A "title" property from a vocabulary that defines a title as being a string
- would not expect the title to be given in an <code id=values:the-a-element-3><a href=#the-a-element>a</a></code> element, even though it looks like a
- <a href=#url id=values:url>URL</a>. On the other hand, if there was a (rather narrowly scoped!) vocabulary for
- "books whose titles look like URLs" which had a "title" property defined to take a URL, then the
- property <em>would</em> expect the title to be given in an <code id=values:the-a-element-4><a href=#the-a-element>a</a></code> element (or one of the
- other <a href=#url-property-elements id=values:url-property-elements-2>URL property elements</a>), because of the requirement above.</p>
-
- <h4 id=associating-names-with-items>5.2.5 Associating names with items</h4>
- <p>To find <dfn id=the-properties-of-an-item>the properties of an item</dfn> defined by the element <var>root</var>,
- the user agent must run the following steps. These steps are also used to flag <a href=#microdata-error id=associating-names-with-items:microdata-error>microdata errors</a>.</p>
- <ol><li><p>Let <var>results</var>, <var>memory</var>, and <var>pending</var> be empty lists of elements.<li><p>Add the element <var>root</var> to <var>memory</var>.<li><p>Add the child elements of <var>root</var>, if any, to <var>pending</var>.<li><p>If <var>root</var> has an <code id=associating-names-with-items:attr-itemref><a href=#attr-itemref>itemref</a></code> attribute,
- <a href=#split-a-string-on-spaces id=associating-names-with-items:split-a-string-on-spaces>split the value of that <code>itemref</code> attribute on spaces</a>. For each resulting token <var>ID</var>, if there is an element in the <a href=#home-subtree id=associating-names-with-items:home-subtree>home subtree</a> of <var>root</var> with the <a href=#concept-id id=associating-names-with-items:concept-id>ID</a> <var>ID</var>, then add
- the first such element to <var>pending</var>.<li><p><i>Loop</i>: If <var>pending</var> is empty, jump to the step labeled <i>end of
- loop</i>.<li><p>Remove an element from <var>pending</var> and let <var>current</var> be
- that element.<li><p>If <var>current</var> is already in <var>memory</var>, there is a
- <a href=#microdata-error id=associating-names-with-items:microdata-error-2>microdata error</a>; return to the step labeled <i>loop</i>.<li><p>Add <var>current</var> to <var>memory</var>.<li><p>If <var>current</var> does not have an <code id=associating-names-with-items:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, then: add all the child elements of <var>current</var> to <var>pending</var>.<li><p>If <var>current</var> has an <code id=associating-names-with-items:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code>
- attribute specified and has one or more <a href=#property-names id=associating-names-with-items:property-names>property names</a>, then add <var>current</var> to <var>results</var>.<li><p>Return to the step labeled <i>loop</i>.<li><p><i>End of loop</i>: Sort <var>results</var> in <a href=#tree-order id=associating-names-with-items:tree-order>tree order</a>.<li><p>Return <var>results</var>.</ol>
- <p>A document must not contain any <a href=#concept-item id=associating-names-with-items:concept-item>items</a> for which the algorithm
- to find <a href=#the-properties-of-an-item id=associating-names-with-items:the-properties-of-an-item>the properties of an item</a> finds any <dfn id=microdata-error>microdata
- errors</dfn>.</p>
- <p>An <a href=#concept-item id=associating-names-with-items:concept-item-2>item</a> is a <dfn id=top-level-microdata-items>top-level
- microdata item</dfn> if its element does not have an <code id=associating-names-with-items:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code>
- attribute.</p>
- <p>All <code id=associating-names-with-items:attr-itemref-2><a href=#attr-itemref>itemref</a></code> attributes in a <code id=associating-names-with-items:document><a href=#document>Document</a></code> must be
- such that there are no cycles in the graph formed from representing each <a href=#concept-item id=associating-names-with-items:concept-item-3>item</a> in the <code id=associating-names-with-items:document-2><a href=#document>Document</a></code> as a node in the graph and each
- <a href=#the-properties-of-an-item id=associating-names-with-items:the-properties-of-an-item-2>property</a> of an item whose <a href=#concept-property-value id=associating-names-with-items:concept-property-value>value</a> is another item as an edge in the graph connecting
- those two items.</p>
-
- <p>A document must not contain any elements that have an <code id=associating-names-with-items:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute that would not be found to be a property of any of
- the <a href=#concept-item id=associating-names-with-items:concept-item-4>items</a> in that document were their <a href=#the-properties-of-an-item id=associating-names-with-items:the-properties-of-an-item-3>properties</a> all to be determined.</p>
- <div class=example>
- <p>In this example, a single license statement is applied to two works, using <code id=associating-names-with-items:attr-itemref-3><a href=#attr-itemref>itemref</a></code> from the items representing the works:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Photo gallery</title>
- </head>
- <body>
- <h1>My photos</h1>
- <figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
- <img itemprop="work" src="images/house.jpeg" alt="A white house, boarded up, sits in a forest.">
- <figcaption itemprop="title">The house I found.</figcaption>
- </figure>
- <figure itemscope itemtype="http://n.whatwg.org/work" itemref="licenses">
- <img itemprop="work" src="images/mailbox.jpeg" alt="Outside the house is a mailbox. It has a leaflet inside.">
- <figcaption itemprop="title">The mailbox.</figcaption>
- </figure>
- <footer>
- <p id="licenses">All images licensed under the <a itemprop="license"
- href="http://www.opensource.org/licenses/mit-license.php">MIT
- license</a>.</p>
- </footer>
- </body>
- </html></pre>
- <p>The above results in two items with the type "<code>http://n.whatwg.org/work</code>",
- one with:</p>
- <dl class=brief><dt>work
- <dd><code>images/house.jpeg</code>
- <dt>title
- <dd>The house I found.
- <dt>license
- <dd><code>http://www.opensource.org/licenses/mit-license.php</code>
- </dl>
- <p>...and one with:</p>
- <dl class=brief><dt>work
- <dd><code>images/mailbox.jpeg</code>
- <dt>title
- <dd>The mailbox.
- <dt>license
- <dd><code>http://www.opensource.org/licenses/mit-license.php</code>
- </dl>
- </div>
-
- <h4 id=microdata-and-other-namespaces>5.2.6 Microdata and other namespaces</h4>
- <p>Currently, the <code id=microdata-and-other-namespaces:attr-itemscope><a href=#attr-itemscope>itemscope</a></code>, <code id=microdata-and-other-namespaces:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code>, and other microdata attributes are only defined for
- <a href=#html-elements id=microdata-and-other-namespaces:html-elements>HTML elements</a>. This means that attributes with the literal names "<code>itemscope</code>", "<code>itemprop</code>", etc, do not cause microdata
- processing to occur on elements in other namespaces, such as SVG.</p>
- <div class=example>
- <p>Thus, in the following example there is only one item, not
- two.</p>
- <pre class=bad><p itemscope></p> <!-- this is an item (with no properties and no type) -->
- <svg itemscope></svg> <!-- this is not, it's just an <code id=microdata-and-other-namespaces:svg-2><a href=#svg-2>svg</a></code> element with an invalid unknown attribute --></pre>
- </div>
- <h3 id=microdata-dom-api>5.3 Microdata DOM API</h3>
- <dl class=domintro><dt><var>document</var> . <code id=microdata-dom-api:dom-document-getitems><a href=#dom-document-getitems>getItems</a></code>( [ <var>types</var> ] )<dd>
- <p>Returns a <code id=microdata-dom-api:nodelist><a href=#nodelist>NodeList</a></code> of the elements in the <code id=microdata-dom-api:document><a href=#document>Document</a></code> that create
- <a href=#concept-item id=microdata-dom-api:concept-item>items</a>, that are not part of other <a href=#concept-item id=microdata-dom-api:concept-item-2>items</a>, and that are of the types given in the argument, if any are
- listed.</p>
- <p>The <var>types</var> argument is interpreted as a space-separated list of types.</p>
- <dt><var>element</var> . <code id=microdata-dom-api:dom-properties><a href=#dom-properties>properties</a></code><dd>
- <p>If the element has an <code id=microdata-dom-api:attr-itemscope><a href=#attr-itemscope>itemscope</a></code> attribute, returns an
- <code id=microdata-dom-api:htmlpropertiescollection-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object with all the element's properties. Otherwise, an
- empty <code id=microdata-dom-api:htmlpropertiescollection-2-2><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> object.</p>
- <dt><var>element</var> . <code id=microdata-dom-api:dom-itemvalue><a href=#dom-itemvalue>itemValue</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the element's <a href=#concept-property-value id=microdata-dom-api:concept-property-value>value</a>.</p>
- <p>Can be set, to change the element's <a href=#concept-property-value id=microdata-dom-api:concept-property-value-2>value</a>.
- Setting the <a href=#concept-property-value id=microdata-dom-api:concept-property-value-3>value</a> when the element has no <code id=microdata-dom-api:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute or when the element's value is an <a href=#concept-item id=microdata-dom-api:concept-item-3>item</a> throws an <code id=microdata-dom-api:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</p>
- </dl>
-
- <p>The <dfn id=dom-document-getitems><code>document.getItems(<var>typeNames</var>)</code></dfn> method takes a string that contains an
- <a href=#unordered-set-of-unique-space-separated-tokens id=microdata-dom-api:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated tokens</a> that are <a href=#case-sensitive id=microdata-dom-api:case-sensitive>case-sensitive</a>,
- representing types. When called, the method must return a <a href=#live id=microdata-dom-api:live>live</a> <code id=microdata-dom-api:nodelist-2><a href=#nodelist>NodeList</a></code>
- object containing all the elements in the document, in <a href=#tree-order id=microdata-dom-api:tree-order>tree order</a>, that are each
- <a href=#top-level-microdata-items id=microdata-dom-api:top-level-microdata-items>top-level microdata items</a> whose <a href=#item-types id=microdata-dom-api:item-types>types</a> include all the
- types specified in the method's argument, having obtained the types by <a href=#split-a-string-on-spaces id=microdata-dom-api:split-a-string-on-spaces>splitting the string on spaces</a>. If there are no tokens specified in the
- argument, then the method must return a <code id=microdata-dom-api:nodelist-3><a href=#nodelist>NodeList</a></code>
- containing all the <a href=#top-level-microdata-items id=microdata-dom-api:top-level-microdata-items-2>top-level microdata items</a> in the document. When the method is
- invoked on a <code id=microdata-dom-api:document-2><a href=#document>Document</a></code> object again with the same argument, the user agent may return
- the same object as the object returned by the earlier call. In other cases, a new
- <code id=microdata-dom-api:nodelist-4><a href=#nodelist>NodeList</a></code> object must be returned.</p>
- <p>The <dfn id=dom-itemscope><code>itemScope</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements>HTML
- elements</a> must <a href=#reflect id=microdata-dom-api:reflect>reflect</a> the <code id=microdata-dom-api:attr-itemscope-2><a href=#attr-itemscope>itemscope</a></code>
- content attribute. The <dfn id=dom-itemtype><code>itemType</code></dfn> IDL attribute on
- <a href=#html-elements id=microdata-dom-api:html-elements-2>HTML elements</a> must <a href=#reflect id=microdata-dom-api:reflect-2>reflect</a> the <code id=microdata-dom-api:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> content attribute. The <dfn id=dom-itemid><code>itemId</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements-3>HTML elements</a> must
- <a href=#reflect id=microdata-dom-api:reflect-3>reflect</a> the <code id=microdata-dom-api:attr-itemid><a href=#attr-itemid>itemid</a></code> content attribute. The <dfn id=dom-itemprop><code>itemProp</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements-4>HTML elements</a> must
- <a href=#reflect id=microdata-dom-api:reflect-4>reflect</a> the <code id=microdata-dom-api:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> content attribute. The <dfn id=dom-itemref><code>itemRef</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements-5>HTML elements</a> must
- <a href=#reflect id=microdata-dom-api:reflect-5>reflect</a> the <code id=microdata-dom-api:attr-itemref><a href=#attr-itemref>itemref</a></code> content attribute.</p>
- <p>The <dfn id=dom-properties><code>properties</code></dfn> IDL attribute on <a href=#html-elements id=microdata-dom-api:html-elements-6>HTML
- elements</a> must return an <code id=microdata-dom-api:htmlpropertiescollection-2-3><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code> rooted at the element's
- <a href=#root-element id=microdata-dom-api:root-element>root element</a> (which element this is might change during the collection's lifetime, as
- the element moves between different subtrees), whose filter matches only elements that are <a href=#the-properties-of-an-item id=microdata-dom-api:the-properties-of-an-item>the properties of the item</a> created by the element on
- which the attribute was invoked, while that element is an <a href=#concept-item id=microdata-dom-api:concept-item-4>item</a>,
- and matches nothing the rest of the time.</p>
- <p>The <dfn id=dom-itemvalue><code>itemValue</code></dfn> IDL attribute's behavior depends on
- the element, as follows:</p>
- <dl><dt>If the element has no <code id=microdata-dom-api:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute<dd><p>The attribute must return null on getting and must throw an
- <code id=microdata-dom-api:invalidaccesserror-2><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>
- <dt>If the element has an <code id=microdata-dom-api:attr-itemscope-3><a href=#attr-itemscope>itemscope</a></code> attribute<dd><p>The attribute must return the element itself on getting and must throw an
- <code id=microdata-dom-api:invalidaccesserror-3><a href=#invalidaccesserror>InvalidAccessError</a></code> exception on setting.</p>
- <dt>If the element is a <code id=microdata-dom-api:the-meta-element><a href=#the-meta-element>meta</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-6>reflecting</a> the
- element's <code id=microdata-dom-api:attr-meta-content><a href=#attr-meta-content>content</a></code> content attribute.<dt>If the element is an <code id=microdata-dom-api:the-audio-element><a href=#the-audio-element>audio</a></code>, <code id=microdata-dom-api:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=microdata-dom-api:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=microdata-dom-api:the-img-element><a href=#the-img-element>img</a></code>, <code id=microdata-dom-api:the-source-element><a href=#the-source-element>source</a></code>, <code id=microdata-dom-api:the-track-element><a href=#the-track-element>track</a></code>, or <code id=microdata-dom-api:the-video-element><a href=#the-video-element>video</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-7>reflecting</a> the
- element's <code>src</code> content attribute.<dt>If the element is an <code id=microdata-dom-api:the-a-element><a href=#the-a-element>a</a></code>, <code id=microdata-dom-api:the-area-element><a href=#the-area-element>area</a></code>, or <code id=microdata-dom-api:the-link-element><a href=#the-link-element>link</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-8>reflecting</a> the
- element's <code>href</code> content attribute.<dt>If the element is an <code id=microdata-dom-api:the-object-element><a href=#the-object-element>object</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-9>reflecting</a> the
- element's <code>data</code> content attribute.<dt>If the element is a <code id=microdata-dom-api:the-data-element><a href=#the-data-element>data</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-10>reflecting</a> the
- element's <code id=microdata-dom-api:attr-data-value><a href=#attr-data-value>value</a></code> content attribute.<dt>If the element is a <code id=microdata-dom-api:the-meter-element><a href=#the-meter-element>meter</a></code> element<dd><p>The attribute must act as it would if it was <a href=#reflect id=microdata-dom-api:reflect-11>reflecting</a> the
- element's <code id=microdata-dom-api:attr-meter-value><a href=#attr-meter-value>value</a></code> content attribute.<dt>If the element is a <code id=microdata-dom-api:the-time-element><a href=#the-time-element>time</a></code> element<dd><p>On getting, if the element has a <code id=microdata-dom-api:attr-time-datetime><a href=#attr-time-datetime>datetime</a></code> content
- attribute, the IDL attribute must return that content attribute's value; otherwise, it must
- return the element's <code id=microdata-dom-api:textcontent><a href=#textcontent>textContent</a></code>. On setting, the IDL attribute must act as it would
- if it was <a href=#reflect id=microdata-dom-api:reflect-12>reflecting</a> the element's <code id=microdata-dom-api:attr-time-datetime-2><a href=#attr-time-datetime>datetime</a></code> content attribute.<dt>Otherwise<dd><p>The attribute must act the same as the element's <code id=microdata-dom-api:textcontent-2><a href=#textcontent>textContent</a></code>
- attribute.</dl>
- <p>When the <code id=microdata-dom-api:dom-itemvalue-2><a href=#dom-itemvalue>itemValue</a></code> IDL attribute is <a href=#reflect id=microdata-dom-api:reflect-13>reflecting</a> a content attribute or acting like the element's
- <code id=microdata-dom-api:textcontent-3><a href=#textcontent>textContent</a></code> attribute, the user agent must, on setting, convert the new value to the
- IDL <code id=microdata-dom-api:idl-domstring><a href=#idl-domstring>DOMString</a></code> value before using it according to the mappings described above.</p>
-
- <div class=example>
- <p>In this example, a script checks to see if a particular element <var>element</var> is
- declaring a particular property, and if it is, it increments a counter:</p>
- <pre>if (element.itemProp.contains('color'))
- count += 1;</pre>
- </div>
- <div class=example>
- <p>This script iterates over each of the values of an element's <code id=microdata-dom-api:attr-itemref-2><a href=#attr-itemref>itemref</a></code> attribute, calling a function for each referenced
- element:</p>
- <pre>for (var index = 0; index < element.itemRef.length; index += 1)
- process(document.getElementById(element.itemRef[index]));</pre>
- </div>
- <h3 id=mdvocabs>5.4 Sample microdata vocabularies</h3>
- <p>The vocabularies in this section are primarily intended to demonstrate how a vocabulary is
- specified, though they are also usable in their own right.</p>
- <h4 id=vcard>5.4.1 vCard</h4>
- <p>An item with the <a href=#item-types id=vcard:item-types>item type</a> <dfn id=md-vcard><code>http://microformats.org/profile/hcard</code></dfn> represents a person's or
- organization's contact information.</p>
- <p>This vocabulary does not <a href=#support-global-identifiers-for-items id=vcard:support-global-identifiers-for-items>support global identifiers for items</a>.</p>
- <p>The following are the type's <a href=#defined-property-name id=vcard:defined-property-name>defined property names</a>.
- They are based on the vocabulary defined in the vCard 4.0 specification and its extensions, where
- more information on how to interpret the values can be found. <a href=#refsRFC6350>[RFC6350]</a></p>
- <dl><dt><dfn id=md-vcard-kind><code>kind</code></dfn><dd>
- <p>Describes what kind of contact the item represents.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value>value</a> must be text that, when compared in a
- <a href=#case-sensitive id=vcard:case-sensitive>case-sensitive</a> manner, is equal to one of the <a href=#kind-strings id=vcard:kind-strings>kind strings</a>.</p>
- <p>A single property with the name <code id=vcard:md-vcard-kind><a href=#md-vcard-kind>kind</a></code> may be present within
- each <a href=#concept-item id=vcard:concept-item>item</a> with the type <code id=vcard:md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-fn><code>fn</code></dfn><dd>
- <p>Gives the formatted text corresponding to the name of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-2>value</a> must be text.</p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-fn><a href=#md-vcard-fn>fn</a></code> must be present within
- each <a href=#concept-item id=vcard:concept-item-2>item</a> with the type <code id=vcard:md-vcard-2><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n><code>n</code></dfn><dd>
- <p>Gives the structured name of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-3>value</a> must be an <a href=#concept-item id=vcard:concept-item-3>item</a> with zero or more of each of the <code id=vcard:md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code>, <code id=vcard:md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code>, <code id=vcard:md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code>, <code id=vcard:md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>, and <code id=vcard:md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code> properties.</p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-n><a href=#md-vcard-n>n</a></code> must be present within
- each <a href=#concept-item id=vcard:concept-item-4>item</a> with the type <code id=vcard:md-vcard-3><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n-family-name><code>family-name</code></dfn> (inside <code id=vcard:md-vcard-n-2><a href=#md-vcard-n>n</a></code>)<dd>
- <p>Gives the family name of the person, or the full name of the organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-4>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-n-family-name-2><a href=#md-vcard-n-family-name>family-name</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-5>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-5>value</a> of the <code id=vcard:md-vcard-n-3><a href=#md-vcard-n>n</a></code> property of
- an <a href=#concept-item id=vcard:concept-item-6>item</a> with the type <code id=vcard:md-vcard-4><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n-given-name><code>given-name</code></dfn> (inside <code id=vcard:md-vcard-n-4><a href=#md-vcard-n>n</a></code>)<dd>
- <p>Gives the given-name of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-6>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-n-given-name-2><a href=#md-vcard-n-given-name>given-name</a></code>
- may be present within the <a href=#concept-item id=vcard:concept-item-7>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-7>value</a> of the <code id=vcard:md-vcard-n-5><a href=#md-vcard-n>n</a></code> property of
- an <a href=#concept-item id=vcard:concept-item-8>item</a> with the type <code id=vcard:md-vcard-5><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n-additional-name><code>additional-name</code></dfn> (inside <code id=vcard:md-vcard-n-6><a href=#md-vcard-n>n</a></code>)<dd>
- <p>Gives the any additional names of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-8>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-n-additional-name-2><a href=#md-vcard-n-additional-name>additional-name</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-9>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-9>value</a> of the <code id=vcard:md-vcard-n-7><a href=#md-vcard-n>n</a></code> property of
- an <a href=#concept-item id=vcard:concept-item-10>item</a> with the type <code id=vcard:md-vcard-6><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n-honorific-prefix><code>honorific-prefix</code></dfn> (inside <code id=vcard:md-vcard-n-8><a href=#md-vcard-n>n</a></code>)<dd>
- <p>Gives the honorific prefix of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-10>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-n-honorific-prefix-2><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-11>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-11>value</a> of the <code id=vcard:md-vcard-n-9><a href=#md-vcard-n>n</a></code> property of
- an <a href=#concept-item id=vcard:concept-item-12>item</a> with the type <code id=vcard:md-vcard-7><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-n-honorific-suffix><code>honorific-suffix</code></dfn> (inside <code id=vcard:md-vcard-n-10><a href=#md-vcard-n>n</a></code>)<dd>
- <p>Gives the honorific suffix of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-12>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-n-honorific-suffix-2><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-13>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-13>value</a> of the <code id=vcard:md-vcard-n-11><a href=#md-vcard-n>n</a></code> property of
- an <a href=#concept-item id=vcard:concept-item-14>item</a> with the type <code id=vcard:md-vcard-8><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-nickname><code>nickname</code></dfn><dd>
- <p>Gives the nickname of the person or organization.</p>
-
- <p class=note>The nickname is the descriptive name given instead of or in addition to the one
- belonging to a person, place, or thing. It can also be used to specify a familiar form of a
- proper name specified by the <code id=vcard:md-vcard-fn-2><a href=#md-vcard-fn>fn</a></code> or <code id=vcard:md-vcard-n-12><a href=#md-vcard-n>n</a></code> properties.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-14>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-nickname><a href=#md-vcard-nickname>nickname</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-15>item</a> with the type <code id=vcard:md-vcard-9><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-photo><code>photo</code></dfn><dd>
- <p>Gives a photograph of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-15>value</a> must be an <a href=#absolute-url id=vcard:absolute-url>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-photo><a href=#md-vcard-photo>photo</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-16>item</a> with the type <code id=vcard:md-vcard-10><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-bday><code>bday</code></dfn><dd>
- <p>Gives the birth date of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-16>value</a> must be a <a href=#valid-date-string id=vcard:valid-date-string>valid date
- string</a>.</p>
- <p>A single property with the name <code id=vcard:md-vcard-bday><a href=#md-vcard-bday>bday</a></code> may be present within
- each <a href=#concept-item id=vcard:concept-item-17>item</a> with the type <code id=vcard:md-vcard-11><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-anniversary><code>anniversary</code></dfn><dd>
- <p>Gives the birth date of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-17>value</a> must be a <a href=#valid-date-string id=vcard:valid-date-string-2>valid date
- string</a>.</p>
- <p>A single property with the name <code id=vcard:md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-18>item</a> with the type <code id=vcard:md-vcard-12><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-sex><code>sex</code></dfn><dd>
- <p>Gives the biological sex of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-18>value</a> must be one of
- <code>F</code>, meaning "female",
- <code>M</code>, meaning "male",
- <code>N</code>, meaning "none or not applicable",
- <code>O</code>, meaning "other", or
- <code>U</code>, meaning "unknown".</p>
- <p>A single property with the name <code id=vcard:md-vcard-sex><a href=#md-vcard-sex>sex</a></code> may be present within
- each <a href=#concept-item id=vcard:concept-item-19>item</a> with the type <code id=vcard:md-vcard-13><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-gender-identity><code>gender-identity</code></dfn><dd>
- <p>Gives the gender identity of the person.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-19>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-gender-identity><a href=#md-vcard-gender-identity>gender-identity</a></code>
- may be present within each <a href=#concept-item id=vcard:concept-item-20>item</a> with the type <code id=vcard:md-vcard-14><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr><code>adr</code></dfn><dd>
- <p>Gives the delivery address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-20>value</a> must be an <a href=#concept-item id=vcard:concept-item-21>item</a> with zero or more <code id=vcard:md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code>,
- <code id=vcard:md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code>, <code id=vcard:md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code>, and <code id=vcard:md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code> properties, and optionally a <code id=vcard:md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> property, optionally a <code id=vcard:md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> property, optionally a <code id=vcard:md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> property, and optionally a <code id=vcard:md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code> property.</p>
- <p>If no <code id=vcard:md-vcard-adr-type-2><a href=#md-vcard-adr-type>type</a></code> properties are present within an <a href=#concept-item id=vcard:concept-item-22>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-21>value</a> of an <code id=vcard:md-vcard-adr><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-23>item</a> with the type <code id=vcard:md-vcard-15><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, then the <a href=#address-type-strings id=vcard:address-type-strings>address type string</a> <code id=vcard:md-vcard-type-adr-work><a href=#md-vcard-type-adr-work>work</a></code> is
- implied.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-adr-2><a href=#md-vcard-adr>adr</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-24>item</a> with the type <code id=vcard:md-vcard-16><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr-type><code>type</code></dfn> (inside <code id=vcard:md-vcard-adr-3><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the type of delivery address.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-22>value</a> must be text that, when compared in a
- <a href=#case-sensitive id=vcard:case-sensitive-2>case-sensitive</a> manner, is equal to one of the <a href=#address-type-strings id=vcard:address-type-strings-2>address type
- strings</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-adr-type-3><a href=#md-vcard-adr-type>type</a></code> may be
- present within the <a href=#concept-item id=vcard:concept-item-25>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-23>value</a> of an <code id=vcard:md-vcard-adr-4><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-26>item</a> with the type <code id=vcard:md-vcard-17><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code id=vcard:md-vcard-adr-5><a href=#md-vcard-adr>adr</a></code> property <a href=#concept-item id=vcard:concept-item-27>item</a> there must only
- be one <code id=vcard:md-vcard-adr-type-4><a href=#md-vcard-adr-type>type</a></code> property per distinct value.</p>
- <dt><dfn id=md-vcard-adr-post-office-box><code>post-office-box</code></dfn> (inside <code id=vcard:md-vcard-adr-6><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the post office box component of the delivery address of the person or
- organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-24>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-adr-post-office-box-2><a href=#md-vcard-adr-post-office-box>post-office-box</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-28>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-25>value</a> of an <code id=vcard:md-vcard-adr-7><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-29>item</a> with the type <code id=vcard:md-vcard-18><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <p class=note>The vCard specification urges authors not to use this field.</p>
- <dt><dfn id=md-vcard-adr-extended-address><code>extended-address</code></dfn> (inside <code id=vcard:md-vcard-adr-8><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives an additional component of the delivery address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-26>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-adr-extended-address-2><a href=#md-vcard-adr-extended-address>extended-address</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-30>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-27>value</a> of an <code id=vcard:md-vcard-adr-9><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-31>item</a> with the type <code id=vcard:md-vcard-19><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <p class=note>The vCard specification urges authors not to use this field.</p>
- <dt><dfn id=md-vcard-adr-street-address><code>street-address</code></dfn> (inside <code id=vcard:md-vcard-adr-10><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the street address component of the delivery address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-28>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-adr-street-address-2><a href=#md-vcard-adr-street-address>street-address</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-32>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-29>value</a> of an <code id=vcard:md-vcard-adr-11><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-33>item</a> with the type <code id=vcard:md-vcard-20><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr-locality><code>locality</code></dfn> (inside <code id=vcard:md-vcard-adr-12><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the locality component (e.g. city) of the delivery address of the person or
- organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-30>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-adr-locality-2><a href=#md-vcard-adr-locality>locality</a></code> may be
- present within the <a href=#concept-item id=vcard:concept-item-34>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-31>value</a> of an <code id=vcard:md-vcard-adr-13><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-35>item</a> with the type <code id=vcard:md-vcard-21><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr-region><code>region</code></dfn> (inside <code id=vcard:md-vcard-adr-14><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the region component (e.g. state or province) of the delivery address of the person or
- organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-32>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-adr-region-2><a href=#md-vcard-adr-region>region</a></code> may be
- present within the <a href=#concept-item id=vcard:concept-item-36>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-33>value</a> of an <code id=vcard:md-vcard-adr-15><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-37>item</a> with the type <code id=vcard:md-vcard-22><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr-postal-code><code>postal-code</code></dfn> (inside <code id=vcard:md-vcard-adr-16><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the postal code component of the delivery address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-34>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-adr-postal-code-2><a href=#md-vcard-adr-postal-code>postal-code</a></code> may
- be present within the <a href=#concept-item id=vcard:concept-item-38>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-35>value</a> of an <code id=vcard:md-vcard-adr-17><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-39>item</a> with the type <code id=vcard:md-vcard-23><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-adr-country-name><code>country-name</code></dfn> (inside <code id=vcard:md-vcard-adr-18><a href=#md-vcard-adr>adr</a></code>)<dd>
- <p>Gives the country name component of the delivery address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-36>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-adr-country-name-2><a href=#md-vcard-adr-country-name>country-name</a></code>
- may be present within the <a href=#concept-item id=vcard:concept-item-40>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-37>value</a> of an <code id=vcard:md-vcard-adr-19><a href=#md-vcard-adr>adr</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-41>item</a> with the type <code id=vcard:md-vcard-24><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-tel><code>tel</code></dfn><dd>
- <p>Gives the telephone number of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-38>value</a> must be either text that can be
- interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121, or an
- <a href=#concept-item id=vcard:concept-item-42>item</a> with zero or more <code id=vcard:md-vcard-tel-type><a href=#md-vcard-tel-type>type</a></code> properties and exactly one <code id=vcard:md-vcard-tel-value><a href=#md-vcard-tel-value>value</a></code> property. <a href=#refsE163>[E163]</a> <a href=#refsX121>[X121]</a></p>
- <p>If no <code id=vcard:md-vcard-tel-type-2><a href=#md-vcard-tel-type>type</a></code> properties are present within an <a href=#concept-item id=vcard:concept-item-43>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-39>value</a> of a <code id=vcard:md-vcard-tel><a href=#md-vcard-tel>tel</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-44>item</a> with the type <code id=vcard:md-vcard-25><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or if the <a href=#concept-property-value id=vcard:concept-property-value-40>value</a> of such a <code id=vcard:md-vcard-tel-2><a href=#md-vcard-tel>tel</a></code>
- property is text, then the <a href=#telephone-type-strings id=vcard:telephone-type-strings>telephone type string</a>
- <code id=vcard:md-vcard-type-tel-voice><a href=#md-vcard-type-tel-voice>voice</a></code> is implied.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-tel-3><a href=#md-vcard-tel>tel</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-45>item</a> with the type <code id=vcard:md-vcard-26><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-tel-type><code>type</code></dfn> (inside <code id=vcard:md-vcard-tel-4><a href=#md-vcard-tel>tel</a></code>)<dd>
- <p>Gives the type of telephone number.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-41>value</a> must be text that, when compared in a
- <a href=#case-sensitive id=vcard:case-sensitive-3>case-sensitive</a> manner, is equal to one of the <a href=#telephone-type-strings id=vcard:telephone-type-strings-2>telephone type
- strings</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-tel-type-3><a href=#md-vcard-tel-type>type</a></code> may be
- present within the <a href=#concept-item id=vcard:concept-item-46>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-42>value</a> of a <code id=vcard:md-vcard-tel-5><a href=#md-vcard-tel>tel</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-47>item</a> with the type <code id=vcard:md-vcard-27><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, but within each such <code id=vcard:md-vcard-tel-6><a href=#md-vcard-tel>tel</a></code> property <a href=#concept-item id=vcard:concept-item-48>item</a> there must only
- be one <code id=vcard:md-vcard-tel-type-4><a href=#md-vcard-tel-type>type</a></code> property per distinct value.</p>
- <dt><dfn id=md-vcard-tel-value><code>value</code></dfn> (inside <code id=vcard:md-vcard-tel-7><a href=#md-vcard-tel>tel</a></code>)<dd>
- <p>Gives the actual telephone number of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-43>value</a> must be text that can be interpreted as
- a telephone number as defined in the CCITT specifications E.163 and X.121. <a href=#refsE163>[E163]</a> <a href=#refsX121>[X121]</a></p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-tel-value-2><a href=#md-vcard-tel-value>value</a></code> must be
- present within the <a href=#concept-item id=vcard:concept-item-49>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-44>value</a> of a <code id=vcard:md-vcard-tel-8><a href=#md-vcard-tel>tel</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-50>item</a> with the type <code id=vcard:md-vcard-28><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-email><code>email</code></dfn><dd>
- <p>Gives the e-mail address of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-45>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-email><a href=#md-vcard-email>email</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-51>item</a> with the type <code id=vcard:md-vcard-29><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-impp><code>impp</code></dfn><dd>
- <p>Gives a <a href=#url id=vcard:url>URL</a> for instant messaging and presence protocol communications with the
- person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-46>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-2>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-impp><a href=#md-vcard-impp>impp</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-52>item</a> with the type <code id=vcard:md-vcard-30><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-lang><code>lang</code></dfn><dd>
- <p>Gives a language understood by the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-47>value</a> must be a valid BCP 47 language tag. <a href=#refsBCP47>[BCP47]</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-lang><a href=#md-vcard-lang>lang</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-53>item</a> with the type <code id=vcard:md-vcard-31><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-tz><code>tz</code></dfn><dd>
- <p>Gives the time zone of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-48>value</a> must be text and must match the
- following syntax:</p>
- <ol><li>Either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).<li>A <a href=#valid-non-negative-integer id=vcard:valid-non-negative-integer>valid non-negative integer</a> that is exactly two digits long and that
- represents a number in the range 00..23.<li>A U+003A COLON character (:).<li>A <a href=#valid-non-negative-integer id=vcard:valid-non-negative-integer-2>valid non-negative integer</a> that is exactly two digits long and that
- represents a number in the range 00..59.</ol>
- <p>Any number of properties with the name <code id=vcard:md-vcard-tz><a href=#md-vcard-tz>tz</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-54>item</a> with the type <code id=vcard:md-vcard-32><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-geo><code>geo</code></dfn><dd>
- <p>Gives the geographical position of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-49>value</a> must be text and must match the
- following syntax:</p>
- <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
- (-).<li>One or more <a href=#ascii-digits id=vcard:ascii-digits>ASCII digits</a>.<li>Optionally*, a U+002E FULL STOP character (.) followed by one or more <a href=#ascii-digits id=vcard:ascii-digits-2>ASCII
- digits</a>.<li>A U+003B SEMICOLON character (;).<li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
- (-).<li>One or more <a href=#ascii-digits id=vcard:ascii-digits-3>ASCII digits</a>.<li>Optionally*, a U+002E FULL STOP character (.) followed by one or more <a href=#ascii-digits id=vcard:ascii-digits-4>ASCII
- digits</a>.</ol>
- <p>The optional components marked with an asterisk (*) should be included, and should have six
- digits each.</p>
-
- <p class=note>The value specifies latitude and longitude, in that order (i.e., "LAT LON"
- ordering), in decimal degrees. The longitude represents the location east and west of the prime
- meridian as a positive or negative real number, respectively. The latitude represents the
- location north and south of the equator as a positive or negative real number, respectively.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-geo><a href=#md-vcard-geo>geo</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-55>item</a> with the type <code id=vcard:md-vcard-33><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-title><code>title</code></dfn><dd>
- <p>Gives the job title, functional position or function of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-50>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-title><a href=#md-vcard-title>title</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-56>item</a> with the type <code id=vcard:md-vcard-34><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-role><code>role</code></dfn><dd>
- <p>Gives the role, occupation, or business category of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-51>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-role><a href=#md-vcard-role>role</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-57>item</a> with the type <code id=vcard:md-vcard-35><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-logo><code>logo</code></dfn><dd>
- <p>Gives the logo of the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-52>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-3>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-logo><a href=#md-vcard-logo>logo</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-58>item</a> with the type <code id=vcard:md-vcard-36><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-agent><code>agent</code></dfn><dd>
- <p>Gives the contact information of another person who will act on behalf of the person or
- organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-53>value</a> must be either an <a href=#concept-item id=vcard:concept-item-59>item</a> with the type <code id=vcard:md-vcard-37><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or an <a href=#absolute-url id=vcard:absolute-url-4>absolute URL</a>,
- or text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-agent><a href=#md-vcard-agent>agent</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-60>item</a> with the type <code id=vcard:md-vcard-38><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-org><code>org</code></dfn><dd>
- <p>Gives the name and units of the organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-54>value</a> must be either text or an <a href=#concept-item id=vcard:concept-item-61>item</a> with one <code id=vcard:md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code> property and zero or more <code id=vcard:md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code> properties.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-org><a href=#md-vcard-org>org</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-62>item</a> with the type <code id=vcard:md-vcard-39><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-org-organization-name><code>organization-name</code></dfn> (inside <code id=vcard:md-vcard-org-2><a href=#md-vcard-org>org</a></code>)<dd>
- <p>Gives the name of the organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-55>value</a> must be text.</p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-org-organization-name-2><a href=#md-vcard-org-organization-name>organization-name</a></code> must be present within the <a href=#concept-item id=vcard:concept-item-63>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-56>value</a> of an <code id=vcard:md-vcard-org-3><a href=#md-vcard-org>org</a></code> property
- of an <a href=#concept-item id=vcard:concept-item-64>item</a> with the type <code id=vcard:md-vcard-40><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-org-organization-unit><code>organization-unit</code></dfn> (inside <code id=vcard:md-vcard-org-4><a href=#md-vcard-org>org</a></code>)<dd>
- <p>Gives the name of the organization unit.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-57>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-org-organization-unit-2><a href=#md-vcard-org-organization-unit>organization-unit</a></code> may be present within the <a href=#concept-item id=vcard:concept-item-65>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-58>value</a> of the <code id=vcard:md-vcard-org-5><a href=#md-vcard-org>org</a></code>
- property of an <a href=#concept-item id=vcard:concept-item-66>item</a> with the type <code id=vcard:md-vcard-41><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-member><code>member</code></dfn><dd>
- <p>Gives a <a href=#url id=vcard:url-2>URL</a> that represents a member of the group.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-59>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-5>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-member><a href=#md-vcard-member>member</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-67>item</a> with the type <code id=vcard:md-vcard-42><a href=#md-vcard>http://microformats.org/profile/hcard</a></code> if the <a href=#concept-item id=vcard:concept-item-68>item</a> also has a property with the name <code id=vcard:md-vcard-kind-2><a href=#md-vcard-kind>kind</a></code> whose value is "<code id=vcard:md-vcard-kind-group><a href=#md-vcard-kind-group>group</a></code>".</p>
- <dt><dfn id=md-vcard-related><code>related</code></dfn><dd>
- <p>Gives a relationship to another entity.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-60>value</a> must an <a href=#concept-item id=vcard:concept-item-69>item</a> with one <code id=vcard:md-vcard-related-url><a href=#md-vcard-related-url>url</a></code>
- property and one <code id=vcard:md-vcard-related-rel><a href=#md-vcard-related-rel>rel</a></code> properties.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-related><a href=#md-vcard-related>orrelated</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-70>item</a> with the type <code id=vcard:md-vcard-43><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-related-url><code>url</code></dfn> (inside <code id=vcard:md-vcard-related-2><a href=#md-vcard-related>related</a></code>)<dd>
- <p>Gives the <a href=#url id=vcard:url-3>URL</a> for the related entity.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-61>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-6>absolute
- URL</a>.</p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-related-url-2><a href=#md-vcard-related-url>url</a></code> must be
- present within the <a href=#concept-item id=vcard:concept-item-71>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-62>value</a> of a <code id=vcard:md-vcard-related-3><a href=#md-vcard-related>related</a></code>
- property of an <a href=#concept-item id=vcard:concept-item-72>item</a> with the type <code id=vcard:md-vcard-44><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-related-rel><code>rel</code></dfn> (inside <code id=vcard:md-vcard-related-4><a href=#md-vcard-related>related</a></code>)<dd>
- <p>Gives the relationship between the entity and the related entity.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-63>value</a> must be text that, when compared in a
- <a href=#case-sensitive id=vcard:case-sensitive-4>case-sensitive</a> manner, is equal to one of the <a href=#relationship-strings id=vcard:relationship-strings>relationship
- strings</a>.</p>
- <p>Exactly one property with the name <code id=vcard:md-vcard-related-rel-2><a href=#md-vcard-related-rel>rel</a></code> must be
- present within the <a href=#concept-item id=vcard:concept-item-73>item</a> that forms the <a href=#concept-property-value id=vcard:concept-property-value-64>value</a> of a <code id=vcard:md-vcard-related-5><a href=#md-vcard-related>related</a></code>
- property of an <a href=#concept-item id=vcard:concept-item-74>item</a> with the type <code id=vcard:md-vcard-45><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-categories><code>categories</code></dfn><dd>
- <p>Gives the name of a category or tag that the person or organization could be classified
- as.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-65>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-categories><a href=#md-vcard-categories>categories</a></code>
- may be present within each <a href=#concept-item id=vcard:concept-item-75>item</a> with the type <code id=vcard:md-vcard-46><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-note><code>note</code></dfn><dd>
- <p>Gives supplemental information or a comment about the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-66>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-note><a href=#md-vcard-note>note</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-76>item</a> with the type <code id=vcard:md-vcard-47><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-rev><code>rev</code></dfn><dd>
- <p>Gives the revision date and time of the contact information.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-67>value</a> must be text that is a <a href=#valid-global-date-and-time-string id=vcard:valid-global-date-and-time-string>valid
- global date and time string</a>.</p>
-
- <p class=note>The value distinguishes the current revision of the information for other
- renditions of the information.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-rev><a href=#md-vcard-rev>rev</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-77>item</a> with the type <code id=vcard:md-vcard-48><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-sound><code>sound</code></dfn><dd>
- <p>Gives a sound file relating to the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-68>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-7>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-sound><a href=#md-vcard-sound>sound</a></code> may be
- present within each <a href=#concept-item id=vcard:concept-item-78>item</a> with the type <code id=vcard:md-vcard-49><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-uid><code>uid</code></dfn><dd>
- <p>Gives a globally unique identifier corresponding to the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-69>value</a> must be text.</p>
- <p>A single property with the name <code id=vcard:md-vcard-uid><a href=#md-vcard-uid>uid</a></code> may be present within
- each <a href=#concept-item id=vcard:concept-item-79>item</a> with the type <code id=vcard:md-vcard-50><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- <dt><dfn id=md-vcard-url><code>url</code></dfn><dd>
- <p>Gives a <a href=#url id=vcard:url-4>URL</a> relating to the person or organization.</p>
- <p>The <a href=#concept-property-value id=vcard:concept-property-value-70>value</a> must be an <a href=#absolute-url id=vcard:absolute-url-8>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vcard:md-vcard-url><a href=#md-vcard-url>url</a></code> may be present
- within each <a href=#concept-item id=vcard:concept-item-80>item</a> with the type <code id=vcard:md-vcard-51><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.</p>
- </dl>
- <p>The <dfn id=kind-strings>kind strings</dfn> are:</p>
- <dl><dt><dfn id=md-vcard-kind-individual><code>individual</code></dfn><dd>
- <p>Indicates a single entity (e.g. a person).</p>
- <dt><dfn id=md-vcard-kind-group><code>group</code></dfn><dd>
- <p>Indicates multiple entities (e.g. a mailing list).</p>
- <dt><dfn id=md-vcard-kind-org><code>org</code></dfn><dd>
- <p>Indicates a single entity that is not a person (e.g. a company).</p>
- <dt><dfn id=md-vcard-kind-location><code>location</code></dfn><dd>
- <p>Indicates a geographical place (e.g. an office building).</p>
- </dl>
- <p>The <dfn id=address-type-strings>address type strings</dfn> are:</p>
- <dl><dt><dfn id=md-vcard-type-adr-home><code>home</code></dfn><dd>
- <p>Indicates a delivery address for a residence.</p>
- <dt><dfn id=md-vcard-type-adr-work><code>work</code></dfn><dd>
- <p>Indicates a delivery address for a place of work.</p>
- </dl>
- <p>The <dfn id=telephone-type-strings>telephone type strings</dfn> are:</p>
- <dl><dt><dfn id=md-vcard-type-tel-home><code>home</code></dfn><dd>
- <p>Indicates a residential number.</p>
- <dt><dfn id=md-vcard-type-tel-work><code>work</code></dfn><dd>
- <p>Indicates a telephone number for a place of work.</p>
- <dt><dfn id=md-vcard-type-tel-text><code>text</code></dfn><dd>
- <p>Indicates that the telephone number supports text messages (SMS).</p>
- <dt><dfn id=md-vcard-type-tel-voice><code>voice</code></dfn><dd>
- <p>Indicates a voice telephone number.</p>
- <dt><dfn id=md-vcard-type-tel-fax><code>fax</code></dfn><dd>
- <p>Indicates a facsimile telephone number.</p>
- <dt><dfn id=md-vcard-type-tel-cell><code>cell</code></dfn><dd>
- <p>Indicates a cellular telephone number.</p>
- <dt><dfn id=md-vcard-type-tel-video><code>video</code></dfn><dd>
- <p>Indicates a video conferencing telephone number.</p>
- <dt><dfn id=md-vcard-type-tel-pager><code>pager</code></dfn><dd>
- <p>Indicates a paging device telephone number.</p>
- <dt><dfn id=md-vcard-type-tel-textphone><code>textphone</code></dfn><dd>
- <p>Indicates a telecommunication device for people with hearing or speech difficulties.</p>
- </dl>
- <p>The <dfn id=relationship-strings>relationship strings</dfn> are:</p>
- <dl><dt><dfn id=md-vcard-rel-emergency><code>emergency</code></dfn><dd>
- <p>An emergency contact.</p>
- <dt><dfn id=md-vcard-rel-agent><code>agent</code></dfn><dd>
- <p>Another entity that acts on behalf of this entity.</p>
- <dt><dfn id=md-vcard-rel-contact>contact</dfn><dt><dfn id=md-vcard-rel-acquaintance>acquaintance</dfn><dt><dfn id=md-vcard-rel-friend>friend</dfn><dt><dfn id=md-vcard-rel-met>met</dfn><dt><dfn id=md-vcard-rel-co-worker>worker</dfn><dt><dfn id=md-vcard-rel-colleague>colleague</dfn><dt><dfn id=md-vcard-rel-co-resident>resident</dfn><dt><dfn id=md-vcard-rel-neighbor>neighbor</dfn><dt><dfn id=md-vcard-rel-child>child</dfn><dt><dfn id=md-vcard-rel-parent>parent</dfn><dt><dfn id=md-vcard-rel-sibling>sibling</dfn><dt><dfn id=md-vcard-rel-spouse>spouse</dfn><dt><dfn id=md-vcard-rel-kin>kin</dfn><dt><dfn id=md-vcard-rel-muse>muse</dfn><dt><dfn id=md-vcard-rel-crush>crush</dfn><dt><dfn id=md-vcard-rel-date>date</dfn><dt><dfn id=md-vcard-rel-sweetheart>sweetheart</dfn><dt><dfn id=md-vcard-rel-me>me</dfn><dd>
- <p>Has the meaning defined in XFN. <a href=#refsXFN>[XFN]</a></p>
- </dl>
- <h5 id=conversion-to-vcard>5.4.1.1 Conversion to vCard</h5>
- <p>Given a list of nodes <var>nodes</var> in a <code id=conversion-to-vcard:document><a href=#document>Document</a></code>, a user agent must
- run the following algorithm to <dfn id=extracting-a-vcard>extract any vCard data represented
- by those nodes</dfn> (only the first vCard is returned):</p>
- <ol><li><p>If none of the nodes in <var>nodes</var> are <a href=#concept-item id=conversion-to-vcard:concept-item>items</a> with the <a href=#item-types id=conversion-to-vcard:item-types>item type</a> <code id=conversion-to-vcard:md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, then there is no vCard. Abort the
- algorithm, returning nothing.<li><p>Let <var>node</var> be the first node in <var>nodes</var> that is an
- <a href=#concept-item id=conversion-to-vcard:concept-item-2>item</a> with the <a href=#item-types id=conversion-to-vcard:item-types-2>item type</a> <code id=conversion-to-vcard:md-vcard-2><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>.<li><p>Let <var>output</var> be an empty string.<li><p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line>Add a vCard line</a> with the type "<code>BEGIN</code>" and the value
- "<code>VCARD</code>" to <var>output</var>.<li><p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-2>Add a vCard line</a> with the type "<code>PROFILE</code>" and the value
- "<code>VCARD</code>" to <var>output</var>.<li><p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-3>Add a vCard line</a> with the type "<code>VERSION</code>" and the value
- "<code>4.0</code>" to <var>output</var>.<li><p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-4>Add a vCard line</a> with the type "<code>SOURCE</code>" and the result
- of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string>escaping the vCard text string</a> that is <a id="conversion-to-vcard:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> as the
- value to <var>output</var>.<li><p>If <a href=#the-title-element-2 id=conversion-to-vcard:the-title-element-2>the <code>title</code> element</a> is not null, <a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-5>add a vCard line</a>
- with the type "<code>NAME</code>" and with the result of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string-2>escaping the vCard text
- string</a> obtained from the <code id=conversion-to-vcard:textcontent><a href=#textcontent>textContent</a></code> of <a href=#the-title-element-2 id=conversion-to-vcard:the-title-element-2-2>the <code>title</code>
- element</a> as the value to <var>output</var>.<li><p>Let <var>sex</var> be the empty string.<li><p>Let <var>gender-identity</var> be the empty string.<li>
- <p>For each element <var>element</var> that is <a href=#the-properties-of-an-item id=conversion-to-vcard:the-properties-of-an-item>a property of the item</a> <var>node</var>: for each name <var>name</var> in <var>element</var>'s <a href=#property-names id=conversion-to-vcard:property-names>property names</a>, run the
- following substeps:</p>
- <ol><li><p>Let <var>parameters</var> be an empty set of name-value pairs.<li>
- <p>Run the appropriate set of substeps from the following list. The steps will set a variable
- <var>value</var>, which is used in the next step.</p>
- <dl><dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value>value</a> is an <a href=#concept-item id=conversion-to-vcard:concept-item-3>item</a> <var>subitem</var> and <var>name</var> is
- <code id=conversion-to-vcard:md-vcard-n><a href=#md-vcard-n>n</a></code><dd>
- <ol><li><p>Let <var>value</var> be the empty string.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-family-name><a href=#md-vcard-n-family-name>family-name</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-2>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-given-name><a href=#md-vcard-n-given-name>given-name</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-3>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-additional-name><a href=#md-vcard-n-additional-name>additional-name</a></code> in
- <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-4>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-honorific-prefix><a href=#md-vcard-n-honorific-prefix>honorific-prefix</a></code>
- in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-5>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-n-honorific-suffix><a href=#md-vcard-n-honorific-suffix>honorific-suffix</a></code>
- in <var>subitem</var>.</p>
- </ol>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-2>value</a> is an <a href=#concept-item id=conversion-to-vcard:concept-item-4>item</a> <var>subitem</var> and <var>name</var> is
- <code id=conversion-to-vcard:md-vcard-adr><a href=#md-vcard-adr>adr</a></code><dd>
- <ol><li><p>Let <var>value</var> be the empty string.<li><p>Append to <var>value</var> the result of <a href=#collecting-vcard-subproperties id=conversion-to-vcard:collecting-vcard-subproperties>collecting vCard
- subproperties</a> named <code id=conversion-to-vcard:md-vcard-adr-post-office-box><a href=#md-vcard-adr-post-office-box>post-office-box</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-vcard-subproperties id=conversion-to-vcard:collecting-vcard-subproperties-2>collecting vCard
- subproperties</a> named <code id=conversion-to-vcard:md-vcard-adr-extended-address><a href=#md-vcard-adr-extended-address>extended-address</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-vcard-subproperties id=conversion-to-vcard:collecting-vcard-subproperties-3>collecting vCard
- subproperties</a> named <code id=conversion-to-vcard:md-vcard-adr-street-address><a href=#md-vcard-adr-street-address>street-address</a></code>
- in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-6>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-adr-locality><a href=#md-vcard-adr-locality>locality</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-7>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-adr-region><a href=#md-vcard-adr-region>region</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-8>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-adr-postal-code><a href=#md-vcard-adr-postal-code>postal-code</a></code> in <var>subitem</var>.</p>
- <li>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-9>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-adr-country-name><a href=#md-vcard-adr-country-name>country-name</a></code> in
- <var>subitem</var>.</p>
- <li><p>If there is a property named <code id=conversion-to-vcard:md-vcard-adr-type><a href=#md-vcard-adr-type>type</a></code> in <var>subitem</var>, and the first such property has a <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-3>value</a> that is not an <a href=#concept-item id=conversion-to-vcard:concept-item-5>item</a> and whose value consists only of <a href=#alphanumeric-ascii-characters id=conversion-to-vcard:alphanumeric-ascii-characters>alphanumeric ASCII
- characters</a>, then add a parameter named "<code>TYPE</code>" whose value is
- the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-4>value</a> of that property to <var>parameters</var>.</ol>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-5>value</a> is an <a href=#concept-item id=conversion-to-vcard:concept-item-6>item</a> <var>subitem</var> and <var>name</var> is
- <code id=conversion-to-vcard:md-vcard-org><a href=#md-vcard-org>org</a></code><dd>
- <ol><li><p>Let <var>value</var> be the empty string.<li><p>Append to <var>value</var> the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-10>collecting the first vCard
- subproperty</a> named <code id=conversion-to-vcard:md-vcard-org-organization-name><a href=#md-vcard-org-organization-name>organization-name</a></code> in <var>subitem</var>.</p>
- <li>
- <p>For each property named <code id=conversion-to-vcard:md-vcard-org-organization-unit><a href=#md-vcard-org-organization-unit>organization-unit</a></code> in <var>subitem</var>, run the following steps:</p>
- <ol><li><p>If the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-6>value</a> of the property is an
- <a href=#concept-item id=conversion-to-vcard:concept-item-7>item</a>, then skip this property.<li><p>Append a U+003B SEMICOLON character (;) to <var>value</var>.<li><p>Append the result of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string-3>escaping the vCard text string</a> given by the
- <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-7>value</a> of the property to <var>value</var>.</ol>
- </ol>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-8>value</a> is an <a href=#concept-item id=conversion-to-vcard:concept-item-8>item</a> <var>subitem</var> with the <a href=#item-types id=conversion-to-vcard:item-types-3>item type</a> <code id=conversion-to-vcard:md-vcard-3><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
- and <var>name</var> is <code id=conversion-to-vcard:md-vcard-related><a href=#md-vcard-related>related</a></code><dd>
- <ol><li><p>Let <var>value</var> be the empty string.<li><p>If there is a property named <code id=conversion-to-vcard:md-vcard-related-url><a href=#md-vcard-related-url>url</a></code> in
- <var>subitem</var>, and its element is a <a href=#url-property-elements id=conversion-to-vcard:url-property-elements>URL property
- element</a>, then append the result of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string-4>escaping the vCard text string</a> given
- by the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-9>value</a> of the first such property to
- <var>value</var>, and add a parameter with the name "<code>VALUE</code>" and the
- value "<code>URI</code>" to <var>parameters</var>.<li><p>If there is a property named <code id=conversion-to-vcard:md-vcard-related-rel><a href=#md-vcard-related-rel>rel</a></code> in
- <var>subitem</var>, and the first such property has a <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-10>value</a> that is not an <a href=#concept-item id=conversion-to-vcard:concept-item-9>item</a> and whose value consists only of <a href=#alphanumeric-ascii-characters id=conversion-to-vcard:alphanumeric-ascii-characters-2>alphanumeric ASCII
- characters</a>, then add a parameter named "<code>RELATION</code>" whose value
- is the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-11>value</a> of that property to
- <var>parameters</var>.</ol>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-12>value</a> is an <a href=#concept-item id=conversion-to-vcard:concept-item-10>item</a> and <var>name</var> is none of the above<dd>
- <ol><li><p>Let <var>value</var> be the result of <a href=#collecting-the-first-vcard-subproperty id=conversion-to-vcard:collecting-the-first-vcard-subproperty-11>collecting the first vCard
- subproperty</a> named <code>value</code> in <var>subitem</var>.</p>
- <li><p>If there is a property named <code>type</code> in <var>subitem</var>, and the first such property has a <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-13>value</a> that is not an <a href=#concept-item id=conversion-to-vcard:concept-item-11>item</a> and whose value consists only of <a href=#alphanumeric-ascii-characters id=conversion-to-vcard:alphanumeric-ascii-characters-3>alphanumeric ASCII
- characters</a>, then add a parameter named "<code>TYPE</code>" whose value is
- the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-14>value</a> of that property to <var>parameters</var>.</ol>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-15>value</a> is not an <a href=#concept-item id=conversion-to-vcard:concept-item-12>item</a> and its <var>name</var> is <code id=conversion-to-vcard:md-vcard-sex><a href=#md-vcard-sex>sex</a></code><dd>
- <p>If this is the first such property to be found, set <var>sex</var> to the
- property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-16>value</a>.</p>
- <dt>If the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-17>value</a> is not an <a href=#concept-item id=conversion-to-vcard:concept-item-13>item</a> and its <var>name</var> is <code id=conversion-to-vcard:md-vcard-gender-identity><a href=#md-vcard-gender-identity>gender-identity</a></code><dd>
- <p>If this is the first such property to be found, set <var>gender-identity</var>
- to the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-18>value</a>.</p>
- <dt>Otherwise (the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-19>value</a> is not an
- <a href=#concept-item id=conversion-to-vcard:concept-item-14>item</a>)<dd>
- <ol><li><p>Let <var>value</var> be the property's <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-20>value</a>.<li><p>If <var>element</var> is one of the <a href=#url-property-elements id=conversion-to-vcard:url-property-elements-2>URL property elements</a>, add
- a parameter with the name "<code>VALUE</code>" and the value "<code>URI</code>" to <var>parameters</var>.<li><p>Otherwise, if <var>name</var> is <code id=conversion-to-vcard:md-vcard-bday><a href=#md-vcard-bday>bday</a></code> or
- <code id=conversion-to-vcard:md-vcard-anniversary><a href=#md-vcard-anniversary>anniversary</a></code> and the <var>value</var> is
- a <a href=#valid-date-string id=conversion-to-vcard:valid-date-string>valid date string</a>, add a parameter with the name "<code>VALUE</code>" and the value "<code>DATE</code>" to <var>parameters</var>.<li><p>Otherwise, if <var>name</var> is <code id=conversion-to-vcard:md-vcard-rev><a href=#md-vcard-rev>rev</a></code> and
- the <var>value</var> is a <a href=#valid-global-date-and-time-string id=conversion-to-vcard:valid-global-date-and-time-string>valid global date and time string</a>, add a
- parameter with the name "<code>VALUE</code>" and the value "<code>DATE-TIME</code>" to <var>parameters</var>.<li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var>value</var> with
- another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C
- REVERSE SOLIDUS character (\).<li><p>Unless <var>name</var> is <code id=conversion-to-vcard:md-vcard-geo><a href=#md-vcard-geo>geo</a></code>, prefix
- every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C REVERSE
- SOLIDUS character (\).<li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
- SMALL LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF)
- character in <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed
- by a U+006E LATIN SMALL LETTER N character (n).</ol>
- </dl>
- <li>
- <p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-6>Add a vCard line</a> with the type <var>name</var>, the parameters <var>parameters</var>, and the value <var>value</var> to <var>output</var>.</p>
- </ol>
- <li><p>If either <var>sex</var> or <var>gender-identity</var> has a value that
- is not the empty string, <a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-7>add a vCard line</a> with the type "<code>GENDER</code>" and the value consisting of the concatenation of <var>sex</var>,
- a U+003B SEMICOLON character (;), and <var>gender-identity</var> to <var>output</var>.<li><p><a href=#add-a-vcard-line id=conversion-to-vcard:add-a-vcard-line-8>Add a vCard line</a> with the type "<code>END</code>" and the value
- "<code>VCARD</code>" to <var>output</var>.</ol>
- <p>When the above algorithm says that the user agent is to <dfn id=add-a-vcard-line>add a vCard line</dfn> consisting
- of a type <var>type</var>, optionally some parameters, and a value <var>value</var> to a string <var>output</var>, it must run the following steps:</p>
- <ol><li><p>Let <var>line</var> be an empty string.
- <li><p>Append <var>type</var>, <a href=#converted-to-ascii-uppercase id=conversion-to-vcard:converted-to-ascii-uppercase>converted to ASCII uppercase</a>, to <var>line</var>.<li>
- <p>If there are any parameters, then for each parameter, in the order that they were added, run
- these substeps:</p>
- <ol><li><p>Append a U+003B SEMICOLON character (;) to <var>line</var>.<li><p>Append the parameter's name to <var>line</var>.<li><p>Append a U+003D EQUALS SIGN character (=) to <var>line</var>.<li><p>Append the parameter's value to <var>line</var>.</ol>
- <li><p>Append a U+003A COLON character (:) to <var>line</var>.<li><p>Append <var>value</var> to <var>line</var>.<li><p>Let <var>maximum length</var> be 75.<li>
- <p>If and while <var>line</var> is longer than <var>maximum length</var>
- Unicode code points long, run the following substeps:</p>
- <ol><li><p>Append the first <var>maximum length</var> Unicode code points of <var>line</var> to <var>output</var>.<li><p>Remove the first <var>maximum length</var> Unicode code points from <var>line</var>.<li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var>output</var>.<li><p>Append a U+000A LINE FEED character (LF) to <var>output</var>.<li><p>Append a U+0020 SPACE character to <var>output</var>.<li><p>Let <var>maximum length</var> be 74.</ol>
- <li><p>Append (what remains of) <var>line</var> to <var>output</var>.<li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var>output</var>.<li><p>Append a U+000A LINE FEED character (LF) to <var>output</var>.</ol>
- <p>When the steps above require the user agent to obtain the result of <dfn id=collecting-vcard-subproperties>collecting vCard
- subproperties</dfn> named <var>subname</var> in <var>subitem</var>, the user
- agent must run the following steps:</p>
- <ol><li><p>Let <var>value</var> be the empty string.<li>
- <p>For each property named <var>subname</var> in the item <var>subitem</var>,
- run the following substeps:</p>
- <ol><li><p>If the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-21>value</a> of the property is itself an
- <a href=#concept-item id=conversion-to-vcard:concept-item-15>item</a>, then skip this property.<li><p>If this is not the first property named <var>subname</var> in <var>subitem</var> (ignoring any that were skipped by the previous step), then append a
- U+002C COMMA character (,) to <var>value</var>.<li><p>Append the result of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string-5>escaping the vCard text string</a> given by the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-22>value</a> of the property to <var>value</var>.</ol>
- <li><p>Return <var>value</var>.</ol>
- <p>When the steps above require the user agent to obtain the result of <dfn id=collecting-the-first-vcard-subproperty>collecting the first
- vCard subproperty</dfn> named <var>subname</var> in <var>subitem</var>, the user
- agent must run the following steps:</p>
- <ol><li><p>If there are no properties named <var>subname</var> in <var>subitem</var>, then abort these substeps, returning the empty string.<li><p>If the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-23>value</a> of the first property named <var>subname</var> in <var>subitem</var> is an <a href=#concept-item id=conversion-to-vcard:concept-item-16>item</a>, then abort these substeps, returning the empty string.<li><p>Return the result of <a href=#escaping-the-vcard-text-string id=conversion-to-vcard:escaping-the-vcard-text-string-6>escaping the vCard text string</a> given by the <a href=#concept-property-value id=conversion-to-vcard:concept-property-value-24>value</a> of the first property named <var>subname</var> in <var>subitem</var>.</ol>
- <p>When the above algorithms say the user agent is to <dfn id=escaping-the-vcard-text-string>escape the vCard text string</dfn> <var>value</var>, the user agent must use the
- following steps:</p>
- <ol><li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var>value</var> with
- another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C REVERSE
- SOLIDUS character (\).<li><p>Prefix every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C
- REVERSE SOLIDUS character (\).<li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
- LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in
- <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
- SMALL LETTER N character (n).<li><p>Return the mutated <var>value</var>.</ol>
- <p class=note>This algorithm can generate invalid vCard output, if the input does not conform to
- the rules described for the <code id=conversion-to-vcard:md-vcard-4><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>
- <a href=#item-types id=conversion-to-vcard:item-types-4>item type</a> and <a href=#defined-property-name id=conversion-to-vcard:defined-property-name>defined property
- names</a>.</p>
- <h5 id=examples-2>5.4.1.2 Examples</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>Here is a long example vCard for a fictional character called "Jack Bauer":</p>
- <pre><section id="jack" itemscope itemtype="http://microformats.org/profile/hcard">
- <h1 itemprop="fn">
- <span itemprop="n" itemscope>
- <span itemprop="given-name">Jack</span>
- <span itemprop="family-name">Bauer</span>
- </span>
- </h1>
- <img itemprop="photo" alt="" src="jack-bauer.jpg">
- <p itemprop="org" itemscope>
- <span itemprop="organization-name">Counter-Terrorist Unit</span>
- (<span itemprop="organization-unit">Los Angeles Division</span>)
- </p>
- <p>
- <span itemprop="adr" itemscope>
- <span itemprop="street-address">10201 W. Pico Blvd.</span><br>
- <span itemprop="locality">Los Angeles</span>,
- <span itemprop="region">CA</span>
- <span itemprop="postal-code">90064</span><br>
- <span itemprop="country-name">United States</span><br>
- </span>
- <span itemprop="geo">34.052339;-118.410623</span>
- </p>
- <h2>Assorted Contact Methods</h2>
- <ul>
- <li itemprop="tel" itemscope>
- <span itemprop="value">+1 (310) 597 3781</span> <span itemprop="type">work</span>
- <meta itemprop="type" content="voice">
- </li>
- <li><a itemprop="url" href="http://en.wikipedia.org/wiki/Jack_Bauer">I'm on Wikipedia</a>
- so you can leave a message on my user talk page.</li>
- <li><a itemprop="url" href="http://www.jackbauerfacts.com/">Jack Bauer Facts</a></li>
- <li itemprop="email"><a href="mailto:j.bauer@la.ctu.gov.invalid">j.bauer@la.ctu.gov.invalid</a></li>
- <li itemprop="tel" itemscope>
- <span itemprop="value">+1 (310) 555 3781</span> <span>
- <meta itemprop="type" content="cell">mobile phone</span>
- </li>
- </ul>
- <ins datetime="2008-07-20 21:00:00+01:00">
- <meta itemprop="rev" content="2008-07-20 21:00:00+01:00">
- <p itemprop="tel" itemscope><strong>Update!</strong>
- My new <span itemprop="type">home</span> phone number is
- <span itemprop="value">01632 960 123</span>.</p>
- </ins>
- </section></pre>
- <p>The odd line wrapping is needed because newlines are meaningful in microdata: newlines would
- be preserved in a conversion to, for example, the vCard format.</p>
- </div>
- <div class=example>
- <p>This example shows a site's contact details (using the <code id=examples-2:the-address-element><a href=#the-address-element>address</a></code> element)
- containing an address with two street components:</p>
- <pre><address itemscope itemtype="http://microformats.org/profile/hcard">
- <strong itemprop="fn"><span itemprop="n" itemscope><span itemprop="given-name">Alfred</span>
- <span itemprop="family-name">Person</span></span></strong> <br>
- <span itemprop="adr" itemscope>
- <span itemprop="street-address">1600 Amphitheatre Parkway</span> <br>
- <span itemprop="street-address">Building 43, Second Floor</span> <br>
- <span itemprop="locality">Mountain View</span>,
- <span itemprop="region">CA</span> <span itemprop="postal-code">94043</span>
- </span>
- </address></pre>
- </div>
- <div class=example>
- <p>The vCard vocabulary can be used to just mark up people's names:</p>
- <pre><span itemscope itemtype="http://microformats.org/profile/hcard"
- ><span itemprop=fn><span itemprop="n" itemscope><span itemprop="given-name"
- >George</span> <span itemprop="family-name">Washington</span></span
- ></span></span></pre>
- <p>This creates a single item with a two name-value pairs, one with the name "fn" and the value
- "George Washington", and the other with the name "n" and a second item as its value, the second
- item having the two name-value pairs "given-name" and "family-name" with the values "George" and
- "Washington" respectively. This is defined to map to the following vCard:</p>
- <pre>BEGIN:VCARD
- PROFILE:VCARD
- VERSION:4.0
- SOURCE:<var>document's address</var>
- FN:George Washington
- N:Washington;George;;;
- END:VCARD</pre>
- </div>
- <h4 id=vevent>5.4.2 vEvent</h4>
- <p>An item with the <a href=#item-types id=vevent:item-types>item type</a> <dfn id=md-vevent><code>http://microformats.org/profile/hcalendar#vevent</code></dfn> represents
- an event.</p>
- <p>This vocabulary does not <a href=#support-global-identifiers-for-items id=vevent:support-global-identifiers-for-items>support global identifiers for items</a>.</p>
- <p>The following are the type's <a href=#defined-property-name id=vevent:defined-property-name>defined property names</a>.
- They are based on the vocabulary defined in the iCalendar specification, where more information on
- how to interpret the values can be found. <a href=#refsRFC2445>[RFC2445]</a></p>
- <p class=note>Only the parts of the iCalendar vocabulary relating to events are used here; this
- vocabulary cannot express a complete iCalendar instance.</p>
- <dl><dt><dfn id=md-vevent-attach><code>attach</code></dfn><dd>
- <p>Gives the address of an associated document for the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value>value</a> must be an <a href=#absolute-url id=vevent:absolute-url>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-attach><a href=#md-vevent-attach>attach</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item>item</a> with the type <code id=vevent:md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-categories><code>categories</code></dfn><dd>
- <p>Gives the name of a category or tag that the event could be classified as.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-2>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-categories><a href=#md-vevent-categories>categories</a></code>
- may be present within each <a href=#concept-item id=vevent:concept-item-2>item</a> with the type <code id=vevent:md-vevent-2><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-class><code>class</code></dfn><dd>
- <p>Gives the access classification of the information regarding the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-3>value</a> must be text with one of the following
- values:</p>
- <ul class=brief><li><code>public</code><li><code>private</code><li><code>confidential</code></ul>
- <p class=warning>This is merely advisory and cannot be considered a confidentiality
- measure.</p>
- <p>A single property with the name <code id=vevent:md-vevent-class><a href=#md-vevent-class>class</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-3>item</a> with the type <code id=vevent:md-vevent-3><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-comment><code>comment</code></dfn><dd>
- <p>Gives a comment regarding the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-4>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-comment><a href=#md-vevent-comment>comment</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-4>item</a> with the type <code id=vevent:md-vevent-4><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-description><code>description</code></dfn><dd>
- <p>Gives a detailed description of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-5>value</a> must be text.</p>
- <p>A single property with the name <code id=vevent:md-vevent-description><a href=#md-vevent-description>description</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-5>item</a> with the type <code id=vevent:md-vevent-5><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-geo><code>geo</code></dfn><dd>
- <p>Gives the geographical position of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-6>value</a> must be text and must match the
- following syntax:</p>
- <ol><li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
- (-).<li>One or more <a href=#ascii-digits id=vevent:ascii-digits>ASCII digits</a>.<li>Optionally*, a U+002E FULL STOP character (.) followed by one or more <a href=#ascii-digits id=vevent:ascii-digits-2>ASCII
- digits</a>.<li>A U+003B SEMICOLON character (;).<li>Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character
- (-).<li>One or more <a href=#ascii-digits id=vevent:ascii-digits-3>ASCII digits</a>.<li>Optionally*, a U+002E FULL STOP character (.) followed by one or more <a href=#ascii-digits id=vevent:ascii-digits-4>ASCII
- digits</a>.</ol>
- <p>The optional components marked with an asterisk (*) should be included, and should have six
- digits each.</p>
-
- <p class=note>The value specifies latitude and longitude, in that order (i.e., "LAT LON"
- ordering), in decimal degrees. The longitude represents the location east and west of the prime
- meridian as a positive or negative real number, respectively. The latitude represents the
- location north and south of the equator as a positive or negative real number, respectively.</p>
- <p>A single property with the name <code id=vevent:md-vevent-geo><a href=#md-vevent-geo>geo</a></code> may be present within
- each <a href=#concept-item id=vevent:concept-item-6>item</a> with the type <code id=vevent:md-vevent-6><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-location><code>location</code></dfn><dd>
- <p>Gives the location of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-7>value</a> must be text.</p>
- <p>A single property with the name <code id=vevent:md-vevent-location><a href=#md-vevent-location>location</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-7>item</a> with the type <code id=vevent:md-vevent-7><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-resources><code>resources</code></dfn><dd>
- <p>Gives a resource that will be needed for the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-8>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-resources><a href=#md-vevent-resources>resources</a></code> may
- be present within each <a href=#concept-item id=vevent:concept-item-8>item</a> with the type <code id=vevent:md-vevent-8><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-status><code>status</code></dfn><dd>
- <p>Gives the confirmation status of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-9>value</a> must be text with one of the following
- values:</p>
- <ul class=brief><li><code>tentative</code><li><code>confirmed</code><li><code>cancelled</code></ul>
- <p>A single property with the name <code id=vevent:md-vevent-status><a href=#md-vevent-status>status</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-9>item</a> with the type <code id=vevent:md-vevent-9><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-summary><code>summary</code></dfn><dd>
- <p>Gives a short summary of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-10>value</a> must be text.</p>
- <p>User agents should replace U+000A LINE FEED (LF) characters in the <a href=#concept-property-value id=vevent:concept-property-value-11>value</a> by U+0020 SPACE characters when using the value.</p>
- <p>A single property with the name <code id=vevent:md-vevent-summary><a href=#md-vevent-summary>summary</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-10>item</a> with the type <code id=vevent:md-vevent-10><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-dtend><code>dtend</code></dfn><dd>
- <p>Gives the date and time by which the event ends.</p>
- <p>If the property with the name <code id=vevent:md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code> is present within an
- <a href=#concept-item id=vevent:concept-item-11>item</a> with the type <code id=vevent:md-vevent-11><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code> that has a property
- with the name <code id=vevent:md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code> whose value is a <a href=#valid-date-string id=vevent:valid-date-string>valid date
- string</a>, then the <a href=#concept-property-value id=vevent:concept-property-value-12>value</a> of the property with
- the name <code id=vevent:md-vevent-dtend-2><a href=#md-vevent-dtend>dtend</a></code> must be text that is a <a href=#valid-date-string id=vevent:valid-date-string-2>valid date
- string</a> also. Otherwise, the <a href=#concept-property-value id=vevent:concept-property-value-13>value</a> of the
- property must be text that is a <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string>valid global date and time string</a>.</p>
- <p>In either case, the <a href=#concept-property-value id=vevent:concept-property-value-14>value</a> be later in time than
- the value of the <code id=vevent:md-vevent-dtstart-2><a href=#md-vevent-dtstart>dtstart</a></code> property of the same <a href=#concept-item id=vevent:concept-item-12>item</a>.</p>
- <p class=note>The time given by the <code id=vevent:md-vevent-dtend-3><a href=#md-vevent-dtend>dtend</a></code> property is not
- inclusive. For day-long events, therefore, the <code id=vevent:md-vevent-dtend-4><a href=#md-vevent-dtend>dtend</a></code>
- property's <a href=#concept-property-value id=vevent:concept-property-value-15>value</a> will be the day <em>after</em> the
- end of the event.</p>
- <p>A single property with the name <code id=vevent:md-vevent-dtend-5><a href=#md-vevent-dtend>dtend</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-13>item</a> with the type <code id=vevent:md-vevent-12><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>, so long as that <code id=vevent:md-vevent-13><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code> does not have a
- property with the name <code id=vevent:md-vevent-duration><a href=#md-vevent-duration>duration</a></code>.</p>
- <dt><dfn id=md-vevent-dtstart><code>dtstart</code></dfn><dd>
- <p>Gives the date and time at which the event starts.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-16>value</a> must be text that is either a
- <a href=#valid-date-string id=vevent:valid-date-string-3>valid date string</a> or a <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-2>valid global date and time string</a>.</p>
- <p>Exactly one property with the name <code id=vevent:md-vevent-dtstart-3><a href=#md-vevent-dtstart>dtstart</a></code> must be
- present within each <a href=#concept-item id=vevent:concept-item-14>item</a> with the type <code id=vevent:md-vevent-14><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-duration><code>duration</code></dfn><dd>
- <p>Gives the duration of the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-17>value</a> must be text that is a <a href=#valid-vevent-duration-string id=vevent:valid-vevent-duration-string>valid
- vevent duration string</a>.</p>
- <p>The duration represented is the sum of all the durations represented by integers in the
- value.</p>
- <p>A single property with the name <code id=vevent:md-vevent-duration-2><a href=#md-vevent-duration>duration</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-15>item</a> with the type <code id=vevent:md-vevent-15><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>, so long as that <code id=vevent:md-vevent-16><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code> does not have a
- property with the name <code id=vevent:md-vevent-dtend-6><a href=#md-vevent-dtend>dtend</a></code>.</p>
- <dt><dfn id=md-vevent-transp><code>transp</code></dfn><dd>
- <p>Gives whether the event is to be considered as consuming time on a calendar, for the purpose
- of free-busy time searches.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-18>value</a> must be text with one of the following
- values:</p>
- <ul class=brief><li><code>opaque</code><li><code>transparent</code></ul>
- <p>A single property with the name <code id=vevent:md-vevent-transp><a href=#md-vevent-transp>transp</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-16>item</a> with the type <code id=vevent:md-vevent-17><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-contact><code>contact</code></dfn><dd>
- <p>Gives the contact information for the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-19>value</a> must be text.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-contact><a href=#md-vevent-contact>contact</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-17>item</a> with the type <code id=vevent:md-vevent-18><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-url><code>url</code></dfn><dd>
- <p>Gives a <a href=#url id=vevent:url>URL</a> for the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-20>value</a> must be an <a href=#absolute-url id=vevent:absolute-url-2>absolute
- URL</a>.</p>
- <p>A single property with the name <code id=vevent:md-vevent-url><a href=#md-vevent-url>url</a></code> may be present within
- each <a href=#concept-item id=vevent:concept-item-18>item</a> with the type <code id=vevent:md-vevent-19><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-uid><code>uid</code></dfn><dd>
- <p>Gives a globally unique identifier corresponding to the event.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-21>value</a> must be text.</p>
- <p>A single property with the name <code id=vevent:md-vevent-uid><a href=#md-vevent-uid>uid</a></code> may be present within
- each <a href=#concept-item id=vevent:concept-item-19>item</a> with the type <code id=vevent:md-vevent-20><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-exdate><code>exdate</code></dfn><dd>
- <p>Gives a date and time at which the event does not occur despite the recurrence rules.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-22>value</a> must be text that is either a
- <a href=#valid-date-string id=vevent:valid-date-string-4>valid date string</a> or a <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-3>valid global date and time string</a>.</p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-exdate><a href=#md-vevent-exdate>exdate</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-20>item</a> with the type <code id=vevent:md-vevent-21><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-exrule><code>exrule</code></dfn><dd>
- <p>Gives a rule for finding dates and times at which the event does not occur despite the
- recurrence rules.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-23>value</a> must be text that matches the RECUR
- value type defined in the iCalendar specification. <a href=#refsRFC2445>[RFC2445]</a></p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-exrule><a href=#md-vevent-exrule>exrule</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-21>item</a> with the type <code id=vevent:md-vevent-22><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-rdate><code>rdate</code></dfn><dd>
- <p>Gives a date and time at which the event recurs.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-24>value</a> must be text that is one of the
- following:
- <ul><li>A <a href=#valid-date-string id=vevent:valid-date-string-5>valid date string</a>.<li>A <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-4>valid global date and time string</a>.<li>A <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-5>valid global date and time string</a> followed by a U+002F SOLIDUS character (/)
- followed by a second <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-6>valid global date and time string</a> representing a later
- time.<li>A <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-7>valid global date and time string</a> followed by a U+002F SOLIDUS character (/)
- followed by a <a href=#valid-vevent-duration-string id=vevent:valid-vevent-duration-string-2>valid vevent duration string</a>.</ul>
- <p>Any number of properties with the name <code id=vevent:md-vevent-rdate><a href=#md-vevent-rdate>rdate</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-22>item</a> with the type <code id=vevent:md-vevent-23><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-rrule><code>rrule</code></dfn><dd>
- <p>Gives a rule for finding dates and times at which the event occurs.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-25>value</a> must be text that matches the RECUR
- value type defined in the iCalendar specification. <a href=#refsRFC2445>[RFC2445]</a></p>
- <p>Any number of properties with the name <code id=vevent:md-vevent-rrule><a href=#md-vevent-rrule>rrule</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-23>item</a> with the type <code id=vevent:md-vevent-24><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-created><code>created</code></dfn><dd>
- <p>Gives the date and time at which the event information was first created in a calendaring
- system.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-26>value</a> must be text that is a <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-8>valid
- global date and time string</a>.</p>
- <p>A single property with the name <code id=vevent:md-vevent-created><a href=#md-vevent-created>created</a></code> may be present
- within each <a href=#concept-item id=vevent:concept-item-24>item</a> with the type <code id=vevent:md-vevent-25><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-last-modified><code>last-modified</code></dfn><dd>
- <p>Gives the date and time at which the event information was last modified in a calendaring
- system.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-27>value</a> must be text that is a <a href=#valid-global-date-and-time-string id=vevent:valid-global-date-and-time-string-9>valid
- global date and time string</a>.</p>
- <p>A single property with the name <code id=vevent:md-vevent-last-modified><a href=#md-vevent-last-modified>last-modified</a></code>
- may be present within each <a href=#concept-item id=vevent:concept-item-25>item</a> with the type <code id=vevent:md-vevent-26><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- <dt><dfn id=md-vevent-sequence><code>sequence</code></dfn><dd>
- <p>Gives a revision number for the event information.</p>
- <p>The <a href=#concept-property-value id=vevent:concept-property-value-28>value</a> must be text that is a <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer>valid
- non-negative integer</a>.</p>
- <p>A single property with the name <code id=vevent:md-vevent-sequence><a href=#md-vevent-sequence>sequence</a></code> may be
- present within each <a href=#concept-item id=vevent:concept-item-26>item</a> with the type <code id=vevent:md-vevent-27><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>.</p>
- </dl>
- <p>A string is a <dfn id=valid-vevent-duration-string>valid vevent duration string</dfn> if it matches the following pattern:</p>
- <ol><li>A U+0050 LATIN CAPITAL LETTER P character (P).<li>One of the following:
- <ul><li> A <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer-2>valid non-negative integer</a> followed by a U+0057 LATIN CAPITAL LETTER W
- character (W). The integer represents a duration of that number of weeks. <li> At least one, and possible both in this order, of the following:
- <ol><li> A <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer-3>valid non-negative integer</a> followed by a U+0044 LATIN CAPITAL LETTER D
- character (D). The integer represents a duration of that number of days. <li> A U+0054 LATIN CAPITAL LETTER T character (T) followed by any one of the following, or
- the first and second of the following in that order, or the second and third of the following
- in that order, or all three of the following in this order:
- <ol><li> A <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer-4>valid non-negative integer</a> followed by a U+0048 LATIN CAPITAL LETTER H
- character (H). The integer represents a duration of that number of hours. <li> A <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer-5>valid non-negative integer</a> followed by a U+004D LATIN CAPITAL LETTER M
- character (M). The integer represents a duration of that number of minutes. <li> A <a href=#valid-non-negative-integer id=vevent:valid-non-negative-integer-6>valid non-negative integer</a> followed by a U+0053 LATIN CAPITAL LETTER S
- character (S). The integer represents a duration of that number of seconds. </ol>
- </ol>
- </ul>
- </ol>
- <h5 id=conversion-to-icalendar>5.4.2.1 Conversion to iCalendar</h5>
- <p>Given a list of nodes <var>nodes</var> in a <code id=conversion-to-icalendar:document><a href=#document>Document</a></code>, a user agent must
- run the following algorithm to <dfn id=extracting-vevent-data>extract any vEvent data
- represented by those nodes</dfn>:</p>
- <ol><li><p>If none of the nodes in <var>nodes</var> are <a href=#concept-item id=conversion-to-icalendar:concept-item>items</a> with the type <code id=conversion-to-icalendar:md-vevent><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>, then there is no
- vEvent data. Abort the algorithm, returning nothing.<li><p>Let <var>output</var> be an empty string.<li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line>Add an iCalendar line</a> with the type "<code>BEGIN</code>" and the
- value "<code>VCALENDAR</code>" to <var>output</var>.<li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-2>Add an iCalendar line</a> with the type "<code>PRODID</code>" and the
- value equal to a user-agent-specific string representing the user agent to <var>output</var>.<li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-3>Add an iCalendar line</a> with the type "<code>VERSION</code>" and the
- value "<code>2.0</code>" to <var>output</var>.<li>
- <p>For each node <var>node</var> in <var>nodes</var> that is an <a href=#concept-item id=conversion-to-icalendar:concept-item-2>item</a> with the type <code id=conversion-to-icalendar:md-vevent-2><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code>, run the following
- steps:</p>
- <ol><li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-4>Add an iCalendar line</a> with the type "<code>BEGIN</code>" and the
- value "<code>VEVENT</code>" to <var>output</var>.<li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-5>Add an iCalendar line</a> with the type "<code>DTSTAMP</code>" and a
- value consisting of an iCalendar DATE-TIME string representing the current date and time, with
- the annotation "<code>VALUE=DATE-TIME</code>", to <var>output</var>. <a href=#refsRFC2445>[RFC2445]</a><li>
- <p>For each element <var>element</var> that is <a href=#the-properties-of-an-item id=conversion-to-icalendar:the-properties-of-an-item>a property of the item</a> <var>node</var>: for each name <var>name</var> in <var>element</var>'s <a href=#property-names id=conversion-to-icalendar:property-names>property names</a>, run the
- appropriate set of substeps from the following list:</p>
- <dl><dt>If the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value>value</a> is an <a href=#concept-item id=conversion-to-icalendar:concept-item-3>item</a><dd>
- <p>Skip the property.</p>
- <dt>If the property is <code id=conversion-to-icalendar:md-vevent-dtend><a href=#md-vevent-dtend>dtend</a></code><dt>If the property is <code id=conversion-to-icalendar:md-vevent-dtstart><a href=#md-vevent-dtstart>dtstart</a></code><dt>If the property is <code id=conversion-to-icalendar:md-vevent-exdate><a href=#md-vevent-exdate>exdate</a></code><dt>If the property is <code id=conversion-to-icalendar:md-vevent-rdate><a href=#md-vevent-rdate>rdate</a></code><dt>If the property is <code id=conversion-to-icalendar:md-vevent-created><a href=#md-vevent-created>created</a></code><dt>If the property is <code id=conversion-to-icalendar:md-vevent-last-modified><a href=#md-vevent-last-modified>last-modified</a></code><dd>
- <p>Let <var>value</var> be the result of stripping all U+002D HYPHEN-MINUS (-) and
- U+003A COLON (:) characters from the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-2>value</a>.</p>
- <p>If the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-3>value</a> is a <a href=#valid-date-string id=conversion-to-icalendar:valid-date-string>valid date
- string</a> then <a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-6>add an iCalendar line</a> with the type <var>name</var>
- and the value <var>value</var> to <var>output</var>, with the annotation
- "<code>VALUE=DATE</code>".</p>
- <p>Otherwise, if the property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-4>value</a> is a
- <a href=#valid-global-date-and-time-string id=conversion-to-icalendar:valid-global-date-and-time-string>valid global date and time string</a> then <a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-7>add an iCalendar line</a> with
- the type <var>name</var> and the value <var>value</var> to <var>output</var>, with the annotation "<code>VALUE=DATE-TIME</code>".</p>
- <p>Otherwise skip the property.</p>
- <dt>Otherwise<dd>
- <p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-8>Add an iCalendar line</a> with the type <var>name</var> and the
- property's <a href=#concept-property-value id=conversion-to-icalendar:concept-property-value-5>value</a> to <var>output</var>.</p>
- </dl>
- <li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-9>Add an iCalendar line</a> with the type "<code>END</code>" and the
- value "<code>VEVENT</code>" to <var>output</var>.</ol>
- <li><p><a href=#add-an-icalendar-line id=conversion-to-icalendar:add-an-icalendar-line-10>Add an iCalendar line</a> with the type "<code>END</code>" and the value
- "<code>VCALENDAR</code>" to <var>output</var>.</ol>
- <p>When the above algorithm says that the user agent is to <dfn id=add-an-icalendar-line>add an iCalendar line</dfn>
- consisting of a type <var>type</var>, a value <var>value</var>, and optionally
- an annotation, to a string <var>output</var>, it must run the following steps:</p>
- <ol><li><p>Let <var>line</var> be an empty string.<li><p>Append <var>type</var>, <a href=#converted-to-ascii-uppercase id=conversion-to-icalendar:converted-to-ascii-uppercase>converted to ASCII uppercase</a>, to <var>line</var>.<li>
- <p>If there is an annotation:</p>
- <ol><li><p>Append a U+003B SEMICOLON character (;) to <var>line</var>.<li><p>Append the annotation to <var>line</var>.</ol>
- <li><p>Append a U+003A COLON character (:) to <var>line</var>.<li><p>Prefix every U+005C REVERSE SOLIDUS character (\) in <var>value</var> with
- another U+005C REVERSE SOLIDUS character (\).<li><p>Prefix every U+002C COMMA character (,) in <var>value</var> with a U+005C REVERSE
- SOLIDUS character (\).<li><p>Prefix every U+003B SEMICOLON character (;) in <var>value</var> with a U+005C
- REVERSE SOLIDUS character (\).<li><p>Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL
- LETTER N character (n).<li><p>Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in
- <var>value</var> with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN
- SMALL LETTER N character (n).<li><p>Append <var>value</var> to <var>line</var>.<li><p>Let <var>maximum length</var> be 75.<li>
- <p>If and while <var>line</var> is longer than <var>maximum length</var>
- Unicode code points long, run the following substeps:</p>
- <ol><li><p>Append the first <var>maximum length</var> Unicode code points of <var>line</var> to <var>output</var>.<li><p>Remove the first <var>maximum length</var> Unicode code points from <var>line</var>.<li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var>output</var>.<li><p>Append a U+000A LINE FEED character (LF) to <var>output</var>.<li><p>Append a U+0020 SPACE character to <var>output</var>.<li><p>Let <var>maximum length</var> be 74.</ol>
- <li><p>Append (what remains of) <var>line</var> to <var>output</var>.<li><p>Append a U+000D CARRIAGE RETURN character (CR) to <var>output</var>.<li><p>Append a U+000A LINE FEED character (LF) to <var>output</var>.</ol>
- <p class=note>This algorithm can generate invalid iCalendar output, if the input does not
- conform to the rules described for the <code id=conversion-to-icalendar:md-vevent-3><a href=#md-vevent>http://microformats.org/profile/hcalendar#vevent</a></code> <a href=#item-types id=conversion-to-icalendar:item-types>item type</a> and <a href=#defined-property-name id=conversion-to-icalendar:defined-property-name>defined property names</a>.</p>
-
- <h5 id=examples-3>5.4.2.2 Examples</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>Here is an example of a page that uses the vEvent vocabulary to mark up an event:</p>
- <pre><body itemscope itemtype="http://microformats.org/profile/hcalendar#vevent">
- ...
- <h1 itemprop="summary">Bluesday Tuesday: Money Road</h1>
- ...
- <time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th @ 7pm</time>
- (until <time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm</time>)
- ...
- <a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
- rel="bookmark" itemprop="url">Link to this page</a>
- ...
- <p>Location: <span itemprop="location">The RoadHouse</span></p>
- ...
- <p><input type=button value="Add to Calendar"
- onclick="location = getCalendar(this)"></p>
- ...
- <meta itemprop="description" content="via livebrum.co.uk">
- </body></pre>
- <p>The "<code>getCalendar()</code>" method could look like
- this:</p>
- <pre>function getCalendar(node) {
- // This function assumes the content is valid.
- // It is not a compliant implementation of the algorithm for <a href=#extracting-vevent-data id=examples-3:extracting-vevent-data>extracting vEvent data</a>.
- while (node && (!node.itemScope || !node.itemType.contains('http://microformats.org/profile/hcalendar#vevent')))
- node = node.parentNode;
- if (!node) {
- alert('No event data found.');
- return;
- }
- var stamp = new Date();
- var stampString = '' + stamp.getUTCFullYear() + (stamp.getUTCMonth() + 1) + stamp.getUTCDate() + 'T' +
- stamp.getUTCHours() + stamp.getUTCMinutes() + stamp.getUTCSeconds() + 'Z';
- var calendar = 'BEGIN:VCALENDAR\r\nPRODID:HTML\r\nVERSION:2.0\r\nBEGIN:VEVENT\r\nDTSTAMP:' + stampString + '\r\n';
- for (var propIndex = 0; propIndex < node.properties.length; propIndex += 1) {
- var prop = node.properties[propIndex];
- var value = prop.itemValue;
- var parameters = '';
- if (prop.localName == 'time') {
- value = value.replace(/[:-]/g, '');
- if (value.match(/T/))
- parameters = ';VALUE=DATE';
- else
- parameters = ';VALUE=DATE-TIME';
- } else {
- value = value.replace(/\\/g, '\\n');
- value = value.replace(/;/g, '\\;');
- value = value.replace(/,/g, '\\,');
- value = value.replace(/\n/g, '\\n');
- }
- for (var nameIndex = 0; nameIndex < prop.itemProp.length; nameIndex += 1) {
- var name = prop.itemProp[nameIndex];
- if (!name.match(/:/) && !name.match(/\./))
- calendar += name.toUpperCase() + parameters + ':' + value + '\r\n';
- }
- }
- calendar += 'END:VEVENT\r\nEND:VCALENDAR\r\n';
- return 'data:text/calendar;component=vevent,' + encodeURI(calendar);
- }</pre>
- <p>The same page could offer some markup, such as the following,
- for copy-and-pasting into blogs:</p>
- <pre><div itemscope itemtype="http://microformats.org/profile/hcalendar#vevent">
- <p>I'm going to
- <strong itemprop="summary">Bluesday Tuesday: Money Road</strong>,
- <time itemprop="dtstart" datetime="2009-05-05T19:00:00Z">May 5th at 7pm</time>
- to <time itemprop="dtend" datetime="2009-05-05T21:00:00Z">9pm</time>,
- at <span itemprop="location">The RoadHouse</span>!</p>
- <p><a href="http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road"
- itemprop="url">See this event on livebrum.co.uk</a>.</p>
- <meta itemprop="description" content="via livebrum.co.uk">
- </div></pre>
- </div>
- <h4 id=licensing-works>5.4.3 Licensing works</h4>
- <p>An item with the <a href=#item-types id=licensing-works:item-types>item type</a> <dfn id=md-work><code>http://n.whatwg.org/work</code></dfn> represents a work (e.g. an article, an
- image, a video, a song, etc). This type is primarily intended to allow authors to include
- licensing information for works.</p>
- <p>The following are the type's <a href=#defined-property-name id=licensing-works:defined-property-name>defined property
- names</a>.</p>
- <dl><dt><dfn id=md-work-work><code>work</code></dfn><dd>
- <p>Identifies the work being described.</p>
- <p>The <a href=#concept-property-value id=licensing-works:concept-property-value>value</a> must be an <a href=#absolute-url id=licensing-works:absolute-url>absolute
- URL</a>.</p>
- <p>Exactly one property with the name <code id=licensing-works:md-work-work><a href=#md-work-work>work</a></code> must be present
- within each <a href=#concept-item id=licensing-works:concept-item>item</a> with the type <code id=licensing-works:md-work><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
- <dt><dfn id=md-work-title><code>title</code></dfn><dd>
- <p>Gives the name of the work.</p>
- <p>A single property with the name <code id=licensing-works:md-work-title><a href=#md-work-title>title</a></code> may be present
- within each <a href=#concept-item id=licensing-works:concept-item-2>item</a> with the type <code id=licensing-works:md-work-2><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
- <dt><dfn id=md-work-author><code>author</code></dfn><dd>
- <p>Gives the name or contact information of one of the authors or creators of the work.</p>
- <p>The <a href=#concept-property-value id=licensing-works:concept-property-value-2>value</a> must be either an <a href=#concept-item id=licensing-works:concept-item-3>item</a> with the type <code id=licensing-works:md-vcard><a href=#md-vcard>http://microformats.org/profile/hcard</a></code>, or text.</p>
- <p>Any number of properties with the name <code id=licensing-works:md-work-author><a href=#md-work-author>author</a></code> may be
- present within each <a href=#concept-item id=licensing-works:concept-item-4>item</a> with the type <code id=licensing-works:md-work-3><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
- <dt><dfn id=md-work-license><code>license</code></dfn><dd>
- <p>Identifies one of the licenses under which the work is available.</p>
- <p>The <a href=#concept-property-value id=licensing-works:concept-property-value-3>value</a> must be an <a href=#absolute-url id=licensing-works:absolute-url-2>absolute
- URL</a>.</p>
- <p>Any number of properties with the name <code id=licensing-works:md-work-license><a href=#md-work-license>license</a></code> may be
- present within each <a href=#concept-item id=licensing-works:concept-item-5>item</a> with the type <code id=licensing-works:md-work-4><a href=#md-work>http://n.whatwg.org/work</a></code>.</p>
- </dl>
- <h5 id=examples-4>5.4.3.1 Examples</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>This example shows an embedded image entitled <cite>My Pond</cite>, licensed under the
- Creative Commons Attribution-Share Alike 3.0 United States License and the MIT license
- simultaneously.</p>
- <pre><figure <strong>itemscope itemtype="http://n.whatwg.org/work"</strong>>
- <img <strong>itemprop="work"</strong> src="mypond.jpeg">
- <figcaption>
- <p><cite <strong>itemprop="title"</strong>>My Pond</cite></p>
- <p><small>Licensed under the <a <strong>itemprop="license"</strong>
- href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative
- Commons Attribution-Share Alike 3.0 United States License</a>
- and the <a <strong>itemprop="license"</strong>
- href="http://www.opensource.org/licenses/mit-license.php">MIT
- license</a>.</small>
- </figcaption>
- </figure></pre>
- </div>
-
- <h3 id=converting-html-to-other-formats>5.5 Converting HTML to other formats</h3>
- <h4 id=json>5.5.1 JSON</h4>
- <p>Given a list of nodes <var>nodes</var> in a <code id=json:document><a href=#document>Document</a></code>, a user agent must
- run the following algorithm to <dfn id=extracting-json>extract the microdata from those nodes
- into a JSON form</dfn>:</p>
- <ol><li><p>Let <var>result</var> be an empty object.<li><p>Let <var>items</var> be an empty array.<li><p>For each <var>node</var> in <var>nodes</var>, check if the element is a
- <a href=#top-level-microdata-items id=json:top-level-microdata-items>top-level microdata item</a>, and if it is then
- <a href=#get-the-object id=json:get-the-object>get the object</a> for that element and add it to <var>items</var>.<li><p>Add an entry to <var>result</var> called "<code>items</code>" whose
- value is the array <var>items</var>.<li><p>Return the result of serialising <var>result</var> to JSON in the shortest
- possible way (meaning no whitespace between tokens, no unnecessary zero digits in numbers, and
- only using Unicode escapes in strings for characters that do not have a dedicated escape
- sequence), and with a lowercase "<code>e</code>" used, when appropriate, in the
- representation of any numbers. <a href=#refsJSON>[JSON]</a></ol>
- <p class=note>This algorithm returns an object with a single property that is an array, instead
- of just returning an array, so that it is possible to extend the algorithm in the future if
- necessary.</p>
- <p>When the user agent is to <dfn id=get-the-object>get the object</dfn> for an item <var>item</var>,
- optionally with a list of elements <var>memory</var>, it must run the following
- substeps:</p>
- <ol><li><p>Let <var>result</var> be an empty object.<li><p>If no <var>memory</var> was passed to the algorithm, let <var>memory</var> be an empty list.<li><p>Add <var>item</var> to <var>memory</var>.<li><p>If the <var>item</var> has any <a href=#item-types id=json:item-types>item types</a>, add an entry to <var>result</var> called "<code>type</code>" whose value is an array listing the
- <a href=#item-types id=json:item-types-2>item types</a> of <var>item</var>, in the order they were specified on the
- <code id=json:attr-itemtype><a href=#attr-itemtype>itemtype</a></code> attribute.</p>
- <li><p>If the <var>item</var> has a <a href=#global-identifier id=json:global-identifier>global identifier</a>, add an entry to <var>result</var> called "<code>id</code>" whose value is the <a href=#global-identifier id=json:global-identifier-2>global
- identifier</a> of <var>item</var>.<li><p>Let <var>properties</var> be an empty object.<li>
- <p>For each element <var>element</var> that has one or more <a href=#property-names id=json:property-names>property names</a>
- and is one of <a href=#the-properties-of-an-item id=json:the-properties-of-an-item>the properties of the item</a> <var>item</var>, in the order those elements are given by the algorithm that returns
- <a href=#the-properties-of-an-item id=json:the-properties-of-an-item-2>the properties of an item</a>, run the following substeps:</p>
- <ol><li><p>Let <var>value</var> be the <a href=#concept-property-value id=json:concept-property-value>property
- value</a> of <var>element</var>.<li><p>If <var>value</var> is an <a href=#concept-item id=json:concept-item>item</a>, then: If <var>value</var> is in <var>memory</var>, then let <var>value</var> be
- the string "<code>ERROR</code>". Otherwise, <a href=#get-the-object id=json:get-the-object-2>get the object</a> for <var>value</var>, passing a copy of <var>memory</var>, and then replace <var>value</var> with the object returned from those steps.<li>
- <p>For each name <var>name</var> in <var>element</var>'s <a href=#property-names id=json:property-names-2>property
- names</a>, run the following substeps:</p>
- <ol><li><p>If there is no entry named <var>name</var> in <var>properties</var>,
- then add an entry named <var>name</var> to <var>properties</var> whose
- value is an empty array.<li><p>Append <var>value</var> to the entry named <var>name</var> in <var>properties</var>.</ol>
- </ol>
- <li><p>Add an entry to <var>result</var> called "<code>properties</code>" whose
- value is the object <var>properties</var>.<li><p>Return <var>result</var>.</ol>
- <div class=example>
- <p>For example, take this markup:</p>
- <pre><!DOCTYPE HTML>
- <title>My Blog</title>
- <article itemscope itemtype="http://schema.org/BlogPosting">
- <header>
- <h1 itemprop="headline">Progress report</h1>
- <p><time itemprop="datePublished" datetime="2013-08-29">today</time></p>
- <link itemprop="url" href="?comments=0">
- </header>
- <p>All in all, he's doing well with his swim lessons. The biggest thing was he had trouble
- putting his head in, but we got it down.</p>
- <section>
- <h1>Comments</h1>
- <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c1">
- <link itemprop="url" href="#c1">
- <footer>
- <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
- <span itemprop="name">Greg</span>
- </span></p>
- <p><time itemprop="commentTime" datetime="2013-08-29">15 minutes ago</time></p>
- </footer>
- <p>Ha!</p>
- </article>
- <article itemprop="comment" itemscope itemtype="http://schema.org/UserComments" id="c2">
- <link itemprop="url" href="#c2">
- <footer>
- <p>Posted by: <span itemprop="creator" itemscope itemtype="http://schema.org/Person">
- <span itemprop="name">Charlotte</span>
- </span></p>
- <p><time itemprop="commentTime" datetime="2013-08-29">5 minutes ago</time></p>
- </footer>
- <p>When you say "we got it down"...</p>
- </article>
- </section>
- </article></pre>
- <p>It would be turned into the following JSON by the algorithm above (supposing that the page's
- URL was <code>http://blog.example.com/progress-report</code>):</p>
- <pre>{
- "items": [
- {
- "type": [ "http://schema.org/BlogPosting" ],
- "properties": {
- "headline": [ "Progress report" ],
- "datePublished": [ "2013-08-29" ],
- "url": [ "http://blog.example.com/progress-report?comments=0" ],
- "comment": [
- {
- "type": [ "http://schema.org/UserComments" ],
- "properties": {
- "url": [ "http://blog.example.com/progress-report#c1" ],
- "creator": [
- {
- "type": [ "http://schema.org/Person" ],
- "properties": {
- "name": [ "Greg" ]
- }
- }
- ],
- "commentTime": [ "2013-08-29" ]
- }
- },
- {
- "type": [ "http://schema.org/UserComments" ],
- "properties": {
- "url": [ "http://blog.example.com/progress-report#c2" ],
- "creator": [
- {
- "type": [ "http://schema.org/Person" ],
- "properties": {
- "name": [ "Charlotte" ]
- }
- }
- ],
- "commentTime": [ "2013-08-29" ]
- }
- }
- ]
- }
- }
- ]
- }</pre>
- </div>
-
- <h2 id=editing>6 <dfn>User interaction</dfn></h2>
- <h3 id=the-hidden-attribute>6.1 The <dfn><code>hidden</code></dfn> attribute</h3>
- <p>All <a href=#html-elements id=the-hidden-attribute:html-elements>HTML elements</a> may have the <code id=the-hidden-attribute:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> content
- attribute set. The <code id=the-hidden-attribute:the-hidden-attribute-2><a href=#the-hidden-attribute>hidden</a></code> attribute is a <a href=#boolean-attribute id=the-hidden-attribute:boolean-attribute>boolean
- attribute</a>. When specified on an element, it indicates that the element is not yet, or is no
- longer, directly relevant to the page's current state, or that it is being used to declare content
- to be reused by other parts of the page as opposed to being directly accessed by the user. User agents should not render elements that have the <code id=the-hidden-attribute:the-hidden-attribute-3><a href=#the-hidden-attribute>hidden</a></code> attribute specified. This requirement may be implemented
- indirectly through the style layer. For example, an HTML+CSS user agent could implement these
- requirements <a href=#hiddenCSS>using the rules suggested in the Rendering
- section</a>.</p>
- <p class=note>Because this attribute is typically implemented using CSS, it's also possible to
- override it using CSS. For instance, a rule that applies 'display: block' to all elements will
- cancel the effects of the <code id=the-hidden-attribute:the-hidden-attribute-4><a href=#the-hidden-attribute>hidden</a></code> attribute. Authors therefore
- have to take care when writing their style sheets to make sure that the attribute is still styled
- as expected.</p>
- <div class=example>
- <p>In the following skeletal example, the attribute is used to hide the Web game's main screen
- until the user logs in:</p>
- <pre> <h1>The Example Game</h1>
- <section id="login">
- <h2>Login</h2>
- <form>
- ...
- <!-- calls login() once the user's credentials have been checked -->
- </form>
- <script>
- function login() {
- // switch screens
- document.getElementById('login').hidden = true;
- document.getElementById('game').hidden = false;
- }
- </script>
- </section>
- <section id="game" hidden>
- ...
- </section></pre>
- </div>
- <p>The <code id=the-hidden-attribute:the-hidden-attribute-5><a href=#the-hidden-attribute>hidden</a></code> attribute must not be used to hide content that
- could legitimately be shown in another presentation. For example, it is incorrect to use <code id=the-hidden-attribute:the-hidden-attribute-6><a href=#the-hidden-attribute>hidden</a></code> to hide panels in a tabbed dialog, because the tabbed interface
- is merely a kind of overflow presentation — one could equally well just show all the form
- controls in one big page with a scrollbar. It is similarly incorrect to use this attribute to hide
- content just from one presentation — if something is marked <code id=the-hidden-attribute:the-hidden-attribute-7><a href=#the-hidden-attribute>hidden</a></code>, it is hidden from all presentations, including, for instance,
- screen readers.</p>
-
-
- <p>Elements that are not themselves <code id=the-hidden-attribute:the-hidden-attribute-8><a href=#the-hidden-attribute>hidden</a></code> must not
- <a href=#hyperlink id=the-hidden-attribute:hyperlink>hyperlink</a> to elements that are <code id=the-hidden-attribute:the-hidden-attribute-9><a href=#the-hidden-attribute>hidden</a></code>. The <code>for</code> attributes of <code id=the-hidden-attribute:the-label-element><a href=#the-label-element>label</a></code> and <code id=the-hidden-attribute:the-output-element><a href=#the-output-element>output</a></code> elements that are not
- themselves <code id=the-hidden-attribute:the-hidden-attribute-10><a href=#the-hidden-attribute>hidden</a></code> must similarly not refer to elements that are
- <code id=the-hidden-attribute:the-hidden-attribute-11><a href=#the-hidden-attribute>hidden</a></code>. In both cases, such references would cause user
- confusion.</p>
- <p>Elements and scripts may, however, refer to elements that are <code id=the-hidden-attribute:the-hidden-attribute-12><a href=#the-hidden-attribute>hidden</a></code> in other contexts.</p>
- <div class=example>
- <p>For example, it would be incorrect to use the <code id=the-hidden-attribute:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
- attribute to link to a section marked with the <code id=the-hidden-attribute:the-hidden-attribute-13><a href=#the-hidden-attribute>hidden</a></code> attribute.
- If the content is not applicable or relevant, then there is no reason to link to it.</p>
- <p>It would be fine, however, to use the ARIA <code id=the-hidden-attribute:attr-aria-describedby><a data-x-internal=attr-aria-describedby href=http://www.w3.org/TR/wai-aria/states_and_properties#aria-describedby>aria-describedby</a></code> attribute to refer to descriptions that are
- themselves <code id=the-hidden-attribute:the-hidden-attribute-14><a href=#the-hidden-attribute>hidden</a></code>. While hiding the descriptions implies that
- they are not useful alone, they could be written in such a way that they are useful in the
- specific context of being referenced from the images that they describe.</p>
- <p>Similarly, a <code id=the-hidden-attribute:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element with the <code id=the-hidden-attribute:the-hidden-attribute-15><a href=#the-hidden-attribute>hidden</a></code>
- attribute could be used by a scripted graphics engine as an off-screen buffer, and a form control
- could refer to a hidden <code id=the-hidden-attribute:the-form-element><a href=#the-form-element>form</a></code> element using its <code id=the-hidden-attribute:attr-fae-form><a href=#attr-fae-form>form</a></code> attribute.</p>
- </div>
- <p>Elements in a section hidden by the <code id=the-hidden-attribute:the-hidden-attribute-16><a href=#the-hidden-attribute>hidden</a></code> attribute are still
- active, e.g. scripts and form controls in such sections still execute and submit respectively.
- Only their presentation to the user changes.</p>
-
- <p>The <dfn id=dom-hidden><code>hidden</code></dfn> IDL attribute must <a href=#reflect id=the-hidden-attribute:reflect>reflect</a>
- the content attribute of the same name.</p>
-
- <h3 id=inert-subtrees>6.2 Inert subtrees</h3>
- <p>A node (in particular elements and text nodes) can be marked as <dfn id=inert>inert</dfn>. When a node
- is <a href=#inert id=inert-subtrees:inert>inert</a>, then the user agent must act as if the node was absent for the purposes of
- targeting user interaction events, may ignore the node for the purposes of text search user
- interfaces (commonly known as "find in page"), and may prevent the user from selecting text in
- that node. User agents should allow the user to override the restrictions on search and text
- selection, however.</p>
- <p class=example>For example, consider a page that consists of just a single <a href=#inert id=inert-subtrees:inert-2>inert</a>
- paragraph positioned in the middle of a <code id=inert-subtrees:the-body-element><a href=#the-body-element>body</a></code>. If a user moves their pointing device
- from the <code id=inert-subtrees:the-body-element-2><a href=#the-body-element>body</a></code> over to the <a href=#inert id=inert-subtrees:inert-3>inert</a> paragraph and clicks on the paragraph,
- no <code id=inert-subtrees:event-mouseover><a href=#event-mouseover>mouseover</a></code> event would be fired, and the <code id=inert-subtrees:event-mousemove><a href=#event-mousemove>mousemove</a></code> and <code id=inert-subtrees:event-click><a href=#event-click>click</a></code> events would
- be fired on the <code id=inert-subtrees:the-body-element-3><a href=#the-body-element>body</a></code> element rather than the paragraph.</p>
- <p class=note>When a node is inert, it generally cannot be focused. Inert nodes that are <a href=#concept-command id=inert-subtrees:concept-command>commands</a> will also get disabled.</p>
- <p>While a <a href=#browsing-context-container id=inert-subtrees:browsing-context-container>browsing context container</a> is marked as <a href=#inert id=inert-subtrees:inert-4>inert</a>, its
- <a href=#nested-browsing-context id=inert-subtrees:nested-browsing-context>nested browsing context</a>'s <a href=#active-document id=inert-subtrees:active-document>active document</a>, and all nodes in that
- <code id=inert-subtrees:document><a href=#document>Document</a></code>, must be marked as <a href=#inert id=inert-subtrees:inert-5>inert</a>.</p>
- <p>An entire <code id=inert-subtrees:document-2><a href=#document>Document</a></code> can be marked as <dfn id=blocked-by-a-modal-dialog>blocked by a modal dialog</dfn> <var>subject</var>. While a <code id=inert-subtrees:document-3><a href=#document>Document</a></code> is so marked, every node that is <a href=#in-a-document id=inert-subtrees:in-a-document>in the <code>Document</code></a>, with the exception of the <var>subject</var> element and its descendants, must be marked <a href=#inert id=inert-subtrees:inert-6>inert</a>. (The
- elements excepted by this paragraph can additionally be marked <a href=#inert id=inert-subtrees:inert-7>inert</a> through other
- means; being part of a modal dialog does not "protect" a node from being marked
- <a href=#inert id=inert-subtrees:inert-8>inert</a>.)</p>
- <p>Only one element at a time can mark a <code id=inert-subtrees:document-4><a href=#document>Document</a></code> as being <a href=#blocked-by-a-modal-dialog id=inert-subtrees:blocked-by-a-modal-dialog>blocked by a modal
- dialog</a>. When a new <code id=inert-subtrees:the-dialog-element><a href=#the-dialog-element>dialog</a></code> is made to <a href=#blocked-by-a-modal-dialog id=inert-subtrees:blocked-by-a-modal-dialog-2>block</a> a <code id=inert-subtrees:document-5><a href=#document>Document</a></code>, the previous element, if any, stops blocking the
- <code id=inert-subtrees:document-6><a href=#document>Document</a></code>.</p>
- <p class=note>The <code id=inert-subtrees:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element's <code id=inert-subtrees:dom-dialog-showmodal><a href=#dom-dialog-showmodal>showModal()</a></code> method makes use of this mechanism.</p>
- <h3 id=activation>6.3 Activation</h3>
- <p>Certain elements in HTML have an <a href=#activation-behavior id=activation:activation-behavior>activation behavior</a>, which means that the user
- can activate them. This triggers a sequence of events dependent on the activation mechanism, and
- normally culminating in a <code id=activation:event-click><a href=#event-click>click</a></code> event, as
- described below.</p>
-
- <p>The user agent should allow the user to manually trigger elements that have an <a href=#activation-behavior id=activation:activation-behavior-2>activation
- behavior</a>, for instance using keyboard or voice input, or through mouse clicks. When the
- user triggers an element with a defined <a href=#activation-behavior id=activation:activation-behavior-3>activation behavior</a> in a manner other than
- clicking it, the default action of the interaction event must be to <a href=#run-synthetic-click-activation-steps id=activation:run-synthetic-click-activation-steps>run synthetic click
- activation steps</a> on the element.</p>
- <p>Each element has a <var>click in progress</var> flag, initially set to false.</p>
- <p>When a user agent is to <dfn id=run-synthetic-click-activation-steps>run synthetic click activation steps</dfn> on an element, the user
- agent must run the following steps:</p>
- <ol><li><p>If the element's <var>click in progress</var> flag is set to true, then abort
- these steps.<li><p>Set the <var>click in progress</var> flag on the element to true.<li><p><a href=#run-pre-click-activation-steps id=activation:run-pre-click-activation-steps>Run pre-click activation steps</a> on the element.<li><p><a href=#fire-a-click-event id=activation:fire-a-click-event>Fire a <code>click</code> event</a> at the element. If the
- <a href=#run-synthetic-click-activation-steps id=activation:run-synthetic-click-activation-steps-2>run synthetic click activation steps</a> algorithm was invoked because the <code id=activation:dom-click><a href=#dom-click>click()</a></code> method was invoked, then the <code id=activation:dom-event-istrusted><a href=#dom-event-istrusted>isTrusted</a></code> attribute must be initialised to false.<li>
- <p>If this <code id=activation:event-click-2><a href=#event-click>click</a></code> event is not canceled, <a href=#run-post-click-activation-steps id=activation:run-post-click-activation-steps>run post-click
- activation steps</a> on the element.</p>
- <p>If the event <em>is</em> canceled, the user agent must <a href=#run-canceled-activation-steps id=activation:run-canceled-activation-steps>run canceled activation
- steps</a> on the element instead.</p>
- <li><p>Set the <var>click in progress</var> flag on the element to false.</ol>
- <p>When a pointing device is clicked, the user agent must <a href=#run-authentic-click-activation-steps id=activation:run-authentic-click-activation-steps>run authentic click activation
- steps</a> instead of firing the click event. When a user
- agent is to <dfn id=run-authentic-click-activation-steps>run authentic click activation steps</dfn> for a given event <var>event</var>, it must follow these steps:</p>
- <ol><li><p>Let <var>target</var> be the element designated by the user (the target of <var>event</var>).<li><p>If <var>target</var> is a <code id=activation:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element, run the <a href=#canvas-mouseevent-rerouting-steps id=activation:canvas-mouseevent-rerouting-steps>canvas
- <code>MouseEvent</code> rerouting steps</a>. If this changes <var>event</var>'s
- target, then let <var>target</var> be the new target.<li><p>Set the <var>click in progress</var> flag on <var>target</var> to
- true.<li><p>Let <var>e</var> be the <a href=#nearest-activatable-element id=activation:nearest-activatable-element>nearest activatable element</a> of <var>target</var> (defined below), if any.<li><p>If there is an element <var>e</var>, <a href=#run-pre-click-activation-steps id=activation:run-pre-click-activation-steps-2>run pre-click activation steps</a>
- on it.<li>
- <p><a href=#concept-event-dispatch id=activation:concept-event-dispatch>Dispatch</a> <var>event</var> (the
- required <code id=activation:event-click-3><a href=#event-click>click</a></code> event) at <var>target</var>.</p>
- <p>If there is an element <var>e</var> and the <code id=activation:event-click-4><a href=#event-click>click</a></code>
- event is not canceled, <a href=#run-post-click-activation-steps id=activation:run-post-click-activation-steps-2>run post-click activation steps</a> on element <var>e</var>.</p>
- <p>If there is an element <var>e</var> and the event <em>is</em> canceled, <a href=#run-canceled-activation-steps id=activation:run-canceled-activation-steps-2>run
- canceled activation steps</a> on element <var>e</var>.</p>
- <li><p>Set the <var>click in progress</var> flag on <var>target</var> to
- false.</ol>
- <p class=note>The algorithms above don't run for arbitrary synthetic events dispatched by author
- script. The <code id=activation:dom-click-2><a href=#dom-click>click()</a></code> method can be used to make the <a href=#run-synthetic-click-activation-steps id=activation:run-synthetic-click-activation-steps-3>run
- synthetic click activation steps</a> algorithm happen programmatically.</p>
- <p class=note>Click-focusing behavior (e.g. the focusing of a text field when user clicks in
- one) typically happens before the click, when the mouse button is first depressed, and is
- therefore not discussed here.</p>
- <p>Given an element <var>target</var>, the <dfn id=nearest-activatable-element>nearest activatable element</dfn> is the
- element returned by the following algorithm:</p>
- <ol><li><p>If <var>target</var> has a defined <a href=#activation-behavior id=activation:activation-behavior-4>activation behavior</a>, then return
- <var>target</var> and abort these steps.<li><p>If <var>target</var> has a parent element, then set <var>target</var> to
- that parent element and return to the first step.<li><p>Otherwise, there is no <a href=#nearest-activatable-element id=activation:nearest-activatable-element-2>nearest activatable element</a>.</ol>
- <p>When a user agent is to <dfn id=run-pre-click-activation-steps>run pre-click activation steps</dfn> on an element, it must run
- the <dfn id=pre-click-activation-steps>pre-click activation steps</dfn> defined for that element, if any.</p>
- <p>When a user agent is to <dfn id=run-canceled-activation-steps>run canceled activation steps</dfn> on an element, it must run the
- <dfn id=canceled-activation-steps>canceled activation steps</dfn> defined for that element, if any.</p>
- <p>When a user agent is to <dfn id=run-post-click-activation-steps>run post-click activation steps</dfn> on an element, it must run
- the <dfn id=activation-behavior>activation behavior</dfn> defined for that element, if any. Activation behaviors can
- refer to the <code id=activation:event-click-5><a href=#event-click>click</a></code> event that was fired by the steps above
- leading up to this point.</p>
-
-
- <dl class=domintro><dt><var>element</var> . <code id=activation:dom-click-3><a href=#dom-click>click</a></code>()<dd>
- <p>Acts as if the element was clicked.</p>
- </dl>
-
- <p>The <dfn id=dom-click><code>click()</code></dfn> method must run the following steps:</p>
- <ol><li><p>If the element is a form control that is <a href=#concept-fe-disabled id=activation:concept-fe-disabled>disabled</a>, abort these steps.<li><p><a href=#run-synthetic-click-activation-steps id=activation:run-synthetic-click-activation-steps-4>Run synthetic click activation steps</a> on the element.</ol>
-
- <h3 id=focus>6.4 Focus</h3>
-
-
-
-
-
- <h4 id=introduction-8>6.4.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>An HTML user interface typically consists of multiple interactive widgets, such as form
- controls, scrollable regions, links, dialog boxes, browser tabs, and so forth. These widgets form
- a hierarchy, with some (e.g. browser tabs, dialog boxes) containing others (e.g. links, form
- controls).</p>
- <p>When interacting with an interface using a keyboard, key input is channeled from the system,
- through the hierarchy of interactive widgets, to an active widget, which is said to be
- <a href=#focused id=introduction-8:focused>focused</a>.</p>
- <div class=example>
- <p>Consider an HTML application running in a browser tab running in a graphical environment.
- Suppose this application had a page with some text fields and links, and was currently showing a
- modal dialog, which itself had a text field and a button.</p>
- <p>The hierarchy of focusable widgets, in this scenario, would include the browser window, which
- would have, amongst its children, the browser tab containing the HTML application. The tab itself
- would have as its children the various links and text fields, as well as the dialog. The dialog
- itself would have as its children the text field and the button.</p>
- <p><img src=http://images.whatwg.org/focus-tree.png alt="">
- <p>If the widget with <span>focus</span> in this example was the text field in the dialog box, then key
- input would be channeled from the graphical system to ① the Web browser, then to ②
- the tab, then to ③ the dialog, and finally to ④ the text field.</p>
- </div>
- <p>Keyboard <em>events</em> are always targetted at this <a href=#focused id=introduction-8:focused-2>focused</a> element.</p>
- <h4 id=data-model>6.4.2 Data model</h4>
- <p>The term <dfn id=focusable-area>focusable area</dfn> is used to refer to regions of the interface that can become
- the target of keyboard input. Focusable areas can be elements, parts of elements, or other regions
- managed by the user agent.</p>
- <p>Each <a href=#focusable-area id=data-model:focusable-area>focusable area</a> has a <dfn id=dom-anchor>DOM anchor</dfn>, which is a <code id=data-model:node><a href=#node>Node</a></code> object
- that represents the position of the <a href=#focusable-area id=data-model:focusable-area-2>focusable area</a> in the DOM. (When the <a href=#focusable-area id=data-model:focusable-area-3>focusable
- area</a> is itself a <code id=data-model:node-2><a href=#node>Node</a></code>, it is its own <a href=#dom-anchor id=data-model:dom-anchor>DOM anchor</a>.) The <a href=#dom-anchor id=data-model:dom-anchor-2>DOM anchor</a> is
- used in some APIs as a substitute for the <a href=#focusable-area id=data-model:focusable-area-4>focusable area</a> when there is no other DOM object
- to represent the <a href=#focusable-area id=data-model:focusable-area-5>focusable area</a>.</p>
- <p>The following table describes what objects can be <a href=#focusable-area id=data-model:focusable-area-6>focusable
- areas</a>. The cells in the left column describe objects that can be <a href=#focusable-area id=data-model:focusable-area-7>focusable areas</a>; the cells in the right column describe the <a href=#dom-anchor id=data-model:dom-anchor-3>DOM
- anchors</a> for those elements. (The cells that span both columns are non-normative examples.)</p>
- <table id=table-fa><thead><tr><th id=th-fa-area><a href=#focusable-area id=data-model:focusable-area-8>Focusable area</a>
- <th id=th-fa-dom-rep><a href=#dom-anchor id=data-model:dom-anchor-4>DOM anchor</a>
- <tr><th colspan=2 id=th-fa-examples>Examples
- <tbody><tr><th headers=th-fa-area id=td-fa-1 class=data-header>
- Elements that have their <a href=#specially-focusable id=data-model:specially-focusable>tabindex focus flag</a> set, that are not <a href=#concept-element-disabled id=data-model:concept-element-disabled>actually disabled</a>, that are not <a href=#expressly-inert-control id=data-model:expressly-inert-control>expressly inert</a>, and that are either <a href=#being-rendered id=data-model:being-rendered>being
- rendered</a> or <a href=#being-used-as-relevant-canvas-fallback-content id=data-model:being-used-as-relevant-canvas-fallback-content>being used as relevant canvas fallback content</a>.
- <td headers="td-fa-1 th-fa-dom-rep">
- The element itself.
- <tr><td colspan=2 headers="td-fa-1 th-fa-examples">
- <p class=example><code id=data-model:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, <code id="data-model:text-(type=text)-state-and-search-state-(type=search)"><a href="#text-(type=text)-state-and-search-state-(type=search)"><input
- type=text></a></code>, sometimes <code id=data-model:the-a-element><a href=#the-a-element><a href=""></a></code> (depending on platform
- conventions).
- <tbody><tr><th headers=th-fa-area id=td-fa-2 class=data-header>
- The shapes of <code id=data-model:the-area-element><a href=#the-area-element>area</a></code> elements in an <a href=#image-map id=data-model:image-map>image map</a> associated with an
- <code id=data-model:the-img-element><a href=#the-img-element>img</a></code> element that is <a href=#being-rendered id=data-model:being-rendered-2>being rendered</a> and is not <a href=#expressly-inert-control id=data-model:expressly-inert-control-2>expressly inert</a>.
- <td headers="td-fa-2 th-fa-dom-rep">
- The <code id=data-model:the-img-element-2><a href=#the-img-element>img</a></code> element.
- <tr><td colspan=2 headers="td-fa-2 th-fa-examples">
- <div class=example>
- <p>In the following example, the <code id=data-model:the-area-element-2><a href=#the-area-element>area</a></code> element creates two shapes, one on each
- image. The <a href=#dom-anchor id=data-model:dom-anchor-5>DOM anchor</a> of the first shape is the first <code id=data-model:the-img-element-3><a href=#the-img-element>img</a></code> element, and the
- <a href=#dom-anchor id=data-model:dom-anchor-6>DOM anchor</a> of the second shape is the second <code id=data-model:the-img-element-4><a href=#the-img-element>img</a></code> element.</p>
- <pre><map id=wallmap><area alt="Enter Door" coords="10,10,100,200" href="door.html"></map>
- ...
- <img src="images/innerwall.jpeg" alt="There is a white wall here, with a door." usemap="#wallmap">
- ...
- <img src="images/outerwall.jpeg" alt="There is a red wall here, with a door." usemap="#wallmap"></pre>
- </div>
- <tbody><tr><th headers=th-fa-area id=td-fa-3 class=data-header>
- The user-agent provided subwidgets of elements that are <a href=#being-rendered id=data-model:being-rendered-3>being rendered</a> and are not
- <a href=#concept-element-disabled id=data-model:concept-element-disabled-2>actually disabled</a> or <a href=#expressly-inert-control id=data-model:expressly-inert-control-3>expressly inert</a>.
- <td headers="td-fa-3 th-fa-dom-rep">
- The element for which the <a href=#focusable-area id=data-model:focusable-area-9>focusable area</a> is a subwidget.
- <tr><td colspan=2 headers="td-fa-3 th-fa-examples">
- <p class=example>The <a href=#expose-a-user-interface-to-the-user id=data-model:expose-a-user-interface-to-the-user>controls in the user
- interface that is exposed to the user</a> for a <code id=data-model:the-video-element><a href=#the-video-element>video</a></code> element, the up and down
- buttons in a spin-control version of <code id="data-model:number-state-(type=number)"><a href="#number-state-(type=number)"><input
- type=number></a></code>, the two range control widgets in a <code id="data-model:range-state-(type=range)"><a href="#range-state-(type=range)"><input type=range multiple></a></code>, the part of a
- <code id=data-model:the-details-element><a href=#the-details-element>details</a></code> element's rendering that enabled the element to be opened or closed using
- keyboard input.</p>
- <tbody><tr><th headers=th-fa-area id=td-fa-4 class=data-header>
- The scrollable regions of elements that are <a href=#being-rendered id=data-model:being-rendered-4>being rendered</a> are not <a href=#expressly-inert-control id=data-model:expressly-inert-control-4>expressly inert</a>.
- <td headers="td-fa-4 th-fa-dom-rep">
- The element for which the box that the scrollable region scrolls was created.
- <tr><td colspan=2 headers="td-fa-4 th-fa-examples">
- <p class=example>The CSS 'overflow' property's 'scroll' value typically creates a scrollable
- region.</p>
- <tbody><tr><th headers=th-fa-area id=td-fa-5 class=data-header>
- The viewport of a <code id=data-model:document><a href=#document>Document</a></code> that is in a <a href=#browsing-context id=data-model:browsing-context>browsing context</a> and is not
- <a href=#inert id=data-model:inert>inert</a>.
- <td headers="td-fa-5 th-fa-dom-rep">
- The <code id=data-model:document-2><a href=#document>Document</a></code> for which the viewport was created.
- <tr><td colspan=2 headers="td-fa-5 th-fa-examples">
- <p class=example>The contents of an <code id=data-model:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>.</p>
- <tbody><tr><th headers=th-fa-area id=td-fa-6 class=data-header>
- Any other element or part of an element, especially to aid with accessibility or to better
- match platform conventions.
- <td headers="td-fa-6 th-fa-dom-rep">
- The element.
- <tr><td colspan=2 headers="td-fa-6 th-fa-examples">
- <p class=example>A user agent could make all list item bullets focusable, so that a user can
- more easily navigate lists.</p>
- <p class=example>Similarly, a user agent could make all elements with <code id=data-model:attr-title><a href=#attr-title>title</a></code> attributes focusable, so that their advisory information can
- be accessed.</p>
- </table>
- <p id=bc-focus-ergo-bcc-focus class=note>A <a href=#browsing-context-container id=data-model:browsing-context-container>browsing context container</a> (e.g. an
- <code id=data-model:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>) is a <a href=#focusable-area id=data-model:focusable-area-10>focusable area</a>, but key events routed to a <a href=#browsing-context-container id=data-model:browsing-context-container-2>browsing context
- container</a> get immediately routed to the <a href=#nested-browsing-context id=data-model:nested-browsing-context>nested browsing context</a>'s <a href=#active-document id=data-model:active-document>active
- document</a>. Similarly, in sequential focus navigation a <a href=#browsing-context-container id=data-model:browsing-context-container-3>browsing context
- container</a> essentially acts merely as a placeholder for its <a href=#nested-browsing-context id=data-model:nested-browsing-context-2>nested browsing
- context</a>'s <a href=#active-document id=data-model:active-document-2>active document</a>.</p>
- <p>Each <a href=#focusable-area id=data-model:focusable-area-11>focusable area</a> belongs to a <dfn id=control-group>control group</dfn>. Each <a href=#control-group id=data-model:control-group>control group</a> has
- an <dfn id=control-group-owner>owner</dfn>. <a href=#control-group-owner id=data-model:control-group-owner>Control group
- owners</a> are <dfn id=control-group-owner-object>control group owner objects</dfn>. The
- following are <a href=#control-group-owner-object id=data-model:control-group-owner-object>control group owner objects</a>:</p>
- <ul class=brief><li><code id=data-model:document-3><a href=#document>Document</a></code> object in <a href=#browsing-context id=data-model:browsing-context-2>browsing contexts</a>.<li><code id=data-model:the-dialog-element><a href=#the-dialog-element>dialog</a></code> elements that have an <code id=data-model:attr-dialog-open><a href=#attr-dialog-open>open</a></code>
- attribute specified and that are <a href=#being-rendered id=data-model:being-rendered-5>being rendered</a>.</ul>
- <p>Each <a href=#control-group-owner-object id=data-model:control-group-owner-object-2>control group owner object</a> owns one <a href=#control-group id=data-model:control-group-2>control group</a> (though that
- group might be empty).</p>
- <p>If the <a href=#dom-anchor id=data-model:dom-anchor-7>DOM anchor</a> of a <a href=#focusable-area id=data-model:focusable-area-12>focusable area</a> is a <a href=#control-group-owner-object id=data-model:control-group-owner-object-3>control group owner
- object</a>, then that <a href=#focusable-area id=data-model:focusable-area-13>focusable area</a> belongs to that <a href=#control-group-owner-object id=data-model:control-group-owner-object-4>control group owner
- object</a>'s <a href=#control-group id=data-model:control-group-3>control group</a>. Otherwise, the <a href=#focusable-area id=data-model:focusable-area-14>focusable area</a> belongs to its
- <a href=#dom-anchor id=data-model:dom-anchor-8>DOM anchor</a>'s nearest ancestor <a href=#control-group-owner-object id=data-model:control-group-owner-object-5>control group owner object</a>.</p>
- <div class=example>
- <p>Thus, a viewport always belongs to the <a href=#control-group id=data-model:control-group-4>control group</a> of the <code id=data-model:document-4><a href=#document>Document</a></code>
- for which the viewport was created, an <code id=data-model:the-input-element><a href=#the-input-element>input</a></code> control belongs to the <a href=#control-group id=data-model:control-group-5>control
- group</a> of its nearest ancestor <code id=data-model:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> or <code id=data-model:document-5><a href=#document>Document</a></code>, and an image
- map's shapes belong to the nearest ancestor <code id=data-model:the-dialog-element-3><a href=#the-dialog-element>dialog</a></code> or <code id=data-model:document-6><a href=#document>Document</a></code> of the
- <code id=data-model:the-img-element-5><a href=#the-img-element>img</a></code> elements (not the <code id=data-model:the-area-element-3><a href=#the-area-element>area</a></code> elements — this means one
- <code id=data-model:the-area-element-4><a href=#the-area-element>area</a></code> element might create multiple shapes in different <a href=#control-group id=data-model:control-group-6>control groups</a>).</p>
- </div>
- <p>An element is <dfn id=expressly-inert-control>expressly inert</dfn> if it is
- <a href=#inert id=data-model:inert-2>inert</a> but it is not a <a href=#control-group-owner-object id=data-model:control-group-owner-object-6>control group owner object</a> and its nearest
- ancestor <a href=#control-group-owner-object id=data-model:control-group-owner-object-7>control group owner object</a> is not <a href=#inert id=data-model:inert-3>inert</a>.</p>
- <p>One <a href=#focusable-area id=data-model:focusable-area-15>focusable area</a> in each non-empty <a href=#control-group id=data-model:control-group-7>control group</a> is designated the
- <dfn id=focused-area-of-the-control-group>focused area of the control group</dfn>. Which control is so designated changes over time,
- based on algorithms in this specification. If a <a href=#control-group id=data-model:control-group-8>control group</a> is empty, it has no <a href=#focused-area-of-the-control-group id=data-model:focused-area-of-the-control-group>focused area</a>.</p>
- <p>Each <a href=#control-group-owner-object id=data-model:control-group-owner-object-8>control group owner object</a> can also act as the <dfn id=dialog-group-manager>manager</dfn> of a <dfn id=dialog-group>dialog group</dfn>.</p>
- <p>Each <code id=data-model:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> element that has an <code id=data-model:attr-dialog-open-2><a href=#attr-dialog-open>open</a></code>
- attribute specified and that is <a href=#being-rendered id=data-model:being-rendered-6>being rendered</a> (i.e. that is a <a href=#control-group-owner-object id=data-model:control-group-owner-object-9>control group
- owner object</a>) and is not <a href=#expressly-inert-dialog id=data-model:expressly-inert-dialog>expressly inert</a>
- belongs to the <a href=#dialog-group id=data-model:dialog-group>dialog group</a> whose <a href=#dialog-group-manager id=data-model:dialog-group-manager>manager</a> is
- the <code id=data-model:the-dialog-element-5><a href=#the-dialog-element>dialog</a></code> element's nearest ancestor <a href=#control-group-owner-object id=data-model:control-group-owner-object-10>control group owner object</a>.</p>
- <p>A <code id=data-model:the-dialog-element-6><a href=#the-dialog-element>dialog</a></code> is <dfn id=expressly-inert-dialog>expressly inert</dfn> if it is
- <a href=#inert id=data-model:inert-4>inert</a> but its nearest ancestor <a href=#control-group-owner-object id=data-model:control-group-owner-object-11>control group owner object</a> is not.</p>
- <p>If no <code id=data-model:the-dialog-element-7><a href=#the-dialog-element>dialog</a></code> element has a particular <a href=#control-group-owner-object id=data-model:control-group-owner-object-12>control group owner object</a> as
- its nearest ancestor <a href=#control-group-owner-object id=data-model:control-group-owner-object-13>control group owner object</a>, then that <a href=#control-group-owner-object id=data-model:control-group-owner-object-14>control group owner
- object</a> has no <a href=#dialog-group id=data-model:dialog-group-2>dialog group</a>.</p>
- <p>Each <a href=#dialog-group id=data-model:dialog-group-3>dialog group</a> can have a <code id=data-model:the-dialog-element-8><a href=#the-dialog-element>dialog</a></code> designated as the <dfn id=focused-dialog-of-the-dialog-group>focused
- dialog of the dialog group</dfn>. Which <code id=data-model:the-dialog-element-9><a href=#the-dialog-element>dialog</a></code> is so designated changes over time,
- based on algorithms in this specification.</p>
- <hr>
- <p><a href=#focusable-area id=data-model:focusable-area-16>Focusable areas</a> in <a href=#control-group id=data-model:control-group-9>control groups</a>
- are ordered relative to the <a href=#tree-order id=data-model:tree-order>tree order</a> of their <a href=#dom-anchor id=data-model:dom-anchor-9>DOM
- anchors</a>. <a href=#focusable-area id=data-model:focusable-area-17>Focusable areas</a> with the same <a href=#dom-anchor id=data-model:dom-anchor-10>DOM anchor</a> in a
- <a href=#control-group id=data-model:control-group-10>control group</a> are ordered relative to their CSS box's relative positions in a pre-order,
- depth-first traversal of the box tree. <a href=#refsCSS>[CSS]</a></p>
- <p>Elements in <a href=#dialog-group id=data-model:dialog-group-4>dialog groups</a> are ordered in <a href=#tree-order id=data-model:tree-order-2>tree
- order</a>.</p>
- <hr>
- <p>The <dfn id=currently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level browsing context</dfn> at any particular time is
- the <a href=#focusable-area id=data-model:focusable-area-18>focusable area</a> or <code id=data-model:the-dialog-element-10><a href=#the-dialog-element>dialog</a></code> returned by this algorithm:</p>
- <ol><li><p>Let <var>candidate</var> be the <code id=data-model:document-7><a href=#document>Document</a></code> of the <a href=#top-level-browsing-context id=data-model:top-level-browsing-context>top-level
- browsing context</a>.<li>
- <p>If <var>candidate</var> has a <a href=#dialog-group id=data-model:dialog-group-5>dialog group</a> with a designated
- <a href=#focused-dialog-of-the-dialog-group id=data-model:focused-dialog-of-the-dialog-group>focused dialog of the dialog group</a>, then let <var>candidate</var> be the
- designated <a href=#focused-dialog-of-the-dialog-group id=data-model:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group</a>, and redo this step.</p>
- <p>Otherwise, if <var>candidate</var> has a non-empty <a href=#control-group id=data-model:control-group-11>control group</a>, and the
- designated <a href=#focused-area-of-the-control-group id=data-model:focused-area-of-the-control-group-2>focused area of the control group</a> is a <a href=#browsing-context-container id=data-model:browsing-context-container-4>browsing context
- container</a>, then let <var>candidate</var> be the <a href=#active-document id=data-model:active-document-3>active document</a> of
- that <a href=#browsing-context-container id=data-model:browsing-context-container-5>browsing context container</a>'s <a href=#nested-browsing-context id=data-model:nested-browsing-context-3>nested browsing context</a>, and redo
- this step.</p>
- <p>Otherwise, if <var>candidate</var> has a non-empty <a href=#control-group id=data-model:control-group-12>control group</a>, let
- <var>candidate</var> be the designated <a href=#focused-area-of-the-control-group id=data-model:focused-area-of-the-control-group-3>focused area of the control
- group</a>.</p>
- <li><p>Return <var>candidate</var>.</ol>
- <p>An element that is the <a href=#dom-anchor id=data-model:dom-anchor-11>DOM anchor</a> of a <a href=#focusable-area id=data-model:focusable-area-19>focusable area</a> is said to <dfn id=gains-focus>gain focus</dfn> when that <a href=#focusable-area id=data-model:focusable-area-20>focusable area</a> becomes the <a href=#currently-focused-area-of-a-top-level-browsing-context id=data-model:currently-focused-area-of-a-top-level-browsing-context>currently
- focused area of a top-level browsing context</a>. When an element is the <a href=#dom-anchor id=data-model:dom-anchor-12>DOM anchor</a> of a
- <a href=#focusable-area id=data-model:focusable-area-21>focusable area</a> of the <a href=#currently-focused-area-of-a-top-level-browsing-context id=data-model:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of a top-level browsing context</a>,
- it is <dfn id=focused>focused</dfn>.</p>
-
- <p>The <dfn id=focus-chain>focus chain</dfn> of a <a href=#focusable-area id=data-model:focusable-area-22>focusable area</a> or <a href=#control-group-owner-object id=data-model:control-group-owner-object-15>control group owner
- object</a> <var>subject</var> is the ordered list constructed as follows:</p>
- <ol><li><p>Let <var>current object</var> be <var>subject</var>.<li><p>Let <var>output</var> be an empty list.<li><p><i>Loop</i>: Append <var>current object</var> to <var>output</var>.<li>
- <p>If <var>current object</var> is an <code id=data-model:the-area-element-5><a href=#the-area-element>area</a></code> element's shape, append
- that <code id=data-model:the-area-element-6><a href=#the-area-element>area</a></code> element to <var>output</var>.</p>
- <p>Otherwise, if <var>current object</var> is a <a href=#focusable-area id=data-model:focusable-area-23>focusable area</a> whose <a href=#dom-anchor id=data-model:dom-anchor-13>DOM
- anchor</a> is an element that is not <var>current object</var> itself, append that
- <a href=#dom-anchor id=data-model:dom-anchor-14>DOM anchor</a> element to <var>output</var>.</p>
- <li>
- <p>If <var>current object</var> is a <code id=data-model:the-dialog-element-11><a href=#the-dialog-element>dialog</a></code> object in a <a href=#dialog-group id=data-model:dialog-group-6>dialog group</a>,
- let <var>current object</var> be that <a href=#dialog-group id=data-model:dialog-group-7>dialog group</a>'s <a href=#dialog-group-manager id=data-model:dialog-group-manager-2>manager</a>, and return to the step labeled <i>loop</i>.</p>
- <p>Otherwise, if <var>current object</var> is a <a href=#focusable-area id=data-model:focusable-area-24>focusable area</a>, let <var>current
- object</var> be that <a href=#focusable-area id=data-model:focusable-area-25>focusable area</a>'s <a href=#control-group id=data-model:control-group-13>control group</a>'s <a href=#control-group-owner id=data-model:control-group-owner-2>owner</a>, and return to the step labeled <i>loop</i>.</p>
- <p>Otherwise, if <var>current object</var> is a <code id=data-model:document-8><a href=#document>Document</a></code> in a <a href=#nested-browsing-context id=data-model:nested-browsing-context-4>nested browsing
- context</a>, let <var>current object</var> be its <a href=#browsing-context-container id=data-model:browsing-context-container-6>browsing context container</a>,
- and return to the step labeled <i>loop</i>.</p>
- <li>
- <p>Return <var>output</var>.</p>
- <p class=note>The chain starts with <var>subject</var> and (if <var>subject</var> is or can be the <a href=#currently-focused-area-of-a-top-level-browsing-context id=data-model:currently-focused-area-of-a-top-level-browsing-context-3>currently focused area of a top-level browsing
- context</a>) continues up the focus hierarchy up to the <code id=data-model:document-9><a href=#document>Document</a></code> of the
- <a href=#top-level-browsing-context id=data-model:top-level-browsing-context-2>top-level browsing context</a>.</p>
- </ol>
-
- <h4 id=the-tabindex-attribute>6.4.3 The <code id=the-tabindex-attribute:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute</h4>
- <p>The <dfn id=attr-tabindex><code>tabindex</code></dfn> content attribute allows authors to
- indicate that an element is supposed to be <a href=#focusable-area id=the-tabindex-attribute:focusable-area>focusable</a>, and
- whether it is supposed to be reachable using <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation>sequential focus navigation</a> and, if so,
- what is to be the relative order of the element for the purposes of sequential focus navigation.
- The name "tab index" comes from the common use of the "tab" key to navigate through the focusable
- elements. The term "tabbing" refers to moving forward through the focusable elements that can be
- reached using sequential focus navigation.</p>
- <p>When the attribute is omitted, the user agent applies defaults. (There is no way to make an
- element that is <a href=#being-rendered id=the-tabindex-attribute:being-rendered>being rendered</a> be not focusable at all without <a href=#concept-element-disabled id=the-tabindex-attribute:concept-element-disabled>disabling</a> it or making it <a href=#inert id=the-tabindex-attribute:inert>inert</a>.)</p>
- <p>The <code id=the-tabindex-attribute:attr-tabindex-2><a href=#attr-tabindex>tabindex</a></code> attribute, if specified, must have a value
- that is a <a href=#valid-integer id=the-tabindex-attribute:valid-integer>valid integer</a>. Positive numbers specify the relative position of the
- element's <a href=#focusable-area id=the-tabindex-attribute:focusable-area-2>focusable areas</a> in the <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order>sequential focus
- navigation order</a>, and negative numbers indicate that the control is to be unreachable by
- <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation-2>sequential focus navigation</a>.</p>
-
- <p>Each element can have a <dfn id=specially-focusable>tabindex focus flag</dfn> set, as defined
- below. This flag is a factor that contributes towards determining whether an element is a
- <a href=#focusable-area id=the-tabindex-attribute:focusable-area-3>focusable area</a>, as described in the previous section.</p>
- <p>If the <code id=the-tabindex-attribute:attr-tabindex-3><a href=#attr-tabindex>tabindex</a></code> attribute is specified on an element, it
- must be parsed using the <a href=#rules-for-parsing-integers id=the-tabindex-attribute:rules-for-parsing-integers>rules for parsing integers</a>. The attribute's values, or lack
- thereof, must be interpreted as follows:</p>
- <dl><dt>If the attribute is omitted or parsing the value returns an error<dd>
- <p>The user agent should follow platform conventions to determine if the element's
- <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable>tabindex focus flag</a> is set and, if so, whether the element and any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-4>focusable areas</a> that have the element as their <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor>DOM anchor</a> can
- be reached using <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation-3>sequential focus navigation</a>, and if so, what their relative
- position in the <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-2>sequential focus navigation order</a> is to be.</p>
- <p>Modulo platform conventions, it is suggested that for the following elements, the
- <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-2>tabindex focus flag</a> be set:</p>
- <ul><li><code id=the-tabindex-attribute:the-a-element><a href=#the-a-element>a</a></code> elements that have an <code id=the-tabindex-attribute:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>
- attribute<li><code id=the-tabindex-attribute:the-link-element><a href=#the-link-element>link</a></code> elements that have an <code id=the-tabindex-attribute:attr-link-href><a href=#attr-link-href>href</a></code> attribute<li><code id=the-tabindex-attribute:the-button-element><a href=#the-button-element>button</a></code> elements<li><code id=the-tabindex-attribute:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=the-tabindex-attribute:attr-input-type><a href=#attr-input-type>type</a></code> attribute are
- not in the <a href="#hidden-state-(type=hidden)" id="the-tabindex-attribute:hidden-state-(type=hidden)">Hidden</a> state<li><code id=the-tabindex-attribute:the-select-element><a href=#the-select-element>select</a></code> elements<li><code id=the-tabindex-attribute:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements<li><code id=the-tabindex-attribute:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> elements<li>Elements with a <code id=the-tabindex-attribute:the-draggable-attribute><a href=#the-draggable-attribute>draggable</a></code> attribute set, if that would
- enable the user agent to allow the user to begin a drag operations for those elements without
- the use of a pointing device<li><a href=#editing-host id=the-tabindex-attribute:editing-host>Editing hosts</a><li><a href=#browsing-context-container id=the-tabindex-attribute:browsing-context-container>Browsing context containers</a><li><a href=#sorting-interface-th-element id=the-tabindex-attribute:sorting-interface-th-element>Sorting interface <code>th</code>
- elements</a></ul>
- <p class=note>One valid reason to ignore the platform conventions and always allow an element
- to be focused (by setting its <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-3>tabindex focus flag</a>) would be if the user's only
- mechanism for activating an element is through a keyboard action that triggers the focused
- element.</p>
- <dt id=negative-tabindex>If the value is a negative integer<dd>
- <p>The user agent must set the element's <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-4>tabindex focus flag</a>, but should omit the
- element from the <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-3>sequential focus navigation order</a>.</p>
- <p class=note>One valid reason to ignore the requirement that sequential focus navigation not
- allow the author to lead to the element would be if the user's only mechanism for moving the
- focus is sequential focus navigation. For instance, a keyboard-only user would be unable to
- click on a text field with a negative <code id=the-tabindex-attribute:attr-tabindex-4><a href=#attr-tabindex>tabindex</a></code>, so that
- user's user agent would be well justified in allowing the user to tab to the control
- regardless.</p>
- <dt>If the value is a zero<dd>
- <p>The user agent must set the element's <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-5>tabindex focus flag</a>, should allow the
- element and any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-5>focusable areas</a> that have the element as their
- <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-2>DOM anchor</a> to be reached using <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation-4>sequential focus navigation</a>, following
- platform conventions to determine the element's relative position in the <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-4>sequential focus
- navigation order</a>.</p>
- <dt>If the value is greater than zero<dd>
- <p>The user agent must set the element's <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-6>tabindex focus flag</a>, should allow the
- element and any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-6>focusable areas</a> that have the element as their
- <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-3>DOM anchor</a> to be reached using sequential focus navigation, and should place the element
- — referenced as <var>candidate</var> below — and the aforementioned <a href=#focusable-area id=the-tabindex-attribute:focusable-area-7>focusable areas</a> in the <a href=#sequential-focus-navigation id=the-tabindex-attribute:sequential-focus-navigation-5>sequential focus navigation</a>
- order so that, relative to other <a href=#focusable-area id=the-tabindex-attribute:focusable-area-8>focusable areas</a> in the
- <a href=#sequential-focus-navigation-order id=the-tabindex-attribute:sequential-focus-navigation-order-5>sequential focus navigation order</a>, they are:</p>
- <ul><li>before any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-9>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-4>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-5><a href=#attr-tabindex>tabindex</a></code> attribute has been omitted or whose value, when parsed,
- returns an error,<li>before any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-10>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-5>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-6><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal to or less than zero,<li>after any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-11>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-6>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-7><a href=#attr-tabindex>tabindex</a></code> attribute has a value greater than zero but less than
- the value of the <code id=the-tabindex-attribute:attr-tabindex-8><a href=#attr-tabindex>tabindex</a></code> attribute on <var>candidate</var>,<li>after any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-12>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-7>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-9><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal to the value of the <code id=the-tabindex-attribute:attr-tabindex-10><a href=#attr-tabindex>tabindex</a></code> attribute on <var>candidate</var> but that is
- earlier in the document in <a href=#tree-order id=the-tabindex-attribute:tree-order>tree order</a> than <var>candidate</var>,<li>before any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-13>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-8>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-11><a href=#attr-tabindex>tabindex</a></code> attribute has a value equal to the value of the <code id=the-tabindex-attribute:attr-tabindex-12><a href=#attr-tabindex>tabindex</a></code> attribute on <var>candidate</var> but that is
- later in the document in <a href=#tree-order id=the-tabindex-attribute:tree-order-2>tree order</a> than <var>candidate</var>, and<li>before any <a href=#focusable-area id=the-tabindex-attribute:focusable-area-14>focusable area</a> whose <a href=#dom-anchor id=the-tabindex-attribute:dom-anchor-9>DOM anchor</a> is an element whose <code id=the-tabindex-attribute:attr-tabindex-13><a href=#attr-tabindex>tabindex</a></code> attribute has a value greater than the value of the
- <code id=the-tabindex-attribute:attr-tabindex-14><a href=#attr-tabindex>tabindex</a></code> attribute on <var>candidate</var>.</ul>
- </dl>
- <p>An element that has its <a href=#specially-focusable id=the-tabindex-attribute:specially-focusable-7>tabindex focus flag</a> set but does not otherwise have an
- <a href=#activation-behavior id=the-tabindex-attribute:activation-behavior>activation behavior</a> defined has an <a href=#activation-behavior id=the-tabindex-attribute:activation-behavior-2>activation behavior</a> that does
- nothing.</p>
- <p class=note>This means that an element that is only focusable because of its <code id=the-tabindex-attribute:attr-tabindex-15><a href=#attr-tabindex>tabindex</a></code> attribute will fire a <code id=the-tabindex-attribute:event-click><a href=#event-click>click</a></code> event in response to a non-mouse activation (e.g. hitting the
- "enter" key while the element is <a href=#focused id=the-tabindex-attribute:focused>focused</a>).</p>
- <p>An element with the <code id=the-tabindex-attribute:attr-tabindex-16><a href=#attr-tabindex>tabindex</a></code> attribute specified is
- <a href=#interactive-content-2 id=the-tabindex-attribute:interactive-content-2>interactive content</a>.</p>
- <p>The <dfn id=dom-tabindex><code>tabIndex</code></dfn> IDL attribute must
- <a href=#reflect id=the-tabindex-attribute:reflect>reflect</a> the value of the <code id=the-tabindex-attribute:attr-tabindex-17><a href=#attr-tabindex>tabindex</a></code> content
- attribute. Its default value is 0 for elements that are focusable and −1 for elements that
- are not focusable.</p>
-
-
- <h4 id=processing-model-6>6.4.4 Processing model</h4>
- <p>The <dfn id=focusing-steps>focusing steps</dfn> for an object <var>new focus target</var> that is
- either a <a href=#focusable-area id=processing-model-6:focusable-area>focusable area</a>, or an element that is not a <a href=#focusable-area id=processing-model-6:focusable-area-2>focusable area</a>, or a
- <a href=#browsing-context id=processing-model-6:browsing-context>browsing context</a>, are as follows:</p>
- <ol><li>
- <p>If <var>new focus target</var> is neither a <code id=processing-model-6:the-dialog-element><a href=#the-dialog-element>dialog</a></code> element that has an
- <code id=processing-model-6:attr-dialog-open><a href=#attr-dialog-open>open</a></code> attribute specified and that is <a href=#being-rendered id=processing-model-6:being-rendered>being
- rendered</a> (i.e. that is a <a href=#control-group-owner-object id=processing-model-6:control-group-owner-object>control group owner object</a>), nor a <a href=#focusable-area id=processing-model-6:focusable-area-3>focusable
- area</a>, then run the first matching set of steps from the following list:</p>
- <dl class=switch><dt>If <var>new focus target</var> is an <code id=processing-model-6:the-area-element><a href=#the-area-element>area</a></code> element with one or more
- shapes that are <a href=#focusable-area id=processing-model-6:focusable-area-4>focusable areas</a><dd>
- <p>Let <var>new focus target</var> be the shape corresponding to the first
- <code id=processing-model-6:the-img-element><a href=#the-img-element>img</a></code> element in <a href=#tree-order id=processing-model-6:tree-order>tree order</a> that uses the image map to which the <code id=processing-model-6:the-area-element-2><a href=#the-area-element>area</a></code>
- element belongs.</p>
- <dt>If <var>new focus target</var> is an element with one or more scrollable regions
- that are <a href=#focusable-area id=processing-model-6:focusable-area-5>focusable areas</a><dd>
- <p>Let <var>new focus target</var> be the element's first scrollable region,
- according to a pre-order, depth-first traversal of the box tree. <a href=#refsCSS>[CSS]</a></p>
- <dt>If <var>new focus target</var> is <a href=#the-body-element-2 id=processing-model-6:the-body-element-2>the body element</a> of its
- <code id=processing-model-6:document><a href=#document>Document</a></code><dt>If <var>new focus target</var> is the <a href=#root-element id=processing-model-6:root-element>root element</a> of its
- <code id=processing-model-6:document-2><a href=#document>Document</a></code> and that <code id=processing-model-6:document-3><a href=#document>Document</a></code> has no <a href=#the-body-element-2 id=processing-model-6:the-body-element-2-2>body element</a><dd>
- <p>Let <var>new focus target</var> be the <code id=processing-model-6:document-4><a href=#document>Document</a></code>'s viewport.</p>
- <dt>If <var>new focus target</var> is a <a href=#browsing-context id=processing-model-6:browsing-context-2>browsing context</a><dd>
- <p>Let <var>new focus target</var> be the <a href=#browsing-context id=processing-model-6:browsing-context-3>browsing context</a>'s
- <a href=#active-document id=processing-model-6:active-document>active document</a>.</p>
- <dt>Otherwise<dd>
- <p>Abort the <a href=#focusing-steps id=processing-model-6:focusing-steps>focusing steps</a>.</p>
- </dl>
- <li>
- <p>If <var>new focus target</var> is a <a href=#control-group-owner-object id=processing-model-6:control-group-owner-object-2>control group owner object</a> that is
- not a <a href=#focusable-area id=processing-model-6:focusable-area-6>focusable area</a>, but does have a <a href=#dialog-group id=processing-model-6:dialog-group>dialog group</a>, and that <a href=#dialog-group id=processing-model-6:dialog-group-2>dialog group</a>
- has a designated <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group>focused dialog</a>, then
- let <var>new focus target</var> be the <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog
- group</a>, and redo this step.</p>
- <p>Otherwise, if <var>new focus target</var> is a <a href=#control-group-owner-object id=processing-model-6:control-group-owner-object-3>control group owner
- object</a> that is not a <a href=#focusable-area id=processing-model-6:focusable-area-7>focusable area</a>, and its <a href=#control-group id=processing-model-6:control-group>control group</a> is not empty,
- then designate <var>new focus target</var> as the <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group>focused area of the control
- group</a>, and redo this step.</p>
-
- <p>Otherwise, if <var>new focus target</var> is a <a href=#browsing-context-container id=processing-model-6:browsing-context-container>browsing context
- container</a>, then let <var>new focus target</var> be the <a href=#nested-browsing-context id=processing-model-6:nested-browsing-context>nested browsing
- context</a>'s <a href=#active-document id=processing-model-6:active-document-2>active document</a>, and redo this step.</p>
- <p class=note>A <code id=processing-model-6:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> element can be both a <a href=#control-group-owner-object id=processing-model-6:control-group-owner-object-4>control group owner
- object</a> and a <a href=#focusable-area id=processing-model-6:focusable-area-8>focusable area</a>, if it has both an <code id=processing-model-6:attr-dialog-open-2><a href=#attr-dialog-open>open</a></code> attribute specified and a <code id=processing-model-6:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute specified and is <a href=#being-rendered id=processing-model-6:being-rendered-2>being
- rendered</a>.</p>
- <li><p>If <var>new focus target</var> is a <a href=#focusable-area id=processing-model-6:focusable-area-9>focusable area</a> and its <a href=#dom-anchor id=processing-model-6:dom-anchor>DOM
- anchor</a> is <a href=#inert id=processing-model-6:inert>inert</a>, then abort these steps.<li><p>If <var>new focus target</var> is the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context>currently focused area of a
- top-level browsing context</a>, then abort these steps.<li><p>Let <var>old chain</var> be the <a href=#focus-chain id=processing-model-6:focus-chain>focus chain</a> of the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of the
- top-level browsing context</a> in which <var>new focus target</var> finds
- itself.<li><p>Let <var>new chain</var> be the <a href=#focus-chain id=processing-model-6:focus-chain-2>focus chain</a> of <var>new
- focus target</var>.<li><p>Run the <a href=#focus-update-steps id=processing-model-6:focus-update-steps>focus update steps</a> with <var>old chain</var>, <var>new chain</var>, and <var>new focus target</var> respectively.</ol>
- <p>User agents must synchronously run the <a href=#focusing-steps id=processing-model-6:focusing-steps-2>focusing steps</a> for a <a href=#focusable-area id=processing-model-6:focusable-area-10>focusable area</a>,
- <code id=processing-model-6:the-dialog-element-3><a href=#the-dialog-element>dialog</a></code>, or <a href=#browsing-context id=processing-model-6:browsing-context-4>browsing context</a> <var>candidate</var> whenever the
- user attempts to move the focus to <var>candidate</var>.</p>
- <p>The <dfn id=unfocusing-steps>unfocusing steps</dfn> for an object <var>old focus target</var> that is
- either a <a href=#focusable-area id=processing-model-6:focusable-area-11>focusable area</a> or an element that is not a <a href=#focusable-area id=processing-model-6:focusable-area-12>focusable area</a> are as
- follows:</p>
- <ol><li><p>If <var>old focus target</var> is <a href=#inert id=processing-model-6:inert-2>inert</a>, then abort these
- steps.<li>
- <p>If <var>old focus target</var> is an <code id=processing-model-6:the-area-element-3><a href=#the-area-element>area</a></code> element and one of its shapes is the
- <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-3>currently focused area of a top-level browsing context</a>, or, if <var>old focus
- target</var> is an element with one or more scrollable regions, and one of them is the
- <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-4>currently focused area of a top-level browsing context</a>, then let <var>old focus
- target</var> be that <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-5>currently focused area of a top-level browsing context</a>.</p>
- <li><p>Let <var>old chain</var> be the <a href=#focus-chain id=processing-model-6:focus-chain-3>focus chain</a> of the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-6>currently
- focused area of a top-level browsing context</a>.<li><p>If <var>old focus target</var> is not one of the entries in <var>old
- chain</var>, then abort these steps.<li>
- <p>If <var>old focus target</var> is a <code id=processing-model-6:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> in a <a href=#dialog-group id=processing-model-6:dialog-group-3>dialog group</a>, and
- the <a href=#dialog-group-manager id=processing-model-6:dialog-group-manager>dialog group manager</a> has a non-empty <a href=#control-group id=processing-model-6:control-group-2>control group</a>, then let
- <var>new focus target</var> be the designated <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-2>focused area of that focus group</a>.</p>
- <p>Otherwise, if <var>old focus target</var> is a <a href=#focusable-area id=processing-model-6:focusable-area-13>focusable area</a>, then let <var>new
- focus target</var> be the first <a href=#focusable-area id=processing-model-6:focusable-area-14>focusable area</a> of its <a href=#control-group id=processing-model-6:control-group-3>control group</a>
- (if the <a href=#control-group-owner id=processing-model-6:control-group-owner>control group owner</a> is a <code id=processing-model-6:document-5><a href=#document>Document</a></code>, this will always be a
- viewport).</p>
- <p>Otherwise, let <var>new focus target</var> be null.</p>
- <li><p>If <var>new focus target</var> is not null, then run the <a href=#focusing-steps id=processing-model-6:focusing-steps-3>focusing
- steps</a> for <var>new focus target</var>.</ol>
- <p>When the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-7>currently focused area of a top-level browsing context</a> is somehow
- unfocused without another element being explicitly focused in its stead, the user agent must
- synchronously run the <a href=#unfocusing-steps id=processing-model-6:unfocusing-steps>unfocusing steps</a> for that object.</p>
- <p class=note>The <a href=#unfocusing-steps id=processing-model-6:unfocusing-steps-2>unfocusing steps</a> do not always result in the focus changing, even
- when applied to the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-8>currently focused area of a top-level browsing context</a>. For
- example, if the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-9>currently focused area of a top-level browsing context</a> is a viewport,
- then it will usually keep its focus regardless until another <a href=#focusable-area id=processing-model-6:focusable-area-15>focusable area</a> is explicitly
- focused with the <a href=#focusing-steps id=processing-model-6:focusing-steps-4>focusing steps</a>.</p>
- <hr>
- <p>When a <a href=#focusable-area id=processing-model-6:focusable-area-16>focusable area</a> is added to an empty <a href=#control-group id=processing-model-6:control-group-4>control group</a>, it must be designated
- the <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-3>focused area of the control group</a>.</p>
- <p>When a <a href=#dialog-group id=processing-model-6:dialog-group-4>dialog group</a> is formed, if the <a href=#dialog-group-manager id=processing-model-6:dialog-group-manager-2>dialog group manager</a> has an empty
- <a href=#control-group id=processing-model-6:control-group-5>control group</a>, the first non-<a href=#inert id=processing-model-6:inert-3>inert</a> <code id=processing-model-6:the-dialog-element-5><a href=#the-dialog-element>dialog</a></code> in the <a href=#dialog-group id=processing-model-6:dialog-group-5>dialog
- group</a>, if any, or else the first <code id=processing-model-6:the-dialog-element-6><a href=#the-dialog-element>dialog</a></code> in the <a href=#dialog-group id=processing-model-6:dialog-group-6>dialog group</a> regardless of
- <a href=#inert id=processing-model-6:inert-4>inertness</a>, must be designated the <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-3>focused dialog of the dialog
- group</a>.</p>
- <p><dfn id=focus-fixup-rule-one>Focus fixup rule one</dfn>: When the designated <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-4>focused area of a control group</a> is removed from that <a href=#control-group id=processing-model-6:control-group-6>control group</a> in
- some way (e.g. it stops being a <a href=#focusable-area id=processing-model-6:focusable-area-17>focusable area</a>, it is removed from the DOM, it
- becomes <a href=#expressly-inert-control id=processing-model-6:expressly-inert-control>expressly inert</a>, etc), and the <a href=#control-group id=processing-model-6:control-group-7>control
- group</a> is still not empty: designate the first non-<a href=#inert id=processing-model-6:inert-5>inert</a> <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-5>focused area</a> in that <a href=#control-group id=processing-model-6:control-group-8>control group</a> to be the new
- <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-6>focused area of the control group</a>, if any; if they are all <a href=#inert id=processing-model-6:inert-6>inert</a>, then
- designate the first <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-7>focused area</a> in that
- <a href=#control-group id=processing-model-6:control-group-9>control group</a> to be the new <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-8>focused area of the control group</a> regardless
- of <a href=#inert id=processing-model-6:inert-7>inertness</a>. If such a removal instead results in the <a href=#control-group id=processing-model-6:control-group-10>control
- group</a> being empty, then there is simply no longer a <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-9>focused area of the control
- group</a>.</p>
- <p class=example>For example, this might happen because an element is removed from its
- <code id=processing-model-6:document-6><a href=#document>Document</a></code>, or has a <code id=processing-model-6:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute added. It might
- also happen to an <code id=processing-model-6:the-input-element><a href=#the-input-element>input</a></code> element when the element gets <a href=#concept-fe-disabled id=processing-model-6:concept-fe-disabled>disabled</a>.</p>
- <p><dfn id=focus-fixup-rule-two>Focus fixup rule two</dfn>: When a <a href=#dialog-group id=processing-model-6:dialog-group-7>dialog group</a> has no designed <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-4>focused
- dialog of the dialog group</a>, and its <a href=#dialog-group-manager id=processing-model-6:dialog-group-manager-3>dialog group manager</a>'s <a href=#control-group id=processing-model-6:control-group-11>control
- group</a> changes from being non-empty to being empty, the first non-<a href=#inert id=processing-model-6:inert-8>inert</a>
- <code id=processing-model-6:the-dialog-element-7><a href=#the-dialog-element>dialog</a></code> in the <a href=#dialog-group id=processing-model-6:dialog-group-8>dialog group</a>, if any, or else the first <code id=processing-model-6:the-dialog-element-8><a href=#the-dialog-element>dialog</a></code> in
- the <a href=#dialog-group id=processing-model-6:dialog-group-9>dialog group</a> regardless of <a href=#inert id=processing-model-6:inert-9>inertness</a>, must be designated
- the <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-5>focused dialog of the dialog group</a>.</p>
- <p><dfn id=focus-fixup-rule-three>Focus fixup rule three</dfn>: When the designated <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-6>focused dialog of a dialog group</a> is removed from that <a href=#dialog-group id=processing-model-6:dialog-group-10>dialog group</a> in
- some way (e.g. it stops <a href=#being-rendered id=processing-model-6:being-rendered-3>being rendered</a>, it loses its <code id=processing-model-6:attr-dialog-open-3><a href=#attr-dialog-open>open</a></code> attribute, it becomes <a href=#expressly-inert-dialog id=processing-model-6:expressly-inert-dialog>expressly inert</a>, etc), and there is still a <a href=#dialog-group id=processing-model-6:dialog-group-11>dialog group</a> (because the
- <code id=processing-model-6:the-dialog-element-9><a href=#the-dialog-element>dialog</a></code> in question was not the last <code id=processing-model-6:the-dialog-element-10><a href=#the-dialog-element>dialog</a></code> in that <a href=#dialog-group id=processing-model-6:dialog-group-12>dialog group</a>):
- if the <a href=#dialog-group id=processing-model-6:dialog-group-13>dialog group</a>'s <a href=#dialog-group-manager id=processing-model-6:dialog-group-manager-4>manager</a>'s <a href=#control-group id=processing-model-6:control-group-12>control
- group</a> is non-empty, let there be no designated <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-7>focused dialog of the dialog group</a>
- any more; otherwise (in the case that the <a href=#control-group id=processing-model-6:control-group-13>control group</a> is empty), designate the first
- non-<a href=#inert id=processing-model-6:inert-10>inert</a> <code id=processing-model-6:the-dialog-element-11><a href=#the-dialog-element>dialog</a></code> in the <a href=#dialog-group id=processing-model-6:dialog-group-14>dialog group</a> to be the <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-8>focused
- dialog of the dialog group</a>, or, if they are all <a href=#inert id=processing-model-6:inert-11>inert</a>, designate the first
- <code id=processing-model-6:the-dialog-element-12><a href=#the-dialog-element>dialog</a></code> in the <a href=#dialog-group id=processing-model-6:dialog-group-15>dialog group</a> to be the <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-9>focused dialog of the dialog
- group</a> regardless of <a href=#inert id=processing-model-6:inert-12>inertness</a>.</p>
- <p>When the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-10>currently focused area of a top-level browsing context</a> was a <a href=#focusable-area id=processing-model-6:focusable-area-18>focusable
- area</a> but stops being a <a href=#focusable-area id=processing-model-6:focusable-area-19>focusable area</a>, or when it was a <code id=processing-model-6:the-dialog-element-13><a href=#the-dialog-element>dialog</a></code> in a
- <a href=#dialog-group id=processing-model-6:dialog-group-16>dialog group</a> and stops being part of that <a href=#dialog-group id=processing-model-6:dialog-group-17>dialog group</a>, or when it
- starts being <a href=#inert id=processing-model-6:inert-13>inert</a>, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>old focus target</var> be whatever the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-11>currently focused area of the top-level browsing
- context</a> was immediately before this algorithm became applicable (e.g. before the element
- was disabled, or the dialog was closed, or whatever caused this algorithm to run).<li><p>Let <var>old chain</var> be the <a href=#focus-chain id=processing-model-6:focus-chain-4>focus chain</a> of the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-12>currently focused area of the
- top-level browsing context</a> at the same time.<li><p>Make sure that the changes implied by the focus fixup rules <a href=#focus-fixup-rule-one id=processing-model-6:focus-fixup-rule-one>one</a>, <a href=#focus-fixup-rule-two id=processing-model-6:focus-fixup-rule-two>two</a>, and <a href=#focus-fixup-rule-three id=processing-model-6:focus-fixup-rule-three>three</a> above are applied.<li><p>Let <var>new focus target</var> be the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-13>currently focused area of a
- top-level browsing context</a>.<li><p>If <var>old focus target</var> and <var>new focus target</var> are the
- same, abort these steps.<li><p>Let <var>new chain</var> be the <a href=#focus-chain id=processing-model-6:focus-chain-5>focus chain</a> of <var>new
- focus target</var>.<li><p>Run the <a href=#focus-update-steps id=processing-model-6:focus-update-steps-2>focus update steps</a> with <var>old chain</var>, <var>new chain</var>, and <var>new focus target</var> respectively.</ol>
- <hr>
- <p>The <dfn id=focus-update-steps>focus update steps</dfn>, given an <var>old chain</var>, a <var>new chain</var>, and a <var>new focus target</var> respectively, are as
- follows:</p>
- <ol><li><p>If the last entry in <var>old chain</var> and the last entry in <var>new chain</var> are the same, pop the last entry from <var>old chain</var>
- and the last entry from <var>new chain</var> and redo this step.<li>
- <p>For each entry <var>entry</var> in <var>old chain</var>, in order, run
- these substeps:</p>
- <ol><li id=unfocus-causes-change-event><p>If <var>entry</var> is an <code id=processing-model-6:the-input-element-2><a href=#the-input-element>input</a></code>
- element, and the <code id=processing-model-6:event-input-change><a href=#event-input-change>change</a></code> event <a href=#concept-input-apply id=processing-model-6:concept-input-apply>applies</a> to the element, and the element does not have a
- defined <a href=#activation-behavior id=processing-model-6:activation-behavior>activation behavior</a>, and the user has changed the element's <a href=#concept-fe-value id=processing-model-6:concept-fe-value>value</a> or its list of <a href=#concept-input-type-file-selected id=processing-model-6:concept-input-type-file-selected>selected files</a> while the control was focused
- without committing that change, then <a href=#fire-a-simple-event id=processing-model-6:fire-a-simple-event>fire a simple event</a> that bubbles named <code id=processing-model-6:event-change><a href=#event-change>change</a></code> at the element.</p>
- <li>
- <p>If <var>entry</var> is an element, let <var>blur event target</var> be
- <var>entry</var>.</p>
- <p>If <var>entry</var> is a <code id=processing-model-6:document-7><a href=#document>Document</a></code> object, let <var>blur
- event target</var> be that <code id=processing-model-6:document-8><a href=#document>Document</a></code> object's <code id=processing-model-6:window><a href=#window>Window</a></code> object.</p>
- <p>Otherwise, let <var>blur event target</var> be null.</p>
- <li><p>If <var>entry</var> is the last entry in <var>old chain</var>, and
- <var>entry</var> is an <code id=processing-model-6:element><a href=#element>Element</a></code>, and the last entry in <var>new
- chain</var> is also an <code id=processing-model-6:element-2><a href=#element>Element</a></code>, then let <var>related blur target</var>
- be the last entry in <var>new chain</var>. Otherwise, let <var>related blur
- target</var> be null.<li>
- <p>If <var>blur event target</var> is not null, <a href=#fire-a-focus-event id=processing-model-6:fire-a-focus-event>fire a focus event</a>
- named <code id=processing-model-6:event-blur><a href=#event-blur>blur</a></code> at <var>blur event target</var>, with
- <var>related blur target</var> as the related target.</p>
- <p class=note>In some cases, e.g. if <var>entry</var> is an <code id=processing-model-6:the-area-element-4><a href=#the-area-element>area</a></code>
- element's shape, a scrollable region, or a viewport, no event is fired.</p>
- </ol>
- <li><p>Apply any relevant platform-specific conventions for focusing <var>new focus
- target</var>. (For example, some platforms select the contents of a text field when that field is
- focused.)<li>
- <p>For each entry <var>entry</var> in <var>new chain</var>, in reverse
- order, run these substeps:</p>
- <ol><li><p>If <var>entry</var> is a <code id=processing-model-6:the-dialog-element-14><a href=#the-dialog-element>dialog</a></code> element: Let <var>entry</var> be the designated <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-10>focused dialog of its dialog group</a>.<li>
- <p>If <var>entry</var> is a <a href=#focusable-area id=processing-model-6:focusable-area-20>focusable area</a>: Designate <var>entry</var> as the <a href=#focused-area-of-the-control-group id=processing-model-6:focused-area-of-the-control-group-10>focused area of the control group</a>. If its <a href=#control-group id=processing-model-6:control-group-14>control
- group</a>'s <a href=#control-group-owner id=processing-model-6:control-group-owner-2>owner</a> is also a <a href=#dialog-group-manager id=processing-model-6:dialog-group-manager-5>dialog group
- manager</a>, then let there be no designated <a href=#focused-dialog-of-the-dialog-group id=processing-model-6:focused-dialog-of-the-dialog-group-11>focused dialog</a> in that <a href=#dialog-group id=processing-model-6:dialog-group-18>dialog group</a>.</p>
- <p class=note>It is possible for <var>entry</var> to be both a <code id=processing-model-6:the-dialog-element-15><a href=#the-dialog-element>dialog</a></code>
- element and a <a href=#focusable-area id=processing-model-6:focusable-area-21>focusable area</a>, in which case it is its own <a href=#control-group-owner id=processing-model-6:control-group-owner-3>control group
- owner</a>.</p>
- <li>
- <p>If <var>entry</var> is an element, let <var>focus event target</var> be
- <var>entry</var>.</p>
- <p>If <var>entry</var> is a <code id=processing-model-6:document-9><a href=#document>Document</a></code> object, let <var>focus
- event target</var> be that <code id=processing-model-6:document-10><a href=#document>Document</a></code> object's <code id=processing-model-6:window-2><a href=#window>Window</a></code> object.</p>
- <p>Otherwise, let <var>focus event target</var> be null.</p>
- <li><p>If <var>entry</var> is the last entry in <var>new chain</var>, and
- <var>entry</var> is an <code id=processing-model-6:element-3><a href=#element>Element</a></code>, and the last entry in <var>old
- chain</var> is also an <code id=processing-model-6:element-4><a href=#element>Element</a></code>, then let <var>related focus target</var>
- be the last entry in <var>old chain</var>. Otherwise, let <var>related
- focus target</var> be null.<li>
- <p>If <var>focus event target</var> is not null, <a href=#fire-a-focus-event id=processing-model-6:fire-a-focus-event-2>fire a focus event</a>
- named <code id=processing-model-6:event-focus><a href=#event-focus>focus</a></code> at <var>focus event target</var>, with
- <var>related focus target</var> as the related target.</p>
- <p class=note>In some cases, e.g. if <var>entry</var> is an <code id=processing-model-6:the-area-element-5><a href=#the-area-element>area</a></code>
- element's shape, a scrollable region, or a viewport, no event is fired.</p>
- </ol>
- </ol>
- <p>When a user agent is required to <dfn id=fire-a-focus-event>fire a focus event</dfn> named <var>e</var> at
- an element <var>t</var> and with a given related target <var>r</var>, the user
- agent must create a <a href=#concept-events-trusted id=processing-model-6:concept-events-trusted>trusted</a> <code id=processing-model-6:focusevent><a href=#focusevent>FocusEvent</a></code>
- object, initialise it to have the given name <var>e</var>, to not bubble, to not be
- cancelable, and to have the <code id=processing-model-6:dom-focusevent-relatedtarget><a href=#dom-focusevent-relatedtarget>relatedTarget</a></code>
- attribute initialised to <var>r</var>, the <code id=processing-model-6:dom-uievent-view><a href=#dom-uievent-view>view</a></code> attribute initialised to the <code id=processing-model-6:window-3><a href=#window>Window</a></code> object of the <code id=processing-model-6:document-11><a href=#document>Document</a></code> object of <var>t</var>, and the <code id=processing-model-6:dom-uievent-detail><a href=#dom-uievent-detail>detail</a></code> attribute initialised to 0, and must then <a href=#concept-event-dispatch id=processing-model-6:concept-event-dispatch>dispatch</a> the newly created <code id=processing-model-6:focusevent-2><a href=#focusevent>FocusEvent</a></code> object
- at the specified target element <var>t</var>.</p>
- <hr>
- <p>When a key event is to be routed in a <a href=#top-level-browsing-context id=processing-model-6:top-level-browsing-context>top-level browsing context</a>, the user agent
- must run the following steps:</p>
- <ol><li><p>Let <var>target area</var> be the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-14>currently focused area of the top-level browsing
- context</a>.<li><p>If <var>target area</var> is a <a href=#focusable-area id=processing-model-6:focusable-area-22>focusable area</a>, let <var>target
- node</var> be <var>target area</var>'s <a href=#dom-anchor id=processing-model-6:dom-anchor-2>DOM anchor</a>. Otherwise, <var>target area</var> is a <code id=processing-model-6:the-dialog-element-16><a href=#the-dialog-element>dialog</a></code>; let <var>target node</var> be
- <var>target area</var>.<li>
- <p>If <var>target node</var> is a <code id=processing-model-6:document-12><a href=#document>Document</a></code> that has a <a href=#the-body-element-2 id=processing-model-6:the-body-element-2-3>body element</a>, then let <var>target node</var> be <a href=#the-body-element-2 id=processing-model-6:the-body-element-2-4>the body
- element</a> of that <code id=processing-model-6:document-13><a href=#document>Document</a></code>.</p>
- <p>Otherwise, if <var>target node</var> is a <code id=processing-model-6:document-14><a href=#document>Document</a></code> that has a
- <a href=#root-element id=processing-model-6:root-element-2>root element</a>, then let <var>target node</var> be the <a href=#root-element id=processing-model-6:root-element-3>root
- element</a> of that <code id=processing-model-6:document-15><a href=#document>Document</a></code>.</p>
- <li>
- <p>If <var>target node</var> is not <a href=#inert id=processing-model-6:inert-14>inert</a>, fire the event at <var>target node</var>.</p>
- <p class=note>It is possible for the <a href=#currently-focused-area-of-a-top-level-browsing-context id=processing-model-6:currently-focused-area-of-a-top-level-browsing-context-15>currently focused area of a top-level browsing
- context</a> to be <a href=#inert id=processing-model-6:inert-15>inert</a>, for example if a <a href=#dom-dialog-showmodal id=processing-model-6:dom-dialog-showmodal>modal dialog is shown</a>, and then that <code id=processing-model-6:the-dialog-element-17><a href=#the-dialog-element>dialog</a></code>
- element is made <a href=#inert id=processing-model-6:inert-16>inert</a>. It is likely to be the result of a logic error in the
- application, though.</p>
- <li><p>If the event was not canceled, then let <var>target area</var> handle the key
- event. This might include <a href=#run-synthetic-click-activation-steps id=processing-model-6:run-synthetic-click-activation-steps>running synthetic
- click activation steps</a> for <var>target node</var>.</ol>
- <h4 id=sequential-focus-navigation>6.4.5 <dfn>Sequential focus navigation</dfn></h4>
- <p>Each <a href=#control-group id=sequential-focus-navigation:control-group>control group</a> has a <dfn id=sequential-focus-navigation-order>sequential focus navigation order</dfn>, which orders some
- or all of the <a href=#focusable-area id=sequential-focus-navigation:focusable-area>focusable areas</a> in the <a href=#control-group id=sequential-focus-navigation:control-group-2>control group</a>
- relative to each other. The order in the <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order>sequential focus navigation order</a> does not
- have to be related to the order in the <a href=#control-group id=sequential-focus-navigation:control-group-3>control group</a> itself. If a <a href=#focusable-area id=sequential-focus-navigation:focusable-area-2>focusable area</a> is
- omitted from the <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-2>sequential focus navigation order</a> of its <a href=#control-group id=sequential-focus-navigation:control-group-4>control group</a>, then
- it is unreachable via <a href=#sequential-focus-navigation id=sequential-focus-navigation:sequential-focus-navigation>sequential focus navigation</a>.</p>
- <p>When the user requests that focus move from the <a href=#currently-focused-area-of-a-top-level-browsing-context id=sequential-focus-navigation:currently-focused-area-of-a-top-level-browsing-context>currently focused area of a top-level
- browsing context</a> to the next or previous <a href=#focusable-area id=sequential-focus-navigation:focusable-area-3>focusable area</a> (e.g. as the default action
- of pressing the <kbd>tab</kbd> key), or when the user requests that focus sequentially move to a
- <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context>top-level browsing context</a> in the first place (e.g. from the browser's location bar),
- the user agent must use the following algorithm:</p>
- <ol><li><p>Let <var>starting point</var> be the <a href=#currently-focused-area-of-a-top-level-browsing-context id=sequential-focus-navigation:currently-focused-area-of-a-top-level-browsing-context-2>currently focused area of a top-level
- browsing context</a>, if the user requested to move focus sequentially from there, or else the
- <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-2>top-level browsing context</a> itself, if the user instead requested to move focus from
- outside the <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-3>top-level browsing context</a>.<li>
- <p>Let <var>direction</var> be <i>forward</i> if the user requested the <em>next</em>
- control, and <i>backward</i> if the user requested the previous control.</p>
- <p class=note>Typically, pressing <kbd>tab</kbd> requests the next control, and pressing
- <kbd><kbd>shift</kbd>+<kbd>tab</kbd></kbd> requests the previous control.</p>
- <li>
- <p><i>Loop</i>: Let <var>selection mechanism</var> be <i>sequential</i> if the <var>starting
- point</var> is a <a href=#browsing-context id=sequential-focus-navigation:browsing-context>browsing context</a> or if <var>starting point</var> is in its
- <a href=#control-group id=sequential-focus-navigation:control-group-5>control group</a>'s <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-3>sequential focus navigation order</a>.</p>
- <p>Otherwise, <var>starting point</var> is not in its <a href=#control-group id=sequential-focus-navigation:control-group-6>control group</a>'s
- <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-4>sequential focus navigation order</a>; let <var>selection mechanism</var> be
- <i>DOM</i>.</p>
- <li><p>Let <var>candidate</var> be the result of running the <a href=#sequential-navigation-search-algorithm id=sequential-focus-navigation:sequential-navigation-search-algorithm>sequential navigation search
- algorithm</a> with <var>starting point</var>, <var>direction</var>, and <var>selection
- mechanism</var> as the arguments.<li><p>If <var>candidate</var> is not null, then run the <a href=#focusing-steps id=sequential-focus-navigation:focusing-steps>focusing steps</a> for
- <var>candidate</var> and abort these steps.<li>
- <p>Otherwise, if <var>starting point</var> is the <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-4>top-level browsing context</a>, or a
- <a href=#focusable-area id=sequential-focus-navigation:focusable-area-4>focusable area</a> in the <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-5>top-level browsing context</a>, the user agent
- should transfer focus to its own controls appropriately (if any), honouring
- <var>direction</var>, and then abort these steps.</p>
- <p class=example>For example, if <var>direction</var> is <i>backward</i>, then the last
- focusable control before the browser's rendering area would be the control to focus.</p>
- <p>If the user agent has no focusable controls — a kiosk-mode browser, for instance
- —
- then the user agent may instead restart these steps with the <var>starting point</var> being the
- <a href=#top-level-browsing-context id=sequential-focus-navigation:top-level-browsing-context-6>top-level browsing context</a> itself.</p>
-
- <li><p>Otherwise, <var>starting point</var> is a <a href=#focusable-area id=sequential-focus-navigation:focusable-area-5>focusable area</a> in a
- <a href=#nested-browsing-context id=sequential-focus-navigation:nested-browsing-context>nested browsing context</a>. Let <var>starting point</var> be that
- <a href=#nested-browsing-context id=sequential-focus-navigation:nested-browsing-context-2>nested browsing context</a>'s <a href=#browsing-context-container id=sequential-focus-navigation:browsing-context-container>browsing context container</a>, and return to the
- step labeled <i>loop</i>.</p>
-
- </ol>
- <p>The <dfn id=sequential-navigation-search-algorithm>sequential navigation search algorithm</dfn> consists of the following steps. This
- algorithm takes three arguments: <var>starting point</var>, <var>direction</var>,
- and <var>selection mechanism</var>.</p>
- <ol><li>
- <p>Pick the appropriate cell from the following table, and follow the instructions in that
- cell.</p>
- <p>The appropriate cell is the one that is from the column whose header describes <var>direction</var> and from the first row whose header describes <var>starting point</var> and <var>selection mechanism</var>.</p>
- <table><thead><tr><th>
- <th> <var>direction</var> is <i>forward</i>
- <th> <var>direction</var> is <i>backward</i>
- <tbody><tr><th><var>starting point</var> is a <a href=#browsing-context id=sequential-focus-navigation:browsing-context-2>browsing context</a>
- <td>Let <var>candidate</var> be the first <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area>suitable sequentially focusable area</a> in <var>starting point</var>'s <a href=#active-document id=sequential-focus-navigation:active-document>active document</a>'s <a href=#primary-control-group id=sequential-focus-navigation:primary-control-group>primary control group</a>, if any; or else null
- <td>Let <var>candidate</var> be the last <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area-2>suitable sequentially focusable area</a> in <var>starting point</var>'s <a href=#active-document id=sequential-focus-navigation:active-document-2>active document</a>'s <a href=#primary-control-group id=sequential-focus-navigation:primary-control-group-2>primary control group</a>, if any; or else null
- <tr><th><var>selection mechanism</var> is <i>DOM</i>
- <td>Let <var>candidate</var> be the first <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area-3>suitable sequentially focusable area</a> in the <a href=#home-control-group id=sequential-focus-navigation:home-control-group>home control group</a> following <var>starting point</var>, if any; or else null
- <td>Let <var>candidate</var> be the last <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area-4>suitable sequentially focusable area</a> in the <a href=#home-control-group id=sequential-focus-navigation:home-control-group-2>home control group</a> preceding <var>starting point</var>, if any; or else null
- <tr><th><var>selection mechanism</var> is <i>sequential</i>
- <td>Let <var>candidate</var> be the first <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area-5>suitable sequentially focusable area</a> in the <a href=#home-sequential-focus-navigation-order id=sequential-focus-navigation:home-sequential-focus-navigation-order>home sequential focus navigation order</a> following <var>starting point</var>, if any; or else null
- <td>Let <var>candidate</var> be the last <a href=#suitable-sequentially-focusable-area id=sequential-focus-navigation:suitable-sequentially-focusable-area-6>suitable sequentially focusable area</a> in the <a href=#home-sequential-focus-navigation-order id=sequential-focus-navigation:home-sequential-focus-navigation-order-2>home sequential focus navigation order</a> preceding <var>starting point</var>, if any; or else null
- </table>
- <p>A <dfn id=suitable-sequentially-focusable-area>suitable sequentially focusable area</dfn> is a <a href=#focusable-area id=sequential-focus-navigation:focusable-area-6>focusable area</a> whose <a href=#dom-anchor id=sequential-focus-navigation:dom-anchor>DOM
- anchor</a> is not <a href=#inert id=sequential-focus-navigation:inert>inert</a> and that is in its <a href=#control-group id=sequential-focus-navigation:control-group-7>control group</a>'s <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-5>sequential
- focus navigation order</a>.</p>
- <p>The <dfn id=primary-control-group>primary control group</dfn> of a <a href=#control-group-owner-object id=sequential-focus-navigation:control-group-owner-object>control group owner object</a> <var>X</var> is the <a href=#control-group id=sequential-focus-navigation:control-group-8>control group</a> of <var>X</var> if <var>X</var> has no <a href=#dialog-group id=sequential-focus-navigation:dialog-group>dialog group</a> or if its <a href=#dialog-group id=sequential-focus-navigation:dialog-group-2>dialog group</a> has no
- designated <a href=#focused-dialog-of-the-dialog-group id=sequential-focus-navigation:focused-dialog-of-the-dialog-group>focused dialog of the dialog group</a>, otherwise, it is the <a href=#primary-control-group id=sequential-focus-navigation:primary-control-group-3>primary
- control group</a> of <var>X</var>'s <a href=#dialog-group id=sequential-focus-navigation:dialog-group-3>dialog group</a>'s designated
- <a href=#focused-dialog-of-the-dialog-group id=sequential-focus-navigation:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group</a>.</p>
- <p>The <dfn id=home-control-group>home control group</dfn> is the <a href=#control-group id=sequential-focus-navigation:control-group-9>control group</a> to which <var>starting point</var> belongs.</p>
- <p>The <dfn id=home-sequential-focus-navigation-order>home sequential focus navigation order</dfn> is the <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-6>sequential focus
- navigation order</a> to which <var>starting point</var> belongs.</p>
- <p class=note>The <a href=#home-sequential-focus-navigation-order id=sequential-focus-navigation:home-sequential-focus-navigation-order-3>home sequential focus navigation order</a> is the <a href=#home-control-group id=sequential-focus-navigation:home-control-group-3>home
- control group</a>'s <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-7>sequential focus navigation order</a>, but is only used when the
- <var>starting point</var> is in that <a href=#sequential-focus-navigation-order id=sequential-focus-navigation:sequential-focus-navigation-order-8>sequential focus navigation order</a>
- (when it's not, <var>selection mechanism</var> will be <i>DOM</i>).</p>
- <li>
- <p>If <var>candidate</var> is a <a href=#browsing-context-container id=sequential-focus-navigation:browsing-context-container-2>browsing context container</a>, then let <var>new candidate</var> be the result of running the <a href=#sequential-navigation-search-algorithm id=sequential-focus-navigation:sequential-navigation-search-algorithm-2>sequential navigation search
- algorithm</a> with <var>candidate</var>'s <a href=#nested-browsing-context id=sequential-focus-navigation:nested-browsing-context-3>nested browsing context</a> as
- the first argument, <var>direction</var> as the second, and <i>sequential</i>
- as the third.</p>
- <p>If <var>new candidate</var> is null, then let <var>starting point</var>
- be <var>candidate</var>, and return to the top of this algorithm. Otherwise, let <var>candidate</var> be <var>new candidate</var>.</p>
- <li><p>Return <var>candidate</var>.</ol>
-
- <h4 id=focus-management-apis>6.4.6 Focus management APIs</h4>
- <dl class=domintro><dt><var>document</var> . <code id=focus-management-apis:dom-document-activeelement><a href=#dom-document-activeelement>activeElement</a></code><dd>
- <p>Returns the deepest element in the document through which or to which key events are being
- routed. This is, roughly speaking, the focused element in the document.</p>
- <p>For the purposes of this API, when a <a href=#child-browsing-context id=focus-management-apis:child-browsing-context>child browsing context</a> is focused, its
- <a href=#browsing-context-container id=focus-management-apis:browsing-context-container>browsing context container</a> is <a href=#bc-focus-ergo-bcc-focus>focused</a> in the
- <a href=#parent-browsing-context id=focus-management-apis:parent-browsing-context>parent browsing context</a>. For example, if the user moves the focus to a text field
- in an <code id=focus-management-apis:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, the <code id=focus-management-apis:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> is the element returned by the <code id=focus-management-apis:dom-document-activeelement-2><a href=#dom-document-activeelement>activeElement</a></code> API in the <code id=focus-management-apis:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>'s
- <a id=focus-management-apis:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
- <dt><var>document</var> . <code id=focus-management-apis:dom-document-hasfocus><a href=#dom-document-hasfocus>hasFocus</a></code>()<dd>
- <p>Returns true if key events are being routed through or to the document; otherwise, returns
- false. Roughly speaking, this corresponds to the document, or a documented nested inside this
- one, being focused.</p>
- <dt><var>window</var> . <code id=focus-management-apis:dom-window-focus><a href=#dom-window-focus>focus</a></code>()<dd>
-
- <p>Moves the focus to the window's <a href=#browsing-context-container id=focus-management-apis:browsing-context-container-2>browsing context container</a>, if any.</p>
- <dt><var>element</var> . <code id=focus-management-apis:dom-focus><a href=#dom-focus>focus</a></code>()<dd>
- <p>Moves the focus to the element.</p>
- <p>If the element is <a href=#the-body-element-2 id=focus-management-apis:the-body-element-2>the body element</a>, moves the focus to the viewport instead.</p>
- <dt><var>element</var> . <code id=focus-management-apis:dom-blur><a href=#dom-blur>blur</a></code>()<dd>
- <p>Moves the focus to the viewport. Use of this method is discouraged; if you want to focus the
- viewport, call the <code id=focus-management-apis:dom-focus-2><a href=#dom-focus>focus()</a></code> method on <a href=#the-body-element-2 id=focus-management-apis:the-body-element-2-2>the body
- element</a>.</p>
- <p>Do not use this method to hide the focus ring if you find the focus ring unsightly. Instead,
- use a CSS rule to override the 'outline' property, and provide a different way to show what
- element is focused. Be aware that if an alternative focusing style isn't made available, the
- page will be significantly less usable for people who primarily navigate pages using a keyboard,
- or those with reduced vision who use focus outlines to help them navigate the page.</p>
-
- <div class=example>
- <p>For example, to hide the outline from links and instead use a yellow background to indicate
- focus, you could use:</p>
- <pre>:link:focus, :visited:focus { outline: none; background: yellow; color: black; }</pre>
- </div>
- </dl>
-
- <p>The <dfn id=dom-document-activeelement><code>activeElement</code></dfn> attribute on
- <code id=focus-management-apis:document><a href=#document>Document</a></code> objects must return the value returned by the following steps:</p>
- <ol><li><p>Let <var>candidate</var> be the <code id=focus-management-apis:document-2><a href=#document>Document</a></code> on which the method was
- invoked.<li><p>If <var>candidate</var> has a <a href=#dialog-group id=focus-management-apis:dialog-group>dialog group</a> with a designated
- <a href=#focused-dialog-of-the-dialog-group id=focus-management-apis:focused-dialog-of-the-dialog-group>focused dialog of the dialog group</a>, then let <var>candidate</var> be the
- designated <a href=#focused-dialog-of-the-dialog-group id=focus-management-apis:focused-dialog-of-the-dialog-group-2>focused dialog of the dialog group</a>, and redo this step.<li><p>If <var>candidate</var> has a non-empty <a href=#control-group id=focus-management-apis:control-group>control group</a>, let <var>candidate</var> be the designated <a href=#focused-area-of-the-control-group id=focus-management-apis:focused-area-of-the-control-group>focused area of the control
- group</a>.</p>
- <li><p>If <var>candidate</var> is a <a href=#focusable-area id=focus-management-apis:focusable-area>focusable area</a>, let <var>candidate</var> be <var>candidate</var>'s <a href=#dom-anchor id=focus-management-apis:dom-anchor>DOM anchor</a>.<li>
- <p>If <var>candidate</var> is a <code id=focus-management-apis:document-3><a href=#document>Document</a></code> that has a <a href=#the-body-element-2 id=focus-management-apis:the-body-element-2-3>body element</a>, then let <var>candidate</var> be <a href=#the-body-element-2 id=focus-management-apis:the-body-element-2-4>the body
- element</a> of that <code id=focus-management-apis:document-4><a href=#document>Document</a></code>.</p>
- <p>Otherwise, if <var>candidate</var> is a <code id=focus-management-apis:document-5><a href=#document>Document</a></code> that has a <a href=#root-element id=focus-management-apis:root-element>root
- element</a>, then let <var>candidate</var> be the <a href=#root-element id=focus-management-apis:root-element-2>root element</a> of that
- <code id=focus-management-apis:document-6><a href=#document>Document</a></code>.</p>
- <p>Otherwise, if <var>candidate</var> is a <code id=focus-management-apis:document-7><a href=#document>Document</a></code>, then let <var>candidate</var> be null.</p>
- <li><p>Return <var>candidate</var>.</ol>
- <p>The <dfn id=dom-document-hasfocus><code>hasFocus()</code></dfn> method on
- <code id=focus-management-apis:document-8><a href=#document>Document</a></code> objects must return the value returned by the following steps:</p>
- <ol><li><p>Let <var>target</var> be the <code id=focus-management-apis:document-9><a href=#document>Document</a></code> on which the method was
- invoked.<li><p>Let <var>candidate</var> be the <code id=focus-management-apis:document-10><a href=#document>Document</a></code> of the <a href=#top-level-browsing-context id=focus-management-apis:top-level-browsing-context>top-level
- browsing context</a>.<li><p>If <var>candidate</var> is <var>target</var>, return true and abort
- these steps.<li>
- <p>If <var>candidate</var> has a <a href=#dialog-group id=focus-management-apis:dialog-group-2>dialog group</a> with a designated <a href=#focused-dialog-of-the-dialog-group id=focus-management-apis:focused-dialog-of-the-dialog-group-3>focused
- dialog of the dialog group</a>, then let <var>candidate</var> be the designated
- <a href=#focused-dialog-of-the-dialog-group id=focus-management-apis:focused-dialog-of-the-dialog-group-4>focused dialog of the dialog group</a>, and redo this step.</p>
- <p>Otherwise, if <var>candidate</var> has a non-empty <a href=#control-group id=focus-management-apis:control-group-2>control group</a>, and the
- designated <a href=#focused-area-of-the-control-group id=focus-management-apis:focused-area-of-the-control-group-2>focused area of the control group</a> is a <a href=#browsing-context-container id=focus-management-apis:browsing-context-container-3>browsing context
- container</a>, and the <a href=#active-document id=focus-management-apis:active-document>active document</a> of that <a href=#browsing-context-container id=focus-management-apis:browsing-context-container-4>browsing context
- container</a>'s <a href=#nested-browsing-context id=focus-management-apis:nested-browsing-context>nested browsing context</a> is <var>target</var>, then
- return true and abort these steps.</p>
- <p>Otherwise, if <var>candidate</var> has a non-empty <a href=#control-group id=focus-management-apis:control-group-3>control group</a>, and the
- designated <a href=#focused-area-of-the-control-group id=focus-management-apis:focused-area-of-the-control-group-3>focused area of the control group</a> is a <a href=#browsing-context-container id=focus-management-apis:browsing-context-container-5>browsing context
- container</a>, then let <var>candidate</var> be the <a href=#active-document id=focus-management-apis:active-document-2>active document</a> of
- that <a href=#browsing-context-container id=focus-management-apis:browsing-context-container-6>browsing context container</a>'s <a href=#nested-browsing-context id=focus-management-apis:nested-browsing-context-2>nested browsing context</a>, and redo
- this step.</p>
- <p>Otherwise, return false and abort these steps.</p>
- </ol>
- <p>The <dfn id=dom-window-focus><code>focus()</code></dfn> method on the <code id=focus-management-apis:window><a href=#window>Window</a></code>
- object, when invoked, must run the <a href=#focusing-steps id=focus-management-apis:focusing-steps>focusing steps</a> with the <code id=focus-management-apis:window-2><a href=#window>Window</a></code>
- object's <a href=#browsing-context id=focus-management-apis:browsing-context>browsing context</a>. Additionally, if this <a href=#browsing-context id=focus-management-apis:browsing-context-2>browsing context</a> is a
- <a href=#top-level-browsing-context id=focus-management-apis:top-level-browsing-context-2>top-level browsing context</a>, user agents are encouraged to trigger some sort of
- notification to indicate to the user that the page is attempting to gain focus.</p>
- <p>The <dfn id=dom-window-blur><code>blur()</code></dfn> method on the <code id=focus-management-apis:window-3><a href=#window>Window</a></code>
- object, when invoked, provides a hint to the user agent that the script believes the user probably
- is not currently interested in the contents of the <a href=#browsing-context id=focus-management-apis:browsing-context-3>browsing context</a> of the
- <code id=focus-management-apis:window-4><a href=#window>Window</a></code> object on which the method was invoked, but that the contents might become
- interesting again in the future.</p>
- <p>User agents are encouraged to ignore calls to this <code id=focus-management-apis:dom-window-blur><a href=#dom-window-blur>blur()</a></code>
- method entirely.</p>
- <p class=note>Historically, the <code id=focus-management-apis:dom-window-blur-2><a href=#dom-window-blur>focus()</a></code> and <code id=focus-management-apis:dom-window-blur-3><a href=#dom-window-blur>blur()</a></code> methods actually affected the system-level focus of the
- system widget (e.g. tab or window) that contained the <a href=#browsing-context id=focus-management-apis:browsing-context-4>browsing context</a>, but hostile
- sites widely abuse this behavior to the user's detriment.</p>
- <p>The <dfn id=dom-focus><code>focus()</code></dfn> method on elements, when invoked, must
- run the following algorithm:</p>
- <ol><li><p>If the element is marked as <i id=focus-management-apis:locked-for-focus><a href=#locked-for-focus>locked for focus</a></i>, then abort these steps.<li><p>Mark the element as <dfn id=locked-for-focus>locked for focus</dfn>.<li><p>Run the <a href=#focusing-steps id=focus-management-apis:focusing-steps-2>focusing steps</a> for the element.<li><p>Unmark the element as <i id=focus-management-apis:locked-for-focus-2><a href=#locked-for-focus>locked for focus</a></i>.</ol>
- <p>The <dfn id=dom-blur><code>blur()</code></dfn> method, when invoked, should run the
- <a href=#unfocusing-steps id=focus-management-apis:unfocusing-steps>unfocusing steps</a> for the element on which the method was called. User agents may
- selectively or uniformly ignore calls to this method for usability reasons.</p>
- <p class=example>For example, if the <code id=focus-management-apis:dom-blur-2><a href=#dom-blur>blur()</a></code> method is unwisely
- being used to remove the focus ring for aesthetics reasons, the page would become unusable by
- keyboard users. Ignoring calls to this method would thus allow keyboard users to interact with the
- page.</p>
-
- <h3 id=assigning-keyboard-shortcuts>6.5 Assigning keyboard shortcuts</h3>
- <h4 id=introduction-9>6.5.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>Each element that can be activated or focused can be assigned a single key combination to
- activate it, using the <code id=introduction-9:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code> attribute.</p>
- <p>The exact shortcut is determined by the user agent, based on information about the user's
- keyboard, what keyboard shortcuts already exist on the platform, and what other shortcuts have
- been specified on the page, using the information provided in the <code id=introduction-9:the-accesskey-attribute-2><a href=#the-accesskey-attribute>accesskey</a></code> attribute as a guide.</p>
- <p>In order to ensure that a relevant keyboard shortcut is available on a wide variety of input
- devices, the author can provide a number of alternatives in the <code id=introduction-9:the-accesskey-attribute-3><a href=#the-accesskey-attribute>accesskey</a></code> attribute.</p>
- <p>Each alternative consists of a single character, such as a letter or digit.</p>
- <p>User agents can provide users with a list of the keyboard shortcuts, but authors are encouraged
- to do so also. The <code id=introduction-9:dom-accesskeylabel><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute returns a
- string representing the actual key combination assigned by the user agent.</p>
- <div class=example>
- <p>In this example, an author has provided a button that can be invoked using a shortcut key. To
- support full keyboards, the author has provided "C" as a possible key. To support devices
- equipped only with numeric keypads, the author has provided "1" as another possibly key.</p>
- <pre><input type=button value=Collect onclick="collect()"
- <strong>accesskey="C 1"</strong> id=c></pre>
- </div>
- <div class=example>
- <p>To tell the user what the shortcut key is, the author has this script here opted to explicitly
- add the key combination to the button's label:</p>
- <pre>function addShortcutKeyLabel(button) {
- <strong> if (button.accessKeyLabel != '')
- button.value += ' (' + button.accessKeyLabel + ')';</strong>
- }
- addShortcutKeyLabel(document.getElementById('c'));</pre>
- <p>Browsers on different platforms will show different labels, even for the same key combination,
- based on the convention prevalent on that platform. For example, if the key combination is the
- Control key, the Shift key, and the letter C, a Windows browser might display
- "<samp>Ctrl+Shift+C</samp>", whereas a Mac browser might display "<samp>^⇧C</samp>", while
- an Emacs browser might just display "<samp>C-C</samp>". Similarly, if the key combination is the
- Alt key and the Escape key, Windows might use "<samp>Alt+Esc</samp>", Mac might use
- "<samp>⌥⎋</samp>", and an Emacs browser might use "<samp>M-ESC</samp>" or
- "<samp>ESC ESC</samp>".</p>
- <p>In general, therefore, it is unwise to attempt to parse the value returned from the <code id=introduction-9:dom-accesskeylabel-2><a href=#dom-accesskeylabel>accessKeyLabel</a></code> IDL attribute.</p>
- </div>
- <h4 id=the-accesskey-attribute>6.5.2 The <dfn><code>accesskey</code></dfn> attribute</h4>
- <p>All <a href=#html-elements id=the-accesskey-attribute:html-elements>HTML elements</a> may have the <code id=the-accesskey-attribute:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code>
- content attribute set. The <code id=the-accesskey-attribute:the-accesskey-attribute-2><a href=#the-accesskey-attribute>accesskey</a></code> attribute's value is used
- by the user agent as a guide for creating a keyboard shortcut that activates or focuses the
- element.</p>
- <p>If specified, the value must be an <a href=#ordered-set-of-unique-space-separated-tokens id=the-accesskey-attribute:ordered-set-of-unique-space-separated-tokens>ordered set of unique space-separated tokens</a>
- that are <a href=#case-sensitive id=the-accesskey-attribute:case-sensitive>case-sensitive</a>, each of which must be exactly one Unicode code point in
- length.</p>
- <div class=example>
- <p>In the following example, a variety of links are given with access keys so that keyboard users
- familiar with the site can more quickly navigate to the relevant pages:</p>
- <pre><nav>
- <p>
- <a title="Consortium Activities" accesskey="A" href="/Consortium/activities">Activities</a> |
- <a title="Technical Reports and Recommendations" accesskey="T" href="/TR/">Technical Reports</a> |
- <a title="Alphabetical Site Index" accesskey="S" href="/Consortium/siteindex">Site Index</a> |
- <a title="About This Site" accesskey="B" href="/Consortium/">About Consortium</a> |
- <a title="Contact Consortium" accesskey="C" href="/Consortium/contact">Contact</a>
- </p>
- </nav></pre>
- </div>
- <div class=example>
- <p>In the following example, the search field is given two possible access keys, "s" and "0" (in
- that order). A user agent on a device with a full keyboard might pick <kbd><kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>S</kbd></kbd> as the shortcut key,
- while a user agent on a small device with just a numeric keypad might pick just the plain
- unadorned key <kbd><kbd>0</kbd></kbd>:</p>
- <pre><form action="/search">
- <label>Search: <input type="search" name="q" accesskey="s 0"></label>
- <input type="submit">
- </form></pre>
- </div>
- <div class=example>
- <p>In the following example, a button has possible access keys described. A script then tries to
- update the button's label to advertise the key combination the user agent selected.</p>
- <pre><input type=submit accesskey="N @ 1" value="Compose">
- ...
- <script>
- function labelButton(button) {
- if (button.accessKeyLabel)
- button.value += ' (' + button.accessKeyLabel + ')';
- }
- var inputs = document.getElementsByTagName('input');
- for (var i = 0; i < inputs.length; i += 1) {
- if (inputs[i].type == "submit")
- labelButton(inputs[i]);
- }
- </script></pre>
- <p>On one user agent, the button's label might become "<samp>Compose (⌘N)</samp>". On
- another, it might become "<samp>Compose (Alt+⇧+1)</samp>". If the user agent doesn't
- assign a key, it will be just "<samp>Compose</samp>". The exact string depends on what the
- <a href=#assigned-access-key id=the-accesskey-attribute:assigned-access-key>assigned access key</a> is, and on how the user agent represents that key
- combination.</p>
- </div>
-
- <h4 id=processing-model-7>6.5.3 Processing model</h4>
- <p>An element's <dfn id=assigned-access-key>assigned access key</dfn> is a key combination derived from the element's
- <code id=processing-model-7:the-accesskey-attribute><a href=#the-accesskey-attribute>accesskey</a></code> content attribute. Initially, an element must not
- have an <a href=#assigned-access-key id=processing-model-7:assigned-access-key>assigned access key</a>.</p>
- <p>Whenever an element's <code id=processing-model-7:the-accesskey-attribute-2><a href=#the-accesskey-attribute>accesskey</a></code> attribute is set, changed,
- or removed, the user agent must update the element's <a href=#assigned-access-key id=processing-model-7:assigned-access-key-2>assigned access key</a> by running
- the following steps:</p>
- <ol><li><p>If the element has no <code id=processing-model-7:the-accesskey-attribute-3><a href=#the-accesskey-attribute>accesskey</a></code> attribute, then skip
- to the <i>fallback</i> step below.<li><p>Otherwise, <a href=#split-a-string-on-spaces id=processing-model-7:split-a-string-on-spaces>split the attribute's value on
- spaces</a>, and let <var>keys</var> be the resulting tokens.<li>
- <p>For each value in <var>keys</var> in turn, in the order the tokens appeared in the
- attribute's value, run the following substeps:</p>
- <ol><li><p>If the value is not a string exactly one Unicode code point in length, then skip the
- remainder of these steps for this value.<li><p>If the value does not correspond to a key on the system's keyboard, then skip the
- remainder of these steps for this value.<li><p>If the user agent can find a mix of zero or more modifier keys that, combined with the
- key that corresponds to the value given in the attribute, can be used as the access key, then
- the user agent may assign that combination of keys as the element's <a href=#assigned-access-key id=processing-model-7:assigned-access-key-3>assigned access
- key</a> and abort these steps.
- <a href=#fingerprinting-vector id=processing-model-7:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </ol>
- <li><p><i>Fallback</i>: Optionally, the user agent may assign a key combination of its choosing
- as the element's <a href=#assigned-access-key id=processing-model-7:assigned-access-key-4>assigned access key</a> and then abort these steps.<li><p>If this step is reached, the element has no <a href=#assigned-access-key id=processing-model-7:assigned-access-key-5>assigned access key</a>.</ol>
- <p>Once a user agent has selected and assigned an access key for an element, the user agent should
- not change the element's <a href=#assigned-access-key id=processing-model-7:assigned-access-key-6>assigned access key</a> unless the <code id=processing-model-7:the-accesskey-attribute-4><a href=#the-accesskey-attribute>accesskey</a></code> content attribute is changed or the element is moved to
- another <code id=processing-model-7:document><a href=#document>Document</a></code>.</p>
- <p>When the user presses the key combination corresponding to the <a href=#assigned-access-key id=processing-model-7:assigned-access-key-7>assigned access key</a>
- for an element, if the element <a href=#concept-command id=processing-model-7:concept-command>defines a command</a>, the
- command's <a href=#command-facet-hiddenstate id=processing-model-7:command-facet-hiddenstate>Hidden State</a> facet is false (visible),
- the command's <a href=#command-facet-disabledstate id=processing-model-7:command-facet-disabledstate>Disabled State</a> facet is also false
- (enabled), the element is <a href=#in-a-document id=processing-model-7:in-a-document>in a <code>Document</code></a> that has an associated
- <a href=#browsing-context id=processing-model-7:browsing-context>browsing context</a>, and neither the element nor any of its ancestors has a <code id=processing-model-7:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute specified, then the user agent must trigger the <a href=#command-facet-action id=processing-model-7:command-facet-action>Action</a> of the command.</p>
- <p class=note>User agents <a href=#expose-commands-in-ui>might expose</a> elements that have
- an <code id=processing-model-7:the-accesskey-attribute-5><a href=#the-accesskey-attribute>accesskey</a></code> attribute in other ways as well, e.g. in a menu
- displayed in response to a specific key combination.</p>
- <hr>
- <p>The <dfn id=dom-accesskey><code>accessKey</code></dfn> IDL attribute must
- <a href=#reflect id=processing-model-7:reflect>reflect</a> the <code id=processing-model-7:the-accesskey-attribute-6><a href=#the-accesskey-attribute>accesskey</a></code> content attribute.</p>
- <p>The <dfn id=dom-accesskeylabel><code>accessKeyLabel</code></dfn> IDL attribute must return
- a string that represents the element's <a href=#assigned-access-key id=processing-model-7:assigned-access-key-8>assigned access key</a>, if any. If the element
- does not have one, then the IDL attribute must return the empty string.</p>
-
- <h3 id=editing-2>6.6 Editing</h3>
- <h4 id=contenteditable>6.6.1 Making document regions editable: The <code id=contenteditable:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> content attribute</h4>
- <p>The <dfn id=attr-contenteditable><code>contenteditable</code></dfn> attribute is an
- <a href=#enumerated-attribute id=contenteditable:enumerated-attribute>enumerated attribute</a> whose keywords are the empty string, <code>true</code>,
- and <code>false</code>. The empty string and the <code>true</code> keyword map
- to the <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state.
- In addition, there is a third state, the <i>inherit</i> state, which is the <i id=contenteditable:missing-value-default><a href=#missing-value-default>missing value default</a></i> (and the <i id=contenteditable:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i>).</p>
- <p>The <i>true</i> state indicates that the element is editable. The <i>inherit</i> state
- indicates that the element is editable if its parent is. The <i>false</i> state indicates that the
- element is not editable.</p>
- <dl class=domintro><dt><var>element</var> . <code id=contenteditable:dom-contenteditable><a href=#dom-contenteditable>contentEditable</a></code> [ = <var>value</var> ]<dd>
- <p>Returns "<code>true</code>", "<code>false</code>", or "<code>inherit</code>", based on the state of the <code id=contenteditable:attr-contenteditable-2><a href=#attr-contenteditable>contenteditable</a></code> attribute.</p>
- <p>Can be set, to change that state.</p>
- <p>Throws a <code id=contenteditable:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception if the new value isn't one of those strings.</p>
- <dt><var>element</var> . <code id=contenteditable:dom-iscontenteditable><a href=#dom-iscontenteditable>isContentEditable</a></code><dd>
- <p>Returns true if the element is editable; otherwise, returns false.</p>
- </dl>
-
- <p>The <dfn id=dom-contenteditable><code>contentEditable</code></dfn> IDL attribute, on
- getting, must return the string "<code>true</code>" if the content attribute is set to
- the true state, "<code>false</code>" if the content attribute is set to the false state,
- and "<code>inherit</code>" otherwise. On setting, if the new value is an <a href=#ascii-case-insensitive id=contenteditable:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the string "<code>inherit</code>" then the content
- attribute must be removed, if the new value is an <a href=#ascii-case-insensitive id=contenteditable:ascii-case-insensitive-2>ASCII case-insensitive</a> match for
- the string "<code>true</code>" then the content attribute must be set to the string
- "<code>true</code>", if the new value is an <a href=#ascii-case-insensitive id=contenteditable:ascii-case-insensitive-3>ASCII case-insensitive</a> match for
- the string "<code>false</code>" then the content attribute must be set to the string
- "<code>false</code>", and otherwise the attribute setter must throw a
- <code id=contenteditable:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception.</p>
- <p>The <dfn id=dom-iscontenteditable><code>isContentEditable</code></dfn> IDL attribute, on
- getting, must return true if the element is either an <a href=#editing-host id=contenteditable:editing-host>editing host</a> or
- <a href=#editable id=contenteditable:editable>editable</a>, and false otherwise.</p>
-
- <h4 id=making-entire-documents-editable:-the-designmode-idl-attribute>6.6.2 Making entire documents editable: The <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode><a href=#designMode>designMode</a></code> IDL attribute</h4>
-
- <p>Documents have a <dfn id=designMode><code>designMode</code></dfn>, which can be either enabled or
- disabled.</p>
-
- <dl class=domintro><dt><var>document</var> . <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-2><a href=#designMode>designMode</a></code> [ = <var>value</var> ]<dd>
- <p>Returns "<code>on</code>" if the document is editable, and "<code>off</code>" if it isn't.</p>
- <p>Can be set, to change the document's current state. This focuses the document and resets the
- selection in that document.</p>
- </dl>
-
- <p>The <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-3><a href=#designMode>designMode</a></code> IDL attribute on the
- <code id=making-entire-documents-editable:-the-designmode-idl-attribute:document><a href=#document>Document</a></code> object takes two values, "<code>on</code>" and "<code>off</code>". On setting, the new value must be compared in an <a href=#ascii-case-insensitive id=making-entire-documents-editable:-the-designmode-idl-attribute:ascii-case-insensitive>ASCII
- case-insensitive</a> manner to these two values; if it matches the "<code>on</code>"
- value, then <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-4><a href=#designMode>designMode</a></code> must be enabled, and if it
- matches the "<code>off</code>" value, then <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-5><a href=#designMode>designMode</a></code> must be disabled. Other values must be
- ignored.</p>
- <p>On getting, if <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-6><a href=#designMode>designMode</a></code> is enabled, the IDL
- attribute must return the value "<code>on</code>"; otherwise it is disabled, and the
- attribute must return the value "<code>off</code>".</p>
- <p>The last state set must persist until the document is destroyed or the state is changed.
- Initially, documents must have their <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-7><a href=#designMode>designMode</a></code>
- disabled.</p>
- <p>When the <code id=making-entire-documents-editable:-the-designmode-idl-attribute:designMode-8><a href=#designMode>designMode</a></code> changes from being disabled to
- being enabled, the user agent must synchronously reset the document's <a href=#active-range id=making-entire-documents-editable:-the-designmode-idl-attribute:active-range>active range</a>'s
- start and end boundary points to be at the start of the <code id=making-entire-documents-editable:-the-designmode-idl-attribute:document-2><a href=#document>Document</a></code> and then run the
- <a href=#focusing-steps id=making-entire-documents-editable:-the-designmode-idl-attribute:focusing-steps>focusing steps</a> for the root element of the <code id=making-entire-documents-editable:-the-designmode-idl-attribute:document-3><a href=#document>Document</a></code>, if any.</p>
-
- <h4 id=best-practices-for-in-page-editors>6.6.3 Best practices for in-page editors</h4>
- <p>Authors are encouraged to set the 'white-space' property on <a href=#editing-host id=best-practices-for-in-page-editors:editing-host>editing
- hosts</a> and on markup that was originally created through these editing mechanisms to the
- value 'pre-wrap'. Default HTML whitespace handling is not well suited to WYSIWYG editing, and line
- wrapping will not work correctly in some corner cases if 'white-space' is left at its default
- value.</p>
- <div class=example>
- <p>As an example of problems that occur if the default 'normal' value is used instead, consider
- the case of the user typing "<kbd>yellow␣␣ball</kbd>", with two spaces (here
- represented by "␣") between the words. With the editing rules in place for the default
- value of 'white-space' ('normal'), the resulting markup will either consist of
- "<samp>yellow&nbsp; ball</samp>" or "<samp>yellow &nbsp;ball</samp>"; i.e.,
- there will be a non-breaking space between the two words in addition to the regular space. This
- is necessary because the 'normal' value for 'white-space' requires adjacent regular spaces to be
- collapsed together.</p>
- <p>In the former case, "<samp>yellow⍽</samp>" might wrap to the next line ("⍽"
- being used here to represent a non-breaking space) even though "<samp>yellow</samp>" alone might
- fit at the end of the line; in the latter case, "<samp>⍽ball</samp>", if wrapped to the
- start of the line, would have visible indentation from the non-breaking space.</p>
- <p>When 'white-space' is set to 'pre-wrap', however, the editing rules will instead simply put
- two regular spaces between the words, and should the two words be split at the end of a line, the
- spaces would be neatly removed from the rendering.</p>
- </div>
- <h4 id=editing-apis>6.6.4 Editing APIs</h4>
- <p>The definition of the terms <dfn id=active-range>active range</dfn>, <dfn id=editing-host>editing host</dfn>, and
- <dfn id=editable>editable</dfn>, the user interface requirements of elements that are <a href=#editing-host id=editing-apis:editing-host>editing hosts</a> or <a href=#editable id=editing-apis:editable>editable</a>, the
- <dfn id=execCommand><code>execCommand()</code></dfn>,
- <dfn id=dom-document-querycommandenabled><code>queryCommandEnabled()</code></dfn>,
- <dfn id=dom-document-querycommandindeterm><code>queryCommandIndeterm()</code></dfn>,
- <dfn id=dom-document-querycommandstate><code>queryCommandState()</code></dfn>,
- <dfn id=dom-document-querycommandsupported><code>queryCommandSupported()</code></dfn>, and
- <dfn id=dom-document-querycommandvalue><code>queryCommandValue()</code></dfn>
- methods, text selections, and the <dfn id=delete-the-selection>delete the selection</dfn> algorithm are defined in the
- HTML Editing APIs specification. <a href=#refsEDITING>[EDITING]</a>
- </p>
-
- <h4 id=spelling-and-grammar-checking>6.6.5 Spelling and grammar checking</h4>
-
- <p>User agents can support the checking of spelling and grammar of editable text, either in form
- controls (such as the value of <code id=spelling-and-grammar-checking:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements), or in elements in an <a href=#editing-host id=spelling-and-grammar-checking:editing-host>editing
- host</a> (e.g. using <code id=spelling-and-grammar-checking:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>).</p>
- <p>For each element, user agents must establish a <dfn id=concept-spellcheck-default>default
- behavior</dfn>, either through defaults or through preferences expressed by the user. There are
- three possible default behaviors for each element:</p>
- <dl><dt><dfn id=concept-spellcheck-default-true>true-by-default</dfn>
- <dd>The element will be checked for spelling and grammar if its contents are editable.
- <dt><dfn id=concept-spellcheck-default-false>false-by-default</dfn>
- <dd>The element will never be checked for spelling and grammar.
- <dt><dfn id=concept-spellcheck-default-inherit>inherit-by-default</dfn>
- <dd>The element's default behavior is the same as its parent element's. Elements that have no
- parent element cannot have this as their default behavior.
- </dl>
- <hr>
-
- <p>The <dfn id=attr-spellcheck><code>spellcheck</code></dfn> attribute is an <a href=#enumerated-attribute id=spelling-and-grammar-checking:enumerated-attribute>enumerated
- attribute</a> whose keywords are the empty string, <code>true</code> and <code>false</code>. The empty string and the <code>true</code> keyword map to the
- <i>true</i> state. The <code>false</code> keyword maps to the <i>false</i> state. In
- addition, there is a third state, the <i>default</i> state, which is the <i id=spelling-and-grammar-checking:missing-value-default><a href=#missing-value-default>missing value default</a></i> (and the <i id=spelling-and-grammar-checking:invalid-value-default><a href=#invalid-value-default>invalid value default</a></i>).</p>
- <p class=note>The <i>true</i> state indicates that the element is to have its spelling and
- grammar checked. The <i>default</i> state indicates that the element is to act according to a
- default behavior, possibly based on the parent element's own <code id=spelling-and-grammar-checking:attr-spellcheck><a href=#attr-spellcheck>spellcheck</a></code> state, as defined below. The <i>false</i> state
- indicates that the element is not to be checked.</p>
-
- <hr>
-
- <dl class=domintro><dt><var>element</var> . <code id=spelling-and-grammar-checking:dom-spellcheck><a href=#dom-spellcheck>spellcheck</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if the element is to have its spelling and grammar checked; otherwise, returns
- false.</p>
- <p>Can be set, to override the default and set the <code id=spelling-and-grammar-checking:attr-spellcheck-2><a href=#attr-spellcheck>spellcheck</a></code> content attribute.</p>
- <dt><var>element</var> . <code id=spelling-and-grammar-checking:dom-forcespellcheck><a href=#dom-forcespellcheck>forceSpellCheck</a></code>()<dd>
- <p>Forces the user agent to report spelling and grammar errors on the element (if checking is
- enabled), even if the user has never focused the element. (If the method is not invoked, user
- agents can hide errors in text that wasn't just entered by the user.)</p>
- </dl>
-
- <p>The <dfn id=dom-spellcheck><code>spellcheck</code></dfn> IDL attribute, on getting, must
- return true if the element's <code id=spelling-and-grammar-checking:attr-spellcheck-3><a href=#attr-spellcheck>spellcheck</a></code> content attribute is
- in the <i>true</i> state, or if the element's <code id=spelling-and-grammar-checking:attr-spellcheck-4><a href=#attr-spellcheck>spellcheck</a></code>
- content attribute is in the <i>default</i> state and the element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default>default behavior</a> is <a href=#concept-spellcheck-default-true id=spelling-and-grammar-checking:concept-spellcheck-default-true>true-by-default</a>, or if the element's <code id=spelling-and-grammar-checking:attr-spellcheck-5><a href=#attr-spellcheck>spellcheck</a></code> content attribute is in the <i>default</i> state and the
- element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default-2>default behavior</a> is <a href=#concept-spellcheck-default-inherit id=spelling-and-grammar-checking:concept-spellcheck-default-inherit>inherit-by-default</a> and the element's parent
- element's <code id=spelling-and-grammar-checking:dom-spellcheck-2><a href=#dom-spellcheck>spellcheck</a></code> IDL attribute would return true;
- otherwise, if none of those conditions applies, then the attribute must instead return false.</p>
- <p class=note>The <code id=spelling-and-grammar-checking:dom-spellcheck-3><a href=#dom-spellcheck>spellcheck</a></code> IDL attribute is not affected
- by user preferences that override the <code id=spelling-and-grammar-checking:attr-spellcheck-6><a href=#attr-spellcheck>spellcheck</a></code> content
- attribute, and therefore might not reflect the actual spellchecking state.</p>
- <p>On setting, if the new value is true, then the element's <code id=spelling-and-grammar-checking:attr-spellcheck-7><a href=#attr-spellcheck>spellcheck</a></code> content attribute must be set to the literal string
- "<code>true</code>", otherwise it must be set to the literal string "<code>false</code>".
- <hr>
- <p>User agents must only consider the following pieces of text as checkable for the purposes of
- this feature:</p>
- <ul><li>The <a href=#concept-fe-value id=spelling-and-grammar-checking:concept-fe-value>value</a> of <code id=spelling-and-grammar-checking:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=spelling-and-grammar-checking:attr-input-type><a href=#attr-input-type>type</a></code> attributes are in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="spelling-and-grammar-checking:text-(type=text)-state-and-search-state-(type=search)">Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" id="spelling-and-grammar-checking:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>,
- <a href="#url-state-(type=url)" id="spelling-and-grammar-checking:url-state-(type=url)">URL</a>, or <a href="#e-mail-state-(type=email)" id="spelling-and-grammar-checking:e-mail-state-(type=email)">E-mail</a> states and that are <i id=spelling-and-grammar-checking:concept-fe-mutable><a href=#concept-fe-mutable>mutable</a></i> (i.e. that do not have the <code id=spelling-and-grammar-checking:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code> attribute specified and that are not <a href=#concept-fe-disabled id=spelling-and-grammar-checking:concept-fe-disabled>disabled</a>).<li>The <a href=#concept-fe-value id=spelling-and-grammar-checking:concept-fe-value-2>value</a> of <code id=spelling-and-grammar-checking:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements that do not
- have a <code id=spelling-and-grammar-checking:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code> attribute and that are not <a href=#concept-fe-disabled id=spelling-and-grammar-checking:concept-fe-disabled-2>disabled</a>.<li>Text in <code id=spelling-and-grammar-checking:text><a href=#text>Text</a></code> nodes that are children of <a href=#editing-host id=spelling-and-grammar-checking:editing-host-2>editing
- hosts</a> or <a href=#editable id=spelling-and-grammar-checking:editable>editable</a> elements.<li>Text in attributes of <a href=#editable id=spelling-and-grammar-checking:editable-2>editable</a> elements.</ul>
- <p>For text that is part of a <code id=spelling-and-grammar-checking:text-2><a href=#text>Text</a></code> node, the element with which the text is
- associated is the element that is the immediate parent of the first character of the word,
- sentence, or other piece of text. For text in attributes, it is the attribute's element. For the
- values of <code id=spelling-and-grammar-checking:the-input-element-2><a href=#the-input-element>input</a></code> and <code id=spelling-and-grammar-checking:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> elements, it is the element itself.</p>
- <p>To determine if a word, sentence, or other piece of text in an applicable element (as defined
- above) is to have spelling- and grammar-checking enabled, the UA must use the following
- algorithm:</p>
- <ol><li>If the user has disabled the checking for this text, then the checking is disabled.<li>Otherwise, if the user has forced the checking for this text to always be enabled, then the
- checking is enabled.<li>Otherwise, if the element with which the text is associated has a <code id=spelling-and-grammar-checking:attr-spellcheck-8><a href=#attr-spellcheck>spellcheck</a></code> content attribute, then: if that attribute is in the
- <i>true</i> state, then checking is enabled; otherwise, if that attribute is in the <i>false</i>
- state, then checking is disabled.<li>Otherwise, if there is an ancestor element with a <code id=spelling-and-grammar-checking:attr-spellcheck-9><a href=#attr-spellcheck>spellcheck</a></code> content attribute that is not in the <i>default</i>
- state, then: if the nearest such ancestor's <code id=spelling-and-grammar-checking:attr-spellcheck-10><a href=#attr-spellcheck>spellcheck</a></code>
- content attribute is in the <i>true</i> state, then checking is enabled; otherwise, checking is
- disabled.<li>Otherwise, if the element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default-3>default behavior</a>
- is <a href=#concept-spellcheck-default-true id=spelling-and-grammar-checking:concept-spellcheck-default-true-2>true-by-default</a>, then checking is
- enabled.<li>Otherwise, if the element's <a href=#concept-spellcheck-default id=spelling-and-grammar-checking:concept-spellcheck-default-4>default behavior</a>
- is <a href=#concept-spellcheck-default-false id=spelling-and-grammar-checking:concept-spellcheck-default-false>false-by-default</a>, then checking is
- disabled.<li>Otherwise, if the element's parent element has <em>its</em> checking enabled, then checking
- is enabled.<li>Otherwise, checking is disabled.</ol>
- <p>If the checking is enabled for a word/sentence/text, the user agent should indicate spelling
- and grammar errors in that text. User agents should take into account the other semantics given in
- the document when suggesting spelling and grammar corrections. User agents may use the language of
- the element to determine what spelling and grammar rules to use, or may use the user's preferred
- language settings. UAs should use <code id=spelling-and-grammar-checking:the-input-element-3><a href=#the-input-element>input</a></code> element attributes such as <code id=spelling-and-grammar-checking:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code> to ensure that the resulting value is valid, where
- possible.</p>
- <p>If checking is disabled, the user agent should not indicate spelling or grammar errors for that
- text.</p>
- <p>Even when checking is enabled, user agents may opt to not report spelling or grammar errors in
- text that the user agent deems the user has no interest in having checked (e.g. text that was
- already present when the page was loaded, or that the user did not type, or text in controls that
- the user has not focused, or in parts of e-mail addresses that the user agent is not confident
- were misspelt). The <dfn id=dom-forcespellcheck><code>forceSpellCheck()</code></dfn> method,
- when invoked on an element, must override this behavior, forcing the user agent to consider all
- spelling and grammar errors in text in that element for which checking is enabled to be of
- interest to the user.</p>
- <div class=example>
- <p>The element with ID "a" in the following example would be the one used to determine if the
- word "Hello" is checked for spelling errors. In this example, it would not be.</p>
- <pre><div contenteditable="true">
- <span spellcheck="false" id="a">Hell</span><em>o!</em>
- </div></pre>
- <p>The element with ID "b" in the following example would have checking enabled (the leading
- space character in the attribute's value on the <code id=spelling-and-grammar-checking:the-input-element-4><a href=#the-input-element>input</a></code> element causes the attribute
- to be ignored, so the ancestor's value is used instead, regardless of the default).</p>
- <pre class=bad><p spellcheck="true">
- <label>Name: <input spellcheck=" false" id="b"></label>
- </p></pre>
- </div>
-
- <p class=note>This specification does not define the user interface for spelling and grammar
- checkers. A user agent could offer on-demand checking, could perform continuous checking while the
- checking is enabled, or could use other interfaces.</p>
- <h3 id=dnd>6.7 <dfn>Drag and drop</dfn></h3>
- <p>This section defines an event-based drag-and-drop mechanism.</p>
- <p>This specification does not define exactly what a <em>drag-and-drop operation</em> actually
- is.</p>
- <p>On a visual medium with a pointing device, a drag operation could be the default action of a
- <code id=dnd:event-mousedown><a href=#event-mousedown>mousedown</a></code> event that is followed by a series of <code id=dnd:event-mousemove><a href=#event-mousemove>mousemove</a></code> events, and the drop could be triggered by the mouse
- being released.</p>
- <p>When using an input modality other than a pointing device, users would probably have to
- explicitly indicate their intention to perform a drag-and-drop operation, stating what they wish
- to drag and where they wish to drop it, respectively.</p>
-
- <p>However it is implemented, drag-and-drop operations must have a starting point (e.g. where the
- mouse was clicked, or the start of the selection or element that was selected for the drag), may
- have any number of intermediate steps (elements that the mouse moves over during a drag, or
- elements that the user picks as possible drop points as he cycles through possibilities), and must
- either have an end point (the element above which the mouse button was released, or the element
- that was finally selected), or be canceled. The end point must be the last element selected as a
- possible drop point before the drop occurs (so if the operation is not canceled, there must be at
- least one element in the middle step).</p>
-
- <h4 id=introduction-10>6.7.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To make an element draggable is simple: give the element a <code id=introduction-10:the-draggable-attribute><a href=#the-draggable-attribute>draggable</a></code> attribute, and set an event listener for <code id=introduction-10:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> that stores the data being dragged.</p>
- <p>The event handler typically needs to check that it's not a text selection that is being
- dragged, and then needs to store data into the <code id=introduction-10:datatransfer><a href=#datatransfer>DataTransfer</a></code> object and set the
- allowed effects (copy, move, link, or some combination).</p>
- <p>For example:</p>
- <pre><p>What fruits do you like?</p>
- <ol ondragstart="dragStartHandler(event)">
- <li draggable="true" data-value="fruit-apple">Apples</li>
- <li draggable="true" data-value="fruit-orange">Oranges</li>
- <li draggable="true" data-value="fruit-pear">Pears</li>
- </ol>
- <script>
- var internalDNDType = 'text/x-example'; // set this to something specific to your site
- function dragStartHandler(event) {
- if (event.target instanceof HTMLLIElement) {
- // use the element's data-value="" attribute as the value to be moving:
- event.dataTransfer.setData(internalDNDType, event.target.dataset.value);
- event.dataTransfer.effectAllowed = 'move'; // only allow moves
- } else {
- event.preventDefault(); // don't allow selection to be dragged
- }
- }
- </script></pre>
- <hr>
- <p>To accept a drop, the drop target has to have a <code id=introduction-10:the-dropzone-attribute><a href=#the-dropzone-attribute>dropzone</a></code>
- attribute and listen to the <code id=introduction-10:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event.</p>
- <p>The value of the <code id=introduction-10:the-dropzone-attribute-2><a href=#the-dropzone-attribute>dropzone</a></code> attribute specifies what kind of
- data to accept (e.g. "<code>string:text/plain</code>" to accept any text strings, or
- "<code>file:image/png</code>" to accept a PNG image file) and what kind of feedback to
- give (e.g. "<code>move</code>" to indicate that the data will be moved).</p>
- <p class=note>Instead of using the <code id=introduction-10:the-dropzone-attribute-3><a href=#the-dropzone-attribute>dropzone</a></code> attribute, a drop
- target can handle the <code id=introduction-10:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> event (to report whether or
- not the drop target is to accept the drop) and the <code id=introduction-10:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code>
- event (to specify what feedback is to be shown to the user).</p>
- <p>The <code id=introduction-10:event-dnd-drop-2><a href=#event-dnd-drop>drop</a></code> event allows the actual drop to be performed. This
- event needs to be canceled, so that the <code id=introduction-10:dom-datatransfer-dropeffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute's value can be used by the source
- (otherwise it's reset).</p>
- <p>For example:</p>
- <pre><p>Drop your favorite fruits below:</p>
- <ol dropzone="move string:text/x-example" ondrop="dropHandler(event)">
- <!-- don't forget to change the "text/x-example" type to something
- specific to your site -->
- </ol>
- <script>
- var internalDNDType = 'text/x-example'; // set this to something specific to your site
- function dropHandler(event) {
- var li = document.createElement('li');
- var data = event.dataTransfer.getData(internalDNDType);
- if (data == 'fruit-apple') {
- li.textContent = 'Apples';
- } else if (data == 'fruit-orange') {
- li.textContent = 'Oranges';
- } else if (data == 'fruit-pear') {
- li.textContent = 'Pears';
- } else {
- li.textContent = 'Unknown Fruit';
- }
- event.target.appendChild(li);
- }
- </script></pre>
- <hr>
- <p>To remove the original element (the one that was dragged) from the display, the <code id=introduction-10:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code> event can be used.</p>
- <p>For our example here, that means updating the original markup to handle that event:</p>
- <pre><p>What fruits do you like?</p>
- <ol ondragstart="dragStartHandler(event)" ondragend="dragEndHandler(event)">
- <em>...as before...</em>
- </ol>
- <script>
- function dragStartHandler(event) {
- // <em>...as before...</em>
- }
- function dragEndHandler(event) {
- if (event.dataTransfer.dropEffect == 'move') {
- // remove the dragged element
- event.target.parentNode.removeChild(event.target);
- }
- }
- </script></pre>
- <h4 id=the-drag-data-store>6.7.2 The drag data store</h4>
- <p>The data that underlies a drag-and-drop operation, known as the <dfn id=drag-data-store>drag data store</dfn>,
- consists of the following information:</p>
- <ul><li><p>A <dfn id=drag-data-store-item-list>drag data store item list</dfn>, which is a list of items representing the dragged
- data, each consisting of the following information:</p>
- <dl><dt><dfn id=the-drag-data-item-kind>The drag data item kind</dfn><dd>
- <p>The kind of data:</p>
- <dl><dt><i>Plain Unicode string</i><dd>
- <p>Text.</p>
- <dt><i>File</i><dd>
- <p>Binary data with a file name.</p>
- </dl>
- <dt><dfn id=the-drag-data-item-type-string>The drag data item type string</dfn><dd>
- <p>A Unicode string giving the type or format of the data, generally given by a <a href=#mime-type id=the-drag-data-store:mime-type>MIME
- type</a>. Some values that are not <a href=#mime-type id=the-drag-data-store:mime-type-2>MIME types</a> are
- special-cased for legacy reasons. The API does not enforce the use of <a href=#mime-type id=the-drag-data-store:mime-type-3>MIME types</a>; other values can be used as well. In all cases, however, the values
- are all <a href=#converted-to-ascii-lowercase id=the-drag-data-store:converted-to-ascii-lowercase>converted to ASCII lowercase</a> by the API.</p>
- <p class=note>Strings that contain <a href=#space-character id=the-drag-data-store:space-character>space characters</a>
- cannot be used with the <code id=the-drag-data-store:the-dropzone-attribute><a href=#the-dropzone-attribute>dropzone</a></code> attribute, so authors are
- encouraged to use only <a href=#mime-type id=the-drag-data-store:mime-type-4>MIME types</a> or custom strings (without
- spaces).</p>
- <p>There is a limit of one <i>Plain Unicode string</i> item per <a href=#the-drag-data-item-type-string id=the-drag-data-store:the-drag-data-item-type-string>item type string</a>.</p>
- <dt>The actual data<dd><p>A Unicode or binary string, in some cases with a file name (itself a Unicode string),
- as per <a href=#the-drag-data-item-kind id=the-drag-data-store:the-drag-data-item-kind>the drag data item kind</a>.</dl>
- <p>The <a href=#drag-data-store-item-list id=the-drag-data-store:drag-data-store-item-list>drag data store item list</a> is ordered in the order that the items were added
- to the list; most recently added last.</p>
- <li>
- <p>The following information, used to generate the UI feedback during the drag:</p>
- <ul><li>User-agent-defined default feedback information, known as the <dfn id=drag-data-store-default-feedback>drag data store default
- feedback</dfn>.<li>Optionally, a bitmap image and the coordinate of a point within that image, known as the
- <dfn id=drag-data-store-bitmap>drag data store bitmap</dfn> and <dfn id=drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate</dfn>.</ul>
- <li>
- <p>A <dfn id=drag-data-store-mode>drag data store mode</dfn>, which is one of the following:</p>
- <dl><dt><dfn id=concept-dnd-rw>Read/write mode</dfn><dd>
- <p>For the <code id=the-drag-data-store:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event. New data can be added to the
- <a href=#drag-data-store id=the-drag-data-store:drag-data-store>drag data store</a>.</p>
- <dt><dfn id=concept-dnd-ro>Read-only mode</dfn><dd>
- <p>For the <code id=the-drag-data-store:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event. The list of items representing dragged
- data can be read, including the data. No new data can be added.</p>
- <dt><dfn id=concept-dnd-p>Protected mode</dfn><dd>
- <p>For all other events. The formats and kinds in the <a href=#drag-data-store id=the-drag-data-store:drag-data-store-2>drag data store</a> list of
- items representing dragged data can be enumerated, but the data itself is unavailable and no
- new data can be added.</p>
- </dl>
- <li>
- <p>A <dfn id=drag-data-store-allowed-effects-state>drag data store allowed effects state</dfn>, which is a string.</p>
- </ul>
- <p>When a <a href=#drag-data-store id=the-drag-data-store:drag-data-store-3>drag data store</a> is <dfn id=create-a-drag-data-store>created</dfn>, it
- must be initialised such that its <a href=#drag-data-store-item-list id=the-drag-data-store:drag-data-store-item-list-2>drag data store item list</a> is empty, it has no
- <a href=#drag-data-store-default-feedback id=the-drag-data-store:drag-data-store-default-feedback>drag data store default feedback</a>, it has no <a href=#drag-data-store-bitmap id=the-drag-data-store:drag-data-store-bitmap>drag data store bitmap</a> and
- <a href=#drag-data-store-hot-spot-coordinate id=the-drag-data-store:drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate</a>, its <a href=#drag-data-store-mode id=the-drag-data-store:drag-data-store-mode>drag data store mode</a> is <a href=#concept-dnd-p id=the-drag-data-store:concept-dnd-p>protected mode</a>, and its <a href=#drag-data-store-allowed-effects-state id=the-drag-data-store:drag-data-store-allowed-effects-state>drag data store allowed effects
- state</a> is the string "<code id=the-drag-data-store:dom-datatransfer-effectallowed-uninitialized><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>".</p>
- <h4 id=the-datatransfer-interface>6.7.3 The <code id=the-datatransfer-interface:datatransfer><a href=#datatransfer>DataTransfer</a></code> interface</h4>
- <p><code id=the-datatransfer-interface:datatransfer-2><a href=#datatransfer>DataTransfer</a></code> objects are used to expose the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store>drag data store</a> that
- underlies a drag-and-drop operation.</p>
- <pre class=idl>interface <dfn id=datatransfer>DataTransfer</dfn> {
- attribute DOMString <a href=#dom-datatransfer-dropeffect id=the-datatransfer-interface:dom-datatransfer-dropeffect>dropEffect</a>;
- attribute DOMString <a href=#dom-datatransfer-effectallowed id=the-datatransfer-interface:dom-datatransfer-effectallowed>effectAllowed</a>;
- readonly attribute <a href=#datatransferitemlist id=the-datatransfer-interface:datatransferitemlist>DataTransferItemList</a> <a href=#dom-datatransfer-items id=the-datatransfer-interface:dom-datatransfer-items>items</a>;
- void <a href=#dom-datatransfer-setdragimage id=the-datatransfer-interface:dom-datatransfer-setdragimage>setDragImage</a>(Element image, long x, long y);
- /* old interface */
- readonly attribute DOMString[] <a href=#dom-datatransfer-types id=the-datatransfer-interface:dom-datatransfer-types>types</a>;
- DOMString <a href=#dom-datatransfer-getdata id=the-datatransfer-interface:dom-datatransfer-getdata>getData</a>(DOMString format);
- void <a href=#dom-datatransfer-setdata id=the-datatransfer-interface:dom-datatransfer-setdata>setData</a>(DOMString format, DOMString data);
- void <a href=#dom-datatransfer-cleardata id=the-datatransfer-interface:dom-datatransfer-cleardata>clearData</a>(optional DOMString format);
- readonly attribute <a href=#filelist id=the-datatransfer-interface:filelist>FileList</a> <a href=#dom-datatransfer-files id=the-datatransfer-interface:dom-datatransfer-files>files</a>;
- };</pre>
- <dl class=domintro><dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-dropeffect-2><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the kind of operation that is currently selected. If the kind of operation isn't one
- of those that is allowed by the <code id=the-datatransfer-interface:dom-datatransfer-effectallowed-2><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute, then the operation will
- fail.</p>
- <p>Can be set, to change the selected operation.</p>
- <p>The possible values are "<code id=the-datatransfer-interface:dom-datatransfer-dropeffect-none><a href=#dom-datatransfer-dropeffect-none>none</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-dropeffect-copy><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-dropeffect-link><a href=#dom-datatransfer-dropeffect-link>link</a></code>", and "<code id=the-datatransfer-interface:dom-datatransfer-dropeffect-move><a href=#dom-datatransfer-dropeffect-move>move</a></code>".</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-effectallowed-3><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the kinds of operations that are to be allowed.</p>
- <p>Can be set (during the <code id=the-datatransfer-interface:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event), to change
- the allowed operations.</p>
- <p>The possible values are "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-none><a href=#dom-datatransfer-effectallowed-none>none</a></code>",
- "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-copy><a href=#dom-datatransfer-effectallowed-copy>copy</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-copylink><a href=#dom-datatransfer-effectallowed-copylink>copyLink</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-copymove><a href=#dom-datatransfer-effectallowed-copymove>copyMove</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-link><a href=#dom-datatransfer-effectallowed-link>link</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-linkmove><a href=#dom-datatransfer-effectallowed-linkmove>linkMove</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-move><a href=#dom-datatransfer-effectallowed-move>move</a></code>", "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-all><a href=#dom-datatransfer-effectallowed-all>all</a></code>", and "<code id=the-datatransfer-interface:dom-datatransfer-effectallowed-uninitialized><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>",</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-items-2><a href=#dom-datatransfer-items>items</a></code><dd>
- <p>Returns a <code id=the-datatransfer-interface:datatransferitemlist-2><a href=#datatransferitemlist>DataTransferItemList</a></code> object, with the drag data.</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-setdragimage-2><a href=#dom-datatransfer-setdragimage>setDragImage</a></code>(<var>element</var>, <var>x</var>, <var>y</var>)<dd>
- <p>Uses the given element to update the drag feedback, replacing any previously specified
- feedback.</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-types-2><a href=#dom-datatransfer-types>types</a></code><dd>
- <p>Returns an array listing the formats that were set in the <code id=the-datatransfer-interface:event-dnd-dragstart-2><a href=#event-dnd-dragstart>dragstart</a></code> event. In addition, if any files are being dragged,
- then one of the types will be the string "<code>Files</code>".</p>
- <dt><var>data</var> = <var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-getdata-2><a href=#dom-datatransfer-getdata>getData</a></code>(<var>format</var>)<dd>
- <p>Returns the specified data. If there is no such data, returns the empty string.</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-setdata-2><a href=#dom-datatransfer-setdata>setData</a></code>(<var>format</var>, <var>data</var>)<dd>
- <p>Adds the specified data.</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-cleardata-2><a href=#dom-datatransfer-cleardata>clearData</a></code>( [ <var>format</var> ] )<dd>
- <p>Removes the data of the specified formats. Removes all data if the argument is omitted.</p>
- <dt><var>dataTransfer</var> . <code id=the-datatransfer-interface:dom-datatransfer-files-2><a href=#dom-datatransfer-files>files</a></code><dd>
- <p>Returns a <code id=the-datatransfer-interface:filelist-2><a href=#filelist>FileList</a></code> of the files being dragged, if any.</p>
- </dl>
- <p><code id=the-datatransfer-interface:datatransfer-3><a href=#datatransfer>DataTransfer</a></code> objects are used during the <a href=#dndevents>drag-and-drop
- events</a>, and are only valid while those events are being fired.</p>
-
- <p>A <code id=the-datatransfer-interface:datatransfer-4><a href=#datatransfer>DataTransfer</a></code> object is associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-2>drag data store</a> while it
- is valid.</p>
- <p>The <dfn id=dom-datatransfer-dropeffect><code>dropEffect</code></dfn> attribute controls
- the drag-and-drop feedback that the user is given during a drag-and-drop operation. When the
- <code id=the-datatransfer-interface:datatransfer-5><a href=#datatransfer>DataTransfer</a></code> object is created, the <code id=the-datatransfer-interface:dom-datatransfer-dropeffect-3><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute is set to a string value. On
- getting, it must return its current value. On setting, if the new value is one of "<dfn id=dom-datatransfer-dropeffect-none><code>none</code></dfn>", "<dfn id=dom-datatransfer-dropeffect-copy><code>copy</code></dfn>", "<dfn id=dom-datatransfer-dropeffect-link><code>link</code></dfn>", or "<dfn id=dom-datatransfer-dropeffect-move><code>move</code></dfn>", then the attribute's current value must be
- set to the new value. Other values must be ignored.</p>
- <p>The <dfn id=dom-datatransfer-effectallowed><code>effectAllowed</code></dfn> attribute is
- used in the drag-and-drop processing model to initialise the <code id=the-datatransfer-interface:dom-datatransfer-dropeffect-4><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute during the <code id=the-datatransfer-interface:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> and <code id=the-datatransfer-interface:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code> events. When the <code id=the-datatransfer-interface:datatransfer-6><a href=#datatransfer>DataTransfer</a></code> object is
- created, the <code id=the-datatransfer-interface:dom-datatransfer-effectallowed-4><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute is set
- to a string value. On getting, it must return its current value. On setting, if <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-3>drag data
- store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode>mode</a> is the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw>read/write mode</a> and the new value is one of "<dfn id=dom-datatransfer-effectallowed-none><code>none</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-copy><code>copy</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-copylink><code>copyLink</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-copymove><code>copyMove</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-link><code>link</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-linkmove><code>linkMove</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-move><code>move</code></dfn>", "<dfn id=dom-datatransfer-effectallowed-all><code>all</code></dfn>", or "<dfn id=dom-datatransfer-effectallowed-uninitialized><code>uninitialized</code></dfn>", then the attribute's
- current value must be set to the new value. Otherwise it must be left unchanged.</p>
- <p>The <dfn id=dom-datatransfer-items><code>items</code></dfn> attribute must return a
- <code id=the-datatransfer-interface:datatransferitemlist-3><a href=#datatransferitemlist>DataTransferItemList</a></code> object associated with the <code id=the-datatransfer-interface:datatransfer-7><a href=#datatransfer>DataTransfer</a></code> object. The
- same object must be returned each time.</p>
- <p>The <dfn id=dom-datatransfer-setdragimage><code>setDragImage(<var>element</var>,
- <var>x</var>, <var>y</var>)</code></dfn> method must run the following steps:</p>
- <ol><li><p>If the <code id=the-datatransfer-interface:datatransfer-8><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-4>drag data
- store</a>, abort these steps. Nothing happens.<li><p>If the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-5>drag data store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode-2>mode</a> is
- not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-2>read/write mode</a>, abort these steps. Nothing
- happens.<li><p>If the <var>element</var> argument is an <code id=the-datatransfer-interface:the-img-element><a href=#the-img-element>img</a></code> element, then set the <a href=#drag-data-store-bitmap id=the-datatransfer-interface:drag-data-store-bitmap>drag
- data store bitmap</a> to the element's image (at its intrinsic size); otherwise, set the
- <a href=#drag-data-store-bitmap id=the-datatransfer-interface:drag-data-store-bitmap-2>drag data store bitmap</a> to an image generated from the given element (the exact
- mechanism for doing so is not currently specified).<li><p>Set the <a href=#drag-data-store-hot-spot-coordinate id=the-datatransfer-interface:drag-data-store-hot-spot-coordinate>drag data store hot spot coordinate</a> to the given <var>x</var>,
- <var>y</var> coordinate.</ol>
- <p>The <dfn id=dom-datatransfer-types><code>types</code></dfn> attribute must return a
- <a href=#live id=the-datatransfer-interface:live>live</a> <a href=#dfn-read-only-array id=the-datatransfer-interface:dfn-read-only-array>read only</a> array giving the strings
- that the following steps would produce. The same object must be returned each time.</p>
- <ol><li><p>Start with an empty list <var>L</var>.<li><p>If the <code id=the-datatransfer-interface:datatransfer-9><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-6>drag data
- store</a>, the array is empty. Abort these steps; return the empty list <var>L</var>.<li><p>For each item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list>drag data store item list</a>
- whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind>kind</a> is <i>Plain Unicode string</i>, add an
- entry to the list <var>L</var> consisting of the item's <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string>type string</a>.<li><p>If there are any items in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-2>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-2>kind</a> is <i>File</i>, then add an entry to the list
- <var>L</var> consisting of the string "<code>Files</code>". (This value can be
- distinguished from the other values because it is not lowercase.)<li><p>The strings produced by these steps are those in the list <var>L</var>.</ol>
- <p>The <dfn id=dom-datatransfer-getdata><code>getData(<var>format</var>)</code></dfn> method
- must run the following steps:</p>
- <ol><li><p>If the <code id=the-datatransfer-interface:datatransfer-10><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-7>drag data
- store</a>, return the empty string and abort these steps.<li><p>If the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-8>drag data store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode-3>mode</a> is
- the <a href=#concept-dnd-p id=the-datatransfer-interface:concept-dnd-p>protected mode</a>, return the empty string and abort these
- steps.<li><p>Let <var>format</var> be the first argument, <a href=#converted-to-ascii-lowercase id=the-datatransfer-interface:converted-to-ascii-lowercase>converted to ASCII
- lowercase</a>.<li><p>Let <var>convert-to-URL</var> be false.<li><p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".<li><p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>" and set <var>convert-to-URL</var> to true.<li><p>If there is no item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-3>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-3>kind</a> is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-2>type string</a> is equal to <var>format</var>, return the empty string
- and abort these steps.<li><p>Let <var>result</var> be the data of the item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-4>drag data store item
- list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-4>kind</a> is <i>Plain Unicode
- string</i> and whose <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-3>type string</a> is equal to
- <var>format</var>.<li><p>If <var>convert-to-URL</var> is true, then parse <var>result</var> as appropriate for
- <code>text/uri-list</code> data, and then set <var>result</var> to the first URL from
- the list, if any, or the empty string otherwise. <a href=#refsRFC2483>[RFC2483]</a><li><p>Return <var>result</var>.</ol>
- <p>The <dfn id=dom-datatransfer-setdata><code>setData(<var>format</var>,
- <var>data</var>)</code></dfn> method must run the following steps:</p>
- <ol><li><p>If the <code id=the-datatransfer-interface:datatransfer-11><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-9>drag data
- store</a>, abort these steps. Nothing happens.<li><p>If the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-10>drag data store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode-4>mode</a> is
- not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-3>read/write mode</a>, abort these steps. Nothing
- happens.<li><p>Let <var>format</var> be the first argument, <a href=#converted-to-ascii-lowercase id=the-datatransfer-interface:converted-to-ascii-lowercase-2>converted to ASCII
- lowercase</a>.<li>
- <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
- <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
- <li><p>Remove the item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-5>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-5>kind</a> is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-4>type string</a> is equal to <var>format</var>, if there is
- one.<li><p>Add an item to the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-6>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-6>kind</a> is <i>Plain Unicode string</i>, whose <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-5>type string</a> is equal to <var>format</var>, and whose data is the string
- given by the method's second argument.</ol>
- <p>The <dfn id=dom-datatransfer-cleardata><code>clearData()</code></dfn> method must run the
- following steps:</p>
- <ol><li><p>If the <code id=the-datatransfer-interface:datatransfer-12><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-11>drag data
- store</a>, abort these steps. Nothing happens.<li><p>If the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-12>drag data store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode-5>mode</a> is
- not the <a href=#concept-dnd-rw id=the-datatransfer-interface:concept-dnd-rw-4>read/write mode</a>, abort these steps. Nothing
- happens.<li><p>If the method was called with no arguments, remove each item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-7>drag data store
- item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-7>kind</a> is <i>Plain Unicode
- string</i>, and abort these steps.<li><p>Let <var>format</var> be the first argument, <a href=#converted-to-ascii-lowercase id=the-datatransfer-interface:converted-to-ascii-lowercase-3>converted to ASCII
- lowercase</a>.<li>
- <p>If <var>format</var> equals "<code>text</code>", change it to "<code>text/plain</code>".</p>
- <p>If <var>format</var> equals "<code>url</code>", change it to "<code>text/uri-list</code>".</p>
- <li><p>Remove the item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-8>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-8>kind</a> is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-6>type string</a> is equal to <var>format</var>, if there is
- one.</ol>
- <p class=note>The <code id=the-datatransfer-interface:dom-datatransfer-cleardata-3><a href=#dom-datatransfer-cleardata>clearData()</a></code> method does not
- affect whether any files were included in the drag, so the <code id=the-datatransfer-interface:dom-datatransfer-types-3><a href=#dom-datatransfer-types>types</a></code> attribute's list might still not be empty after
- calling <code id=the-datatransfer-interface:dom-datatransfer-cleardata-4><a href=#dom-datatransfer-cleardata>clearData()</a></code> (it would still contain the
- "<code>Files</code>" string if any files were included in the drag).</p>
- <p>The <dfn id=dom-datatransfer-files><code>files</code></dfn> attribute must return a
- <a href=#live id=the-datatransfer-interface:live-2>live</a> <code id=the-datatransfer-interface:filelist-3><a href=#filelist>FileList</a></code> sequence consisting of <code id=the-datatransfer-interface:file><a href=#file>File</a></code> objects
- representing the files found by the following steps. The same object must be returned each time.
- Furthermore, for a given <code id=the-datatransfer-interface:filelist-4><a href=#filelist>FileList</a></code> object and a given underlying file, the same
- <code id=the-datatransfer-interface:file-2><a href=#file>File</a></code> object must be used each time.</p>
- <ol><li><p>Start with an empty list <var>L</var>.<li><p>If the <code id=the-datatransfer-interface:datatransfer-13><a href=#datatransfer>DataTransfer</a></code> object is no longer associated with a <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-13>drag data
- store</a>, the <code id=the-datatransfer-interface:filelist-5><a href=#filelist>FileList</a></code> is empty. Abort these steps; return the empty list <var>L</var>.<li><p>If the <a href=#drag-data-store id=the-datatransfer-interface:drag-data-store-14>drag data store</a>'s <a href=#drag-data-store-mode id=the-datatransfer-interface:drag-data-store-mode-6>mode</a> is
- the <a href=#concept-dnd-p id=the-datatransfer-interface:concept-dnd-p-2>protected mode</a>, abort these steps; return the empty list
- <var>L</var>.<li><p>For each item in the <a href=#drag-data-store-item-list id=the-datatransfer-interface:drag-data-store-item-list-9>drag data store item list</a>
- whose <a href=#the-drag-data-item-kind id=the-datatransfer-interface:the-drag-data-item-kind-9>kind</a> is <i>File</i> , add the item's data (the file, in particular its name and contents, as well as
- its <a href=#the-drag-data-item-type-string id=the-datatransfer-interface:the-drag-data-item-type-string-7>type</a>) to the list <var>L</var>.<li><p>The files found by these steps are those in the list <var>L</var>.</ol>
- <p class=note>This version of the API does not expose the types of the files during the
- drag.</p>
-
- <h5 id=the-datatransferitemlist-interface>6.7.3.1 The <code id=the-datatransferitemlist-interface:datatransferitemlist><a href=#datatransferitemlist>DataTransferItemList</a></code> interface</h5>
- <p>Each <code id=the-datatransferitemlist-interface:datatransfer><a href=#datatransfer>DataTransfer</a></code> object is associated with a <code id=the-datatransferitemlist-interface:datatransferitemlist-2><a href=#datatransferitemlist>DataTransferItemList</a></code>
- object.</p>
- <pre class=idl>interface <dfn id=datatransferitemlist>DataTransferItemList</dfn> {
- readonly attribute unsigned long <a href=#dom-datatransferitemlist-length id=the-datatransferitemlist-interface:dom-datatransferitemlist-length>length</a>;
- <a href=#dom-datatransferitemlist-item id=the-datatransferitemlist-interface:dom-datatransferitemlist-item>getter</a> <a href=#datatransferitem id=the-datatransferitemlist-interface:datatransferitem>DataTransferItem</a> (unsigned long index);
- <a href=#datatransferitem id=the-datatransferitemlist-interface:datatransferitem-2>DataTransferItem</a>? <a href=#dom-datatransferitemlist-add id=the-datatransferitemlist-interface:dom-datatransferitemlist-add>add</a>(DOMString data, DOMString type);
- <a href=#datatransferitem id=the-datatransferitemlist-interface:datatransferitem-3>DataTransferItem</a>? <a href=#dom-datatransferitemlist-add id=the-datatransferitemlist-interface:dom-datatransferitemlist-add-2>add</a>(<a href=#file id=the-datatransferitemlist-interface:file>File</a> data);
- void <a href=#dom-datatransferitemlist-remove id=the-datatransferitemlist-interface:dom-datatransferitemlist-remove>remove</a>(unsigned long index);
- void <a href=#dom-datatransferitemlist-clear id=the-datatransferitemlist-interface:dom-datatransferitemlist-clear>clear</a>();
- };</pre>
- <dl class=domintro><dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-length-2><a href=#dom-datatransferitemlist-length>length</a></code><dd><p>Returns the number of items in the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store>drag data store</a>.<dt><var>items</var>[<var>index</var>]<dd>
- <p>Returns the <code id=the-datatransferitemlist-interface:datatransferitem-4><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var>index</var>th
- entry in the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-2>drag data store</a>.</p>
- <dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-remove-2><a href=#dom-datatransferitemlist-remove>remove</a></code>(<var>index</var>)<dd>
- <p>Removes the <var>index</var>th entry in the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-3>drag data store</a>.</p>
- <dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-clear-2><a href=#dom-datatransferitemlist-clear>clear</a></code>()<dd>
- <p>Removes all the entries in the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-4>drag data store</a>.</p>
- <dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-add-3><a href=#dom-datatransferitemlist-add>add</a></code>(<var>data</var>)<dt><var>items</var> . <code id=the-datatransferitemlist-interface:dom-datatransferitemlist-add-4><a href=#dom-datatransferitemlist-add>add</a></code>(<var>data</var>, <var>type</var>)<dd>
- <p>Adds a new entry for the given data to the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-5>drag data store</a>. If the data is plain
- text then a <var>type</var> string has to be provided
- also.</p>
- </dl>
-
- <p>While the <code id=the-datatransferitemlist-interface:datatransferitemlist-3><a href=#datatransferitemlist>DataTransferItemList</a></code> object's <code id=the-datatransferitemlist-interface:datatransfer-2><a href=#datatransfer>DataTransfer</a></code> object is
- associated with a <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-6>drag data store</a>, the <code id=the-datatransferitemlist-interface:datatransferitemlist-4><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
- <i>mode</i> is the same as the <a href=#drag-data-store-mode id=the-datatransferitemlist-interface:drag-data-store-mode>drag data store mode</a>. When the
- <code id=the-datatransferitemlist-interface:datatransferitemlist-5><a href=#datatransferitemlist>DataTransferItemList</a></code> object's <code id=the-datatransferitemlist-interface:datatransfer-3><a href=#datatransfer>DataTransfer</a></code> object is <em>not</em>
- associated with a <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-7>drag data store</a>, the <code id=the-datatransferitemlist-interface:datatransferitemlist-6><a href=#datatransferitemlist>DataTransferItemList</a></code> object's
- <i>mode</i> is the <i>disabled mode</i>. The <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-8>drag data store</a> referenced in this
- section (which is used only when the <code id=the-datatransferitemlist-interface:datatransferitemlist-7><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the
- <i>disabled mode</i>) is the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-9>drag data store</a> with which the
- <code id=the-datatransferitemlist-interface:datatransferitemlist-8><a href=#datatransferitemlist>DataTransferItemList</a></code> object's <code id=the-datatransferitemlist-interface:datatransfer-4><a href=#datatransfer>DataTransfer</a></code> object is associated.</p>
- <p>The <dfn id=dom-datatransferitemlist-length><code>length</code></dfn> attribute must
- return zero if the object is in the <i>disabled mode</i>; otherwise it must return the number of
- items in the <a href=#drag-data-store-item-list id=the-datatransferitemlist-interface:drag-data-store-item-list>drag data store item list</a>.</p>
- <p>When a <code id=the-datatransferitemlist-interface:datatransferitemlist-9><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the <i>disabled mode</i>, its
- <a href=#supported-property-indices id=the-datatransferitemlist-interface:supported-property-indices>supported property indices</a> are the numbers in the range
- <span>0 .. <var>n</var>-1</span>,
- where <var>n</var> is the number of items in the <a href=#drag-data-store-item-list id=the-datatransferitemlist-interface:drag-data-store-item-list-2>drag data store item
- list</a>.</p>
- <p>To <dfn id=dom-datatransferitemlist-item>determine the value of an indexed property</dfn>
- <var>i</var> of a <code id=the-datatransferitemlist-interface:datatransferitemlist-10><a href=#datatransferitemlist>DataTransferItemList</a></code> object, the user agent must return a
- <code id=the-datatransferitemlist-interface:datatransferitem-5><a href=#datatransferitem>DataTransferItem</a></code> object representing the <var>i</var>th item in the
- <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-10>drag data store</a>. The same object must be returned each time a particular item is
- obtained from this <code id=the-datatransferitemlist-interface:datatransferitemlist-11><a href=#datatransferitemlist>DataTransferItemList</a></code> object. The <code id=the-datatransferitemlist-interface:datatransferitem-6><a href=#datatransferitem>DataTransferItem</a></code>
- object must be associated with the same <code id=the-datatransferitemlist-interface:datatransfer-5><a href=#datatransfer>DataTransfer</a></code> object as the
- <code id=the-datatransferitemlist-interface:datatransferitemlist-12><a href=#datatransferitemlist>DataTransferItemList</a></code> object when it is first created.</p>
- <p>The <dfn id=dom-datatransferitemlist-add><code>add()</code></dfn> method must run the
- following steps:</p>
- <ol><li><p>If the <code id=the-datatransferitemlist-interface:datatransferitemlist-13><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the <i id=the-datatransferitemlist-interface:concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i>, return null and abort these steps.<li>
- <p>Jump to the appropriate set of steps from the following list:</p>
- <dl class=switch><dt>If the first argument to the method is a string<dd>
- <p>If there is already an item in the <a href=#drag-data-store-item-list id=the-datatransferitemlist-interface:drag-data-store-item-list-3>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransferitemlist-interface:the-drag-data-item-kind>kind</a> is <i>Plain Unicode string</i> and whose <a href=#the-drag-data-item-type-string id=the-datatransferitemlist-interface:the-drag-data-item-type-string>type string</a> is equal to the value of the
- method's second argument, <a href=#converted-to-ascii-lowercase id=the-datatransferitemlist-interface:converted-to-ascii-lowercase>converted to ASCII lowercase</a>, then throw a
- <code id=the-datatransferitemlist-interface:notsupportederror><a href=#notsupportederror>NotSupportedError</a></code> exception and abort these steps.</p>
- <p>Otherwise, add an item to the <a href=#drag-data-store-item-list id=the-datatransferitemlist-interface:drag-data-store-item-list-4>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransferitemlist-interface:the-drag-data-item-kind-2>kind</a> is <i>Plain Unicode string</i>, whose <a href=#the-drag-data-item-type-string id=the-datatransferitemlist-interface:the-drag-data-item-type-string-2>type string</a> is equal to the value of the method's second
- argument, <a href=#converted-to-ascii-lowercase id=the-datatransferitemlist-interface:converted-to-ascii-lowercase-2>converted to ASCII lowercase</a>, and whose data is the string given by the
- method's first argument.</p>
- <dt>If the first argument to the method is a <code id=the-datatransferitemlist-interface:file-2><a href=#file>File</a></code><dd>
- <p>Add an item to the <a href=#drag-data-store-item-list id=the-datatransferitemlist-interface:drag-data-store-item-list-5>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-datatransferitemlist-interface:the-drag-data-item-kind-3>kind</a> is <i>File</i>, whose <a href=#the-drag-data-item-type-string id=the-datatransferitemlist-interface:the-drag-data-item-type-string-3>type
- string</a> is the <code id=the-datatransferitemlist-interface:dom-blob-type><a href=#dom-blob-type>type</a></code> of the <code id=the-datatransferitemlist-interface:file-3><a href=#file>File</a></code>,
- <a href=#converted-to-ascii-lowercase id=the-datatransferitemlist-interface:converted-to-ascii-lowercase-3>converted to ASCII lowercase</a>, and whose data is the same as the
- <code id=the-datatransferitemlist-interface:file-4><a href=#file>File</a></code>'s data.</p>
- </dl>
- <li><p><a href=#dom-datatransferitemlist-item id=the-datatransferitemlist-interface:dom-datatransferitemlist-item-2>Determine the value of the indexed
- property</a> corresponding to the newly added item, and return that value (a newly created
- <code id=the-datatransferitemlist-interface:datatransferitem-7><a href=#datatransferitem>DataTransferItem</a></code> object).</ol>
- <p>The <dfn id=dom-datatransferitemlist-remove><code>remove()</code></dfn> method, when
- invoked with the argument <var>i</var>, must run these steps:</p>
- <ol><li><p>If the <code id=the-datatransferitemlist-interface:datatransferitemlist-14><a href=#datatransferitemlist>DataTransferItemList</a></code> object is not in the <i id=the-datatransferitemlist-interface:concept-dnd-rw-2><a href=#concept-dnd-rw>read/write mode</a></i>, throw an <code id=the-datatransferitemlist-interface:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception and
- abort these steps.<li><p>Remove the <var>i</var>th item from the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-11>drag data store</a>.</ol>
- <p>The <dfn id=dom-datatransferitemlist-clear><code>clear</code></dfn> method, if the
- <code id=the-datatransferitemlist-interface:datatransferitemlist-15><a href=#datatransferitemlist>DataTransferItemList</a></code> object is in the <i id=the-datatransferitemlist-interface:concept-dnd-rw-3><a href=#concept-dnd-rw>read/write mode</a></i>,
- must remove all the items from the <a href=#drag-data-store id=the-datatransferitemlist-interface:drag-data-store-12>drag data store</a>. Otherwise, it must do
- nothing.</p>
-
- <h5 id=the-datatransferitem-interface>6.7.3.2 The <code id=the-datatransferitem-interface:datatransferitem><a href=#datatransferitem>DataTransferItem</a></code> interface</h5>
- <p>Each <code id=the-datatransferitem-interface:datatransferitem-2><a href=#datatransferitem>DataTransferItem</a></code> object is associated with a <code id=the-datatransferitem-interface:datatransfer><a href=#datatransfer>DataTransfer</a></code>
- object.</p>
- <pre class=idl>interface <dfn id=datatransferitem>DataTransferItem</dfn> {
- readonly attribute DOMString <a href=#dom-datatransferitem-kind id=the-datatransferitem-interface:dom-datatransferitem-kind>kind</a>;
- readonly attribute DOMString <a href=#dom-datatransferitem-type id=the-datatransferitem-interface:dom-datatransferitem-type>type</a>;
- void <a href=#dom-datatransferitem-getasstring id=the-datatransferitem-interface:dom-datatransferitem-getasstring>getAsString</a>(<a href=#functionstringcallback id=the-datatransferitem-interface:functionstringcallback>FunctionStringCallback</a>? _callback);
- <a href=#file id=the-datatransferitem-interface:file>File</a>? <a href=#dom-datatransferitem-getasfile id=the-datatransferitem-interface:dom-datatransferitem-getasfile>getAsFile</a>();
- };
- callback <dfn id=functionstringcallback>FunctionStringCallback</dfn> = void (DOMString data);</pre>
- <dl class=domintro><dt><var>item</var> . <code id=the-datatransferitem-interface:dom-datatransferitem-kind-2><a href=#dom-datatransferitem-kind>kind</a></code><dd>
- <p>Returns <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind>the drag data item kind</a>, one of: "string",
- "file".</p>
- <dt><var>item</var> . <code id=the-datatransferitem-interface:dom-datatransferitem-type-2><a href=#dom-datatransferitem-type>type</a></code><dd>
- <p>Returns <a href=#the-drag-data-item-type-string id=the-datatransferitem-interface:the-drag-data-item-type-string>the drag data item type string</a>.</p>
- <dt><var>item</var> . <code id=the-datatransferitem-interface:dom-datatransferitem-getasstring-2><a href=#dom-datatransferitem-getasstring>getAsString</a></code>(<var>callback</var>)<dd>
- <p>Invokes the callback with the string data as the argument, if <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind-2>the drag data item
- kind</a> is <i>Plain Unicode string</i>.</p>
- <dt><var>file</var> = <var>item</var> . <code id=the-datatransferitem-interface:dom-datatransferitem-getasfile-2><a href=#dom-datatransferitem-getasfile>getAsFile</a></code>()<dd>
- <p>Returns a <code id=the-datatransferitem-interface:file-2><a href=#file>File</a></code> object, if <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind-3>the drag data item kind</a> is <i>File</i>.</p>
- </dl>
-
- <p>While the <code id=the-datatransferitem-interface:datatransferitem-3><a href=#datatransferitem>DataTransferItem</a></code> object's <code id=the-datatransferitem-interface:datatransfer-2><a href=#datatransfer>DataTransfer</a></code> object is associated
- with a <a href=#drag-data-store id=the-datatransferitem-interface:drag-data-store>drag data store</a> and that <a href=#drag-data-store id=the-datatransferitem-interface:drag-data-store-2>drag data store</a>'s <a href=#drag-data-store-item-list id=the-datatransferitem-interface:drag-data-store-item-list>drag data store
- item list</a> still contains the item that the <code id=the-datatransferitem-interface:datatransferitem-4><a href=#datatransferitem>DataTransferItem</a></code> object represents,
- the <code id=the-datatransferitem-interface:datatransferitem-5><a href=#datatransferitem>DataTransferItem</a></code> object's <i>mode</i> is the same as the <a href=#drag-data-store-mode id=the-datatransferitem-interface:drag-data-store-mode>drag data store
- mode</a>. When the <code id=the-datatransferitem-interface:datatransferitem-6><a href=#datatransferitem>DataTransferItem</a></code> object's <code id=the-datatransferitem-interface:datatransfer-3><a href=#datatransfer>DataTransfer</a></code> object is
- <em>not</em> associated with a <a href=#drag-data-store id=the-datatransferitem-interface:drag-data-store-3>drag data store</a>, or if the item that the
- <code id=the-datatransferitem-interface:datatransferitem-7><a href=#datatransferitem>DataTransferItem</a></code> object represents has been removed from the relevant <a href=#drag-data-store-item-list id=the-datatransferitem-interface:drag-data-store-item-list-2>drag data
- store item list</a>, the <code id=the-datatransferitem-interface:datatransferitem-8><a href=#datatransferitem>DataTransferItem</a></code> object's <i>mode</i> is the <i>disabled
- mode</i>. The <a href=#drag-data-store id=the-datatransferitem-interface:drag-data-store-4>drag data store</a> referenced in this section (which is used only when the
- <code id=the-datatransferitem-interface:datatransferitem-9><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i>disabled mode</i>) is the <a href=#drag-data-store id=the-datatransferitem-interface:drag-data-store-5>drag data
- store</a> with which the <code id=the-datatransferitem-interface:datatransferitem-10><a href=#datatransferitem>DataTransferItem</a></code> object's <code id=the-datatransferitem-interface:datatransfer-4><a href=#datatransfer>DataTransfer</a></code>
- object is associated.</p>
- <p>The <dfn id=dom-datatransferitem-kind><code>kind</code></dfn> attribute must return the
- empty string if the <code id=the-datatransferitem-interface:datatransferitem-11><a href=#datatransferitem>DataTransferItem</a></code> object is in the <i>disabled mode</i>; otherwise
- it must return the string given in the cell from the second column of the following table from the
- row whose cell in the first column contains <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind-4>the drag data item kind</a> of the item
- represented by the <code id=the-datatransferitem-interface:datatransferitem-12><a href=#datatransferitem>DataTransferItem</a></code> object:</p>
- <table><thead><tr><th> Kind <th> String
- <tbody><tr><td> <i>Plain Unicode string</i> <td> "<code>string</code>"
- <tr><td> <i>File</i> <td> "<code>file</code>"
- </table>
- <p>The <dfn id=dom-datatransferitem-type><code>type</code></dfn> attribute must return the
- empty string if the <code id=the-datatransferitem-interface:datatransferitem-13><a href=#datatransferitem>DataTransferItem</a></code> object is in the <i>disabled mode</i>; otherwise
- it must return <a href=#the-drag-data-item-type-string id=the-datatransferitem-interface:the-drag-data-item-type-string-2>the drag data item type string</a> of the item represented by the
- <code id=the-datatransferitem-interface:datatransferitem-14><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
- <p>The <dfn id=dom-datatransferitem-getasstring><code>getAsString(<var>callback</var>)</code></dfn> method must run the following steps:</p>
- <ol><li><p>If the <var>callback</var> is null, abort these steps.<li><p>If the <code id=the-datatransferitem-interface:datatransferitem-15><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i id=the-datatransferitem-interface:concept-dnd-rw><a href=#concept-dnd-rw>read/write mode</a></i> or the <i id=the-datatransferitem-interface:concept-dnd-ro><a href=#concept-dnd-ro>read-only mode</a></i>,
- abort these steps. The callback is never invoked.<li><p>If <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind-5>the drag data item kind</a> is not <i>Plain Unicode string</i>, abort these
- steps. The callback is never invoked.<li><p>Otherwise, <a href=#queue-a-task id=the-datatransferitem-interface:queue-a-task>queue a task</a> to invoke <var>callback</var>, passing the
- actual data of the item represented by the <code id=the-datatransferitem-interface:datatransferitem-16><a href=#datatransferitem>DataTransferItem</a></code> object as the
- argument.</ol>
- <p>The <dfn id=dom-datatransferitem-getasfile><code>getAsFile()</code></dfn>
- method must run the following steps:</p>
- <ol><li><p>If the <code id=the-datatransferitem-interface:datatransferitem-17><a href=#datatransferitem>DataTransferItem</a></code> object is not in the <i id=the-datatransferitem-interface:concept-dnd-rw-2><a href=#concept-dnd-rw>read/write mode</a></i> or the <i id=the-datatransferitem-interface:concept-dnd-ro-2><a href=#concept-dnd-ro>read-only mode</a></i>,
- return null and abort these steps.<li><p>If <a href=#the-drag-data-item-kind id=the-datatransferitem-interface:the-drag-data-item-kind-6>the drag data item kind</a> is not <i>File</i>, then return null and abort
- these steps.<li><p>Return a new <code id=the-datatransferitem-interface:file-3><a href=#file>File</a></code> object representing the actual data of the item represented
- by the <code id=the-datatransferitem-interface:datatransferitem-18><a href=#datatransferitem>DataTransferItem</a></code> object.</p>
- </ol>
-
- <h4 id=the-dragevent-interface>6.7.4 The <code id=the-dragevent-interface:dragevent><a href=#dragevent>DragEvent</a></code> interface</h4>
- <p>The drag-and-drop processing model involves several events. They all use the
- <code id=the-dragevent-interface:dragevent-2><a href=#dragevent>DragEvent</a></code> interface.</p>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#drageventinit id=the-dragevent-interface:drageventinit>DragEventInit</a> eventInitDict)]
- interface <dfn id=dragevent>DragEvent</dfn> : <a href=#mouseevent id=the-dragevent-interface:mouseevent>MouseEvent</a> {
- readonly attribute <a href=#datatransfer id=the-dragevent-interface:datatransfer>DataTransfer</a>? <a href=#dom-dragevent-datatransfer id=the-dragevent-interface:dom-dragevent-datatransfer>dataTransfer</a>;
- };
- dictionary <dfn id=drageventinit>DragEventInit</dfn> : <a href=#mouseeventinit id=the-dragevent-interface:mouseeventinit>MouseEventInit</a> {
- <a href=#datatransfer id=the-dragevent-interface:datatransfer-2>DataTransfer</a>? dataTransfer;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-dragevent-interface:dom-dragevent-datatransfer-2><a href=#dom-dragevent-datatransfer>dataTransfer</a></code><dd>
- <p>Returns the <code id=the-dragevent-interface:datatransfer-3><a href=#datatransfer>DataTransfer</a></code> object for the event.</p>
- </dl>
- <p class=note>Although, for consistency with other event interfaces, the <code id=the-dragevent-interface:dragevent-3><a href=#dragevent>DragEvent</a></code>
- interface has a constructor, it is not particularly useful. In particular, there's no way to
- create a useful <code id=the-dragevent-interface:datatransfer-4><a href=#datatransfer>DataTransfer</a></code> object from script, as <code id=the-dragevent-interface:datatransfer-5><a href=#datatransfer>DataTransfer</a></code> objects
- have a processing and security model that is coordinated by the browser during drag-and-drops.</p>
-
- <p>The <dfn id=dom-dragevent-datatransfer><code>dataTransfer</code></dfn> attribute of the
- <code id=the-dragevent-interface:dragevent-4><a href=#dragevent>DragEvent</a></code> interface must return the value it was initialised to. When the object is
- created, this attribute must be initialised to null. It represents the context information for the
- event.</p>
-
-
- <p>When a user agent is required to <dfn id=fire-a-dnd-event>fire a DND event</dfn> named <var>e</var> at an element,
- using a particular <a href=#drag-data-store id=the-dragevent-interface:drag-data-store>drag data store</a>, and optionally with a specific <var>related
- target</var>, the user agent must run the following steps:</p>
- <ol><li><p>If no specific <var>related target</var> was provided, set <var>related target</var> to
- null.<li><p>Let <var>window</var> be the <code id=the-dragevent-interface:window><a href=#window>Window</a></code> object of the <code id=the-dragevent-interface:document><a href=#document>Document</a></code>
- object of the specified target element.<li>
- <p>If <var>e</var> is <code id=the-dragevent-interface:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code>, set the <a href=#drag-data-store-mode id=the-dragevent-interface:drag-data-store-mode>drag
- data store mode</a> to the <a href=#concept-dnd-rw id=the-dragevent-interface:concept-dnd-rw>read/write mode</a>.</p>
- <p>If <var>e</var> is <code id=the-dragevent-interface:event-dnd-drop><a href=#event-dnd-drop>drop</a></code>, set the <a href=#drag-data-store-mode id=the-dragevent-interface:drag-data-store-mode-2>drag data store
- mode</a> to the <a href=#concept-dnd-ro id=the-dragevent-interface:concept-dnd-ro>read-only mode</a>.</p>
- <li><p>Let <var>dataTransfer</var> be a newly created <code id=the-dragevent-interface:datatransfer-6><a href=#datatransfer>DataTransfer</a></code> object
- associated with the given <a href=#drag-data-store id=the-dragevent-interface:drag-data-store-2>drag data store</a>.<li><p id=effectAllowed-initialization>Set the <code id=the-dragevent-interface:dom-datatransfer-effectallowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute to the <a href=#drag-data-store id=the-dragevent-interface:drag-data-store-3>drag data
- store</a>'s <a href=#drag-data-store-allowed-effects-state id=the-dragevent-interface:drag-data-store-allowed-effects-state>drag data store allowed effects state</a>.<li>
- <p id=dropEffect-initialization>Set the <code id=the-dragevent-interface:dom-datatransfer-dropeffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute to "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-none><a href=#dom-datatransfer-dropeffect-none>none</a></code>" if <var>e</var> is <code id=the-dragevent-interface:event-dnd-dragstart-2><a href=#event-dnd-dragstart>dragstart</a></code>, <code id=the-dragevent-interface:event-dnd-drag><a href=#event-dnd-drag>drag</a></code>, <code id=the-dragevent-interface:event-dnd-dragexit><a href=#event-dnd-dragexit>dragexit</a></code>, or <code id=the-dragevent-interface:event-dnd-dragleave><a href=#event-dnd-dragleave>dragleave</a></code>; to the value corresponding to the <a href=#current-drag-operation id=the-dragevent-interface:current-drag-operation>current
- drag operation</a> if <var>e</var> is <code id=the-dragevent-interface:event-dnd-drop-2><a href=#event-dnd-drop>drop</a></code> or
- <code id=the-dragevent-interface:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code>; and to a value based on the <code id=the-dragevent-interface:dom-datatransfer-effectallowed-2><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute's value and the
- drag-and-drop source, as given by the following table, otherwise (i.e. if <var>e</var>
- is <code id=the-dragevent-interface:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> or <code id=the-dragevent-interface:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code>):</p>
- <table><thead><tr><th><code id=the-dragevent-interface:dom-datatransfer-effectallowed-3><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code><th><code id=the-dragevent-interface:dom-datatransfer-dropeffect-2><a href=#dom-datatransfer-dropeffect>dropEffect</a></code><tbody><tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-none><a href=#dom-datatransfer-effectallowed-none>none</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-none-2><a href=#dom-datatransfer-dropeffect-none>none</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-copy><a href=#dom-datatransfer-effectallowed-copy>copy</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-copylink><a href=#dom-datatransfer-effectallowed-copylink>copyLink</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-2><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override>if appropriate</a>, "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link><a href=#dom-datatransfer-dropeffect-link>link</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-copymove><a href=#dom-datatransfer-effectallowed-copymove>copyMove</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-3><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-2>if appropriate</a>, "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-all><a href=#dom-datatransfer-effectallowed-all>all</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-4><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-3>if appropriate</a>, either "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-2><a href=#dom-datatransfer-dropeffect-link>link</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-2><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-link><a href=#dom-datatransfer-effectallowed-link>link</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-3><a href=#dom-datatransfer-dropeffect-link>link</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-linkmove><a href=#dom-datatransfer-effectallowed-linkmove>linkMove</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-4><a href=#dom-datatransfer-dropeffect-link>link</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-4>if appropriate</a>, "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-3><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-move><a href=#dom-datatransfer-effectallowed-move>move</a></code>"<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-4><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-uninitialized><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>" when what is being dragged is a selection from a text field<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-5><a href=#dom-datatransfer-dropeffect-move>move</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-5>if appropriate</a>, either "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-5><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-5><a href=#dom-datatransfer-dropeffect-link>link</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-uninitialized-2><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>" when what is being dragged is a selection<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-6><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-6>if appropriate</a>, either "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-6><a href=#dom-datatransfer-dropeffect-link>link</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-6><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>"<code id=the-dragevent-interface:dom-datatransfer-effectallowed-uninitialized-3><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>" when what is being dragged is an <code id=the-dragevent-interface:the-a-element><a href=#the-a-element>a</a></code> element with an <code id=the-dragevent-interface:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-7><a href=#dom-datatransfer-dropeffect-link>link</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-7>if appropriate</a>, either "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-7><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-7><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<tr><td>Any other case<td>"<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-8><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>", or, <a href=#concept-platform-dropeffect-override id=the-dragevent-interface:concept-platform-dropeffect-override-8>if appropriate</a>, either "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-8><a href=#dom-datatransfer-dropeffect-link>link</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-8><a href=#dom-datatransfer-dropeffect-move>move</a></code>"</table>
- <p>Where the table above provides <dfn id=concept-platform-dropeffect-override>possibly
- appropriate alternatives</dfn>, user agents may instead use the listed alternative values if
- platform conventions dictate that the user has requested those alternate effects.</p>
- <p class=example>For example, Windows platform conventions are such that dragging while
- holding the "alt" key indicates a preference for linking the data, rather than moving or copying
- it. Therefore, on a Windows system, if "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-link-9><a href=#dom-datatransfer-dropeffect-link>link</a></code>" is an option according to
- the table above while the "alt" key is depressed, the user agent could select that instead of
- "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-copy-9><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>" or "<code id=the-dragevent-interface:dom-datatransfer-dropeffect-move-9><a href=#dom-datatransfer-dropeffect-move>move</a></code>".</p>
- <li>
- <p>Create a <a href=#concept-events-trusted id=the-dragevent-interface:concept-events-trusted>trusted</a> <code id=the-dragevent-interface:dragevent-5><a href=#dragevent>DragEvent</a></code> object
- and initialise it to have the given name <var>e</var>, to bubble, to be cancelable unless
- <var>e</var> is <code id=the-dragevent-interface:event-dnd-dragexit-2><a href=#event-dnd-dragexit>dragexit</a></code>, <code id=the-dragevent-interface:event-dnd-dragleave-2><a href=#event-dnd-dragleave>dragleave</a></code>, or <code id=the-dragevent-interface:event-dnd-dragend-2><a href=#event-dnd-dragend>dragend</a></code>, and to have the <code id=the-dragevent-interface:dom-uievent-view><a href=#dom-uievent-view>view</a></code> attribute initialised to <var>window</var>, the <code id=the-dragevent-interface:dom-uievent-detail><a href=#dom-uievent-detail>detail</a></code> attribute initialised to zero, the mouse and key
- attributes initialised according to the state of the input devices as they would be for user
- interaction events, the <code id=the-dragevent-interface:dom-mouseevent-relatedtarget><a href=#dom-mouseevent-relatedtarget>relatedTarget</a></code>
- attribute initialised to <var>related target</var>, and the <code id=the-dragevent-interface:dom-dragevent-datatransfer-3><a href=#dom-dragevent-datatransfer>dataTransfer</a></code> attribute initialised to
- <var>dataTransfer</var>, the <code id=the-dragevent-interface:datatransfer-7><a href=#datatransfer>DataTransfer</a></code> object created above.</p>
-
- <p>If there is no relevant pointing device, the object must have its <code>screenX</code>, <code>screenY</code>, <code>clientX</code>, <code>clientY</code>, and <code>button</code> attributes set to 0.</p>
- <li><p><a href=#concept-event-dispatch id=the-dragevent-interface:concept-event-dispatch>Dispatch</a> the newly created
- <code id=the-dragevent-interface:dragevent-6><a href=#dragevent>DragEvent</a></code> object at the specified target element.<li><p>Set the <a href=#drag-data-store-allowed-effects-state id=the-dragevent-interface:drag-data-store-allowed-effects-state-2>drag data store allowed effects state</a> to the current value of
- <var>dataTransfer</var>'s <code id=the-dragevent-interface:dom-datatransfer-effectallowed-4><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code>
- attribute. (It can only have changed value if <var>e</var> is <code id=the-dragevent-interface:event-dnd-dragstart-3><a href=#event-dnd-dragstart>dragstart</a></code>.)<li><p>Set the <a href=#drag-data-store-mode id=the-dragevent-interface:drag-data-store-mode-3>drag data store mode</a> back to the <a href=#concept-dnd-p id=the-dragevent-interface:concept-dnd-p>protected mode</a> if it was changed in the first step.<li><p>Break the association between <var>dataTransfer</var> and the <a href=#drag-data-store id=the-dragevent-interface:drag-data-store-4>drag data
- store</a>.</ol>
-
-
- <h4 id=drag-and-drop-processing-model>6.7.5 Drag-and-drop processing model</h4>
- <p>When the user attempts to begin a drag operation, the user agent must run the following steps.
- User agents must act as if these steps were run even if the drag actually started in another
- document or application and the user agent was not aware that the drag was occurring until it
- intersected with a document under the user agent's purview.</p>
- <ol><li>
- <p>Determine what is being dragged, as follows:</p>
- <p>If the drag operation was invoked on a selection, then it is the selection that is being
- dragged.</p>
- <p>Otherwise, if the drag operation was invoked on a <code id=drag-and-drop-processing-model:document><a href=#document>Document</a></code>, it is the first
- element, going up the ancestor chain, starting at the node that the user tried to drag, that has
- the IDL attribute <code id=drag-and-drop-processing-model:dom-draggable><a href=#dom-draggable>draggable</a></code> set to true. If there is no such
- element, then nothing is being dragged; abort these steps, the drag-and-drop operation is never
- started.</p>
- <p>Otherwise, the drag operation was invoked outside the user agent's purview. What is being
- dragged is defined by the document or application where the drag was started.</p>
- <p class=note><code id=drag-and-drop-processing-model:the-img-element><a href=#the-img-element>img</a></code> elements and <code id=drag-and-drop-processing-model:the-a-element><a href=#the-a-element>a</a></code> elements with an <code id=drag-and-drop-processing-model:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute have their <code id=drag-and-drop-processing-model:dom-draggable-2><a href=#dom-draggable>draggable</a></code> attribute set to true by default.</p>
- <li><p><a href=#create-a-drag-data-store id=drag-and-drop-processing-model:create-a-drag-data-store>Create a drag data store</a>. All the DND events fired subsequently by the steps
- in this section must use this <a href=#drag-data-store id=drag-and-drop-processing-model:drag-data-store>drag data store</a>.<li>
- <p>Establish which DOM node is the <dfn id=source-node>source node</dfn>, as follows:</p>
- <p>If it is a selection that is being dragged, then the <a href=#source-node id=drag-and-drop-processing-model:source-node>source node</a> is the
- <code id=drag-and-drop-processing-model:text><a href=#text>Text</a></code> node that the user started the drag on (typically the <code id=drag-and-drop-processing-model:text-2><a href=#text>Text</a></code> node
- that the user originally clicked). If the user did not specify a particular node, for example if
- the user just told the user agent to begin a drag of "the selection", then the <a href=#source-node id=drag-and-drop-processing-model:source-node-2>source
- node</a> is the first <code id=drag-and-drop-processing-model:text-3><a href=#text>Text</a></code> node containing a part of the selection.</p>
- <p>Otherwise, if it is an element that is being dragged, then the <a href=#source-node id=drag-and-drop-processing-model:source-node-3>source node</a> is
- the element that is being dragged.</p>
- <p>Otherwise, the <a href=#source-node id=drag-and-drop-processing-model:source-node-4>source node</a> is part of another document or application. When this
- specification requires that an event be dispatched at the <a href=#source-node id=drag-and-drop-processing-model:source-node-5>source node</a> in this case,
- the user agent must instead follow the platform-specific conventions relevant to that
- situation.</p>
- <p class=note>Multiple events are fired on the <a href=#source-node id=drag-and-drop-processing-model:source-node-6>source node</a> during the course of
- the drag-and-drop operation.</p>
- <li>
- <p>Determine the <dfn id=list-of-dragged-nodes>list of dragged nodes</dfn>, as follows:</p>
- <p>If it is a selection that is being dragged, then the <a href=#list-of-dragged-nodes id=drag-and-drop-processing-model:list-of-dragged-nodes>list of dragged nodes</a>
- contains, in <a href=#tree-order id=drag-and-drop-processing-model:tree-order>tree order</a>, every node that is partially or completely included in the
- selection (including all their ancestors).</p>
- <p>Otherwise, the <a href=#list-of-dragged-nodes id=drag-and-drop-processing-model:list-of-dragged-nodes-2>list of dragged nodes</a> contains only the <a href=#source-node id=drag-and-drop-processing-model:source-node-7>source node</a>,
- if any.</p>
- <li>
- <p>If it is a selection that is being dragged, then add an item to the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list>drag data store
- item list</a>, with its properties set as follows:</p>
- <dl><dt><a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string>The drag data item type string</a>
- <dd>"<code id=drag-and-drop-processing-model:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>"<dt><a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind>The drag data item kind</a>
- <dd><i>Plain Unicode string</i><dt>The actual data<dd>The text of the selection</dl>
- <p>Otherwise, if any files are being dragged, then add one item per file to the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-2>drag data
- store item list</a>, with their properties set as follows:</p>
- <dl><dt><a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-2>The drag data item type string</a>
- <dd>The MIME type of the file, if known, or "<code id=drag-and-drop-processing-model:application/octet-stream><a data-x-internal=application/octet-stream href=http://tools.ietf.org/html/rfc2046#section-4.5.1>application/octet-stream</a></code>" otherwise.<dt><a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-2>The drag data item kind</a>
- <dd><i>File</i><dt>The actual data<dd>The file's contents and name.</dl>
- <p class=note>Dragging files can currently only happen from outside a <a href=#browsing-context id=drag-and-drop-processing-model:browsing-context>browsing
- context</a>, for example from a file system manager application.</p>
- <p>If the drag initiated outside of the application, the user agent must add items to the
- <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-3>drag data store item list</a> as appropriate for the data being dragged, honoring
- platform conventions where appropriate; however, if the platform conventions do not use <a href=#mime-type id=drag-and-drop-processing-model:mime-type>MIME types</a> to label dragged data, the user agent must make a
- best-effort attempt to map the types to MIME types, and, in any case, all the <a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-3>drag data item type strings</a> must be <a href=#converted-to-ascii-lowercase id=drag-and-drop-processing-model:converted-to-ascii-lowercase>converted to ASCII
- lowercase</a>.</p>
- <p>User agents may also add one or more items representing the selection or dragged element(s)
- in other forms, e.g. as HTML.</p>
- <li>
- <p>If the <a href=#list-of-dragged-nodes id=drag-and-drop-processing-model:list-of-dragged-nodes-3>list of dragged nodes</a> is not empty, then <a href=#extracting-json id=drag-and-drop-processing-model:extracting-json>extract the microdata from those nodes into a JSON form</a>, and add one item to the
- <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-4>drag data store item list</a>, with its properties set as follows:</p>
- <dl><dt><a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-4>The drag data item type string</a>
- <dd><code id=drag-and-drop-processing-model:application/microdata+json><a href=#application/microdata+json>application/microdata+json</a></code><dt><a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-3>The drag data item kind</a>
- <dd><i>Plain Unicode string</i><dt>The actual data<dd>The resulting JSON string.</dl>
- <li>
- <p>Run the following substeps:</p>
- <ol><li><p>Let <var>urls</var> be an empty list of <a href=#absolute-url id=drag-and-drop-processing-model:absolute-url>absolute
- URLs</a>.<li>
- <p>For each <var>node</var> in the <a href=#list-of-dragged-nodes id=drag-and-drop-processing-model:list-of-dragged-nodes-4>list of dragged nodes</a>:</p>
- <dl><dt>If the node is an <code id=drag-and-drop-processing-model:the-a-element-2><a href=#the-a-element>a</a></code> element with an <code id=drag-and-drop-processing-model:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code> attribute<dd>Add to <var>urls</var> the result of <a href=#resolve-a-url id=drag-and-drop-processing-model:resolve-a-url>resolving</a> the element's <code id=drag-and-drop-processing-model:attr-hyperlink-href-3><a href=#attr-hyperlink-href>href</a></code> content
- attribute relative to the element.<dt>If the node is an <code id=drag-and-drop-processing-model:the-img-element-2><a href=#the-img-element>img</a></code> element with a <code id=drag-and-drop-processing-model:attr-img-src><a href=#attr-img-src>src</a></code>
- attribute<dd>Add to <var>urls</var> the result of <a href=#resolve-a-url id=drag-and-drop-processing-model:resolve-a-url-2>resolving</a> the element's <code id=drag-and-drop-processing-model:attr-img-src-2><a href=#attr-img-src>src</a></code> content attribute
- relative to the element.</dl>
- <li><p>If <var>urls</var> is still empty, abort these substeps.<li><p>Let <var>url string</var> be the result of concatenating the strings in <var>urls</var>,
- in the order they were added, separated by a U+000D CARRIAGE RETURN U+000A LINE FEED character
- pair (CRLF).<li><p>Add one item to the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-5>drag data store item list</a>, with its properties set as
- follows:</p>
- <dl><dt><a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-5>The drag data item type string</a>
- <dd><code id=drag-and-drop-processing-model:text/uri-list><a href=#text/uri-list>text/uri-list</a></code><dt><a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-4>The drag data item kind</a>
- <dd><i>Plain Unicode string</i><dt>The actual data<dd><var>url string</var></dl>
- </ol>
- <li>
- <p>Update the <a href=#drag-data-store-default-feedback id=drag-and-drop-processing-model:drag-data-store-default-feedback>drag data store default feedback</a> as appropriate for the user agent
- (if the user is dragging the selection, then the selection would likely be the basis for this
- feedback; if the user is dragging an element, then that element's rendering would be used; if
- the drag began outside the user agent, then the platform conventions for determining the drag
- feedback should be used).</p>
- <li>
- <p><a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event>Fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> at the
- <a href=#source-node id=drag-and-drop-processing-model:source-node-8>source node</a>.</p>
- <p>If the event is canceled, then the drag-and-drop operation should not occur; abort these
- steps.</p>
- <p class=note>Since events with no event listeners registered are, almost by definition, never
- canceled, drag-and-drop is always available to the user if the author does not specifically
- prevent it.</p>
- <li>
- <p><a href=#initiate-the-drag-and-drop-operation id=drag-and-drop-processing-model:initiate-the-drag-and-drop-operation>Initiate the drag-and-drop operation</a> in a manner consistent with platform
- conventions, and as described below.</p>
- <p id=base-dnd-feedback>The drag-and-drop feedback must be generated from the first of the
- following sources that is available:</p>
- <ol><li>The <a href=#drag-data-store-bitmap id=drag-and-drop-processing-model:drag-data-store-bitmap>drag data store bitmap</a>, if any. In this case, the <a href=#drag-data-store-hot-spot-coordinate id=drag-and-drop-processing-model:drag-data-store-hot-spot-coordinate>drag data store
- hot spot coordinate</a> should be used as hints for where to put the cursor relative to the
- resulting image. The values are expressed as distances in CSS pixels from the left side and
- from the top side of the image respectively. <a href=#refsCSS>[CSS]</a><li>The <a href=#drag-data-store-default-feedback id=drag-and-drop-processing-model:drag-data-store-default-feedback-2>drag data store default feedback</a>.</ol>
- </ol>
- <p>From the moment that the user agent is to <dfn id=initiate-the-drag-and-drop-operation>initiate the drag-and-drop operation</dfn>,
- until the end of the drag-and-drop operation, device input events (e.g. mouse and keyboard events)
- must be suppressed.</p>
- <p>During the drag operation, the element directly indicated by the user as the drop target is
- called the <dfn id=immediate-user-selection>immediate user selection</dfn>. (Only elements can be selected by the user; other
- nodes must not be made available as drop targets.) However, the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection>immediate user
- selection</a> is not necessarily the <dfn id=current-target-element>current target element</dfn>, which is the element
- currently selected for the drop part of the drag-and-drop operation.</p>
- <p>The <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-2>immediate user selection</a> changes as the user selects different elements
- (either by pointing at them with a pointing device, or by selecting them in some other way). The
- <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element>current target element</a> changes when the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-3>immediate user selection</a>
- changes, based on the results of event listeners in the document, as described below.</p>
- <p>Both the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-2>current target element</a> and the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-4>immediate user selection</a> can
- be null, which means no target element is selected. They can also both be elements in other
- (DOM-based) documents, or other (non-Web) programs altogether. (For example, a user could drag
- text to a word-processor.) The <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-3>current target element</a> is initially null.</p>
- <p>In addition, there is also a <dfn id=current-drag-operation>current drag operation</dfn>, which can take on the values
- "<dfn id=concept-current-drag-operation-none><code>none</code></dfn>", "<dfn id=concept-current-drag-operation-copy><code>copy</code></dfn>", "<dfn id=concept-current-drag-operation-link><code>link</code></dfn>", and "<dfn id=concept-current-drag-operation-move><code>move</code></dfn>". Initially, it has the value
- "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none><a href=#concept-current-drag-operation-none>none</a></code>". It is updated by the user agent
- as described in the steps below.</p>
- <p>User agents must, as soon as the drag operation is <a href=#initiate-the-drag-and-drop-operation id=drag-and-drop-processing-model:initiate-the-drag-and-drop-operation-2>initiated</a> and every 350ms (±200ms) thereafter for as long as the drag
- operation is ongoing, <a href=#queue-a-task id=drag-and-drop-processing-model:queue-a-task>queue a task</a> to perform the following steps in sequence:</p>
- <ol><li>
- <p>If the user agent is still performing the previous iteration of the sequence (if any) when
- the next iteration becomes due, abort these steps for this iteration (effectively "skipping
- missed frames" of the drag-and-drop operation).</p>
- <li>
- <p><a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-2>Fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-drag><a href=#event-dnd-drag>drag</a></code> at the
- <a href=#source-node id=drag-and-drop-processing-model:source-node-9>source node</a>. If this event is canceled, the user agent must set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation>current
- drag operation</a> to "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-2><a href=#concept-current-drag-operation-none>none</a></code>" (no
- drag operation).</p>
- <li>
- <p>If the <code id=drag-and-drop-processing-model:event-dnd-drag-2><a href=#event-dnd-drag>drag</a></code> event was not canceled and the user has not
- ended the drag-and-drop operation, check the state of the drag-and-drop operation, as
- follows:</p>
- <ol><li>
- <p>If the user is indicating a different <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-5>immediate user selection</a> than during the
- last iteration (or if this is the first iteration), and if this <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-6>immediate user
- selection</a> is not the same as the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-4>current target element</a>, then <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-3>fire a
- DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragexit><a href=#event-dnd-dragexit>dragexit</a></code> at the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-5>current
- target element</a>, and then update the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-6>current target element</a> as follows:</p>
- <dl class=switch><dt>If the new <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-7>immediate user selection</a> is null<dd><p>Set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-7>current target element</a> to null also.<dt>If the new <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-8>immediate user selection</a> is in a non-DOM document or
- application<dd><p>Set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-8>current target element</a> to the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-9>immediate user
- selection</a>.<dt>Otherwise<dd>
- <p><a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-4>Fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code>
- at the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-10>immediate user selection</a>.</p>
- <p>If the event is canceled, then set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-9>current target element</a> to the
- <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-11>immediate user selection</a>.</p>
- <p>Otherwise, run the appropriate step from the following list:</p>
- <dl class=switch><dt>If the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-12>immediate user selection</a> is a text field (e.g.
- <code id=drag-and-drop-processing-model:the-textarea-element><a href=#the-textarea-element>textarea</a></code>, or an <code id=drag-and-drop-processing-model:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=drag-and-drop-processing-model:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="drag-and-drop-processing-model:text-(type=text)-state-and-search-state-(type=search)">Text</a> state) or an <a href=#editing-host id=drag-and-drop-processing-model:editing-host>editing host</a> or
- <a href=#editable id=drag-and-drop-processing-model:editable>editable</a> element, and the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-6>drag data store item list</a> has an item
- with <a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-6>the drag data item type string</a> "<code id=drag-and-drop-processing-model:text/plain-2><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>" and <a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-5>the
- drag data item kind</a> <i>Plain Unicode string</i><dd><p>Set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-10>current target element</a> to the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-13>immediate user
- selection</a> anyway.<dt>If the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-14>immediate user selection</a> is an element with a <code id=drag-and-drop-processing-model:the-dropzone-attribute><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match id=drag-and-drop-processing-model:concept-dropzone-match>matches</a> the <a href=#drag-data-store id=drag-and-drop-processing-model:drag-data-store-2>drag data store</a><dd><p>Set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-11>current target element</a> to the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-15>immediate user
- selection</a> anyway.<dt>If the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-16>immediate user selection</a> is an element that itself has an ancestor
- element with a <code id=drag-and-drop-processing-model:the-dropzone-attribute-2><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match id=drag-and-drop-processing-model:concept-dropzone-match-2>matches</a> the <a href=#drag-data-store id=drag-and-drop-processing-model:drag-data-store-3>drag data store</a><dd>
- <p>Let <var>new target</var> be the nearest (deepest) such ancestor element.</p>
- <p>If the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-17>immediate user selection</a> is <var>new target</var>, then leave the
- <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-12>current target element</a> unchanged.</p>
- <p>Otherwise, <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-5>fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragenter-2><a href=#event-dnd-dragenter>dragenter</a></code> at <var>new target</var>, with the current
- <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-13>current target element</a> as the specific <var>related target</var>. Then, set
- the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-14>current target element</a> to <var>new target</var>, regardless of whether
- that event was canceled or not.</p>
- <dt>If the <a href=#immediate-user-selection id=drag-and-drop-processing-model:immediate-user-selection-18>immediate user selection</a> is <a href=#the-body-element-2 id=drag-and-drop-processing-model:the-body-element-2>the body element</a><dd><p>Leave the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-15>current target element</a> unchanged.<dt>Otherwise<dd>
- <p><a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-6>Fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragenter-3><a href=#event-dnd-dragenter>dragenter</a></code>
- at <a href=#the-body-element-2 id=drag-and-drop-processing-model:the-body-element-2-2>the body element</a>, if there is one, or at the <code id=drag-and-drop-processing-model:document-2><a href=#document>Document</a></code> object,
- if not. Then, set the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-16>current target element</a> to <a href=#the-body-element-2 id=drag-and-drop-processing-model:the-body-element-2-3>the body
- element</a>, regardless of whether that event was canceled or not.</p>
- </dl>
- </dl>
- <li>
- <p>If the previous step caused the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-17>current target element</a> to change, and if the
- previous target element was not null or a part of a non-DOM document, then <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-7>fire a DND
- event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragleave><a href=#event-dnd-dragleave>dragleave</a></code> at the previous target
- element, with the new <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-18>current target element</a> as the specific <var>related
- target</var>.</p>
- <li>
- <p>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-19>current target element</a> is a DOM element, then <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-8>fire a DND
- event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code> at this <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-20>current
- target element</a>.</p>
- <p>If the <code id=drag-and-drop-processing-model:event-dnd-dragover-2><a href=#event-dnd-dragover>dragover</a></code> event is not canceled, run the
- appropriate step from the following list:</p>
- <dl class=switch><dt>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-21>current target element</a> is a text field (e.g. <code id=drag-and-drop-processing-model:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>,
- or an <code id=drag-and-drop-processing-model:the-input-element-2><a href=#the-input-element>input</a></code> element whose <code id=drag-and-drop-processing-model:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute
- is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="drag-and-drop-processing-model:text-(type=text)-state-and-search-state-(type=search)-2">Text</a> state) or an <a href=#editing-host id=drag-and-drop-processing-model:editing-host-2>editing
- host</a> or <a href=#editable id=drag-and-drop-processing-model:editable-2>editable</a> element, and the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-7>drag data store item list</a>
- has an item with <a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-7>the drag data item type string</a> "<code id=drag-and-drop-processing-model:text/plain-3><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>" and
- <a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-6>the drag data item kind</a> <i>Plain Unicode string</i><dd><p>Set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-2>current drag operation</a> to either "<code id=drag-and-drop-processing-model:concept-current-drag-operation-copy><a href=#concept-current-drag-operation-copy>copy</a></code>" or "<code id=drag-and-drop-processing-model:concept-current-drag-operation-move><a href=#concept-current-drag-operation-move>move</a></code>", as appropriate given the platform
- conventions.<dt>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-22>current target element</a> is an element with a <code id=drag-and-drop-processing-model:the-dropzone-attribute-3><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match id=drag-and-drop-processing-model:concept-dropzone-match-3>matches</a> the <a href=#drag-data-store id=drag-and-drop-processing-model:drag-data-store-4>drag data store</a> and <a href=#concept-dropzone-operation id=drag-and-drop-processing-model:concept-dropzone-operation>specifies an operation</a><dd><p>Set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-3>current drag operation</a> to the operation <a href=#concept-dropzone-operation id=drag-and-drop-processing-model:concept-dropzone-operation-2>specified</a> by the <code id=drag-and-drop-processing-model:the-dropzone-attribute-4><a href=#the-dropzone-attribute>dropzone</a></code> attribute of the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-23>current target
- element</a>.</p>
- <dt>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-24>current target element</a> is an element with a <code id=drag-and-drop-processing-model:the-dropzone-attribute-5><a href=#the-dropzone-attribute>dropzone</a></code> attribute that <a href=#concept-dropzone-match id=drag-and-drop-processing-model:concept-dropzone-match-4>matches</a> the <a href=#drag-data-store id=drag-and-drop-processing-model:drag-data-store-5>drag data store</a> and does not
- <a href=#concept-dropzone-operation id=drag-and-drop-processing-model:concept-dropzone-operation-3>specify an operation</a><dd><p>Set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-4>current drag operation</a> to "<code id=drag-and-drop-processing-model:concept-current-drag-operation-copy-2><a href=#concept-current-drag-operation-copy>copy</a></code>".</p>
- <dt>Otherwise<dd><p>Reset the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-5>current drag operation</a> to "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-3><a href=#concept-current-drag-operation-none>none</a></code>".</dl>
- <p>Otherwise (if the <code id=drag-and-drop-processing-model:event-dnd-dragover-3><a href=#event-dnd-dragover>dragover</a></code> event <em>is</em>
- canceled), set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-6>current drag operation</a> based on the values of the <code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> and <code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attributes of the
- <code id=drag-and-drop-processing-model:dragevent><a href=#dragevent>DragEvent</a></code> object's <code id=drag-and-drop-processing-model:dom-dragevent-datatransfer><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
- object as they stood after the event <a href=#concept-event-dispatch id=drag-and-drop-processing-model:concept-event-dispatch>dispatch</a>
- finished, as per the following table:</p>
- <table><thead><tr><th><code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-2><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code><th><code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-2><a href=#dom-datatransfer-dropeffect>dropEffect</a></code><th>Drag operation<tbody><tr><td>"<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-copy><a href=#dom-datatransfer-effectallowed-copy>copy</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-copylink><a href=#dom-datatransfer-effectallowed-copylink>copyLink</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-copymove><a href=#dom-datatransfer-effectallowed-copymove>copyMove</a></code>", or "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-all><a href=#dom-datatransfer-effectallowed-all>all</a></code>"<td>"<code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-copy><a href=#dom-datatransfer-dropeffect-copy>copy</a></code>"<td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-copy-3><a href=#concept-current-drag-operation-copy>copy</a></code>"<tr><td>"<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized-2><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-link><a href=#dom-datatransfer-effectallowed-link>link</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-copylink-2><a href=#dom-datatransfer-effectallowed-copylink>copyLink</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-linkmove><a href=#dom-datatransfer-effectallowed-linkmove>linkMove</a></code>", or "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-all-2><a href=#dom-datatransfer-effectallowed-all>all</a></code>"<td>"<code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-link><a href=#dom-datatransfer-dropeffect-link>link</a></code>"<td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-link><a href=#concept-current-drag-operation-link>link</a></code>"<tr><td>"<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-uninitialized-3><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-move><a href=#dom-datatransfer-effectallowed-move>move</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-copymove-2><a href=#dom-datatransfer-effectallowed-copymove>copyMove</a></code>", "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-linkmove-2><a href=#dom-datatransfer-effectallowed-linkmove>linkMove</a></code>", or "<code id=drag-and-drop-processing-model:dom-datatransfer-effectallowed-all-3><a href=#dom-datatransfer-effectallowed-all>all</a></code>"<td>"<code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-move><a href=#dom-datatransfer-dropeffect-move>move</a></code>"<td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-move-2><a href=#concept-current-drag-operation-move>move</a></code>"<tr><td colspan=2>Any other case<td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-4><a href=#concept-current-drag-operation-none>none</a></code>"</table>
- <li>
- <p>Otherwise, if the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-25>current target element</a> is not a DOM element, use
- platform-specific mechanisms to determine what drag operation is being performed (none, copy,
- link, or move), and set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-7>current drag operation</a> accordingly.</p>
- <li>
- <p>Update the drag feedback (e.g. the mouse cursor) to match the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-8>current drag
- operation</a>, as follows:</p>
- <table><thead><tr><th>Drag operation<th>Feedback<tbody><tr><td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-copy-4><a href=#concept-current-drag-operation-copy>copy</a></code>"<td>Data will be copied if dropped here.<tr><td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-link-2><a href=#concept-current-drag-operation-link>link</a></code>"<td>Data will be linked if dropped here.<tr><td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-move-3><a href=#concept-current-drag-operation-move>move</a></code>"<td>Data will be moved if dropped here.<tr><td>"<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-5><a href=#concept-current-drag-operation-none>none</a></code>"<td>No operation allowed, dropping here will cancel the drag-and-drop operation.</table>
- </ol>
- <li>
- <p>Otherwise, if the user ended the drag-and-drop operation (e.g. by releasing the mouse button
- in a mouse-driven drag-and-drop interface), or if the <code id=drag-and-drop-processing-model:event-dnd-drag-3><a href=#event-dnd-drag>drag</a></code>
- event was canceled, then this will be the last iteration. Run the following steps, then stop the
- drag-and-drop operation:</p>
- <ol><li>
- <p>If the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-9>current drag operation</a> is "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-6><a href=#concept-current-drag-operation-none>none</a></code>" (no drag operation), or, if the user
- ended the drag-and-drop operation by canceling it (e.g. by hitting the <kbd>Escape</kbd> key),
- or if the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-26>current target element</a> is null, then the drag operation failed. Run
- these substeps:</p>
- <ol><li><p>Let <var>dropped</var> be false.<li><p>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-27>current target element</a> is a DOM element, <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-9>fire a DND
- event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragleave-2><a href=#event-dnd-dragleave>dragleave</a></code> at it; otherwise, if
- it is not null, use platform-specific conventions for drag cancellation.<li><p>Set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-10>current drag operation</a> to "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-7><a href=#concept-current-drag-operation-none>none</a></code>".</ol>
- <p>Otherwise, the drag operation might be a success; run these substeps:</p>
- <ol><li><p>Let <var>dropped</var> be true.<li><p>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-28>current target element</a> is a DOM element, <a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-10>fire a DND
- event</a> named <code id=drag-and-drop-processing-model:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> at it; otherwise, use
- platform-specific conventions for indicating a drop.<li>
- <p>If the event is canceled, set the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-11>current drag operation</a> to the value of the
- <code id=drag-and-drop-processing-model:dom-datatransfer-dropeffect-3><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> attribute of the
- <code id=drag-and-drop-processing-model:dragevent-2><a href=#dragevent>DragEvent</a></code> object's <code id=drag-and-drop-processing-model:dom-dragevent-datatransfer-2><a href=#dom-dragevent-datatransfer>dataTransfer</a></code>
- object as it stood after the event <a href=#concept-event-dispatch id=drag-and-drop-processing-model:concept-event-dispatch-2>dispatch</a>
- finished.</p>
- <p>Otherwise, the event is not canceled; perform the event's default action, which depends
- on the exact target as follows:</p>
- <dl class=switch><dt>If the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-29>current target element</a> is a text field (e.g. <code id=drag-and-drop-processing-model:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code>,
- or an <code id=drag-and-drop-processing-model:the-input-element-3><a href=#the-input-element>input</a></code> element whose <code id=drag-and-drop-processing-model:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute
- is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="drag-and-drop-processing-model:text-(type=text)-state-and-search-state-(type=search)-3">Text</a> state) or an <a href=#editing-host id=drag-and-drop-processing-model:editing-host-3>editing
- host</a> or <a href=#editable id=drag-and-drop-processing-model:editable-3>editable</a> element, and the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-8>drag data store item
- list</a> has an item with <a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-8>the drag data item type string</a>
- "<code id=drag-and-drop-processing-model:text/plain-4><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>" and <a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-7>the drag data item kind</a> <i>Plain Unicode
- string</i><dd><p>Insert the actual data of the first item in the <a href=#drag-data-store-item-list id=drag-and-drop-processing-model:drag-data-store-item-list-9>drag data store item
- list</a> to have <a href=#the-drag-data-item-type-string id=drag-and-drop-processing-model:the-drag-data-item-type-string-9>a drag data item type
- string</a> of "<code id=drag-and-drop-processing-model:text/plain-5><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>" and <a href=#the-drag-data-item-kind id=drag-and-drop-processing-model:the-drag-data-item-kind-8>a drag
- data item kind</a> that is <i>Plain Unicode string</i> into the text field or
- <a href=#editing-host id=drag-and-drop-processing-model:editing-host-4>editing host</a> or <a href=#editable id=drag-and-drop-processing-model:editable-4>editable</a> element in a manner consistent with
- platform-specific conventions (e.g. inserting it at the current mouse cursor position, or
- inserting it at the end of the field).<dt>Otherwise<dd><p>Reset the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-12>current drag operation</a> to "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-8><a href=#concept-current-drag-operation-none>none</a></code>".</dl>
- </ol>
- <li>
- <p><a href=#fire-a-dnd-event id=drag-and-drop-processing-model:fire-a-dnd-event-11>Fire a DND event</a> named <code id=drag-and-drop-processing-model:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code> at the
- <a href=#source-node id=drag-and-drop-processing-model:source-node-10>source node</a>.</p>
- <li>
- <p>Run the appropriate steps from the following list as the default action of the <code id=drag-and-drop-processing-model:event-dnd-dragend-2><a href=#event-dnd-dragend>dragend</a></code> event:</p>
- <dl class=switch><dt>If <var>dropped</var> is true, the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-30>current target element</a> is a <i>text
- field</i> (see below), the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-13>current drag operation</a> is "<code id=drag-and-drop-processing-model:concept-current-drag-operation-move-4><a href=#concept-current-drag-operation-move>move</a></code>", and the source of the
- drag-and-drop operation is a selection in the DOM that is entirely contained within an
- <a href=#editing-host id=drag-and-drop-processing-model:editing-host-5>editing host</a><dd><p><a href=#delete-the-selection id=drag-and-drop-processing-model:delete-the-selection>Delete the selection</a>.<dt>If <var>dropped</var> is true, the <a href=#current-target-element id=drag-and-drop-processing-model:current-target-element-31>current target element</a> is a <i>text
- field</i> (see below), the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-14>current drag operation</a> is "<code id=drag-and-drop-processing-model:concept-current-drag-operation-move-5><a href=#concept-current-drag-operation-move>move</a></code>", and the source of the
- drag-and-drop operation is a selection in a text field<dd><p>The user agent should delete the dragged selection from the relevant text
- field.<dt>If <var>dropped</var> is false or if the <a href=#current-drag-operation id=drag-and-drop-processing-model:current-drag-operation-15>current drag operation</a> is "<code id=drag-and-drop-processing-model:concept-current-drag-operation-none-9><a href=#concept-current-drag-operation-none>none</a></code>"<dd><p>The drag was canceled. If the platform conventions dictate that this be represented to
- the user (e.g. by animating the dragged selection going back to the source of the
- drag-and-drop operation), then do so.<dt>Otherwise<dd><p>The event has no default action.</dl>
- <p>For the purposes of this step, a <i>text field</i> is a <code id=drag-and-drop-processing-model:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> element or an
- <code id=drag-and-drop-processing-model:the-input-element-4><a href=#the-input-element>input</a></code> element whose <code id=drag-and-drop-processing-model:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in
- one of the
- <a href="#text-(type=text)-state-and-search-state-(type=search)" id="drag-and-drop-processing-model:text-(type=text)-state-and-search-state-(type=search)-4">Text</a>,
- <a href="#text-(type=text)-state-and-search-state-(type=search)" id="drag-and-drop-processing-model:text-(type=text)-state-and-search-state-(type=search)-5">Search</a>,
- <a href="#telephone-state-(type=tel)" id="drag-and-drop-processing-model:telephone-state-(type=tel)">Tel</a>,
- <a href="#url-state-(type=url)" id="drag-and-drop-processing-model:url-state-(type=url)">URL</a>,
- <a href="#e-mail-state-(type=email)" id="drag-and-drop-processing-model:e-mail-state-(type=email)">E-mail</a>,
- <a href="#password-state-(type=password)" id="drag-and-drop-processing-model:password-state-(type=password)">Password</a>, or
- <a href="#number-state-(type=number)" id="drag-and-drop-processing-model:number-state-(type=number)">Number</a>
- states.</p>
- </ol>
- </ol>
- <p class=note>User agents are encouraged to consider how to react to drags near the edge of
- scrollable regions. For example, if a user drags a link to the bottom of the viewport on a long
- page, it might make sense to scroll the page so that the user can drop the link lower on the
- page.</p>
- <p class=note>This model is independent of which <code id=drag-and-drop-processing-model:document-3><a href=#document>Document</a></code> object the nodes involved
- are from; the events are fired as described above and the rest of the processing model runs as
- described above, irrespective of how many documents are involved in the operation.</p>
-
- <h4 id=dndevents>6.7.6 Events summary</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The following events are involved in the drag-and-drop
- model.</p>
- <table><thead><tr><th> Event Name <th> Target <th> Cancelable? <th> <a href=#drag-data-store-mode id=dndevents:drag-data-store-mode>Drag data store mode</a> <th> <code id=dndevents:dom-datatransfer-dropeffect><a href=#dom-datatransfer-dropeffect>dropEffect</a></code> <th> Default Action <tbody><tr><td><dfn id=event-dnd-dragstart><code>dragstart</code></dfn><td><a href=#source-node id=dndevents:source-node>Source node</a><td>✓ Cancelable<td><a href=#concept-dnd-rw id=dndevents:concept-dnd-rw>Read/write mode</a>
-
- <td>"<code id=dndevents:dom-datatransfer-dropeffect-none><a href=#dom-datatransfer-dropeffect-none>none</a></code>"<td>Initiate the drag-and-drop operation<tr><td><dfn id=event-dnd-drag><code>drag</code></dfn><td><a href=#source-node id=dndevents:source-node-2>Source node</a><td>✓ Cancelable<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p>Protected mode</a>
-
- <td>"<code id=dndevents:dom-datatransfer-dropeffect-none-2><a href=#dom-datatransfer-dropeffect-none>none</a></code>"<td>Continue the drag-and-drop operation<tr><td><dfn id=event-dnd-dragenter><code>dragenter</code></dfn><td><a href=#immediate-user-selection id=dndevents:immediate-user-selection>Immediate user selection</a> or <a href=#the-body-element-2 id=dndevents:the-body-element-2>the body element</a><td>✓ Cancelable<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p-2>Protected mode</a>
-
- <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a><td>Reject <a href=#immediate-user-selection id=dndevents:immediate-user-selection-2>immediate user selection</a> as potential <a href=#current-target-element id=dndevents:current-target-element>target element</a><tr><td><dfn id=event-dnd-dragexit><code>dragexit</code></dfn><td><a href=#current-target-element id=dndevents:current-target-element-2>Previous target element</a><td>—<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p-3>Protected mode</a>
-
- <td>"<code id=dndevents:dom-datatransfer-dropeffect-none-3><a href=#dom-datatransfer-dropeffect-none>none</a></code>"<td>None<tr><td><dfn id=event-dnd-dragleave><code>dragleave</code></dfn><td><a href=#current-target-element id=dndevents:current-target-element-3>Previous target element</a><td>—<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p-4>Protected mode</a>
-
- <td>"<code id=dndevents:dom-datatransfer-dropeffect-none-4><a href=#dom-datatransfer-dropeffect-none>none</a></code>"<td>None<tr><td><dfn id=event-dnd-dragover><code>dragover</code></dfn><td><a href=#current-target-element id=dndevents:current-target-element-4>Current target element</a><td>✓ Cancelable<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p-5>Protected mode</a>
-
- <td><a href=#dropEffect-initialization>Based on <code>effectAllowed</code> value</a><td>Reset the <a href=#current-drag-operation id=dndevents:current-drag-operation>current drag operation</a> to "none"<tr><td><dfn id=event-dnd-drop><code>drop</code></dfn><td><a href=#current-target-element id=dndevents:current-target-element-5>Current target element</a><td>✓ Cancelable<td><a href=#concept-dnd-ro id=dndevents:concept-dnd-ro>Read-only mode</a>
-
- <td><a href=#current-drag-operation id=dndevents:current-drag-operation-2>Current drag operation</a><td>Varies<tr><td><dfn id=event-dnd-dragend><code>dragend</code></dfn><td><a href=#source-node id=dndevents:source-node-3>Source node</a><td>—<td><a href=#concept-dnd-p id=dndevents:concept-dnd-p-6>Protected mode</a>
-
- <td><a href=#current-drag-operation id=dndevents:current-drag-operation-3>Current drag operation</a><td>Varies</table>
- <p>Not shown in the above table: all these events bubble, and the <code id=dndevents:dom-datatransfer-effectallowed><a href=#dom-datatransfer-effectallowed>effectAllowed</a></code> attribute always has the value it had
- after the <code id=dndevents:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event, defaulting to "<code id=dndevents:dom-datatransfer-effectallowed-uninitialized><a href=#dom-datatransfer-effectallowed-uninitialized>uninitialized</a></code>" in the <code id=dndevents:event-dnd-dragstart-2><a href=#event-dnd-dragstart>dragstart</a></code> event.</p>
- <h4 id=the-draggable-attribute>6.7.7 The <dfn><code>draggable</code></dfn> attribute</h4>
- <p>All <a href=#html-elements id=the-draggable-attribute:html-elements>HTML elements</a> may have the <code id=the-draggable-attribute:the-draggable-attribute><a href=#the-draggable-attribute>draggable</a></code>
- content attribute set. The <code id=the-draggable-attribute:the-draggable-attribute-2><a href=#the-draggable-attribute>draggable</a></code> attribute is an
- <a href=#enumerated-attribute id=the-draggable-attribute:enumerated-attribute>enumerated attribute</a>. It has three states. The first state is <i>true</i> and it has
- the keyword <code>true</code>. The second state is <i>false</i> and it has the keyword
- <code>false</code>. The third state is <i>auto</i>; it has no keywords but it is the
- <i id=the-draggable-attribute:missing-value-default><a href=#missing-value-default>missing value default</a></i>.</p>
- <p>The <i>true</i> state means the element is draggable; the <i>false</i> state means that it is
- not. The <i>auto</i> state uses the default behavior of the user agent.</p>
- <p>An element with a <code id=the-draggable-attribute:the-draggable-attribute-3><a href=#the-draggable-attribute>draggable</a></code> attribute should also have a
- <code id=the-draggable-attribute:attr-title><a href=#attr-title>title</a></code> attribute that names the element for the purpose of
- non-visual interactions. </p>
- <dl class=domintro><dt><var>element</var> . <code id=the-draggable-attribute:dom-draggable><a href=#dom-draggable>draggable</a></code> [ = <var>value</var> ]<dd>
- <p>Returns true if the element is draggable; otherwise, returns false.</p>
- <p>Can be set, to override the default and set the <code id=the-draggable-attribute:the-draggable-attribute-4><a href=#the-draggable-attribute>draggable</a></code>
- content attribute.</p>
- </dl>
-
- <p>The <dfn id=dom-draggable><code>draggable</code></dfn> IDL attribute, whose value depends
- on the content attribute's in the way described below, controls whether or not the element is
- draggable. Generally, only text selections are draggable, but elements whose <code id=the-draggable-attribute:dom-draggable-2><a href=#dom-draggable>draggable</a></code> IDL attribute is true become draggable as well.</p>
- <p>If an element's <code id=the-draggable-attribute:the-draggable-attribute-5><a href=#the-draggable-attribute>draggable</a></code> content attribute has the state
- <i>true</i>, the <code id=the-draggable-attribute:dom-draggable-3><a href=#dom-draggable>draggable</a></code> IDL attribute must return true.</p>
- <p>Otherwise, if the element's <code id=the-draggable-attribute:the-draggable-attribute-6><a href=#the-draggable-attribute>draggable</a></code> content attribute has
- the state <i>false</i>, the <code id=the-draggable-attribute:dom-draggable-4><a href=#dom-draggable>draggable</a></code> IDL attribute must return
- false.</p>
- <p>Otherwise, the element's <code id=the-draggable-attribute:the-draggable-attribute-7><a href=#the-draggable-attribute>draggable</a></code> content attribute has
- the state <i>auto</i>. If the element is an <code id=the-draggable-attribute:the-img-element><a href=#the-img-element>img</a></code> element, an <code id=the-draggable-attribute:the-object-element><a href=#the-object-element>object</a></code>
- element that <a href=#represents id=the-draggable-attribute:represents>represents</a> an image, or an <code id=the-draggable-attribute:the-a-element><a href=#the-a-element>a</a></code> element with an <code id=the-draggable-attribute:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> content attribute, the <code id=the-draggable-attribute:dom-draggable-5><a href=#dom-draggable>draggable</a></code> IDL attribute must return true; otherwise, the <code id=the-draggable-attribute:dom-draggable-6><a href=#dom-draggable>draggable</a></code> IDL attribute must return false.</p>
- <p>If the <code id=the-draggable-attribute:dom-draggable-7><a href=#dom-draggable>draggable</a></code> IDL attribute is set to the value false,
- the <code id=the-draggable-attribute:the-draggable-attribute-8><a href=#the-draggable-attribute>draggable</a></code> content attribute must be set to the literal
- value "<code>false</code>". If the <code id=the-draggable-attribute:dom-draggable-8><a href=#dom-draggable>draggable</a></code> IDL
- attribute is set to the value true, the <code id=the-draggable-attribute:the-draggable-attribute-9><a href=#the-draggable-attribute>draggable</a></code> content
- attribute must be set to the literal value "<code>true</code>".</p>
-
- <h4 id=the-dropzone-attribute>6.7.8 The <dfn><code>dropzone</code></dfn> attribute</h4>
- <p>All <a href=#html-elements id=the-dropzone-attribute:html-elements>HTML elements</a> may have the <code id=the-dropzone-attribute:the-dropzone-attribute><a href=#the-dropzone-attribute>dropzone</a></code> content
- attribute set. When specified, its value must be an <a href=#unordered-set-of-unique-space-separated-tokens id=the-dropzone-attribute:unordered-set-of-unique-space-separated-tokens>unordered set of unique space-separated
- tokens</a> that are <a href=#ascii-case-insensitive id=the-dropzone-attribute:ascii-case-insensitive>ASCII case-insensitive</a>. The allowed values are the
- following:</p>
- <dl><dt><dfn id=attr-dropzone-copy><code>copy</code></dfn><dd><p>Indicates that dropping an accepted item on the element will result in a copy of the
- dragged data.</p>
- <dt><dfn id=attr-dropzone-move><code>move</code></dfn><dd><p>Indicates that dropping an accepted item on the element will result in the dragged data
- being moved to the new location.</p>
- <dt><dfn id=attr-dropzone-link><code>link</code></dfn><dd><p>Indicates that dropping an accepted item on the element will result in a link to the
- original data.</p>
- <dt>Any keyword with eight characters or more, beginning with the an <a href=#ascii-case-insensitive id=the-dropzone-attribute:ascii-case-insensitive-2>ASCII
- case-insensitive</a> match for the string "<code>string:</code>"<dd><p>Indicates that items with <a href=#the-drag-data-item-kind id=the-dropzone-attribute:the-drag-data-item-kind>the drag data item kind</a> <i>Plain Unicode string</i>
- and <a href=#the-drag-data-item-type-string id=the-dropzone-attribute:the-drag-data-item-type-string>the drag data item type string</a> set to a value that matches the remainder of the
- keyword are accepted.<dt>Any keyword with six characters or more, beginning with an <a href=#ascii-case-insensitive id=the-dropzone-attribute:ascii-case-insensitive-3>ASCII
- case-insensitive</a> match for the string "<code>file:</code>"<dd><p>Indicates that items with <a href=#the-drag-data-item-kind id=the-dropzone-attribute:the-drag-data-item-kind-2>the drag data item kind</a> <i>File</i> and <a href=#the-drag-data-item-type-string id=the-dropzone-attribute:the-drag-data-item-type-string-2>the
- drag data item type string</a> set to a value that matches the remainder of the keyword are
- accepted.</dl>
- <p>The <code id=the-dropzone-attribute:the-dropzone-attribute-2><a href=#the-dropzone-attribute>dropzone</a></code> content attribute's values must not have more
- than one of the three feedback values (<code id=the-dropzone-attribute:attr-dropzone-copy><a href=#attr-dropzone-copy>copy</a></code>, <code id=the-dropzone-attribute:attr-dropzone-move><a href=#attr-dropzone-move>move</a></code>, and <code id=the-dropzone-attribute:attr-dropzone-link><a href=#attr-dropzone-link>link</a></code>)
- specified. If none are specified, the <code id=the-dropzone-attribute:attr-dropzone-copy-2><a href=#attr-dropzone-copy>copy</a></code> value is
- implied.</p>
- <p>An element with a <code id=the-dropzone-attribute:the-dropzone-attribute-3><a href=#the-dropzone-attribute>dropzone</a></code> attribute should also have a
- <code id=the-dropzone-attribute:attr-title><a href=#attr-title>title</a></code> attribute that names the element for the purpose of
- non-visual interactions. </p>
-
- <p>A <code id=the-dropzone-attribute:the-dropzone-attribute-4><a href=#the-dropzone-attribute>dropzone</a></code> attribute <dfn id=concept-dropzone-match>matches a drag data store</dfn> if the <a href=#dropzone-processing-steps id=the-dropzone-attribute:dropzone-processing-steps><code>dropzone</code> processing steps</a> result in a match.</p>
- <p>A <code id=the-dropzone-attribute:the-dropzone-attribute-5><a href=#the-dropzone-attribute>dropzone</a></code> attribute <dfn id=concept-dropzone-operation>specifies an operation</dfn> if the <a href=#dropzone-processing-steps id=the-dropzone-attribute:dropzone-processing-steps-2><code>dropzone</code> processing steps</a> result in a specified operation. The
- specified operation is as given by those steps.</p>
- <p>The <dfn id=dropzone-processing-steps><code>dropzone</code> processing steps</dfn> are as follows.
- They either result in a match or not, and separate from this result either in a specified
- operation or not, as defined below.</p>
- <ol><li><p>Let <var>value</var> be the value of the <code id=the-dropzone-attribute:the-dropzone-attribute-6><a href=#the-dropzone-attribute>dropzone</a></code> attribute.<li><p>Let <var>keywords</var> be the result of <a href=#split-a-string-on-spaces id=the-dropzone-attribute:split-a-string-on-spaces>splitting <var>value</var> on spaces</a>.<li><p>Let <var>matched</var> be false.<li><p>Let <var>operation</var> be unspecified.<li>
- <p>For each value in <var>keywords</var>, if any, in the order that they were found in
- <var>value</var>, run the following steps.</p>
- <ol><li><p>Let <var>keyword</var> be the keyword.<li>
- <p>If <var>keyword</var> is one of "<code id=the-dropzone-attribute:attr-dropzone-copy-3><a href=#attr-dropzone-copy>copy</a></code>",
- "<code id=the-dropzone-attribute:attr-dropzone-move-2><a href=#attr-dropzone-move>move</a></code>", or "<code id=the-dropzone-attribute:attr-dropzone-link-2><a href=#attr-dropzone-link>link</a></code>", then: run the following substeps:</p>
- <ol><li><p>If <var>operation</var> is still unspecified, then let <var>operation</var> be the string given by <var>keyword</var>.<li><p>Skip to the step labeled <i>end of keyword</i> below.</ol>
- <li><p>If <var>keyword</var> does not contain a U+003A COLON character (:), or if the
- first such character in <var>keyword</var> is either the first character or the last
- character in the string, then skip to the step labeled <i>end of keyword</i> below.<li><p>Let <var>kind code</var> be the substring of <var>keyword</var> from
- the first character in the string to the last character in the string that is before the first
- U+003A COLON character (:) in the string, <a href=#converted-to-ascii-lowercase id=the-dropzone-attribute:converted-to-ascii-lowercase>converted to ASCII lowercase</a>.</p>
- <li>
- <p>Jump to the appropriate step from the list below, based on the value of <var>kind
- code</var>:</p>
- <dl class=switch><dt>If <var>kind code</var> is the string "<code>string</code>"<dd>
- <p>Let <var>kind</var> be <i>Plain Unicode string</i>.</p>
- <dt>If <var>kind code</var> is the string "<code>file</code>"<dd>
- <p>Let <var>kind</var> be <i>File</i>.</p>
- <dt>Otherwise<dd>
- <p>Skip to the step labeled <i>end of keyword</i> below.</p>
- </dl>
- <li><p>Let <var>type</var> be the substring of <var>keyword</var> from the
- first character after the first U+003A COLON character (:) in the string, to the last character
- in the string, <a href=#converted-to-ascii-lowercase id=the-dropzone-attribute:converted-to-ascii-lowercase-2>converted to ASCII lowercase</a>.<li><p>If there exist any items in the <a href=#drag-data-store-item-list id=the-dropzone-attribute:drag-data-store-item-list>drag data store item list</a> whose <a href=#the-drag-data-item-kind id=the-dropzone-attribute:the-drag-data-item-kind-3>drag data item kind</a> is the
- kind given in <var>kind</var> and
- whose <a href=#the-drag-data-item-type-string id=the-dropzone-attribute:the-drag-data-item-type-string-3>drag data item type string</a> is <var>type</var>, then let <var>matched</var> be true.<li><p><i>End of keyword</i>: Go on to the next keyword, if any, or the next step in the
- overall algorithm, if there are no more.</ol>
- <li>
- <p>The algorithm results in a match if <var>matched</var> is true, and does not
- otherwise.</p>
- <p>The algorithm results in a specified operation if <var>operation</var> is not
- unspecified. The specified operation, if one is specified, is the one given by <var>operation</var>.</p>
- </ol>
- <p>The <dfn id=dom-dropzone><code>dropzone</code></dfn> IDL attribute must
- <a href=#reflect id=the-dropzone-attribute:reflect>reflect</a> the content attribute of the same name.</p>
-
- <div class=example>
- <p>In this example, a <code id=the-dropzone-attribute:the-div-element><a href=#the-div-element>div</a></code> element is made into a drop target for image files using
- the <code id=the-dropzone-attribute:the-dropzone-attribute-7><a href=#the-dropzone-attribute>dropzone</a></code> attribute. Images dropped into the target are
- then displayed.</p>
- <pre><div dropzone="copy file:image/png file:image/gif file:image/jpeg" ondrop="receive(event, this)">
- <p>Drop an image here to have it displayed.</p>
- </div>
- <script>
- function receive(event, element) {
- var data = event.dataTransfer.items;
- for (var i = 0; i < data.length; i += 1) {
- if ((data[i].kind == 'file') && (data[i].type.match('^image/'))) {
- var img = new Image();
- img.src = window.createObjectURL(data[i].getAsFile());
- element.appendChild(img);
- }
- }
- }
- </script></pre>
- </div>
-
- <h4 id=security-risks-in-the-drag-and-drop-model>6.7.9 Security risks in the drag-and-drop model</h4>
- <p>User agents must not make the data added to the <code id=security-risks-in-the-drag-and-drop-model:datatransfer><a href=#datatransfer>DataTransfer</a></code> object during the
- <code id=security-risks-in-the-drag-and-drop-model:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event available to scripts until the <code id=security-risks-in-the-drag-and-drop-model:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event, because otherwise, if a user were to drag sensitive
- information from one document to a second document, crossing a hostile third document in the
- process, the hostile document could intercept the data.</p>
- <p>For the same reason, user agents must consider a drop to be successful only if the user
- specifically ended the drag operation — if any scripts end the drag operation, it must be
- considered unsuccessful (canceled) and the <code id=security-risks-in-the-drag-and-drop-model:event-dnd-drop-2><a href=#event-dnd-drop>drop</a></code> event must not be
- fired.</p>
- <p>User agents should take care to not start drag-and-drop operations in response to script
- actions. For example, in a mouse-and-window environment, if a script moves a window while the user
- has his mouse button depressed, the UA would not consider that to start a drag. This is important
- because otherwise UAs could cause data to be dragged from sensitive sources and dropped into
- hostile documents without the user's consent.</p>
- <p>User agents should filter potentially active (scripted) content (e.g. HTML) when it is dragged
- and when it is dropped, using a whitelist of known-safe features. Similarly, <a href=#relative-url id=security-risks-in-the-drag-and-drop-model:relative-url>relative URLs</a> should be turned into absolute URLs to avoid references changing in
- unexpected ways. This specification does not specify how this is performed.</p>
- <div class=example>
- <p>Consider a hostile page providing some content and getting the user to select and drag and
- drop (or indeed, copy and paste) that content to a victim page's <code id=security-risks-in-the-drag-and-drop-model:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code> region. If the browser does not ensure that
- only safe content is dragged, potentially unsafe content such as scripts and event handlers in
- the selection, once dropped (or pasted) into the victim site, get the privileges of the victim
- site. This would thus enable a cross-site scripting attack.</p>
- </div>
-
- <h2 id=browsers>7 Loading Web pages</h2>
-
- <p>This section describes features that apply most directly to Web browsers. Having said that,
- except where specified otherwise, the requirements defined in this section <em>do</em> apply to
- all user agents, whether they are Web browsers or not.</p>
-
- <h3 id=windows>7.1 Browsing contexts</h3>
- <p>A <dfn id=browsing-context>browsing context</dfn> is an environment in which <code id=windows:document><a href=#document>Document</a></code> objects are
- presented to the user.</p>
- <p class=note>A tab or window in a Web browser typically contains a <a href=#browsing-context id=windows:browsing-context>browsing
- context</a>, as does an <code id=windows:the-iframe-element><a href=#the-iframe-element>iframe</a></code> or <code id=windows:frame><a href=#frame>frame</a></code>s in a
- <code id=windows:frameset><a href=#frameset>frameset</a></code>.</p>
- <p>Each <a href=#browsing-context id=windows:browsing-context-2>browsing context</a> has a corresponding <code id=windows:windowproxy><a href=#windowproxy>WindowProxy</a></code> object.</p>
- <p>A <a href=#browsing-context id=windows:browsing-context-3>browsing context</a> has a <a href=#session-history id=windows:session-history>session history</a>, which lists the
- <code id=windows:document-2><a href=#document>Document</a></code> objects that that <a href=#browsing-context id=windows:browsing-context-4>browsing context</a> has presented, is
- presenting, or will present. At any time, one <code id=windows:document-3><a href=#document>Document</a></code> in each <a href=#browsing-context id=windows:browsing-context-5>browsing
- context</a> is designated the <dfn id=active-document>active document</dfn>. A <code id=windows:document-4><a href=#document>Document</a></code>'s
- <a href=#browsing-context id=windows:browsing-context-6>browsing context</a> is that <a href=#browsing-context id=windows:browsing-context-7>browsing context</a> whose <a href=#session-history id=windows:session-history-2>session
- history</a> contains the <code id=windows:document-5><a href=#document>Document</a></code>, if any. (A <code id=windows:document-6><a href=#document>Document</a></code> created using
- an API such as <code id=windows:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> has no
- <a href=#browsing-context id=windows:browsing-context-8>browsing context</a>.)</p>
- <p>Each <code id=windows:document-7><a href=#document>Document</a></code> in a <a href=#browsing-context id=windows:browsing-context-9>browsing context</a> is <dfn id=concept-document-window>associated</dfn> with a <code id=windows:window><a href=#window>Window</a></code> object. A
- <a href=#browsing-context id=windows:browsing-context-10>browsing context</a>'s <code id=windows:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object forwards everything to the
- <a href=#browsing-context id=windows:browsing-context-11>browsing context</a>'s <a href=#active-document id=windows:active-document>active document</a>'s <code id=windows:window-2><a href=#window>Window</a></code> object.</p>
- <p class=note>In general, there is a 1-to-1 mapping from the <code id=windows:window-3><a href=#window>Window</a></code> object to the
- <code id=windows:document-8><a href=#document>Document</a></code> object. There are two exceptions. First, a <code id=windows:window-4><a href=#window>Window</a></code> can be reused
- for the presentation of a second <code id=windows:document-9><a href=#document>Document</a></code> in the same <a href=#browsing-context id=windows:browsing-context-12>browsing context</a>,
- such that the mapping is then 1-to-2. This occurs when a <a href=#browsing-context id=windows:browsing-context-13>browsing context</a> is <a href=#navigate id=windows:navigate>navigated</a> from the initial <code id=windows:about:blank><a href=#about:blank>about:blank</a></code> <code id=windows:document-10><a href=#document>Document</a></code>
- to another, with <a href=#replacement-enabled id=windows:replacement-enabled>replacement enabled</a>. Second, a <code id=windows:document-11><a href=#document>Document</a></code> can end up
- being reused for several <code id=windows:window-5><a href=#window>Window</a></code> objects when the <code id=windows:dom-document-open><a href=#dom-document-open>document.open()</a></code> method is used, such that the mapping is then
- many-to-1.</p>
- <p class=note>A <code id=windows:document-12><a href=#document>Document</a></code> does not necessarily have a <a href=#browsing-context id=windows:browsing-context-14>browsing context</a>
- associated with it. In particular, data mining tools are likely to never instantiate browsing
- contexts.</p>
- <hr>
- <p>A <a href=#browsing-context id=windows:browsing-context-15>browsing context</a> can have a <dfn id=creator-browsing-context>creator browsing context</dfn>, the
- <a href=#browsing-context id=windows:browsing-context-16>browsing context</a> that was responsible for its creation. If a <a href=#browsing-context id=windows:browsing-context-17>browsing
- context</a> has a <a href=#parent-browsing-context id=windows:parent-browsing-context>parent browsing context</a>, then that is its <a href=#creator-browsing-context id=windows:creator-browsing-context>creator browsing
- context</a>. Otherwise, if the <a href=#browsing-context id=windows:browsing-context-18>browsing context</a> has an <a href=#opener-browsing-context id=windows:opener-browsing-context>opener browsing
- context</a>, then <em>that</em> is its <a href=#creator-browsing-context id=windows:creator-browsing-context-2>creator browsing context</a>. Otherwise, the
- <a href=#browsing-context id=windows:browsing-context-19>browsing context</a> has no <a href=#creator-browsing-context id=windows:creator-browsing-context-3>creator browsing context</a>.</p>
- <p>If a <a href=#browsing-context id=windows:browsing-context-20>browsing context</a> <var>A</var> has a <a href=#creator-browsing-context id=windows:creator-browsing-context-4>creator browsing
- context</a>, then the <code id=windows:document-13><a href=#document>Document</a></code> that was the <a href=#active-document id=windows:active-document-2>active document</a> of that
- <a href=#creator-browsing-context id=windows:creator-browsing-context-5>creator browsing context</a> at the time <var>A</var> was created is the
- <dfn id=creator-document>creator <code>Document</code></dfn>.</p>
-
- <p>When a <a href=#browsing-context id=windows:browsing-context-21>browsing context</a> is first created, it must be created with a single
- <code id=windows:document-14><a href=#document>Document</a></code> in its session history, whose <a href=http://dom.spec.whatwg.org/#concept-document-url id="windows:the-document's-address" data-x-internal="the-document's-address">address</a> is <code id=windows:about:blank-2><a href=#about:blank>about:blank</a></code>, which is marked as being an <a href=#html-documents id=windows:html-documents>HTML document</a>, whose <a href="#document's-character-encoding" id="windows:document's-character-encoding">character encoding</a> is UTF-8, and which is both <a href=#ready-for-post-load-tasks id=windows:ready-for-post-load-tasks>ready for post-load
- tasks</a> and <a href=#completely-loaded id=windows:completely-loaded>completely loaded</a> immediately, along with a new <code id=windows:window-6><a href=#window>Window</a></code>
- object that the <code id=windows:document-15><a href=#document>Document</a></code> is associated with. The <code id=windows:document-16><a href=#document>Document</a></code> must have a
- single child <code id=windows:the-html-element><a href=#the-html-element>html</a></code> node, which itself has two empty child nodes: a <code id=windows:the-head-element><a href=#the-head-element>head</a></code>
- element, and a <code id=windows:the-body-element><a href=#the-body-element>body</a></code> element. As soon as this <code id=windows:document-17><a href=#document>Document</a></code> is created, the
- user agent must <a href=#implement-the-sandboxing id=windows:implement-the-sandboxing>implement the sandboxing</a> for it. If the <a href=#browsing-context id=windows:browsing-context-22>browsing context</a>
- has a <a href=#creator-document id=windows:creator-document>creator <code>Document</code></a>, then the <a href=#browsing-context id=windows:browsing-context-23>browsing context</a>'s
- <code id=windows:document-18><a href=#document>Document</a></code>'s <a href="#the-document's-referrer" id="windows:the-document's-referrer">referrer</a> must be set to
- <a href=http://dom.spec.whatwg.org/#concept-document-url id="windows:the-document's-address-2" data-x-internal="the-document's-address">the address</a> of that <a href=#creator-document id=windows:creator-document-2>creator
- <code>Document</code></a> at the time of the <a href=#browsing-context id=windows:browsing-context-24>browsing context</a>'s creation.</p>
- <p class=note>If the <a href=#browsing-context id=windows:browsing-context-25>browsing context</a> is created specifically to be immediately
- navigated, then that initial navigation will have <a href=#replacement-enabled id=windows:replacement-enabled-2>replacement enabled</a>.</p>
- <p id=about-blank-origin>The <a href=#origin-2 id=windows:origin-2>origin</a> and <a href=#effective-script-origin id=windows:effective-script-origin>effective script origin</a> of the
- <code id=windows:about:blank-3><a href=#about:blank>about:blank</a></code> <code id=windows:document-19><a href=#document>Document</a></code> are set when the <code id=windows:document-20><a href=#document>Document</a></code> is created.
- If the new <a href=#browsing-context id=windows:browsing-context-26>browsing context</a> has a <a href=#creator-browsing-context id=windows:creator-browsing-context-6>creator browsing context</a>, then the
- <a href=#origin-2 id=windows:origin-2-2>origin</a> of the <code id=windows:about:blank-4><a href=#about:blank>about:blank</a></code> <code id=windows:document-21><a href=#document>Document</a></code> is an <a href=#concept-origin-alias id=windows:concept-origin-alias>alias</a> to the <a href=#origin-2 id=windows:origin-2-3>origin</a> of the <a href=#creator-document id=windows:creator-document-3>creator
- <code>Document</code></a> and the <a href=#effective-script-origin id=windows:effective-script-origin-2>effective script origin</a> of the
- <code id=windows:about:blank-5><a href=#about:blank>about:blank</a></code> <code id=windows:document-22><a href=#document>Document</a></code> is initially an <a href=#concept-origin-alias id=windows:concept-origin-alias-2>alias</a> to the <a href=#effective-script-origin id=windows:effective-script-origin-3>effective script origin</a> of the
- <a href=#creator-document id=windows:creator-document-4>creator <code>Document</code></a>. Otherwise, the <a href=#origin-2 id=windows:origin-2-4>origin</a> of the
- <code id=windows:about:blank-6><a href=#about:blank>about:blank</a></code> <code id=windows:document-23><a href=#document>Document</a></code> is a globally unique identifier assigned when the
- new <a href=#browsing-context id=windows:browsing-context-27>browsing context</a> is created and the <a href=#effective-script-origin id=windows:effective-script-origin-4>effective script origin</a> of the
- <code id=windows:about:blank-7><a href=#about:blank>about:blank</a></code> <code id=windows:document-24><a href=#document>Document</a></code> is initially an <a href=#concept-origin-alias id=windows:concept-origin-alias-3>alias</a> to its <a href=#origin-2 id=windows:origin-2-5>origin</a>.</p>
-
- <h4 id=nested-browsing-contexts>7.1.1 Nested browsing contexts</h4>
- <p>Certain elements (for example, <code id=nested-browsing-contexts:the-iframe-element><a href=#the-iframe-element>iframe</a></code> elements) can instantiate further <a href=#browsing-context id=nested-browsing-contexts:browsing-context>browsing contexts</a>. These are called <dfn id=nested-browsing-context>nested browsing contexts</dfn>. If a browsing context <var>P</var> has a
- <code id=nested-browsing-contexts:document><a href=#document>Document</a></code> <var>D</var> with an element <var>E</var> that nests
- another browsing context <var>C</var> inside it, then <var>C</var> is said to be
- <dfn id=browsing-context-nested-through>nested through</dfn> <var>D</var>, and <var>E</var> is said to be the <dfn id=browsing-context-container>browsing context container</dfn> of <var>C</var>.
- If the <a href=#browsing-context-container id=nested-browsing-contexts:browsing-context-container>browsing context container</a> element <var>E</var> is <a href=#in-a-document id=nested-browsing-contexts:in-a-document>in</a> the <code id=nested-browsing-contexts:document-2><a href=#document>Document</a></code> <var>D</var>, then <var>P</var> is
- said to be the <dfn id=parent-browsing-context>parent browsing context</dfn> of <var>C</var> and <var>C</var> is said to be a <dfn id=child-browsing-context>child browsing context</dfn> of <var>P</var>.
- Otherwise, the <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context>nested browsing context</a> <var>C</var> has no <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context>parent
- browsing context</a>.</p>
- <p>A browsing context <var>A</var> is said to be an <dfn id=ancestor-browsing-context>ancestor</dfn> of a browsing context <var>B</var> if there exists a browsing
- context <var>A'</var> that is a <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context>child browsing context</a> of <var>A</var> and that is itself an <a href=#ancestor-browsing-context id=nested-browsing-contexts:ancestor-browsing-context>ancestor</a> of
- <var>B</var>, or if the browsing context <var>A</var> is the
- <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-2>parent browsing context</a> of <var>B</var>.</p>
- <p>A browsing context that is not a <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context-2>nested browsing context</a> has no <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-3>parent
- browsing context</a>, and is the <dfn id=top-level-browsing-context>top-level browsing context</dfn> of all the browsing
- contexts for which it is an <a href=#ancestor-browsing-context id=nested-browsing-contexts:ancestor-browsing-context-2>ancestor browsing context</a>.</p>
- <p>The transitive closure of <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-4>parent browsing contexts</a>
- for a <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context-3>nested browsing context</a> gives the list of <a href=#ancestor-browsing-context id=nested-browsing-contexts:ancestor-browsing-context-3>ancestor browsing contexts</a>.</p>
- <p>The <dfn id=list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</dfn> of a <code id=nested-browsing-contexts:document-3><a href=#document>Document</a></code> <var>d</var> is the (ordered) list returned by the following algorithm:</p>
- <ol><li><p>Let <var>list</var> be an empty list.<li>
- <p>For each <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-2>child browsing context</a> of <var>d</var> that is <a href=#browsing-context-nested-through id=nested-browsing-contexts:browsing-context-nested-through>nested through</a> an element that is <a href=#in-a-document id=nested-browsing-contexts:in-a-document-2>in the <code>Document</code></a> <var>d</var>, in the <a href=#tree-order id=nested-browsing-contexts:tree-order>tree
- order</a> of the elements nesting those <a href=#browsing-context id=nested-browsing-contexts:browsing-context-2>browsing
- contexts</a>, run these substeps:</p>
- <ol><li><p>Append that <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-3>child browsing context</a> to the list <var>list</var>.</p>
- <li><p>Append the <a href=#list-of-the-descendant-browsing-contexts id=nested-browsing-contexts:list-of-the-descendant-browsing-contexts>list of the descendant browsing contexts</a> of the <a href=#active-document id=nested-browsing-contexts:active-document>active
- document</a> of that <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-4>child browsing context</a> to the list <var>list</var>.</ol>
- <li><p>Return the constructed <var>list</var>.</ol>
- <p>A <code id=nested-browsing-contexts:document-4><a href=#document>Document</a></code> is said to be <dfn id=fully-active>fully active</dfn> when it is the <a href=#active-document id=nested-browsing-contexts:active-document-2>active
- document</a> of its <a href=#browsing-context id=nested-browsing-contexts:browsing-context-3>browsing context</a>, and either its browsing context is a
- <a href=#top-level-browsing-context id=nested-browsing-contexts:top-level-browsing-context>top-level browsing context</a>, or it has a <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-5>parent browsing context</a> and the
- <code id=nested-browsing-contexts:document-5><a href=#document>Document</a></code> <a href=#browsing-context-nested-through id=nested-browsing-contexts:browsing-context-nested-through-2>through which</a> it is
- <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context-4>nested</a> is itself <a href=#fully-active id=nested-browsing-contexts:fully-active>fully active</a>.</p>
- <p>Because they are nested through an element, <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-5>child browsing
- contexts</a> are always tied to a specific <code id=nested-browsing-contexts:document-6><a href=#document>Document</a></code> in their <a href=#parent-browsing-context id=nested-browsing-contexts:parent-browsing-context-6>parent browsing
- context</a>. User agents must not allow the user to interact with <a href=#child-browsing-context id=nested-browsing-contexts:child-browsing-context-6>child browsing contexts</a> of elements that are in <code id=nested-browsing-contexts:document-7><a href=#document>Document</a></code>s that are
- not themselves <a href=#fully-active id=nested-browsing-contexts:fully-active-2>fully active</a>.</p>
- <p>A <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context-5>nested browsing context</a> can have a <a href=#seamless-browsing-context-flag id=nested-browsing-contexts:seamless-browsing-context-flag>seamless browsing context flag</a>
- set, if it is embedded through an <code id=nested-browsing-contexts:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> element with a <code id=nested-browsing-contexts:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code> attribute.</p>
- <p>A <a href=#nested-browsing-context id=nested-browsing-contexts:nested-browsing-context-6>nested browsing context</a> can be put into a <dfn id=delaying-load-events-mode>delaying <code>load</code> events mode</dfn>. This is used when it is <a href=#navigate id=nested-browsing-contexts:navigate>navigated</a>, to <a href=#delay-the-load-event id=nested-browsing-contexts:delay-the-load-event>delay the load event</a> of the <a href=#browsing-context-container id=nested-browsing-contexts:browsing-context-container-2>browsing
- context container</a> before the new <code id=nested-browsing-contexts:document-8><a href=#document>Document</a></code> is created.</p>
- <p>The <dfn id=document-family>document family</dfn> of a <a href=#browsing-context id=nested-browsing-contexts:browsing-context-4>browsing context</a> consists of the union of all
- the <code id=nested-browsing-contexts:document-9><a href=#document>Document</a></code> objects in that <a href=#browsing-context id=nested-browsing-contexts:browsing-context-5>browsing context</a>'s <a href=#session-history id=nested-browsing-contexts:session-history>session
- history</a> and the <a href=#document-family id=nested-browsing-contexts:document-family>document families</a> of all those
- <code id=nested-browsing-contexts:document-10><a href=#document>Document</a></code> objects. The <a href=#document-family id=nested-browsing-contexts:document-family-2>document family</a> of a <code id=nested-browsing-contexts:document-11><a href=#document>Document</a></code> object
- consists of the union of all the <a href=#document-family id=nested-browsing-contexts:document-family-3>document families</a> of the
- <a href=#browsing-context id=nested-browsing-contexts:browsing-context-6>browsing contexts</a> that are <a href=#browsing-context-nested-through id=nested-browsing-contexts:browsing-context-nested-through-3>nested through</a> the <code id=nested-browsing-contexts:document-12><a href=#document>Document</a></code> object.</p>
- <h5 id=navigating-nested-browsing-contexts-in-the-dom>7.1.1.1 Navigating nested browsing contexts in the DOM</h5>
- <dl class=domintro><dt><var>window</var> . <code id=navigating-nested-browsing-contexts-in-the-dom:dom-top><a href=#dom-top>top</a></code><dd>
- <p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy><a href=#windowproxy>WindowProxy</a></code> for the <a href=#top-level-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context>top-level browsing context</a>.</p>
- <dt><var>window</var> . <code id=navigating-nested-browsing-contexts-in-the-dom:dom-parent><a href=#dom-parent>parent</a></code><dd>
- <p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> for the <a href=#parent-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:parent-browsing-context>parent browsing context</a>.</p>
- <dt><var>window</var> . <code id=navigating-nested-browsing-contexts-in-the-dom:dom-frameelement><a href=#dom-frameelement>frameElement</a></code><dd>
- <p>Returns the <code id=navigating-nested-browsing-contexts-in-the-dom:element><a href=#element>Element</a></code> for the <a href=#browsing-context-container id=navigating-nested-browsing-contexts-in-the-dom:browsing-context-container>browsing context container</a>.</p>
- <p>Returns null if there isn't one.</p>
- <p>Throws a <code id=navigating-nested-browsing-contexts-in-the-dom:securityerror><a href=#securityerror>SecurityError</a></code> exception in cross-origin situations.</p>
- </dl>
-
- <p>The <dfn id=dom-top><code>top</code></dfn> IDL attribute on the <code id=navigating-nested-browsing-contexts-in-the-dom:window><a href=#window>Window</a></code> object
- of a <code id=navigating-nested-browsing-contexts-in-the-dom:document><a href=#document>Document</a></code> in a <a href=#browsing-context id=navigating-nested-browsing-contexts-in-the-dom:browsing-context>browsing context</a> <var>b</var> must return
- the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object of its <a href=#top-level-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-2>top-level browsing context</a> (which would be
- its own <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-4><a href=#windowproxy>WindowProxy</a></code> object if it was a <a href=#top-level-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-3>top-level browsing context</a>
- itself), if it has one, or its own <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-5><a href=#windowproxy>WindowProxy</a></code> object otherwise (e.g. if it was a
- detached <a href=#nested-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:nested-browsing-context>nested browsing context</a>).</p>
- <p>The <dfn id=dom-parent><code>parent</code></dfn> IDL attribute on the <code id=navigating-nested-browsing-contexts-in-the-dom:window-2><a href=#window>Window</a></code>
- object of a <code id=navigating-nested-browsing-contexts-in-the-dom:document-2><a href=#document>Document</a></code> in a <a href=#browsing-context id=navigating-nested-browsing-contexts-in-the-dom:browsing-context-2>browsing context</a> <var>b</var> must
- return the <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-6><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#parent-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:parent-browsing-context-2>parent browsing context</a>, if there
- is one (i.e. if <var>b</var> is a <a href=#child-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:child-browsing-context>child browsing context</a>), or the
- <code id=navigating-nested-browsing-contexts-in-the-dom:windowproxy-7><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context id=navigating-nested-browsing-contexts-in-the-dom:browsing-context-3>browsing context</a> <var>b</var> itself,
- otherwise (i.e. if it is a <a href=#top-level-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:top-level-browsing-context-4>top-level browsing context</a> or a detached <a href=#nested-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:nested-browsing-context-2>nested
- browsing context</a>).</p>
- <p>The <dfn id=dom-frameelement><code>frameElement</code></dfn> IDL attribute on the
- <code id=navigating-nested-browsing-contexts-in-the-dom:window-3><a href=#window>Window</a></code> object of a <code id=navigating-nested-browsing-contexts-in-the-dom:document-3><a href=#document>Document</a></code> <var>d</var>, on getting, must run
- the following algorithm:</p>
- <ol><li><p>If <var>d</var> is not a <code id=navigating-nested-browsing-contexts-in-the-dom:document-4><a href=#document>Document</a></code> in a <a href=#nested-browsing-context id=navigating-nested-browsing-contexts-in-the-dom:nested-browsing-context-3>nested browsing
- context</a>, return null and abort these steps.<li><p>If the <a href=#browsing-context-container id=navigating-nested-browsing-contexts-in-the-dom:browsing-context-container-2>browsing context container</a>'s <a id=navigating-nested-browsing-contexts-in-the-dom:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> does not have the
- <a href=#same-origin id=navigating-nested-browsing-contexts-in-the-dom:same-origin>same</a> <a href=#effective-script-origin id=navigating-nested-browsing-contexts-in-the-dom:effective-script-origin>effective script origin</a> as the
- <a href=#effective-script-origin id=navigating-nested-browsing-contexts-in-the-dom:effective-script-origin-2>effective script origin</a> specified by the <a href=#entry-settings-object id=navigating-nested-browsing-contexts-in-the-dom:entry-settings-object>entry settings object</a>, then
- throw a <code id=navigating-nested-browsing-contexts-in-the-dom:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li><p>Return the <a href=#browsing-context-container id=navigating-nested-browsing-contexts-in-the-dom:browsing-context-container-3>browsing context container</a> for <var>b</var>.</ol>
-
- <h4 id=auxiliary-browsing-contexts>7.1.2 Auxiliary browsing contexts</h4>
- <p>It is possible to create new browsing contexts that are related to a <a href=#top-level-browsing-context id=auxiliary-browsing-contexts:top-level-browsing-context>top-level browsing
- context</a> without being nested through an element. Such browsing contexts are called <dfn id=auxiliary-browsing-context>auxiliary browsing contexts</dfn>. Auxiliary browsing contexts
- are always <a href=#top-level-browsing-context id=auxiliary-browsing-contexts:top-level-browsing-context-2>top-level browsing contexts</a>.</p>
- <p>An <a href=#auxiliary-browsing-context id=auxiliary-browsing-contexts:auxiliary-browsing-context>auxiliary browsing context</a> has an <dfn id=opener-browsing-context>opener browsing context</dfn>, which is
- the <a href=#browsing-context id=auxiliary-browsing-contexts:browsing-context>browsing context</a> from which the <a href=#auxiliary-browsing-context id=auxiliary-browsing-contexts:auxiliary-browsing-context-2>auxiliary browsing context</a> was
- created.</p>
- <h5 id=navigating-auxiliary-browsing-contexts-in-the-dom>7.1.2.1 Navigating auxiliary browsing contexts in the DOM</h5>
- <p>The <dfn id=dom-opener><code>opener</code></dfn> IDL attribute on the <code id=navigating-auxiliary-browsing-contexts-in-the-dom:window><a href=#window>Window</a></code>
- object, on getting, must return the <code id=navigating-auxiliary-browsing-contexts-in-the-dom:windowproxy><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context id=navigating-auxiliary-browsing-contexts-in-the-dom:browsing-context>browsing
- context</a> from which the current <a href=#browsing-context id=navigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-2>browsing context</a> was created (its <a href=#opener-browsing-context id=navigating-auxiliary-browsing-contexts-in-the-dom:opener-browsing-context>opener
- browsing context</a>), if there is one, if it is still available, and if the current
- <a href=#browsing-context id=navigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-3>browsing context</a> has not <i id=navigating-auxiliary-browsing-contexts-in-the-dom:disowned-its-opener><a href=#disowned-its-opener>disowned its opener</a></i>;
- otherwise, it must return null. On setting, if the new value is null then the current
- <a href=#browsing-context id=navigating-auxiliary-browsing-contexts-in-the-dom:browsing-context-4>browsing context</a> must <dfn id=disowned-its-opener>disown its opener</dfn>; if
- the new value is anything else then the user agent must
-
- call the [[DefineOwnProperty]] internal method of the <code id=navigating-auxiliary-browsing-contexts-in-the-dom:window-2><a href=#window>Window</a></code> object, passing the
- property name "<code>opener</code>" as the property key, and the Property Descriptor {
- [[Value]]: <var>value</var>, [[Writable]]: true, [[Enumerable]]: true,
- [[Configurable]]: true } as the property descriptor,
-
- where <var>value</var> is the new value.</p>
- <h4 id=secondary-browsing-contexts>7.1.3 Secondary browsing contexts</h4>
- <p>User agents may support <dfn id=secondary-browsing-context>secondary browsing
- contexts</dfn>, which are <a href=#browsing-context id=secondary-browsing-contexts:browsing-context>browsing contexts</a> that form part
- of the user agent's interface, apart from the main content area.</p>
- <p class=note>The <code id=secondary-browsing-contexts:link-type-sidebar><a href=#link-type-sidebar>sidebar</a></code> link type uses <a href=#secondary-browsing-context id=secondary-browsing-contexts:secondary-browsing-context>secondary browsing contexts</a>.</p>
-
- <h4 id=security-nav>7.1.4 Security</h4>
- <p id=security-1>A <a href=#browsing-context id=security-nav:browsing-context>browsing context</a> <var>A</var> is <dfn id=familiar-with>familiar
- with</dfn> a second <a href=#browsing-context id=security-nav:browsing-context-2>browsing context</a> <var>B</var> if one of the following
- conditions is true:</p>
- <ul><li>Either the <a href=#origin-2 id=security-nav:origin-2>origin</a> of the <a href=#active-document id=security-nav:active-document>active document</a> of <var>A</var>
- is the <a href=#same-origin id=security-nav:same-origin>same</a> as the <a href=#origin-2 id=security-nav:origin-2-2>origin</a> of the <a href=#active-document id=security-nav:active-document-2>active
- document</a> of <var>B</var>, or<li>The browsing context <var>A</var> is a <a href=#nested-browsing-context id=security-nav:nested-browsing-context>nested browsing context</a> with a
- <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context>top-level browsing context</a>, and its <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-2>top-level browsing context</a> is <var>B</var>, or<li>The browsing context <var>B</var> is an <a href=#auxiliary-browsing-context id=security-nav:auxiliary-browsing-context>auxiliary browsing context</a> and
- <var>A</var> is <a href=#familiar-with id=security-nav:familiar-with>familiar with</a> <var>B</var>'s <a href=#opener-browsing-context id=security-nav:opener-browsing-context>opener
- browsing context</a>, or<li>The browsing context <var>B</var> is not a <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-3>top-level browsing context</a>,
- but there exists an <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context>ancestor browsing context</a> of <var>B</var> whose
- <a href=#active-document id=security-nav:active-document-3>active document</a> has the <a href=#same-origin id=security-nav:same-origin-2>same</a> <a href=#origin-2 id=security-nav:origin-2-3>origin</a> as
- the <a href=#active-document id=security-nav:active-document-4>active document</a> of <var>A</var> (possibly in fact being <var>A</var> itself).</ul>
- <hr>
- <p>A <a href=#browsing-context id=security-nav:browsing-context-3>browsing context</a> <var>A</var> is <dfn id=allowed-to-navigate>allowed to navigate</dfn> a
- second <a href=#browsing-context id=security-nav:browsing-context-4>browsing context</a> <var>B</var> if the following algorithm terminates
- positively:</p>
- <ol><li><p>If <var>A</var> is not the same <a href=#browsing-context id=security-nav:browsing-context-5>browsing context</a> as <var>B</var>, and <var>A</var> is not one of the <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context-2>ancestor browsing contexts</a> of <var>B</var>, and <var>B</var>
- is not a <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-4>top-level browsing context</a>, and <var>A</var>'s <a href=#active-document id=security-nav:active-document-5>active
- document</a>'s <a href=#active-sandboxing-flag-set id=security-nav:active-sandboxing-flag-set>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag id=security-nav:sandboxed-navigation-browsing-context-flag>sandboxed navigation
- browsing context flag</a> set, then abort these steps negatively.<li><p>Otherwise, if <var>B</var> is a <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-5>top-level browsing context</a>, and is
- one of the <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context-3>ancestor browsing contexts</a> of <var>A</var>, and <var>A</var>'s <a id=security-nav:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=security-nav:active-sandboxing-flag-set-2>active sandboxing
- flag set</a> has its <a href=#sandboxed-top-level-navigation-browsing-context-flag id=security-nav:sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</a> set,
- then abort these steps negatively.<li><p>Otherwise, if <var>B</var> is a <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-6>top-level browsing context</a>, and is
- neither <var>A</var> nor one of the <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context-4>ancestor
- browsing contexts</a> of <var>A</var>, and <var>A</var>'s
- <code id=security-nav:document><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=security-nav:active-sandboxing-flag-set-3>active sandboxing flag set</a> has its <a href=#sandboxed-navigation-browsing-context-flag id=security-nav:sandboxed-navigation-browsing-context-flag-2>sandboxed
- navigation browsing context flag</a> set, and <var>A</var> is not the <a href=#one-permitted-sandboxed-navigator id=security-nav:one-permitted-sandboxed-navigator>one
- permitted sandboxed navigator</a> of <var>B</var>, then abort these steps
- negatively.<li><p>Otherwise, terminate positively!</ol>
- <hr>
- <p>An element has a <dfn id=browsing-context-scope-origin>browsing context scope origin</dfn> if its <code id=security-nav:document-2><a href=#document>Document</a></code>'s
- <a href=#browsing-context id=security-nav:browsing-context-6>browsing context</a> is a <a href=#top-level-browsing-context id=security-nav:top-level-browsing-context-7>top-level browsing context</a> or if all of its
- <code id=security-nav:document-3><a href=#document>Document</a></code>'s <a href=#ancestor-browsing-context id=security-nav:ancestor-browsing-context-5>ancestor browsing contexts</a>
- all have <a href=#active-document id=security-nav:active-document-6>active documents</a> whose <a href=#origin-2 id=security-nav:origin-2-4>origin</a> are the
- <a href=#same-origin id=security-nav:same-origin-3>same origin</a> as the element's <a id=security-nav:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#origin-2 id=security-nav:origin-2-5>origin</a>. If an
- element has a <a href=#browsing-context-scope-origin id=security-nav:browsing-context-scope-origin>browsing context scope origin</a>, then its value is the
- <a href=#origin-2 id=security-nav:origin-2-6>origin</a> of the element's <a id=security-nav:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
-
-
- <h4 id=groupings-of-browsing-contexts>7.1.5 Groupings of browsing contexts</h4>
- <p>Each <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context>browsing context</a> is defined as having a list of one or more <dfn id=directly-reachable-browsing-contexts>directly
- reachable browsing contexts</dfn>. These are:</p>
- <ul><li>The <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-2>browsing context</a> itself.<li>All the <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-3>browsing context</a>'s <a href=#child-browsing-context id=groupings-of-browsing-contexts:child-browsing-context>child browsing
- contexts</a>.<li>The <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-4>browsing context</a>'s <a href=#parent-browsing-context id=groupings-of-browsing-contexts:parent-browsing-context>parent browsing context</a>.<li>All the <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-5>browsing contexts</a> that have the <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-6>browsing
- context</a> as their <a href=#opener-browsing-context id=groupings-of-browsing-contexts:opener-browsing-context>opener browsing context</a>.<li>The <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-7>browsing context</a>'s <a href=#opener-browsing-context id=groupings-of-browsing-contexts:opener-browsing-context-2>opener browsing context</a>.</ul>
- <p>The transitive closure of all the <a href=#browsing-context id=groupings-of-browsing-contexts:browsing-context-8>browsing contexts</a> that
- are <a href=#directly-reachable-browsing-contexts id=groupings-of-browsing-contexts:directly-reachable-browsing-contexts>directly reachable browsing contexts</a> forms a <dfn id=unit-of-related-browsing-contexts>unit of related browsing
- contexts</dfn>.</p>
- <p>Each <a href=#unit-of-related-browsing-contexts id=groupings-of-browsing-contexts:unit-of-related-browsing-contexts>unit of related browsing contexts</a> is then further divided into the smallest
- number of groups such that every member of each group has an <a href=#active-document id=groupings-of-browsing-contexts:active-document>active document</a> with an
- <a href=#effective-script-origin id=groupings-of-browsing-contexts:effective-script-origin>effective script origin</a> that, through appropriate manipulation of the <code id=groupings-of-browsing-contexts:dom-document-domain><a href=#dom-document-domain>document.domain</a></code> attribute, could be made to be the same as
- other members of the group, but could not be made the same as members of any other group. Each
- such group is a <dfn id=unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</dfn>.</p>
- <p class=note>There is also at most one <a href=#event-loop id=groupings-of-browsing-contexts:event-loop>event loop</a> per <a href=#unit-of-related-similar-origin-browsing-contexts id=groupings-of-browsing-contexts:unit-of-related-similar-origin-browsing-contexts>unit of related
- similar-origin browsing contexts</a> (though several <a href=#unit-of-related-similar-origin-browsing-contexts id=groupings-of-browsing-contexts:unit-of-related-similar-origin-browsing-contexts-2>units of related similar-origin browsing contexts</a> can
- have a shared <a href=#event-loop id=groupings-of-browsing-contexts:event-loop-2>event loop</a>).</p>
-
- <h4 id=browsing-context-names>7.1.6 Browsing context names</h4>
- <p>Browsing contexts can have a <dfn id=browsing-context-name>browsing context name</dfn>. By default, a browsing context
- has no name (its name is not set).</p>
- <p>A <dfn id=valid-browsing-context-name>valid browsing context name</dfn> is any string with at least one character that does
- not start with a U+005F LOW LINE character. (Names starting with an underscore are reserved for
- special keywords.)</p>
- <p>A <dfn id=valid-browsing-context-name-or-keyword>valid browsing context name or keyword</dfn> is any string that is either a <a href=#valid-browsing-context-name id=browsing-context-names:valid-browsing-context-name>valid
- browsing context name</a> or that is an <a href=#ascii-case-insensitive id=browsing-context-names:ascii-case-insensitive>ASCII case-insensitive</a> match for one of:
- <code>_blank</code>, <code>_self</code>, <code>_parent</code>, or <code>_top</code>.</p>
- <p>These values have different meanings based on whether the page is sandboxed or not, as
- summarised in the following (non-normative) table. In this table, "current" means the
- <a href=#browsing-context id=browsing-context-names:browsing-context>browsing context</a> that the link or script is in, "parent" means the <a href=#parent-browsing-context id=browsing-context-names:parent-browsing-context>parent
- browsing context</a> of the one the link or script is in, "master" means the nearest
- <a href=#ancestor-browsing-context id=browsing-context-names:ancestor-browsing-context>ancestor browsing context</a> of the one the link or script is in that is not itself in a
- <a href=#attr-iframe-seamless id=browsing-context-names:attr-iframe-seamless>seamless iframe</a>, "top" means the <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context>top-level
- browsing context</a> of the one the link or script is in, "new" means a new <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context-2>top-level
- browsing context</a> or <a href=#auxiliary-browsing-context id=browsing-context-names:auxiliary-browsing-context>auxiliary browsing context</a> is to be created, subject to
- various user preferences and user agent policies, "none" means that nothing will happen, and
- "maybe new" means the same as "new" if the "<code id=browsing-context-names:attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>" keyword is also specified on the
- <code id=browsing-context-names:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute (or if the user overrode the
- sandboxing), and the same as "none" otherwise.</p>
- <table><thead><tr><th rowspan=2>Keyword
- <th rowspan=2>Ordinary effect
- <th colspan=5>Effect in an <code id=browsing-context-names:the-iframe-element><a href=#the-iframe-element>iframe</a></code> with...
- <tr><th><code>seamless=""</code>
- <th><code>sandbox=""</code>
- <th><code>sandbox="" seamless=""</code>
- <th><code>sandbox="allow-top-navigation"</code>
- <th><code>sandbox="allow-top-navigation" seamless=""</code>
- <tbody><tr><td>none specified, for links and form submissions
- <td>current
- <td>master
- <td>current
- <td>master
- <td>current
- <td>master
- <tr><td>empty string
- <td>current
- <td>master
- <td>current
- <td>master
- <td>current
- <td>master
- <tr><td><code>_blank</code>
- <td>new
- <td>new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- <tr><td><code>_self</code>
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <tr><td><code>_parent</code> if there isn't a parent
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <tr><td><code>_parent</code> if parent is also top
- <td>parent/top
- <td>parent/top
- <td>none
- <td>none
- <td>parent/top
- <td>parent/top
- <tr><td><code>_parent</code> if there is one and it's not top
- <td>parent
- <td>parent
- <td>none
- <td>none
- <td>none
- <td>none
- <tr><td><code>_top</code> if top is current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <tr><td><code>_top</code> if top is not current
- <td>top
- <td>top
- <td>none
- <td>none
- <td>top
- <td>top
- <tr><td>name that doesn't exist
- <td>new
- <td>new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- <tr><td>name that exists and is a descendant
- <td>specified descendant
- <td>specified descendant
- <td>specified descendant
- <td>specified descendant
- <td>specified descendant
- <td>specified descendant
- <tr><td>name that exists and is current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <td>current
- <tr><td>name that exists and is an ancestor that is top
- <td>specified ancestor
- <td>specified ancestor
- <td>none
- <td>none
- <td>specified ancestor/top
- <td>specified ancestor/top
- <tr><td>name that exists and is an ancestor that is not top
- <td>specified ancestor
- <td>specified ancestor
- <td>none
- <td>none
- <td>none
- <td>none
- <tr><td>other name that exists with common top
- <td>specified
- <td>specified
- <td>none
- <td>none
- <td>none
- <td>none
- <tr><td>name that exists with different top, if <a href=#familiar-with id=browsing-context-names:familiar-with>familiar</a> and <a href=#one-permitted-sandboxed-navigator id=browsing-context-names:one-permitted-sandboxed-navigator>one permitted sandboxed navigator</a>
- <td>specified
- <td>specified
- <td>specified
- <td>specified
- <td>specified
- <td>specified
- <tr><td>name that exists with different top, if <a href=#familiar-with id=browsing-context-names:familiar-with-2>familiar</a> but not <a href=#one-permitted-sandboxed-navigator id=browsing-context-names:one-permitted-sandboxed-navigator-2>one permitted sandboxed navigator</a>
- <td>specified
- <td>specified
- <td>none
- <td>none
- <td>none
- <td>none
- <tr><td>name that exists with different top, not <a href=#familiar-with id=browsing-context-names:familiar-with-3>familiar</a>
- <td>new
- <td>new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- <td>maybe new
- </table>
- <p class=tablenote><small>Most of the restrictions on sandboxed browsing contexts are applied by
- other algorithms, e.g. the <a href=#navigate id=browsing-context-names:navigate>navigation</a> algorithm, not <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=browsing-context-names:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules
- for choosing a browsing context given a browsing context name</a> given below.</small></p>
-
- <hr>
- <p>An algorithm is <dfn id=allowed-to-show-a-popup>allowed to show a popup</dfn> if any of the following conditions is
- true:</p>
- <ul><li><p>The <a href=#concept-task id=browsing-context-names:concept-task>task</a> in which the algorithm is running is currently
- processing an <a href=#activation-behavior id=browsing-context-names:activation-behavior>activation behavior</a> whose <code id=browsing-context-names:event-click><a href=#event-click>click</a></code> event
- was <a href=#concept-events-trusted id=browsing-context-names:concept-events-trusted>trusted</a>.<li>
- <p>The <a href=#concept-task id=browsing-context-names:concept-task-2>task</a> in which the algorithm is running is currently
- running the event listener for a <a href=#concept-events-trusted id=browsing-context-names:concept-events-trusted-2>trusted</a> event whose
- type is in the following list:</p>
- <ul class=brief><li><code id=browsing-context-names:event-change><a href=#event-change>change</a></code><li><code id=browsing-context-names:event-click-2><a href=#event-click>click</a></code><li><code id=browsing-context-names:event-dblclick><a href=#event-dblclick>dblclick</a></code><li><code id=browsing-context-names:event-mouseup><a href=#event-mouseup>mouseup</a></code><li><code id=browsing-context-names:event-reset><a href=#event-reset>reset</a></code><li><code id=browsing-context-names:event-submit><a href=#event-submit>submit</a></code></ul>
- <li>
- <p>The <a href=#concept-task id=browsing-context-names:concept-task-3>task</a> in which the algorithm is running was <a href=#queue-a-task id=browsing-context-names:queue-a-task>queued</a> by an algorithm that was <a href=#allowed-to-show-a-popup id=browsing-context-names:allowed-to-show-a-popup>allowed to show a popup</a>,
- and the chain of such algorithms started within a user-agent defined timeframe.</p>
- <p class=example>For example, if a user clicked a button, it might be acceptable for a popup
- to result from that after 4 seconds, but it would likely not be acceptable for a popup to result
- from that after 4 hours.</p>
- </ul>
- <hr>
- <p><dfn id=the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>The rules for choosing a browsing context given a browsing context name</dfn> are as
- follows. The rules assume that they are being applied in the context of a <a href=#browsing-context id=browsing-context-names:browsing-context-2>browsing
- context</a>, as part of the execution of a <a href=#concept-task id=browsing-context-names:concept-task-4>task</a>.</p>
- <ol><li>
- <p>If the given browsing context name is the empty string or <code>_self</code>, then
- the chosen browsing context must be the current one.</p>
- <p>If the given browsing context name is <code>_self</code>, then this is an
- <a href=#explicit-self-navigation-override id=browsing-context-names:explicit-self-navigation-override>explicit self-navigation override</a>, which overrides the behavior of the
- <a href=#seamless-browsing-context-flag id=browsing-context-names:seamless-browsing-context-flag>seamless browsing context flag</a> set by the <code id=browsing-context-names:attr-iframe-seamless-2><a href=#attr-iframe-seamless>seamless</a></code> attribute on <code id=browsing-context-names:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> elements.</p>
- <li><p>If the given browsing context name is <code>_parent</code>, then the chosen
- browsing context must be the <a href=#parent-browsing-context id=browsing-context-names:parent-browsing-context-2><em>parent</em> browsing context</a> of the current one,
- unless there isn't one, in which case the chosen browsing context must be the current browsing
- context.<li><p>If the given browsing context name is <code>_top</code>, then the chosen browsing
- context must be the <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context-3>top-level browsing context</a> of the current one, if there is one,
- or else the current browsing context.<li>
- <p>If the given browsing context name is not <code>_blank</code> and there exists a
- browsing context whose <a href=#browsing-context-name id=browsing-context-names:browsing-context-name>name</a> is the same as the given
- browsing context name, and the current browsing context is <a href=#familiar-with id=browsing-context-names:familiar-with-4>familiar with</a> that
- browsing context, and the user agent determines that the two browsing contexts are related
- enough that it is ok if they reach each other, then that browsing context must be the chosen
- one. If there are multiple matching browsing contexts, the user agent should select one in some
- arbitrary consistent manner, such as the most recently opened, most recently focused, or more
- closely related.</p>
- <p>If the browsing context is chosen by this step to be the current browsing context, then this
- is also an <a href=#explicit-self-navigation-override id=browsing-context-names:explicit-self-navigation-override-2>explicit self-navigation override</a>.</p>
- <li>
- <p>Otherwise, a new browsing context is being requested, and what happens depends on the user
- agent's configuration and abilities — it is determined by the rules given for the first
- applicable option from the following list:</p>
- <dl class=switch><dt id=popup-blocker>If the algorithm is not <a href=#allowed-to-show-a-popup id=browsing-context-names:allowed-to-show-a-popup-2>allowed to show a popup</a> and the
- user agent has been configured to not show popups (i.e. the user agent has a "popup blocker"
- enabled)<dd>
- <p>There is no chosen browsing context. The user agent may inform the user that a popup has
- been blocked.</p>
- <dt id=sandboxWindowOpen>If the current browsing context's <a href=#active-document id=browsing-context-names:active-document>active document</a>'s
- <a href=#active-sandboxing-flag-set id=browsing-context-names:active-sandboxing-flag-set>active sandboxing flag set</a> has the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=browsing-context-names:sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing
- context flag</a> set.<dd>
- <p>Typically, there is no chosen browsing context.</p>
- <p>The user agent may offer to create a new <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context-4>top-level browsing context</a> or reuse
- an existing <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context-5>top-level browsing context</a>. If the user picks one of those options,
- then the designated browsing context must be the chosen one (the browsing context's name isn't
- set to the given browsing context name). The default behaviour (if the user agent doesn't
- offer the option to the user, or if the user declines to allow a browsing context to be used)
- must be that there must not be a chosen browsing context.</p>
- <p class=warning>If this case occurs, it means that an author has explicitly sandboxed the
- document that is trying to open a link.</p>
- <dt id=noopener>If the user agent has been configured such that in this instance it will
- create a new browsing context, and the browsing context is being requested as part of <a href=#following-hyperlinks-2 id=browsing-context-names:following-hyperlinks-2>following a hyperlink</a> whose <a href=#linkTypes>link
- types</a> include the <code id=browsing-context-names:link-type-noreferrer><a href=#link-type-noreferrer>noreferrer</a></code> keyword<dd><p>A new <a href=#top-level-browsing-context id=browsing-context-names:top-level-browsing-context-6>top-level browsing context</a> must be created. If the given browsing
- context name is not <code>_blank</code>, then the new top-level browsing context's
- name must be the given browsing context name (otherwise, it has no name). The chosen browsing
- context must be this new browsing context. The creation of such a <a href=#browsing-context id=browsing-context-names:browsing-context-3>browsing context</a>
- is <dfn id=a-new-start-for-session-storage>a new start for session storage</dfn>.</p>
- <p class=note>If it is immediately <a href=#navigate id=browsing-context-names:navigate-2>navigated</a>, then the
- navigation will be done with <a href=#replacement-enabled id=browsing-context-names:replacement-enabled>replacement enabled</a>.<dt>If the user agent has been configured such that in this instance it will create a new
- browsing context, and the <code id=browsing-context-names:link-type-noreferrer-2><a href=#link-type-noreferrer>noreferrer</a></code> keyword doesn't
- apply<dd><p>A new <a href=#auxiliary-browsing-context id=browsing-context-names:auxiliary-browsing-context-2>auxiliary browsing context</a> must be created, with the <a href=#opener-browsing-context id=browsing-context-names:opener-browsing-context>opener
- browsing context</a> being the current one. If the given browsing context name is not <code>_blank</code>, then the new auxiliary browsing context's name must be the given
- browsing context name (otherwise, it has no name). The chosen browsing context must be this new
- browsing context.</p>
- <p class=note>If it is immediately <a href=#navigate id=browsing-context-names:navigate-3>navigated</a>, then the
- navigation will be done with <a href=#replacement-enabled id=browsing-context-names:replacement-enabled-2>replacement enabled</a>.<dt>If the user agent has been configured such that in this instance it will reuse the current
- browsing context<dd><p>The chosen browsing context is the current browsing context.<dt>If the user agent has been configured such that in this instance it will not find a
- browsing context<dd><p>There must not be a chosen browsing context.</dl>
- <p>User agent implementors are encouraged to provide a way for users to configure the user agent
- to always reuse the current browsing context.</p>
- <p>If the current browsing context's <a href=#active-document id=browsing-context-names:active-document-2>active document</a>'s <a href=#active-sandboxing-flag-set id=browsing-context-names:active-sandboxing-flag-set-2>active sandboxing flag
- set</a> has the <a href=#sandboxed-navigation-browsing-context-flag id=browsing-context-names:sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</a> set and the chosen
- browsing context picked above, if any, is a new browsing context (whether top-level or
- auxiliary), then all the flags that are set in the current browsing context's <a href=#active-document id=browsing-context-names:active-document-3>active
- document</a>'s <a href=#active-sandboxing-flag-set id=browsing-context-names:active-sandboxing-flag-set-3>active sandboxing flag set</a> when the new browsing context is
- created must be set in the new browsing context's <a href=#popup-sandboxing-flag-set id=browsing-context-names:popup-sandboxing-flag-set>popup sandboxing flag set</a>, and
- the current browsing context must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator id=browsing-context-names:one-permitted-sandboxed-navigator-3>one permitted
- sandboxed navigator</a>.</p>
- </ol>
-
- <h3 id=the-window-object>7.2 The <code id=the-window-object:window><a href=#window>Window</a></code> object</h3>
- <pre class=idl>[PrimaryGlobal]
- /*sealed*/ interface <dfn id=window>Window</dfn> : <a href=#eventtarget id=the-window-object:eventtarget>EventTarget</a> {
- // the current browsing context
- [Unforgeable] readonly attribute <a href=#windowproxy id=the-window-object:windowproxy>WindowProxy</a> <a href=#dom-window id=the-window-object:dom-window>window</a>;
- [Replaceable] readonly attribute <a href=#windowproxy id=the-window-object:windowproxy-2>WindowProxy</a> <a href=#dom-self id=the-window-object:dom-self>self</a>;
- [Unforgeable] readonly attribute <a href=#document id=the-window-object:document>Document</a> <a href=#dom-document-2 id=the-window-object:dom-document-2>document</a>;
- attribute DOMString <a href=#dom-name id=the-window-object:dom-name>name</a>;
- [PutForwards=<a href=#dom-url-href id=the-window-object:dom-url-href>href</a>, Unforgeable] readonly attribute <a href=#location id=the-window-object:location>Location</a> <a href=#dom-location id=the-window-object:dom-location>location</a>;
- readonly attribute <a href=#history-3 id=the-window-object:history-3>History</a> <a href=#dom-history id=the-window-object:dom-history>history</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop>BarProp</a> <a href=#dom-window-locationbar id=the-window-object:dom-window-locationbar>locationbar</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop-2>BarProp</a> <a href=#dom-window-menubar id=the-window-object:dom-window-menubar>menubar</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop-3>BarProp</a> <a href=#dom-window-personalbar id=the-window-object:dom-window-personalbar>personalbar</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop-4>BarProp</a> <a href=#dom-window-scrollbars id=the-window-object:dom-window-scrollbars>scrollbars</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop-5>BarProp</a> <a href=#dom-window-statusbar id=the-window-object:dom-window-statusbar>statusbar</a>;
- [Replaceable] readonly attribute <a href=#barprop id=the-window-object:barprop-6>BarProp</a> <a href=#dom-window-toolbar id=the-window-object:dom-window-toolbar>toolbar</a>;
- attribute DOMString <a href=#dom-window-status id=the-window-object:dom-window-status>status</a>;
- void <a href=#dom-window-close id=the-window-object:dom-window-close>close</a>();
- readonly attribute boolean <a href=#dom-window-closed id=the-window-object:dom-window-closed>closed</a>;
- void <a href=#dom-window-stop id=the-window-object:dom-window-stop>stop</a>();
- void <a href=#dom-window-focus id=the-window-object:dom-window-focus>focus</a>();
- void <a href=#dom-window-blur id=the-window-object:dom-window-blur>blur</a>();
- // other browsing contexts
- [Replaceable] readonly attribute <a href=#windowproxy id=the-window-object:windowproxy-3>WindowProxy</a> <a href=#dom-frames id=the-window-object:dom-frames>frames</a>;
- [Replaceable] readonly attribute unsigned long <a href=#dom-length id=the-window-object:dom-length>length</a>;
- [Unforgeable] readonly attribute <a href=#windowproxy id=the-window-object:windowproxy-4>WindowProxy</a> <a href=#dom-top id=the-window-object:dom-top>top</a>;
- attribute any <a href=#dom-opener id=the-window-object:dom-opener>opener</a>;
- readonly attribute <a href=#windowproxy id=the-window-object:windowproxy-5>WindowProxy</a> <a href=#dom-parent id=the-window-object:dom-parent>parent</a>;
- readonly attribute <a href=#element id=the-window-object:element>Element</a>? <a href=#dom-frameelement id=the-window-object:dom-frameelement>frameElement</a>;
- <a href=#windowproxy id=the-window-object:windowproxy-6>WindowProxy</a> <a href=#dom-open id=the-window-object:dom-open>open</a>(optional DOMString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = "", optional boolean replace = false);
- <a href=#dom-window-item id=the-window-object:dom-window-item>getter</a> <a href=#windowproxy id=the-window-object:windowproxy-7>WindowProxy</a> (unsigned long index);
- <a href=#dom-window-nameditem id=the-window-object:dom-window-nameditem>getter</a> object (DOMString name);
- // the user agent
- readonly attribute <a href=#navigator id=the-window-object:navigator>Navigator</a> <a href=#dom-navigator id=the-window-object:dom-navigator>navigator</a>;
- [Replaceable] readonly attribute <a href=#external id=the-window-object:external>External</a> <a href=#dom-external id=the-window-object:dom-external>external</a>;
- readonly attribute <a href=#applicationcache id=the-window-object:applicationcache>ApplicationCache</a> <a href=#dom-applicationcache id=the-window-object:dom-applicationcache>applicationCache</a>;
- // user prompts
- void <a href=#dom-alert id=the-window-object:dom-alert>alert</a>();
- void <a href=#dom-alert id=the-window-object:dom-alert-2>alert</a>(DOMString message);
- boolean <a href=#dom-confirm id=the-window-object:dom-confirm>confirm</a>(optional DOMString message = "");
- DOMString? <a href=#dom-prompt id=the-window-object:dom-prompt>prompt</a>(optional DOMString message = "", optional DOMString default = "");
- void <a href=#dom-print id=the-window-object:dom-print>print</a>();
- any <a href=#dom-showmodaldialog id=the-window-object:dom-showmodaldialog>showModalDialog</a>(DOMString url, optional any argument);
- void <a href=#dom-window-postmessage id=the-window-object:dom-window-postmessage>postMessage</a>(any message, DOMString targetOrigin, optional sequence<<a href=#transferable id=the-window-object:transferable>Transferable</a>> transfer);
- // <a href="#Window-partial">also has obsolete members</a>
- };
- <a href=#window id=the-window-object:window-2>Window</a> implements <a href=#globaleventhandlers id=the-window-object:globaleventhandlers>GlobalEventHandlers</a>;
- <a href=#window id=the-window-object:window-3>Window</a> implements <a href=#windoweventhandlers id=the-window-object:windoweventhandlers>WindowEventHandlers</a>;</pre>
- <dl class=domintro><dt><var>window</var> . <code id=the-window-object:dom-window-2><a href=#dom-window>window</a></code><dt><var>window</var> . <code id=the-window-object:dom-frames-2><a href=#dom-frames>frames</a></code><dt><var>window</var> . <code id=the-window-object:dom-self-2><a href=#dom-self>self</a></code><dd>
- <p>These attributes all return <var>window</var>.</p>
- <dt><var>window</var> . <code id=the-window-object:dom-document-2-2><a href=#dom-document-2>document</a></code><dd>
- <p>Returns the <code id=the-window-object:document-2><a href=#document>Document</a></code> associated with <var>window</var>.</p>
- <dt><var>document</var> . <code id=the-window-object:dom-document-defaultview><a href=#dom-document-defaultview>defaultView</a></code><dd>
- <p>Returns the <code id=the-window-object:window-4><a href=#window>Window</a></code> object of the <a href=#active-document id=the-window-object:active-document>active document</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-window><code>window</code></dfn>, <dfn id=dom-frames><code>frames</code></dfn>, and <dfn id=dom-self><code>self</code></dfn>
- IDL attributes must all return the <code id=the-window-object:window-5><a href=#window>Window</a></code> object's <a href=#browsing-context id=the-window-object:browsing-context>browsing context</a>'s
- <code id=the-window-object:windowproxy-8><a href=#windowproxy>WindowProxy</a></code> object.</p>
- <p>The <dfn id=dom-document-2><code>document</code></dfn> IDL attribute must return
- <a href=#concept-document-window id=the-window-object:concept-document-window>the <code>Window</code> object's newest <code>Document</code> object</a>.</p>
- <p>The <dfn id=dom-document-defaultview><code>defaultView</code></dfn> IDL attribute of the
- <code id=the-window-object:document-3><a href=#document>Document</a></code> interface must return the <code id=the-window-object:document-4><a href=#document>Document</a></code>'s <a href=#browsing-context id=the-window-object:browsing-context-2>browsing
- context</a>'s <code id=the-window-object:windowproxy-9><a href=#windowproxy>WindowProxy</a></code> object, if there is one, or null otherwise.</p>
- <hr>
- <p>For historical reasons, <code id=the-window-object:window-6><a href=#window>Window</a></code> objects must also have a writable, configurable,
- non-enumerable property named <dfn id=htmldocument><code>HTMLDocument</code></dfn> whose value is the
- <code id=the-window-object:document-5><a href=#document>Document</a></code> interface object.</p>
-
-
- <h4 id=security-window>7.2.1 Security</h4>
- <p class=critical>This section describes a security model that is underdefined, imperfect, and
- does not match implementations. Work is ongoing to attempt to resolve this, but in the meantime,
- please do not rely on this section for precision. Implementors are urged to send their feedback on
- how cross-origin cross-global access to <code id=security-window:window><a href=#window>Window</a></code> and <code id=security-window:location><a href=#location>Location</a></code> objects
- should work. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20701">bug 20701</a>.</p>
- <p id=security-2>User agents must throw a <code id=security-window:securityerror><a href=#securityerror>SecurityError</a></code> exception whenever any
- properties of a <code id=security-window:window-2><a href=#window>Window</a></code> object are accessed when the <a href=#incumbent-settings-object id=security-window:incumbent-settings-object>incumbent settings
- object</a> specifies an <a href=#effective-script-origin id=security-window:effective-script-origin>effective script origin</a> that is not the <a href=#same-origin id=security-window:same-origin>same</a> as <a href=#concept-document-window id=security-window:concept-document-window>the <code>Window</code> object's
- <code>Document</code></a>'s <a href=#effective-script-origin id=security-window:effective-script-origin-2>effective script origin</a>, with the following
- exceptions:</p>
- <ul><li>The <code id=security-window:dom-location><a href=#dom-location>location</a></code> attribute
- <li>The <code id=security-window:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> method
- <li>The <code id=security-window:dom-window><a href=#dom-window>window</a></code> attribute
- <li>The <code id=security-window:dom-frames><a href=#dom-frames>frames</a></code> attribute
- <li>The <code id=security-window:dom-self><a href=#dom-self>self</a></code> attribute
- <li>The <code id=security-window:dom-top><a href=#dom-top>top</a></code> attribute
- <li>The <code id=security-window:dom-parent><a href=#dom-parent>parent</a></code> attribute
- <li>The <code id=security-window:dom-opener><a href=#dom-opener>opener</a></code> attribute
- <li>The <code id=security-window:dom-window-closed><a href=#dom-window-closed>closed</a></code> attribute
- <li>The <code id=security-window:dom-window-close><a href=#dom-window-close>close()</a></code> method
- <li>The <code id=security-window:dom-window-blur><a href=#dom-window-blur>blur()</a></code> method
- <li>The <code id=security-window:dom-window-focus><a href=#dom-window-focus>focus()</a></code> method
- <li>The <a href=#dynamic-nested-browsing-context-properties id=security-window:dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</a>
- </ul>
- <p>When the <a href=#incumbent-settings-object id=security-window:incumbent-settings-object-2>incumbent settings object</a> specifies an <a href=#effective-script-origin id=security-window:effective-script-origin-3>effective script
- origin</a> that is different than a <a href=#concept-document-window id=security-window:concept-document-window-2><code>Window</code>
- object's <code>Document</code></a>'s <a href=#effective-script-origin id=security-window:effective-script-origin-4>effective script origin</a>, the user agent must
- act as if any changes to that <code id=security-window:window-3><a href=#window>Window</a></code> object's properties, getters, setters, etc, were
- not present, and as if all the properties of that <code id=security-window:window-4><a href=#window>Window</a></code> object had their
- [[Enumerable]] attribute set to false.</p>
- <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin id=security-window:effective-script-origin-5>effective
- script origin</a> that is not the same as the <code id=security-window:window-5><a href=#window>Window</a></code> object's
- <code id=security-window:document><a href=#document>Document</a></code>'s <a href=#effective-script-origin id=security-window:effective-script-origin-6>effective script origin</a> must be provided with a separate set
- of objects. These objects must have the prototype chain appropriate for the script for which the
- objects are created (not those that would be appropriate for scripts whose <a href=#global-object id=security-window:global-object>global
- object</a>, as specified by their <a href=#settings-object id=security-window:settings-object>settings object</a>, is the <code id=security-window:window-6><a href=#window>Window</a></code>
- object in question).</p>
- <div class=example>
- <p>For instance, if two frames containing <code id=security-window:document-2><a href=#document>Document</a></code>s from different <a href=#origin-2 id=security-window:origin-2>origins</a> access the same <code id=security-window:window-7><a href=#window>Window</a></code> object's <code id=security-window:dom-window-postmessage-2><a href=#dom-window-postmessage>postMessage()</a></code> method, they will get distinct objects that
- are not equal.</p>
- </div>
-
- <h4 id=apis-for-creating-and-navigating-browsing-contexts-by-name>7.2.2 APIs for creating and navigating browsing contexts by name</h4>
- <dl class=domintro><dt><var>window</var> = <var>window</var> . <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-open><a href=#dom-open>open</a></code>( [ <var>url</var> [, <var>target</var> [, <var>features</var> [, <var>replace</var> ] ] ] ] )<dd>
- <p>Opens a window to show <var>url</var> (defaults to <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank><a href=#about:blank>about:blank</a></code>), and
- returns it. The <var>target</var> argument gives the name of the new window. If a
- window exists with that name already, it is reused. The <var>replace</var> attribute,
- if true, means that whatever page is currently open in that window will be removed from the
- window's session history. The <var id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-open-features><a data-x-internal=dom-open-features href=http://dev.w3.org/csswg/cssom-view/#the-features-argument-to-the-open()-method>features</a></var> argument can be used to influence the rendering of the new window.</p>
- <dt><var>window</var> . <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-name><a href=#dom-name>name</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the name of the window.</p>
- <p>Can be set, to change the name.</p>
- <dt><var>window</var> . <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-close><a href=#dom-window-close>close</a></code>()<dd>
- <p>Closes the window.</p>
- <dt><var>window</var> . <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-closed><a href=#dom-window-closed>closed</a></code><dd>
- <p>Returns true if the window has been closed, false otherwise.</p>
- <dt><var>window</var> . <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-window-stop><a href=#dom-window-stop>stop</a></code>()<dd>
- <p>Cancels the document load.</p>
- </dl>
-
-
- <p>The <dfn id=dom-open><code>open()</code></dfn> method on <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window><a href=#window>Window</a></code> objects
- provides a mechanism for <a href=#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate>navigating</a> an existing <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context>browsing
- context</a> or opening and navigating an <a href=#auxiliary-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:auxiliary-browsing-context>auxiliary browsing context</a>.</p>
- <p>The method has four arguments, though they are all optional.</p>
- <p>The first argument, <var>url</var>, must be a <a href=#valid-non-empty-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:valid-non-empty-url>valid non-empty URL</a> for a
- page to load in the browsing context. If the first argument is the empty string, then the <var>url</var> argument must be interpreted as "<code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-2><a href=#about:blank>about:blank</a></code>". Otherwise, the
- argument must be <a href=#resolve-a-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:resolve-a-url>resolved</a> to an <a href=#absolute-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:absolute-url>absolute URL</a> (or
- an error), relative to the <a href=#api-base-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=apis-for-creating-and-navigating-browsing-contexts-by-name:entry-settings-object>entry settings
- object</a> when the method was invoked.</p>
- <p>The second argument, <var>target</var>, specifies the <a href=#browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-name>name</a> of the browsing context that is to be navigated. It must be a <a href=#valid-browsing-context-name-or-keyword id=apis-for-creating-and-navigating-browsing-contexts-by-name:valid-browsing-context-name-or-keyword>valid
- browsing context name or keyword</a>.</p>
- <p>The third argument, <var id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-open-features-2><a data-x-internal=dom-open-features href=http://dev.w3.org/csswg/cssom-view/#the-features-argument-to-the-open()-method>features</a></var>, must be interpreted as
- defined in the CSSOM View specification. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a></p>
- <p>The fourth argument, <var>replace</var>, specifies whether or not the new page will
- <a href=#replacement-enabled id=apis-for-creating-and-navigating-browsing-contexts-by-name:replacement-enabled>replace</a> the page currently loaded in the browsing
- context, when <var>target</var> identifies an existing browsing context (as opposed to
- leaving the current page in the browsing context's <a href=#session-history id=apis-for-creating-and-navigating-browsing-contexts-by-name:session-history>session history</a>).</p>
- <p>When the method is invoked, the user agent must first select a <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-2>browsing context</a> to
- navigate by applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for choosing a browsing context given a browsing context
- name</a> using the <var>target</var> argument as the name and the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-3>browsing
- context</a> of the script as the context in which the algorithm is executed, unless the user
- has indicated a preference, in which case the browsing context to navigate may instead be the one
- indicated by the user.</p>
- <p class=example>For example, suppose there is a user agent that supports control-clicking a
- link to open it in a new tab. If a user clicks in that user agent on an element whose <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:handler-onclick><a href=#handler-onclick>onclick</a></code> handler uses the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:dom-open-2><a href=#dom-open>window.open()</a></code> API to open a page in an iframe, but, while doing so, holds
- the control key down, the user agent could override the selection of the target browsing context
- to instead target a new tab.</p>
- <p>If applying <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name-2>the rules for choosing a browsing context given a browsing context
- name</a> using the <var>target</var> argument would result in there not being a chosen
- browsing context, then throw an <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort these
- steps.</p>
- <p>Otherwise, if <var>url</var> is not "<code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-3><a href=#about:blank>about:blank</a></code>", the user agent must
- <a href=#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-2>navigate</a> the selected <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-4>browsing context</a> to the
- <a href=#absolute-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:absolute-url-2>absolute URL</a> obtained from <a href=#resolve-a-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:resolve-a-url-2>resolving</a> <var>url</var> earlier, with <a href=#exceptions-enabled id=apis-for-creating-and-navigating-browsing-contexts-by-name:exceptions-enabled>exceptions enabled</a>. If the <var>replace</var> is true or if the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-5>browsing context</a> was just created as part
- of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name-3>the rules for choosing a browsing context given a browsing context name</a>, then
- <a href=#replacement-enabled id=apis-for-creating-and-navigating-browsing-contexts-by-name:replacement-enabled-2>replacement must be enabled</a> also. The navigation must be
- done with the <a href=#responsible-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=apis-for-creating-and-navigating-browsing-contexts-by-name:incumbent-settings-object>incumbent settings
- object</a> as the <a href=#source-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:source-browsing-context>source browsing context</a>. If the <a href=#resolve-a-url id=apis-for-creating-and-navigating-browsing-contexts-by-name:resolve-a-url-3>resolve a URL</a>
- algorithm failed, then the user agent may either instead <a href=#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-3>navigate</a> to an inline error
- page, with <a href=#exceptions-enabled id=apis-for-creating-and-navigating-browsing-contexts-by-name:exceptions-enabled-2>exceptions enabled</a> and using the same replacement behavior and source
- browsing context behavior as described earlier in this paragraph; or treat the <var>url</var> as "<code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-4><a href=#about:blank>about:blank</a></code>", acting as described in the next paragraph.</p>
- <p>If <var>url</var> <em>is</em> "<code id=apis-for-creating-and-navigating-browsing-contexts-by-name:about:blank-5><a href=#about:blank>about:blank</a></code>", and the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-6>browsing
- context</a> was just created as part of <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name-4>the rules for choosing a browsing context given a
- browsing context name</a>, then the user agent must instead <a href=#queue-a-task id=apis-for-creating-and-navigating-browsing-contexts-by-name:queue-a-task>queue a task</a> to
- <a href=#fire-a-simple-event id=apis-for-creating-and-navigating-browsing-contexts-by-name:fire-a-simple-event>fire a simple event</a> named <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:event-load><a href=#event-load>load</a></code> at the selected
- <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-7>browsing context</a>'s <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-2><a href=#window>Window</a></code> object, with <i id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-event-target-override><a href=#concept-event-target-override>target override</a></i> set to the selected <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-8>browsing context</a>'s <a href=#concept-document-window id=apis-for-creating-and-navigating-browsing-contexts-by-name:concept-document-window><code>Window</code> object's <code>Document</code></a> object.</p>
- <p>The method must return the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:windowproxy><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-9>browsing context</a>
- that was navigated, or null if no browsing context was navigated.</p>
- <hr>
- <p>The <dfn id=dom-name><code>name</code></dfn> attribute of the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-3><a href=#window>Window</a></code> object
- must, on getting, return the current <a href=#browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-name-2>name</a> of the
- <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-10>browsing context</a>, if one is set, or the empty string otherwise; and, on setting, set
- the <a href=#browsing-context-name id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-name-3>name</a> of the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-11>browsing context</a> to the
- new value.</p>
- <p class=note>The name <a href=#resetBCName>gets reset</a> when the browsing context is
- navigated to another domain.</p>
- <hr>
- <p>The <dfn id=dom-window-close><code>close()</code></dfn> method on <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-4><a href=#window>Window</a></code>
- objects should, if all the following conditions are met, <a href=#close-a-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:close-a-browsing-context>close</a> the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-12>browsing context</a> <var>A</var>:
- <ul class=brief><li>The corresponding <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-13>browsing context</a> <var>A</var> is
- <a href=#script-closable id=apis-for-creating-and-navigating-browsing-contexts-by-name:script-closable>script-closable</a>.<li>The <a href=#responsible-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context-2>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=apis-for-creating-and-navigating-browsing-contexts-by-name:incumbent-settings-object-2>incumbent settings
- object</a> is <a href=#familiar-with id=apis-for-creating-and-navigating-browsing-contexts-by-name:familiar-with>familiar with</a> the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-14>browsing context</a> <var>A</var>.<li id=sandboxClose>The <a href=#responsible-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:responsible-browsing-context-3>responsible browsing context</a> specified by the
- <a href=#incumbent-settings-object id=apis-for-creating-and-navigating-browsing-contexts-by-name:incumbent-settings-object-3>incumbent settings object</a> is <a href=#allowed-to-navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-15>browsing
- context</a> <var>A</var>.</ul>
- <p>A <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-16>browsing context</a> is <dfn id=script-closable>script-closable</dfn> if it is an <a href=#auxiliary-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:auxiliary-browsing-context-2>auxiliary
- browsing context</a> that was created by a script (as opposed to by an action of the user), or
- if it is a <a href=#top-level-browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:top-level-browsing-context>top-level browsing context</a> whose <a href=#session-history id=apis-for-creating-and-navigating-browsing-contexts-by-name:session-history-2>session history</a> contains
- only one <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:document><a href=#document>Document</a></code>.</p>
- <p>The <dfn id=dom-window-closed><code>closed</code></dfn> attribute on <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-5><a href=#window>Window</a></code>
- objects must return true if the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-6><a href=#window>Window</a></code> object's <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-17>browsing context</a> has
- been <a href=#a-browsing-context-is-discarded id=apis-for-creating-and-navigating-browsing-contexts-by-name:a-browsing-context-is-discarded>discarded</a>, and false otherwise.</p>
- <p>The <dfn id=dom-window-stop><code>stop()</code></dfn> method on <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-7><a href=#window>Window</a></code>
- objects should, if there is an existing attempt to <a href=#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-4>navigate</a> the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-18>browsing
- context</a> and that attempt is not currently running the <a href=#unload-a-document id=apis-for-creating-and-navigating-browsing-contexts-by-name:unload-a-document>unload a document</a>
- algorithm, cancel that <a href=#navigate id=apis-for-creating-and-navigating-browsing-contexts-by-name:navigate-5>navigation</a>; then, it must <a href=#abort-a-document id=apis-for-creating-and-navigating-browsing-contexts-by-name:abort-a-document>abort</a> the <a href=#active-document id=apis-for-creating-and-navigating-browsing-contexts-by-name:active-document>active document</a> of the <a href=#browsing-context id=apis-for-creating-and-navigating-browsing-contexts-by-name:browsing-context-19>browsing
- context</a> of the <code id=apis-for-creating-and-navigating-browsing-contexts-by-name:window-8><a href=#window>Window</a></code> object on which it was invoked.</p>
-
- <h4 id=accessing-other-browsing-contexts>7.2.3 Accessing other browsing contexts</h4>
- <dl class=domintro><dt><var>window</var> . <code id=accessing-other-browsing-contexts:dom-length><a href=#dom-length>length</a></code><dd>
- <p>Returns the number of <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context>child browsing
- contexts</a>.</p>
- <dt><var>window</var>[<var>index</var>]<dd>
- <p>Returns the indicated <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context-2>child browsing context</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-length><code>length</code></dfn> IDL attribute on the <code id=accessing-other-browsing-contexts:window><a href=#window>Window</a></code>
- interface must return the number of <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context-3>child browsing
- contexts</a> that are <a href=#browsing-context-nested-through id=accessing-other-browsing-contexts:browsing-context-nested-through>nested through</a>
- elements that are <a href=#in-a-document id=accessing-other-browsing-contexts:in-a-document>in the <code>Document</code></a> that is the
- <a href=#active-document id=accessing-other-browsing-contexts:active-document>active document</a> of that <code id=accessing-other-browsing-contexts:window-2><a href=#window>Window</a></code> object, if that <code id=accessing-other-browsing-contexts:window-3><a href=#window>Window</a></code>'s
- <a href=#browsing-context id=accessing-other-browsing-contexts:browsing-context>browsing context</a> shares the same <a href=#event-loop id=accessing-other-browsing-contexts:event-loop>event loop</a> as the <a href=#responsible-document id=accessing-other-browsing-contexts:responsible-document>responsible
- document</a> specified by the <a href=#entry-settings-object id=accessing-other-browsing-contexts:entry-settings-object>entry settings object</a> accessing the IDL attribute;
- otherwise, it must return zero.</p>
-
- <p>The <a href=#supported-property-indices id=accessing-other-browsing-contexts:supported-property-indices>supported property indices</a> on the <code id=accessing-other-browsing-contexts:window-4><a href=#window>Window</a></code> object at any instant
- are the numbers in the range 0 .. <span><var>n</var>-1</span>, where <var>n</var> is the number returned by the <code id=accessing-other-browsing-contexts:dom-length-2><a href=#dom-length>length</a></code> IDL
- attribute. If <var>n</var> is zero then there are no <a href=#supported-property-indices id=accessing-other-browsing-contexts:supported-property-indices-2>supported property
- indices</a>.</p>
-
- <p>To <dfn id=dom-window-item>determine the value of an indexed property</dfn> <var>index</var> of a <code id=accessing-other-browsing-contexts:window-5><a href=#window>Window</a></code> object, the user agent must return the
- <code id=accessing-other-browsing-contexts:windowproxy><a href=#windowproxy>WindowProxy</a></code> object of the <var>index</var>th <a href=#child-browsing-context id=accessing-other-browsing-contexts:child-browsing-context-4>child browsing
- context</a> of the <code id=accessing-other-browsing-contexts:document><a href=#document>Document</a></code> that is <a href=#browsing-context-nested-through id=accessing-other-browsing-contexts:browsing-context-nested-through-2>nested through</a> an element that is <a href=#in-a-document id=accessing-other-browsing-contexts:in-a-document-2>in the
- <code>Document</code></a>, sorted in the order that the elements nesting those <a href=#browsing-context id=accessing-other-browsing-contexts:browsing-context-2>browsing contexts</a> were most recently inserted into the
- <code id=accessing-other-browsing-contexts:document-2><a href=#document>Document</a></code>, the <code id=accessing-other-browsing-contexts:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object of the most recently inserted
- <a href=#browsing-context-container id=accessing-other-browsing-contexts:browsing-context-container>browsing context container</a>'s <a href=#nested-browsing-context id=accessing-other-browsing-contexts:nested-browsing-context>nested browsing context</a> being last.</p>
- <p>These properties are the <dfn id=dynamic-nested-browsing-context-properties>dynamic nested browsing context properties</dfn>.</p>
-
- <h4 id=named-access-on-the-window-object>7.2.4 Named access on the <code id=named-access-on-the-window-object:window><a href=#window>Window</a></code> object</h4>
- <dl class=domintro><dt><var>window</var>[<var>name</var>]<dd>
- <p>Returns the indicated element or collection of elements.</p>
- <p>As a general rule, relying on this will lead to brittle code. Which IDs end up mapping to
- this API can vary over time, as new features are added to the Web platform, for example. Instead
- of this, use <code>document.getElementById()</code> or <code>document.querySelector()</code>.</p>
- </dl>
-
- <p>The <code id=named-access-on-the-window-object:window-2><a href=#window>Window</a></code> interface <a href=#support-named-properties id=named-access-on-the-window-object:support-named-properties>supports named
- properties</a>. The <a href=#supported-property-names id=named-access-on-the-window-object:supported-property-names>supported property names</a> at any moment consist of the
- following, in <a href=#tree-order id=named-access-on-the-window-object:tree-order>tree order</a>, ignoring later duplicates:</p>
- <ul><li>the <a href=#browsing-context-name id=named-access-on-the-window-object:browsing-context-name>browsing context name</a> of any <a href=#child-browsing-context id=named-access-on-the-window-object:child-browsing-context>child browsing context</a> of the
- <a href=#active-document id=named-access-on-the-window-object:active-document>active document</a> whose name is not the empty string,<li>the value of the <code>name</code> content attribute for all <code id=named-access-on-the-window-object:the-a-element><a href=#the-a-element>a</a></code>,
- <code id=named-access-on-the-window-object:the-applet-element><a href=#the-applet-element>applet</a></code>, <code id=named-access-on-the-window-object:the-area-element><a href=#the-area-element>area</a></code>, <code id=named-access-on-the-window-object:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=named-access-on-the-window-object:the-form-element><a href=#the-form-element>form</a></code>,
- <code id=named-access-on-the-window-object:frameset><a href=#frameset>frameset</a></code>, <code id=named-access-on-the-window-object:the-img-element><a href=#the-img-element>img</a></code>, and <code id=named-access-on-the-window-object:the-object-element><a href=#the-object-element>object</a></code> elements in the <a href=#active-document id=named-access-on-the-window-object:active-document-2>active
- document</a> that have a non-empty <code>name</code> content attribute, and<li>the value of the <code id=named-access-on-the-window-object:the-id-attribute><a href=#the-id-attribute>id</a></code> content attribute of any <a href=#html-elements id=named-access-on-the-window-object:html-elements>HTML element</a> in the <a href=#active-document id=named-access-on-the-window-object:active-document-3>active document</a> with a non-empty <code id=named-access-on-the-window-object:the-id-attribute-2><a href=#the-id-attribute>id</a></code> content attribute.</ul>
- <p>To <a href=#determine-the-value-of-a-named-property id=named-access-on-the-window-object:determine-the-value-of-a-named-property>determine the value of a named property</a> <var>name</var> when <dfn id=dom-window-nameditem>the <code>Window</code> object is indexed for property
- retrieval</dfn>, the user agent must return the value obtained using the following steps:</p>
- <ol><li>
- <p>Let <var>objects</var> be the list of <a href=#dom-window-nameditem-filter id=named-access-on-the-window-object:dom-window-nameditem-filter>named objects</a> with the name <var>name</var>
- in the <a href=#active-document id=named-access-on-the-window-object:active-document-4>active document</a>.
- <p class=note>There will be at least one such object, by definition.</p>
- <li>
- <p>If <var>objects</var> contains a <a href=#nested-browsing-context id=named-access-on-the-window-object:nested-browsing-context>nested browsing context</a>, then return
- the <code id=named-access-on-the-window-object:windowproxy><a href=#windowproxy>WindowProxy</a></code> object of the <a href=#nested-browsing-context id=named-access-on-the-window-object:nested-browsing-context-2>nested browsing context</a> corresponding to
- the first <a href=#browsing-context-container id=named-access-on-the-window-object:browsing-context-container>browsing context container</a> in <a href=#tree-order id=named-access-on-the-window-object:tree-order-2>tree order</a> whose
- <a href=#browsing-context id=named-access-on-the-window-object:browsing-context>browsing context</a> is in <var>objects</var>, and abort these steps.</p>
- <li>
- <p>Otherwise, if <var>objects</var> has only one element, return that element and
- abort these steps.</p>
- <li>
- <p>Otherwise return an <code id=named-access-on-the-window-object:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=named-access-on-the-window-object:document><a href=#document>Document</a></code> node,
- whose filter matches only <a href=#dom-window-nameditem-filter id=named-access-on-the-window-object:dom-window-nameditem-filter-2>named objects</a> with
- the name <var>name</var>. (By definition, these will all be elements.)</p>
- </ol>
- <p><dfn id=dom-window-nameditem-filter>Named objects</dfn> with the name <var>name</var>, for the purposes of the above algorithm, are those that are either:</p>
- <ul><li><a href=#child-browsing-context id=named-access-on-the-window-object:child-browsing-context-2>child browsing contexts</a> of the <a href=#active-document id=named-access-on-the-window-object:active-document-5>active
- document</a> whose name is <var>name</var>,<li><code id=named-access-on-the-window-object:the-a-element-2><a href=#the-a-element>a</a></code>, <code id=named-access-on-the-window-object:the-applet-element-2><a href=#the-applet-element>applet</a></code>, <code id=named-access-on-the-window-object:the-area-element-2><a href=#the-area-element>area</a></code>, <code id=named-access-on-the-window-object:the-embed-element-2><a href=#the-embed-element>embed</a></code>,
- <code id=named-access-on-the-window-object:the-form-element-2><a href=#the-form-element>form</a></code>, <code id=named-access-on-the-window-object:frameset-2><a href=#frameset>frameset</a></code>, <code id=named-access-on-the-window-object:the-img-element-2><a href=#the-img-element>img</a></code>, or <code id=named-access-on-the-window-object:the-object-element-2><a href=#the-object-element>object</a></code> elements that
- have a <code>name</code> content attribute whose value is <var>name</var>, or<li><a href=#html-elements id=named-access-on-the-window-object:html-elements-2>HTML elements</a> that have an <code id=named-access-on-the-window-object:the-id-attribute-3><a href=#the-id-attribute>id</a></code> content attribute
- whose value is <var>name</var>.</ul>
-
-
- <h4 id=garbage-collection-and-browsing-contexts>7.2.5 Garbage collection and browsing contexts</h4>
- <p>A <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context>browsing context</a> has a strong reference to each of its <code id=garbage-collection-and-browsing-contexts:document><a href=#document>Document</a></code>s
- and its <code id=garbage-collection-and-browsing-contexts:windowproxy><a href=#windowproxy>WindowProxy</a></code> object, and the user agent itself has a strong reference to its
- <a href=#top-level-browsing-context id=garbage-collection-and-browsing-contexts:top-level-browsing-context>top-level browsing contexts</a>.</p>
- <p>A <code id=garbage-collection-and-browsing-contexts:document-2><a href=#document>Document</a></code> has a strong reference to its <code id=garbage-collection-and-browsing-contexts:window><a href=#window>Window</a></code> object.</p>
- <p class=note>A <code id=garbage-collection-and-browsing-contexts:window-2><a href=#window>Window</a></code> object <a href=#implied-strong-reference id=garbage-collection-and-browsing-contexts:implied-strong-reference>has a strong
- reference</a> to its <code id=garbage-collection-and-browsing-contexts:document-3><a href=#document>Document</a></code> object through its <code id=garbage-collection-and-browsing-contexts:dom-document-2><a href=#dom-document-2>document</a></code> attribute. Thus, references from other scripts to either of
- those objects will keep both alive. Similarly, both <code id=garbage-collection-and-browsing-contexts:document-4><a href=#document>Document</a></code> and <code id=garbage-collection-and-browsing-contexts:window-3><a href=#window>Window</a></code>
- objects have <a href=#implied-strong-reference id=garbage-collection-and-browsing-contexts:implied-strong-reference-2>implied strong references</a> to the
- <code id=garbage-collection-and-browsing-contexts:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object.</p>
- <p>Each <a href=#concept-script id=garbage-collection-and-browsing-contexts:concept-script>script</a> has a strong reference to its <a href=#settings-object id=garbage-collection-and-browsing-contexts:settings-object>settings
- object</a>, and each <a href=#script-settings-object id=garbage-collection-and-browsing-contexts:script-settings-object>script settings object</a> has strong references to its
- <a href=#global-object id=garbage-collection-and-browsing-contexts:global-object>global object</a>, <a href=#responsible-browsing-context id=garbage-collection-and-browsing-contexts:responsible-browsing-context>responsible browsing context</a>, and <a href=#responsible-document id=garbage-collection-and-browsing-contexts:responsible-document>responsible
- document</a>.</p>
-
- <p>When a <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context-2>browsing context</a> is to <dfn id=discard-a-document>discard a <code>Document</code></dfn>, the user
- agent must run the following steps:</p>
- <ol><li><p>Set the <code id=garbage-collection-and-browsing-contexts:document-5><a href=#document>Document</a></code>'s <i id=garbage-collection-and-browsing-contexts:concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.<li><p>Run any <a href=#unloading-document-cleanup-steps id=garbage-collection-and-browsing-contexts:unloading-document-cleanup-steps>unloading document cleanup steps</a> for the <code id=garbage-collection-and-browsing-contexts:document-6><a href=#document>Document</a></code> that
- are defined by this specification and <a href=#other-applicable-specifications id=garbage-collection-and-browsing-contexts:other-applicable-specifications>other applicable specifications</a>.<li><p><a href=#abort-a-document id=garbage-collection-and-browsing-contexts:abort-a-document>Abort the <code>Document</code></a>.<li><p>Remove any <a href=#concept-task id=garbage-collection-and-browsing-contexts:concept-task>tasks</a> associated with the
- <code id=garbage-collection-and-browsing-contexts:document-7><a href=#document>Document</a></code> in any <a href=#task-source id=garbage-collection-and-browsing-contexts:task-source>task source</a>, without running those tasks.<li><p><a href=#a-browsing-context-is-discarded id=garbage-collection-and-browsing-contexts:a-browsing-context-is-discarded>Discard</a> all the <a href=#child-browsing-context id=garbage-collection-and-browsing-contexts:child-browsing-context>child browsing contexts</a> of the <code id=garbage-collection-and-browsing-contexts:document-8><a href=#document>Document</a></code>.<li><p>Lose the strong reference from the <code id=garbage-collection-and-browsing-contexts:document-9><a href=#document>Document</a></code>'s <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context-3>browsing context</a>
- to the <code id=garbage-collection-and-browsing-contexts:document-10><a href=#document>Document</a></code>.</ol>
- <p class=note>Whenever a <code id=garbage-collection-and-browsing-contexts:document-11><a href=#document>Document</a></code> object is <a href=#discard-a-document id=garbage-collection-and-browsing-contexts:discard-a-document>discarded</a>, it is also removed from the list of <a href="#the-worker's-documents" id="garbage-collection-and-browsing-contexts:the-worker's-documents">the worker's
- <code>Document</code>s</a> of each worker whose list contains that <code id=garbage-collection-and-browsing-contexts:document-12><a href=#document>Document</a></code>.</p>
- <p>When <dfn id=a-browsing-context-is-discarded>a <em>browsing context</em> is discarded</dfn>, the strong reference from the user
- agent itself to the <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context-4>browsing context</a> must be severed, and all the
- <code id=garbage-collection-and-browsing-contexts:document-13><a href=#document>Document</a></code> objects for all the entries in the <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context-5>browsing context</a>'s session
- history must be <a href=#discard-a-document id=garbage-collection-and-browsing-contexts:discard-a-document-2>discarded</a> as well.</p>
- <p>User agents may <a href=#a-browsing-context-is-discarded id=garbage-collection-and-browsing-contexts:a-browsing-context-is-discarded-2>discard</a> <a href=#top-level-browsing-context id=garbage-collection-and-browsing-contexts:top-level-browsing-context-2>top-level browsing contexts</a> at any time (typically, in
- response to user requests, e.g. when a user force-closes a window containing one or more <a href=#top-level-browsing-context id=garbage-collection-and-browsing-contexts:top-level-browsing-context-3>top-level browsing contexts</a>). Other <a href=#browsing-context id=garbage-collection-and-browsing-contexts:browsing-context-6>browsing contexts</a> must be discarded once their
- <code id=garbage-collection-and-browsing-contexts:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object is eligible for garbage collection.</p>
-
- <h4 id=closing-browsing-contexts>7.2.6 Closing browsing contexts</h4>
- <p>When the user agent is required to <dfn id=close-a-browsing-context>close a browsing context</dfn>, it must run the
- following steps:</p>
- <ol><li><p>Let <var>specified browsing context</var> be the <a href=#browsing-context id=closing-browsing-contexts:browsing-context>browsing context</a>
- being closed.<li><p><a href=#prompt-to-unload-a-document id=closing-browsing-contexts:prompt-to-unload-a-document>Prompt to unload</a> the <a href=#active-document id=closing-browsing-contexts:active-document>active
- document</a> of the <var>specified browsing context</var>. If the user <a href=#refused-to-allow-the-document-to-be-unloaded id=closing-browsing-contexts:refused-to-allow-the-document-to-be-unloaded>refused
- to allow the document to be unloaded</a>, then abort these steps.<li><p><a href=#unload-a-document id=closing-browsing-contexts:unload-a-document>Unload</a> the <a href=#active-document id=closing-browsing-contexts:active-document-2>active document</a> of the <var>specified browsing context</var> with the <var>recycle</var> parameter set to
- false.<li><p>Remove the <var>specified browsing context</var> from the user interface (e.g.
- close or hide its tab in a tabbed browser).<li><p><a href=#a-browsing-context-is-discarded id=closing-browsing-contexts:a-browsing-context-is-discarded>Discard</a> the <var>specified
- browsing context</var>.</ol>
- <p>User agents should offer users the ability to arbitrarily <a href=#close-a-browsing-context id=closing-browsing-contexts:close-a-browsing-context>close</a> any <a href=#top-level-browsing-context id=closing-browsing-contexts:top-level-browsing-context>top-level browsing context</a>.</p>
- <h4 id=browser-interface-elements>7.2.7 Browser interface elements</h4>
- <p>To allow Web pages to integrate with Web browsers, certain Web browser interface elements are
- exposed in a limited way to scripts in Web pages.</p>
- <p>Each interface element is represented by a <code id=browser-interface-elements:barprop><a href=#barprop>BarProp</a></code> object:</p>
- <pre class=idl>interface <dfn id=barprop>BarProp</dfn> {
- attribute boolean <a href=#dom-barprop-visible id=browser-interface-elements:dom-barprop-visible>visible</a>;
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=browser-interface-elements:dom-window-locationbar><a href=#dom-window-locationbar>locationbar</a></code> . <code id=browser-interface-elements:dom-barprop-visible-2><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the location bar is visible; otherwise, returns false.</p>
- <dt><var>window</var> . <code id=browser-interface-elements:dom-window-menubar><a href=#dom-window-menubar>menubar</a></code> . <code id=browser-interface-elements:dom-barprop-visible-3><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the menu bar is visible; otherwise, returns false.</p>
- <dt><var>window</var> . <code id=browser-interface-elements:dom-window-personalbar><a href=#dom-window-personalbar>personalbar</a></code> . <code id=browser-interface-elements:dom-barprop-visible-4><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the personal bar is visible; otherwise, returns false.</p>
- <dt><var>window</var> . <code id=browser-interface-elements:dom-window-scrollbars><a href=#dom-window-scrollbars>scrollbars</a></code> . <code id=browser-interface-elements:dom-barprop-visible-5><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the scroll bars are visible; otherwise, returns false.</p>
- <dt><var>window</var> . <code id=browser-interface-elements:dom-window-statusbar><a href=#dom-window-statusbar>statusbar</a></code> . <code id=browser-interface-elements:dom-barprop-visible-6><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the status bar is visible; otherwise, returns false.</p>
- <dt><var>window</var> . <code id=browser-interface-elements:dom-window-toolbar><a href=#dom-window-toolbar>toolbar</a></code> . <code id=browser-interface-elements:dom-barprop-visible-7><a href=#dom-barprop-visible>visible</a></code><dd>
- <p>Returns true if the toolbar is visible; otherwise, returns false.</p>
- </dl>
-
- <p>The <dfn id=dom-barprop-visible>visible</dfn> attribute, on getting, must return either
- true or a value determined by the user agent to most accurately represent the visibility state of
- the user interface element that the object represents, as described below. On setting, the new
- value must be discarded.</p>
- <p>The following <code id=browser-interface-elements:barprop-2><a href=#barprop>BarProp</a></code> objects exist for each <code id=browser-interface-elements:document><a href=#document>Document</a></code> object in a
- <a href=#browsing-context id=browser-interface-elements:browsing-context>browsing context</a>. Some of the user interface elements represented by these objects
- might have no equivalent in some user agents; for those user agents, except when otherwise
- specified, the object must act as if it was present and visible (i.e. its <code id=browser-interface-elements:dom-barprop-visible-8><a href=#dom-barprop-visible>visible</a></code> attribute must return true).</p>
- <dl><dt><dfn id=the-location-bar-barprop-object>The location bar <code>BarProp</code> object</dfn><dd>Represents the user interface element that contains a control that displays the
- <a href=#url id=browser-interface-elements:url>URL</a> of the <a href=#active-document id=browser-interface-elements:active-document>active document</a>, or some similar interface concept.<dt><dfn id=the-menu-bar-barprop-object>The menu bar <code>BarProp</code> object</dfn><dd>Represents the user interface element that contains a list of commands in menu form, or some
- similar interface concept.<dt><dfn id=the-personal-bar-barprop-object>The personal bar <code>BarProp</code> object</dfn><dd>Represents the user interface element that contains links to the user's favorite pages, or
- some similar interface concept.<dt><dfn id=the-scrollbar-barprop-object>The scrollbar <code>BarProp</code> object</dfn><dd>Represents the user interface element that contains a scrolling mechanism, or some similar
- interface concept.<dt><dfn id=the-status-bar-barprop-object>The status bar <code>BarProp</code> object</dfn><dd>Represents a user interface element found immediately below or after the document, as
- appropriate for the user's media, which typically provides information about ongoing network
- activity or information about elements that the user's pointing device is current indicating. If
- the user agent has no such user interface element, then the object may act as if the
- corresponding user interface element was absent (i.e. its <code id=browser-interface-elements:dom-barprop-visible-9><a href=#dom-barprop-visible>visible</a></code> attribute may return false).<dt><dfn id=the-toolbar-barprop-object>The toolbar <code>BarProp</code> object</dfn><dd>Represents the user interface element found immediately above or before the document, as
- appropriate for the user's media, which typically provides <a href=#session-history id=browser-interface-elements:session-history>session history</a> traversal
- controls (back and forward buttons, reload buttons, etc). If the user agent has no such user
- interface element, then the object may act as if the corresponding user interface element was
- absent (i.e. its <code id=browser-interface-elements:dom-barprop-visible-10><a href=#dom-barprop-visible>visible</a></code> attribute may return
- false).</dl>
- <p>The <dfn id=dom-window-locationbar><code>locationbar</code></dfn> attribute must return
- <a href=#the-location-bar-barprop-object id=browser-interface-elements:the-location-bar-barprop-object>the location bar <code>BarProp</code> object</a>.</p>
- <p>The <dfn id=dom-window-menubar><code>menubar</code></dfn> attribute must return <a href=#the-menu-bar-barprop-object id=browser-interface-elements:the-menu-bar-barprop-object>the
- menu bar <code>BarProp</code> object</a>.</p>
- <p>The <dfn id=dom-window-personalbar><code>personalbar</code></dfn> attribute must return
- <a href=#the-personal-bar-barprop-object id=browser-interface-elements:the-personal-bar-barprop-object>the personal bar <code>BarProp</code> object</a>.</p>
- <p>The <dfn id=dom-window-scrollbars><code>scrollbars</code></dfn> attribute must return
- <a href=#the-scrollbar-barprop-object id=browser-interface-elements:the-scrollbar-barprop-object>the scrollbar <code>BarProp</code> object</a>.</p>
- <p>The <dfn id=dom-window-statusbar><code>statusbar</code></dfn> attribute must return
- <a href=#the-status-bar-barprop-object id=browser-interface-elements:the-status-bar-barprop-object>the status bar <code>BarProp</code> object</a>.</p>
- <p>The <dfn id=dom-window-toolbar><code>toolbar</code></dfn> attribute must return <a href=#the-toolbar-barprop-object id=browser-interface-elements:the-toolbar-barprop-object>the
- toolbar <code>BarProp</code> object</a>.</p>
- <hr>
- <p>For historical reasons, the <dfn id=dom-window-status><code>status</code></dfn> attribute
- on the <code id=browser-interface-elements:window><a href=#window>Window</a></code> object must, on getting, return the last string it was set to, and on
- setting, must set itself to the new value. When the <code id=browser-interface-elements:window-2><a href=#window>Window</a></code> object is created, the
- attribute must be set to the empty string. It does not do anything else.</p>
-
-
- <h4 id=the-windowproxy-object>7.2.8 The <code id=the-windowproxy-object:windowproxy><a href=#windowproxy>WindowProxy</a></code> object</h4>
- <p>As mentioned earlier, each <a href=#browsing-context id=the-windowproxy-object:browsing-context>browsing context</a> has a
- <dfn id=windowproxy><code>WindowProxy</code></dfn> object. This object is unusual in that all operations that
- would be performed on it must be performed on the <code id=the-windowproxy-object:window><a href=#window>Window</a></code> object of the <a href=#browsing-context id=the-windowproxy-object:browsing-context-2>browsing
- context</a>'s <a href=#active-document id=the-windowproxy-object:active-document>active document</a> instead. It is thus indistinguishable from that
- <code id=the-windowproxy-object:window-2><a href=#window>Window</a></code> object in every way until the <a href=#browsing-context id=the-windowproxy-object:browsing-context-3>browsing context</a> is navigated.</p>
- <p>There is no <code id=the-windowproxy-object:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> interface object.</p>
- <p class=note>The <code id=the-windowproxy-object:windowproxy-3><a href=#windowproxy>WindowProxy</a></code> object allows scripts to act as if each
- <a href=#browsing-context id=the-windowproxy-object:browsing-context-4>browsing context</a> had a single <code id=the-windowproxy-object:window-3><a href=#window>Window</a></code> object, while still keeping
- separate <code id=the-windowproxy-object:window-4><a href=#window>Window</a></code> objects for each <code id=the-windowproxy-object:document><a href=#document>Document</a></code>.</p>
- <div class=example>
- <p>In the following example, the variable <var>x</var> is set to the
- <code id=the-windowproxy-object:windowproxy-4><a href=#windowproxy>WindowProxy</a></code> object returned by the <code id=the-windowproxy-object:dom-window><a href=#dom-window>window</a></code> accessor
- on the global object. All of the expressions following the assignment return true, because in
- every respect, the <code id=the-windowproxy-object:windowproxy-5><a href=#windowproxy>WindowProxy</a></code> object acts like the underlying <code id=the-windowproxy-object:window-5><a href=#window>Window</a></code>
- object.</p>
- <pre>var x = window;
- x instanceof Window; // true
- x === this; // true</pre>
- </div>
-
- <h3 id=origin>7.3 Origin</h3>
-
- <p>Origins are the fundamental currency of the Web's security model. Two actors in the Web
- platform that share an origin are assumed to trust each other and to have the same authority.
- Actors with differing origins are considered potentially hostile versus each other, and are
- isolated from each other to varying degrees.</p>
- <p class=example>For example, if Example Bank's Web site, hosted at <code>bank.example.com</code>, tries to examine the DOM of Example Charity's Web site, hosted
- at <code>charity.example.org</code>, a <code id=origin:securityerror><a href=#securityerror>SecurityError</a></code> exception will be
- raised.</p>
- <hr>
- <p>The <dfn id=origin-2>origin</dfn> of a resource and the <dfn id=effective-script-origin>effective script origin</dfn> of a resource
- are both either opaque identifiers or tuples consisting of a scheme component, a host component, a
- port component, and optionally extra data.</p>
- <p class=note>The extra data could include the certificate of the site when using encrypted
- connections, to ensure that if the site's secure certificate changes, the origin is considered to
- change as well.</p>
-
- <p>An <a href=#origin-2 id=origin:origin-2>origin</a> or <a href=#effective-script-origin id=origin:effective-script-origin>effective script origin</a> can be defined as an <dfn id=concept-origin-alias>alias</dfn> to another <a href=#origin-2 id=origin:origin-2-2>origin</a> or <a href=#effective-script-origin id=origin:effective-script-origin-2>effective script
- origin</a>. The value of the <a href=#origin-2 id=origin:origin-2-3>origin</a> or <a href=#effective-script-origin id=origin:effective-script-origin-3>effective script origin</a> is
- then the value of the <a href=#origin-2 id=origin:origin-2-4>origin</a> or <a href=#effective-script-origin id=origin:effective-script-origin-4>effective script origin</a> to which it is
- an alias.</p>
- <p>These characteristics are defined as follows:</p>
- <dl><dt>For URLs<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-5>origin</a> and <a href=#effective-script-origin id=origin:effective-script-origin-5>effective script origin</a> of the <a href=#url id=origin:url>URL</a> are
- the origin defined in <cite>The Web Origin Concept</cite>. <a href=#refsORIGIN>[ORIGIN]</a></p>
- <dt>For <code id=origin:document><a href=#document>Document</a></code> objects<dd>
- <dl class=switch><dt id=sandboxOrigin>If a <code id=origin:document-2><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=origin:active-sandboxing-flag-set>active sandboxing flag set</a> has
- its <a href=#sandboxed-origin-browsing-context-flag id=origin:sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</a> set<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-6>origin</a> is a globally unique identifier assigned when the
- <code id=origin:document-3><a href=#document>Document</a></code> is created.</p>
- <p>The <a href=#effective-script-origin id=origin:effective-script-origin-6>effective script origin</a> is initially an <a href=#concept-origin-alias id=origin:concept-origin-alias>alias</a> to the <a href=#origin-2 id=origin:origin-2-7>origin</a> of the
- <code id=origin:document-4><a href=#document>Document</a></code>.</p>
- <dt>If a <code id=origin:document-5><a href=#document>Document</a></code> was served over the network and has an address that uses a URL
- scheme with a server-based naming authority<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-8>origin</a> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-2>alias</a> to the
- <a href=#origin-2 id=origin:origin-2-9>origin</a> of <a id="origin:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the <code>Document</code>'s address</a>.</p>
- <p>The <a href=#effective-script-origin id=origin:effective-script-origin-7>effective script origin</a> is initially an <a href=#concept-origin-alias id=origin:concept-origin-alias-3>alias</a> to the <a href=#origin-2 id=origin:origin-2-10>origin</a> of the
- <code id=origin:document-6><a href=#document>Document</a></code>.</p>
- <dt>If a <code id=origin:document-7><a href=#document>Document</a></code> was generated from a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=origin:data-protocol data-x-internal=data-protocol><code>data:</code> URL</a> found in another <code id=origin:document-8><a href=#document>Document</a></code> or in a
- script<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-11>origin</a> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-4>alias</a> to the
- <a href=#origin-2 id=origin:origin-2-12>origin</a> specified by the <a href=#incumbent-settings-object id=origin:incumbent-settings-object>incumbent settings object</a> when the <a href=#navigate id=origin:navigate>navigate</a>
- algorithm was invoked, or, if no <a href=#concept-script id=origin:concept-script>script</a> was involved, of
- the <a id=origin:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the element that initiated the <a href=#navigate id=origin:navigate-2>navigation</a> to that <a href=#url id=origin:url-2>URL</a>.</p>
- <p>The <a href=#effective-script-origin id=origin:effective-script-origin-8>effective script origin</a> is initially an <a href=#concept-origin-alias id=origin:concept-origin-alias-5>alias</a> to the <a href=#effective-script-origin id=origin:effective-script-origin-9>effective script origin</a> of that
- same <a href=#script-settings-object id=origin:script-settings-object>script settings object</a> or <code id=origin:document-9><a href=#document>Document</a></code>.</p>
- <dt>If a <code id=origin:document-10><a href=#document>Document</a></code> is the initial "<code id=origin:about:blank><a href=#about:blank>about:blank</a></code>" document<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-13>origin</a> and <a href=#effective-script-origin id=origin:effective-script-origin-10>effective script origin</a> of the
- <code id=origin:document-11><a href=#document>Document</a></code> are <a href=#about-blank-origin>those it was assigned when its
- browsing context was created</a>.</p>
- <dt>If a <code id=origin:document-12><a href=#document>Document</a></code> was created as part of the processing for <a href=#javascript-protocol id=origin:javascript-protocol><code>javascript:</code> URLs</a><dd>
- <p>The <a href=#origin-2 id=origin:origin-2-14>origin</a> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-6>alias</a> to the
- <a href=#origin-2 id=origin:origin-2-15>origin</a> of the <a href=#active-document id=origin:active-document>active document</a> of the <a href=#browsing-context id=origin:browsing-context>browsing context</a>
- being navigated when the <a href=#navigate id=origin:navigate-3>navigate</a> algorithm was invoked.</p>
- <p>The <a href=#effective-script-origin id=origin:effective-script-origin-11>effective script origin</a> is initially an <a href=#concept-origin-alias id=origin:concept-origin-alias-7>alias</a> to the <a href=#effective-script-origin id=origin:effective-script-origin-12>effective script origin</a> of that
- same <code id=origin:document-13><a href=#document>Document</a></code>.</p>
- <dt>If a <code id=origin:document-14><a href=#document>Document</a></code> is <a href=#an-iframe-srcdoc-document id=origin:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a><dd>
- <p>The <a href=#origin-2 id=origin:origin-2-16>origin</a> of the <code id=origin:document-15><a href=#document>Document</a></code> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-8>alias</a> to the <a href=#origin-2 id=origin:origin-2-17>origin</a> of the
- <code id=origin:document-16><a href=#document>Document</a></code>'s <a href=#browsing-context id=origin:browsing-context-2>browsing context</a>'s <a href=#browsing-context-container id=origin:browsing-context-container>browsing context
- container</a>'s <a id=origin:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
- <p>The <a href=#effective-script-origin id=origin:effective-script-origin-13>effective script origin</a> is initially an <a href=#concept-origin-alias id=origin:concept-origin-alias-9>alias</a> to the <a href=#effective-script-origin id=origin:effective-script-origin-14>effective script origin</a> of the
- <code id=origin:document-17><a href=#document>Document</a></code>'s <a href=#browsing-context id=origin:browsing-context-3>browsing context</a>'s <a href=#browsing-context-container id=origin:browsing-context-container-2>browsing context
- container</a>'s <a id=origin:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
- <dt>If a <code id=origin:document-18><a href=#document>Document</a></code> was obtained in some other manner (e.g. a <a href=http://tools.ietf.org/html/rfc2397#section-2 id=origin:data-protocol-2 data-x-internal=data-protocol><code>data:</code> URL</a> typed in by the user or that was returned as the
- location of an HTTP redirect (<a href=#concept-http-equivalent-codes id=origin:concept-http-equivalent-codes>or equivalent</a>
- in other protocols), a <code id=origin:document-19><a href=#document>Document</a></code> created using the <code id=origin:dom-domimplementation-createdocument><a href=#dom-domimplementation-createdocument>createDocument()</a></code> API, etc)<dd>
- <p>The default behavior as defined in the DOM standard applies. <a href=#refsDOM>[DOM]</a>.</p>
- <p class=note>The <a href=#origin-2 id=origin:origin-2-18>origin</a> is a globally unique identifier assigned when the
- <code id=origin:document-20><a href=#document>Document</a></code> is created, and the <a href=#effective-script-origin id=origin:effective-script-origin-15>effective script origin</a> is initially an
- <a href=#concept-origin-alias id=origin:concept-origin-alias-10>alias</a> to the <a href=#origin-2 id=origin:origin-2-19>origin</a> of the
- <code id=origin:document-21><a href=#document>Document</a></code>.</p>
- </dl>
- <p class=note>The <a href=#effective-script-origin id=origin:effective-script-origin-16>effective script origin</a> of a <code id=origin:document-22><a href=#document>Document</a></code> can be
- manipulated using the <code id=origin:dom-document-domain><a href=#dom-document-domain>document.domain</a></code> IDL
- attribute.</p>
- <dt>For images of <code id=origin:the-img-element><a href=#the-img-element>img</a></code> elements<dd>
- <dl class=switch><dt>If the image data is <a href=#cors-cross-origin id=origin:cors-cross-origin>CORS-cross-origin</a><dd>The <a href=#origin-2 id=origin:origin-2-20>origin</a> is a globally unique identifier assigned when the image is
- created.<dt>If the image data is <a href=#cors-same-origin id=origin:cors-same-origin>CORS-same-origin</a><dd>The <a href=#origin-2 id=origin:origin-2-21>origin</a> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-11>alias</a> to the
- <a href=#origin-2 id=origin:origin-2-22>origin</a> of the <code id=origin:the-img-element-2><a href=#the-img-element>img</a></code> element's <a id=origin:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</dl>
- <p>Images do not have an <a href=#effective-script-origin id=origin:effective-script-origin-17>effective script origin</a>.</p>
- <dt>For <code id=origin:the-audio-element><a href=#the-audio-element>audio</a></code> and <code id=origin:the-video-element><a href=#the-video-element>video</a></code> elements<dd>
- <dl class=switch><dt>If the <a href=#media-data id=origin:media-data>media data</a> is <a href=#cors-cross-origin id=origin:cors-cross-origin-2>CORS-cross-origin</a><dd>The <a href=#origin-2 id=origin:origin-2-23>origin</a> is a globally unique identifier assigned when the <a href=#media-data id=origin:media-data-2>media
- data</a> is <a href=#fetch id=origin:fetch>fetched</a>.<dt>If the <a href=#media-data id=origin:media-data-3>media data</a> is <a href=#cors-same-origin id=origin:cors-same-origin-2>CORS-same-origin</a><dd>The <a href=#origin-2 id=origin:origin-2-24>origin</a> is an <a href=#concept-origin-alias id=origin:concept-origin-alias-12>alias</a> to the
- <a href=#origin-2 id=origin:origin-2-25>origin</a> of the <a href=#media-element id=origin:media-element>media element</a>'s <a id=origin:node-document-5 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</dl>
- <p><a href=#media-element id=origin:media-element-2>Media elements</a> do not have an <a href=#effective-script-origin id=origin:effective-script-origin-18>effective script
- origin</a>.</p>
- <dt>For fonts<dd>
- <p>The <a href=#origin-2 id=origin:origin-2-26>origin</a> of a downloadable Web font is an <a href=#concept-origin-alias id=origin:concept-origin-alias-13>alias</a> to the <a href=#origin-2 id=origin:origin-2-27>origin</a> of the <a href=#absolute-url id=origin:absolute-url>absolute
- URL</a> used to obtain the font (after any redirects). <a href=#refsCSSFONTS>[CSSFONTS]</a>
- <a href=#refsCSSFONTLOAD>[CSSFONTLOAD]</a></p>
- <p>The <a href=#origin-2 id=origin:origin-2-28>origin</a> of a locally installed system font is an <a href=#concept-origin-alias id=origin:concept-origin-alias-14>alias</a> to the <a href=#origin-2 id=origin:origin-2-29>origin</a> of the
- <code id=origin:document-23><a href=#document>Document</a></code> in which that font is being used.</p>
- <p>Fonts do not have an <a href=#effective-script-origin id=origin:effective-script-origin-19>effective script origin</a>.</p>
- </dl>
- <p>Other specifications can override the above definitions by themselves specifying the origin of
- a particular <a href=#url id=origin:url-3>URL</a>, <code id=origin:document-24><a href=#document>Document</a></code>, image, <a href=#media-element id=origin:media-element-3>media element</a>, or
- font.</p>
-
- <hr>
- <p>The <dfn id=unicode-serialisation-of-an-origin>Unicode serialisation of an origin</dfn> is the string obtained by applying the
- following algorithm to the given <a href=#origin-2 id=origin:origin-2-30>origin</a>:</p>
- <ol><li><p>If the <a href=#origin-2 id=origin:origin-2-31>origin</a> in question is not a scheme/host/port tuple, then return the
- literal string "<code>null</code>" and abort these steps.<li><p>Otherwise, let <var>result</var> be the scheme part of the <a href=#origin-2 id=origin:origin-2-32>origin</a>
- tuple.<li><p>Append the string "<code>://</code>" to <var>result</var>.<li><p>Apply the <a href=#domain-to-unicode id=origin:domain-to-unicode>domain to Unicode</a> algorithm to each component of the host
- part of the <a href=#origin-2 id=origin:origin-2-33>origin</a> tuple, and append the results — each component, in the same
- order, separated by U+002E FULL STOP characters (.) — to <var>result</var>. <a href=#refsURL>[URL]</a><li><p>If the port part of the <a href=#origin-2 id=origin:origin-2-34>origin</a> tuple gives a port that is different from the
- default port for the protocol given by the scheme part of the <a href=#origin-2 id=origin:origin-2-35>origin</a> tuple, then
- append a U+003A COLON character (:) and the given port, in base ten, to <var>result</var>.<li><p>Return <var>result</var>.</ol>
- <p>The <dfn id=ascii-serialisation-of-an-origin>ASCII serialisation of an origin</dfn> is the string obtained by applying the
- following algorithm to the given <a href=#origin-2 id=origin:origin-2-36>origin</a>:</p>
- <ol><li><p>If the <a href=#origin-2 id=origin:origin-2-37>origin</a> in question is not a scheme/host/port tuple, then return the
- literal string "<code>null</code>" and abort these steps.<li><p>Otherwise, let <var>result</var> be the scheme part of the <a href=#origin-2 id=origin:origin-2-38>origin</a>
- tuple.<li><p>Append the string "<code>://</code>" to <var>result</var>.<li>
- <p>Apply the <a href=#domain-to-ascii id=origin:domain-to-ascii>domain to ASCII</a> algorithm to each component of the host part of
- the <a href=#origin-2 id=origin:origin-2-39>origin</a> tuple, and append the results — each component, in the same order,
- separated by U+002E FULL STOP characters (.) — to <var>result</var>. <a href=#refsURL>[URL]</a></p>
- <p>If the ToASCII algorithm used by the <a href=#domain-to-ascii id=origin:domain-to-ascii-2>domain to ASCII</a> algorithm fails to
- convert one of the components of the string, e.g. because it is too long or because it contains
- invalid characters, then throw a <code id=origin:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps. <a href=#refsRFC3490>[RFC3490]</a></p>
- <li><p>If the port part of the <a href=#origin-2 id=origin:origin-2-40>origin</a> tuple gives a port that is different from the
- default port for the protocol given by the scheme part of the <a href=#origin-2 id=origin:origin-2-41>origin</a> tuple, then
- append a U+003A COLON character (:) and the given port, in base ten, to <var>result</var>.<li><p>Return <var>result</var>.</ol>
- <p>Two <a href=#origin-2 id=origin:origin-2-42>origins</a> are said to be the <dfn id=same-origin>same origin</dfn> if the
- following algorithm returns true:</p>
- <ol><li><p>Let <var>A</var> be the first <a href=#origin-2 id=origin:origin-2-43>origin</a> being compared, and <var>B</var> be the second <a href=#origin-2 id=origin:origin-2-44>origin</a> being compared.<li><p>If <var>A</var> and <var>B</var> are both opaque identifiers, and their
- value is equal, then return true.<li><p>Otherwise, if either <var>A</var> or <var>B</var> or both are opaque
- identifiers, return false.<li><p>If <var>A</var> and <var>B</var> have scheme components that are not
- identical, return false.<li><p>If <var>A</var> and <var>B</var> have host components that are not
- identical, return false.<li><p>If <var>A</var> and <var>B</var> have port components that are not
- identical, return false.<li><p>If either <var>A</var> or <var>B</var> have additional data, but that
- data is not identical for both, return false.<li><p>Return true.</ol>
-
- <h4 id=relaxing-the-same-origin-restriction>7.3.1 Relaxing the same-origin restriction</h4>
- <dl class=domintro><dt><var>document</var> . <code id=relaxing-the-same-origin-restriction:dom-document-domain><a href=#dom-document-domain>domain</a></code> [ = <var>domain</var> ]<dd>
- <p>Returns the current domain used for security checks.</p>
- <p>Can be set to a value that removes subdomains, to change the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin>effective script
- origin</a> to allow pages on other subdomains of the same domain (if they do the same thing)
- to access each other. (Can't be set in sandboxed <code id=relaxing-the-same-origin-restriction:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s.)</p>
- </dl>
-
- <p>The <dfn id=dom-document-domain><code>domain</code></dfn> attribute on
- <code id=relaxing-the-same-origin-restriction:document><a href=#document>Document</a></code> objects must be initialised to <a href="#the-document's-domain" id="relaxing-the-same-origin-restriction:the-document's-domain">the document's domain</a>, if it has
- one, and the empty string otherwise. If <a href="#the-document's-domain" id="relaxing-the-same-origin-restriction:the-document's-domain-2">the document's domain</a> starts with a U+005B
- LEFT SQUARE BRACKET character ([) and ends with a U+005D RIGHT SQUARE BRACKET character (]), it is
- an IPv6 address; these square brackets must be omitted when initializing the attribute's
- value.</p>
- <p>On getting, the attribute must return its current value, unless the <code id=relaxing-the-same-origin-restriction:document-2><a href=#document>Document</a></code> has
- no <a href=#browsing-context id=relaxing-the-same-origin-restriction:browsing-context>browsing context</a>, in which case it must return the empty string.</p>
- <p>On setting, the user agent must run the following algorithm:</p>
- <ol><li>
- <p>If the <code id=relaxing-the-same-origin-restriction:document-3><a href=#document>Document</a></code> has no <a href=#browsing-context id=relaxing-the-same-origin-restriction:browsing-context-2>browsing context</a>, throw a
- <code id=relaxing-the-same-origin-restriction:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
- <li>
- <p>If the <code id=relaxing-the-same-origin-restriction:document-4><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=relaxing-the-same-origin-restriction:active-sandboxing-flag-set>active sandboxing flag set</a> has its
- <a href=#sandboxed-document.domain-browsing-context-flag id=relaxing-the-same-origin-restriction:sandboxed-document.domain-browsing-context-flag>sandboxed <code>document.domain</code> browsing context
- flag</a> set, throw a <code id=relaxing-the-same-origin-restriction:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
- <li>
- <p>If the new value is an IPv4 or IPv6 address, let <var>new value</var> be the new
- value.</p>
- <p>Otherwise, <a href=#strictly-split-a-string id=relaxing-the-same-origin-restriction:strictly-split-a-string>strictly split</a> the new value on
- U+002E FULL STOP characters (.), apply the <a href=#domain-to-ascii id=relaxing-the-same-origin-restriction:domain-to-ascii>domain to ASCII</a> algorithm to each
- returned token, and let <var>new value</var> be the result of concatenating the
- results of applying that algorithm to each token, in the same order, separated by U+002E FULL
- STOP characters (.). <a href=#refsURL>[URL]</a></p>
- <p>If the ToASCII algorithm used by the <a href=#domain-to-ascii id=relaxing-the-same-origin-restriction:domain-to-ascii-2>domain to ASCII</a> algorithm fails to
- convert one of the components of the string, e.g. because it is too long or because it contains
- invalid characters, then throw a <code id=relaxing-the-same-origin-restriction:securityerror-3><a href=#securityerror>SecurityError</a></code> exception and abort these steps. <a href=#refsRFC3490>[RFC3490]</a></p>
- <li>
- <p>If <var>new value</var> is not exactly equal to the current value of the <code id=relaxing-the-same-origin-restriction:dom-document-domain-2><a href=#dom-document-domain>document.domain</a></code> attribute, then run these substeps:</p>
- <ol><li>
- <p>If the current value is an IPv4 or IPv6 address, throw a <code id=relaxing-the-same-origin-restriction:securityerror-4><a href=#securityerror>SecurityError</a></code>
- exception and abort these steps.</p>
- <li>
- <p>If <var>new value</var>, prefixed by a U+002E FULL STOP (.), does not exactly
- match the end of the current value, throw a <code id=relaxing-the-same-origin-restriction:securityerror-5><a href=#securityerror>SecurityError</a></code> exception and abort
- these steps.</p>
- <p class=note>If the <var>new value</var> is an IPv4 or IPv6 address, it cannot
- match the <var>new value</var> in this way and thus an exception will be thrown
- here.</p>
-
- <li>
- <p>If <var>new value</var> matches a suffix in the Public Suffix List, or, if <var>new value</var>, prefixed by a U+002E FULL STOP (.), matches the end of a suffix in
- the Public Suffix List, then throw a <code id=relaxing-the-same-origin-restriction:securityerror-6><a href=#securityerror>SecurityError</a></code> exception and abort these
- steps. <a href=#refsPSL>[PSL]</a></p>
- <p>Suffixes must be compared in an <a href=#ascii-case-insensitive id=relaxing-the-same-origin-restriction:ascii-case-insensitive>ASCII case-insensitive</a> manner, after applying
- the <a href=#domain-to-ascii id=relaxing-the-same-origin-restriction:domain-to-ascii-3>domain to ASCII</a> algorithm to their individual components, . <a href=#refsURL>[URL]</a></p>
- </ol>
- <li><p>Release the <a href=#storage-mutex id=relaxing-the-same-origin-restriction:storage-mutex>storage mutex</a>.<li>
- <p>Set the attribute's value to <var>new value</var>.</p>
- <li>
- <p>If the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin-2>effective script origin</a> of the <code id=relaxing-the-same-origin-restriction:document-5><a href=#document>Document</a></code> is an <a href=#concept-origin-alias id=relaxing-the-same-origin-restriction:concept-origin-alias>alias</a>, set it to the value of the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin-3>effective script
- origin</a> (essentially de-aliasing the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin-4>effective script origin</a>).</p>
- <li>
- <p>If <var>new value</var> is not the empty string, then run these substeps:</p>
- <ol><li>
- <p>Set the host part of the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin-5>effective script origin</a> tuple of the
- <code id=relaxing-the-same-origin-restriction:document-6><a href=#document>Document</a></code> to <var>new value</var>.</p>
- <li>
- <p>Set the port part of the <a href=#effective-script-origin id=relaxing-the-same-origin-restriction:effective-script-origin-6>effective script origin</a> tuple of the
- <code id=relaxing-the-same-origin-restriction:document-7><a href=#document>Document</a></code> to "manual override" (a value that, for the purposes of <a href=#same-origin id=relaxing-the-same-origin-restriction:same-origin>comparing origins</a>, is identical to "manual override" but not
- identical to any other value).</p>
- </ol>
- </ol>
- <p>The <dfn id="the-document's-domain">domain</dfn> of a <code id=relaxing-the-same-origin-restriction:document-8><a href=#document>Document</a></code> is the host part
- of the document's <a href=#origin-2 id=relaxing-the-same-origin-restriction:origin-2>origin</a>, if the value of that <a href=#origin-2 id=relaxing-the-same-origin-restriction:origin-2-2>origin</a> is a
- scheme/host/port tuple. If it isn't, then the document does not have a domain.</p>
-
- <p class=note>The <code id=relaxing-the-same-origin-restriction:dom-document-domain-3><a href=#dom-document-domain>domain</a></code> attribute is used to enable
- pages on different hosts of a domain to access each others' DOMs.</p>
- <p class=warning>Do not use the <code id=relaxing-the-same-origin-restriction:dom-document-domain-4><a href=#dom-document-domain>document.domain</a></code>
- attribute when using shared hosting. If an untrusted third party is able to host an HTTP server at
- the same IP address but on a different port, then the same-origin protection that normally
- protects two different sites on the same host will fail, as the ports are ignored when comparing
- origins after the <code id=relaxing-the-same-origin-restriction:dom-document-domain-5><a href=#dom-document-domain>document.domain</a></code> attribute has been
- used.</p>
- <h3 id=sandboxing>7.4 Sandboxing</h3>
- <p>A <dfn id=sandboxing-flag-set>sandboxing flag set</dfn> is a set of zero or more of the following flags, which are
- used to restrict the abilities that potentially untrusted resources have:</p>
- <dl><dt>The <dfn id=sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxLinks>prevents content from navigating browsing contexts other
- than the sandboxed browsing context itself</a> (or browsing contexts further nested inside it),
- <a href=#auxiliary-browsing-context id=sandboxing:auxiliary-browsing-context>auxiliary browsing contexts</a> (which are protected
- by the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=sandboxing:sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> defined next), and the
- <a href=#top-level-browsing-context id=sandboxing:top-level-browsing-context>top-level browsing context</a> (which is protected by the <a href=#sandboxed-top-level-navigation-browsing-context-flag id=sandboxing:sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level
- navigation browsing context flag</a> defined below).</p>
- <p>If the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=sandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-2>sandboxed auxiliary navigation browsing context flag</a> is not set, then in
- certain cases the restrictions nonetheless allow popups (new <a href=#top-level-browsing-context id=sandboxing:top-level-browsing-context-2>top-level browsing contexts</a>) to be opened. These <a href=#browsing-context id=sandboxing:browsing-context>browsing contexts</a> always have <dfn id=one-permitted-sandboxed-navigator>one permitted sandboxed navigator</dfn>, set
- when the browsing context is created, which allows the <a href=#browsing-context id=sandboxing:browsing-context-2>browsing context</a> that
- created them to actually navigate them. (Otherwise, the <a href=#sandboxed-navigation-browsing-context-flag id=sandboxing:sandboxed-navigation-browsing-context-flag>sandboxed navigation browsing
- context flag</a> would prevent them from being navigated even if they were opened.)</p>
- <dt>The <dfn id=sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxWindowOpen>prevents content from creating new auxiliary browsing
- contexts</a>, e.g. using the <code id=sandboxing:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code> attribute, the
- <code id=sandboxing:dom-open><a href=#dom-open>window.open()</a></code> method, or the <code id=sandboxing:dom-showmodaldialog><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>
- <dt>The <dfn id=sandboxed-top-level-navigation-browsing-context-flag>sandboxed top-level navigation browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxLinks>prevents content from navigating their <span>top-level
- browsing context</span></a> and <a href=#sandboxClose>prevents content from closing their
- <span>top-level browsing context</span></a>.</p>
- <p>When the <a href=#sandboxed-top-level-navigation-browsing-context-flag id=sandboxing:sandboxed-top-level-navigation-browsing-context-flag-2>sandboxed top-level navigation browsing context flag</a> is <em>not</em>
- set, content can navigate its <a href=#top-level-browsing-context id=sandboxing:top-level-browsing-context-3>top-level browsing context</a>, but other <a href=#browsing-context id=sandboxing:browsing-context-3>browsing contexts</a> are still protected by the <a href=#sandboxed-navigation-browsing-context-flag id=sandboxing:sandboxed-navigation-browsing-context-flag-2>sandboxed
- navigation browsing context flag</a> and possibly the <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=sandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-3>sandboxed auxiliary navigation
- browsing context flag</a>.</p>
- <dt>The <dfn id=sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</dfn><dd>
- <p>This flag prevents content from instantiating <a href=#plugin id=sandboxing:plugin>plugins</a>, whether
- using <a href=#sandboxPluginEmbed>the <code>embed</code> element</a>, <a href=#sandboxPluginObject>the <code>object</code> element</a>, <a href=#sandboxPluginApplet>the <code>applet</code> element</a>, or through <a href=#sandboxPluginNavigate>navigation</a> of a <a href=#nested-browsing-context id=sandboxing:nested-browsing-context>nested browsing context</a>, unless
- those <a href=#plugin id=sandboxing:plugin-2>plugins</a> can be <a href=#concept-plugin-secure id=sandboxing:concept-plugin-secure>secured</a>.</p>
- <dt>The <dfn id=sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</dfn><dd>
- <p>This flag prevents content from using the <code id=sandboxing:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>
- attribute on descendant <code id=sandboxing:the-iframe-element><a href=#the-iframe-element>iframe</a></code> elements.</p>
- <p class=note>This prevents a page inserted using the <code id=sandboxing:attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> keyword from using a
- CSS-selector-based method of probing the DOM of other pages on the same site (in particular,
- pages that contain user-sensitive information).</p>
-
- <dt>The <dfn id=sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxOrigin>forces content into a unique origin</a>, thus preventing
- it from accessing other content from the same <a href=#origin-2 id=sandboxing:origin-2>origin</a>.</p>
- <p>This flag also <a href=#sandboxCookies>prevents script from reading from or writing to the
- <code>document.cookie</code> IDL attribute</a>, and blocks access to
- <code id=sandboxing:dom-localstorage><a href=#dom-localstorage>localStorage</a></code>.</p>
- <dt>The <dfn id=sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxSubmitBlocked>blocks form submission</a>.</p>
- <dt>The <dfn id=sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag</dfn><dd>
- <p>This flag disables the Pointer Lock API. <a href=#refsPOINTERLOCK>[POINTERLOCK]</a></p>
- <dt>The <dfn id=sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</dfn><dd>
- <p>This flag <a href=#sandboxScriptBlocked>blocks script execution</a>.</p>
- <dt>The <dfn id=sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</dfn><dd>
- <p>This flag blocks features that trigger automatically, such as <a href=#attr-media-autoplay id=sandboxing:attr-media-autoplay>automatically playing a video</a> or <a href=#attr-fe-autofocus id=sandboxing:attr-fe-autofocus>automatically focusing a form control</a>.</p>
- <dt>The <dfn id=sandboxed-storage-area-urls-flag>sandboxed storage area URLs flag</dfn><dd>
- <p>This flag prevents URL schemes that use storage areas from being able to access the origin's
- data.</p>
- <dt>The <dfn id=sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context flag</dfn><dd>
- <p>This flag prevents content from using the <code id=sandboxing:dom-element-requestfullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code> method.</p>
- <dt>The <dfn id=sandboxed-document.domain-browsing-context-flag>sandboxed <code>document.domain</code> browsing context flag</dfn><dd>
- <p>This flag prevents content from using the <code id=sandboxing:dom-document-domain><a href=#dom-document-domain>document.domain</a></code> feature to change the <a href=#effective-script-origin id=sandboxing:effective-script-origin>effective script
- origin</a>.</p>
- </dl>
- <p>When the user agent is to <dfn id=parse-a-sandboxing-directive>parse a sandboxing directive</dfn>, given a string <var>input</var>, a <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set>sandboxing flag set</a> <var>output</var>, and
- optionally an <var>allow fullscreen flag</var>, it must run the following steps:</p>
- <ol><li><p><a href=#split-a-string-on-spaces id=sandboxing:split-a-string-on-spaces>Split <var>input</var> on spaces</a>,
- to obtain <var>tokens</var>.<li><p>Let <var>output</var> be empty.<li>
- <p>Add the following flags to <var>output</var>:</p>
- <ul><li><p>The <a href=#sandboxed-navigation-browsing-context-flag id=sandboxing:sandboxed-navigation-browsing-context-flag-3>sandboxed navigation browsing context flag</a>.<li><p>The <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=sandboxing:sandboxed-auxiliary-navigation-browsing-context-flag-4>sandboxed auxiliary navigation browsing context flag</a>, unless <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-popups><code>allow-popups</code></dfn> keyword.<li><p>The <a href=#sandboxed-top-level-navigation-browsing-context-flag id=sandboxing:sandboxed-top-level-navigation-browsing-context-flag-3>sandboxed top-level navigation browsing context flag</a>, unless <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-top-navigation><code>allow-top-navigation</code></dfn>
- keyword.<li><p>The <a href=#sandboxed-plugins-browsing-context-flag id=sandboxing:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a>.<li><p>The <a href=#sandboxed-seamless-iframes-flag id=sandboxing:sandboxed-seamless-iframes-flag>sandboxed seamless iframes flag</a>.<li>
- <p>The <a href=#sandboxed-origin-browsing-context-flag id=sandboxing:sandboxed-origin-browsing-context-flag>sandboxed origin browsing context flag</a>, unless the <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-same-origin><code>allow-same-origin</code></dfn>
- keyword.</p>
- <div class=note>
- <p>The <code id=sandboxing:attr-iframe-sandbox-allow-same-origin-2><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code> keyword
- is intended for two cases.</p>
- <p>First, it can be used to allow content from the same site to be sandboxed to disable
- scripting, while still allowing access to the DOM of the sandboxed content.</p>
- <p>Second, it can be used to embed content from a third-party site, sandboxed to prevent that
- site from opening pop-up windows, etc, without preventing the embedded page from
- communicating back to its originating site, using the database APIs to store data, etc.</p>
- </div>
- <li><p>The <a href=#sandboxed-forms-browsing-context-flag id=sandboxing:sandboxed-forms-browsing-context-flag>sandboxed forms browsing context flag</a>, unless <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-forms><code>allow-forms</code></dfn> keyword.<li><p>The <a href=#sandboxed-pointer-lock-browsing-context-flag id=sandboxing:sandboxed-pointer-lock-browsing-context-flag>sandboxed pointer lock browsing context flag</a>, unless <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-pointer-lock><code>allow-pointer-lock</code></dfn>
- keyword.<li><p>The <a href=#sandboxed-scripts-browsing-context-flag id=sandboxing:sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing context flag</a>, unless <var>tokens</var> contains the <dfn id=attr-iframe-sandbox-allow-scripts><code>allow-scripts</code></dfn> keyword.<li>
- <p>The <a href=#sandboxed-automatic-features-browsing-context-flag id=sandboxing:sandboxed-automatic-features-browsing-context-flag>sandboxed automatic features browsing context flag</a>, unless <var>tokens</var> contains the <code id=sandboxing:attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> keyword (defined above).</p>
- <p class=note>This flag is relaxed by the same keyword as scripts, because when scripts are
- enabled these features are trivially possible anyway, and it would be unfortunate to force
- authors to use script to do them when sandboxed rather than allowing them to use the
- declarative features.</p>
- <li><p>The <a href=#sandboxed-storage-area-urls-flag id=sandboxing:sandboxed-storage-area-urls-flag>sandboxed storage area URLs flag</a>.<li><p>The <a href=#sandboxed-fullscreen-browsing-context-flag id=sandboxing:sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context flag</a>, unless the <var>allow fullscreen flag</var> was passed to the <a href=#parse-a-sandboxing-directive id=sandboxing:parse-a-sandboxing-directive>parse a sandboxing
- directive</a> flag.<li><p>The <a href=#sandboxed-document.domain-browsing-context-flag id=sandboxing:sandboxed-document.domain-browsing-context-flag>sandboxed <code>document.domain</code> browsing
- context flag</a>.</ul>
- </ol>
- <hr>
- <p>Every <a href=#top-level-browsing-context id=sandboxing:top-level-browsing-context-4>top-level browsing context</a> has a <dfn id=popup-sandboxing-flag-set>popup sandboxing flag set</dfn>, which
- is a <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-2>sandboxing flag set</a>. When a <a href=#browsing-context id=sandboxing:browsing-context-4>browsing context</a> is created, its
- <a href=#popup-sandboxing-flag-set id=sandboxing:popup-sandboxing-flag-set>popup sandboxing flag set</a> must be empty. It is populated by <a href=#the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name id=sandboxing:the-rules-for-choosing-a-browsing-context-given-a-browsing-context-name>the rules for
- choosing a browsing context given a browsing context name</a>.</p>
- <p>Every <a href=#nested-browsing-context id=sandboxing:nested-browsing-context-2>nested browsing context</a> has an <dfn id=iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag
- set</dfn>, which is a <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-3>sandboxing flag set</a>. Which flags in a <a href=#nested-browsing-context id=sandboxing:nested-browsing-context-3>nested browsing
- context</a>'s <a href=#iframe-sandboxing-flag-set id=sandboxing:iframe-sandboxing-flag-set><code>iframe</code> sandboxing flag set</a> are set at any particular
- time is determined by the <code id=sandboxing:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> element's <code id=sandboxing:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code> attribute.</p>
- <p>Every <code id=sandboxing:document><a href=#document>Document</a></code> has an <dfn id=active-sandboxing-flag-set>active sandboxing flag set</dfn>, which is a
- <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-4>sandboxing flag set</a>. When the <code id=sandboxing:document-2><a href=#document>Document</a></code> is created, its <a href=#active-sandboxing-flag-set id=sandboxing:active-sandboxing-flag-set>active
- sandboxing flag set</a> must be empty. It is populated by the <a href=#navigate id=sandboxing:navigate>navigation
- algorithm</a>.</p>
- <p>Every resource that is obtained by the <a href=#navigate id=sandboxing:navigate-2>navigation algorithm</a> has a
- <dfn id=forced-sandboxing-flag-set>forced sandboxing flag set</dfn>, which is a <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-5>sandboxing flag set</a>. A resource by
- default has no flags set in its <a href=#forced-sandboxing-flag-set id=sandboxing:forced-sandboxing-flag-set>forced sandboxing flag set</a>, but other specifications
- can define that certain flags are set.</p>
- <p class=note>In particular, the <a href=#forced-sandboxing-flag-set id=sandboxing:forced-sandboxing-flag-set-2>forced sandboxing flag set</a> is used by the Content
- Security Policy specification. <a href=#refsCSP>[CSP]</a></p>
- <hr>
- <p>When a user agent is to <dfn id=implement-the-sandboxing>implement the sandboxing</dfn> for a <code id=sandboxing:document-3><a href=#document>Document</a></code>, it
- must populate <code id=sandboxing:document-4><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=sandboxing:active-sandboxing-flag-set-2>active sandboxing flag set</a> with the union of
- the flags that are present in the following <a href=#sandboxing-flag-set id=sandboxing:sandboxing-flag-set-6>sandboxing flag
- sets</a> at the time the <code id=sandboxing:document-5><a href=#document>Document</a></code> object is created:</p>
- <ul><li><p>If the <code id=sandboxing:document-6><a href=#document>Document</a></code>'s <a href=#browsing-context id=sandboxing:browsing-context-5>browsing context</a> is a <a href=#top-level-browsing-context id=sandboxing:top-level-browsing-context-5>top-level browsing
- context</a>, then: the flags set on the <a href=#browsing-context id=sandboxing:browsing-context-6>browsing context</a>'s <a href=#popup-sandboxing-flag-set id=sandboxing:popup-sandboxing-flag-set-2>popup sandboxing
- flag set</a>.<li><p>If the <code id=sandboxing:document-7><a href=#document>Document</a></code>'s <a href=#browsing-context id=sandboxing:browsing-context-7>browsing context</a> is a <a href=#nested-browsing-context id=sandboxing:nested-browsing-context-4>nested browsing
- context</a>, then: the flags set on the <a href=#browsing-context id=sandboxing:browsing-context-8>browsing context</a>'s
- <a href=#iframe-sandboxing-flag-set id=sandboxing:iframe-sandboxing-flag-set-2><code>iframe</code> sandboxing flag set</a>.<li><p>If the <code id=sandboxing:document-8><a href=#document>Document</a></code>'s <a href=#browsing-context id=sandboxing:browsing-context-9>browsing context</a> is a <a href=#nested-browsing-context id=sandboxing:nested-browsing-context-5>nested browsing
- context</a>, then: the flags set on the <a href=#browsing-context id=sandboxing:browsing-context-10>browsing context</a>'s <a href=#parent-browsing-context id=sandboxing:parent-browsing-context>parent browsing
- context</a>'s <a href=#active-document id=sandboxing:active-document>active document</a>'s <a href=#active-sandboxing-flag-set id=sandboxing:active-sandboxing-flag-set-3>active sandboxing flag set</a>.<li><p>The flags set on the <code id=sandboxing:document-9><a href=#document>Document</a></code>'s resource's <a href=#forced-sandboxing-flag-set id=sandboxing:forced-sandboxing-flag-set-3>forced sandboxing flag
- set</a>, if it has one.</ul>
- <h3 id=history>7.5 Session history and navigation</h3>
- <h4 id=the-session-history-of-browsing-contexts>7.5.1 The session history of browsing contexts</h4>
- <p>The sequence of <code id=the-session-history-of-browsing-contexts:document><a href=#document>Document</a></code>s in a <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context>browsing context</a> is its <dfn id=session-history>session
- history</dfn>. Each <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context-2>browsing context</a>, including <a href=#nested-browsing-context id=the-session-history-of-browsing-contexts:nested-browsing-context>nested browsing contexts</a>, has a distinct session history. A <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context-3>browsing
- context</a>'s session history consists of a flat list of <a href=#session-history-entry id=the-session-history-of-browsing-contexts:session-history-entry>session history entries</a>. Each <dfn id=session-history-entry>session history entry</dfn> consists, at a
- minimum, of a <a href=#url id=the-session-history-of-browsing-contexts:url>URL</a>, and each entry may in addition have a <a href=#state-object id=the-session-history-of-browsing-contexts:state-object>state object</a>, a
- title, a <code id=the-session-history-of-browsing-contexts:document-2><a href=#document>Document</a></code> object, form data, a scroll position, and other information
- associated with it.</p>
- <p class=note>Each entry, when first created, has a <code id=the-session-history-of-browsing-contexts:document-3><a href=#document>Document</a></code>. However, when a
- <code id=the-session-history-of-browsing-contexts:document-4><a href=#document>Document</a></code> is not <a href=#fully-active id=the-session-history-of-browsing-contexts:fully-active>active</a>, it's possible for it to be
- <a href=#discard-a-document id=the-session-history-of-browsing-contexts:discard-a-document>discarded</a> to free resources. The <a href=#url id=the-session-history-of-browsing-contexts:url-2>URL</a> and
- other data in a <a href=#session-history-entry id=the-session-history-of-browsing-contexts:session-history-entry-2>session history entry</a> is then used to bring a new
- <code id=the-session-history-of-browsing-contexts:document-5><a href=#document>Document</a></code> into being to take the place of the original, should the user agent find
- itself having to reactivate that <code id=the-session-history-of-browsing-contexts:document-6><a href=#document>Document</a></code>.</p>
- <p class=note>Titles associated with <a href=#session-history-entry id=the-session-history-of-browsing-contexts:session-history-entry-3>session history
- entries</a> need not have any relation with the current <code id=the-session-history-of-browsing-contexts:the-title-element><a href=#the-title-element>title</a></code> of the
- <code id=the-session-history-of-browsing-contexts:document-7><a href=#document>Document</a></code>. The title of a <a href=#session-history-entry id=the-session-history-of-browsing-contexts:session-history-entry-4>session history entry</a> is intended to explain
- the state of the document at that point, so that the user can navigate the document's history.</p>
- <p>URLs without associated <a href=#state-object id=the-session-history-of-browsing-contexts:state-object-2>state objects</a> are added to the
- session history as the user (or script) navigates from page to page.</p>
- <hr>
- <p>Each <code id=the-session-history-of-browsing-contexts:document-8><a href=#document>Document</a></code> object in a <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context-4>browsing context</a>'s <a href=#session-history id=the-session-history-of-browsing-contexts:session-history>session
- history</a> is associated with a unique <code id=the-session-history-of-browsing-contexts:history-3><a href=#history-3>History</a></code> object which must all model the
- same underlying <a href=#session-history id=the-session-history-of-browsing-contexts:session-history-2>session history</a>.</p>
-
- <p>The <dfn id=dom-history><code>history</code></dfn> attribute of the <code id=the-session-history-of-browsing-contexts:window><a href=#window>Window</a></code>
- interface must return the object implementing the <code id=the-session-history-of-browsing-contexts:history-3-2><a href=#history-3>History</a></code> interface for that <a href=#concept-document-window id=the-session-history-of-browsing-contexts:concept-document-window><code>Window</code> object's newest
- <code>Document</code></a>.</p>
-
- <hr>
- <p>A <dfn id=state-object>state object</dfn> is an object representing a user interface state.</p>
- <p>Pages can <a href=#dom-history-pushstate id=the-session-history-of-browsing-contexts:dom-history-pushstate>add</a> <a href=#state-object id=the-session-history-of-browsing-contexts:state-object-3>state
- objects</a> to the session history. These are then <a href=#event-popstate id=the-session-history-of-browsing-contexts:event-popstate>returned to the
- script</a> when the user (or script) goes back in the history, thus enabling authors to use the
- "navigation" metaphor even in one-page applications.</p>
- <div class=note>
- <p><a href=#state-object id=the-session-history-of-browsing-contexts:state-object-4>State objects</a> are intended to be used for two main purposes:
- first, storing a preparsed description of the state in the <a href=#url id=the-session-history-of-browsing-contexts:url-3>URL</a> so that in the simple
- case an author doesn't have to do the parsing (though one would still need the parsing for
- handling <a href=#url id=the-session-history-of-browsing-contexts:url-4>URLs</a> passed around by users, so it's only a minor
- optimization), and second, so that the author can store state that one wouldn't store in the URL
- because it only applies to the current <code id=the-session-history-of-browsing-contexts:document-9><a href=#document>Document</a></code> instance and it would have to be
- reconstructed if a new <code id=the-session-history-of-browsing-contexts:document-10><a href=#document>Document</a></code> were opened.</p>
- <p>An example of the latter would be something like keeping track of the precise coordinate from
- which a pop-up <code id=the-session-history-of-browsing-contexts:the-div-element><a href=#the-div-element>div</a></code> was made to animate, so that if the user goes back, it can be
- made to animate to the same location. Or alternatively, it could be used to keep a pointer into a
- cache of data that would be fetched from the server based on the information in the
- <a href=#url id=the-session-history-of-browsing-contexts:url-5>URL</a>, so that when going back and forward, the information doesn't have to be fetched
- again.</p>
- </div>
- <hr>
- <p>At any point, one of the entries in the session history is the <dfn id=current-entry>current entry</dfn>. This
- is the entry representing the <a href=#active-document id=the-session-history-of-browsing-contexts:active-document>active document</a> of the <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context-5>browsing context</a>.
- Which entry is the <a href=#current-entry id=the-session-history-of-browsing-contexts:current-entry>current entry</a> is changed by the algorithms defined in this
- specification, e.g. during <a href=#traverse-the-history id=the-session-history-of-browsing-contexts:traverse-the-history>session history
- traversal</a>.</p>
- <p class=note>The <a href=#current-entry id=the-session-history-of-browsing-contexts:current-entry-2>current entry</a> is usually an entry for the <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-session-history-of-browsing-contexts:the-document's-address" data-x-internal="the-document's-address">address</a> of the <code id=the-session-history-of-browsing-contexts:document-11><a href=#document>Document</a></code>. However, it can also be one of
- the entries for <a href=#state-object id=the-session-history-of-browsing-contexts:state-object-5>state objects</a> added to the history by that
- document.</p>
- <p><dfn id=an-entry-with-persisted-user-state>An entry with persisted user state</dfn> is one that also has user-agent defined state.
- This specification does not specify what kind of state can be stored.</p>
- <p class=example>For example, some user agents might want to persist the scroll position, or the
- values of form controls.</p>
- <p class=note>User agents that persist the value of form controls are encouraged to also persist
- their directionality (the value of the element's <code id=the-session-history-of-browsing-contexts:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute).
- This prevents values from being displayed incorrectly after a history traversal when the user had
- originally entered the values with an explicit, non-default directionality.</p>
- <p>Entries that consist of <a href=#state-object id=the-session-history-of-browsing-contexts:state-object-6>state objects</a> share the same
- <code id=the-session-history-of-browsing-contexts:document-12><a href=#document>Document</a></code> as the entry for the page that was active when they were added.</p>
- <p>Contiguous entries that differ just by fragment identifier also share the same
- <code id=the-session-history-of-browsing-contexts:document-13><a href=#document>Document</a></code>.</p>
- <p class=note>All entries that share the same <code id=the-session-history-of-browsing-contexts:document-14><a href=#document>Document</a></code> (and that are therefore
- merely different states of one particular document) are contiguous by definition.</p>
- <p>Each <code id=the-session-history-of-browsing-contexts:document-15><a href=#document>Document</a></code> in a <a href=#browsing-context id=the-session-history-of-browsing-contexts:browsing-context-6>browsing context</a> can also have a <dfn id=latest-entry>latest
- entry</dfn>. This is the entry or that <code id=the-session-history-of-browsing-contexts:document-16><a href=#document>Document</a></code> that was most the recently traversed
- to. When a <code id=the-session-history-of-browsing-contexts:document-17><a href=#document>Document</a></code> is created, it initially has no <a href=#latest-entry id=the-session-history-of-browsing-contexts:latest-entry>latest entry</a>.</p>
-
- <p>User agents may <a href=#discard-a-document id=the-session-history-of-browsing-contexts:discard-a-document-2>discard</a> the <code id=the-session-history-of-browsing-contexts:document-18><a href=#document>Document</a></code>
- objects of entries other than the <a href=#current-entry id=the-session-history-of-browsing-contexts:current-entry-3>current entry</a> that are not referenced from any
- script, reloading the pages afresh when the user or script navigates back to such pages. This
- specification does not specify when user agents should discard <code id=the-session-history-of-browsing-contexts:document-19><a href=#document>Document</a></code> objects and
- when they should cache them.</p>
- <p>Entries that have had their <code id=the-session-history-of-browsing-contexts:document-20><a href=#document>Document</a></code> objects discarded must, for the purposes of
- the algorithms given below, act as if they had not. When the user or script navigates back or
- forwards to a page which has no in-memory DOM objects, any other entries that shared the same
- <code id=the-session-history-of-browsing-contexts:document-21><a href=#document>Document</a></code> object with it must share the new object as well.</p>
-
- <h4 id=the-history-interface>7.5.2 The <code id=the-history-interface:history-3><a href=#history-3>History</a></code> interface</h4>
- <pre class=idl>interface <dfn id=history-3>History</dfn> {
- readonly attribute long <a href=#dom-history-length id=the-history-interface:dom-history-length>length</a>;
- readonly attribute any <a href=#dom-history-state id=the-history-interface:dom-history-state>state</a>;
- void <a href=#dom-history-go id=the-history-interface:dom-history-go>go</a>(optional long delta);
- void <a href=#dom-history-back id=the-history-interface:dom-history-back>back</a>();
- void <a href=#dom-history-forward id=the-history-interface:dom-history-forward>forward</a>();
- void <a href=#dom-history-pushstate id=the-history-interface:dom-history-pushstate>pushState</a>(any data, DOMString title, optional DOMString? url = null);
- void <a href=#dom-history-replacestate id=the-history-interface:dom-history-replacestate>replaceState</a>(any data, DOMString title, optional DOMString? url = null);
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=the-history-interface:dom-history><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-length-2><a href=#dom-history-length>length</a></code><dd>
- <p>Returns the number of entries in the <a href=#joint-session-history id=the-history-interface:joint-session-history>joint session history</a>.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-2><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-state-2><a href=#dom-history-state>state</a></code><dd>
- <p>Returns the current <a href=#state-object id=the-history-interface:state-object>state object</a>.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-3><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-go-2><a href=#dom-history-go>go</a></code>( [ <var>delta</var> ] )<dd>
- <p>Goes back or forward the specified number of steps in the <a href=#joint-session-history id=the-history-interface:joint-session-history-2>joint session history</a>.</p>
- <p>A zero delta will reload the current page.</p>
- <p>If the delta is out of range, does nothing.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-4><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-back-2><a href=#dom-history-back>back</a></code>()<dd>
- <p>Goes back one step in the <a href=#joint-session-history id=the-history-interface:joint-session-history-3>joint session history</a>.</p>
- <p>If there is no previous page, does nothing.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-5><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-forward-2><a href=#dom-history-forward>forward</a></code>()<dd>
- <p>Goes forward one step in the <a href=#joint-session-history id=the-history-interface:joint-session-history-4>joint session history</a>.</p>
- <p>If there is no next page, does nothing.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-6><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-pushstate-2><a href=#dom-history-pushstate>pushState</a></code>(<var>data</var>, <var>title</var> [, <var>url</var> ] )<dd>
- <p>Pushes the given data onto the session history, with the given title, and, if provided and
- not null, the given URL.</p>
- <dt><var>window</var> . <code id=the-history-interface:dom-history-7><a href=#dom-history>history</a></code> . <code id=the-history-interface:dom-history-replacestate-2><a href=#dom-history-replacestate>replaceState</a></code>(<var>data</var>, <var>title</var> [, <var>url</var> ] )<dd>
- <p>Updates the current entry in the session history to have the given data, title, and, if
- provided and not null, URL.</p>
- </dl>
- <p>The <dfn id=joint-session-history>joint session history</dfn> of a <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context>top-level browsing context</a> is the union
- of all the <a href=#session-history id=the-history-interface:session-history>session histories</a> of all <a href=#browsing-context id=the-history-interface:browsing-context>browsing contexts</a> of all the <a href=#fully-active id=the-history-interface:fully-active>fully active</a> <code id=the-history-interface:document><a href=#document>Document</a></code>
- objects that share that <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-2>top-level browsing context</a>, with all the entries that are
- <a href=#current-entry id=the-history-interface:current-entry>current entries</a> in their respective <a href=#session-history id=the-history-interface:session-history-2>session histories</a> removed except for the <a href=#current-entry-of-the-joint-session-history id=the-history-interface:current-entry-of-the-joint-session-history>current entry of the joint session
- history</a>.</p>
- <p>The <dfn id=current-entry-of-the-joint-session-history>current entry of the joint session history</dfn> is the entry that most recently
- became a <a href=#current-entry id=the-history-interface:current-entry-2>current entry</a> in its <a href=#session-history id=the-history-interface:session-history-3>session history</a>.</p>
- <p>Entries in the <a href=#joint-session-history id=the-history-interface:joint-session-history-5>joint session history</a> are ordered chronologically by the time they
- were added to their respective <a href=#session-history id=the-history-interface:session-history-4>session histories</a>. Each entry
- has an index; the earliest entry has index 0, and the subsequent entries are numbered with
- consecutively increasing integers (1, 2, 3, etc).</p>
- <p class=note>Since each <code id=the-history-interface:document-2><a href=#document>Document</a></code> in a <a href=#browsing-context id=the-history-interface:browsing-context-2>browsing context</a> might have a
- different <a href=#event-loop id=the-history-interface:event-loop>event loop</a>, the actual state of the <a href=#joint-session-history id=the-history-interface:joint-session-history-6>joint session history</a> can
- be somewhat nebulous. For example, two sibling <code id=the-history-interface:the-iframe-element><a href=#the-iframe-element>iframe</a></code> elements could both <a href=#traverse-the-history id=the-history-interface:traverse-the-history>traverse</a> from one unique origin to another at the same time,
- so their precise order might not be well-defined; similarly, since they might only find out about
- each other later, they might disagree about the length of the <a href=#joint-session-history id=the-history-interface:joint-session-history-7>joint session
- history</a>.</p>
-
- <p>All the getters and setters for attributes, and all the methods, defined on the
- <code id=the-history-interface:history-3-2><a href=#history-3>History</a></code> interface, when invoked on a <code id=the-history-interface:history-3-3><a href=#history-3>History</a></code> object associated with a
- <code id=the-history-interface:document-3><a href=#document>Document</a></code> that is not <a href=#fully-active id=the-history-interface:fully-active-2>fully active</a>, must throw a
- <code id=the-history-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception instead of operating as described below.</p>
- <p>The <dfn id=dom-history-length><code>length</code></dfn> attribute of the
- <code id=the-history-interface:history-3-4><a href=#history-3>History</a></code> interface must return the number of entries in the <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-3>top-level browsing
- context</a>'s <a href=#joint-session-history id=the-history-interface:joint-session-history-8>joint session history</a>.</p>
- <p>The actual entries are not accessible from script.</p>
- <p>The <dfn id=dom-history-state><code>state</code></dfn> attribute of the
- <code id=the-history-interface:history-3-5><a href=#history-3>History</a></code> interface must return the last value it was set to by the user agent.
- Initially, its value must be null.</p>
- <p>When the <dfn id=dom-history-go><code>go(<var>delta</var>)</code></dfn> method is
- invoked, if the argument to the method was omitted or has the value zero, the user agent must act
- as if the <code id=the-history-interface:dom-location-reload><a href=#dom-location-reload>location.reload()</a></code> method was called instead.
- Otherwise, the user agent must <a href=#traverse-the-history-by-a-delta id=the-history-interface:traverse-the-history-by-a-delta>traverse the history by a delta</a> whose value is the
- value of the method's argument.</p>
- <p>When the <dfn id=dom-history-back><code>back()</code></dfn> method is invoked, the user
- agent must <a href=#traverse-the-history-by-a-delta id=the-history-interface:traverse-the-history-by-a-delta-2>traverse the history by a delta</a> −1.</p>
- <p>When the <dfn id=dom-history-forward><code>forward()</code></dfn>method is invoked, the
- user agent must <a href=#traverse-the-history-by-a-delta id=the-history-interface:traverse-the-history-by-a-delta-3>traverse the history by a delta</a> +1.</p>
- <hr>
- <p>Each <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-4>top-level browsing context</a> has a <dfn id=session-history-traversal-queue>session history traversal queue</dfn>,
- initially empty, to which <a href=#concept-task id=the-history-interface:concept-task>tasks</a> can be added.</p>
- <p>Each <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-5>top-level browsing context</a>, when created, must asynchronously begin running
- the following algorithm, known as the <dfn id=session-history-event-loop>session history event loop</dfn> for that
- <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-6>top-level browsing context</a>:</p>
- <ol><li><p>Wait until this <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-7>top-level browsing context</a>'s <a href=#session-history-traversal-queue id=the-history-interface:session-history-traversal-queue>session history traversal
- queue</a> is not empty.<li><p>Pull the first <a href=#concept-task id=the-history-interface:concept-task-2>task</a> from this <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-8>top-level browsing
- context</a>'s <a href=#session-history-traversal-queue id=the-history-interface:session-history-traversal-queue-2>session history traversal queue</a>, and execute it.<li><p>Return to the first step of this algorithm.</p>
- </ol>
- <p>The <a href=#session-history-event-loop id=the-history-interface:session-history-event-loop>session history event loop</a> helps coordinate cross-browsing-context transitions
- of the <a href=#joint-session-history id=the-history-interface:joint-session-history-9>joint session history</a>: since each <a href=#browsing-context id=the-history-interface:browsing-context-3>browsing context</a> might, at any
- particular time, have a different <a href=#event-loop id=the-history-interface:event-loop-2>event loop</a> (this can happen if the user agent has
- more than one <a href=#event-loop id=the-history-interface:event-loop-3>event loop</a> per <a href=#unit-of-related-browsing-contexts id=the-history-interface:unit-of-related-browsing-contexts>unit of related browsing contexts</a>),
- transitions would otherwise have to involve cross-event-loop synchronisation.</p>
- <hr>
- <p>To <dfn id=traverse-the-history-by-a-delta>traverse the history by a delta</dfn> <var>delta</var>, the user agent must
- append a <a href=#concept-task id=the-history-interface:concept-task-3>task</a> to this <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-9>top-level browsing context</a>'s
- <a href=#session-history-traversal-queue id=the-history-interface:session-history-traversal-queue-3>session history traversal queue</a>, the <a href=#concept-task id=the-history-interface:concept-task-4>task</a>
- consisting of running the following steps:</p>
- <ol><li><p>Let <var>delta</var> be the argument to the method.<li><p>If the index of the <a href=#current-entry-of-the-joint-session-history id=the-history-interface:current-entry-of-the-joint-session-history-2>current entry of the joint session history</a> plus <var>delta</var> is less than zero or greater than or equal to the number of items in the
- <a href=#joint-session-history id=the-history-interface:joint-session-history-10>joint session history</a>, then abort these steps.</p>
- <li><p>Let <var>specified entry</var> be the entry in the <a href=#joint-session-history id=the-history-interface:joint-session-history-11>joint session
- history</a> whose index is the sum of <var>delta</var> and the index of the
- <a href=#current-entry-of-the-joint-session-history id=the-history-interface:current-entry-of-the-joint-session-history-3>current entry of the joint session history</a>.<li><p>Let <var>specified browsing context</var> be the <a href=#browsing-context id=the-history-interface:browsing-context-4>browsing context</a> of
- the <var>specified entry</var>.<li><p>If the <var>specified browsing context</var>'s <a href=#active-document id=the-history-interface:active-document>active document</a>'s
- <a href=#unload-a-document id=the-history-interface:unload-a-document>unload a document</a> algorithm is currently running, abort these steps.<li>
- <p><a href=#queue-a-task id=the-history-interface:queue-a-task>Queue a task</a> that consists of running the following substeps. The relevant
- <a href=#event-loop id=the-history-interface:event-loop-4>event loop</a> is that of the <var>specified browsing context</var>'s
- <a href=#active-document id=the-history-interface:active-document-2>active document</a>. The <a href=#task-source id=the-history-interface:task-source>task source</a> for the queued task is the
- <a href=#history-traversal-task-source id=the-history-interface:history-traversal-task-source>history traversal task source</a>.</p>
- <ol><li><p>If there is an ongoing attempt to navigate <var>specified browsing context</var>
- that has not yet <a href=#concept-navigate-mature id=the-history-interface:concept-navigate-mature>matured</a> (i.e. it has not passed the
- point of making its <code id=the-history-interface:document-4><a href=#document>Document</a></code> the <a href=#active-document id=the-history-interface:active-document-3>active document</a>), then cancel that
- attempt to navigate the <a href=#browsing-context id=the-history-interface:browsing-context-5>browsing context</a>.<li>
- <p>If the <var>specified browsing context</var>'s <a href=#active-document id=the-history-interface:active-document-4>active document</a> is not
- the same <code id=the-history-interface:document-5><a href=#document>Document</a></code> as the <code id=the-history-interface:document-6><a href=#document>Document</a></code> of the <var>specified
- entry</var>, then run these substeps:</p>
- <ol><li><p><a href=#fully-exit-fullscreen id=the-history-interface:fully-exit-fullscreen>Fully exit fullscreen</a>.<li><p><a href=#prompt-to-unload-a-document id=the-history-interface:prompt-to-unload-a-document>Prompt to unload</a> the <a href=#active-document id=the-history-interface:active-document-5>active
- document</a> of the <var>specified browsing context</var>. If the user
- <a href=#refused-to-allow-the-document-to-be-unloaded id=the-history-interface:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then abort these steps.<li><p><a href=#unload-a-document id=the-history-interface:unload-a-document-2>Unload</a> the <a href=#active-document id=the-history-interface:active-document-6>active document</a> of the
- <var>specified browsing context</var> with the <var>recycle</var> parameter
- set to false.</ol>
- <li><p><a href=#traverse-the-history id=the-history-interface:traverse-the-history-2>Traverse the history</a> of the <var>specified browsing context</var> to
- the <var>specified entry</var>.</p>
- </ol>
- </ol>
- <p>When the user navigates through a <a href=#browsing-context id=the-history-interface:browsing-context-6>browsing context</a>, e.g. using a browser's back
- and forward buttons, the user agent must <a href=#traverse-the-history-by-a-delta id=the-history-interface:traverse-the-history-by-a-delta-4>traverse the history by a delta</a> equivalent
- to the action specified by the user.</p>
- <hr>
- <p>The <dfn id=dom-history-pushstate><code>pushState(<var>data</var>, <var>title</var>, <var>url</var>)</code></dfn> method adds a state object entry to
- the history.</p>
- <p>The <dfn id=dom-history-replacestate><code>replaceState(<var>data</var>, <var>title</var>, <var>url</var>)</code></dfn> method updates the state object,
- title, and optionally the <a href=#url id=the-history-interface:url>URL</a> of the <a href=#current-entry id=the-history-interface:current-entry-3>current entry</a> in the history.</p>
- <p>When either of these methods is invoked, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>cloned data</var> be a <a href=#structured-clone id=the-history-interface:structured-clone>structured clone</a> of the specified
- <var>data</var>. If this throws an exception, then rethrow that exception and abort
- these steps.<li>
- <p>If the third argument is not null, run these substeps:</p>
- <ol><li><a href=#resolve-a-url id=the-history-interface:resolve-a-url>Resolve</a> the value of the third argument, relative to
- the <a href=#api-base-url id=the-history-interface:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=the-history-interface:entry-settings-object>entry settings object</a>.<li>If that fails, throw a <code id=the-history-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li>Compare the resulting <a href=#parsed-url id=the-history-interface:parsed-url>parsed URL</a> to the result of applying the <a href=#url-parser id=the-history-interface:url-parser>URL
- parser</a> algorithm to <a id="the-history-interface:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>. If any component of these two
- <a href=#url id=the-history-interface:url-2>URLs</a> differ other than the <a href=#concept-url-path id=the-history-interface:concept-url-path>path</a>, <a href=#concept-url-query id=the-history-interface:concept-url-query>query</a>, and <a href=#concept-url-fragment id=the-history-interface:concept-url-fragment>fragment</a> components, then throw a
- <code id=the-history-interface:securityerror-3><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li>If the <a href=#origin-2 id=the-history-interface:origin-2>origin</a> of the resulting <a href=#absolute-url id=the-history-interface:absolute-url>absolute URL</a> is not the same as
- the <a href=#origin-2 id=the-history-interface:origin-2-2>origin</a> of the <a href=#responsible-document id=the-history-interface:responsible-document>responsible document</a> specified by the <a href=#entry-settings-object id=the-history-interface:entry-settings-object-2>entry
- settings object</a>, and either the <a href=#concept-url-path id=the-history-interface:concept-url-path-2>path</a> or <a href=#concept-url-query id=the-history-interface:concept-url-query-2>query</a> components of the two <a href=#parsed-url id=the-history-interface:parsed-url-2>parsed
- URLs</a> compared in the previous step differ, throw a <code id=the-history-interface:securityerror-4><a href=#securityerror>SecurityError</a></code> exception
- and abort these steps. (This prevents sandboxed content from spoofing other pages on the same
- origin.)<li><p>Let <var>new URL</var> be the resulting <a href=#absolute-url id=the-history-interface:absolute-url-2>absolute URL</a>.</ol>
- <p>For the purposes of the comparisons in the above substeps, the <a href=#concept-url-path id=the-history-interface:concept-url-path-3>path</a> and <a href=#concept-url-query id=the-history-interface:concept-url-query-3>query</a> components
- can only be the same if the <a href=#concept-url-scheme id=the-history-interface:concept-url-scheme>scheme</a> component of both
- <a href=#parsed-url id=the-history-interface:parsed-url-3>parsed URLs</a> are <a href=#concept-url-scheme-relative id=the-history-interface:concept-url-scheme-relative>relative schemes</a>.</p>
- <li>
- <p>If the third argument is null, then let <var>new URL</var> be the <a href=#url id=the-history-interface:url-3>URL</a>
- of the <a href=#current-entry id=the-history-interface:current-entry-4>current entry</a>.</p>
- <li>
- <p>If the method invoked was the <code id=the-history-interface:dom-history-pushstate-3><a href=#dom-history-pushstate>pushState()</a></code>
- method:</p>
- <ol><li>
- <p>Remove all the entries in the <a href=#browsing-context id=the-history-interface:browsing-context-7>browsing context</a>'s <a href=#session-history id=the-history-interface:session-history-5>session history</a>
- after the <a href=#current-entry id=the-history-interface:current-entry-5>current entry</a>. If the <a href=#current-entry id=the-history-interface:current-entry-6>current entry</a> is the last entry in
- the session history, then no entries are removed.</p>
- <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
- agent's user interface.</p>
- <li><p>Remove any <a href=#concept-task id=the-history-interface:concept-task-5>tasks</a> queued by the <a href=#history-traversal-task-source id=the-history-interface:history-traversal-task-source-2>history traversal
- task source</a> that are associated with any <code id=the-history-interface:document-7><a href=#document>Document</a></code> objects in the
- <a href=#top-level-browsing-context id=the-history-interface:top-level-browsing-context-10>top-level browsing context</a>'s <a href=#document-family id=the-history-interface:document-family>document family</a>.<li><p>If appropriate, update the <a href=#current-entry id=the-history-interface:current-entry-7>current entry</a> to reflect any state that the user
- agent wishes to persist. The entry is then said to be <a href=#an-entry-with-persisted-user-state id=the-history-interface:an-entry-with-persisted-user-state>an entry with persisted user
- state</a>.<li><p>Add a <a href=#state-object id=the-history-interface:state-object-2>state object</a> entry to the session history, after the <a href=#current-entry id=the-history-interface:current-entry-8>current
- entry</a>, with <var>cloned data</var> as the <a href=#state-object id=the-history-interface:state-object-3>state object</a>, the given
- <var>title</var> as the title, and <var>new URL</var> as the <a href=#url id=the-history-interface:url-4>URL</a>
- of the entry.<li><p>Update the <a href=#current-entry id=the-history-interface:current-entry-9>current entry</a> to be this newly added entry.</ol>
- <p>Otherwise, if the method invoked was the <code id=the-history-interface:dom-history-replacestate-3><a href=#dom-history-replacestate>replaceState()</a></code> method:</p>
- <ol><li><p>Update the <a href=#current-entry id=the-history-interface:current-entry-10>current entry</a> in the session history so that <var>cloned data</var> is the entry's new state object, the given <var>title</var>
- is the new title, and <var>new URL</var> is the entry's new <a href=#url id=the-history-interface:url-5>URL</a>.</ol>
- <li><p>If the <a href=#current-entry id=the-history-interface:current-entry-11>current entry</a> in the session history represents a non-GET request
- (e.g. it was the result of a POST submission) then update it to instead represent a GET request
- (<a href=#concept-http-equivalent-get id=the-history-interface:concept-http-equivalent-get>or equivalent</a>).<li>
- <p>Set <a id="the-history-interface:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> to <var>new URL</var>.</p>
- <p class=note>Since this is neither a <a href=#navigate id=the-history-interface:navigate>navigation</a> of the
- <a href=#browsing-context id=the-history-interface:browsing-context-8>browsing context</a> nor a <a href=#traverse-the-history id=the-history-interface:traverse-the-history-3>history traversal</a>,
- it does not cause a <code id=the-history-interface:event-hashchange><a href=#event-hashchange>hashchange</a></code> event to be fired.</p>
- <li>
- <p>Set <code id=the-history-interface:dom-history-state-3><a href=#dom-history-state>history.state</a></code> to a <a href=#structured-clone id=the-history-interface:structured-clone-2>structured clone</a>
- of <var>cloned data</var>.</p>
- <li>
- <p>Let the <a href=#latest-entry id=the-history-interface:latest-entry>latest entry</a> of the <code id=the-history-interface:document-8><a href=#document>Document</a></code> of the <a href=#current-entry id=the-history-interface:current-entry-12>current
- entry</a> be the <a href=#current-entry id=the-history-interface:current-entry-13>current entry</a>.</p>
- </ol>
- <p class=note>The <var>title</var> is purely advisory. User agents might use the title
- in the user interface.</p>
- <p>User agents may limit the number of state objects added to the session history per page. If a
- page hits the UA-defined limit, user agents must remove the entry immediately after the first
- entry for that <code id=the-history-interface:document-9><a href=#document>Document</a></code> object in the session history after having added the new
- entry. (Thus the state history acts as a FIFO buffer for eviction, but as a LIFO buffer for
- navigation.)</p>
-
- <div class=example>
- <p>Consider a game where the user can navigate along a line, such that the user is always at some
- coordinate, and such that the user can bookmark the page corresponding to a particular
- coordinate, to return to it later.</p>
- <p>A static page implementing the x=5 position in such a game could look like the following:</p>
- <pre><!DOCTYPE HTML>
- <!-- this is http://example.com/line?x=5 -->
- <title>Line Game - 5</title>
- <p>You are at coordinate 5 on the line.</p>
- <p>
- <a href="?x=6">Advance to 6</a> or
- <a href="?x=4">retreat to 4</a>?
- </p></pre>
- <p>The problem with such a system is that each time the user clicks, the whole page has to be
- reloaded. Here instead is another way of doing it, using script:</p>
- <pre><!DOCTYPE HTML>
- <!-- this starts off as http://example.com/line?x=5 -->
- <title>Line Game - 5</title>
- <p>You are at coordinate <span id="coord">5</span> on the line.</p>
- <p>
- <a href="?x=6" onclick="go(1); return false;">Advance to 6</a> or
- <a href="?x=4" onclick="go(-1); return false;">retreat to 4</a>?
- </p>
- <script>
- var currentPage = 5; // prefilled by server
- function go(d) {
- setupPage(currentPage + d);
- history.pushState(currentPage, document.title, '?x=' + currentPage);
- }
- onpopstate = function(event) {
- setupPage(event.state);
- }
- function setupPage(page) {
- currentPage = page;
- document.title = 'Line Game - ' + currentPage;
- document.getElementById('coord').textContent = currentPage;
- document.links[0].href = '?x=' + (currentPage+1);
- document.links[0].textContent = 'Advance to ' + (currentPage+1);
- document.links[1].href = '?x=' + (currentPage-1);
- document.links[1].textContent = 'retreat to ' + (currentPage-1);
- }
- </script></pre>
- <p>In systems without script, this still works like the previous example. However, users that
- <em>do</em> have script support can now navigate much faster, since there is no network access
- for the same experience. Furthermore, contrary to the experience the user would have with just a
- naïve script-based approach, bookmarking and navigating the session history still work.</p>
- <p>In the example above, the <var>data</var> argument to the <code id=the-history-interface:dom-history-pushstate-4><a href=#dom-history-pushstate>pushState()</a></code> method is the same information as would be sent
- to the server, but in a more convenient form, so that the script doesn't have to parse the URL
- each time the user navigates.</p>
- </div>
- <div class=example>
- <p>Applications might not use the same title for a <a href=#session-history-entry id=the-history-interface:session-history-entry>session history entry</a> as the
- value of the document's <code id=the-history-interface:the-title-element><a href=#the-title-element>title</a></code> element at that time. For example, here is a simple
- page that shows a block in the <code id=the-history-interface:the-title-element-2><a href=#the-title-element>title</a></code> element. Clearly, when navigating backwards to
- a previous state the user does not go back in time, and therefore it would be inappropriate to
- put the time in the session history title.</p>
- <pre><!DOCTYPE HTML>
- <TITLE>Line</TITLE>
- <SCRIPT>
- setInterval(function () { document.title = 'Line - ' + new Date(); }, 1000);
- var i = 1;
- function inc() {
- set(i+1);
- history.pushState(i, 'Line - ' + i);
- }
- function set(newI) {
- i = newI;
- document.forms.F.I.value = newI;
- }
- </SCRIPT>
- <BODY ONPOPSTATE="set(event.state)">
- <FORM NAME=F>
- State: <OUTPUT NAME=I>1</OUTPUT> <INPUT VALUE="Increment" TYPE=BUTTON ONCLICK="inc()">
- </FORM></pre>
- </div>
- <h4 id=the-location-interface>7.5.3 The <code id=the-location-interface:location><a href=#location>Location</a></code> interface</h4>
- <p>Each <code id=the-location-interface:document><a href=#document>Document</a></code> object in a <a href=#browsing-context id=the-location-interface:browsing-context>browsing context</a>'s session history is
- associated with a unique instance of a <code id=the-location-interface:location-2><a href=#location>Location</a></code> object.</p>
- <dl class=domintro><dt><var>document</var> . <code id=the-location-interface:dom-document-location><a href=#dom-document-location>location</a></code> [ = <var>value</var> ]<dt><var>window</var> . <code id=the-location-interface:dom-location><a href=#dom-location>location</a></code> [ = <var>value</var> ]<dd>
- <p>Returns a <code id=the-location-interface:location-3><a href=#location>Location</a></code> object with the current page's location.</p>
- <p>Can be set, to navigate to another page.</p>
- </dl>
-
- <p>The <dfn id=dom-document-location><code>location</code></dfn> attribute of the
- <code id=the-location-interface:document-2><a href=#document>Document</a></code> interface must return the <code id=the-location-interface:location-4><a href=#location>Location</a></code> object for that
- <code id=the-location-interface:document-3><a href=#document>Document</a></code> object, if it is in a <a href=#browsing-context id=the-location-interface:browsing-context-2>browsing context</a>, and null otherwise.</p>
- <p>The <dfn id=dom-location><code>location</code></dfn> attribute of the <code id=the-location-interface:window><a href=#window>Window</a></code>
- interface must return the <code id=the-location-interface:location-5><a href=#location>Location</a></code> object for that <code id=the-location-interface:window-2><a href=#window>Window</a></code> object's
- <code id=the-location-interface:document-4><a href=#document>Document</a></code>.</p>
-
- <p><code id=the-location-interface:location-6><a href=#location>Location</a></code> objects provide a representation of <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address" data-x-internal="the-document's-address">the address</a> of the <a href=#active-document id=the-location-interface:active-document>active document</a> of their <code id=the-location-interface:document-5><a href=#document>Document</a></code>'s
- <a href=#browsing-context id=the-location-interface:browsing-context-3>browsing context</a>, and allow the <a href=#current-entry id=the-location-interface:current-entry>current entry</a> of the <a href=#browsing-context id=the-location-interface:browsing-context-4>browsing
- context</a>'s session history to be changed, by adding or replacing entries in the <code id=the-location-interface:dom-history><a href=#dom-history>history</a></code> object.</p>
- <pre class=idl>[Unforgeable] interface <dfn id=location>Location</dfn> {
- void <a href=#dom-location-assign id=the-location-interface:dom-location-assign>assign</a>(DOMString url);
- void <a href=#dom-location-replace id=the-location-interface:dom-location-replace>replace</a>(DOMString url);
- void <a href=#dom-location-reload id=the-location-interface:dom-location-reload>reload</a>();
- };
- <a href=#location id=the-location-interface:location-7>Location</a> implements <a href=#urlutils id=the-location-interface:urlutils>URLUtils</a>;</pre>
- <dl class=domintro><dt><var>location</var> . <code id=the-location-interface:dom-location-assign-2><a href=#dom-location-assign>assign</a></code>(<var>url</var>)<dd>
- <p>Navigates to the given page.</p>
- <dt><var>location</var> . <code id=the-location-interface:dom-location-replace-2><a href=#dom-location-replace>replace</a></code>(<var>url</var>)<dd>
- <p>Removes the current page from the session history and navigates to the given page.</p>
- <dt><var>location</var> . <code id=the-location-interface:dom-location-reload-2><a href=#dom-location-reload>reload</a></code>()<dd>
- <p>Reloads the current page.</p>
- </dl>
-
- <p>The <i>relevant <code id=the-location-interface:document-6><a href=#document>Document</a></code></i> is the <code id=the-location-interface:location-8><a href=#location>Location</a></code> object's associated
- <code id=the-location-interface:document-7><a href=#document>Document</a></code> object's <a href=#browsing-context id=the-location-interface:browsing-context-5>browsing context</a>'s <a href=#active-document id=the-location-interface:active-document-2>active document</a>.</p>
- <p>When the <dfn id=dom-location-assign><code>assign(<var>url</var>)</code></dfn>
- method is invoked, the UA must <a href=#resolve-a-url id=the-location-interface:resolve-a-url>resolve</a> the argument, relative
- to the <a href=#api-base-url id=the-location-interface:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=the-location-interface:entry-settings-object>entry settings object</a>, and if that
- is successful, must <a href=#navigate id=the-location-interface:navigate>navigate</a> the <a href=#browsing-context id=the-location-interface:browsing-context-6>browsing
- context</a> to the specified <var>url</var>, with <a href=#exceptions-enabled id=the-location-interface:exceptions-enabled>exceptions enabled</a>. If
- the <a href=#browsing-context id=the-location-interface:browsing-context-7>browsing context</a>'s <a href=#session-history id=the-location-interface:session-history>session history</a> contains only one
- <code id=the-location-interface:document-8><a href=#document>Document</a></code>, and that was the <code id=the-location-interface:about:blank><a href=#about:blank>about:blank</a></code> <code id=the-location-interface:document-9><a href=#document>Document</a></code> created
- when the <a href=#browsing-context id=the-location-interface:browsing-context-8>browsing context</a> was created, then the navigation must be done with
- <a href=#replacement-enabled id=the-location-interface:replacement-enabled>replacement enabled</a>.</p>
- <p>When the <dfn id=dom-location-replace><code>replace(<var>url</var>)</code></dfn> method is invoked, the UA must <a href=#resolve-a-url id=the-location-interface:resolve-a-url-2>resolve</a> the argument, relative to the <a href=#api-base-url id=the-location-interface:api-base-url-2>API base URL</a> specified by the
- <a href=#entry-settings-object id=the-location-interface:entry-settings-object-2>entry settings object</a>, and if that is successful, <a href=#navigate id=the-location-interface:navigate-2>navigate</a> the <a href=#browsing-context id=the-location-interface:browsing-context-9>browsing context</a> to the specified <var>url</var> with <a href=#replacement-enabled id=the-location-interface:replacement-enabled-2>replacement enabled</a> and <a href=#exceptions-enabled id=the-location-interface:exceptions-enabled-2>exceptions enabled</a>.</p>
- <p>Navigation for the <code id=the-location-interface:dom-location-assign-3><a href=#dom-location-assign>assign()</a></code> and <code id=the-location-interface:dom-location-replace-3><a href=#dom-location-replace>replace()</a></code> methods must be done with the <a href=#responsible-browsing-context id=the-location-interface:responsible-browsing-context>responsible
- browsing context</a> specified by the <a href=#incumbent-settings-object id=the-location-interface:incumbent-settings-object>incumbent settings object</a> as the
- <a href=#source-browsing-context id=the-location-interface:source-browsing-context>source browsing context</a>.</p>
- <p>If the <a href=#resolve-a-url id=the-location-interface:resolve-a-url-3>resolving</a> step of the <code id=the-location-interface:dom-location-assign-4><a href=#dom-location-assign>assign()</a></code> and <code id=the-location-interface:dom-location-replace-4><a href=#dom-location-replace>replace()</a></code> methods is not successful, then the user agent must
- instead throw a <code id=the-location-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception.</p>
- <p>When the <dfn id=dom-location-reload><code>reload()</code></dfn> method is invoked, the
- user agent must run the appropriate steps from the following list:</p>
- <dl class=switch><dt>If the currently executing <a href=#concept-task id=the-location-interface:concept-task>task</a> is the dispatch of a <code id=the-location-interface:event-resize><a href=#event-resize>resize</a></code> event in response to the user resizing the <a href=#browsing-context id=the-location-interface:browsing-context-10>browsing
- context</a><dd><p>Repaint the <a href=#browsing-context id=the-location-interface:browsing-context-11>browsing context</a> and abort these steps.<dt>If the <a href=#browsing-context id=the-location-interface:browsing-context-12>browsing context</a>'s <a href=#active-document id=the-location-interface:active-document-3>active document</a> is <a href=#an-iframe-srcdoc-document id=the-location-interface:an-iframe-srcdoc-document>an
- <code>iframe</code> <code>srcdoc</code> document</a><dd><p><a href=#process-the-iframe-attributes id=the-location-interface:process-the-iframe-attributes>Reprocess the <code>iframe</code>
- attributes</a> of the <a href=#browsing-context id=the-location-interface:browsing-context-13>browsing context</a>'s <a href=#browsing-context-container id=the-location-interface:browsing-context-container>browsing context
- container</a>.<dt>If the <a href=#browsing-context id=the-location-interface:browsing-context-14>browsing context</a>'s <a href=#active-document id=the-location-interface:active-document-4>active document</a> has its <a href=#reload-override-flag id=the-location-interface:reload-override-flag>reload
- override flag</a> set<dd><p>Perform <a href=#an-overridden-reload id=the-location-interface:an-overridden-reload>an overridden reload</a>, with the <a href=#browsing-context id=the-location-interface:browsing-context-15>browsing context</a> being
- navigated as the <a href=#responsible-browsing-context id=the-location-interface:responsible-browsing-context-2>responsible browsing context</a>.<dt>Otherwise<dd><p><a href=#navigate id=the-location-interface:navigate-3>Navigate</a> the <a href=#browsing-context id=the-location-interface:browsing-context-16>browsing context</a> to
- <a id="the-location-interface:the-document's-address-2" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> with <a href=#replacement-enabled id=the-location-interface:replacement-enabled-3>replacement enabled</a> and <a href=#exceptions-enabled id=the-location-interface:exceptions-enabled-3>exceptions
- enabled</a>. The <a href=#source-browsing-context id=the-location-interface:source-browsing-context-2>source browsing context</a> must be the <a href=#browsing-context id=the-location-interface:browsing-context-17>browsing
- context</a> being navigated. This is a <a href=#reload-triggered-navigation id=the-location-interface:reload-triggered-navigation>reload-triggered navigation</a>.</dl>
- <p>When a user requests that the <a href=#active-document id=the-location-interface:active-document-5>active document</a> of a <a href=#browsing-context id=the-location-interface:browsing-context-18>browsing context</a>
- be reloaded through a user interface element, the user agent should <a href=#navigate id=the-location-interface:navigate-4>navigate</a> the <a href=#browsing-context id=the-location-interface:browsing-context-19>browsing context</a> to the same resource as that
- <code id=the-location-interface:document-10><a href=#document>Document</a></code>, with <a href=#replacement-enabled id=the-location-interface:replacement-enabled-4>replacement enabled</a>. In the case of non-idempotent
- methods (e.g. HTTP POST), the user agent should prompt the user to confirm the operation first,
- since otherwise transactions (e.g. purchases or database modifications) could be repeated. User
- agents may allow the user to explicitly override any caches when reloading. If <a href=#browsing-context id=the-location-interface:browsing-context-20>browsing
- context</a>'s <a href=#active-document id=the-location-interface:active-document-6>active document</a>'s <a href=#reload-override-flag id=the-location-interface:reload-override-flag-2>reload override flag</a> is set, then the
- user agent may instead perform <a href=#an-overridden-reload id=the-location-interface:an-overridden-reload-2>an overridden reload</a> rather than the navigation
- described in this paragraph (with the <a href=#browsing-context id=the-location-interface:browsing-context-21>browsing context</a> being reloaded as the
- <a href=#source-browsing-context id=the-location-interface:source-browsing-context-3>source browsing context</a>).</p>
- <hr>
-
-
- <p>The <code id=the-location-interface:location-9><a href=#location>Location</a></code> interface also supports the <code id=the-location-interface:urlutils-2><a href=#urlutils>URLUtils</a></code> interface. <a href=#refsURL>[URL]</a></p>
-
- <p>When the object is created, and whenever the <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address-3" data-x-internal="the-document's-address">the
- address</a> of the <i>relevant <code id=the-location-interface:document-11><a href=#document>Document</a></code></i> changes, the user agent must invoke
- the object's <code id=the-location-interface:urlutils-3><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-set-the-input id=the-location-interface:concept-uu-set-the-input>set the
- input</a> algorithm with <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-location-interface:the-document's-address-4" data-x-internal="the-document's-address">the address</a> of the
- <i>relevant <code id=the-location-interface:document-12><a href=#document>Document</a></code></i> as the given value.</p>
- <p>The object's <code id=the-location-interface:urlutils-4><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-get-the-base id=the-location-interface:concept-uu-get-the-base>get the
- base</a> algorithm must return the <a href=#api-base-url id=the-location-interface:api-base-url-3>API base URL</a> specified by the <a href=#entry-settings-object id=the-location-interface:entry-settings-object-3>entry
- settings object</a>, if there is one, or null otherwise.</p>
- <p>The object's <code id=the-location-interface:urlutils-5><a href=#urlutils>URLUtils</a></code> interface's <a href=#concept-uu-query-encoding id=the-location-interface:concept-uu-query-encoding>query
- encoding</a> is the <a href="#document's-character-encoding" id="the-location-interface:document's-character-encoding">document's character encoding</a>.</p>
- <p>When the object's <code id=the-location-interface:urlutils-6><a href=#urlutils>URLUtils</a></code> interface invokes its <a href=#concept-uu-update id=the-location-interface:concept-uu-update>update steps</a> with the string <var>value</var>, the
- user agent must run the following steps:</p>
- <ol><li>
- <p>If any of the following conditions are met, let <var>mode</var> be <i>normal
- navigation</i>; otherwise, let it be <i>replace navigation</i>:</p>
- <ul class=brief><li>The <code id=the-location-interface:location-10><a href=#location>Location</a></code> object's <i>relevant <code id=the-location-interface:document-13><a href=#document>Document</a></code></i> has
- <a href=#completely-loaded id=the-location-interface:completely-loaded>completely loaded</a>, or<li>In the <a href=#concept-task id=the-location-interface:concept-task-2>task</a> in which the algorithm is running, an
- <a href=#activation-behavior id=the-location-interface:activation-behavior>activation behavior</a> is currently being processed whose <code id=the-location-interface:event-click><a href=#event-click>click</a></code> event was <a href=#concept-events-trusted id=the-location-interface:concept-events-trusted>trusted</a>, or<li>In the <a href=#concept-task id=the-location-interface:concept-task-3>task</a> in which the algorithm is running, the event
- listener for a <a href=#concept-events-trusted id=the-location-interface:concept-events-trusted-2>trusted</a> <code id=the-location-interface:event-click-2><a href=#event-click>click</a></code> event is being handled.</ul>
- <li><p>If <var>mode</var> is <i>normal navigation</i>, then act as if the <code id=the-location-interface:dom-location-assign-5><a href=#dom-location-assign>assign()</a></code> method had been called with <var>value</var> as its argument. Otherwise, act as if the <code id=the-location-interface:dom-location-replace-5><a href=#dom-location-replace>replace()</a></code> method had been called with <var>value</var> as its argument.</ol>
-
-
- <h5 id=security-location>7.5.3.1 Security</h5>
- <p class=critical>This section describes a security model that is underdefined, imperfect, and
- does not match implementations. Work is ongoing to attempt to resolve this, but in the meantime,
- please do not rely on this section for precision. Implementors are urged to send their feedback on
- how cross-origin cross-global access to <code id=security-location:window><a href=#window>Window</a></code> and <code id=security-location:location><a href=#location>Location</a></code> objects
- should work. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=20701">bug 20701</a>.</p>
- <p id=security-3>User agents must throw a <code id=security-location:securityerror><a href=#securityerror>SecurityError</a></code> exception whenever any
- properties of a <code id=security-location:location-2><a href=#location>Location</a></code> object are accessed when the <a href=#entry-settings-object id=security-location:entry-settings-object>entry settings
- object</a> specifies an <a href=#effective-script-origin id=security-location:effective-script-origin>effective script origin</a> that is not the <a href=#same-origin id=security-location:same-origin>same</a> as the <code id=security-location:location-3><a href=#location>Location</a></code> object's associated <code id=security-location:document><a href=#document>Document</a></code>'s
- <a href=#browsing-context id=security-location:browsing-context>browsing context</a>'s <a href=#active-document id=security-location:active-document>active document</a>'s <a href=#effective-script-origin id=security-location:effective-script-origin-2>effective script
- origin</a>, with the following exceptions:</p>
- <ul><li>The <code id=security-location:dom-url-href><a href=#dom-url-href>href</a></code> setter, if the <a href=#responsible-browsing-context id=security-location:responsible-browsing-context>responsible browsing
- context</a> specified by the <a href=#entry-settings-object id=security-location:entry-settings-object-2>entry settings object</a> is <a href=#familiar-with id=security-location:familiar-with>familiar with</a>
- the <a href=#browsing-context id=security-location:browsing-context-2>browsing context</a> with which the <code id=security-location:location-4><a href=#location>Location</a></code> object is associated
- <li>The <code id=security-location:dom-location-replace><a href=#dom-location-replace>replace()</a></code> method, if the <a href=#responsible-browsing-context id=security-location:responsible-browsing-context-2>responsible
- browsing context</a> specified by the <a href=#entry-settings-object id=security-location:entry-settings-object-3>entry settings object</a> is <a href=#familiar-with id=security-location:familiar-with-2>familiar
- with</a> the <a href=#browsing-context id=security-location:browsing-context-3>browsing context</a> with which the <code id=security-location:location-5><a href=#location>Location</a></code> object is
- associated
- <li>Any properties not defined in the IDL for the <code id=security-location:location-6><a href=#location>Location</a></code> object or indirectly via
- one of those properties (e.g. <code>toString()</code>, which is defined via the <code>stringifier</code> keyword), if the <a href=#effective-script-origin id=security-location:effective-script-origin-3>effective script origin</a> specified by
- the <a href=#entry-settings-object id=security-location:entry-settings-object-4>entry settings object</a> is the <a href=#same-origin id=security-location:same-origin-2>same origin</a> as the
- <code id=security-location:location-7><a href=#location>Location</a></code> object's associated <code id=security-location:document-2><a href=#document>Document</a></code>'s <a href=#effective-script-origin id=security-location:effective-script-origin-4>effective script
- origin</a>
- </ul>
- <p>When the <a href=#effective-script-origin id=security-location:effective-script-origin-5>effective script origin</a> specified by the <a href=#entry-settings-object id=security-location:entry-settings-object-5>entry settings
- object</a> is different than a <code id=security-location:location-8><a href=#location>Location</a></code> object's associated
- <code id=security-location:document-3><a href=#document>Document</a></code>'s <a href=#effective-script-origin id=security-location:effective-script-origin-6>effective script origin</a>, the user agent must act as if any
- changes to that <code id=security-location:location-9><a href=#location>Location</a></code> object's properties, getters, setters, etc, were not
- present, and as if all the properties of that <code id=security-location:location-10><a href=#location>Location</a></code> object had their
- [[Enumerable]] attribute set to false.</p>
- <p>For members that return objects (including function objects), each distinct <a href=#effective-script-origin id=security-location:effective-script-origin-7>effective
- script origin</a> that is not the <a href=#same-origin id=security-location:same-origin-3>same origin</a> as the <code id=security-location:location-11><a href=#location>Location</a></code>
- object's <code id=security-location:document-4><a href=#document>Document</a></code>'s <a href=#effective-script-origin id=security-location:effective-script-origin-8>effective script origin</a> must be provided with a
- separate set of objects. These objects must have the prototype chain appropriate for the script
- for which the objects are created (not those that would be appropriate for scripts whose
- <a href=#settings-object id=security-location:settings-object>settings object</a> specifies a <a href=#global-object id=security-location:global-object>global object</a> that is the
- <code id=security-location:location-12><a href=#location>Location</a></code> object's <code id=security-location:document-5><a href=#document>Document</a></code>'s <code id=security-location:window-2><a href=#window>Window</a></code> object).</p>
-
-
- <h4 id=history-notes>7.5.4 Implementation notes for session history</h4>
-
- <p><i>This section is non-normative.</i></p>
- <p>The <code id=history-notes:history-3><a href=#history-3>History</a></code> interface is not meant to place restrictions on how implementations
- represent the session history to the user.</p>
- <p>For example, session history could be implemented in a tree-like manner, with each page having
- multiple "forward" pages. This specification doesn't define how the linear list of pages in the
- <code id=history-notes:dom-history><a href=#dom-history>history</a></code> object are derived from the actual session history as
- seen from the user's perspective.</p>
- <p>Similarly, a page containing two <code id=history-notes:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s has a <code id=history-notes:dom-history-2><a href=#dom-history>history</a></code> object distinct from the <code id=history-notes:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>s' <code id=history-notes:dom-history-3><a href=#dom-history>history</a></code> objects, despite the fact that typical Web browsers present the
- user with just one "Back" button, with a session history that interleaves the navigation of the
- two inner frames and the outer page.</p>
- <p><strong>Security</strong>: It is suggested that to avoid letting a page "hijack" the history
- navigation facilities of a UA by abusing <code id=history-notes:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code>,
- the UA provide the user with a way to jump back to the previous page (rather than just going back
- to the previous state). For example, the back button could have a drop down showing just the pages
- in the session history, and not showing any of the states. Similarly, an aural browser could have
- two "back" commands, one that goes back to the previous state, and one that jumps straight back to
- the previous page.</p>
- <p>In addition, a user agent could ignore calls to <code id=history-notes:dom-history-pushstate-2><a href=#dom-history-pushstate>pushState()</a></code> that are invoked on a timer, or from event
- listeners that are not triggered in response to a clear user action, or that are invoked in rapid
- succession.</p>
-
- <h3 id=browsing-the-web>7.6 Browsing the Web</h3>
-
- <h4 id=navigating-across-documents>7.6.1 Navigating across documents</h4>
- <p>Certain actions cause the <a href=#browsing-context id=navigating-across-documents:browsing-context>browsing context</a> to <i id=navigating-across-documents:navigate><a href=#navigate>navigate</a></i> to
- a new resource. A user agent may provide various ways for the user to explicitly cause a browsing
- context to navigate, in addition to those defined in this specification.</p>
- <p class=example>For example, <a href=#following-hyperlinks-2 id=navigating-across-documents:following-hyperlinks-2>following a hyperlink</a>,
- <a href=#concept-form-submit id=navigating-across-documents:concept-form-submit>form submission</a>, and the <code id=navigating-across-documents:dom-open><a href=#dom-open>window.open()</a></code> and <code id=navigating-across-documents:dom-location-assign><a href=#dom-location-assign>location.assign()</a></code> methods can all cause a browsing context to
- navigate.</p>
- <p class=note>A <i>resource</i> has a URL, but that might not be the only information necessary
- to identify it. For example, a form submission that uses HTTP POST would also have the HTTP method
- and payload. Similarly, <a href=#an-iframe-srcdoc-document id=navigating-across-documents:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a> needs to know the data it is to use.</p>
- <p>Navigation always involves <dfn id=source-browsing-context>source browsing context</dfn>, which is the browsing context which
- was responsible for starting the navigation.</p>
-
-
- <p>When a browsing context is <dfn id=navigate>navigated</dfn> to a new resource, the user
- agent must run the following steps:</p>
- <ol><li><p>Release the <a href=#storage-mutex id=navigating-across-documents:storage-mutex>storage mutex</a>.<li id=sandboxLinks>
- <p>If the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context>source browsing context</a> is not <a href=#allowed-to-navigate id=navigating-across-documents:allowed-to-navigate>allowed to navigate</a> the
- <a href=#browsing-context id=navigating-across-documents:browsing-context-2>browsing context</a> being navigated, then abort these steps.</p>
- <p>If these steps are aborted here, the user agent may instead offer to open the new resource in
- a new <a href=#top-level-browsing-context id=navigating-across-documents:top-level-browsing-context>top-level browsing context</a> or in the <a href=#top-level-browsing-context id=navigating-across-documents:top-level-browsing-context-2>top-level browsing context</a>
- of the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-2>source browsing context</a>, at the user's option, in which case the user agent
- must <a href=#navigate id=navigating-across-documents:navigate-2>navigate</a> that designated <a href=#top-level-browsing-context id=navigating-across-documents:top-level-browsing-context-3>top-level
- browsing context</a> to the new resource as if the user had requested it independently.</p>
- <p class=note>Doing so, however, can be dangerous, as it means that the user is overriding the
- author's explicit request to sandbox the content.</p>
- <p>If the <a href=#navigate id=navigating-across-documents:navigate-3>navigate</a> algorithm was invoked with <dfn id=exceptions-enabled>exceptions enabled</dfn>, and it
- is aborted on this step, then in addition to aborting this algorithm, the user agent must also
- throw a <code id=navigating-across-documents:securityerror><a href=#securityerror>SecurityError</a></code> exception.</p>
- <li id=seamlessLinks><p>If the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-3>source browsing context</a> is the same as the
- <a href=#browsing-context id=navigating-across-documents:browsing-context-3>browsing context</a> being navigated, and this browsing context has its <a href=#seamless-browsing-context-flag id=navigating-across-documents:seamless-browsing-context-flag>seamless
- browsing context flag</a> set, and the <a href=#browsing-context id=navigating-across-documents:browsing-context-4>browsing context</a> being navigated was not
- chosen using an <dfn id=explicit-self-navigation-override>explicit self-navigation override</dfn>, then find the nearest
- <a href=#ancestor-browsing-context id=navigating-across-documents:ancestor-browsing-context>ancestor browsing context</a> that does not have its <a href=#seamless-browsing-context-flag id=navigating-across-documents:seamless-browsing-context-flag-2>seamless browsing context
- flag</a> set, and continue these steps as if <em>that</em> <a href=#browsing-context id=navigating-across-documents:browsing-context-5>browsing context</a> was
- the one that was going to be <a href=#navigate id=navigating-across-documents:navigate-4>navigated</a> instead.<li><p>If there is a preexisting attempt to navigate the <a href=#browsing-context id=navigating-across-documents:browsing-context-6>browsing context</a>, and the
- <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-4>source browsing context</a> is the same as the <a href=#browsing-context id=navigating-across-documents:browsing-context-7>browsing context</a> being
- navigated, and that attempt is currently running the <a href=#unload-a-document id=navigating-across-documents:unload-a-document>unload a document</a> algorithm,
- and the <a href=#origin-2 id=navigating-across-documents:origin-2>origin</a> of the <a href=#url id=navigating-across-documents:url>URL</a> of the resource being loaded in that
- navigation is not the <a href=#same-origin id=navigating-across-documents:same-origin>same origin</a> as the <a href=#origin-2 id=navigating-across-documents:origin-2-2>origin</a> of the <a href=#url id=navigating-across-documents:url-2>URL</a>
- of the resource being loaded in <em>this</em> navigation, then abort these steps without
- affecting the preexisting attempt to navigate the <a href=#browsing-context id=navigating-across-documents:browsing-context-8>browsing context</a>.<li><p>If a <a href=#concept-task id=navigating-across-documents:concept-task>task</a> queued by the <a href=#traverse-the-history-by-a-delta id=navigating-across-documents:traverse-the-history-by-a-delta>traverse the history by a
- delta</a> algorithm is running the <a href=#unload-a-document id=navigating-across-documents:unload-a-document-2>unload a document</a> algorithm for the
- <a href=#active-document id=navigating-across-documents:active-document>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-9>browsing context</a> being navigated, then abort
- these steps without affecting the <a href=#unload-a-document id=navigating-across-documents:unload-a-document-3>unload a document</a> algorithm or the aforementioned
- history traversal task.<li><p>If the <a href=#prompt-to-unload-a-document id=navigating-across-documents:prompt-to-unload-a-document>prompt to unload a document</a> algorithm is being run for the
- <a href=#active-document id=navigating-across-documents:active-document-2>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-10>browsing context</a> being navigated, then abort
- these steps without affecting the <a href=#prompt-to-unload-a-document id=navigating-across-documents:prompt-to-unload-a-document-2>prompt to unload a document</a> algorithm.<li>
- <p>Let <var>gone async</var> be false.</p>
- <p class=note>The <a href=#navigate-redirect-step><i>handle redirects</i></a> step later in
- this algorithm can in certain cases jump back to the step labeled <a href=#navigate-fragid-step><i>fragment identifiers</i></a>. Since, between those two steps,
- this algorithm goes from operating synchronously in the context of the calling <a href=#concept-task id=navigating-across-documents:concept-task-2>task</a> to operating asynchronously independent of the <a href=#event-loop id=navigating-across-documents:event-loop>event
- loop</a>, some of the intervening steps need to be able to handle both being synchronous and
- being asynchronous. The <var>gone async</var> flag is thus used to make these steps
- aware of which mode they are operating in.</p>
- <li id=navigate-fragid-step><p><i>Fragment identifiers</i>: If this is not a
- <dfn id=reload-triggered-navigation>reload-triggered navigation</dfn>: apply the <a href=#url-parser id=navigating-across-documents:url-parser>URL parser</a> algorithm to the
- <a href=#absolute-url id=navigating-across-documents:absolute-url>absolute URL</a> of the new resource and the <a href=http://dom.spec.whatwg.org/#concept-document-url id="navigating-across-documents:the-document's-address" data-x-internal="the-document's-address">address</a> of the <a href=#active-document id=navigating-across-documents:active-document-3>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-11>browsing context</a>
- being navigated; if all the components of the resulting <a href=#parsed-url id=navigating-across-documents:parsed-url>parsed
- URLs</a>, ignoring any <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment>fragment</a> components, are
- identical, and the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get id=navigating-across-documents:concept-http-equivalent-get>or equivalent</a>, and the <a href=#parsed-url id=navigating-across-documents:parsed-url-2>parsed URL</a> of the
- new resource has a <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment-2>fragment</a> component that is not null
- (even if it is empty), then <a href=#scroll-to-fragid id=navigating-across-documents:scroll-to-fragid>navigate to that fragment
- identifier</a> and abort these steps.<li><p>If <var>gone async</var> is false, cancel any preexisting but not yet <a href=#concept-navigate-mature id=navigating-across-documents:concept-navigate-mature>mature</a> attempt to navigate the <a href=#browsing-context id=navigating-across-documents:browsing-context-12>browsing
- context</a>, including canceling any instances of the <a href=#fetch id=navigating-across-documents:fetch>fetch</a> algorithm started by
- those attempts. If one of those attempts has already created and <a href=#initialise-the-document-object id=navigating-across-documents:initialise-the-document-object>initialised a new <code>Document</code> object</a>, <a href=#abort-a-document id=navigating-across-documents:abort-a-document>abort</a> that <code id=navigating-across-documents:document><a href=#document>Document</a></code> also. (Navigation attempts that have <a href=#concept-navigate-mature id=navigating-across-documents:concept-navigate-mature-2>matured</a> already have session history entries, and are
- therefore handled during the <a href=#update-the-session-history-with-the-new-page id=navigating-across-documents:update-the-session-history-with-the-new-page>update the session history with the new page</a> algorithm,
- later.)<li><p>If the new resource is to be handled using a mechanism that does not affect the browsing
- context, e.g. ignoring the navigation request altogether because the specified scheme is not one
- of the supported protocols, then abort these steps and <a href=#hand-off-to-external-software id=navigating-across-documents:hand-off-to-external-software>proceed with that mechanism instead</a>.<li>
- <p>If <var>gone async</var> is false, <a href=#prompt-to-unload-a-document id=navigating-across-documents:prompt-to-unload-a-document-3>prompt
- to unload</a> the <code id=navigating-across-documents:document-2><a href=#document>Document</a></code> object. If the user <a href=#refused-to-allow-the-document-to-be-unloaded id=navigating-across-documents:refused-to-allow-the-document-to-be-unloaded>refused to allow the
- document to be unloaded</a>, then abort these steps.</p>
- <p>If this instance of the <a href=#navigate id=navigating-across-documents:navigate-5>navigation</a> algorithm gets canceled
- while this step is running, the <a href=#prompt-to-unload-a-document id=navigating-across-documents:prompt-to-unload-a-document-4>prompt to unload a document</a> algorithm must
- nonetheless be run to completion.</p>
- <li><p>If <var>gone async</var> is false, <a href=#abort-a-document id=navigating-across-documents:abort-a-document-2>abort</a>
- the <a href=#active-document id=navigating-across-documents:active-document-4>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-13>browsing context</a>.<li>
- <p>If the new resource is to be handled by displaying some sort of inline content, e.g. an error
- message because the specified scheme is not one of the supported protocols, or an inline prompt
- to allow the user to select <a href=#dom-navigator-registerprotocolhandler id=navigating-across-documents:dom-navigator-registerprotocolhandler>a registered
- handler</a> for the given scheme, then <a href=#read-ua-inline id=navigating-across-documents:read-ua-inline>display the inline
- content</a> and abort these steps.</p>
- <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
- with a new URL to handle the request.</p>
- <li>
- <p>If the <a href=#browsing-context id=navigating-across-documents:browsing-context-14>browsing context</a> being navigated is a <a href=#nested-browsing-context id=navigating-across-documents:nested-browsing-context>nested browsing
- context</a>, then put it in the <a href=#delaying-load-events-mode id=navigating-across-documents:delaying-load-events-mode>delaying <code>load</code> events
- mode</a>.</p>
- <p>The user agent must take this <a href=#nested-browsing-context id=navigating-across-documents:nested-browsing-context-2>nested browsing context</a> out of the <a href=#delaying-load-events-mode id=navigating-across-documents:delaying-load-events-mode-2>delaying
- <code>load</code> events mode</a> when this <a href=#navigate id=navigating-across-documents:navigate-6>navigation</a> algorithm later <a href=#concept-navigate-mature id=navigating-across-documents:concept-navigate-mature-3>matures</a>, or when it terminates (whether due to having
- run all the steps, or being canceled, or being aborted), whichever happens first.</p>
-
- <li>
- <p>This is the step that attempts to obtain the resource, if necessary. Jump to the first
- appropriate substep:</p>
- <dl><dt>If the resource has already been obtained (e.g. because it is being used to populate an
- <code id=navigating-across-documents:the-object-element><a href=#the-object-element>object</a></code> element's new <a href=#child-browsing-context id=navigating-across-documents:child-browsing-context>child browsing context</a>)<dd><p>Skip this step. The data is already available.<dt>If the new resource is a <a href=#url id=navigating-across-documents:url-3>URL</a> whose <a href=#concept-url-scheme id=navigating-across-documents:concept-url-scheme>scheme</a> is <code id=navigating-across-documents:javascript-protocol><a href=#javascript-protocol>javascript</a></code><dd>
-
- <p><a href=#queue-a-task id=navigating-across-documents:queue-a-task>Queue a task</a> to run <dfn id=javascript-protocol>these
- "<code>javascript:</code> URL" steps</dfn>, associated with the <a href=#active-document id=navigating-across-documents:active-document-5>active document</a>
- of the <a href=#browsing-context id=navigating-across-documents:browsing-context-15>browsing context</a> being navigated:</p>
- <ol id=concept-js-deref><li><p>If the <a href=#origin-2 id=navigating-across-documents:origin-2-3>origin</a> of the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-5>source browsing context</a> is not the
- <a href=#same-origin id=navigating-across-documents:same-origin-2>same origin</a> as the <a href=#origin-2 id=navigating-across-documents:origin-2-4>origin</a> of the <a href=#active-document id=navigating-across-documents:active-document-6>active document</a> of
- the <a href=#browsing-context id=navigating-across-documents:browsing-context-16>browsing context</a> being navigated, then act as if the result of evaluating
- the script was the void value, and jump to the step labeled <i>process results</i>
- below.<li><p>Apply the <a href=#url-parser id=navigating-across-documents:url-parser-2>URL parser</a> to the <a href=#url id=navigating-across-documents:url-4>URL</a> being navigated.<li><p>Let <var>parsed URL</var> be the result of the <a href=#url-parser id=navigating-across-documents:url-parser-3>URL
- parser</a>.<li><p>Let <var>script source</var> be the empty string.<li><p>Append <var>parsed URL</var>'s <a href=#concept-url-scheme-data id=navigating-across-documents:concept-url-scheme-data>scheme
- data</a> component to <var>script source</var>.<li><p>If <var>parsed URL</var>'s <a href=#concept-url-query id=navigating-across-documents:concept-url-query>query</a>
- component is not null, then first append a U+003F QUESTION MARK character (?) to <var>script source</var>, and then append <var>parsed URL</var>'s <a href=#concept-url-query id=navigating-across-documents:concept-url-query-2>query</a> component to <var>script
- source</var>.<li><p>If <var>parsed URL</var>'s <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment-3>fragment</a> component is not null, then first append a
- U+0023 NUMBER SIGN character (#) to <var>script source</var>, and then append <var>parsed URL</var>'s <a href=#concept-url-fragment id=navigating-across-documents:concept-url-fragment-4>fragment</a> component to
- <var>script source</var>.<li><p>Replace <var>script source</var> with the result of applying the
- <a href=#percent-decode id=navigating-across-documents:percent-decode>percent decode</a> algorithm to <var>script source</var>.<li><p>Replace <var>script source</var> with the result of applying the <a href=#utf-8-decode id=navigating-across-documents:utf-8-decode>UTF-8
- decode</a> algorithm to <var>script source</var>.<li><p>Let <var>address</var> be the <a href=http://dom.spec.whatwg.org/#concept-document-url id="navigating-across-documents:the-document's-address-2" data-x-internal="the-document's-address">address</a> of the <a href=#active-document id=navigating-across-documents:active-document-7>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-17>browsing
- context</a> being navigated.<li>
- <p><a href=#create-a-script id=navigating-across-documents:create-a-script>Create a script</a>, using <var>script source</var> as the script
- source, <var>address</var> as the script source URL, JavaScript as the scripting
- language, and the <a href=#script-settings-object id=navigating-across-documents:script-settings-object>script settings object</a> of the <code id=navigating-across-documents:window><a href=#window>Window</a></code> object of
- the <a href=#active-document id=navigating-across-documents:active-document-8>active document</a> of the <a href=#browsing-context id=navigating-across-documents:browsing-context-18>browsing context</a> being navigated.</p>
- <p>Let <var>result</var> be the return value of the <a href=#code-entry-point id=navigating-across-documents:code-entry-point>code entry-point</a>
- of this <a href=#concept-script id=navigating-across-documents:concept-script>script</a>. If an exception was thrown, let <var>result</var> be void instead. (The result will be void also if <a href=#concept-bc-noscript id=navigating-across-documents:concept-bc-noscript>scripting is disabled</a>.)</p>
- <li>
- <p><i>Process results</i>: If the result of executing the script is void (there is no return
- value), then the result of obtaining the resource for the URL is <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes>equivalent to</a> an HTTP resource with an HTTP
- 204 No Content response.</p>
- <p>Otherwise, the result of obtaining the resource for the URL is <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes-2>equivalent</a> to an HTTP resource with a 200 OK
- response whose <a href=#content-type id=navigating-across-documents:content-type>Content-Type metadata</a> is
- <code id=navigating-across-documents:text/html><a href=#text/html>text/html</a></code> and whose response body is the return value converted to a string
- value.</p>
- <p>When it comes time to <a href="#set-the-document's-address" id="navigating-across-documents:set-the-document's-address">set the document's address</a> in the <a href=#navigate id=navigating-across-documents:navigate-7>navigation algorithm</a>, use <var>address</var> as the
- <a href=#override-url id=navigating-across-documents:override-url>override URL</a>.</p>
- </ol>
- <p>The <a href=#task-source id=navigating-across-documents:task-source>task source</a> for this <a href=#concept-task id=navigating-across-documents:concept-task-3>task</a> is the
- <a href=#dom-manipulation-task-source id=navigating-across-documents:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- <div class=example>
- <p>So for example a <a href=#javascript-protocol id=navigating-across-documents:javascript-protocol-2><code>javascript:</code> URL</a> in
- an <code id=navigating-across-documents:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute of an <code id=navigating-across-documents:the-a-element><a href=#the-a-element>a</a></code> element
- would only be evaluated when the link was <a href=#following-hyperlinks-2 id=navigating-across-documents:following-hyperlinks-2-2>followed</a>, while such a URL in the <code id=navigating-across-documents:attr-iframe-src><a href=#attr-iframe-src>src</a></code> attribute of an <code id=navigating-across-documents:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element would be
- evaluated in the context of the <code id=navigating-across-documents:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>'s own <a href=#nested-browsing-context id=navigating-across-documents:nested-browsing-context-3>nested browsing
- context</a> when the <code id=navigating-across-documents:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code> is being set up; once evaluated, its return value
- (if it was not void) would replace that <a href=#browsing-context id=navigating-across-documents:browsing-context-19>browsing context</a>'s <code id=navigating-across-documents:document-3><a href=#document>Document</a></code>, thus also
- changing the <code id=navigating-across-documents:window-2><a href=#window>Window</a></code> object of that <a href=#browsing-context id=navigating-across-documents:browsing-context-20>browsing context</a>.</p>
- </div>
- <dt>If the new resource is to be fetched using HTTP GET <a href=#concept-http-equivalent-get id=navigating-across-documents:concept-http-equivalent-get-2>or equivalent</a>, and there are <a href=#relevant-application-cache id=navigating-across-documents:relevant-application-cache>relevant application caches</a> that are identified by a URL with the
- <a href=#same-origin id=navigating-across-documents:same-origin-3>same origin</a> as the URL in question, and that have this URL as one of their
- entries, excluding entries marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign>foreign</a>,
- and whose <a href=#concept-appcache-mode id=navigating-across-documents:concept-appcache-mode>mode</a> is <a href=#concept-appcache-mode-fast id=navigating-across-documents:concept-appcache-mode-fast>fast</a>, and the user agent is not in a mode where it
- will avoid using <a href=#application-cache id=navigating-across-documents:application-cache>application caches</a><dd>
- <p><a href=#fetch id=navigating-across-documents:fetch-2>Fetch</a> the resource from the <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection>most
- appropriate application cache</a> of those that match.</p>
- <p class=example>For example, imagine an HTML page with an associated application cache
- displaying an image and a form, where the image is also used by several other application
- caches. If the user right-clicks on the image and chooses "View Image", then the user agent
- could decide to show the image from any of those caches, but it is likely that the most useful
- cache for the user would be the one that was used for the aforementioned HTML page. On the
- other hand, if the user submits the form, and the form does a POST submission, then the user
- agent will not use an application cache at all; the submission will be made to the
- network.</p>
- <dt>Otherwise<dd>
- <p><a href=#fetch id=navigating-across-documents:fetch-3>Fetch</a> the new resource, with the <i>manual redirect flag</i>
- set.</p>
- </dl>
- <p>If the steps above invoked the <a href=#fetch id=navigating-across-documents:fetch-4>fetch</a> algorithm, the following requirements also
- apply:</p>
- <p>If the resource is being fetched using a method other than one <a href=#concept-http-equivalent-get id=navigating-across-documents:concept-http-equivalent-get-3>equivalent to</a> HTTP's GET, or, if the <a href=#navigate id=navigating-across-documents:navigate-8>navigation algorithm</a> was invoked as a
- result of the <a href=#concept-form-submit id=navigating-across-documents:concept-form-submit-2>form submission algorithm</a>, then the
- <a href=#fetch id=navigating-across-documents:fetch-5>fetching algorithm</a> must be invoked from the <a href=#origin-2 id=navigating-across-documents:origin-2-5>origin</a> of
- the <a href=#active-document id=navigating-across-documents:active-document-9>active document</a> of the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-6>source browsing context</a>, if any.</p>
- <p>Otherwise, if the <a href=#browsing-context id=navigating-across-documents:browsing-context-21>browsing context</a> being navigated is a <a href=#child-browsing-context id=navigating-across-documents:child-browsing-context-2>child browsing
- context</a>, then the <a href=#fetch id=navigating-across-documents:fetch-6>fetching algorithm</a> must be invoked from the
- <a href=#browsing-context-scope-origin id=navigating-across-documents:browsing-context-scope-origin>browsing context scope origin</a> of the <a href=#browsing-context-container id=navigating-across-documents:browsing-context-container>browsing context container</a> of the
- <a href=#browsing-context id=navigating-across-documents:browsing-context-22>browsing context</a> being navigated, if it has one.</p>
- <li>
-
- <p>If <var>gone async</var> is false, return to whatever algorithm invoked the
- navigation steps and continue running these steps asynchronously.</p>
- <li><p>Let <var>gone async</var> be true.<li><p>Wait for one or more bytes to be available or for the user agent to establish that the
- resource in question is empty. During this time, the user agent may allow the user to cancel this
- navigation attempt or start other navigation attempts.<li id=navigate-redirect-step>
- <p><i>Handle redirects</i>: If fetching the resource results in a redirect, and either the
- <a href=#url id=navigating-across-documents:url-5>URL</a> of the target of the redirect has the <a href=#same-origin id=navigating-across-documents:same-origin-4>same origin</a> as the original
- resource, or the resource is being obtained using the POST method or a safe method (in HTTP
- terms), return to <a href=#navigate-fragid-step>the step labeled <i>fragment
- identifiers</i></a> with the new resource, except that if the <a href=#url id=navigating-across-documents:url-6>URL</a> of the target of
- the redirect does not have a fragment identifier and the <a href=#url id=navigating-across-documents:url-7>URL</a> of the resource that
- led to the redirect does, then the fragment identifier of the resource that led to the redirect
- must be propagated to the <a href=#url id=navigating-across-documents:url-8>URL</a> of the target of the redirect.</p>
- <p class=example>So for instance, if the original URL was "<code>http://example.com/#!sample</code>" and "<code>http://example.com/</code>" is
- found to redirect to "<code>https://example.com/</code>", the URL of the new resource
- will be "<code>https://example.com/#!sample</code>".</p>
- <p>Otherwise, if fetching the resource results in a redirect but the <a href=#url id=navigating-across-documents:url-9>URL</a> of the
- target of the redirect does not have the <a href=#same-origin id=navigating-across-documents:same-origin-5>same origin</a> as the original resource and
- the resource is being obtained using a method that is neither the POST method nor a safe method
- (in HTTP terms), then abort these steps. The user agent may indicate to the user that the
- navigation has been aborted for security reasons.</p>
- <li>
- <p><strong>Fallback in prefer-online mode</strong>: If the resource was not fetched from an
- <a href=#application-cache id=navigating-across-documents:application-cache-2>application cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get id=navigating-across-documents:concept-http-equivalent-get-4>or equivalent</a>, and there are <a href=#relevant-application-cache id=navigating-across-documents:relevant-application-cache-2>relevant application caches</a> that are identified by a URL with the
- <a href=#same-origin id=navigating-across-documents:same-origin-6>same origin</a> as the URL in question, and that have this URL as one of their entries,
- excluding entries marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign-2>foreign</a>, and whose
- <a href=#concept-appcache-mode id=navigating-across-documents:concept-appcache-mode-2>mode</a> is <a href=#concept-appcache-mode-prefer-online id=navigating-across-documents:concept-appcache-mode-prefer-online>prefer-online</a>, and the user didn't cancel the
- navigation attempt during the earlier step, and the navigation attempt failed (e.g. the server
- returned a 4xx or 5xx status code <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes-3>or
- equivalent</a>, or there was a DNS error), then:</p>
- <p>Let <var>candidate</var> be the resource identified by the URL in question from the
- <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection-2>most appropriate application cache</a> of those that
- match.</p>
- <p>If <var>candidate</var> is not marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign-3>foreign</a>, then the user agent must discard the failed
- load and instead continue along these steps using <var>candidate</var> as the resource.
- The user agent may indicate to the user that the original page load failed, and that the page
- used was a previously cached resource.</p>
- <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
- obtained</i>, as used to set <a href="#the-document's-referrer" id="navigating-across-documents:the-document's-referrer">the document's referrer</a> in the <a href=#initialise-the-document-object id=navigating-across-documents:initialise-the-document-object-2>initialise the
- <code>Document</code> object</a> steps below; they still use the value as computed by the
- original <a href=#fetch id=navigating-across-documents:fetch-7>fetch</a> algorithm.</p>
- <li>
- <p><strong>Fallback for fallback entries</strong>: If the resource was not fetched from an
- <a href=#application-cache id=navigating-across-documents:application-cache-3>application cache</a>, and was to be fetched using HTTP GET <a href=#concept-http-equivalent-get id=navigating-across-documents:concept-http-equivalent-get-5>or equivalent</a>, and its URL <a href=#concept-appcache-matches-fallback id=navigating-across-documents:concept-appcache-matches-fallback>matches the fallback namespace</a> of one or more
- <a href=#relevant-application-cache id=navigating-across-documents:relevant-application-cache-3>relevant application caches</a>, and the <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection-3>most appropriate application cache</a> of those that match
- does not have an entry in its <a href=#concept-appcache-onlinewhitelist id=navigating-across-documents:concept-appcache-onlinewhitelist>online
- whitelist</a> that has the <a href=#same-origin id=navigating-across-documents:same-origin-7>same origin</a> as the resource's URL and that is a
- <a href=#prefix-match id=navigating-across-documents:prefix-match>prefix match</a> for the resource's URL, and the user didn't cancel the navigation
- attempt during the earlier step, and the navigation attempt failed (e.g. the server returned a
- 4xx or 5xx status code <a href=#concept-http-equivalent-codes id=navigating-across-documents:concept-http-equivalent-codes-4>or equivalent</a>, or
- there was a DNS error), then:</p>
- <p>Let <var>candidate</var> be the <a href=#concept-appcache-fallback id=navigating-across-documents:concept-appcache-fallback>fallback
- resource</a> specified for the <a href=#concept-appcache-fallback-ns id=navigating-across-documents:concept-appcache-fallback-ns>fallback
- namespace</a> in question. If multiple application caches match, the user agent must use the
- fallback of the <a href=#concept-appcache-selection id=navigating-across-documents:concept-appcache-selection-4>most appropriate application
- cache</a> of those that match.</p>
- <p>If <var>candidate</var> is not marked as <a href=#concept-appcache-foreign id=navigating-across-documents:concept-appcache-foreign-4>foreign</a>, then the user agent must discard the failed
- load and instead continue along these steps using <var>candidate</var> as the resource.
- <a id="navigating-across-documents:the-document's-address-3" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">The document's address</a>, if appropriate, will still be the originally requested URL,
- not the fallback URL, but the user agent may indicate to the user that the original page load
- failed, that the page used was a fallback resource, and what the URL of the fallback resource
- actually is.</p>
- <p class=note>This does not affect the <i>address of the resource from which Request-URIs are
- obtained</i>, as used to set <a href="#the-document's-referrer" id="navigating-across-documents:the-document's-referrer-2">the document's referrer</a> in the <a href=#initialise-the-document-object id=navigating-across-documents:initialise-the-document-object-3>initialise the
- <code>Document</code> object</a> steps below; they still use the value as computed by the
- original <a href=#fetch id=navigating-across-documents:fetch-8>fetch</a> algorithm.</p>
- <li>
- <p><i>Resource handling</i>: If the resource's out-of-band metadata (e.g. HTTP headers), not
- counting any <a href=#content-type id=navigating-across-documents:content-type-2>type information</a> (such as the Content-Type HTTP
- header), requires some sort of processing that will not affect the browsing context, then
- perform that processing and abort these steps.</p>
- <div class=note>
- <p>Such processing might be triggered by, amongst other things, the following:</p>
- <ul class=brief><li>HTTP status codes (e.g. 204 No Content or 205 Reset Content)<li>Network errors (e.g. the network interface being unavailable)<li>Cryptographic protocol failures (e.g. an incorrect TLS certificate)</ul>
- </div>
- <p>Responses with HTTP <code id=navigating-across-documents:http-content-disposition><a href=#http-content-disposition>Content-Disposition</a></code> headers
- specifying the <code>attachment</code> disposition type must be handled <a href=#as-a-download id=navigating-across-documents:as-a-download>as a
- download</a>.</p>
-
- <p>HTTP 401 responses that do not include a challenge recognised by the user agent must be
- processed as if they had no challenge, e.g. rendering the entity body as if the response had
- been 200 OK.</p>
- <p>User agents may show the entity body of an HTTP 401 response even when the response does
- include a recognised challenge, with the option to login being included in a non-modal fashion,
- to enable the information provided by the server to be used by the user before authenticating.
- Similarly, user agents should allow the user to authenticate (in a non-modal fashion) against
- authentication challenges included in other responses such as HTTP 200 OK responses, effectively
- allowing resources to present HTTP login forms without requiring their use.</p>
- <li><p>Let <var>type</var> be <a href=http://mimesniff.spec.whatwg.org/#sniffed-mime-type id=navigating-across-documents:content-type-sniffing-2 data-x-internal=content-type-sniffing-2>the sniffed type of
- the resource</a>.<li><p>If the user agent has been configured to process resources of the given <var>type</var> using some mechanism other than rendering the content in a <a href=#browsing-context id=navigating-across-documents:browsing-context-23>browsing
- context</a>, then skip this step. Otherwise, if the <var>type</var> is one of the
- following types, jump to the appropriate entry in the following list, and process the resource as
- described there:</p>
- <dl class=switch><dt>"<code id=navigating-across-documents:text/html-2><a href=#text/html>text/html</a></code>"<dd>Follow the steps given in the <a href=#read-html id=navigating-across-documents:read-html>HTML document</a> section,
- and then, once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-9>navigate</a> algorithm.<dt>"<code id=navigating-across-documents:application/xml><a href=#application/xml>application/xml</a></code>"<dt>"<code id=navigating-across-documents:text/xml><a href=#text/xml>text/xml</a></code>"<dt>"<code id=navigating-across-documents:image/svg+xml><a href=#image/svg+xml>image/svg+xml</a></code>"<dt>"<code id=navigating-across-documents:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code>"<dt>Any other type ending in "<code>+xml</code>" that is not an <a href=#explicitly-supported-xml-type id=navigating-across-documents:explicitly-supported-xml-type>explicitly
- supported XML type</a><dd>Follow the steps given in the <a href=#read-xml id=navigating-across-documents:read-xml>XML document</a> section. If
- that section determines that the content is <em>not</em> to be displayed as a generic XML
- document, then proceed to the next step in this overall set of steps. Otherwise, once the steps
- given in the <a href=#read-xml id=navigating-across-documents:read-xml-2>XML document</a> section have completed, abort this
- <a href=#navigate id=navigating-across-documents:navigate-10>navigate</a> algorithm.<dt>"<code id=navigating-across-documents:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>"<dd>Follow the steps given in the <a href=#read-text id=navigating-across-documents:read-text>plain text file</a> section,
- and then, once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-11>navigate</a> algorithm.<dt>"<code id=navigating-across-documents:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>"<dd>Follow the steps given in the <a href=#read-multipart-x-mixed-replace id=navigating-across-documents:read-multipart-x-mixed-replace>multipart/x-mixed-replace</a> section, and then,
- once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-12>navigate</a> algorithm.<dt>A supported image, video, or audio type<dd>Follow the steps given in the <a href=#read-media id=navigating-across-documents:read-media>media</a> section, and then,
- once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-13>navigate</a> algorithm.<dt>A type that will use an external application to render the content in the <a href=#browsing-context id=navigating-across-documents:browsing-context-24>browsing
- context</a><dd>Follow the steps given in the <a href=#read-plugin id=navigating-across-documents:read-plugin>plugin</a> section, and then,
- once they have completed, abort this <a href=#navigate id=navigating-across-documents:navigate-14>navigate</a> algorithm.</dl>
- <p>An <dfn id=explicitly-supported-xml-type>explicitly supported XML type</dfn> is one for which the user agent is configured to
- use an external application to render the content (either a <a href=#plugin id=navigating-across-documents:plugin>plugin</a> rendering
- directly in the <a href=#browsing-context id=navigating-across-documents:browsing-context-25>browsing context</a>, or a separate application), or one for which the
- user agent has dedicated processing rules (e.g. a Web browser with a built-in Atom feed viewer
- would be said to explicitly support the <code id=navigating-across-documents:application/atom+xml><a href=#application/atom+xml>application/atom+xml</a></code> MIME type), or one for
- which the user agent has a dedicated handler (e.g. one registered using <code id=navigating-across-documents:dom-navigator-registercontenthandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>).</p>
- <p><dfn id="set-the-document's-address">Setting the document's address</dfn>: If there is no
- <dfn id=override-url>override URL</dfn>, then any <code id=navigating-across-documents:document-4><a href=#document>Document</a></code> created by these steps must have its
- <a href=http://dom.spec.whatwg.org/#concept-document-url id="navigating-across-documents:the-document's-address-4" data-x-internal="the-document's-address">address</a> set to the <a href=#url id=navigating-across-documents:url-10>URL</a> that was
- originally to be <a href=#fetch id=navigating-across-documents:fetch-9>fetched</a>, ignoring any other data that was used to
- obtain the resource (e.g. the entity body in the case of a POST submission is not part of
- <a id="navigating-across-documents:the-document's-address-5" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>, nor is the URL of the fallback resource in the case of the
- original load having failed and that URL having been found to match a <a href=#concept-appcache-fallback-ns id=navigating-across-documents:concept-appcache-fallback-ns-2>fallback namespace</a>). However, if there <em>is</em>
- an <a href=#override-url id=navigating-across-documents:override-url-2>override URL</a>, then any <code id=navigating-across-documents:document-5><a href=#document>Document</a></code> created by these steps must have
- its <a href=http://dom.spec.whatwg.org/#concept-document-url id="navigating-across-documents:the-document's-address-6" data-x-internal="the-document's-address">address</a> set to that <a href=#url id=navigating-across-documents:url-11>URL</a>
- instead.</p>
- <p class=note>An <a href=#override-url id=navigating-across-documents:override-url-3>override URL</a> is set when <a href=#javascript-protocol id=navigating-across-documents:javascript-protocol-3>dereferencing a <code>javascript:</code> URL</a> and when
- performing <a href=#an-overridden-reload id=navigating-across-documents:an-overridden-reload>an overridden reload</a>.</p>
- <p><dfn id=initialise-the-document-object>Initializing a new <code>Document</code>
- object</dfn>: when a <code id=navigating-across-documents:document-6><a href=#document>Document</a></code> is created as part of the above steps, the user agent
- will be required to additionally run the following algorithm after creating the new object:</p>
- <ol><li><p>Create a new <code id=navigating-across-documents:window-3><a href=#window>Window</a></code> object, and associate it with the
- <code id=navigating-across-documents:document-7><a href=#document>Document</a></code>, with one exception: if the <a href=#browsing-context id=navigating-across-documents:browsing-context-26>browsing context</a>'s only entry in
- its <a href=#session-history id=navigating-across-documents:session-history>session history</a> is the <code id=navigating-across-documents:about:blank><a href=#about:blank>about:blank</a></code> <code id=navigating-across-documents:document-8><a href=#document>Document</a></code> that was
- added when the <a href=#browsing-context id=navigating-across-documents:browsing-context-27>browsing context</a> was created, and navigation is occurring with
- <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled>replacement enabled</a>, and that <code id=navigating-across-documents:document-9><a href=#document>Document</a></code> has the <a href=#same-origin id=navigating-across-documents:same-origin-8>same
- origin</a> as the new <code id=navigating-across-documents:document-10><a href=#document>Document</a></code>, then use the <code id=navigating-across-documents:window-4><a href=#window>Window</a></code> object of that
- <code id=navigating-across-documents:document-11><a href=#document>Document</a></code> instead, and change the <code id=navigating-across-documents:dom-document-2><a href=#dom-document-2>document</a></code>
- attribute of the <code id=navigating-across-documents:window-5><a href=#window>Window</a></code> object to point to the new <code id=navigating-across-documents:document-12><a href=#document>Document</a></code>.</p>
- <li><p>Set <a href="#the-document's-referrer" id="navigating-across-documents:the-document's-referrer-3">the document's referrer</a> to the <i>address of the resource from which
- Request-URIs are obtained</i> as determined when the <a href=#fetch id=navigating-across-documents:fetch-10>fetch</a> algorithm obtained the
- resource, if that algorithm was used and determined such a value; otherwise, set it to the
- empty string.<li><p><a href=#implement-the-sandboxing id=navigating-across-documents:implement-the-sandboxing>Implement the sandboxing</a> for the <code id=navigating-across-documents:document-13><a href=#document>Document</a></code>.<li id=fullscreen-logic>
- <p>If the <a href=#active-sandboxing-flag-set id=navigating-across-documents:active-sandboxing-flag-set>active sandboxing flag set</a> of the <code id=navigating-across-documents:document-14><a href=#document>Document</a></code>'s
- <a href=#browsing-context id=navigating-across-documents:browsing-context-28>browsing context</a> or any of its <a href=#ancestor-browsing-context id=navigating-across-documents:ancestor-browsing-context-2>ancestor
- browsing contexts</a> (if any) have the <a href=#sandboxed-fullscreen-browsing-context-flag id=navigating-across-documents:sandboxed-fullscreen-browsing-context-flag>sandboxed fullscreen browsing context
- flag</a> set, then skip this step.</p>
- <p>If the <code id=navigating-across-documents:document-15><a href=#document>Document</a></code>'s <a href=#browsing-context id=navigating-across-documents:browsing-context-29>browsing context</a> has a <a href=#browsing-context-container id=navigating-across-documents:browsing-context-container-2>browsing context
- container</a> and either it is not an <code id=navigating-across-documents:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code> element, or it does not have the
- <code id=navigating-across-documents:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code> attribute specified, or its
- <code id=navigating-across-documents:document-16><a href=#document>Document</a></code> does not have the <a href=#fullscreen-enabled-flag id=navigating-across-documents:fullscreen-enabled-flag>fullscreen enabled flag</a> set, then also
- skip this step.</p>
- <p>Otherwise, set the <code id=navigating-across-documents:document-17><a href=#document>Document</a></code>'s <a href=#fullscreen-enabled-flag id=navigating-across-documents:fullscreen-enabled-flag-2>fullscreen enabled flag</a>.</p>
- </ol>
- <li id=navigate-non-Document>
- <p><i>Non-document content</i>: If, given <var>type</var>, the new resource is to be
- handled by displaying some sort of inline content, e.g. a native rendering of the content, an
- error message because the specified type is not supported, or an inline prompt to allow the user
- to select <a href=#dom-navigator-registercontenthandler id=navigating-across-documents:dom-navigator-registercontenthandler-2>a registered handler</a> for
- the given type, then <a href=#read-ua-inline id=navigating-across-documents:read-ua-inline-2>display the inline content</a>, and
- then abort these steps.</p>
- <p class=note>In the case of a registered handler being used, the algorithm will be reinvoked
- with a new URL to handle the request.</p>
- <li><p>Otherwise, the document's <var>type</var> is such that the resource will not
- affect the browsing context, e.g. because the resource is to be handed to an external application
- or because it is an unknown type that will be processed <a href=#as-a-download id=navigating-across-documents:as-a-download-2>as a download</a>. <a href=#hand-off-to-external-software id=navigating-across-documents:hand-off-to-external-software-2>Process the resource appropriately</a>.</p>
- </ol>
- <p>When a resource is handled by <dfn id=hand-off-to-external-software>passing its URL or
- data to an external software package</dfn> separate from the user agent (e.g. handing a <code id=navigating-across-documents:mailto-protocol><a data-x-internal=mailto-protocol href=http://tools.ietf.org/html/rfc6068#section-2>mailto:</a></code> URL to a mail client, or a Word document to a word
- processor), user agents should attempt to mitigate the risk that this is an attempt to exploit the
- target software, e.g. by prompting the user to confirm that the <a href=#source-browsing-context id=navigating-across-documents:source-browsing-context-7>source browsing
- context</a>'s <a href=#active-document id=navigating-across-documents:active-document-10>active document</a>'s <a href=#origin-2 id=navigating-across-documents:origin-2-6>origin</a> is to be allowed to invoke the
- specified software. In particular, if the <a href=#navigate id=navigating-across-documents:navigate-15>navigate</a> algorithm, when it was invoked,
- was not <a href=#allowed-to-show-a-popup id=navigating-across-documents:allowed-to-show-a-popup>allowed to show a popup</a>, the user agent should not invoke the external
- software package without prior user confirmation.</p>
- <p class=example>For example, there could be a vulnerability in the target software's URL
- handler which a hostile page would attempt to exploit by tricking a user into clicking a link.</p>
- <hr>
- <p>Some of the sections below, to which the above algorithm defers in certain cases, require the
- user agent to <dfn id=update-the-session-history-with-the-new-page>update the session history with the new page</dfn>. When a user agent is
- required to do this, it must <a href=#queue-a-task id=navigating-across-documents:queue-a-task-2>queue a task</a> (associated with the <code id=navigating-across-documents:document-18><a href=#document>Document</a></code>
- object of the <a href=#current-entry id=navigating-across-documents:current-entry>current entry</a>, not the new one) to run the following steps:</p>
- <ol><li>
- <p><a href=#unload-a-document id=navigating-across-documents:unload-a-document-4>Unload</a> the <code id=navigating-across-documents:document-19><a href=#document>Document</a></code> object of the
- <a href=#current-entry id=navigating-across-documents:current-entry-2>current entry</a>, with the <var>recycle</var> parameter set to false.</p>
- <p>If this instance of the <a href=#navigate id=navigating-across-documents:navigate-16>navigation</a> algorithm is canceled while
- this step is running the <a href=#unload-a-document id=navigating-across-documents:unload-a-document-5>unload a document</a> algorithm, then the <a href=#unload-a-document id=navigating-across-documents:unload-a-document-6>unload a
- document</a> algorithm must be allowed to run to completion, but this instance of the <a href=#navigate id=navigating-across-documents:navigate-17>navigation</a> algorithm must not run beyond this step. (In particular, for
- instance, the cancelation of this algorithm does not abort any event dispatch or script
- execution occurring as part of unloading the document or its descendants.)</p>
- <li>
- <dl><dt>If the navigation was initiated for <dfn id=entry-update>entry update</dfn> of an entry<dd>
- <ol><li><p>Replace the <code id=navigating-across-documents:document-20><a href=#document>Document</a></code> of the entry being updated, and any other entries
- that referenced the same document as that entry, with the new <code id=navigating-across-documents:document-21><a href=#document>Document</a></code>.<li><p><a href=#traverse-the-history id=navigating-across-documents:traverse-the-history>Traverse the history</a> to the new entry.</ol>
- <p class=note>This can only happen if the entry being updated is not the <a href=#current-entry id=navigating-across-documents:current-entry-3>current
- entry</a>, and can never happen with <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled-2>replacement enabled</a>. (It happens when the
- user tried to traverse to a session history entry that no longer had a <code id=navigating-across-documents:document-22><a href=#document>Document</a></code>
- object.)</p>
- <dt>Otherwise<dd>
- <ol><li>
- <p>Remove all the entries in the <a href=#browsing-context id=navigating-across-documents:browsing-context-30>browsing context</a>'s <a href=#session-history id=navigating-across-documents:session-history-2>session
- history</a> after the <a href=#current-entry id=navigating-across-documents:current-entry-4>current entry</a>. If the <a href=#current-entry id=navigating-across-documents:current-entry-5>current entry</a> is
- the last entry in the session history, then no entries are removed.</p>
- <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the
- user agent's user interface.</p>
- <li><p>Append a new entry at the end of the <code id=navigating-across-documents:history-3><a href=#history-3>History</a></code> object representing the new
- resource and its <code id=navigating-across-documents:document-23><a href=#document>Document</a></code> object and related state.<li><p><a href=#traverse-the-history id=navigating-across-documents:traverse-the-history-2>Traverse the history</a> to the new entry. If the navigation was initiated
- with <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled-3>replacement enabled</a>, then the traversal must itself be initiated with
- <a href=#replacement-enabled id=navigating-across-documents:replacement-enabled-4>replacement enabled</a>.</p>
- </ol>
- </dl>
- <li><p>The <a href=#navigate id=navigating-across-documents:navigate-18>navigation algorithm</a> has now <dfn id=concept-navigate-mature>matured</dfn>.<li><p><i>Fragment identifier loop</i>: <a href=#spin-the-event-loop id=navigating-across-documents:spin-the-event-loop>Spin the event loop</a> for a user-agent-defined
- amount of time, as desired by the user agent implementor. (This is intended to allow the user
- agent to optimise the user experience in the face of performance concerns.)<li><p>If the <code id=navigating-across-documents:document-24><a href=#document>Document</a></code> object has no parser, or its parser has <a href=#stop-parsing id=navigating-across-documents:stop-parsing>stopped parsing</a>, or the user agent has reason to believe the user is no longer
- interested in scrolling to the fragment identifier, then abort these steps.<li><p><a href=#scroll-to-the-fragment-identifier id=navigating-across-documents:scroll-to-the-fragment-identifier>Scroll to the fragment identifier</a> given in <a id="navigating-across-documents:the-document's-address-7" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's
- address</a>. If this fails to find <a href=#the-indicated-part-of-the-document id=navigating-across-documents:the-indicated-part-of-the-document>an
- indicated part of the document</a>, then return to the <i>fragment identifier loop</i>
- step.</ol>
- <p>The <a href=#task-source id=navigating-across-documents:task-source-2>task source</a> for this <a href=#concept-task id=navigating-across-documents:concept-task-4>task</a> is the
- <a href=#networking-task-source id=navigating-across-documents:networking-task-source>networking task source</a>.</p>
- <h4 id=read-html>7.6.2 <dfn>Page load processing model for HTML files</dfn></h4>
- <p>When an HTML document is to be loaded in a <a href=#browsing-context id=read-html:browsing-context>browsing context</a>, the user agent must
- <a href=#queue-a-task id=read-html:queue-a-task>queue a task</a> to create a <code id=read-html:document><a href=#document>Document</a></code> object, mark it as being an <a href=#html-documents id=read-html:html-documents>HTML document</a>, set its <a href=#concept-document-content-type id=read-html:concept-document-content-type>content type</a> to "<code>text/html</code>",
- <a href=#initialise-the-document-object id=read-html:initialise-the-document-object>initialise the <code>Document</code> object</a>, and finally create an <a href=#html-parser id=read-html:html-parser>HTML
- parser</a> and associate it with the <code id=read-html:document-2><a href=#document>Document</a></code>. Each <a href=#concept-task id=read-html:concept-task>task</a> that the <a href=#networking-task-source id=read-html:networking-task-source>networking task source</a> places on the
- <a href=#task-queue id=read-html:task-queue>task queue</a> while the <a href=#fetch id=read-html:fetch>fetching algorithm</a> runs must then
- fill the parser's <a href=#the-input-byte-stream id=read-html:the-input-byte-stream>input byte stream</a> with the fetched bytes and cause the <a href=#html-parser id=read-html:html-parser-2>HTML
- parser</a> to perform the appropriate processing of the input stream.</p>
- <p class=note>The <a href=#the-input-byte-stream id=read-html:the-input-byte-stream-2>input byte stream</a> converts bytes into characters for use in the
- <a href=#tokenization id=read-html:tokenization>tokenizer</a>. This process relies, in part, on character encoding
- information found in the real <a href=#content-type id=read-html:content-type>Content-Type metadata</a> of the
- resource; the "sniffed type" is not used for this purpose.</p>
-
- <p>When no more bytes are available, the user agent must <a href=#queue-a-task id=read-html:queue-a-task-2>queue a task</a> for the parser
- to process the implied EOF character, which eventually causes a <code id=read-html:event-load><a href=#event-load>load</a></code> event to be fired.</p>
- <p>After creating the <code id=read-html:document-3><a href=#document>Document</a></code> object, but before any script execution, certainly
- before the parser <a href=#stop-parsing id=read-html:stop-parsing>stops</a>, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-html:update-the-session-history-with-the-new-page>update the
- session history with the new page</a>.</p>
- <p class=note><a href=#concept-appcache-init id=read-html:concept-appcache-init>Application cache selection</a> happens <a href=#parser-appcache>in the HTML parser</a>.</p>
- <p>The <a href=#task-source id=read-html:task-source>task source</a> for the two tasks mentioned in this section must be the
- <a href=#networking-task-source id=read-html:networking-task-source-2>networking task source</a>.</p>
- <h4 id=read-xml>7.6.3 <dfn>Page load processing model for XML files</dfn></h4>
- <p>When faced with displaying an XML file inline, user agents must follow the requirements defined
- in the XML and Namespaces in XML recommendations, RFC 3023, DOM, and other relevant specifications
- to create a <code id=read-xml:document><a href=#document>Document</a></code> object and a corresponding <a href=#xml-parser id=read-xml:xml-parser>XML parser</a>. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsRFC3023>[RFC3023]</a> <a href=#refsDOM>[DOM]</a></p>
- <p class=note>At the time of writing, the XML specification community had not actually yet
- specified how XML and the DOM interact.</p>
- <p>After the <code id=read-xml:document-2><a href=#document>Document</a></code> is created, the user agent must <a href=#initialise-the-document-object id=read-xml:initialise-the-document-object>initialise the
- <code>Document</code> object</a>.</p>
- <p>The actual HTTP headers and other metadata, not the headers as mutated or implied by the
- algorithms given in this specification, are the ones that must be used when determining the
- character encoding according to the rules given in the above specifications. Once the character
- encoding is established, the <a href="#document's-character-encoding" id="read-xml:document's-character-encoding">document's character encoding</a> must be set to that
- character encoding.</p>
- <p>If the root element, as parsed according to the XML specifications cited above, is found to be
- an <code id=read-xml:the-html-element><a href=#the-html-element>html</a></code> element with an attribute <code id=read-xml:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
- whose value is not the empty string, then, as soon as the element is <a href=#insert-an-element-into-a-document id=read-xml:insert-an-element-into-a-document>inserted into the document</a>, the user agent must <a href=#resolve-a-url id=read-xml:resolve-a-url>resolve</a> the value of that attribute relative to that element, and if
- that is successful, must apply the <a href=#concept-url-serialiser id=read-xml:concept-url-serialiser>URL serialiser</a>
- algorithm to the resulting <a href=#parsed-url id=read-xml:parsed-url>parsed URL</a> with the <i>exclude fragment flag</i> set to
- obtain <var>manifest URL</var>, and then run the <a href=#concept-appcache-init id=read-xml:concept-appcache-init>application
- cache selection algorithm</a> with <var>manifest URL</var> as the manifest URL, passing in the
- newly-created <code id=read-xml:document-3><a href=#document>Document</a></code>. Otherwise, if the attribute is absent, its value is the empty
- string, or resolving its value fails, then as soon as the root element is <a href=#insert-an-element-into-a-document id=read-xml:insert-an-element-into-a-document-2>inserted into the document</a>, the user agent must run the <a href=#concept-appcache-init id=read-xml:concept-appcache-init-2>application cache selection algorithm</a> with no manifest, and
- passing in the <code id=read-xml:document-4><a href=#document>Document</a></code>.</p>
- <p class=note>Because the processing of the <code id=read-xml:attr-html-manifest-2><a href=#attr-html-manifest>manifest</a></code>
- attribute happens only once the root element is parsed, any URLs referenced by processing
- instructions before the root element (such as <code><?xml-stylesheet?></code> PIs)
- will be fetched from the network and cannot be cached.</p>
- <p>User agents may examine the namespace of the root <code id=read-xml:element><a href=#element>Element</a></code> node of this
- <code id=read-xml:document-5><a href=#document>Document</a></code> object to perform namespace-based dispatch to alternative processing tools,
- e.g. determining that the content is actually a syndication feed and passing it to a feed handler.
- If such processing is to take place, abort the steps in this section, and jump to <a href=#navigate-non-Document>the next step</a> (labeled <i>non-document content</i>) in the
- <a href=#navigate id=read-xml:navigate>navigate</a> steps above.</p>
- <p>Otherwise, then, with the newly created <code id=read-xml:document-6><a href=#document>Document</a></code>, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-xml:update-the-session-history-with-the-new-page>update
- the session history with the new page</a>. User agents may do this before the complete document
- has been parsed (thus achieving <i>incremental rendering</i>), and must do this before any scripts
- are to be executed.</p>
- <p>Error messages from the parse process (e.g. XML namespace well-formedness errors) may be
- reported inline by mutating the <code id=read-xml:document-7><a href=#document>Document</a></code>.</p>
- <h4 id=read-text>7.6.4 <dfn>Page load processing model for text files</dfn></h4>
- <p>When a plain text document is to be loaded in a <a href=#browsing-context id=read-text:browsing-context>browsing context</a>, the user agent
- must <a href=#queue-a-task id=read-text:queue-a-task>queue a task</a> to create a <code id=read-text:document><a href=#document>Document</a></code> object, mark it as being an <a href=#html-documents id=read-text:html-documents>HTML document</a>, set its <a href=#concept-document-content-type id=read-text:concept-document-content-type>content type</a> to "<code>text/plain</code>",
- <a href=#initialise-the-document-object id=read-text:initialise-the-document-object>initialise the <code>Document</code> object</a>, create an <a href=#html-parser id=read-text:html-parser>HTML parser</a>,
- associate it with the <code id=read-text:document-2><a href=#document>Document</a></code>, act as if the tokenizer had emitted a start tag token
- with the tag name "pre" followed by a single U+000A LINE FEED (LF) character, and switch the <a href=#html-parser id=read-text:html-parser-2>HTML
- parser</a>'s tokenizer to the <a href=#plaintext-state id=read-text:plaintext-state>PLAINTEXT state</a>. Each <a href=#concept-task id=read-text:concept-task>task</a> that the <a href=#networking-task-source id=read-text:networking-task-source>networking task source</a> places on the
- <a href=#task-queue id=read-text:task-queue>task queue</a> while the <a href=#fetch id=read-text:fetch>fetching algorithm</a> runs must then
- fill the parser's <a href=#the-input-byte-stream id=read-text:the-input-byte-stream>input byte stream</a> with the fetched bytes and cause the <a href=#html-parser id=read-text:html-parser-3>HTML
- parser</a> to perform the appropriate processing of the input stream.</p>
- <p>The rules for how to convert the bytes of the plain text document into actual characters, and
- the rules for actually rendering the text to the user, are defined in RFC 2046, RFC 3676, and
- subsequent versions thereof. <a href=#refsRFC2046>[RFC2046]</a> <a href=#refsRFC3676>[RFC3676]</a></p>
- <p>The <a href="#document's-character-encoding" id="read-text:document's-character-encoding">document's character encoding</a> must be set to the character encoding used to
- decode the document.</p>
- <p>Upon creation of the <code id=read-text:document-3><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init id=read-text:concept-appcache-init>application cache selection algorithm</a> with no manifest, and
- passing in the newly-created <code id=read-text:document-4><a href=#document>Document</a></code>.</p>
-
- <p>When no more bytes are available, the user agent must <a href=#queue-a-task id=read-text:queue-a-task-2>queue a task</a> for the parser
- to process the implied EOF character, which eventually causes a <code id=read-text:event-load><a href=#event-load>load</a></code> event to be fired.</p>
- <p>After creating the <code id=read-text:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
- parsing, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-text:update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
- <p>User agents may add content to the <code id=read-text:the-head-element><a href=#the-head-element>head</a></code> element of the <code id=read-text:document-6><a href=#document>Document</a></code>, e.g.
- linking to a style sheet or a binding, providing script, giving the document a
- <code id=read-text:the-title-element><a href=#the-title-element>title</a></code>, etc.</p>
- <p class=note>In particular, if the user agent supports the <code>Format=Flowed</code>
- feature of RFC 3676 then the user agent would need to apply extra styling to cause the text to
- wrap correctly and to handle the quoting feature. This could be performed using, e.g., a
- binding or a CSS extension.</p>
- <p>The <a href=#task-source id=read-text:task-source>task source</a> for the two tasks mentioned in this section must be the
- <a href=#networking-task-source id=read-text:networking-task-source-2>networking task source</a>.</p>
- <h4 id=read-multipart-x-mixed-replace>7.6.5 <dfn>Page load processing model for <code>multipart/x-mixed-replace</code> resources</dfn></h4>
- <p>When a resource with the type <code id=read-multipart-x-mixed-replace:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> is to be loaded in a
- <a href=#browsing-context id=read-multipart-x-mixed-replace:browsing-context>browsing context</a>, the user agent must parse the resource using the rules for
- multipart types. <a href=#refsRFC2046>[RFC2046]</a></p>
- <p>For each body part obtained from the resource, the user agent must run a new instance of the
- <a href=#navigate id=read-multipart-x-mixed-replace:navigate>navigate</a> algorithm, starting from the <i>resource handling</i> step, using the new
- body part as the resource being navigated, with <a href=#replacement-enabled id=read-multipart-x-mixed-replace:replacement-enabled>replacement enabled</a> if a previous
- body part from the same resource resulted in a <code id=read-multipart-x-mixed-replace:document><a href=#document>Document</a></code> object being created and
- <a href=#initialise-the-document-object id=read-multipart-x-mixed-replace:initialise-the-document-object>initialized</a>, and otherwise using the same
- setup as the <a href=#navigate id=read-multipart-x-mixed-replace:navigate-2>navigate</a> attempt that caused this section to be invoked in the first
- place.</p>
- <p>For the purposes of algorithms processing these body parts as if they were complete stand-alone
- resources, the user agent must act as if there were no more bytes for those resources whenever the
- boundary following the body part is reached.</p>
- <p class=note>Thus, <code id=read-multipart-x-mixed-replace:event-load><a href=#event-load>load</a></code> events (and for that matter <code id=read-multipart-x-mixed-replace:event-unload><a href=#event-unload>unload</a></code> events) do fire for each body part loaded.</p>
- <h4 id=read-media>7.6.6 <dfn>Page load processing model for media</dfn></h4>
- <p>When an image, video, or audio resource is to be loaded in a <a href=#browsing-context id=read-media:browsing-context>browsing context</a>, the
- user agent should create a <code id=read-media:document><a href=#document>Document</a></code> object, mark it as being an <a href=#html-documents id=read-media:html-documents>HTML document</a>, set its <a href=#concept-document-content-type id=read-media:concept-document-content-type>content
- type</a> to the sniffed MIME type of the resource (<var>type</var> in the
- <a href=#navigate id=read-media:navigate>navigate</a> algorithm), <a href=#initialise-the-document-object id=read-media:initialise-the-document-object>initialise the <code>Document</code> object</a>, append
- an <code id=read-media:the-html-element><a href=#the-html-element>html</a></code> element to the <code id=read-media:document-2><a href=#document>Document</a></code>, append a <code id=read-media:the-head-element><a href=#the-head-element>head</a></code> element and
- a <code id=read-media:the-body-element><a href=#the-body-element>body</a></code> element to the <code id=read-media:the-html-element-2><a href=#the-html-element>html</a></code> element, append an element <var>host element</var> for the media, as described below, to the <code id=read-media:the-body-element-2><a href=#the-body-element>body</a></code> element,
- and set the appropriate attribute of the element <var>host element</var>, as described
- below, to the address of the image, video, or audio resource.</p>
- <p>The element <var>host element</var> to create for the media is the element given in
- the table below in the second cell of the row whose first cell describes the media. The
- appropriate attribute to set is the one given by the third cell in that same row.</p>
- <table><thead><tr><th> Type of media
- <th> Element for the media
- <th> Appropriate attribute
- <tr><td> Image
- <td> <code id=read-media:the-img-element><a href=#the-img-element>img</a></code>
- <td> <code id=read-media:attr-img-src><a href=#attr-img-src>src</a></code>
- <tr><td> Video
- <td> <code id=read-media:the-video-element><a href=#the-video-element>video</a></code>
- <td> <code id=read-media:attr-media-src><a href=#attr-media-src>src</a></code>
- <tr><td> Audio
- <td> <code id=read-media:the-audio-element><a href=#the-audio-element>audio</a></code>
- <td> <code id=read-media:attr-media-src-2><a href=#attr-media-src>src</a></code>
- </table>
-
- <p>Then, the user agent must act as if it had <a href=#stop-parsing id=read-media:stop-parsing>stopped
- parsing</a>.</p>
- <p>Upon creation of the <code id=read-media:document-3><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init id=read-media:concept-appcache-init>application cache selection algorithm</a> with no manifest, and
- passing in the newly-created <code id=read-media:document-4><a href=#document>Document</a></code>.</p>
- <p>After creating the <code id=read-media:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
- fully loading, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-media:update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
- <p>User agents may add content to the <code id=read-media:the-head-element-2><a href=#the-head-element>head</a></code> element of the <code id=read-media:document-6><a href=#document>Document</a></code>, or
- attributes to the element <var>host element</var>, e.g. to link to a style sheet or a
- binding, to provide a script, to give the document a <code id=read-media:the-title-element><a href=#the-title-element>title</a></code>, to make the media
- <a href=#attr-media-autoplay id=read-media:attr-media-autoplay>autoplay</a>, etc.</p>
- <h4 id=read-plugin>7.6.7 <dfn>Page load processing model for content that uses plugins</dfn></h4>
- <p>When a resource that requires an external resource to be rendered is to be loaded in a
- <a href=#browsing-context id=read-plugin:browsing-context>browsing context</a>, the user agent should create a <code id=read-plugin:document><a href=#document>Document</a></code> object, mark
- it as being an <a href=#html-documents id=read-plugin:html-documents>HTML document</a> and mark it as being a
- <dfn id=plugin-document>plugin document</dfn>, set its <a href=#concept-document-content-type id=read-plugin:concept-document-content-type>content
- type</a> to the sniffed MIME type of the resource (<var>type</var> in the
- <a href=#navigate id=read-plugin:navigate>navigate</a> algorithm), <a href=#initialise-the-document-object id=read-plugin:initialise-the-document-object>initialise the <code>Document</code> object</a>, append
- an <code id=read-plugin:the-html-element><a href=#the-html-element>html</a></code> element to the <code id=read-plugin:document-2><a href=#document>Document</a></code>, append a <code id=read-plugin:the-head-element><a href=#the-head-element>head</a></code> element and
- a <code id=read-plugin:the-body-element><a href=#the-body-element>body</a></code> element to the <code id=read-plugin:the-html-element-2><a href=#the-html-element>html</a></code> element, append an <code id=read-plugin:the-embed-element><a href=#the-embed-element>embed</a></code> to the
- <code id=read-plugin:the-body-element-2><a href=#the-body-element>body</a></code> element, and set the <code id=read-plugin:attr-embed-src><a href=#attr-embed-src>src</a></code> attribute of the
- <code id=read-plugin:the-embed-element-2><a href=#the-embed-element>embed</a></code> element to the address of the resource.</p>
- <p class=note>The term <a href=#plugin-document id=read-plugin:plugin-document>plugin document</a> is used by the Content Security Policy
- specification as part of the mechanism that ensures <code id=read-plugin:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s can't be used to evade
- <code>plugin-types</code> directives. <a href=#refsCSP>[CSP]</a></p>
-
- <p>Then, the user agent must act as if it had <a href=#stop-parsing id=read-plugin:stop-parsing>stopped
- parsing</a>.</p>
- <p>Upon creation of the <code id=read-plugin:document-3><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init id=read-plugin:concept-appcache-init>application cache selection algorithm</a> with no manifest, and
- passing in the newly-created <code id=read-plugin:document-4><a href=#document>Document</a></code>.</p>
- <p>After creating the <code id=read-plugin:document-5><a href=#document>Document</a></code> object, but potentially before the page has finished
- fully loading, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-plugin:update-the-session-history-with-the-new-page>update the session history with the new page</a>.</p>
- <p>User agents may add content to the <code id=read-plugin:the-head-element-2><a href=#the-head-element>head</a></code> element of the <code id=read-plugin:document-6><a href=#document>Document</a></code>, or
- attributes to the <code id=read-plugin:the-embed-element-3><a href=#the-embed-element>embed</a></code> element, e.g. to link to a style sheet or a binding, or
- to give the document a <code id=read-plugin:the-title-element><a href=#the-title-element>title</a></code>.</p>
- <p id=sandboxPluginNavigate class=note>If the <code id=read-plugin:document-7><a href=#document>Document</a></code>'s <a href=#active-sandboxing-flag-set id=read-plugin:active-sandboxing-flag-set>active sandboxing
- flag set</a> has its <a href=#sandboxed-plugins-browsing-context-flag id=read-plugin:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> set, the synthesized
- <code id=read-plugin:the-embed-element-4><a href=#the-embed-element>embed</a></code> element will <a href=#sandboxPluginEmbed>fail to render the content</a> if
- the relevant <a href=#plugin id=read-plugin:plugin>plugin</a> cannot be <a href=#concept-plugin-secure id=read-plugin:concept-plugin-secure>secured</a>.</p>
- <h4 id=read-ua-inline>7.6.8 <dfn>Page load processing model for inline
- content that doesn't have a DOM</dfn></h4>
- <p>When the user agent is to display a user agent page inline in a <a href=#browsing-context id=read-ua-inline:browsing-context>browsing context</a>,
- the user agent should create a <code id=read-ua-inline:document><a href=#document>Document</a></code> object, mark it as being an <a href=#html-documents id=read-ua-inline:html-documents>HTML document</a>, set its <a href=#concept-document-content-type id=read-ua-inline:concept-document-content-type>content type</a> to "<code>text/html</code>",
- <a href=#initialise-the-document-object id=read-ua-inline:initialise-the-document-object>initialise the <code>Document</code> object</a>, and then either associate that
- <code id=read-ua-inline:document-2><a href=#document>Document</a></code> with a custom rendering that is not rendered using the normal
- <code id=read-ua-inline:document-3><a href=#document>Document</a></code> rendering rules, or mutate that <code id=read-ua-inline:document-4><a href=#document>Document</a></code> until it represents
- the content the user agent wants to render.</p>
-
- <p>Once the page has been set up, the user agent must act as if it had <a href=#stop-parsing id=read-ua-inline:stop-parsing>stopped parsing</a>.</p>
- <p>Upon creation of the <code id=read-ua-inline:document-5><a href=#document>Document</a></code> object, the user agent must run the <a href=#concept-appcache-init id=read-ua-inline:concept-appcache-init>application cache selection algorithm</a> with no manifest,
- passing in the newly-created <code id=read-ua-inline:document-6><a href=#document>Document</a></code>.</p>
- <p>After creating the <code id=read-ua-inline:document-7><a href=#document>Document</a></code> object, but potentially before the page has been
- completely set up, the user agent must <a href=#update-the-session-history-with-the-new-page id=read-ua-inline:update-the-session-history-with-the-new-page>update the session history with the new
- page</a>.</p>
- <h4 id=scroll-to-fragid>7.6.9 <dfn>Navigating to a fragment identifier</dfn></h4>
- <p>When a user agent is supposed to navigate to a fragment identifier, then the user agent must
- run the following steps:</p>
- <ol><li>
- <p>Remove all the entries in the <a href=#browsing-context id=scroll-to-fragid:browsing-context>browsing context</a>'s <a href=#session-history id=scroll-to-fragid:session-history>session history</a>
- after the <a href=#current-entry id=scroll-to-fragid:current-entry>current entry</a>. If the <a href=#current-entry id=scroll-to-fragid:current-entry-2>current entry</a> is the last entry in the
- session history, then no entries are removed.</p>
- <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
- agent's user interface.</p>
- <li><p>Remove any <a href=#concept-task id=scroll-to-fragid:concept-task>tasks</a> queued by the <a href=#history-traversal-task-source id=scroll-to-fragid:history-traversal-task-source>history traversal
- task source</a> that are associated with any <code id=scroll-to-fragid:document><a href=#document>Document</a></code> objects in the
- <a href=#top-level-browsing-context id=scroll-to-fragid:top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family id=scroll-to-fragid:document-family>document family</a>.<li><p>Append a new entry at the end of the <code id=scroll-to-fragid:history-3><a href=#history-3>History</a></code> object representing the new
- resource and its <code id=scroll-to-fragid:document-2><a href=#document>Document</a></code> object and related state. Its <a href=#url id=scroll-to-fragid:url>URL</a> must be set
- to the address to which the user agent was <a href=#navigate id=scroll-to-fragid:navigate>navigating</a>. The title
- must be left unset.<li><p><a href=#traverse-the-history id=scroll-to-fragid:traverse-the-history>Traverse the history</a> to the new entry, with the <i>asynchronous events</i> flag
- set. This will <a href=#scroll-to-the-fragment-identifier id=scroll-to-fragid:scroll-to-the-fragment-identifier>scroll to the fragment
- identifier</a> given in what is now <a id="scroll-to-fragid:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a>.</ol>
- <p class=note>If the scrolling fails because the relevant <a href=#concept-id id=scroll-to-fragid:concept-id>ID</a> has
- not yet been parsed, then the original <a href=#navigate id=scroll-to-fragid:navigate-2>navigation</a> algorithm will
- take care of the scrolling instead, as the last few steps of its <a href=#update-the-session-history-with-the-new-page id=scroll-to-fragid:update-the-session-history-with-the-new-page>update the session history
- with the new page</a> algorithm.</p>
- <hr>
- <p>When the user agent is required to <dfn id=scroll-to-the-fragment-identifier>scroll to the fragment identifier</dfn> and <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document>the
- indicated part of the document</a>, if any, is <a href=#being-rendered id=scroll-to-fragid:being-rendered>being rendered</a>, the user agent must
- either change the scrolling position of the document using the following algorithm, or perform
- some other action such that <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-2>the indicated part of the document</a> is brought to the
- user's attention. If there is no indicated part, or if the indicated part is not <a href=#being-rendered id=scroll-to-fragid:being-rendered-2>being
- rendered</a>, then the user agent must do nothing. The aforementioned algorithm is as
- follows:</p>
- <ol><li><p>Let <var>target</var> be <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-3>the indicated part of the
- document</a>, as defined below.<li><p>If <var>target</var> is the top of the document, then <a href=#scroll-to-the-beginning-of-the-document id=scroll-to-fragid:scroll-to-the-beginning-of-the-document>scroll to the
- beginning of the document</a> for the <code id=scroll-to-fragid:document-3><a href=#document>Document</a></code>, and abort these steps. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a><li><p>Use the <a href=#scroll-an-element-into-view id=scroll-to-fragid:scroll-an-element-into-view>scroll an element into view</a> algorithm to scroll <var>target</var> into view, with the <var>align to top flag</var> set. <a href=#refsCSSOMVIEW>[CSSOMVIEW]</a><li><p>Run the <a href=#focusing-steps id=scroll-to-fragid:focusing-steps>focusing steps</a> for that element.</ol>
- <p><dfn id=the-indicated-part-of-the-document>The indicated part of the document</dfn> is the one that the fragment identifier, if any,
- identifies. The semantics of the fragment identifier in terms of mapping it to a specific DOM Node
- is defined by the specification that defines the <a href=#mime-type id=scroll-to-fragid:mime-type>MIME type</a> used by the
- <code id=scroll-to-fragid:document-4><a href=#document>Document</a></code> (for example, the processing of fragment identifiers for <a href=#xml-mime-type id=scroll-to-fragid:xml-mime-type>XML MIME types</a> is the responsibility of RFC3023). <a href=#refsRFC3023>[RFC3023]</a></p>
- <p>For HTML documents (and <a href=#html-mime-type id=scroll-to-fragid:html-mime-type>HTML MIME types</a>), the following
- processing model must be followed to determine what <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-4>the indicated part of the
- document</a> is.</p>
- <ol><li><p>Apply the <a href=#url-parser id=scroll-to-fragid:url-parser>URL parser</a> algorithm to the <a href=#url id=scroll-to-fragid:url-2>URL</a>, and let <var>fragid</var> be the <a href=#concept-url-fragment id=scroll-to-fragid:concept-url-fragment>fragment</a> component of the
- resulting <a href=#parsed-url id=scroll-to-fragid:parsed-url>parsed URL</a>.<li><p>If <var>fragid</var> is the empty string, then <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-5>the indicated part of the
- document</a> is the top of the document; stop the algorithm here.<li><p>Let <var>fragid bytes</var> be the result of <a href=#percent-decode id=scroll-to-fragid:percent-decode>percent-decoding</a> <var>fragid</var>.<li><p>Let <var>decoded fragid</var> be the result of applying the <a href=#utf-8-decoder id=scroll-to-fragid:utf-8-decoder>UTF-8
- decoder</a> algorithm to <var>fragid bytes</var>. If the <a href=#utf-8-decoder id=scroll-to-fragid:utf-8-decoder-2>UTF-8 decoder</a>
- emits a <a href=#decoder-error id=scroll-to-fragid:decoder-error>decoder error</a>, abort the decoder and instead jump to the step labeled <i>no
- decoded fragid</i>.<li><p>If there is an element in the DOM that has an <a href=#concept-id id=scroll-to-fragid:concept-id-2>ID</a> exactly
- equal to <var>decoded fragid</var>, then the first such element in <a href=#tree-order id=scroll-to-fragid:tree-order>tree order</a> is
- <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-6>the indicated part of the document</a>; stop the algorithm here.<li><p><i>No decoded fragid</i>: If there is an <code id=scroll-to-fragid:the-a-element><a href=#the-a-element>a</a></code> element in the DOM that has a <code id=scroll-to-fragid:attr-a-name><a href=#attr-a-name>name</a></code> attribute whose value is exactly equal to <var>fragid</var> (<em>not</em> <var>decoded fragid</var>), then the first such
- element in <a href=#tree-order id=scroll-to-fragid:tree-order-2>tree order</a> is <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-7>the indicated part of the document</a>; stop the algorithm
- here.<li><p>If <var>fragid</var> is an <a href=#ascii-case-insensitive id=scroll-to-fragid:ascii-case-insensitive>ASCII case-insensitive</a> match for the
- string <code>top</code>, then <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-8>the indicated part of the document</a> is the top
- of the document; stop the algorithm here.<li><p>Otherwise, there is no <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-9>indicated part of
- the document</a>.</ol>
- <p>For the purposes of the interaction of HTML with Selectors' <dfn id=selector-target><code>:target</code></dfn> pseudo-class, the <dfn id=target-element><i>target element</i></dfn>
- is <a href=#the-indicated-part-of-the-document id=scroll-to-fragid:the-indicated-part-of-the-document-10>the indicated part of the document</a>, if that is an element; otherwise there is no
- <i id=scroll-to-fragid:target-element><a href=#target-element>target element</a></i>. <a href=#refsSELECTORS>[SELECTORS]</a></p>
- <p>The <a href=#task-source id=scroll-to-fragid:task-source>task source</a> for the task mentioned in this section must be the <a href=#dom-manipulation-task-source id=scroll-to-fragid:dom-manipulation-task-source>DOM
- manipulation task source</a>.</p>
-
- <h4 id=history-traversal>7.6.10 History traversal</h4>
-
- <p>When a user agent is required to <dfn id=traverse-the-history>traverse the history</dfn> to a <var>specified
- entry</var>, optionally with <a href=#replacement-enabled id=history-traversal:replacement-enabled>replacement enabled</a>, and optionally with the
- <i>asynchronous events</i> flag set, the user agent must act as follows.</p>
- <p class=note>This algorithm is not just invoked when <a href=#traverse-the-history-by-a-delta id=history-traversal:traverse-the-history-by-a-delta>explicitly going back or forwards in the session history</a> — it is also invoked
- in other situations, for example when <a href=#navigate id=history-traversal:navigate>navigating a browsing context</a>,
- as part of <a href=#update-the-session-history-with-the-new-page id=history-traversal:update-the-session-history-with-the-new-page>updating the session history
- with the new page</a>.</p>
- <ol><li>
- <p>If there is no longer a <code id=history-traversal:document><a href=#document>Document</a></code> object for the entry in question,
- <a href=#navigate id=history-traversal:navigate-2>navigate</a> the <a href=#browsing-context id=history-traversal:browsing-context>browsing
- context</a> to the resource for that entry to perform an <a href=#entry-update id=history-traversal:entry-update>entry update</a> of that
- entry, and abort these steps. The "<a href=#navigate id=history-traversal:navigate-3>navigate</a>" algorithm reinvokes this "traverse"
- algorithm to complete the traversal, at which point there <em>is</em> a <code id=history-traversal:document-2><a href=#document>Document</a></code>
- object and so this step gets skipped. The navigation must be done using the same <a href=#source-browsing-context id=history-traversal:source-browsing-context>source
- browsing context</a> as was used the first time this entry was created. (This can never
- happen with <a href=#replacement-enabled id=history-traversal:replacement-enabled-2>replacement enabled</a>.)</p>
- <p class=note>If the resource was obtained usign a non-idempotent action, for example a POST
- form submission, or if the resource is no longer available, for example because the computer is
- now offline and the page wasn't cached, navigating to it again might not be possible. In this
- case, the navigation will result in a different page than previously; for example, it might be
- an error message explaining the problem or offering to resubmit the form.</p>
- <li><p>If the <a href=#current-entry id=history-traversal:current-entry>current entry</a>'s title was not set by the <code id=history-traversal:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code> or <code id=history-traversal:dom-history-replacestate><a href=#dom-history-replacestate>replaceState()</a></code> methods, then set its title to the value
- returned by the <code id=history-traversal:document.title><a href=#document.title>document.title</a></code> IDL attribute.<li><p>If appropriate, update the <a href=#current-entry id=history-traversal:current-entry-2>current entry</a> in the <a href=#browsing-context id=history-traversal:browsing-context-2>browsing
- context</a>'s <code id=history-traversal:document-3><a href=#document>Document</a></code> object's <code id=history-traversal:history-3><a href=#history-3>History</a></code> object to reflect any state
- that the user agent wishes to persist. The entry is then said to be <a href=#an-entry-with-persisted-user-state id=history-traversal:an-entry-with-persisted-user-state>an entry with persisted
- user state</a>.<li><p>If the <var>specified entry</var> has a different <code id=history-traversal:document-4><a href=#document>Document</a></code> object
- than the <a href=#current-entry id=history-traversal:current-entry-3>current entry</a>, then run the following substeps:</p>
- <ol><li><p>Remove any <a href=#concept-task id=history-traversal:concept-task>tasks</a> queued by the <a href=#history-traversal-task-source id=history-traversal:history-traversal-task-source>history traversal
- task source</a> that are associated with any <code id=history-traversal:document-5><a href=#document>Document</a></code> objects in the
- <a href=#top-level-browsing-context id=history-traversal:top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family id=history-traversal:document-family>document family</a>.<li>
- <p>If the <a href=#origin-2 id=history-traversal:origin-2>origin</a> of the <code id=history-traversal:document-6><a href=#document>Document</a></code> of the <var>specified
- entry</var> is not the <a href=#same-origin id=history-traversal:same-origin>same</a> as the <a href=#origin-2 id=history-traversal:origin-2-2>origin</a> of the
- <code id=history-traversal:document-7><a href=#document>Document</a></code> of the <a href=#current-entry id=history-traversal:current-entry-4>current entry</a>, then run the following
- sub-sub-steps:</p>
- <ol><li><p>The current <a href=#browsing-context-name id=history-traversal:browsing-context-name>browsing context name</a> must be stored with all the entries in
- the history that are associated with <code id=history-traversal:document-8><a href=#document>Document</a></code> objects with the <a href=#same-origin id=history-traversal:same-origin-2>same
- origin</a> as the <a href=#active-document id=history-traversal:active-document>active document</a> <em>and</em> that are contiguous with the
- <a href=#current-entry id=history-traversal:current-entry-5>current entry</a>.<li id=resetBCName><p>If the browsing context is a <a href=#top-level-browsing-context id=history-traversal:top-level-browsing-context-2>top-level browsing context</a>,
- but not an <a href=#auxiliary-browsing-context id=history-traversal:auxiliary-browsing-context>auxiliary browsing context</a>, then the browsing context's
- <a href=#browsing-context-name id=history-traversal:browsing-context-name-2>browsing context name</a> must be unset.</ol>
- <li id=appcache-history-2><p>Make the <var>specified entry</var>'s
- <code id=history-traversal:document-9><a href=#document>Document</a></code> object the <a href=#active-document id=history-traversal:active-document-2>active document</a> of the <a href=#browsing-context id=history-traversal:browsing-context-3>browsing
- context</a>.<li>
- <p>If the <var>specified entry</var> has a <a href=#browsing-context-name id=history-traversal:browsing-context-name-3>browsing context name</a> stored
- with it, then run the following sub-sub-steps:</p>
- <ol><li><p>Set the browsing context's <a href=#browsing-context-name id=history-traversal:browsing-context-name-4>browsing context name</a> to the name stored with
- the specified entry.<li><p>Clear any <a href=#browsing-context-name id=history-traversal:browsing-context-name-5>browsing context names</a> stored
- with all entries in the history that are associated with <code id=history-traversal:document-10><a href=#document>Document</a></code> objects with
- the <a href=#same-origin id=history-traversal:same-origin-3>same origin</a> as the new <a href=#active-document id=history-traversal:active-document-3>active document</a> and that are contiguous
- with the specified entry.</ol>
- <li id=history-autocomplete><p>If the <var>specified entry</var>'s
- <code id=history-traversal:document-11><a href=#document>Document</a></code> has any form controls whose <a href=#autofill-field-name id=history-traversal:autofill-field-name>autofill field name</a> is "<code id=history-traversal:attr-fe-autocomplete-off><a href=#attr-fe-autocomplete-off>off</a></code>", invoke the <a href=#concept-form-reset-control id=history-traversal:concept-form-reset-control>reset algorithm</a> of each of those elements.<li>
- <p>If the <a href=#current-document-readiness id=history-traversal:current-document-readiness>current document readiness</a> of the <var>specified entry</var>'s
- <code id=history-traversal:document-12><a href=#document>Document</a></code> is "<code>complete</code>", <a href=#queue-a-task id=history-traversal:queue-a-task>queue a task</a> to run
- the following sub-sub-steps:</p>
- <ol><li><p>If the <code id=history-traversal:document-13><a href=#document>Document</a></code>'s <a href=#page-showing id=history-traversal:page-showing>page showing</a> flag is true, then abort this
- task (i.e. don't fire the event below).<li><p>Set the <code id=history-traversal:document-14><a href=#document>Document</a></code>'s <a href=#page-showing id=history-traversal:page-showing-2>page showing</a> flag to true.<li>
- <p>Run any <dfn id=session-history-document-visibility-change-steps>session history document visibility change steps</dfn> for <code id=history-traversal:document-15><a href=#document>Document</a></code> that
- are defined by <a href=#other-applicable-specifications id=history-traversal:other-applicable-specifications>other applicable specifications</a>.</p>
- <p class=note>This is specifically intended for use by the Page Visibility specification. <a href=#refsPAGEVIS>[PAGEVIS]</a></p>
- <li><p><a href=#concept-event-fire id=history-traversal:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=history-traversal:concept-events-trusted>trusted</a> event with the name <code id=history-traversal:event-pageshow><a href=#event-pageshow>pageshow</a></code> at the <code id=history-traversal:window><a href=#window>Window</a></code> object of that
- <code id=history-traversal:document-16><a href=#document>Document</a></code>, with <i id=history-traversal:concept-event-target-override><a href=#concept-event-target-override>target override</a></i> set to the <code id=history-traversal:document-17><a href=#document>Document</a></code>
- object,
- using the <code id=history-traversal:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code id=history-traversal:dom-pagetransitionevent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialised to true.
- This event must not bubble, must not be cancelable, and has no default action.</ol>
-
- </ol>
- <li><p>Set <a id="history-traversal:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> to the URL of the <var>specified
- entry</var>.<li><p>If the <var>specified entry</var> has a URL whose fragment identifier differs
- from that of the <a href=#current-entry id=history-traversal:current-entry-6>current entry</a>'s when compared in a <a href=#case-sensitive id=history-traversal:case-sensitive>case-sensitive</a>
- manner, and the two share the same <code id=history-traversal:document-18><a href=#document>Document</a></code> object, then let <var>hash
- changed</var> be true, and let <var>old URL</var> be the URL of the <a href=#current-entry id=history-traversal:current-entry-7>current
- entry</a> and <var>new URL</var> be the URL of the <var>specified
- entry</var>. Otherwise, let <var>hash changed</var> be false.<li><p>If the traversal was initiated with <dfn id=replacement-enabled>replacement enabled</dfn>, remove the entry
- immediately before the <var>specified entry</var> in the session history.</p>
- <li><p>If the <var>specified entry</var> is not <a href=#an-entry-with-persisted-user-state id=history-traversal:an-entry-with-persisted-user-state-2>an entry with persisted user
- state</a>, but its URL has a fragment identifier, <a href=#scroll-to-the-fragment-identifier id=history-traversal:scroll-to-the-fragment-identifier>scroll to the fragment
- identifier</a>.<li>
- <p>If the entry is <a href=#an-entry-with-persisted-user-state id=history-traversal:an-entry-with-persisted-user-state-3>an entry with persisted user state</a>, the user agent may update
- aspects of the document and its rendering, for instance the scroll position or values of form
- fields, that it had previously recorded.</p>
-
- <p class=note>This can even include updating the <code id=history-traversal:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute
- of <code id=history-traversal:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements or <code id=history-traversal:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=history-traversal:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in either the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="history-traversal:text-(type=text)-state-and-search-state-(type=search)">Text</a> state or the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="history-traversal:text-(type=text)-state-and-search-state-(type=search)-2">Search</a> state, if the persisted state includes the
- directionality of user input in such controls.</p>
- <li><p>If the entry is a <a href=#state-object id=history-traversal:state-object>state object</a> entry, let <var>state</var> be a
- <a href=#structured-clone id=history-traversal:structured-clone>structured clone</a> of that state object. Otherwise, let <var>state</var> be
- null.<li><p>Set <code id=history-traversal:dom-history-state><a href=#dom-history-state>history.state</a></code> to <var>state</var>.<li><p>Let <var>state changed</var> be true if the <code id=history-traversal:document-19><a href=#document>Document</a></code> of the <var>specified entry</var> has a <a href=#latest-entry id=history-traversal:latest-entry>latest entry</a>, and that entry is not the <var>specified entry</var>; otherwise let it be false.</p>
- <li><p>Let the <a href=#latest-entry id=history-traversal:latest-entry-2>latest entry</a> of the <code id=history-traversal:document-20><a href=#document>Document</a></code> of the <var>specified entry</var> be the <var>specified entry</var>.<li>
- <p>If the <i>asynchronous events</i> flag is not set, then run the following steps
- synchronously. Otherwise, the <i>asynchronous events</i> flag is set; <a href=#queue-a-task id=history-traversal:queue-a-task-2>queue a task</a>
- to run the following substeps.</p>
- <ol><li><p>If <var>state changed</var> is true, <a href=#concept-event-fire id=history-traversal:concept-event-fire-2>fire</a> a <a href=#concept-events-trusted id=history-traversal:concept-events-trusted-2>trusted</a>
- event with the name <code id=history-traversal:event-popstate><a href=#event-popstate>popstate</a></code> at the <code id=history-traversal:window-2><a href=#window>Window</a></code>
- object of the <code id=history-traversal:document-21><a href=#document>Document</a></code>, using the <code id=history-traversal:popstateevent><a href=#popstateevent>PopStateEvent</a></code> interface, with the
- <code id=history-traversal:dom-popstateevent-state><a href=#dom-popstateevent-state>state</a></code> attribute initialised to the value of <var>state</var>. This event must bubble but not be cancelable and has no default
- action.<li><p>If <var>hash changed</var> is true, then <a href=#concept-event-fire id=history-traversal:concept-event-fire-3>fire</a> a <a href=#concept-events-trusted id=history-traversal:concept-events-trusted-3>trusted</a>
- event with the name <code id=history-traversal:event-hashchange><a href=#event-hashchange>hashchange</a></code> at the <a href=#browsing-context id=history-traversal:browsing-context-4>browsing
- context</a>'s <code id=history-traversal:window-3><a href=#window>Window</a></code> object, using the <code id=history-traversal:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code> interface,
- with the <code id=history-traversal:dom-hashchangeevent-oldurl><a href=#dom-hashchangeevent-oldurl>oldURL</a></code> attribute initialised to <var>old URL</var> and the <code id=history-traversal:dom-hashchangeevent-newurl><a href=#dom-hashchangeevent-newurl>newURL</a></code> attribute
- initialised to <var>new URL</var>. This event must bubble but not be cancelable and
- has no default action.</ol>
- <li><p>The <a href=#current-entry id=history-traversal:current-entry-8>current entry</a> is now the <var>specified entry</var>.</ol>
- <p>The <a href=#task-source id=history-traversal:task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source id=history-traversal:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
-
- <h5 id=the-popstateevent-interface>7.6.10.1 The <code id=the-popstateevent-interface:popstateevent><a href=#popstateevent>PopStateEvent</a></code> interface</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#popstateeventinit id=the-popstateevent-interface:popstateeventinit>PopStateEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=popstateevent>PopStateEvent</dfn> : <a href=#event id=the-popstateevent-interface:event>Event</a> {
- readonly attribute any <a href=#dom-popstateevent-state id=the-popstateevent-interface:dom-popstateevent-state>state</a>;
- };
- dictionary <dfn id=popstateeventinit>PopStateEventInit</dfn> : <a href=#eventinit id=the-popstateevent-interface:eventinit>EventInit</a> {
- any state;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-popstateevent-interface:dom-popstateevent-state-2><a href=#dom-popstateevent-state>state</a></code><dd>
- <p>Returns a copy of the information that was provided to <code id=the-popstateevent-interface:dom-history-pushstate><a href=#dom-history-pushstate>pushState()</a></code> or <code id=the-popstateevent-interface:dom-history-replacestate><a href=#dom-history-replacestate>replaceState()</a></code>.</p>
- </dl>
-
- <p>The <dfn id=dom-popstateevent-state><code>state</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents the context information for the event, or null, if the state represented is
- the initial state of the <code id=the-popstateevent-interface:document><a href=#document>Document</a></code>.</p>
-
- <h5 id=the-hashchangeevent-interface>7.6.10.2 The <code id=the-hashchangeevent-interface:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code> interface</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#hashchangeeventinit id=the-hashchangeevent-interface:hashchangeeventinit>HashChangeEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=hashchangeevent>HashChangeEvent</dfn> : <a href=#event id=the-hashchangeevent-interface:event>Event</a> {
- readonly attribute DOMString <a href=#dom-hashchangeevent-oldurl id=the-hashchangeevent-interface:dom-hashchangeevent-oldurl>oldURL</a>;
- readonly attribute DOMString <a href=#dom-hashchangeevent-newurl id=the-hashchangeevent-interface:dom-hashchangeevent-newurl>newURL</a>;
- };
- dictionary <dfn id=hashchangeeventinit>HashChangeEventInit</dfn> : <a href=#eventinit id=the-hashchangeevent-interface:eventinit>EventInit</a> {
- DOMString oldURL;
- DOMString newURL;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-hashchangeevent-interface:dom-hashchangeevent-oldurl-2><a href=#dom-hashchangeevent-oldurl>oldURL</a></code><dd>
- <p>Returns the <a href=#url id=the-hashchangeevent-interface:url>URL</a> of the <a href=#session-history-entry id=the-hashchangeevent-interface:session-history-entry>session history entry</a> that was previously
- current.</p>
- <dt><var>event</var> . <code id=the-hashchangeevent-interface:dom-hashchangeevent-newurl-2><a href=#dom-hashchangeevent-newurl>newURL</a></code><dd>
- <p>Returns the <a href=#url id=the-hashchangeevent-interface:url-2>URL</a> of the <a href=#session-history-entry id=the-hashchangeevent-interface:session-history-entry-2>session history entry</a> that is now
- current.</p>
- </dl>
-
- <p>The <dfn id=dom-hashchangeevent-oldurl><code>oldURL</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents context information for the event, specifically the URL of the <a href=#session-history-entry id=the-hashchangeevent-interface:session-history-entry-3>session
- history entry</a> that was traversed from.</p>
- <p>The <dfn id=dom-hashchangeevent-newurl><code>newURL</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents context information for the event, specifically the URL of the <a href=#session-history-entry id=the-hashchangeevent-interface:session-history-entry-4>session
- history entry</a> that was traversed to.</p>
-
- <h5 id=the-pagetransitionevent-interface>7.6.10.3 The <code id=the-pagetransitionevent-interface:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#pagetransitioneventinit id=the-pagetransitionevent-interface:pagetransitioneventinit>PageTransitionEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=pagetransitionevent>PageTransitionEvent</dfn> : <a href=#event id=the-pagetransitionevent-interface:event>Event</a> {
- readonly attribute boolean <a href=#dom-pagetransitionevent-persisted id=the-pagetransitionevent-interface:dom-pagetransitionevent-persisted>persisted</a>;
- };
- dictionary <dfn id=pagetransitioneventinit>PageTransitionEventInit</dfn> : <a href=#eventinit id=the-pagetransitionevent-interface:eventinit>EventInit</a> {
- boolean persisted;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-pagetransitionevent-interface:dom-pagetransitionevent-persisted-2><a href=#dom-pagetransitionevent-persisted>persisted</a></code><dd>
- <p>For the <code id=the-pagetransitionevent-interface:event-pageshow><a href=#event-pageshow>pageshow</a></code> event, returns false if the page is
- newly being loaded (and the <code id=the-pagetransitionevent-interface:event-load><a href=#event-load>load</a></code> event will fire). Otherwise,
- returns true.</p>
- <p>For the <code id=the-pagetransitionevent-interface:event-pagehide><a href=#event-pagehide>pagehide</a></code> event, returns false if the page is
- going away for the last time. Otherwise, returns true, meaning that (if nothing conspires to
- make the page unsalvageable) the page might be reused if the user navigates back to this
- page.</p>
- <p>Things that can cause the page to be unsalvageable include:</p>
- <ul class=brief><li><code id=the-pagetransitionevent-interface:dom-document-open><a href=#dom-document-open>document.open()</a></code>
- <li>Listening for <code id=the-pagetransitionevent-interface:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code> events
- <li>Listening for <code id=the-pagetransitionevent-interface:event-unload><a href=#event-unload>unload</a></code> events
- <li>Having <code id=the-pagetransitionevent-interface:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s that are not salvageable
- <li>Active <code id=the-pagetransitionevent-interface:websocket><a href=#websocket>WebSocket</a></code> objects
- <li><a href=#abort-a-document id=the-pagetransitionevent-interface:abort-a-document>Aborting a <code>Document</code></a>
- </ul>
- </dl>
-
- <p>The <dfn id=dom-pagetransitionevent-persisted><code>persisted</code></dfn> attribute must
- return the value it was initialised to. When the object is created, this attribute must be
- initialised to false. It represents the context information for the event.</p>
-
- <h4 id=unloading-documents>7.6.11 Unloading documents</h4>
-
- <p>A <code id=unloading-documents:document><a href=#document>Document</a></code> has a <dfn id=concept-document-salvageable><i>salvageable</i></dfn> state, which must initially be
- true, a <dfn id=fired-unload>fired unload</dfn> flag, which must initially be false, and a <dfn id=page-showing>page showing</dfn>
- flag, which must initially be false. The <a href=#page-showing id=unloading-documents:page-showing>page showing</a> flag is used to ensure that
- scripts receive <code id=unloading-documents:event-pageshow><a href=#event-pageshow>pageshow</a></code> and <code id=unloading-documents:event-pagehide><a href=#event-pagehide>pagehide</a></code> events in a consistent manner (e.g. that they never
- receive two <code id=unloading-documents:event-pagehide-2><a href=#event-pagehide>pagehide</a></code> events in a row without an intervening
- <code id=unloading-documents:event-pageshow-2><a href=#event-pageshow>pageshow</a></code>, or vice versa).</p>
- <p><a href=#event-loop id=unloading-documents:event-loop>Event loops</a> have a <dfn id=termination-nesting-level>termination nesting level</dfn>
- counter, which must initially be zero.</p>
- <p>When a user agent is to <dfn id=prompt-to-unload-a-document>prompt to unload a document</dfn>, it must run the following
- steps.</p>
- <ol><li><p>Increase the <a href=#event-loop id=unloading-documents:event-loop-2>event loop</a>'s <a href=#termination-nesting-level id=unloading-documents:termination-nesting-level>termination nesting level</a> by
- one.<li><p>Increase the <code id=unloading-documents:document-2><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter id=unloading-documents:ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> by
- one.<li><p>Let <var>event</var> be a new <a href=#concept-events-trusted id=unloading-documents:concept-events-trusted>trusted</a>
- <code id=unloading-documents:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> event object with the name <code id=unloading-documents:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code>, which does not bubble but is cancelable.<li><p><i>Dispatch</i>: <a href=#concept-event-dispatch id=unloading-documents:concept-event-dispatch>Dispatch</a> <var>event</var> at the <code id=unloading-documents:document-3><a href=#document>Document</a></code>'s <code id=unloading-documents:window><a href=#window>Window</a></code> object.<li><p>Decrease the <a href=#event-loop id=unloading-documents:event-loop-3>event loop</a>'s <a href=#termination-nesting-level id=unloading-documents:termination-nesting-level-2>termination nesting level</a> by
- one.<li><p>Release the <a href=#storage-mutex id=unloading-documents:storage-mutex>storage mutex</a>.<li><p>If any event listeners were triggered by the earlier <i>dispatch</i> step, then set the
- <code id=unloading-documents:document-4><a href=#document>Document</a></code>'s <i id=unloading-documents:concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to
- false.<li>
- <p>If the <code id=unloading-documents:dom-beforeunloadevent-returnvalue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute of the
- <var>event</var> object is not the empty string, or if the event was canceled, then the
- user agent should ask the user to confirm that they wish to unload the document.</p>
- <p>The prompt shown by the user agent may include the string of the <code id=unloading-documents:dom-beforeunloadevent-returnvalue-2><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute, or some leading subset
- thereof. (A user agent may want to truncate the string to 1024 characters for display, for
- instance.)</p>
- <p>The user agent must <a href=#pause id=unloading-documents:pause>pause</a> while waiting for the user's response.</p>
- <p>If the user did not confirm the page navigation, then the user agent <dfn id=refused-to-allow-the-document-to-be-unloaded>refused to allow
- the document to be unloaded</dfn>.</p>
- <li><p>If this algorithm was invoked by another instance of the "prompt to unload a document"
- algorithm (i.e. through the steps below that invoke this algorithm for all descendant browsing
- contexts), then jump to the step labeled <i>end</i>.<li><p>Let <var>descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts id=unloading-documents:list-of-the-descendant-browsing-contexts>list of the descendant browsing
- contexts</a> of the <code id=unloading-documents:document-5><a href=#document>Document</a></code>.<li>
- <p>If <var>descendants</var> is not an empty list, then for each <a href=#browsing-context id=unloading-documents:browsing-context>browsing
- context</a> <var>b</var> in <var>descendants</var> run the following
- substeps:</p>
- <ol><li><p><a href=#prompt-to-unload-a-document id=unloading-documents:prompt-to-unload-a-document>Prompt to unload</a> the <a href=#active-document id=unloading-documents:active-document>active
- document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-2>browsing context</a> <var>b</var>. If the user
- <a href=#refused-to-allow-the-document-to-be-unloaded id=unloading-documents:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be unloaded</a>, then the user implicitly also <a href=#refused-to-allow-the-document-to-be-unloaded id=unloading-documents:refused-to-allow-the-document-to-be-unloaded-2>refused to allow <em>this</em> document to
- be unloaded</a>; jump to the step labeled <i>end</i>.</p>
- <li><p>If the <i id=unloading-documents:concept-document-salvageable-2><a href=#concept-document-salvageable>salvageable</a></i> state of the <a href=#active-document id=unloading-documents:active-document-2>active
- document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-3>browsing context</a> <var>b</var> is false, then set
- the <i id=unloading-documents:concept-document-salvageable-3><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document to
- false also.</ol>
- <li><p><i>End</i>: Decrease the <code id=unloading-documents:document-6><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter id=unloading-documents:ignore-opens-during-unload-counter-2>ignore-opens-during-unload
- counter</a> by one.</ol>
- <p>When a user agent is to <dfn id=unload-a-document>unload a document</dfn>, it must run the following steps. These
- steps are passed an argument, <var>recycle</var>, which is either true or false,
- indicating whether the <code id=unloading-documents:document-7><a href=#document>Document</a></code> object is going to be re-used. (This is set by the
- <code id=unloading-documents:dom-document-open><a href=#dom-document-open>document.open()</a></code> method.)</p>
- <ol><li><p>Increase the <a href=#event-loop id=unloading-documents:event-loop-4>event loop</a>'s <a href=#termination-nesting-level id=unloading-documents:termination-nesting-level-3>termination nesting level</a> by
- one.<li><p>Increase the <code id=unloading-documents:document-8><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter id=unloading-documents:ignore-opens-during-unload-counter-3>ignore-opens-during-unload counter</a> by
- one.<li><p>If the <code id=unloading-documents:document-9><a href=#document>Document</a></code>'s <a href=#page-showing id=unloading-documents:page-showing-2>page showing</a> flag is false, then jump to the
- step labeled <i>unload event</i> below (i.e. skip firing the <code id=unloading-documents:event-pagehide-3><a href=#event-pagehide>pagehide</a></code> event and don't rerun the <a href=#unloading-document-visibility-change-steps id=unloading-documents:unloading-document-visibility-change-steps>unloading document
- visibility change steps</a>).<li><p>Set the <code id=unloading-documents:document-10><a href=#document>Document</a></code>'s <a href=#page-showing id=unloading-documents:page-showing-3>page showing</a> flag to false.<li><p><a href=#concept-event-fire id=unloading-documents:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=unloading-documents:concept-events-trusted-2>trusted</a> event with the name <code id=unloading-documents:event-pagehide-4><a href=#event-pagehide>pagehide</a></code> at the <code id=unloading-documents:window-2><a href=#window>Window</a></code> object of the
- <code id=unloading-documents:document-11><a href=#document>Document</a></code>, with <i id=unloading-documents:concept-event-target-override><a href=#concept-event-target-override>target override</a></i> set to the <code id=unloading-documents:document-12><a href=#document>Document</a></code>
- object, using the <code id=unloading-documents:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface,
- with the <code id=unloading-documents:dom-pagetransitionevent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialized
- to true if the <code id=unloading-documents:document-13><a href=#document>Document</a></code> object's <i id=unloading-documents:concept-document-salvageable-4><a href=#concept-document-salvageable>salvageable</a></i> state is true, and false otherwise. This
- event must not bubble, must not be cancelable, and has no default action.<li>
- <p>Run any <dfn id=unloading-document-visibility-change-steps>unloading document visibility change steps</dfn> for <code id=unloading-documents:document-14><a href=#document>Document</a></code> that
- are defined by <a href=#other-applicable-specifications id=unloading-documents:other-applicable-specifications>other applicable specifications</a>.</p>
- <p class=note>This is specifically intended for use by the Page Visibility specification. <a href=#refsPAGEVIS>[PAGEVIS]</a></p>
- <li><p><i>Unload event</i>: If the <code id=unloading-documents:document-15><a href=#document>Document</a></code>'s <a href=#fired-unload id=unloading-documents:fired-unload>fired unload</a> flag is
- false, <a href=#fire-a-simple-event id=unloading-documents:fire-a-simple-event>fire a simple event</a> named <code id=unloading-documents:event-unload><a href=#event-unload>unload</a></code> at the
- <code id=unloading-documents:document-16><a href=#document>Document</a></code>'s <code id=unloading-documents:window-3><a href=#window>Window</a></code> object, with <i id=unloading-documents:concept-event-target-override-2><a href=#concept-event-target-override>target override</a></i> set to the
- <code id=unloading-documents:document-17><a href=#document>Document</a></code> object.<li><p>Decrease the <a href=#event-loop id=unloading-documents:event-loop-5>event loop</a>'s <a href=#termination-nesting-level id=unloading-documents:termination-nesting-level-4>termination nesting level</a> by
- one.<li><p>Release the <a href=#storage-mutex id=unloading-documents:storage-mutex-2>storage mutex</a>.<li><p>If any event listeners were triggered by the earlier <i>unload event</i> step, then set
- the <code id=unloading-documents:document-18><a href=#document>Document</a></code> object's <i id=unloading-documents:concept-document-salvageable-5><a href=#concept-document-salvageable>salvageable</a></i> state
- to false and set the <code id=unloading-documents:document-19><a href=#document>Document</a></code>'s <a href=#fired-unload id=unloading-documents:fired-unload-2>fired unload</a> flag to true.<li><p>Run any <a href=#unloading-document-cleanup-steps id=unloading-documents:unloading-document-cleanup-steps>unloading document cleanup steps</a> for <code id=unloading-documents:document-20><a href=#document>Document</a></code> that are
- defined by this specification and <a href=#other-applicable-specifications id=unloading-documents:other-applicable-specifications-2>other applicable specifications</a>.<li><p>If this algorithm was invoked by another instance of the "unload a document" algorithm
- (i.e. by the steps below that invoke this algorithm for all descendant browsing contexts), then
- jump to the step labeled <i>end</i>.<li><p>Let <var>descendants</var> be the <a href=#list-of-the-descendant-browsing-contexts id=unloading-documents:list-of-the-descendant-browsing-contexts-2>list of the descendant browsing
- contexts</a> of the <code id=unloading-documents:document-21><a href=#document>Document</a></code>.<li>
- <p>If <var>descendants</var> is not an empty list, then for each <a href=#browsing-context id=unloading-documents:browsing-context-4>browsing
- context</a> <var>b</var> in <var>descendants</var> run the following
- substeps:</p>
- <ol><li><p><a href=#unload-a-document id=unloading-documents:unload-a-document>Unload</a> the <a href=#active-document id=unloading-documents:active-document-3>active document</a> of the
- <a href=#browsing-context id=unloading-documents:browsing-context-5>browsing context</a> <var>b</var> with the <var>recycle</var>
- parameter set to false.<li><p>If the <i id=unloading-documents:concept-document-salvageable-6><a href=#concept-document-salvageable>salvageable</a></i> state of the <a href=#active-document id=unloading-documents:active-document-4>active
- document</a> of the <a href=#browsing-context id=unloading-documents:browsing-context-6>browsing context</a> <var>b</var> is false, then set
- the <i id=unloading-documents:concept-document-salvageable-7><a href=#concept-document-salvageable>salvageable</a></i> state of <em>this</em> document to
- false also.</ol>
- <li><p>If both the <code id=unloading-documents:document-22><a href=#document>Document</a></code>'s <i id=unloading-documents:concept-document-salvageable-8><a href=#concept-document-salvageable>salvageable</a></i> state and <var>recycle</var> are
- false, then the <code id=unloading-documents:document-23><a href=#document>Document</a></code>'s <a href=#browsing-context id=unloading-documents:browsing-context-7>browsing context</a> must <a href=#discard-a-document id=unloading-documents:discard-a-document>discard the <code>Document</code></a>.<li><p><i>End</i>: Decrease the <code id=unloading-documents:document-24><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter id=unloading-documents:ignore-opens-during-unload-counter-4>ignore-opens-during-unload
- counter</a> by one.</ol>
- <p>This specification defines the following <dfn id=unloading-document-cleanup-steps>unloading document cleanup steps</dfn>. Other
- specifications can define more.</p>
- <ol><li>
- <p><a href=#make-disappear id=unloading-documents:make-disappear>Make disappear</a> any <code id=unloading-documents:websocket><a href=#websocket>WebSocket</a></code> objects that were created by the <code id=unloading-documents:dom-websocket><a href=#dom-websocket>WebSocket()</a></code> constructor from the
- <code id=unloading-documents:document-25><a href=#document>Document</a></code>'s <code id=unloading-documents:window-4><a href=#window>Window</a></code> object.</p>
- <p>If this affected any <code id=unloading-documents:websocket-2><a href=#websocket>WebSocket</a></code> objects, then set <code id=unloading-documents:document-26><a href=#document>Document</a></code>'s <i id=unloading-documents:concept-document-salvageable-9><a href=#concept-document-salvageable>salvageable</a></i> state to false.</p>
- <li><p>If the <code id=unloading-documents:document-27><a href=#document>Document</a></code>'s <i id=unloading-documents:concept-document-salvageable-10><a href=#concept-document-salvageable>salvageable</a></i>
- state is false, <a href=#concept-eventsource-forcibly-close id=unloading-documents:concept-eventsource-forcibly-close>forcibly close</a> any
- <code id=unloading-documents:eventsource><a href=#eventsource>EventSource</a></code> objects that whose constructor was invoked from the
- <code id=unloading-documents:document-28><a href=#document>Document</a></code>'s <code id=unloading-documents:window-5><a href=#window>Window</a></code> object.<li><p>If the <code id=unloading-documents:document-29><a href=#document>Document</a></code>'s <i id=unloading-documents:concept-document-salvageable-11><a href=#concept-document-salvageable>salvageable</a></i>
- state is false, empty the <code id=unloading-documents:document-30><a href=#document>Document</a></code>'s <code id=unloading-documents:window-6><a href=#window>Window</a></code>'s <a href=#list-of-active-timers id=unloading-documents:list-of-active-timers>list of active
- timers</a>.</ol>
-
- <h5 id=the-beforeunloadevent-interface>7.6.11.1 The <code id=the-beforeunloadevent-interface:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> interface</h5>
- <pre class=idl>interface <dfn id=beforeunloadevent>BeforeUnloadEvent</dfn> : <a href=#event id=the-beforeunloadevent-interface:event>Event</a> {
- attribute DOMString <a href=#dom-beforeunloadevent-returnvalue id=the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue>returnValue</a>;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-beforeunloadevent-interface:dom-beforeunloadevent-returnvalue-2><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current return value of the event (the message to show the user).</p>
- <p>Can be set, to update the message.</p>
- </dl>
- <p class=note>There are no <code id=the-beforeunloadevent-interface:beforeunloadevent-2><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>-specific initialization methods.</p>
-
- <p>The <dfn id=dom-beforeunloadevent-returnvalue><code>returnValue</code></dfn> attribute
- represents the message to show the user. When the event is created, the attribute must be set to
- the empty string. On getting, it must return the last value it was set to. On setting, the
- attribute must be set to the new value.</p>
-
-
- <h4 id=aborting-a-document-load>7.6.12 Aborting a document load</h4>
- <p>If a <code id=aborting-a-document-load:document><a href=#document>Document</a></code> is <dfn id=abort-a-document>aborted</dfn>, the user agent must
- run the following steps:</p>
- <ol><li><p><a href=#abort-a-document id=aborting-a-document-load:abort-a-document>Abort</a> the <a href=#active-document id=aborting-a-document-load:active-document>active
- documents</a> of every <a href=#child-browsing-context id=aborting-a-document-load:child-browsing-context>child browsing context</a>. If this results in any of those
- <code id=aborting-a-document-load:document-2><a href=#document>Document</a></code> objects having their <i id=aborting-a-document-load:concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state set to false, then set this
- <code id=aborting-a-document-load:document-3><a href=#document>Document</a></code>'s <i id=aborting-a-document-load:concept-document-salvageable-2><a href=#concept-document-salvageable>salvageable</a></i> state to false
- also.<li><p>Cancel any instances of the <a href=#fetch id=aborting-a-document-load:fetch>fetch</a> algorithm in the context of
- this <code id=aborting-a-document-load:document-4><a href=#document>Document</a></code>, discarding any <a href=#concept-task id=aborting-a-document-load:concept-task>tasks</a> <a href=#queue-a-task id=aborting-a-document-load:queue-a-task>queued</a> for them, and discarding any further data received from the
- network for them. If this resulted in any instances of the <a href=#fetch id=aborting-a-document-load:fetch-2>fetch</a>
- algorithm being canceled or any <a href=#queue-a-task id=aborting-a-document-load:queue-a-task-2>queued</a> <a href=#concept-task id=aborting-a-document-load:concept-task-2>tasks</a> or any network data getting discarded, then set the
- <code id=aborting-a-document-load:document-5><a href=#document>Document</a></code>'s <i id=aborting-a-document-load:concept-document-salvageable-3><a href=#concept-document-salvageable>salvageable</a></i> state to
- false.<li><p>If the <code id=aborting-a-document-load:document-6><a href=#document>Document</a></code> has an <a href=#active-parser id=aborting-a-document-load:active-parser>active parser</a>, then <a href=#abort-a-parser id=aborting-a-document-load:abort-a-parser>abort that parser</a> and set the <code id=aborting-a-document-load:document-7><a href=#document>Document</a></code>'s <i id=aborting-a-document-load:concept-document-salvageable-4><a href=#concept-document-salvageable>salvageable</a></i> state to false.</ol>
- <p>User agents may allow users to explicitly invoke the <a href=#abort-a-document id=aborting-a-document-load:abort-a-document-2>abort a
- document</a> algorithm for a <code id=aborting-a-document-load:document-8><a href=#document>Document</a></code>. If the user does so, then, if that
- <code id=aborting-a-document-load:document-9><a href=#document>Document</a></code> is an <a href=#active-document id=aborting-a-document-load:active-document-2>active document</a>, the user agent should <a href=#queue-a-task id=aborting-a-document-load:queue-a-task-3>queue a
- task</a> to <a href=#fire-a-simple-event id=aborting-a-document-load:fire-a-simple-event>fire a simple event</a> named <code id=aborting-a-document-load:event-abort><a href=#event-abort>abort</a></code> at
- that <code id=aborting-a-document-load:document-10><a href=#document>Document</a></code>'s <code id=aborting-a-document-load:window><a href=#window>Window</a></code> object before invoking the <a href=#abort-a-document id=aborting-a-document-load:abort-a-document-3>abort</a> algorithm.</p>
-
-
- <h3 id=offline>7.7 Offline Web applications</h3>
-
- <h4 id=introduction-11>7.7.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>In order to enable users to continue interacting with Web applications and documents even when
- their network connection is unavailable — for instance, because they are traveling outside
- of their ISP's coverage area — authors can provide a manifest which lists the files that are
- needed for the Web application to work offline and which causes the user's browser to keep a copy
- of the files for use offline.</p>
- <p>To illustrate this, consider a simple clock applet consisting of an HTML page "<code>clock.html</code>", a CSS style sheet "<code>clock.css</code>", and a JavaScript
- script "<code>clock.js</code>".</p>
- <p>Before adding the manifest, these three files might look like this:</p>
- <pre><!-- clock.html -->
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Clock</title>
- <script src="clock.js"></script>
- <link rel="stylesheet" href="clock.css">
- </head>
- <body>
- <p>The time is: <output id="clock"></output></p>
- </body>
- </html></pre>
- <pre>/* clock.css */
- output { font: 2em sans-serif; }</pre>
- <pre>/* clock.js */
- setInterval(function () {
- document.getElementById('clock').value = new Date();
- }, 1000);</pre>
- <p>If the user tries to open the "<code>clock.html</code>" page while offline, though,
- the user agent (unless it happens to have it still in the local cache) will fail with an
- error.</p>
- <p>The author can instead provide a manifest of the three files, say "<code>clock.appcache</code>":</p>
- <pre>CACHE MANIFEST
- clock.html
- clock.css
- clock.js
- </pre>
- <p>With a small change to the HTML file, the manifest (served as <code id=introduction-11:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code>)
- is linked to the application:</p>
- <pre><!-- clock.html -->
- <!DOCTYPE HTML>
- <html manifest="clock.appcache">
- <head>
- <title>Clock</title>
- <script src="clock.js"></script>
- <link rel="stylesheet" href="clock.css">
- </head>
- <body>
- <p>The time is: <output id="clock"></output></p>
- </body>
- </html></pre>
- <p>Now, if the user goes to the page, the browser will cache the files and make them available
- even when the user is offline.</p>
- <p class=note>Authors are encouraged to include the main page in the manifest also, but in
- practice the page that referenced the manifest is automatically cached even if it isn't explicitly
- mentioned.</p>
- <p class=note>With the exception of "no-store" directive, HTTP cache headers and restrictions on
- caching pages served over TLS (encrypted, using <code id=introduction-11:https-protocol><a data-x-internal=https-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.2>https:</a></code>) are
- overridden by manifests. Thus, pages will not expire from an application cache before the user
- agent has updated it, and even applications served over TLS can be made to work offline.</p>
- <p><a href=//www.whatwg.org/demos/offline/clock/live-demo/clock.html>View this example online</a>.</p>
- <h5 id=supporting-offline-caching-for-legacy-applications>7.7.1.1 Supporting offline caching for legacy applications</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The application cache feature works best if the application logic is separate from the
- application and user data, with the logic (markup, scripts, style sheets, images, etc) listed in
- the manifest and stored in the application cache, with a finite number of static HTML pages for
- the application, and with the application and user data stored in Web Storage or a client-side
- Indexed Database, updated dynamically using Web Sockets, <code id=supporting-offline-caching-for-legacy-applications:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code>, server-sent
- events, or some other similar mechanism.</p>
- <p>This model results in a fast experience for the user: the application immediately loads, and
- fresh data is obtained as fast as the network will allow it (possibly while stale data shows).</p>
- <p>Legacy applications, however, tend to be designed so that the user data and the logic are mixed
- together in the HTML, with each operation resulting in a new HTML page from the server.</p>
- <div class=example>
- <p>For example, consider a news application. The typical architecture of such an application,
- when not using the application cache feature, is that the user fetches the main page, and the
- server returns a dynamically-generated page with the current headlines and the user interface
- logic mixed together.</p>
- <p>A news application designed for the application cache feature, however, would instead have the
- main page just consist of the logic, and would then have the main page fetch the data separately
- from the server, e.g. using <code id=supporting-offline-caching-for-legacy-applications:xmlhttprequest-2><a href=#xmlhttprequest>XMLHttpRequest</a></code>.</p>
- </div>
- <p>The mixed-content model does not work well with the application cache feature: since the
- content is cached, it would result in the user always seeing the stale data from the previous time
- the cache was updated.</p>
- <p>While there is no way to make the legacy model work as fast as the separated model, it
- <em>can</em> at least be retrofitted for offline use using the <a href=#concept-appcache-mode-prefer-online id=supporting-offline-caching-for-legacy-applications:concept-appcache-mode-prefer-online>prefer-online</a> <a href=#concept-appcache-mode id=supporting-offline-caching-for-legacy-applications:concept-appcache-mode>application cache mode</a>. To do so, list all the static
- resources used by the HTML page you want to have work offline in an <a href=#concept-appcache-manifest id=supporting-offline-caching-for-legacy-applications:concept-appcache-manifest>application cache manifest</a>, use the <code id=supporting-offline-caching-for-legacy-applications:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute to select that manifest from the HTML file,
- and then add the following line at the bottom of the manifest:</p>
- <pre>SETTINGS:
- prefer-online
- NETWORK:
- *</pre>
- <p>This causes the <a href=#application-cache id=supporting-offline-caching-for-legacy-applications:application-cache>application cache</a> to only be used for <a href=#concept-appcache-master id=supporting-offline-caching-for-legacy-applications:concept-appcache-master>master entries</a> when the user is offline, and causes the
- application cache to be used as an atomic HTTP cache (essentially pinning resources listed in the
- manifest), while allowing all resources not listed in the manifest to be accessed normally when
- the user is online.</p>
- <h5 id=appcacheevents>7.7.1.2 Event summary</h5>
- <p><i>This section is non-normative.</i></p>
- <p>When the user visits a page that declares a manifest, the browser will try to update the cache.
- It does this by fetching a copy of the manifest and, if the manifest has changed since the user
- agent last saw it, redownloading all the resources it mentions and caching them anew.</p>
- <p>As this is going on, a number of events get fired on the <code id=appcacheevents:applicationcache><a href=#applicationcache>ApplicationCache</a></code> object
- to keep the script updated as to the state of the cache update, so that the user can be notified
- appropriately. The events are as follows:</p>
- <table><thead><tr><th> Event name
- <th> Interface
- <th> Fired when...
- <th> Next events
- <tbody><tr><td> <dfn id=event-appcache-checking><code>checking</code></dfn>
- <td> <code id=appcacheevents:event><a href=#event>Event</a></code>
- <td> The user agent is checking for an update, or attempting to download the manifest for the
- first time. <strong>This is always the first event in the sequence.</strong>
- <td> <code id=appcacheevents:event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>, <code id=appcacheevents:event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>, <code id=appcacheevents:event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>, <code id=appcacheevents:event-appcache-error><a href=#event-appcache-error>error</a></code>
- <tr><td> <dfn id=event-appcache-noupdate><code>noupdate</code></dfn>
- <td> <code id=appcacheevents:event-2><a href=#event>Event</a></code>
- <td> The manifest hadn't changed.
- <td> Last event in sequence.
- <tr><td> <dfn id=event-appcache-downloading><code>downloading</code></dfn>
- <td> <code id=appcacheevents:event-3><a href=#event>Event</a></code>
- <td> The user agent has found an update and is fetching it, or is downloading the resources
- listed by the manifest for the first time.
- <td> <code id=appcacheevents:event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, <code id=appcacheevents:event-appcache-error-2><a href=#event-appcache-error>error</a></code>, <code id=appcacheevents:event-appcache-cached><a href=#event-appcache-cached>cached</a></code>, <code id=appcacheevents:event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code>
- <tr><td> <dfn id=event-appcache-progress><code>progress</code></dfn>
- <td> <code id=appcacheevents:progressevent><a href=#progressevent>ProgressEvent</a></code>
- <td> The user agent is downloading resources listed by the manifest.
- The event object's <code id=appcacheevents:dom-progressevent-total><a href=#dom-progressevent-total>total</a></code> attribute returns the total number of files to be downloaded.
- The event object's <code id=appcacheevents:dom-progressevent-loaded><a href=#dom-progressevent-loaded>loaded</a></code> attribute returns the number of files processed so far.
- <td> <code id=appcacheevents:event-appcache-progress-2><a href=#event-appcache-progress>progress</a></code>, <code id=appcacheevents:event-appcache-error-3><a href=#event-appcache-error>error</a></code>, <code id=appcacheevents:event-appcache-cached-2><a href=#event-appcache-cached>cached</a></code>, <code id=appcacheevents:event-appcache-updateready-2><a href=#event-appcache-updateready>updateready</a></code>
- <tr><td> <dfn id=event-appcache-cached><code>cached</code></dfn>
- <td> <code id=appcacheevents:event-4><a href=#event>Event</a></code>
- <td> The resources listed in the manifest have been downloaded, and the application is now cached.
- <td> Last event in sequence.
- <tr><td> <dfn id=event-appcache-updateready><code>updateready</code></dfn>
- <td> <code id=appcacheevents:event-5><a href=#event>Event</a></code>
- <td> The resources listed in the manifest have been newly redownloaded, and the script can use
- <code id=appcacheevents:dom-appcache-swapcache><a href=#dom-appcache-swapcache>swapCache()</a></code> to switch to the new cache.
- <td> Last event in sequence.
- <tr><td> <dfn id=event-appcache-obsolete><code>obsolete</code></dfn>
- <td> <code id=appcacheevents:event-6><a href=#event>Event</a></code>
- <td> The manifest was found to have become a 404 or 410 page, so the application cache is being deleted.
- <td> Last event in sequence.
- <tr><td rowspan=4> <dfn id=event-appcache-error><code>error</code></dfn>
- <td rowspan=4> <code id=appcacheevents:event-7><a href=#event>Event</a></code>
- <td> The manifest was a 404 or 410 page, so the attempt to cache the application has been aborted.
- <td rowspan=3> Last event in sequence.
- <tr><td> The manifest hadn't changed, but the page referencing the manifest failed to download properly.
- <tr><td> A fatal error occurred while fetching the resources listed in the manifest.
- <tr><td> The manifest changed while the update was being run.
- <td> The user agent will try fetching the files again momentarily.
- </table>
- <p>These events are cancelable; their default action is for the user agent to show download
- progress information. If the page shows its own update UI, canceling the events will prevent the
- user agent from showing redundant progress information.</p>
-
- <h4 id=appcache>7.7.2 Application caches</h4>
- <p>An <dfn id=application-cache>application cache</dfn> is a set of cached resources consisting of:</p>
- <ul><li>
- <p>One or more resources (including their out-of-band metadata, such as HTTP headers, if any),
- identified by URLs, each falling into one (or more) of the following categories:</p>
- <dl><dt><dfn id=concept-appcache-master>Master entries</dfn>
- <dd><p class=note>These are documents that were added to the cache because a <a href=#browsing-context id=appcache:browsing-context>browsing
- context</a> was <a href=#navigate id=appcache:navigate>navigated</a> to that document and the document
- indicated that this was its cache, using the <code id=appcache:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code>
- attribute.</p>
- <dt><dfn id=concept-appcache-manifest>The manifest</dfn>
- <dd><p class=note>This is the resource corresponding to the URL that was given in a master
- entry's <code id=appcache:the-html-element><a href=#the-html-element>html</a></code> element's <code id=appcache:attr-html-manifest-2><a href=#attr-html-manifest>manifest</a></code> attribute.
- The manifest is fetched and processed during the <a href=#application-cache-download-process id=appcache:application-cache-download-process>application cache download
- process</a>. All the <a href=#concept-appcache-master id=appcache:concept-appcache-master>master entries</a> have the
- <a href=#same-origin id=appcache:same-origin>same origin</a> as the manifest.</p>
- <dt><dfn id=concept-appcache-explicit>Explicit entries</dfn>
- <dd><p class=note>These are the resources that were listed in the cache's <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest>manifest</a> in an <a href=#concept-appcache-manifest-explicit id=appcache:concept-appcache-manifest-explicit>explicit section</a>.</p>
- <dt><dfn id=concept-appcache-fallback>Fallback entries</dfn>
- <dd><p class=note>These are the resources that were listed in the cache's <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-2>manifest</a> in a <a href=#concept-appcache-manifest-fallback id=appcache:concept-appcache-manifest-fallback>fallback section</a>.</p>
- </dl>
- <p><a href=#concept-appcache-explicit id=appcache:concept-appcache-explicit>Explicit entries</a> and <a href=#concept-appcache-fallback id=appcache:concept-appcache-fallback>Fallback entries</a> can be marked as <dfn id=concept-appcache-foreign>foreign</dfn>, which means that they have a <code id=appcache:attr-html-manifest-3><a href=#attr-html-manifest>manifest</a></code> attribute but that it doesn't point at this cache's
- <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-3>manifest</a>.</p>
- <p class=note>A URL in the list can be flagged with multiple different types, and thus an
- entry can end up being categorised as multiple entries. For example, an entry can be a manifest
- entry and an explicit entry at the same time, if the manifest is listed within the manifest.</p>
- <li>
- <p>Zero or more <dfn id=concept-appcache-fallback-ns>fallback namespaces</dfn>, each of
- which is mapped to a <a href=#concept-appcache-fallback id=appcache:concept-appcache-fallback-2>fallback entry</a>.</p>
- <p class=note>These are URLs used as <a href=#concept-appcache-matches-fallback id=appcache:concept-appcache-matches-fallback>prefix
- match patterns</a> for resources that are to be fetched from the network if possible, or to
- be replaced by the corresponding <a href=#concept-appcache-fallback id=appcache:concept-appcache-fallback-3>fallback entry</a>
- if not. Each namespace URL has the <a href=#same-origin id=appcache:same-origin-2>same origin</a> as <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-4>the manifest</a>.</p>
- <li>
- <p>Zero or more URLs that form the <dfn id=concept-appcache-onlinewhitelist>online
- whitelist namespaces</dfn>.</p>
- <p class=note>These are used as prefix match patterns, and declare URLs for which the user
- agent will ignore the application cache, instead fetching them normally (i.e. from the network
- or local HTTP cache as appropriate).</p>
- <li>
- <p>An <dfn id=concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard
- flag</dfn>, which is either <i>open</i> or <i>blocking</i>.</p>
- <p class=note>The <i>open</i> state indicates that any URL not listed as cached is to
- be implicitly treated as being in the <a href=#concept-appcache-onlinewhitelist id=appcache:concept-appcache-onlinewhitelist>online
- whitelist namespaces</a>; the <i>blocking</i> state indicates that URLs not listed
- explicitly in the manifest are to be treated as unavailable.</p>
- <li>
- <p>A <dfn id=concept-appcache-mode>cache mode flag</dfn>, which is either in the <dfn id=concept-appcache-mode-fast><i>fast</i></dfn> state or the <dfn id=concept-appcache-mode-prefer-online><i>prefer-online</i></dfn> state.</p>
- </ul>
- <p>Each <a href=#application-cache id=appcache:application-cache>application cache</a> has a <dfn id=concept-appcache-completeness>completeness flag</dfn>, which is either <i>complete</i> or
- <i>incomplete</i>.</p>
- <hr>
- <p>An <dfn id=application-cache-group>application cache group</dfn> is a group of <a href=#application-cache id=appcache:application-cache-2>application
- caches</a>, identified by the <a href=#absolute-url id=appcache:absolute-url>absolute URL</a> of a resource <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-5>manifest</a> which is used to populate the caches in the
- group.</p>
- <p>An <a href=#application-cache id=appcache:application-cache-3>application cache</a> is <dfn id=concept-appcache-newer>newer</dfn> than
- another if it was created after the other (in other words, <a href=#application-cache id=appcache:application-cache-4>application caches</a> in an <a href=#application-cache-group id=appcache:application-cache-group>application cache group</a> have a chronological
- order).</p>
- <p>Only the newest <a href=#application-cache id=appcache:application-cache-5>application cache</a> in an <a href=#application-cache-group id=appcache:application-cache-group-2>application cache group</a> can
- have its <a href=#concept-appcache-completeness id=appcache:concept-appcache-completeness>completeness flag</a> set to
- <i>incomplete</i>; the others are always all <i>complete</i>.</p>
- <p>Each <a href=#application-cache-group id=appcache:application-cache-group-3>application cache group</a> has an <dfn id=concept-appcache-status>update
- status</dfn>, which is one of the following: <i>idle</i>, <i>checking</i>, <i>downloading</i>.</p>
- <p>A <dfn id=relevant-application-cache>relevant application cache</dfn> is an <a href=#application-cache id=appcache:application-cache-6>application cache</a> that is the <a href=#concept-appcache-newer id=appcache:concept-appcache-newer>newest</a> in its <a href=#application-cache-group id=appcache:application-cache-group-4>group</a> to be <i>complete</i>.</p>
- <p>Each <a href=#application-cache-group id=appcache:application-cache-group-5>application cache group</a> has a <dfn id=concept-appcache-pending-masters>list of pending master entries</dfn>. Each entry in this
- list consists of a resource and a corresponding <code id=appcache:document><a href=#document>Document</a></code> object. It is used during
- the <a href=#application-cache-download-process id=appcache:application-cache-download-process-2>application cache download process</a> to ensure that new master entries are cached
- even if the <a href=#application-cache-download-process id=appcache:application-cache-download-process-3>application cache download process</a> was already running for their
- <a href=#application-cache-group id=appcache:application-cache-group-6>application cache group</a> when they were loaded.</p>
- <p>An <a href=#application-cache-group id=appcache:application-cache-group-7>application cache group</a> can be marked as <dfn id=concept-appcache-obsolete>obsolete</dfn>, meaning that it must be ignored when looking at
- what <a href=#application-cache-group id=appcache:application-cache-group-8>application cache groups</a> exist.</p>
- <hr>
- <p>A <dfn id=cache-host>cache host</dfn> is a <code id=appcache:document-2><a href=#document>Document</a></code> or a <code id=appcache:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
- object. A <a href=#cache-host id=appcache:cache-host>cache host</a> can be associated with an <a href=#application-cache id=appcache:application-cache-7>application cache</a>.</p>
- <p>A <code id=appcache:document-3><a href=#document>Document</a></code> initially is not associated with an <a href=#application-cache id=appcache:application-cache-8>application cache</a>, but
- can become associated with one early during the page load process, when steps <a href=#parser-appcache>in the parser</a> and in the <a href=#navigate id=appcache:navigate-2>navigation</a>
- sections cause <a href=#concept-appcache-init id=appcache:concept-appcache-init>cache selection</a> to occur.</p>
- <p>A <code id=appcache:sharedworkerglobalscope-2><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> can be associated with an <a href=#application-cache id=appcache:application-cache-9>application cache</a>
- when it is created.</p>
- <p>Each <a href=#cache-host id=appcache:cache-host-2>cache host</a> has an associated <code id=appcache:applicationcache><a href=#applicationcache>ApplicationCache</a></code> object.</p>
- <hr>
- <p>Multiple <a href=#application-cache id=appcache:application-cache-10>application caches</a> in different <a href=#application-cache-group id=appcache:application-cache-group-9>application cache groups</a> can contain the same resource,
- e.g. if the manifests all reference that resource. If the user agent is to <dfn id=concept-appcache-selection>select an application cache</dfn> from a list of <a href=#relevant-application-cache id=appcache:relevant-application-cache>relevant application caches</a> that contain a resource, the
- user agent must use the application cache that the user most likely wants to see the resource
- from, taking into account the following:</p>
- <ul><li>which application cache was most recently updated,
- <li>which application cache was being used to display the resource from which the user decided to
- look at the new resource, and
- <li>which application cache the user prefers.
- </ul>
- <hr>
- <p>A URL <dfn id=concept-appcache-matches-fallback>matches a fallback namespace</dfn> if
- there exists a <a href=#relevant-application-cache id=appcache:relevant-application-cache-2>relevant application cache</a> whose <a href=#concept-appcache-manifest id=appcache:concept-appcache-manifest-6>manifest</a>'s URL has the <a href=#same-origin id=appcache:same-origin-3>same origin</a> as the
- URL in question, and that has a <a href=#concept-appcache-fallback-ns id=appcache:concept-appcache-fallback-ns>fallback
- namespace</a> that is a <a href=#prefix-match id=appcache:prefix-match>prefix match</a> for the URL being examined. If multiple
- fallback namespaces match the same URL, the longest one is the one that matches. A URL looking for
- a fallback namespace can match more than one application cache at a time, but only matches one
- namespace in each cache.</p>
- <div class=example>
- <p>If a manifest <code>http://example.com/app1/manifest</code> declares that <code>http://example.com/resources/images</code> is a fallback namespace, and the user
- navigates to <code>HTTP://EXAMPLE.COM:80/resources/images/cat.png</code>, then the user
- agent will decide that the application cache identified by <code>http://example.com/app1/manifest</code> contains a namespace with a match for that
- URL.</p>
-
- </div>
-
- <h4 id=manifests>7.7.3 The cache manifest syntax</h4>
- <h5 id=some-sample-manifests>7.7.3.1 Some sample manifests</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>This example manifest requires two images and a style sheet to be cached and whitelists a CGI
- script.</p>
- <pre>CACHE MANIFEST
- # the above line is required
- # this is a comment
- # there can be as many of these anywhere in the file
- # they are all ignored
- # comments can have spaces before them
- # but must be alone on the line
- # blank lines are ignored too
- # these are files that need to be cached they can either be listed
- # first, or a "CACHE:" header could be put before them, as is done
- # lower down.
- images/sound-icon.png
- images/background.png
- # note that each file has to be put on its own line
- # here is a file for the online whitelist -- it isn't cached, and
- # references to this file will bypass the cache, always hitting the
- # network (or trying to, if the user is offline).
- NETWORK:
- comm.cgi
- # here is another set of files to cache, this time just the CSS file.
- CACHE:
- style/default.css</pre>
- <p>It could equally well be written as follows:</p>
- <pre>CACHE MANIFEST
- NETWORK:
- comm.cgi
- CACHE:
- style/default.css
- images/sound-icon.png
- images/background.png</pre>
- </div>
- <div class=example>
- <p>Offline application cache manifests can use absolute paths or even absolute URLs:</p>
- <pre>CACHE MANIFEST
- /main/home
- /main/app.js
- /settings/home
- /settings/app.js
- http://img.example.com/logo.png
- http://img.example.com/check.png
- http://img.example.com/cross.png</pre>
- </div>
- <div class=example>
- <p>The following manifest defines a catch-all error page that is displayed for any page on the
- site while the user is offline. It also specifies that the <a href=#concept-appcache-onlinewhitelist-wildcard id=some-sample-manifests:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard flag</a> is <i>open</i>, meaning that accesses to resources on other sites will not be blocked.
- (Resources on the same site are already not blocked because of the catch-all fallback
- namespace.)</p>
- <p>So long as all pages on the site reference this manifest, they will get cached locally as they
- are fetched, so that subsequent hits to the same page will load the page immediately from the
- cache. Until the manifest is changed, those pages will not be fetched from the server again. When
- the manifest changes, then all the files will be redownloaded.</p>
- <p>Subresources, such as style sheets, images, etc, would only be cached using the regular HTTP
- caching semantics, however.</p>
- <pre>CACHE MANIFEST
- FALLBACK:
- / /offline.html
- NETWORK:
- *</pre>
- </div>
- <h5 id=writing-cache-manifests>7.7.3.2 Writing cache manifests</h5>
- <p>Manifests must be served using the <code id=writing-cache-manifests:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code> <a href=#mime-type id=writing-cache-manifests:mime-type>MIME type</a>. All
- resources served using the <code id=writing-cache-manifests:text/cache-manifest-2><a href=#text/cache-manifest>text/cache-manifest</a></code> <a href=#mime-type id=writing-cache-manifests:mime-type-2>MIME type</a> must follow the
- syntax of application cache manifests, as described in this section.</p>
- <p>An application cache manifest is a text file, whose text is encoded using UTF-8. Data in
- application cache manifests is line-based. Newlines must be represented by U+000A LINE FEED (LF)
- characters, U+000D CARRIAGE RETURN (CR) characters, or U+000D CARRIAGE RETURN (CR) U+000A LINE
- FEED (LF) pairs. <a href=#refsENCODING>[ENCODING]</a></p>
- <p class=note>This is a <a href=#willful-violation id=writing-cache-manifests:willful-violation>willful violation</a> of RFC 2046, which requires all <code>text/*</code> types to only allow CRLF line breaks. This requirement, however, is
- outdated; the use of CR, LF, and CRLF line breaks is commonly supported and indeed sometimes CRLF
- is <em>not</em> supported by text editors. <a href=#refsRFC2046>[RFC2046]</a></p>
- <p>The first line of an application cache manifest must consist of the string "CACHE", a single
- U+0020 SPACE character, the string "MANIFEST", and either a U+0020 SPACE character, a U+0009
- CHARACTER TABULATION (tab) character, a U+000A LINE FEED (LF) character, or a U+000D CARRIAGE
- RETURN (CR) character. The first line may optionally be preceded by a U+FEFF BYTE ORDER MARK (BOM)
- character. If any other text is found on the first line, it is ignored.</p>
- <p>Subsequent lines, if any, must all be one of the following:</p>
- <dl><dt>A blank line
- <dd>
- <p>Blank lines must consist of zero or more U+0020 SPACE and
- U+0009 CHARACTER TABULATION (tab) characters only.</p>
- <dt>A comment
- <dd>
- <p>Comment lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
- characters, followed by a single U+0023 NUMBER SIGN character (#), followed by zero or more
- characters other than U+000A LINE FEED (LF) and U+000D CARRIAGE RETURN (CR) characters.</p>
- <p class=note>Comments must be on a line on their own. If they were to be included on a line
- with a URL, the "#" would be mistaken for part of a fragment identifier.</p>
- <dt>A section header
- <dd>
- <p>Section headers change the current section. There are four possible section headers:
- <dl><dt><code>CACHE:</code>
- <dd>Switches to the <dfn id=concept-appcache-manifest-explicit>explicit section</dfn>.
- <dt><code>FALLBACK:</code>
- <dd>Switches to the <dfn id=concept-appcache-manifest-fallback>fallback section</dfn>.
- <dt><code>NETWORK:</code>
- <dd>Switches to the <dfn id=concept-appcache-manifest-network>online whitelist section</dfn>.
- <dt><code>SETTINGS:</code>
- <dd>Switches to the <dfn id=concept-appcache-manifest-settings>settings section</dfn>.
- </dl>
- <p>Section header lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
- TABULATION (tab) characters, followed by one of the names above (including the U+003A COLON
- character (:)) followed by zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
- characters.</p>
- <p>Ironically, by default, the current section is the <a href=#concept-appcache-manifest-explicit id=writing-cache-manifests:concept-appcache-manifest-explicit>explicit section</a>.</p>
- <dt>Data for the current section
- <dd>
- <p>The format that data lines must take depends on the current section.</p>
- <p>When the current section is the <a href=#concept-appcache-manifest-explicit id=writing-cache-manifests:concept-appcache-manifest-explicit-2>explicit
- section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
- TABULATION (tab) characters, a <a href=#valid-url id=writing-cache-manifests:valid-url>valid URL</a> identifying a resource other than the
- manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab)
- characters.</p>
- <p>When the current section is the <a href=#concept-appcache-manifest-fallback id=writing-cache-manifests:concept-appcache-manifest-fallback>fallback
- section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
- TABULATION (tab) characters, a <a href=#valid-url id=writing-cache-manifests:valid-url-2>valid URL</a> identifying a resource other than the
- manifest itself, one or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters,
- another <a href=#valid-url id=writing-cache-manifests:valid-url-3>valid URL</a> identifying a resource other than the manifest itself, and then
- zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>
- <p>When the current section is the <a href=#concept-appcache-manifest-network id=writing-cache-manifests:concept-appcache-manifest-network>online
- whitelist section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009
- CHARACTER TABULATION (tab) characters, either a single U+002A ASTERISK character (*) or a <a href=#valid-url id=writing-cache-manifests:valid-url-4>valid URL</a> identifying a resource
- other than the manifest itself, and then zero or more U+0020 SPACE and U+0009 CHARACTER
- TABULATION (tab) characters.</p>
- <p>When the current section is the <a href=#concept-appcache-manifest-settings id=writing-cache-manifests:concept-appcache-manifest-settings>settings
- section</a>, data lines must consist of zero or more U+0020 SPACE and U+0009 CHARACTER
- TABULATION (tab) characters, a <a href=#concept-appcache-manifest-setting id=writing-cache-manifests:concept-appcache-manifest-setting>setting</a>,
- and then zero or more U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters.</p>
- <p>Currently only one <dfn id=concept-appcache-manifest-setting>setting</dfn> is
- defined:</p>
- <dl><dt>The cache mode setting<dd>This consists of the string "<code>prefer-online</code>". It sets the <a href=#concept-appcache-mode id=writing-cache-manifests:concept-appcache-mode>cache mode</a> to <a href=#concept-appcache-mode-prefer-online id=writing-cache-manifests:concept-appcache-mode-prefer-online>prefer-online</a>. (The <a href=#concept-appcache-mode id=writing-cache-manifests:concept-appcache-mode-2>cache mode</a> defaults to <a href=#concept-appcache-mode-fast id=writing-cache-manifests:concept-appcache-mode-fast>fast</a>.)</dl>
- <p>Within a <a href=#concept-appcache-manifest-settings id=writing-cache-manifests:concept-appcache-manifest-settings-2>settings section</a>, each <a href=#concept-appcache-manifest-setting id=writing-cache-manifests:concept-appcache-manifest-setting-2>setting</a> must occur no more than once.</p>
- </dl>
- <p>Manifests may contain sections more than once. Sections may be empty.</p>
- <p>URLs that are to be fallback pages associated with <a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns>fallback namespaces</a>, and those namespaces themselves,
- must be given in <a href=#concept-appcache-manifest-fallback id=writing-cache-manifests:concept-appcache-manifest-fallback-2>fallback sections</a>, with
- the namespace being the first URL of the data line, and the corresponding fallback page being the
- second URL. All the other pages to be cached must be listed in <a href=#concept-appcache-manifest-explicit id=writing-cache-manifests:concept-appcache-manifest-explicit-3>explicit sections</a>.</p>
- <p><a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-2>Fallback namespaces</a> and <a href=#concept-appcache-fallback id=writing-cache-manifests:concept-appcache-fallback>fallback entries</a> must have the <a href=#same-origin id=writing-cache-manifests:same-origin>same origin</a>
- as the manifest itself. <a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-3>Fallback namespaces</a>
- must also be <span>in the same path</span> as the manifest's URL.</p>
- <p>A <a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-4>fallback namespace</a> must not be listed more
- than once.</p>
- <p>Namespaces that the user agent is to put into the <a href=#concept-appcache-onlinewhitelist id=writing-cache-manifests:concept-appcache-onlinewhitelist>online whitelist</a> must all be specified in <a href=#concept-appcache-manifest-network id=writing-cache-manifests:concept-appcache-manifest-network-2>online whitelist sections</a>. (This is needed for
- any URL that the page is intending to use to communicate back to the server.) To specify that all
- URLs are automatically whitelisted in this way, a U+002A ASTERISK character (*) may be specified
- as one of the URLs. </p>
- <p>Authors should not include namespaces in the <a href=#concept-appcache-onlinewhitelist id=writing-cache-manifests:concept-appcache-onlinewhitelist-2>online whitelist</a> for which another namespace in
- the <a href=#concept-appcache-onlinewhitelist id=writing-cache-manifests:concept-appcache-onlinewhitelist-3>online whitelist</a> is a <a href=#prefix-match id=writing-cache-manifests:prefix-match>prefix
- match</a>.</p>
- <p><a href=#relative-url id=writing-cache-manifests:relative-url>Relative URLs</a> must be given relative to the manifest's own
- URL. All URLs in the manifest must have the same <a href=#concept-url-scheme id=writing-cache-manifests:concept-url-scheme>scheme</a> as
- the manifest itself (either explicitly or implicitly, through the use of <a href=#relative-url id=writing-cache-manifests:relative-url-2>relative URLs</a>). <a href=#refsURL>[URL]</a></p>
- <p>URLs in manifests must not have fragment identifiers (i.e. the U+0023 NUMBER SIGN character
- isn't allowed in URLs in manifests).</p>
- <p><a href=#concept-appcache-fallback-ns id=writing-cache-manifests:concept-appcache-fallback-ns-5>Fallback namespaces</a> and namespaces in the
- <a href=#concept-appcache-onlinewhitelist id=writing-cache-manifests:concept-appcache-onlinewhitelist-4>online whitelist</a> are matched by <a href=#prefix-match id=writing-cache-manifests:prefix-match-2>prefix
- match</a>.</p>
-
- <h5 id=parsing-cache-manifests>7.7.3.3 Parsing cache manifests</h5>
- <p>When a user agent is to <dfn id=parse-a-manifest>parse a manifest</dfn>, it means that the user agent must run the
- following steps:</p>
- <ol><li>
- <p><a href=#utf-8-decode id=parsing-cache-manifests:utf-8-decode>UTF-8 decode</a> the byte stream corresponding with the manifest to be parsed.</p>
- <p class=note>The <a href=#utf-8-decode id=parsing-cache-manifests:utf-8-decode-2>UTF-8 decode</a> algorithm strips a leading BOM, if any.</p>
-
- <li><p>Let <var>base URL</var> be the <a href=#absolute-url id=parsing-cache-manifests:absolute-url>absolute URL</a> representing the
- manifest.<li><p>Apply the <a href=#url-parser id=parsing-cache-manifests:url-parser>URL parser</a> to <var>base URL</var>, and let <var>manifest path</var>
- be the <a href=#concept-url-path id=parsing-cache-manifests:concept-url-path>path</a> component thus obtained.<li><p>Remove all the characters in <var>manifest path</var> after the last U+002F SOLIDUS
- character (/), if any. (The first character and the last character in <var>manifest path</var>
- after this step will both be slashes, the URL path separator character.)<li><p>Apply the <a href=#url-parser id=parsing-cache-manifests:url-parser-2>URL parser</a> steps to the <var>base URL</var>, so that the
- components from its <a href=#parsed-url id=parsing-cache-manifests:parsed-url>parsed URL</a> can be used by the subseqent steps of this
- algorithm.<li><p>Let <var>explicit URLs</var> be an initially empty list of <a href=#absolute-url id=parsing-cache-manifests:absolute-url-2>absolute URLs</a> for <a href=#concept-appcache-explicit id=parsing-cache-manifests:concept-appcache-explicit>explicit
- entries</a>.<li><p>Let <var>fallback URLs</var> be an initially empty mapping of <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns>fallback namespaces</a> to <a href=#absolute-url id=parsing-cache-manifests:absolute-url-3>absolute URLs</a> for <a href=#concept-appcache-fallback id=parsing-cache-manifests:concept-appcache-fallback>fallback
- entries</a>.<li><p>Let <var>online whitelist namespaces</var> be an initially empty list of <a href=#absolute-url id=parsing-cache-manifests:absolute-url-4>absolute URLs</a> for an <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist>online whitelist</a>.<li><p>Let <var>online whitelist wildcard flag</var> be <i>blocking</i>. <li><p>Let <var>cache mode flag</var> be <i>fast</i>. <li><p>Let <var>input</var> be the decoded text of the manifest's byte stream.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the first character.<li><p>If the characters starting from <var>position</var> are "CACHE", followed by a
- U+0020 SPACE character, followed by "MANIFEST", then advance <var>position</var> to the
- next character after those. Otherwise, this isn't a cache manifest; abort this algorithm with a
- failure while checking for the magic signature.<li><p>If the character at <var>position</var> is neither a U+0020 SPACE character, a
- U+0009 CHARACTER TABULATION (tab) character, U+000A LINE FEED (LF) character, nor a U+000D
- CARRIAGE RETURN (CR) character, then this isn't a cache manifest; abort this algorithm with a
- failure while checking for the magic signature.<li><p>This is a cache manifest. The algorithm cannot fail beyond
- this point (though bogus lines can get ignored).<li><p><a href=#collect-a-sequence-of-characters id=parsing-cache-manifests:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <em>not</em> U+000A LINE FEED (LF)
- or U+000D CARRIAGE RETURN (CR) characters, and ignore those characters. (Extra text on the first
- line, after the signature, is ignored.)<li><p>Let <var>mode</var> be "explicit".<li><p><i>Start of line</i>: If <var>position</var> is past the end of <var>input</var>, then jump to the last step. Otherwise, <a href=#collect-a-sequence-of-characters id=parsing-cache-manifests:collect-a-sequence-of-characters-2>collect a sequence of
- characters</a> that are U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, or
- U+0009 CHARACTER TABULATION (tab) characters.<li><p>Now, <a href=#collect-a-sequence-of-characters id=parsing-cache-manifests:collect-a-sequence-of-characters-3>collect a sequence of characters</a> that are <em>not</em> U+000A LINE FEED
- (LF) or U+000D CARRIAGE RETURN (CR) characters, and let the result be <var>line</var>.<li><p>Drop any trailing U+0020 SPACE and U+0009 CHARACTER TABULATION (tab) characters at the end
- of <var>line</var>.<li><p>If <var>line</var> is the empty string, then jump back to the step labeled <i>start
- of line</i>.<li><p>If the first character in <var>line</var> is a U+0023 NUMBER SIGN character (#),
- then jump back to the step labeled <i>start of line</i>.<li><p>If <var>line</var> equals "CACHE:" (the word "CACHE" followed by a U+003A COLON
- character (:)), then set <var>mode</var> to "explicit" and jump back to the step labeled
- <i>start of line</i>.<li><p>If <var>line</var> equals "FALLBACK:" (the word "FALLBACK" followed by a U+003A
- COLON character (:)), then set <var>mode</var> to "fallback" and jump back to the step
- labeled <i>start of line</i>.<li><p>If <var>line</var> equals "NETWORK:" (the word "NETWORK" followed by a U+003A
- COLON character (:)), then set <var>mode</var> to "online whitelist" and jump back to
- the step labeled <i>start of line</i>.<li><p>If <var>line</var> equals "SETTINGS:" (the word "SETTINGS" followed by a U+003A
- COLON character (:)), then set <var>mode</var> to "settings" and jump back to the step
- labeled <i>start of line</i>.<li><p>If <var>line</var> ends with a U+003A COLON character (:), then set <var>mode</var> to "unknown" and jump back to the step labeled <i>start of line</i>.<li><p>This is either a data line or it is syntactically incorrect.<li><p>Let <var>position</var> be a pointer into <var>line</var>, initially
- pointing at the start of the string.<li><p>Let <var>tokens</var> be a list of strings, initially empty.<li>
- <p>While <var>position</var> doesn't point past the end of <var>line</var>:</p>
- <ol><li><p>Let <var>current token</var> be an empty string.<li><p>While <var>position</var> doesn't point past the end of <var>line</var> and the character at <var>position</var> is neither a U+0020 SPACE
- nor a U+0009 CHARACTER TABULATION (tab) character, add the character at <var>position</var> to <var>current token</var> and advance <var>position</var> to the next character in <var>input</var>.<li><p>Add <var>current token</var> to the <var>tokens</var> list.<li><p>While <var>position</var> doesn't point past the end of <var>line</var> and the character at <var>position</var> is either a U+0020 SPACE
- or a U+0009 CHARACTER TABULATION (tab) character, advance <var>position</var> to the
- next character in <var>input</var>.</ol>
- <li>
- <p>Process <var>tokens</var> as follows:</p>
- <dl class=switch><dt>If <var>mode</var> is "explicit"<dd>
- <p><a href=#resolve-a-url id=parsing-cache-manifests:resolve-a-url>Resolve</a> the first item in <var>tokens</var>,
- relative to <var>base URL</var>, with the URL character encoding set to UTF-8;
- ignore the rest.</p>
- <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>
- <p>If the resulting <a href=#parsed-url id=parsing-cache-manifests:parsed-url-2>parsed URL</a> has a different <a href=#concept-url-scheme id=parsing-cache-manifests:concept-url-scheme>scheme</a> component than <var>base URL</var> (the
- manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>
- <p>Let <var>new URL</var> be the result of applying the <a href=#concept-url-serialiser id=parsing-cache-manifests:concept-url-serialiser>URL serialiser</a> algorithm to the resulting <a href=#parsed-url id=parsing-cache-manifests:parsed-url-3>parsed
- URL</a>, with the <i>exclude fragment flag</i> set.</p>
- <p>Add <var>new URL</var> to the <var>explicit URLs</var>.</p>
- <dt>If <var>mode</var> is "fallback"<dd>
- <p>Let <var>part one</var> be the first token in <var>tokens</var>, and let
- <var>part two</var> be the second token in <var>tokens</var>.</p>
- <p><a href=#resolve-a-url id=parsing-cache-manifests:resolve-a-url-2>Resolve</a> <var>part one</var> and <var>part two</var>, relative to <var>base URL</var>, with the URL character
- encoding set to UTF-8.</p>
- <p>If either fails, then jump back to the step labeled <i>start of line</i>.</p>
- <p>If the <a href=#absolute-url id=parsing-cache-manifests:absolute-url-5>absolute URL</a> corresponding to either <var>part one</var> or
- <var>part two</var> does not have the <a href=#same-origin id=parsing-cache-manifests:same-origin>same origin</a> as the manifest's URL,
- then jump back to the step labeled <i>start of line</i>.</p>
- <p>Let <var>part one path</var> be the <a href=#concept-url-path id=parsing-cache-manifests:concept-url-path-2>path</a> component
- of the <a href=#resulting-parsed-url id=parsing-cache-manifests:resulting-parsed-url>resulting parsed URL</a> for <var>part one</var>.</p>
- <p>If <var>manifest path</var> is not a <a href=#prefix-match id=parsing-cache-manifests:prefix-match>prefix match</a> for <var>part one
- path</var>, then jump back to the step labeled <i>start of line</i>.</p>
- <p>Let <var>part one</var> be the result of applying the <a href=#concept-url-serialiser id=parsing-cache-manifests:concept-url-serialiser-2>URL serialiser</a> algorithm to the first resulting
- <a href=#parsed-url id=parsing-cache-manifests:parsed-url-4>parsed URL</a>, with the <i>exclude fragment flag</i> set.</p>
- <p>Let <var>part two</var> be the result of applying the <a href=#concept-url-serialiser id=parsing-cache-manifests:concept-url-serialiser-3>URL serialiser</a> algorithm to the second resulting
- <a href=#parsed-url id=parsing-cache-manifests:parsed-url-5>parsed URL</a>, with the <i>exclude fragment flag</i> set.</p>
- <p>If <var>part one</var> is already in the <var>fallback URLs</var> mapping
- as a <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-2>fallback namespace</a>, then jump back to
- the step labeled <i>start of line</i>.</p>
- <p>Otherwise, add <var>part one</var> to the <var>fallback URLs</var>
- mapping as a <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-3>fallback namespace</a>, mapped to
- <var>part two</var> as the <a href=#concept-appcache-fallback id=parsing-cache-manifests:concept-appcache-fallback-2>fallback
- entry</a>.</p>
- <dt>If <var>mode</var> is "online whitelist"<dd>
- <p>If the first item in <var>tokens</var> is a U+002A ASTERISK character (*), then
- set <var>online whitelist wildcard flag</var> to <i>open</i> and jump back
- to the step labeled <i>start of line</i>.</p>
- <p>Otherwise, <a href=#resolve-a-url id=parsing-cache-manifests:resolve-a-url-3>resolve</a> the first item in <var>tokens</var>, relative to <var>base URL</var>, with the URL character
- encoding set to UTF-8; ignore the rest.</p>
- <p>If this fails, then jump back to the step labeled <i>start of line</i>.</p>
- <p>If the resulting <a href=#parsed-url id=parsing-cache-manifests:parsed-url-6>parsed URL</a> has a different <a href=#concept-url-scheme id=parsing-cache-manifests:concept-url-scheme-2>scheme</a> component than <var>base URL</var> (the
- manifest's URL), then jump back to the step labeled <i>start of line</i>.</p>
- <p>Let <var>new URL</var> be the result of applying the <a href=#concept-url-serialiser id=parsing-cache-manifests:concept-url-serialiser-4>URL serialiser</a> algorithm to the resulting <a href=#parsed-url id=parsing-cache-manifests:parsed-url-7>parsed
- URL</a>, with the <i>exclude fragment flag</i> set.</p>
- <p>Add <var>new URL</var> to the <var>online whitelist namespaces</var>.</p>
- <dt>If <var>mode</var> is "settings"<dd>
- <p>If <var>tokens</var> contains a single token, and that token is a
- <a href=#case-sensitive id=parsing-cache-manifests:case-sensitive>case-sensitive</a> match for the string "<code>prefer-online</code>", then
- set <var>cache mode flag</var> to <i>prefer-online</i> and jump back to the
- step labeled <i>start of line</i>.</p>
- <p>Otherwise, the line is an unsupported setting: do nothing; the line is ignored.</p>
- <dt>If <var>mode</var> is "unknown"<dd>
- <p>Do nothing. The line is ignored.</p>
- </dl>
- <li><p>Jump back to the step labeled <i>start of line</i>. (That step jumps to the next, and last,
- step when the end of the file is reached.)<li><p>Return the <var>explicit URLs</var> list, the <var>fallback URLs</var>
- mapping, the <var>online whitelist namespaces</var>, the <var>online whitelist
- wildcard flag</var>, and the <var>cache mode flag</var>.</ol>
- <div class=note>
- <p>The resource that declares the manifest (with the <code id=parsing-cache-manifests:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute) will always get taken from the cache,
- whether it is listed in the cache or not, even if it is listed in an <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist-2>online whitelist namespace</a>.</p>
- <p>If a resource is listed in the <a href=#concept-appcache-manifest-explicit id=parsing-cache-manifests:concept-appcache-manifest-explicit>explicit
- section</a> or as a <a href=#concept-appcache-fallback id=parsing-cache-manifests:concept-appcache-fallback-3>fallback entry</a> in the <a href=#concept-appcache-manifest-fallback id=parsing-cache-manifests:concept-appcache-manifest-fallback>fallback section</a>, the resource will always be
- taken from the cache, regardless of any other matching entries in the <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-4>fallback namespaces</a> or <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist-3>online whitelist namespaces</a>.</p>
- <p>When a <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-5>fallback namespace</a> and an <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist-4>online whitelist namespace</a> overlap, the <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist-5>online whitelist namespace</a> has priority.</p>
- <p>The <a href=#concept-appcache-onlinewhitelist-wildcard id=parsing-cache-manifests:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard
- flag</a> is applied last, only for URLs that match neither the <a href=#concept-appcache-onlinewhitelist id=parsing-cache-manifests:concept-appcache-onlinewhitelist-6>online whitelist namespace</a> nor the <a href=#concept-appcache-fallback-ns id=parsing-cache-manifests:concept-appcache-fallback-ns-6>fallback namespace</a> and that are not listed in the
- <a href=#concept-appcache-manifest-explicit id=parsing-cache-manifests:concept-appcache-manifest-explicit-2>explicit section</a>.</p>
- </div>
- <h4 id=downloading-or-updating-an-application-cache>7.7.4 Downloading or updating an application cache</h4>
- <p>When the user agent is required (by other parts of this specification) to start the
- <dfn id=application-cache-download-process>application cache download process</dfn> for an <a href=#absolute-url id=downloading-or-updating-an-application-cache:absolute-url>absolute URL</a> purported to
- identify a <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest>manifest</a>, or for an <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group>application
- cache group</a>, potentially given a particular <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host>cache host</a>, and potentially given
- a <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master>master</a> resource, the user agent must run the steps
- below. These steps are always run asynchronously, in parallel with the <a href=#event-loop id=downloading-or-updating-an-application-cache:event-loop>event loop</a>
- <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task>tasks</a>.</p>
- <p>Some of these steps have requirements that only apply if the user agent <dfn id=shows-caching-progress>shows caching
- progress</dfn>. Support for this is optional. Caching progress UI could consist of a progress bar
- or message panel in the user agent's interface, or an overlay, or something else. Certain events
- fired during the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process>application cache download process</a> allow the script to override the
- display of such an interface. (Such events are delayed until after the <code id=downloading-or-updating-an-application-cache:event-load><a href=#event-load>load</a></code> event has fired.)
- The goal of this is to allow Web applications to provide more
- seamless update mechanisms, hiding from the user the mechanics of the application cache mechanism.
- User agents may display user interfaces independent of this, but are encouraged to not show
- prominent update progress notifications for applications that cancel the relevant events.</p>
- <p>The <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-2>application cache download process</a> steps are as follows:
- <ol><li><p>Optionally, wait until the permission to start the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-3>application cache download
- process</a> has been obtained from the user and until the user agent is confident that the
- network is available. This could include doing nothing until the user explicitly opts-in to
- caching the site, or could involve prompting the user for permission. The algorithm might never
- get past this point. (This step is particularly intended to be used by user agents running on
- severely space-constrained devices or in highly privacy-sensitive environments).<li>
- <p>Atomically, so as to avoid race conditions, perform the following substeps:</p>
- <ol><li>
- <p>Pick the appropriate substeps:</p>
- <dl class=switch><dt>If these steps were invoked with an <a href=#absolute-url id=downloading-or-updating-an-application-cache:absolute-url-2>absolute URL</a> purported to identify a
- <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest-2>manifest</a><dd>
- <p>Let <var>manifest URL</var> be that <a href=#absolute-url id=downloading-or-updating-an-application-cache:absolute-url-3>absolute URL</a>.</p>
- <p>If there is no <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-2>application cache group</a> identified by <var>manifest
- URL</var>, then create a new <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-3>application cache group</a> identified by <var>manifest URL</var>. Initially, it has no <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache>application caches</a>. One will be created later in this algorithm.</p>
- <dt>If these steps were invoked with an <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-4>application cache group</a><dd>
- <p>Let <var>manifest URL</var> be the <a href=#absolute-url id=downloading-or-updating-an-application-cache:absolute-url-4>absolute URL</a> of the <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest-3>manifest</a> used to identify the <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-5>application
- cache group</a> to be updated.</p>
- <p>If that <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-6>application cache group</a> is <a href=#concept-appcache-obsolete id=downloading-or-updating-an-application-cache:concept-appcache-obsolete>obsolete</a>, then abort this instance of the
- <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-4>application cache download process</a>. This can happen if another instance of this
- algorithm found the manifest to be 404 or 410 while this algorithm was waiting in the first
- step above.</p>
- </dl>
- <li><p>Let <var>cache group</var> be the <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-7>application cache group</a>
- identified by <var>manifest URL</var>.<li><p>If these steps were invoked with a <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master-2>master</a>
- resource, then add the resource, along with the resource's <code id=downloading-or-updating-an-application-cache:document><a href=#document>Document</a></code>, to <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters>list of pending
- master entries</a>.<li><p>If these steps were invoked with a <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-2>cache host</a>, and the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status>status</a> of <var>cache group</var> is
- <i>checking</i> or <i>downloading</i>, then <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task>queue a post-load task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event>fire a
- simple event</a> named <code id=downloading-or-updating-an-application-cache:event-appcache-checking><a href=#event-appcache-checking>checking</a></code> that is
- cancelable at the <code id=downloading-or-updating-an-application-cache:applicationcache><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-3>cache host</a>. The
- default action of this event must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress>shows caching progress</a>,
- the display of some sort of user interface indicating to the user that the user agent is
- checking to see if it can download the application.<li><p>If these steps were invoked with a <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-4>cache host</a>, and the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-2>status</a> of <var>cache group</var> is
- <i>downloading</i>, then also <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-2>queue a post-load task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-2>fire a simple
- event</a> named <code id=downloading-or-updating-an-application-cache:event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code> that is
- cancelable at the <code id=downloading-or-updating-an-application-cache:applicationcache-2><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-5>cache host</a>. The
- default action of this event must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-2>shows caching progress</a>,
- the display of some sort of user interface indicating to the user the application is being
- downloaded.<li><p>If the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-3>status</a> of the <var>cache
- group</var> is either <i>checking</i> or <i>downloading</i>, then abort this instance of the
- <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-5>application cache download process</a>, as an update is already in progress.<li><p>Set the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-4>status</a> of <var>cache
- group</var> to <i>checking</i>.</p>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-6>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-2>application cache</a> in
- <var>cache group</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-3>queue a post-load task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-3>fire a simple
- event</a> that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-checking-2><a href=#event-appcache-checking>checking</a></code> at
- the <code id=downloading-or-updating-an-application-cache:applicationcache-3><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-7>cache host</a>. The default action
- of these events must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-3>shows caching progress</a>, the display of
- some sort of user interface indicating to the user that the user agent is checking for the
- availability of updates.</ol>
- <p class=note>The remainder of the steps run asynchronously.</p>
- <p>If <var>cache group</var> already has an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-3>application cache</a> in it, then
- this is an <dfn id=concept-appcache-upgrade>upgrade attempt</dfn>. Otherwise, this is a
- <dfn id=concept-appcache-cache>cache attempt</dfn>.</p>
- <li><p>If this is a <a href=#concept-appcache-cache id=downloading-or-updating-an-application-cache:concept-appcache-cache>cache attempt</a>, then this
- algorithm was invoked with a <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-8>cache host</a>; <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-4>queue a post-load task</a> to
- <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-4>fire a simple event</a> named <code id=downloading-or-updating-an-application-cache:event-appcache-checking-3><a href=#event-appcache-checking>checking</a></code> that
- is cancelable at the <code id=downloading-or-updating-an-application-cache:applicationcache-4><a href=#applicationcache>ApplicationCache</a></code> singleton of that <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-9>cache host</a>. The
- default action of this event must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-4>shows caching progress</a>, the
- display of some sort of user interface indicating to the user that the user agent is checking for
- the availability of updates.<li>
- <p><i>Fetching the manifest</i>: <a href=#fetch id=downloading-or-updating-an-application-cache:fetch>Fetch</a> the resource from <var>manifest URL</var> with the <i>synchronous flag</i> set, and let <var>manifest</var> be that resource. HTTP caching semantics should be honored for this
- request.</p>
- <p>Parse <var>manifest</var> according to the <a href=#parse-a-manifest id=downloading-or-updating-an-application-cache:parse-a-manifest>rules for
- parsing manifests</a>, obtaining a list of <a href=#concept-appcache-explicit id=downloading-or-updating-an-application-cache:concept-appcache-explicit>explicit
- entries</a>, <a href=#concept-appcache-fallback id=downloading-or-updating-an-application-cache:concept-appcache-fallback>fallback entries</a> and the <a href=#concept-appcache-fallback-ns id=downloading-or-updating-an-application-cache:concept-appcache-fallback-ns>fallback namespaces</a> that map to them, entries for
- the <a href=#concept-appcache-onlinewhitelist id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist>online whitelist</a>, and values for the
- <a href=#concept-appcache-onlinewhitelist-wildcard id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard flag</a>
- and the <a href=#concept-appcache-mode id=downloading-or-updating-an-application-cache:concept-appcache-mode>cache mode flag</a>.</p>
- <p class=note>The <a href=#mime-type id=downloading-or-updating-an-application-cache:mime-type>MIME type</a> of the resource is ignored — it is assumed to
- be <code id=downloading-or-updating-an-application-cache:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code>. In the future, if new manifest formats are supported, the
- different types will probably be distinguished on the basis of the file signatures (for the
- current format, that is the "<code>CACHE MANIFEST</code>" string at the top of the
- file).</p>
- <li>
- <p>If <i>fetching the manifest</i> fails due to a 404 or 410 response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes>or equivalent</a>, then run these substeps:</p>
- <ol><li><p>Mark <var>cache group</var> as <a href=#concept-appcache-obsolete id=downloading-or-updating-an-application-cache:concept-appcache-obsolete-2>obsolete</a>. This <var>cache group</var> no
- longer exists for any purpose other than the processing of <code id=downloading-or-updating-an-application-cache:document-2><a href=#document>Document</a></code> objects
- already associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-4>application cache</a> in the <var>cache
- group</var>.<li><p>Let <var>task list</var> be an empty list of <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-2>tasks</a>.</p>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-10>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-5>application cache</a> in
- <var>cache group</var>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-3>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-5>fire
- a simple event</a> named <code id=downloading-or-updating-an-application-cache:event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code> that is
- cancelable at the <code id=downloading-or-updating-an-application-cache:applicationcache-5><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-11>cache host</a>, and
- append it to <var>task list</var>. The default action of these events must be, if the
- user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-5>shows caching progress</a>, the display of some sort of user interface
- indicating to the user that the application is no longer available for offline use.<li><p>For each entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-2>list of pending master entries</a>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-4>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-6>fire a simple event</a> that is cancelable named
- <code id=downloading-or-updating-an-application-cache:event-appcache-error><a href=#event-appcache-error>error</a></code> (not <code id=downloading-or-updating-an-application-cache:event-appcache-obsolete-2><a href=#event-appcache-obsolete>obsolete</a></code>!) at the <code id=downloading-or-updating-an-application-cache:applicationcache-6><a href=#applicationcache>ApplicationCache</a></code>
- singleton of the <code id=downloading-or-updating-an-application-cache:document-3><a href=#document>Document</a></code> for this entry, if there still is one, and append it to
- <var>task list</var>. The default action of this event must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-6>shows caching progress</a>, the display of some sort of user interface indicating to
- the user that the user agent failed to save the application for offline use.<li><p>If <var>cache group</var> has an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-6>application cache</a> whose <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness>completeness flag</a> is <i>incomplete</i>, then
- discard that <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-7>application cache</a>.</p>
- <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
- progress.<li><p>Let the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-5>status</a> of <var>cache
- group</var> be <i>idle</i>.<li><p>For each <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-5>task</a> in <var>task list</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-5>queue that task as a post-load task</a>.<li><p>Abort the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-6>application cache download process</a>.</ol>
- <li>
- <p>Otherwise, if <i>fetching the manifest</i> fails in some other way (e.g. the server returns
- another 4xx or 5xx response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-2>or equivalent</a>, or
- there is a DNS error, or the connection times out, or the user cancels the download, or the
- parser for manifests fails when checking the magic signature), or if the server returned a
- redirect, then run the <a href=#cache-failure-steps id=downloading-or-updating-an-application-cache:cache-failure-steps>cache failure steps</a>. <a href=#refsHTTP>[HTTP]</a></p>
- <li>
- <p>If this is an <a href=#concept-appcache-upgrade id=downloading-or-updating-an-application-cache:concept-appcache-upgrade>upgrade attempt</a> and the newly
- downloaded <var>manifest</var> is byte-for-byte identical to the manifest found in the
- <a href=#concept-appcache-newer id=downloading-or-updating-an-application-cache:concept-appcache-newer>newest</a> <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-8>application cache</a> in <var>cache group</var>, or the server reported it as "304 Not Modified" <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-3>or equivalent</a>, then run these substeps:</p>
- <ol><li><p>Let <var>cache</var> be the <a href=#concept-appcache-newer id=downloading-or-updating-an-application-cache:concept-appcache-newer-2>newest</a>
- <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-9>application cache</a> in <var>cache group</var>.<li><p>Let <var>task list</var> be an empty list of <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-6>tasks</a>.</p>
- <li>
- <p>For each entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-3>list of pending master entries</a>, wait for the
- resource for this entry to have either completely downloaded or failed.</p>
- <p>If the download failed (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-4>or equivalent</a>, or there is a DNS error, the
- connection times out, or the user cancels the download), or if the resource is labeled with
- the "no-store" cache directive, then create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-7>task</a> to
- <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-7>fire a simple event</a> that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-error-2><a href=#event-appcache-error>error</a></code> at the <code id=downloading-or-updating-an-application-cache:applicationcache-7><a href=#applicationcache>ApplicationCache</a></code> singleton of
- the <code id=downloading-or-updating-an-application-cache:document-4><a href=#document>Document</a></code> for this entry, if there still is one, and append it to <var>task list</var>. The default action of this event must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-7>shows caching progress</a>, the display of some sort of user interface indicating to
- the user that the user agent failed to save the application for offline use.</p>
- <p>Otherwise, associate the <code id=downloading-or-updating-an-application-cache:document-5><a href=#document>Document</a></code> for this entry with <var>cache</var>; store the resource for this entry in <var>cache</var>, if it
- isn't already there, and categorise its entry as a <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master-3>master entry</a>. If applying the <a href=#url-parser id=downloading-or-updating-an-application-cache:url-parser>URL parser</a>
- algorithm to the resource's <a href=#url id=downloading-or-updating-an-application-cache:url>URL</a> results in a <a href=#parsed-url id=downloading-or-updating-an-application-cache:parsed-url>parsed URL</a> that has a
- non-null <a href=#concept-url-fragment id=downloading-or-updating-an-application-cache:concept-url-fragment>fragment</a> component, the <a href=#url id=downloading-or-updating-an-application-cache:url-2>URL</a>
- used for the entry in <var>cache</var> must instead be the <a href=#absolute-url id=downloading-or-updating-an-application-cache:absolute-url-5>absolute URL</a>
- obtained from applying the <a href=#concept-url-serialiser id=downloading-or-updating-an-application-cache:concept-url-serialiser>URL serialiser</a>
- algorithm to the <a href=#parsed-url id=downloading-or-updating-an-application-cache:parsed-url-2>parsed URL</a> with the <i>exclude fragment flag</i> set
- (application caches never include fragment identifiers).</p>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-12>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-10>application cache</a> in
- <var>cache group</var>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-8>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-8>fire
- a simple event</a> that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code> at the <code id=downloading-or-updating-an-application-cache:applicationcache-8><a href=#applicationcache>ApplicationCache</a></code> singleton
- of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-13>cache host</a>, and append it to <var>task list</var>. The default
- action of these events must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-8>shows caching progress</a>, the
- display of some sort of user interface indicating to the user that the application is up to
- date.<li><p>Empty <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-4>list of pending master entries</a>.<li><p>If appropriate, remove any user interface indicating that an update for this cache is in
- progress.<li><p>Let the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-6>status</a> of <var>cache
- group</var> be <i>idle</i>.<li><p>For each <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-9>task</a> in <var>task list</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-6>queue that task as a post-load task</a>.<li><p>Abort the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-7>application cache download process</a>.</ol>
- <li><p>Let <var>new cache</var> be a newly created <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-11>application cache</a> in
- <var>cache group</var>. Set its <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-2>completeness
- flag</a> to <i>incomplete</i>.<li><p>For each entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-5>list of pending master entries</a>, associate the
- <code id=downloading-or-updating-an-application-cache:document-6><a href=#document>Document</a></code> for this entry with <var>new cache</var>.<li><p>Set the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-7>status</a> of <var>cache
- group</var> to <i>downloading</i>.<li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-14>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-12>application cache</a> in <var>cache group</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-7>queue a post-load task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-9>fire a simple
- event</a> that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-downloading-2><a href=#event-appcache-downloading>downloading</a></code>
- at the <code id=downloading-or-updating-an-application-cache:applicationcache-9><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-15>cache host</a>. The default action
- of these events must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-9>shows caching progress</a>, the display of
- some sort of user interface indicating to the user that a new version is being
- downloaded.<li><p>Let <var>file list</var> be an empty list of URLs with flags.<li><p>Add all the URLs in the list of <a href=#concept-appcache-explicit id=downloading-or-updating-an-application-cache:concept-appcache-explicit-2>explicit
- entries</a> obtained by parsing <var>manifest</var> to <var>file list</var>,
- each flagged with "explicit entry".<li><p>Add all the URLs in the list of <a href=#concept-appcache-fallback id=downloading-or-updating-an-application-cache:concept-appcache-fallback-2>fallback
- entries</a> obtained by parsing <var>manifest</var> to <var>file list</var>,
- each flagged with "fallback entry".<li><p>If this is an <a href=#concept-appcache-upgrade id=downloading-or-updating-an-application-cache:concept-appcache-upgrade-2>upgrade attempt</a>, then add all
- the URLs of <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master-4>master entries</a> in the <a href=#concept-appcache-newer id=downloading-or-updating-an-application-cache:concept-appcache-newer-3>newest</a> <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-13>application cache</a> in <var>cache group</var> whose <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-3>completeness
- flag</a> is <i>complete</i> to <var>file list</var>, each flagged with "master
- entry".<li><p>If any URL is in <var>file list</var> more than once, then merge the entries into
- one entry for that URL, that entry having all the flags that the original entries had.<li>
- <p>For each URL in <var>file list</var>, run the following steps. These steps may be
- run in parallel for two or more of the URLs at a time. If, while running these steps, the
- <code id=downloading-or-updating-an-application-cache:applicationcache-10><a href=#applicationcache>ApplicationCache</a></code> object's <code id=downloading-or-updating-an-application-cache:dom-appcache-abort><a href=#dom-appcache-abort>abort()</a></code> method
- <a href=#send-a-signal id=downloading-or-updating-an-application-cache:send-a-signal>sends a signal</a> to this instance of the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-8>application
- cache download process</a> algorithm, then run the <a href=#cache-failure-steps id=downloading-or-updating-an-application-cache:cache-failure-steps-2>cache failure steps</a>
- instead.</p>
- <ol><li>
- <p>If the resource URL being processed was flagged as neither an "explicit entry" nor or a
- "fallback entry", then the user agent may skip this URL.</p>
- <p class=note>This is intended to allow user agents to expire resources not listed in the
- manifest from the cache. Generally, implementors are urged to use an approach that expires
- lesser-used resources first.</p>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-16>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-14>application cache</a> in
- <var>cache group</var>, <a href=#queue-a-progress-post-load-task id=downloading-or-updating-an-application-cache:queue-a-progress-post-load-task>queue a progress post-load task</a> to <a href=#concept-event-fire id=downloading-or-updating-an-application-cache:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=downloading-or-updating-an-application-cache:concept-events-trusted>trusted</a>
- event with the name <code id=downloading-or-updating-an-application-cache:event-appcache-progress><a href=#event-appcache-progress>progress</a></code>, which does not
- bubble, which is cancelable, and which uses the <code id=downloading-or-updating-an-application-cache:progressevent><a href=#progressevent>ProgressEvent</a></code> interface, at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-11><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-17>cache host</a>. The <code id=downloading-or-updating-an-application-cache:dom-progressevent-lengthcomputable><a href=#dom-progressevent-lengthcomputable>lengthComputable</a></code> attribute must be set to
- true, the <code id=downloading-or-updating-an-application-cache:dom-progressevent-total><a href=#dom-progressevent-total>total</a></code> attribute must be set to the
- number of files in <var>file list</var>, and the <code id=downloading-or-updating-an-application-cache:dom-progressevent-loaded><a href=#dom-progressevent-loaded>loaded</a></code> attribute must be set to the number of files in
- <var>file list</var> that have been either downloaded or skipped so far. The default
- action of these events must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-10>shows caching progress</a>, the
- display of some sort of user interface indicating to the user that a file is being downloaded
- in preparation for updating the application. <a href=#refsXHR>[XHR]</a><li>
- <p><a href=#fetch id=downloading-or-updating-an-application-cache:fetch-2>Fetch</a> the resource, from the <a href=#origin-2 id=downloading-or-updating-an-application-cache:origin-2>origin</a> of the
- <a href=#url id=downloading-or-updating-an-application-cache:url-3>URL</a> <var>manifest URL</var>, with the <i>synchronous flag</i> set and
- the <i>manual redirect flag</i> set. If this is an <a href=#concept-appcache-upgrade id=downloading-or-updating-an-application-cache:concept-appcache-upgrade-3>upgrade attempt</a>, then use the <a href=#concept-appcache-newer id=downloading-or-updating-an-application-cache:concept-appcache-newer-4>newest</a> <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-15>application cache</a> in <var>cache group</var> as an HTTP cache, and honor HTTP caching semantics (such as
- expiration, ETags, and so forth) with respect to that cache. User agents may also have other
- caches in place that are also honored.</p>
- <p class=note>If the resource in question is already being downloaded for other reasons then
- the existing download process can sometimes be used for the purposes of this step, as defined
- by the <a href=#fetch id=downloading-or-updating-an-application-cache:fetch-3>fetching</a> algorithm.</p>
- <p class=example>An example of a resource that might already be being downloaded is a large
- image on a Web page that is being seen for the first time. The image would get downloaded to
- satisfy the <code id=downloading-or-updating-an-application-cache:the-img-element><a href=#the-img-element>img</a></code> element on the page, as well as being listed in the cache
- manifest. According to the rules for <a href=#fetch id=downloading-or-updating-an-application-cache:fetch-4>fetching</a> that image only need
- be downloaded once, and it can be used both for the cache and for the rendered Web page.</p>
- <li>
- <p>If the previous step fails (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-5>or equivalent</a>, or there is a DNS error, or the
- connection times out, or the user cancels the download), or if the server returned a redirect,
- or if the resource is labeled with the "no-store" cache directive, then run the first
- appropriate step from the following list: <a href=#refsHTTP>[HTTP]</a></p>
- <dl class=switch><dt>If the URL being processed was flagged as an "explicit entry" or a "fallback entry"<dd>
- <p>If these steps are being run in parallel for any other URLs in <var>file
- list</var>, then abort these steps for those other URLs. Run the <a href=#cache-failure-steps id=downloading-or-updating-an-application-cache:cache-failure-steps-3>cache failure
- steps</a>.</p>
- <p class=note>Redirects are fatal because they are either indicative of a network problem
- (e.g. a captive portal); or would allow resources to be added to the cache under URLs that
- differ from any URL that the networking model will allow access to, leaving orphan entries;
- or would allow resources to be stored under URLs different than their true URLs. All of
- these situations are bad.</p>
- <dt>If the error was a 404 or 410 HTTP response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-6>or equivalent</a><dt>If the resource was labeled with the "no-store" cache directive<dd>
- <p>Skip this resource. It is dropped from the cache.</p>
- <dt>Otherwise<dd>
- <p>Copy the resource and its metadata from the <a href=#concept-appcache-newer id=downloading-or-updating-an-application-cache:concept-appcache-newer-5>newest</a> <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-16>application cache</a> in <var>cache group</var> whose <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-4>completeness
- flag</a> is <i>complete</i>, and act as if that was the fetched resource, ignoring the
- resource obtained from the network.</p>
- </dl>
- <p>User agents may warn the user of these errors as an aid to development.</p>
- <p class=note>These rules make errors for resources listed in the manifest fatal, while
- making it possible for other resources to be removed from caches when they are removed from
- the server, without errors, and making non-manifest resources survive server-side errors.</p>
- <p class=note>Except for the "no-store" directive, HTTP caching rules that would cause a
- file to be expired or otherwise not cached are ignored for the purposes of the
- <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-9>application cache download process</a>.</p>
- <li>
- <p>Otherwise, the fetching succeeded. Store the resource in the <var>new
- cache</var>.</p>
- <p>If the user agent is not able to store the resource (e.g. because of quota restrictions),
- the user agent may prompt the user or try to resolve the problem in some other manner (e.g.
- automatically pruning content in other caches). If the problem cannot be resolved, the user
- agent must run the <a href=#cache-failure-steps id=downloading-or-updating-an-application-cache:cache-failure-steps-4>cache failure steps</a>.</p>
- <li><p>If the URL being processed was flagged as an "explicit entry" in <var>file
- list</var>, then categorise the entry as an <a href=#concept-appcache-explicit id=downloading-or-updating-an-application-cache:concept-appcache-explicit-3>explicit
- entry</a>.<li><p>If the URL being processed was flagged as a "fallback entry" in <var>file
- list</var>, then categorise the entry as a <a href=#concept-appcache-fallback id=downloading-or-updating-an-application-cache:concept-appcache-fallback-3>fallback
- entry</a>.<li><p>If the URL being processed was flagged as an "master entry" in <var>file
- list</var>, then categorise the entry as a <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master-5>master
- entry</a>.<li><p>As an optimization, if the resource is an HTML or XML file whose root element is an
- <code id=downloading-or-updating-an-application-cache:the-html-element><a href=#the-html-element>html</a></code> element with a <code id=downloading-or-updating-an-application-cache:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute
- whose value doesn't match the manifest URL of the application cache being processed, then the
- user agent should mark the entry as being <a href=#concept-appcache-foreign id=downloading-or-updating-an-application-cache:concept-appcache-foreign>foreign</a>.</p>
- </ol>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-18>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-17>application cache</a> in <var>cache group</var>, <a href=#queue-a-progress-post-load-task id=downloading-or-updating-an-application-cache:queue-a-progress-post-load-task-2>queue a progress post-load task</a> to <a href=#concept-event-fire id=downloading-or-updating-an-application-cache:concept-event-fire-2>fire</a> a <a href=#concept-events-trusted id=downloading-or-updating-an-application-cache:concept-events-trusted-2>trusted</a>
- event with the name <code id=downloading-or-updating-an-application-cache:event-appcache-progress-2><a href=#event-appcache-progress>progress</a></code>, which does not bubble,
- which is cancelable, and which uses the <code id=downloading-or-updating-an-application-cache:progressevent-2><a href=#progressevent>ProgressEvent</a></code> interface, at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-12><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-19>cache host</a>. The <code id=downloading-or-updating-an-application-cache:dom-progressevent-lengthcomputable-2><a href=#dom-progressevent-lengthcomputable>lengthComputable</a></code> attribute must be set to
- true, the <code id=downloading-or-updating-an-application-cache:dom-progressevent-total-2><a href=#dom-progressevent-total>total</a></code> and the <code id=downloading-or-updating-an-application-cache:dom-progressevent-loaded-2><a href=#dom-progressevent-loaded>loaded</a></code> attributes must be set to the number of files in
- <var>file list</var>. The default action of these events must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-11>shows caching progress</a>, the display of some sort of user interface indicating to the
- user that all the files have been downloaded. <a href=#refsXHR>[XHR]</a><li><p>Store the list of <a href=#concept-appcache-fallback-ns id=downloading-or-updating-an-application-cache:concept-appcache-fallback-ns-2>fallback namespaces</a>,
- and the URLs of the <a href=#concept-appcache-fallback id=downloading-or-updating-an-application-cache:concept-appcache-fallback-4>fallback entries</a> that they map
- to, in <var>new cache</var>.<li><p>Store the URLs that form the new <a href=#concept-appcache-onlinewhitelist id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist-2>online
- whitelist</a> in <var>new cache</var>.<li><p>Store the value of the new <a href=#concept-appcache-onlinewhitelist-wildcard id=downloading-or-updating-an-application-cache:concept-appcache-onlinewhitelist-wildcard-2>online
- whitelist wildcard flag</a> in <var>new cache</var>.<li><p>Store the value of the new <a href=#concept-appcache-mode id=downloading-or-updating-an-application-cache:concept-appcache-mode-2>cache mode flag</a> in
- <var>new cache</var>.<li>
- <p>For each entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-6>list of pending master entries</a>, wait for the
- resource for this entry to have either completely downloaded or failed.</p>
- <p>If the download failed (e.g. the server returns a 4xx or 5xx response <a href=#concept-http-equivalent-codes id=downloading-or-updating-an-application-cache:concept-http-equivalent-codes-7>or equivalent</a>, or there is a DNS error, the
- connection times out, or the user cancels the download), or if the resource is labeled with the
- "no-store" cache directive, then run these substeps:</p>
- <ol><li><p>Unassociate the <code id=downloading-or-updating-an-application-cache:document-7><a href=#document>Document</a></code> for this entry from <var>new
- cache</var>.<li><p><a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-8>Queue a post-load task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-10>fire a simple event</a> that is
- cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-error-3><a href=#event-appcache-error>error</a></code> at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-13><a href=#applicationcache>ApplicationCache</a></code> singleton of the <code id=downloading-or-updating-an-application-cache:document-8><a href=#document>Document</a></code> for this entry, if there
- still is one. The default action of this event must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-12>shows caching
- progress</a>, the display of some sort of user interface indicating to the user that the
- user agent failed to save the application for offline use.</p>
- <li>
- <p>If this is a <a href=#concept-appcache-cache id=downloading-or-updating-an-application-cache:concept-appcache-cache-2>cache attempt</a> and this entry is
- the last entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-7>list of pending master entries</a>, then run these
- further substeps:</p>
- <ol><li><p>Discard <var>cache group</var> and its only <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-18>application cache</a>,
- <var>new cache</var>.</p>
- <li><p>If appropriate, remove any user interface indicating that an update for this cache is
- in progress.<li><p>Abort the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-10>application cache download process</a>.</ol>
- <li><p>Otherwise, remove this entry from <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-8>list of pending master entries</a>.</ol>
- <p>Otherwise, store the resource for this entry in <var>new cache</var>, if it isn't
- already there, and categorise its entry as a <a href=#concept-appcache-master id=downloading-or-updating-an-application-cache:concept-appcache-master-6>master
- entry</a>.</p>
- <li>
- <p><a href=#fetch id=downloading-or-updating-an-application-cache:fetch-5>Fetch</a> the resource from <var>manifest URL</var> again, with
- the <i>synchronous flag</i> set, and let <var>second manifest</var> be that resource.
- HTTP caching semantics should again be honored for this request.</p>
- <p class=note>Since caching can be honored, authors are encouraged to avoid setting the cache
- headers on the manifest in such a way that the user agent would simply not contact the network
- for this second request; otherwise, the user agent would not notice if the cache had changed
- during the cache update process.</p>
- <li>
- <p>If the previous step failed for any reason, or if the fetching attempt involved a redirect,
- or if <var>second manifest</var> and <var>manifest</var> are not byte-for-byte
- identical, then schedule a rerun of the entire algorithm with the same parameters after a short
- delay, and run the <a href=#cache-failure-steps id=downloading-or-updating-an-application-cache:cache-failure-steps-5>cache failure steps</a>.</p>
- <li>
- <p>Otherwise, store <var>manifest</var> in <var>new cache</var>, if it's not
- there already, and categorise its entry as <a href=#concept-appcache-manifest id=downloading-or-updating-an-application-cache:concept-appcache-manifest-4>the
- manifest</a>.</p>
- <li><p>Set the <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-5>completeness flag</a> of <var>new cache</var> to <i>complete</i>.<li><p>Let <var>task list</var> be an empty list of <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-10>tasks</a>.</p>
- <li>
- <p>If this is a <a href=#concept-appcache-cache id=downloading-or-updating-an-application-cache:concept-appcache-cache-3>cache attempt</a>, then for each
- <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-20>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-19>application cache</a> in <var>cache
- group</var>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-11>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-11>fire a simple event</a>
- that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-cached><a href=#event-appcache-cached>cached</a></code> at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-14><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-21>cache host</a>, and append it to <var>task list</var>. The default action of these events must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-13>shows caching progress</a>, the display of some sort of user interface indicating to
- the user that the application has been cached and that they can now use it offline.</p>
- <p>Otherwise, it is an <a href=#concept-appcache-upgrade id=downloading-or-updating-an-application-cache:concept-appcache-upgrade-4>upgrade attempt</a>. For each
- <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-22>cache host</a> associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-20>application cache</a> in <var>cache
- group</var>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-12>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-12>fire a simple event</a>
- that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-15><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-23>cache host</a>, and append it to <var>task list</var>. The default action of these events must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-14>shows caching progress</a>, the display of some sort of user interface indicating to
- the user that a new version is available and that they can activate it by reloading the
- page.</p>
- <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
- progress.<li><p>Set the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-8>update status</a> of <var>cache
- group</var> to <i>idle</i>.<li><p>For each <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-13>task</a> in <var>task list</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-9>queue that task as a post-load task</a>.</ol>
- <p>The <dfn id=cache-failure-steps>cache failure steps</dfn> are as follows:</p>
- <ol><li><p>Let <var>task list</var> be an empty list of <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-14>tasks</a>.</p>
- <li>
- <p>For each entry in <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-9>list of pending master entries</a>, run the
- following further substeps. These steps may be run in parallel for two or more entries at a
- time.</p>
- <ol><li><p>Wait for the resource for this entry to have either completely downloaded or failed.</p>
- <li><p>Unassociate the <code id=downloading-or-updating-an-application-cache:document-9><a href=#document>Document</a></code> for this entry from its <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-21>application
- cache</a>, if it has one.<li><p>Create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-15>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-13>fire a simple event</a> that
- is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-error-4><a href=#event-appcache-error>error</a></code> at the
- <code id=downloading-or-updating-an-application-cache:applicationcache-16><a href=#applicationcache>ApplicationCache</a></code> singleton of the <code id=downloading-or-updating-an-application-cache:document-10><a href=#document>Document</a></code> for this entry, if there
- still is one, and append it to <var>task list</var>. The default action of these
- events must be, if the user agent <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-15>shows caching progress</a>, the display of some sort
- of user interface indicating to the user that the user agent failed to save the application for
- offline use.</p>
- </ol>
- <li><p>For each <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-24>cache host</a> still associated with an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-22>application cache</a>
- in <var>cache group</var>, create a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-16>task</a> to <a href=#fire-a-simple-event id=downloading-or-updating-an-application-cache:fire-a-simple-event-14>fire
- a simple event</a> that is cancelable named <code id=downloading-or-updating-an-application-cache:event-appcache-error-5><a href=#event-appcache-error>error</a></code> at
- the <code id=downloading-or-updating-an-application-cache:applicationcache-17><a href=#applicationcache>ApplicationCache</a></code> singleton of the <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-25>cache host</a>, and append it to <var>task list</var>. The default action of these events must be, if the user agent
- <a href=#shows-caching-progress id=downloading-or-updating-an-application-cache:shows-caching-progress-16>shows caching progress</a>, the display of some sort of user interface indicating to the
- user that the user agent failed to save the application for offline use.<li><p>Empty <var>cache group</var>'s <a href=#concept-appcache-pending-masters id=downloading-or-updating-an-application-cache:concept-appcache-pending-masters-10>list of pending master entries</a>.<li><p>If <var>cache group</var> has an <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-23>application cache</a> whose <a href=#concept-appcache-completeness id=downloading-or-updating-an-application-cache:concept-appcache-completeness-6>completeness flag</a> is <i>incomplete</i>, then discard
- that <a href=#application-cache id=downloading-or-updating-an-application-cache:application-cache-24>application cache</a>.</p>
- <li><p>If appropriate, remove any user interface indicating that an update for this cache is in
- progress.<li><p>Let the <a href=#concept-appcache-status id=downloading-or-updating-an-application-cache:concept-appcache-status-9>status</a> of <var>cache
- group</var> be <i>idle</i>.<li><p>If this was a <a href=#concept-appcache-cache id=downloading-or-updating-an-application-cache:concept-appcache-cache-4>cache attempt</a>, discard <var>cache group</var> altogether.</p>
- <li><p>For each <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-17>task</a> in <var>task list</var>, <a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-10>queue that task as a post-load task</a>.<li><p>Abort the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-11>application cache download process</a>.</ol>
- <p>Attempts to <a href=#fetch id=downloading-or-updating-an-application-cache:fetch-6>fetch</a> resources as part of the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-12>application cache download
- process</a> may be done with cache-defeating semantics, to avoid problems with stale or
- inconsistent intermediary caches.</p>
- <hr>
- <p>User agents may invoke the <a href=#application-cache-download-process id=downloading-or-updating-an-application-cache:application-cache-download-process-13>application cache download process</a>, in the background,
- for any <a href=#application-cache-group id=downloading-or-updating-an-application-cache:application-cache-group-8>application cache group</a>, at any time (with no <a href=#cache-host id=downloading-or-updating-an-application-cache:cache-host-26>cache host</a>). This
- allows user agents to keep caches primed and to update caches even before the user visits a
- site.</p>
- <hr>
- <p>Each <code id=downloading-or-updating-an-application-cache:document-11><a href=#document>Document</a></code> has a list of <dfn id=pending-application-cache-download-process-tasks>pending application cache download process
- tasks</dfn> that is used to delay events fired by the algorithm above until the document's <code id=downloading-or-updating-an-application-cache:event-load-2><a href=#event-load>load</a></code> event has fired. When the <code id=downloading-or-updating-an-application-cache:document-12><a href=#document>Document</a></code> is created, the
- list must be empty.</p>
- <p>When the steps above say to <dfn id=queue-a-post-load-task>queue a post-load task</dfn> <var>task</var>, where
- <var>task</var> is a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-18>task</a> that dispatches an event on a
- target <code id=downloading-or-updating-an-application-cache:applicationcache-18><a href=#applicationcache>ApplicationCache</a></code> object <var>target</var>, the user agent must run
- the appropriate steps from the following list:</p>
- <dl><dt>If <var>target</var>'s <a id=downloading-or-updating-an-application-cache:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is
- <a href=#ready-for-post-load-tasks id=downloading-or-updating-an-application-cache:ready-for-post-load-tasks>ready for post-load tasks</a><dd><p><a href=#queue-a-task id=downloading-or-updating-an-application-cache:queue-a-task>Queue</a> the task <var>task</var>.<dt>Otherwise<dd><p>Add <var>task</var> to <var>target</var>'s <a id=downloading-or-updating-an-application-cache:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s list
- of <a href=#pending-application-cache-download-process-tasks id=downloading-or-updating-an-application-cache:pending-application-cache-download-process-tasks>pending application cache download process tasks</a>.</dl>
- <p>When the steps above say to <dfn id=queue-a-progress-post-load-task>queue a progress post-load task</dfn> <var>task</var>, where
- <var>task</var> is a <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-19>task</a> that dispatches an event on a
- target <code id=downloading-or-updating-an-application-cache:applicationcache-19><a href=#applicationcache>ApplicationCache</a></code> object <var>target</var>, the user agent must run
- the following steps:</p>
- <ol><li><p>If there is a <var>task</var> in <var>target</var>'s <a id=downloading-or-updating-an-application-cache:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s list
- of <a href=#pending-application-cache-download-process-tasks id=downloading-or-updating-an-application-cache:pending-application-cache-download-process-tasks-2>pending application cache download process tasks</a> that is labeled as a
- <i>progress task</i>, then remove that task from the list.<li><p>Label <var>task</var> as a <i>progress task</i>.<li><p><a href=#queue-a-post-load-task id=downloading-or-updating-an-application-cache:queue-a-post-load-task-11>Queue a post-load task</a> <var>task</var>.</ol>
- <p>The <a href=#task-source id=downloading-or-updating-an-application-cache:task-source>task source</a> for these <a href=#concept-task id=downloading-or-updating-an-application-cache:concept-task-20>tasks</a> is the
- <a href=#networking-task-source id=downloading-or-updating-an-application-cache:networking-task-source>networking task source</a>.</p>
- <h4 id=the-application-cache-selection-algorithm>7.7.5 The application cache selection algorithm</h4>
- <p>When the <dfn id=concept-appcache-init>application cache selection algorithm</dfn>
- algorithm is invoked with a <code id=the-application-cache-selection-algorithm:document><a href=#document>Document</a></code> <var>document</var> and optionally a
- manifest <a href=#url id=the-application-cache-selection-algorithm:url>URL</a> <var>manifest URL</var>, the user agent must run the first
- applicable set of steps from the following list:</p>
- <dl class=switch><dt>If there is a <var>manifest URL</var>, and <var>document</var> was loaded
- from an <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache>application cache</a>, and the URL of the <a href=#concept-appcache-manifest id=the-application-cache-selection-algorithm:concept-appcache-manifest>manifest</a> of that cache's <a href=#application-cache-group id=the-application-cache-selection-algorithm:application-cache-group>application cache
- group</a> is <em>not</em> the same as <var>manifest URL</var><dd>
- <p>Mark the entry for the resource from which <var>document</var> was taken in the
- <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-2>application cache</a> from which it was loaded as <a href=#concept-appcache-foreign id=the-application-cache-selection-algorithm:concept-appcache-foreign>foreign</a>.</p>
- <p>Restart the current navigation from the top of the <a href=#navigate id=the-application-cache-selection-algorithm:navigate>navigation
- algorithm</a>, undoing any changes that were made as part of the initial load (changes can be
- avoided by ensuring that the step to <a href=#update-the-session-history-with-the-new-page id=the-application-cache-selection-algorithm:update-the-session-history-with-the-new-page>update the session history with the new page</a>
- is only ever completed <em>after</em> this <a href=#concept-appcache-init id=the-application-cache-selection-algorithm:concept-appcache-init>application cache
- selection algorithm</a> is run, though this is not required).</p>
- <p class=note>The navigation will not result in the same resource being loaded, because
- "foreign" entries are never picked during navigation.</p>
- <p>User agents may notify the user of the inconsistency between the cache manifest and the
- document's own metadata, to aid in application development.</p>
- <dt>If <var>document</var> was loaded from an <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-3>application cache</a>, and that
- <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-4>application cache</a> still exists (it is not now <a href=#concept-appcache-obsolete id=the-application-cache-selection-algorithm:concept-appcache-obsolete>obsolete</a>)<dd>
- <p>Associate <var>document</var> with the <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-5>application cache</a> from which it
- was loaded. Invoke, in the background, the <a href=#application-cache-download-process id=the-application-cache-selection-algorithm:application-cache-download-process>application cache download process</a> for
- that <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-6>application cache</a>'s <a href=#application-cache-group id=the-application-cache-selection-algorithm:application-cache-group-2>application cache group</a>, with <var>document</var> as the <a href=#cache-host id=the-application-cache-selection-algorithm:cache-host>cache host</a>.</p>
- <dt>If <var>document</var> was loaded using HTTP GET <a href=#concept-http-equivalent-get id=the-application-cache-selection-algorithm:concept-http-equivalent-get>or
- equivalent</a>, and, there is a <var>manifest URL</var>, and <var>manifest
- URL</var> has the <a href=#same-origin id=the-application-cache-selection-algorithm:same-origin>same origin</a> as <var>document</var><dd>
- <p>Invoke, in the background, the <a href=#application-cache-download-process id=the-application-cache-selection-algorithm:application-cache-download-process-2>application cache download process</a> for <var>manifest URL</var>, with <var>document</var> as the <a href=#cache-host id=the-application-cache-selection-algorithm:cache-host-2>cache host</a>
- and with the resource from which <var>document</var> was parsed as the <a href=#concept-appcache-master id=the-application-cache-selection-algorithm:concept-appcache-master>master</a> resource.</p>
- <p>If there are <a href=#relevant-application-cache id=the-application-cache-selection-algorithm:relevant-application-cache>relevant application caches</a> that
- are identified by a URL with the <a href=#same-origin id=the-application-cache-selection-algorithm:same-origin-2>same origin</a> as the URL of <var>document</var>, and that have this URL as one of their entries, excluding entries
- marked as <a href=#concept-appcache-foreign id=the-application-cache-selection-algorithm:concept-appcache-foreign-2>foreign</a>, then the user agent should use
- the <a href=#concept-appcache-selection id=the-application-cache-selection-algorithm:concept-appcache-selection>most appropriate application cache</a> of those
- that match as an HTTP cache for any subresource loads. User agents may also have other caches in
- place that are also honored.</p>
- <dt>Otherwise<dd>
- <p>The <code id=the-application-cache-selection-algorithm:document-2><a href=#document>Document</a></code> is not associated with any <a href=#application-cache id=the-application-cache-selection-algorithm:application-cache-7>application cache</a>.</p>
- <p>If there was a <var>manifest URL</var>, the user agent may report to the user that
- it was ignored, to aid in application development.</p>
- </dl>
- <h4 id=changesToNetworkingModel>7.7.6 Changes to the networking model</h4>
- <p>When a <a href=#cache-host id=changesToNetworkingModel:cache-host>cache host</a> is associated with an <a href=#application-cache id=changesToNetworkingModel:application-cache>application cache</a> whose <a href=#concept-appcache-completeness id=changesToNetworkingModel:concept-appcache-completeness>completeness flag</a> is <i>complete</i>, any and all
- loads for resources related to that <a href=#cache-host id=changesToNetworkingModel:cache-host-2>cache host</a> other than those for <a href=#child-browsing-context id=changesToNetworkingModel:child-browsing-context>child browsing contexts</a> must go through the following steps
- instead of immediately invoking the mechanisms appropriate to that resource's scheme:</p>
- <ol><li><p>If the resource is not to be fetched using the HTTP GET mechanism <a href=#concept-http-equivalent-get id=changesToNetworkingModel:concept-http-equivalent-get>or equivalent</a>, or if applying the <a href=#url-parser id=changesToNetworkingModel:url-parser>URL
- parser</a> algorithm to both its <a href=#url id=changesToNetworkingModel:url>URL</a> and the <a href=#application-cache id=changesToNetworkingModel:application-cache-2>application cache</a>'s
- <a href=#concept-appcache-manifest id=changesToNetworkingModel:concept-appcache-manifest>manifest</a>'s URL results in two <a href=#parsed-url id=changesToNetworkingModel:parsed-url>parsed URLs</a> with different <a href=#concept-url-scheme id=changesToNetworkingModel:concept-url-scheme>scheme</a> components,
- then <a href=#fetch id=changesToNetworkingModel:fetch>fetch</a> the resource normally and abort these steps.<li><p>If the resource's URL is <a href=#concept-appcache-master id=changesToNetworkingModel:concept-appcache-master>a master entry</a>,
- <a href=#concept-appcache-manifest id=changesToNetworkingModel:concept-appcache-manifest-2>the manifest</a>, <a href=#concept-appcache-explicit id=changesToNetworkingModel:concept-appcache-explicit>an explicit entry</a>, or <a href=#concept-appcache-fallback id=changesToNetworkingModel:concept-appcache-fallback>a fallback entry</a> in the <a href=#application-cache id=changesToNetworkingModel:application-cache-3>application cache</a>,
- then get the resource from the cache (instead of fetching it), and abort these steps.<li><p>If there is an entry in the <a href=#application-cache id=changesToNetworkingModel:application-cache-4>application cache</a>'s <a href=#concept-appcache-onlinewhitelist id=changesToNetworkingModel:concept-appcache-onlinewhitelist>online whitelist</a> that has the <a href=#same-origin id=changesToNetworkingModel:same-origin>same
- origin</a> as the resource's URL and that is a <a href=#prefix-match id=changesToNetworkingModel:prefix-match>prefix match</a> for the resource's
- URL, then <a href=#fetch id=changesToNetworkingModel:fetch-2>fetch</a> the resource normally and abort these steps.<li>
- <p>If the resource's URL has the <a href=#same-origin id=changesToNetworkingModel:same-origin-2>same origin</a> as the manifest's URL, and there is a
- <a href=#concept-appcache-fallback-ns id=changesToNetworkingModel:concept-appcache-fallback-ns>fallback namespace</a> <var>f</var> in
- the <a href=#application-cache id=changesToNetworkingModel:application-cache-5>application cache</a> that is a <a href=#prefix-match id=changesToNetworkingModel:prefix-match-2>prefix match</a> for the resource's URL,
- then:</p>
- <p><a href=#fetch id=changesToNetworkingModel:fetch-3>Fetch</a> the resource normally. If this results in a redirect to a resource with
- another <a href=#origin-2 id=changesToNetworkingModel:origin-2>origin</a> (indicative of a captive portal), or a 4xx or 5xx status code <a href=#concept-http-equivalent-codes id=changesToNetworkingModel:concept-http-equivalent-codes>or equivalent</a>, or if there were network errors (but
- not if the user canceled the download), then instead get, from the cache, the resource of the
- <a href=#concept-appcache-fallback id=changesToNetworkingModel:concept-appcache-fallback-2>fallback entry</a> corresponding to the <a href=#concept-appcache-fallback-ns id=changesToNetworkingModel:concept-appcache-fallback-ns-2>fallback namespace</a> <var>f</var>. Abort
- these steps.</p>
- <li><p>If the <a href=#application-cache id=changesToNetworkingModel:application-cache-6>application cache</a>'s <a href=#concept-appcache-onlinewhitelist-wildcard id=changesToNetworkingModel:concept-appcache-onlinewhitelist-wildcard>online whitelist wildcard flag</a> is <i>open</i>, then <a href=#fetch id=changesToNetworkingModel:fetch-4>fetch</a> the resource normally and abort these steps.<li><p>Fail the resource load as if there had been a generic network error.</ol>
- <p class=note>The above algorithm ensures that so long as the <a href=#concept-appcache-onlinewhitelist-wildcard id=changesToNetworkingModel:concept-appcache-onlinewhitelist-wildcard-2>online whitelist wildcard flag</a> is <i>blocking</i>, resources that are not present in the <a href=#concept-appcache-manifest id=changesToNetworkingModel:concept-appcache-manifest-3>manifest</a> will always fail to load (at least, after the
- <a href=#application-cache id=changesToNetworkingModel:application-cache-7>application cache</a> has been primed the first time), making the testing of offline
- applications simpler.</p>
-
-
- <h4 id=expiring-application-caches>7.7.7 Expiring application caches</h4>
- <p>As a general rule, user agents should not expire application caches, except on request from the
- user, or after having been left unused for an extended period of time.</p>
- <p>Application caches and cookies have similar implications with respect to privacy (e.g. if the
- site can identify the user when providing the cache, it can store data in the cache that can be
- used for cookie resurrection). Implementors are therefore encouraged to expose application caches
- in a manner related to HTTP cookies, allowing caches to be expunged together with cookies and
- other origin-specific data.</p>
- <p class=example>For example, a user agent could have a "delete site-specific data" feature that
- clears all cookies, application caches, local storage, databases, etc, from an origin all at
- once.</p>
-
-
- <h4 id=disk-space>7.7.8 Disk space</h4>
- <p>User agents should consider applying constraints on disk usage of <a href=#application-cache id=disk-space:application-cache>application caches</a>, and care should be taken to ensure that the restrictions cannot
- be easily worked around using subdomains.</p>
- <p>User agents should allow users to see how much space each domain is using, and may offer the
- user the ability to delete specific <a href=#application-cache id=disk-space:application-cache-2>application caches</a>.</p>
- <p>For predictability, quotas should be based on the uncompressed size of data stored.</p>
-
- <p class=note>How quotas are presented to the user is not defined by this specification. User
- agents are encouraged to provide features such as allowing a user to indicate that certain sites
- are trusted to use more than the default quota, e.g. by asynchronously presenting a user interface
- while a cache is being updated, or by having an explicit whitelist in the user agent's
- configuration interface.</p>
-
- <h4 id=security-concerns-with-offline-applications-caches>7.7.9 Security concerns with offline applications caches</h4>
- <p><i>This section is non-normative.</i></p>
- <p>The main risk introduced by offline application caches is that an injection attack can be
- elevated into persistent site-wide page replacement. This attack involves using an injection
- vulnerability to upload two files to the victim site. The first file is an application cache
- manifest consisting of just a fallback entry pointing to the second file, which is an HTML page
- whose manifest is declared as that first file. Once the user has been directed to that second
- file, all subsequent accesses to any file covered by the given fallback namespace while either the
- user or the site is offline will instead show that second file. Targetted denial-of-service
- attacks can be used to ensure that the site appears offline.</p>
- <p>To mitigate this, manifests can only specify fallbacks that are in the same path as the
- manifest itself. This means that a content injection upload vulnerability in a particular
- directory on a server can only be escalated to a take-over of that directory and its
- subdirectories. If there is no way to inject a file into the root directory, the entire site
- cannot be taken over.</p>
- <p>If a site has been attacked in this way, simply removing the offending manifest will eventually
- clear the problem, since the next time the manifest is updated, a 404 error will be seen, and the
- user agent will clear the cache. "Eventually" is the key word here, however; while the attack on
- the user or server is ongoing, such that connections from an affected user to the affected site
- are blocked, the user agent will simply assume that the user is offline and will continue to use
- the hostile manifest.</p>
- <p>TLS does not inherently protect a site from this attack, since the attack relies on content
- being served from the server itself. Not using application caches also does not prevent this
- attack, since the attack relies on an attacker-provided manifest.</p>
- <h4 id=application-cache-api>7.7.10 Application cache API</h4>
- <pre class=idl>[Exposed=(Window,SharedWorker)]
- interface <dfn id=applicationcache>ApplicationCache</dfn> : <a href=#eventtarget id=application-cache-api:eventtarget>EventTarget</a> {
- // <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status>update status</a>
- const unsigned short <a href=#dom-appcache-uncached id=application-cache-api:dom-appcache-uncached>UNCACHED</a> = 0;
- const unsigned short <a href=#dom-appcache-idle id=application-cache-api:dom-appcache-idle>IDLE</a> = 1;
- const unsigned short <a href=#dom-appcache-checking id=application-cache-api:dom-appcache-checking>CHECKING</a> = 2;
- const unsigned short <a href=#dom-appcache-downloading id=application-cache-api:dom-appcache-downloading>DOWNLOADING</a> = 3;
- const unsigned short <a href=#dom-appcache-updateready id=application-cache-api:dom-appcache-updateready>UPDATEREADY</a> = 4;
- const unsigned short <a href=#dom-appcache-obsolete id=application-cache-api:dom-appcache-obsolete>OBSOLETE</a> = 5;
- readonly attribute unsigned short <a href=#dom-appcache-status id=application-cache-api:dom-appcache-status>status</a>;
- // updates
- void <a href=#dom-appcache-update id=application-cache-api:dom-appcache-update>update</a>();
- void <a href=#dom-appcache-abort id=application-cache-api:dom-appcache-abort>abort</a>();
- void <a href=#dom-appcache-swapcache id=application-cache-api:dom-appcache-swapcache>swapCache</a>();
- // events
- attribute <a href=#eventhandler id=application-cache-api:eventhandler>EventHandler</a> <a href=#handler-appcache-onchecking id=application-cache-api:handler-appcache-onchecking>onchecking</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-2>EventHandler</a> <a href=#handler-appcache-onerror id=application-cache-api:handler-appcache-onerror>onerror</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-3>EventHandler</a> <a href=#handler-appcache-onnoupdate id=application-cache-api:handler-appcache-onnoupdate>onnoupdate</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-4>EventHandler</a> <a href=#handler-appcache-ondownloading id=application-cache-api:handler-appcache-ondownloading>ondownloading</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-5>EventHandler</a> <a href=#handler-appcache-onprogress id=application-cache-api:handler-appcache-onprogress>onprogress</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-6>EventHandler</a> <a href=#handler-appcache-onupdateready id=application-cache-api:handler-appcache-onupdateready>onupdateready</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-7>EventHandler</a> <a href=#handler-appcache-oncached id=application-cache-api:handler-appcache-oncached>oncached</a>;
- attribute <a href=#eventhandler id=application-cache-api:eventhandler-8>EventHandler</a> <a href=#handler-appcache-onobsolete id=application-cache-api:handler-appcache-onobsolete>onobsolete</a>;
- };</pre>
- <dl class=domintro><dt><var>cache</var> = <var>window</var> . <code id=application-cache-api:dom-applicationcache><a href=#dom-applicationcache>applicationCache</a></code><dd>
- <p>(In a window.) Returns the <code id=application-cache-api:applicationcache><a href=#applicationcache>ApplicationCache</a></code> object that applies to the
- <a href=#active-document id=application-cache-api:active-document>active document</a> of that <code id=application-cache-api:window><a href=#window>Window</a></code>.</p>
- <dt><var>cache</var> = <var>self</var> . <code id=application-cache-api:dom-applicationcache-2><a href=#dom-applicationcache>applicationCache</a></code><dd>
- <p>(In a shared worker.) Returns the <code id=application-cache-api:applicationcache-2><a href=#applicationcache>ApplicationCache</a></code> object that applies to the
- current shared worker.</p>
- <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-status-2><a href=#dom-appcache-status>status</a></code><dd>
- <p>Returns the current status of the application cache, as given by the constants defined
- below.</p>
- <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-update-2><a href=#dom-appcache-update>update</a></code>()<dd>
- <p>Invokes the <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process>application cache download process</a>.</p>
- <p>Throws an <code id=application-cache-api:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if there is no application cache to
- update.</p>
- <p>Calling this method is not usually necessary, as user agents will generally take care of
- updating <a href=#application-cache id=application-cache-api:application-cache>application caches</a> automatically.</p>
- <p>The method can be useful in situations such as long-lived applications. For example, a Web
- mail application might stay open in a browser tab for weeks at a time. Such an application could
- want to test for updates each day.</p>
- <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-abort-2><a href=#dom-appcache-abort>abort</a></code>()<dd>
- <p>Cancels the <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process-2>application cache download process</a>.</p>
- <p>This method is intended to be used by Web application showing their own caching progress UI,
- in case the user wants to stop the update (e.g. because bandwidth is limited).</p>
- <dt><var>cache</var> . <code id=application-cache-api:dom-appcache-swapcache-2><a href=#dom-appcache-swapcache>swapCache</a></code>()<dd>
- <p>Switches to the most recent application cache, if there is a newer one. If there isn't,
- throws an <code id=application-cache-api:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception.</p>
- <p>This does not cause previously-loaded resources to be reloaded; for example, images do not
- suddenly get reloaded and style sheets and scripts do not get reparsed or reevaluated. The only
- change is that subsequent requests for cached resources will obtain the newer copies.</p>
- <p>The <code id=application-cache-api:event-appcache-updateready><a href=#event-appcache-updateready>updateready</a></code> event will fire before this
- method can be called. Once it fires, the Web application can, at its leisure, call this method
- to switch the underlying cache to the one with the more recent updates. To make proper use of
- this, applications have to be able to bring the new features into play; for example, reloading
- scripts to enable new features.</p>
- <p>An easier alternative to <code id=application-cache-api:dom-appcache-swapcache-3><a href=#dom-appcache-swapcache>swapCache()</a></code> is just to
- reload the entire page at a time suitable for the user, using <code id=application-cache-api:dom-location-reload><a href=#dom-location-reload>location.reload()</a></code>.</p>
- </dl>
-
- <p>There is a one-to-one mapping from <a href=#cache-host id=application-cache-api:cache-host>cache hosts</a> to
- <code id=application-cache-api:applicationcache-3><a href=#applicationcache>ApplicationCache</a></code> objects. The <dfn id=dom-applicationcache><code>applicationCache</code></dfn> attribute on <code id=application-cache-api:window-2><a href=#window>Window</a></code>
- objects must return the <code id=application-cache-api:applicationcache-4><a href=#applicationcache>ApplicationCache</a></code> object associated with the
- <code id=application-cache-api:window-3><a href=#window>Window</a></code> object's <a href=#active-document id=application-cache-api:active-document-2>active document</a>. The <dfn id=dom-sharedworkerglobalscope-applicationcache><code>applicationCache</code></dfn> attribute
- on <code id=application-cache-api:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects must return the <code id=application-cache-api:applicationcache-5><a href=#applicationcache>ApplicationCache</a></code>
- object associated with the worker.</p>
- <p class=note>A <code id=application-cache-api:window-4><a href=#window>Window</a></code> or <code id=application-cache-api:sharedworkerglobalscope-2><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object has an
- associated <code id=application-cache-api:applicationcache-6><a href=#applicationcache>ApplicationCache</a></code> object even if that <a href=#cache-host id=application-cache-api:cache-host-2>cache host</a> has no actual
- <a href=#application-cache id=application-cache-api:application-cache-2>application cache</a>.</p>
- <hr>
- <p>The <dfn id=dom-appcache-status><code>status</code></dfn> attribute, on getting, must
- return the current state of the <a href=#application-cache id=application-cache-api:application-cache-3>application cache</a> that the
- <code id=application-cache-api:applicationcache-7><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-3>cache host</a> is associated with, if any. This
- must be the appropriate value from the following list:</p>
-
- <dl><dt><dfn id=dom-appcache-uncached><code>UNCACHED</code></dfn> (numeric value 0)<dd><p>The <code id=application-cache-api:applicationcache-8><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-4>cache host</a> is not associated with
- an <a href=#application-cache id=application-cache-api:application-cache-4>application cache</a> at this time.<dt><dfn id=dom-appcache-idle><code>IDLE</code></dfn> (numeric value 1)<dd><p>The <code id=application-cache-api:applicationcache-9><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-5>cache host</a> is associated with an
- <a href=#application-cache id=application-cache-api:application-cache-5>application cache</a> whose <a href=#application-cache-group id=application-cache-api:application-cache-group>application cache group</a>'s <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status-2>update status</a> is <i>idle</i>, and that <a href=#application-cache id=application-cache-api:application-cache-6>application
- cache</a> is the <a href=#concept-appcache-newer id=application-cache-api:concept-appcache-newer>newest</a> cache in its
- <a href=#application-cache-group id=application-cache-api:application-cache-group-2>application cache group</a>, and the <a href=#application-cache-group id=application-cache-api:application-cache-group-3>application cache group</a> is not marked
- as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete>obsolete</a>.<dt><dfn id=dom-appcache-checking><code>CHECKING</code></dfn> (numeric value 2)<dd><p>The <code id=application-cache-api:applicationcache-10><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-6>cache host</a> is associated with an
- <a href=#application-cache id=application-cache-api:application-cache-7>application cache</a> whose <a href=#application-cache-group id=application-cache-api:application-cache-group-4>application cache group</a>'s <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status-3>update status</a> is <i>checking</i>.<dt><dfn id=dom-appcache-downloading><code>DOWNLOADING</code></dfn> (numeric value 3)<dd><p>The <code id=application-cache-api:applicationcache-11><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-7>cache host</a> is associated with an
- <a href=#application-cache id=application-cache-api:application-cache-8>application cache</a> whose <a href=#application-cache-group id=application-cache-api:application-cache-group-5>application cache group</a>'s <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status-4>update status</a> is <i>downloading</i>.<dt><dfn id=dom-appcache-updateready><code>UPDATEREADY</code></dfn> (numeric value 4)<dd><p>The <code id=application-cache-api:applicationcache-12><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-8>cache host</a> is associated with an
- <a href=#application-cache id=application-cache-api:application-cache-9>application cache</a> whose <a href=#application-cache-group id=application-cache-api:application-cache-group-6>application cache group</a>'s <a href=#concept-appcache-status id=application-cache-api:concept-appcache-status-5>update status</a> is <i>idle</i>, and whose <a href=#application-cache-group id=application-cache-api:application-cache-group-7>application
- cache group</a> is not marked as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete-2>obsolete</a>, but
- that <a href=#application-cache id=application-cache-api:application-cache-10>application cache</a> is <em>not</em> the <a href=#concept-appcache-newer id=application-cache-api:concept-appcache-newer-2>newest</a> cache in its group.<dt><dfn id=dom-appcache-obsolete><code>OBSOLETE</code></dfn> (numeric value 5)<dd><p>The <code id=application-cache-api:applicationcache-13><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-9>cache host</a> is associated with an
- <a href=#application-cache id=application-cache-api:application-cache-11>application cache</a> whose <a href=#application-cache-group id=application-cache-api:application-cache-group-8>application cache group</a> is marked as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete-3>obsolete</a>.</dl>
-
- <hr>
- <p>If the <dfn id=dom-appcache-update><code>update()</code></dfn> method is invoked, the user
- agent must invoke the <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process-3>application cache download process</a>, in the background, for the
- <a href=#application-cache-group id=application-cache-api:application-cache-group-9>application cache group</a> of the <a href=#application-cache id=application-cache-api:application-cache-12>application cache</a> with which the
- <code id=application-cache-api:applicationcache-14><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-10>cache host</a> is associated, but without giving
- that <a href=#cache-host id=application-cache-api:cache-host-11>cache host</a> to the algorithm. If there is no such <a href=#application-cache id=application-cache-api:application-cache-13>application cache</a>,
- or if its <a href=#application-cache-group id=application-cache-api:application-cache-group-10>application cache group</a> is marked as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete-4>obsolete</a>, then the method must throw an
- <code id=application-cache-api:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception instead.</p>
- <p>If the <dfn id=dom-appcache-abort><code>abort()</code></dfn> method is invoked, the user
- agent must <dfn id=send-a-signal>send a signal</dfn> to the current <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process-4>application cache download process</a>
- for the <a href=#application-cache-group id=application-cache-api:application-cache-group-11>application cache group</a> of the <a href=#application-cache id=application-cache-api:application-cache-14>application cache</a> with which the
- <code id=application-cache-api:applicationcache-15><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-12>cache host</a> is associated, if any. If there is
- no such <a href=#application-cache id=application-cache-api:application-cache-15>application cache</a>, or it does not have a current <a href=#application-cache-download-process id=application-cache-api:application-cache-download-process-5>application cache
- download process</a>, then do nothing.</p>
- <p>If the <dfn id=dom-appcache-swapcache><code>swapCache()</code></dfn> method is invoked,
- the user agent must run the following steps:
- <ol><li><p>Check that <code id=application-cache-api:applicationcache-16><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-13>cache host</a> is associated
- with an <a href=#application-cache id=application-cache-api:application-cache-16>application cache</a>. If it is not, then throw an
- <code id=application-cache-api:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Let <var>cache</var> be the <a href=#application-cache id=application-cache-api:application-cache-17>application cache</a> with which the
- <code id=application-cache-api:applicationcache-17><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-14>cache host</a> is associated. (By definition,
- this is the same as the one that was found in the previous step.)<li><p>If <var>cache</var>'s <a href=#application-cache-group id=application-cache-api:application-cache-group-12>application cache group</a> is marked as <a href=#concept-appcache-obsolete id=application-cache-api:concept-appcache-obsolete-5>obsolete</a>, then unassociate the
- <code id=application-cache-api:applicationcache-18><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-15>cache host</a> from <var>cache</var> and
- abort these steps. (Resources will now load from the network instead of the cache.)<li><p>Check that there is an application cache in the same <a href=#application-cache-group id=application-cache-api:application-cache-group-13>application cache group</a>
- as <var>cache</var> whose <a href=#concept-appcache-completeness id=application-cache-api:concept-appcache-completeness>completeness
- flag</a> is <i>complete</i> and that is <a href=#concept-appcache-newer id=application-cache-api:concept-appcache-newer-3>newer</a> than
- <var>cache</var>. If there is not, then throw an <code id=application-cache-api:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.<li><p>Let <var>new cache</var> be the <a href=#concept-appcache-newer id=application-cache-api:concept-appcache-newer-4>newest</a> <a href=#application-cache id=application-cache-api:application-cache-18>application cache</a> in the same
- <a href=#application-cache-group id=application-cache-api:application-cache-group-14>application cache group</a> as <var>cache</var> whose <a href=#concept-appcache-completeness id=application-cache-api:concept-appcache-completeness-2>completeness flag</a> is <i>complete</i>.<li><p>Unassociate the <code id=application-cache-api:applicationcache-19><a href=#applicationcache>ApplicationCache</a></code> object's <a href=#cache-host id=application-cache-api:cache-host-16>cache host</a> from <var>cache</var> and instead associate it with <var>new cache</var>.</ol>
- <p>The following are the <a href=#event-handlers id=application-cache-api:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=application-cache-api:event-handler-event-type>event handler event types</a>) that must be
- supported, as <a href=#event-handler-idl-attributes id=application-cache-api:event-handler-idl-attributes>event handler IDL attributes</a>, by all objects implementing the
- <code id=application-cache-api:applicationcache-20><a href=#applicationcache>ApplicationCache</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=application-cache-api:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=application-cache-api:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-appcache-onchecking><code>onchecking</code></dfn> <td> <code id=application-cache-api:event-appcache-checking><a href=#event-appcache-checking>checking</a></code>
- <tr><td><dfn id=handler-appcache-onerror><code>onerror</code></dfn> <td> <code id=application-cache-api:event-appcache-error><a href=#event-appcache-error>error</a></code>
- <tr><td><dfn id=handler-appcache-onnoupdate><code>onnoupdate</code></dfn> <td> <code id=application-cache-api:event-appcache-noupdate><a href=#event-appcache-noupdate>noupdate</a></code>
- <tr><td><dfn id=handler-appcache-ondownloading><code>ondownloading</code></dfn> <td> <code id=application-cache-api:event-appcache-downloading><a href=#event-appcache-downloading>downloading</a></code>
- <tr><td><dfn id=handler-appcache-onprogress><code>onprogress</code></dfn> <td> <code id=application-cache-api:event-appcache-progress><a href=#event-appcache-progress>progress</a></code>
- <tr><td><dfn id=handler-appcache-onupdateready><code>onupdateready</code></dfn> <td> <code id=application-cache-api:event-appcache-updateready-2><a href=#event-appcache-updateready>updateready</a></code>
- <tr><td><dfn id=handler-appcache-oncached><code>oncached</code></dfn> <td> <code id=application-cache-api:event-appcache-cached><a href=#event-appcache-cached>cached</a></code>
- <tr><td><dfn id=handler-appcache-onobsolete><code>onobsolete</code></dfn> <td> <code id=application-cache-api:event-appcache-obsolete><a href=#event-appcache-obsolete>obsolete</a></code>
- </table>
-
- <h4 id=browser-state>7.7.11 Browser state</h4>
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=navigatoronline>NavigatorOnLine</dfn> {
- readonly attribute boolean <a href=#dom-navigator-online id=browser-state:dom-navigator-online>onLine</a>;
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=browser-state:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=browser-state:dom-navigator-online-2><a href=#dom-navigator-online>onLine</a></code><dd>
- <p>Returns false if the user agent is definitely offline (disconnected from the network).
- Returns true if the user agent might be online.</p>
- <p>The events <code id=browser-state:event-online><a href=#event-online>online</a></code> and <code id=browser-state:event-offline><a href=#event-offline>offline</a></code> are fired when the value of this attribute changes.</p>
- </dl>
-
- <p>The <dfn id=dom-navigator-online><code>navigator.onLine</code></dfn> attribute must return
- false if the user agent will not contact the network when the user follows links or when a script
- requests a remote page (or knows that such an attempt would fail), and must return true
- otherwise.</p>
- <p>When the value that would be returned by the <code id=browser-state:dom-navigator-online-3><a href=#dom-navigator-online>navigator.onLine</a></code> attribute of a <code id=browser-state:window><a href=#window>Window</a></code> or
- <code id=browser-state:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> changes from true to false, the user agent must <a href=#queue-a-task id=browser-state:queue-a-task>queue a
- task</a> to <a href=#fire-a-simple-event id=browser-state:fire-a-simple-event>fire a simple event</a> named <code id=browser-state:event-offline-2><a href=#event-offline>offline</a></code>
- at the <code id=browser-state:window-2><a href=#window>Window</a></code> or <code id=browser-state:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object.</p>
- <p>On the other hand, when the value that would be returned by the <code id=browser-state:dom-navigator-online-4><a href=#dom-navigator-online>navigator.onLine</a></code> attribute of a <code id=browser-state:window-3><a href=#window>Window</a></code> or
- <code id=browser-state:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> changes from false to true, the user agent must <a href=#queue-a-task id=browser-state:queue-a-task-2>queue a
- task</a> to <a href=#fire-a-simple-event id=browser-state:fire-a-simple-event-2>fire a simple event</a> named <code id=browser-state:event-online-2><a href=#event-online>online</a></code> at
- the <code id=browser-state:window-4><a href=#window>Window</a></code> or <code id=browser-state:workerglobalscope-4><a href=#workerglobalscope>WorkerGlobalScope</a></code> object.</p>
- <p>The <a href=#task-source id=browser-state:task-source>task source</a> for these <a href=#concept-task id=browser-state:concept-task>tasks</a> is the
- <a href=#networking-task-source id=browser-state:networking-task-source>networking task source</a>.</p>
-
- <p class=note>This attribute is inherently unreliable. A computer can be connected to a network
- without having Internet access.</p>
- <div class=example>
- <p>In this example, an indicator is updated as the browser goes online and offline.</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Online status</title>
- <script>
- function updateIndicator() {
- document.getElementById('indicator').textContent = navigator.onLine ? 'online' : 'offline';
- }
- </script>
- </head>
- <body onload="updateIndicator()" ononline="updateIndicator()" onoffline="updateIndicator()">
- <p>The network is: <span id="indicator">(state unknown)</span>
- </body>
- </html></pre>
- </div>
- <h2 id=webappapis>8 Web application APIs</h2>
- <h3 id=scripting>8.1 Scripting</h3>
- <h4 id=introduction-12>8.1.1 Introduction</h4>
- <p>Various mechanisms can cause author-provided executable code to run in the context of a
- document. These mechanisms include, but are probably not limited to:</p>
- <ul><li>Processing of <code id=introduction-12:the-script-element><a href=#the-script-element>script</a></code> elements.<li>Navigating to <a href=#javascript-protocol id=introduction-12:javascript-protocol><code>javascript:</code> URLs</a>.<li>Event handlers, whether registered through the DOM using <code>addEventListener()</code>, by explicit <a href=#event-handler-content-attributes id=introduction-12:event-handler-content-attributes>event handler content attributes</a>, by
- <a href=#event-handler-idl-attributes id=introduction-12:event-handler-idl-attributes>event handler IDL attributes</a>, or otherwise.<li>Processing of technologies like SVG that have their own scripting features.</ul>
-
- <h4 id=enabling-and-disabling-scripting>8.1.2 Enabling and disabling scripting</h4>
- <p><dfn id=concept-bc-script>Scripting is enabled</dfn> in a <em><a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context>browsing
- context</a></em> when all of the following conditions are true:</p>
- <ul><li>The user agent supports scripting.<li>The user has not disabled scripting for this <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-2>browsing context</a> at this time.
- (User agents may provide users with the option to disable scripting globally, or in a
- finer-grained manner, e.g. on a per-origin basis.)
- <a href=#fingerprinting-vector id=enabling-and-disabling-scripting:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- <li id=sandboxScriptBlocked>The <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-3>browsing context</a>'s <a href=#active-document id=enabling-and-disabling-scripting:active-document>active document</a>'s
- <a href=#active-sandboxing-flag-set id=enabling-and-disabling-scripting:active-sandboxing-flag-set>active sandboxing flag set</a> does not have its <a href=#sandboxed-scripts-browsing-context-flag id=enabling-and-disabling-scripting:sandboxed-scripts-browsing-context-flag>sandboxed scripts browsing
- context flag</a> set.</ul>
- <p><dfn id=concept-bc-noscript>Scripting is disabled</dfn> in a <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-4>browsing context</a>
- when any of the above conditions are false (i.e. when scripting is not <a href=#concept-bc-script id=enabling-and-disabling-scripting:concept-bc-script>enabled</a>).</p>
- <hr>
- <p><dfn id=concept-n-script>Scripting is enabled</dfn> for a <em>node</em> if the
- <code id=enabling-and-disabling-scripting:document><a href=#document>Document</a></code> object of the node (the node itself, if it is itself a <code id=enabling-and-disabling-scripting:document-2><a href=#document>Document</a></code>
- object) has an associated <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-5>browsing context</a>, and <a href=#concept-bc-script id=enabling-and-disabling-scripting:concept-bc-script-2>scripting is enabled</a> in that <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-6>browsing context</a>.</p>
- <p><dfn id=concept-n-noscript>Scripting is disabled</dfn> for a node if there is no such
- <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-7>browsing context</a>, or if <a href=#concept-bc-noscript id=enabling-and-disabling-scripting:concept-bc-noscript>scripting is
- disabled</a> in that <a href=#browsing-context id=enabling-and-disabling-scripting:browsing-context-8>browsing context</a>.</p>
-
-
-
- <h4 id=processing-model-8>8.1.3 Processing model</h4>
- <h5 id=definitions-2>8.1.3.1 Definitions</h5>
- <p>This specification describes three kinds of <a href=#javascript-global-environment id=definitions-2:javascript-global-environment>JavaScript global environments</a>: the <dfn id=document-environment>document environment</dfn>, the
- <dfn id=dedicated-worker-environment>dedicated worker environment</dfn>, and the <dfn id=shared-worker-environment>shared worker environment</dfn>. The
- <a href=#dedicated-worker-environment id=definitions-2:dedicated-worker-environment>dedicated worker environment</a> and the <a href=#shared-worker-environment id=definitions-2:shared-worker-environment>shared worker environment</a> are both
- types of <dfn id=worker-environment>worker environments</dfn>.</p>
- <p>Except where otherwise specified, a <a href=#javascript-global-environment id=definitions-2:javascript-global-environment-2>JavaScript global environment</a> is a
- <a href=#document-environment id=definitions-2:document-environment>document environment</a>.</p>
- <hr>
- <p>A <dfn id=concept-script>script</dfn> has:</p>
- <dl><dt>A <dfn id=code-entry-point>code entry-point</dfn><dd>
- <p>A code entry-point represents a block of executable code that the script exposes to other
- scripts and to the user agent. Typically, the code corresponding to the code entry-point is
- executed immediately after the script is parsed, but for event handlers, it is called each time
- the handler is invoked.</p>
- <p class=example>In JavaScript <code id=definitions-2:the-script-element><a href=#the-script-element>script</a></code> blocks, this corresponds to the execution
- context of the global code.</p>
- <dt>Optionally, a <dfn id=muted-errors>muted errors</dfn> flag<dd>
- <p>A flag which, if set, means that error information will not be provided for errors in this
- script (used to mute errors for cross-origin scripts, since that can leak private
- information).</p>
- <dt>A <dfn id=settings-object>settings object</dfn><dd>
- <p>A <a href=#script-settings-object id=definitions-2:script-settings-object>script settings object</a>, various settings that are shared with other scripts in
- the same context.</p>
- </dl>
- <hr>
- <p>A <dfn id=script-settings-object>script settings object</dfn> specifies algorithms for obtaining the following:</p>
- <dl><dt>A <dfn id=script-execution-environment>script execution environment</dfn> for each language supported by the user agent<dd>
- <p>The characteristics of the script execution environment depend on the language, and are not
- defined by this specification.</p>
- <p class=example>In JavaScript, the script execution environment consists of the interpreter,
- the stack of <i>execution contexts</i>, the <i>global code</i> and <i>function code</i> and the
- <code id=definitions-2:idl-function><a href=#idl-function>Function</a></code> objects resulting, and so forth.</p>
- <dt>A <dfn id=global-object>global object</dfn><dd>
- <p>An object that provides the APIs that can be called by the code in scripts that use this
- <a href=#script-settings-object id=definitions-2:script-settings-object-2>settings object</a>.</p>
- <p class=note>This is typically a <code id=definitions-2:window><a href=#window>Window</a></code> object or a
- <code id=definitions-2:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object. When a <a href=#global-object id=definitions-2:global-object>global object</a> is an empty object, it
- can't do anything that interacts with the environment.</p>
- <p>If the <a href=#global-object id=definitions-2:global-object-2>global object</a> is a <code id=definitions-2:window-2><a href=#window>Window</a></code> object, then, in JavaScript, the
- ThisBinding of the global execution context for this script must be the <code id=definitions-2:window-3><a href=#window>Window</a></code>
- object's <code id=definitions-2:windowproxy><a href=#windowproxy>WindowProxy</a></code> object, rather than the global object. <a href=#refsECMA262>[ECMA262]</a></p>
- <p class=note>This is a <a href=#willful-violation id=definitions-2:willful-violation>willful violation</a> of the JavaScript specification current
- at the time of writing (ECMAScript edition 5, as defined in section 10.4.1.1 Initial Global
- Execution Context, step 3). The JavaScript specification requires that the <code>this</code> keyword in the global scope return the global object, but this is not
- compatible with the security design prevalent in implementations as specified herein. <a href=#refsECMA262>[ECMA262]</a></p>
- <dt>A <dfn id=responsible-browsing-context>responsible browsing context</dfn><dd>
- <p>A <a href=#browsing-context id=definitions-2:browsing-context>browsing context</a> that is assigned responsibility for actions taken by the
- scripts that use this <a href=#script-settings-object id=definitions-2:script-settings-object-3>script settings object</a>.</p>
- <p class=example>When a script creates and <a href=#navigate id=definitions-2:navigate>navigates</a> a new
- <a href=#top-level-browsing-context id=definitions-2:top-level-browsing-context>top-level browsing context</a>, the <code id=definitions-2:dom-opener><a href=#dom-opener>opener</a></code> attribute
- of the new <a href=#browsing-context id=definitions-2:browsing-context-2>browsing context</a>'s <code id=definitions-2:window-4><a href=#window>Window</a></code> object will be set to the
- <a href=#responsible-browsing-context id=definitions-2:responsible-browsing-context>responsible browsing context</a>'s <code id=definitions-2:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object.</p>
- <dt>A <dfn id=responsible-document>responsible document</dfn><dd>
- <p>A <code id=definitions-2:document><a href=#document>Document</a></code> that is assigned responsibility for actions taken by the scripts that
- use this <a href=#script-settings-object id=definitions-2:script-settings-object-4>script settings object</a>.</p>
- <p class=example>For example, the <a href=http://dom.spec.whatwg.org/#concept-document-url id="definitions-2:the-document's-address" data-x-internal="the-document's-address">address</a> of the
- <a href=#responsible-document id=definitions-2:responsible-document>responsible document</a> is used to set the <a href=http://dom.spec.whatwg.org/#concept-document-url id="definitions-2:the-document's-address-2" data-x-internal="the-document's-address">address</a> of the <code id=definitions-2:document-2><a href=#document>Document</a></code> after it has been reset using <code id=definitions-2:dom-document-open><a href=#dom-document-open>document.open()</a></code>.</p>
- <dt>A <dfn id=responsible-event-loop>responsible event loop</dfn><dd>
- <p>An <a href=#event-loop id=definitions-2:event-loop>event loop</a> that is used when it would not be immediately clear what event
- loop to use.</p>
- <dt>An <dfn id=api-referrer-source>API referrer source</dfn><dd>
- <p>Either a <code id=definitions-2:document-3><a href=#document>Document</a></code> (specifically, the <a href=#responsible-document id=definitions-2:responsible-document-2>responsible document</a>), or a
- <a href=#url id=definitions-2:url>URL</a>, which is used by some APIs to determine what value to use for the <code id=definitions-2:http-referer><a href=#http-referer>Referer</a></code> (sic) header in calls to the <a href=#fetch id=definitions-2:fetch>fetching</a> algorithm.</p>
- <dt>An <dfn id=api-url-character-encoding>API URL character encoding</dfn><dd>
- <p>A character encoding used to encode URLs by APIs called by scripts that use this <a href=#script-settings-object id=definitions-2:script-settings-object-5>script
- settings object</a>.</p>
- <dt>An <dfn id=api-base-url>API base URL</dfn><dd>
- <p>An <a href=#absolute-url id=definitions-2:absolute-url>absolute URL</a> used by APIs called by scripts that use this <a href=#script-settings-object id=definitions-2:script-settings-object-6>script
- settings object</a> to resolve <a href=#relative-url id=definitions-2:relative-url>relative URLs</a>.</p>
- <dt>An <a href=#origin-2 id=definitions-2:origin-2>origin</a> and an <a href=#effective-script-origin id=definitions-2:effective-script-origin>effective script origin</a><dd>
- <p>An instrument used in security checks.</p>
- </dl>
- <p>The <dfn id=relevant-settings-object-for-a-global-object>relevant settings object for a global object</dfn> <var>o</var> is the
- <a href=#script-settings-object id=definitions-2:script-settings-object-7>script settings object</a> whose <a href=#global-object id=definitions-2:global-object-3>global object</a> is <var>o</var>.
- (There is always a 1:1 mapping of global objects to script settings objects.)</p>
- <p>The <dfn id=relevant-settings-object-for-a-script>relevant settings object for a script</dfn> <var>s</var> is the
- <a href=#settings-object id=definitions-2:settings-object>settings object</a> of <var>s</var>.</p>
- <h5 id=script-settings-for-browsing-contexts>8.1.3.2 Script settings for browsing contexts</h5>
- <p>Whenever a new <code id=script-settings-for-browsing-contexts:window><a href=#window>Window</a></code> object is created, it must also create a <a href=#script-settings-object id=script-settings-for-browsing-contexts:script-settings-object>script
- settings object</a> whose algorithms are defined as follows:</p>
- <dl><dt>The <a href=#script-execution-environment id=script-settings-for-browsing-contexts:script-execution-environment>script execution environments</a><dd>
- <p>When the <a href=#script-settings-object id=script-settings-for-browsing-contexts:script-settings-object-2>script settings object</a> is created, for each language supported by the
- user agent, create an appropriate execution environment as defined by the relevant
- specification.</p>
- <p>When a <a href=#script-execution-environment id=script-settings-for-browsing-contexts:script-execution-environment-2>script execution environment</a> is needed, return the appropriate one from
- those created when the <a href=#script-settings-object id=script-settings-for-browsing-contexts:script-settings-object-3>script settings object</a> was created.</p>
- <dt>The <a href=#global-object id=script-settings-for-browsing-contexts:global-object>global object</a><dd>
- <p>Return the <code id=script-settings-for-browsing-contexts:window-2><a href=#window>Window</a></code> object itself.</p>
- <dt>The <a href=#responsible-browsing-context id=script-settings-for-browsing-contexts:responsible-browsing-context>responsible browsing context</a><dd>
- <p>Return the <a href=#browsing-context id=script-settings-for-browsing-contexts:browsing-context>browsing context</a> with which the <code id=script-settings-for-browsing-contexts:window-3><a href=#window>Window</a></code> object is
- associated.</p>
- <dt>The <a href=#responsible-document id=script-settings-for-browsing-contexts:responsible-document>responsible document</a><dd>
- <p>Return the <code id=script-settings-for-browsing-contexts:document><a href=#document>Document</a></code> with which the <code id=script-settings-for-browsing-contexts:window-4><a href=#window>Window</a></code> is currently
- associated.</p>
- <dt>The <a href=#responsible-event-loop id=script-settings-for-browsing-contexts:responsible-event-loop>responsible event loop</a><dd>
- <p>Return the <a href=#event-loop id=script-settings-for-browsing-contexts:event-loop>event loop</a> that is associated with the <a href=#unit-of-related-similar-origin-browsing-contexts id=script-settings-for-browsing-contexts:unit-of-related-similar-origin-browsing-contexts>unit of related
- similar-origin browsing contexts</a> to which the <code id=script-settings-for-browsing-contexts:window-5><a href=#window>Window</a></code> object's <a href=#browsing-context id=script-settings-for-browsing-contexts:browsing-context-2>browsing
- context</a> belongs.</p>
- <dt>The <a href=#api-referrer-source id=script-settings-for-browsing-contexts:api-referrer-source>API referrer source</a><dd>
- <p>Return the <code id=script-settings-for-browsing-contexts:document-2><a href=#document>Document</a></code> with which the <code id=script-settings-for-browsing-contexts:window-6><a href=#window>Window</a></code> is currently
- associated.</p>
- <dt>The <a href=#api-url-character-encoding id=script-settings-for-browsing-contexts:api-url-character-encoding>API URL character encoding</a><dd>
- <p>Return the current <a href="#document's-character-encoding" id="script-settings-for-browsing-contexts:document's-character-encoding">character encoding</a> of
- the <code id=script-settings-for-browsing-contexts:document-3><a href=#document>Document</a></code> with which the <code id=script-settings-for-browsing-contexts:window-7><a href=#window>Window</a></code> is currently associated.</p>
- <dt>The <a href=#api-base-url id=script-settings-for-browsing-contexts:api-base-url>API base URL</a><dd>
- <p>Return the current <a href=#document-base-url id=script-settings-for-browsing-contexts:document-base-url>base URL</a> of the
- <code id=script-settings-for-browsing-contexts:document-4><a href=#document>Document</a></code> with which the <code id=script-settings-for-browsing-contexts:window-8><a href=#window>Window</a></code> is currently associated.</p>
- <dt>The <a href=#origin-2 id=script-settings-for-browsing-contexts:origin-2>origin</a><dd>
- <p>Return the <a href=#origin-2 id=script-settings-for-browsing-contexts:origin-2-2>origin</a> of the <code id=script-settings-for-browsing-contexts:document-5><a href=#document>Document</a></code> with which the
- <code id=script-settings-for-browsing-contexts:window-9><a href=#window>Window</a></code> is currently associated.</p>
- <dt>The <a href=#effective-script-origin id=script-settings-for-browsing-contexts:effective-script-origin>effective script origin</a><dd>
- <p>Return the <a href=#effective-script-origin id=script-settings-for-browsing-contexts:effective-script-origin-2>effective script origin</a> of the <code id=script-settings-for-browsing-contexts:document-6><a href=#document>Document</a></code> with which the
- <code id=script-settings-for-browsing-contexts:window-10><a href=#window>Window</a></code> is currently associated.</p>
- </dl>
- <h5 id=calling-scripts>8.1.3.3 Calling scripts</h5>
- <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts id=calling-scripts:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a> has a <dfn id=stack-of-script-settings-objects>stack of script
- settings objects</dfn>, which must be initially empty. When a new <a href=#script-settings-object id=calling-scripts:script-settings-object>script settings
- object</a> is <i>pushed</i> onto this stack, the specified <a href=#script-settings-object id=calling-scripts:script-settings-object-2>script settings object</a>
- is to be added to the stack; when the <a href=#script-settings-object id=calling-scripts:script-settings-object-3>script settings object</a> on this stack that was
- most recently pushed onto it is to be <i>popped</i> from the stack, it must be removed. Entries on
- this stack can be labeled as <dfn id=candidate-entry-settings-object>candidate entry
- settings objects</dfn>.</p>
- <p>When a user agent is to <dfn id=jump-to-a-code-entry-point>jump to a code entry-point</dfn> for a <a href=#concept-script id=calling-scripts:concept-script>script</a> <var>s</var>, the user agent must run the
- following steps:</p>
- <ol><li><p>Let <var>context</var> be the <a href=#settings-object id=calling-scripts:settings-object>settings object</a> of <var>s</var>.<li><p><a href=#prepare-to-run-a-callback id=calling-scripts:prepare-to-run-a-callback>Prepare to run a callback</a> with <var>context</var> as the
- <a href=#script-settings-object id=calling-scripts:script-settings-object-4>script settings object</a>. If this returns "do not run" then abort these
- steps.<li><p>Make the appropriate <a href=#script-execution-environment id=calling-scripts:script-execution-environment>script execution environment</a> specified by <var>context</var> execute the <var>s</var>'s <a href=#code-entry-point id=calling-scripts:code-entry-point>code
- entry-point</a>.<li><p><a href=#clean-up-after-running-a-callback id=calling-scripts:clean-up-after-running-a-callback>Clean up after running a callback</a>.</ol>
- <p>The steps to <dfn id=prepare-to-run-a-callback>prepare to run a callback</dfn> with a <a href=#script-settings-object id=calling-scripts:script-settings-object-5>script settings object</a>
- <var>o</var> are as follows. They return either "run" or "do not run".</p>
- <ol><li><p>If the <a href=#global-object id=calling-scripts:global-object>global object</a> specified by <var>o</var> is a
- <code id=calling-scripts:window><a href=#window>Window</a></code> object whose <code id=calling-scripts:document><a href=#document>Document</a></code> object is not <a href=#fully-active id=calling-scripts:fully-active>fully active</a>,
- then return "do not run" and abort these steps.</p>
- <li><p>If <a href=#concept-bc-noscript id=calling-scripts:concept-bc-noscript>scripting is disabled</a> for the
- <a href=#responsible-browsing-context id=calling-scripts:responsible-browsing-context>responsible browsing context</a> specified by <var>o</var>, then return "do
- not run" and abort these steps.</p>
- <li><p>Push <var>o</var> onto the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects>stack of script settings objects</a>, and
- label it as a <a href=#candidate-entry-settings-object id=calling-scripts:candidate-entry-settings-object>candidate entry settings object</a>.<li><p>Return "run".</ol>
- <p>The steps to <dfn id=clean-up-after-running-a-callback>clean up after running a callback</dfn> are as follows:</p>
- <ol><li><p>Pop the current <a href=#incumbent-settings-object id=calling-scripts:incumbent-settings-object>incumbent settings object</a> from the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-2>stack of script
- settings objects</a>.<li><p>If the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-3>stack of script settings objects</a> is now empty, <a href=#run-the-global-script-clean-up-jobs id=calling-scripts:run-the-global-script-clean-up-jobs>run the global
- script clean-up jobs</a>. (These cannot run scripts.)<li><p>If the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-4>stack of script settings objects</a> is now empty, <a href=#perform-a-microtask-checkpoint id=calling-scripts:perform-a-microtask-checkpoint>perform a
- microtask checkpoint</a>. (If this runs scripts, these algorithms will be invoked
- reentrantly.)</ol>
- <p class=note>These algorithms are not invoked by one script directly calling another, but they
- can be invoked reentrantly in an indirect manner, e.g. if a script dispatches an event which has
- event listeners registered.</p>
- <p>When a JavaScript <i>SourceElements</i> production is to be evaluated, the <a href=#settings-object id=calling-scripts:settings-object-2>settings
- object</a> of the <a href=#concept-script id=calling-scripts:concept-script-2>script</a> corresponding to that
- <i>SourceElements</i> must be pushed onto the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-5>stack of script settings objects</a> before
- the evaluation begins, and popped when the evaluation ends (regardless of whether it's an abrupt
- completion or not).</p>
- <p>The <dfn id=entry-settings-object>entry settings object</dfn> is the most-recently added <a href=#script-settings-object id=calling-scripts:script-settings-object-6>script settings
- object</a> in the <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-6>stack of script settings objects</a> that is labeled as a
- <a href=#candidate-entry-settings-object id=calling-scripts:candidate-entry-settings-object-2>candidate entry settings object</a>. If the stack is empty, or has no entries labeled as
- such, then there is no <a href=#entry-settings-object id=calling-scripts:entry-settings-object>entry settings object</a>. It is used to obtain, amongst other
- things, the <a href=#api-base-url id=calling-scripts:api-base-url>API base URL</a> to <a href=#resolve-a-url id=calling-scripts:resolve-a-url>resolve</a> relative
- <a href=#url id=calling-scripts:url>URLs</a> used in scripts running in that <a href=#unit-of-related-similar-origin-browsing-contexts id=calling-scripts:unit-of-related-similar-origin-browsing-contexts-2>unit of related
- similar-origin browsing contexts</a>.</p>
- <p>The <dfn id=incumbent-settings-object>incumbent settings object</dfn> is the <a href=#script-settings-object id=calling-scripts:script-settings-object-7>script settings object</a> in the
- <a href=#stack-of-script-settings-objects id=calling-scripts:stack-of-script-settings-objects-7>stack of script settings objects</a> that was most-recently added (i.e. the last one on
- the stack). If the stack is empty, then there is no <a href=#incumbent-settings-object id=calling-scripts:incumbent-settings-object-2>incumbent settings object</a>. It is
- used in some security checks.</p>
- <p class=note>The Web IDL specification also uses these algorithms. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <hr>
- <p>Each <a href=#unit-of-related-similar-origin-browsing-contexts id=calling-scripts:unit-of-related-similar-origin-browsing-contexts-3>unit of related similar-origin browsing contexts</a> has a <dfn id=global-script-clean-up-jobs-list>global script
- clean-up jobs list</dfn>, which must initially be empty. A global script clean-up job cannot run
- scripts, and cannot be sensitive to the order in which other clean-up jobs are executed. The File
- API uses this to release <code id=calling-scripts:blob-protocol><a data-x-internal=blob-protocol href=http://dev.w3.org/2006/webapi/FileAPI/#DefinitionOfScheme>blob:</a></code> URLs. <a href=#refsFILEAPI>[FILEAPI]</a></p>
- <p>When the user agent is to <dfn id=run-the-global-script-clean-up-jobs>run the global script clean-up jobs</dfn>, the user agent must
- perform each of the jobs in the <a href=#global-script-clean-up-jobs-list id=calling-scripts:global-script-clean-up-jobs-list>global script clean-up jobs list</a> and then empty the
- list.</p>
-
-
- <h5 id=creating-scripts>8.1.3.4 Creating scripts</h5>
- <p>When the specification says that a <a href=#concept-script id=creating-scripts:concept-script>script</a> is to be <dfn id=create-a-script>created</dfn>, given some script source, a script source URL, its
- scripting language, a <a href=#script-settings-object id=creating-scripts:script-settings-object>script settings object</a>, and optionally a <var>muted
- errors</var> flag, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>script</var> be a new <a href=#concept-script id=creating-scripts:concept-script-2>script</a> that
- this algorithm will subsequently initialize.<li><p>If <a href=#concept-bc-noscript id=creating-scripts:concept-bc-noscript>scripting is disabled</a> for <a href=#browsing-context id=creating-scripts:browsing-context>browsing
- context</a> passed to this algorithm, then abort these steps, as if the script source
- described a program that did nothing but return void.</p>
- <li><p>Obtain the appropriate <a href=#script-execution-environment id=creating-scripts:script-execution-environment>script execution environment</a> for the given scripting
- language from the <a href=#script-settings-object id=creating-scripts:script-settings-object-2>script settings object</a> provided.<li><p>Parse/compile/initialise the source of the script using the <a href=#script-execution-environment id=creating-scripts:script-execution-environment-2>script execution
- environment</a>, as appropriate for the scripting language, and thus obtain <var>script</var>'s <a href=#code-entry-point id=creating-scripts:code-entry-point>code entry-point</a>.<li><p>Let <var>script</var>'s <a href=#settings-object id=creating-scripts:settings-object>settings object</a> be the <a href=#script-settings-object id=creating-scripts:script-settings-object-3>script
- settings object</a> provided.<li><p>If the <var>muted errors</var> flag was set, then set <var>script</var>'s <a href=#muted-errors id=creating-scripts:muted-errors>muted errors</a> flag.<li>
- <p>If all the steps above succeeded (in particular, if the script was compiled successfully),
- <a href=#jump-to-a-code-entry-point id=creating-scripts:jump-to-a-code-entry-point>Jump</a> to <var>script</var>'s <a href=#code-entry-point id=creating-scripts:code-entry-point-2>code
- entry-point</a>.</p>
- <p>Otherwise, <a href=#report-the-error id=creating-scripts:report-the-error>report the error</a> for <var>script</var>, with the
- problematic position (line number and column number), using the <a href=#global-object id=creating-scripts:global-object>global object</a>
- specified by the <a href=#script-settings-object id=creating-scripts:script-settings-object-4>script settings object</a> as the target. If the error is still <i id=creating-scripts:concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported to
- the user.</p>
- </ol>
-
-
- <h5 id=killing-scripts>8.1.3.5 Killing scripts</h5>
- <p>User agents may impose resource limitations on scripts, for example CPU quotas, memory limits,
- total execution time limits, or bandwidth limitations. When a script exceeds a limit, the user
- agent may either throw a <code id=killing-scripts:quotaexceedederror><a href=#quotaexceedederror>QuotaExceededError</a></code> exception, abort the script without an
- exception, prompt the user, or throttle script execution.</p>
- <div class=example>
- <p>For example, the following script never terminates. A user agent could, after waiting for a
- few seconds, prompt the user to either terminate the script or let it continue.</p>
- <pre><script>
- while (true) { /* loop */ }
- </script></pre>
- </div>
- <p>User agents are encouraged to allow users to disable scripting whenever the user is prompted
- either by a script (e.g. using the <code id=killing-scripts:dom-alert><a href=#dom-alert>window.alert()</a></code> API) or because
- of a script's actions (e.g. because it has exceeded a time limit).</p>
- <p>If scripting is disabled while a script is executing, the script should be terminated
- immediately.</p>
- <p>User agents may allow users to specifically disable scripts just for the purposes of closing a
- <a href=#browsing-context id=killing-scripts:browsing-context>browsing context</a>.</p>
- <p class=example>For example, the prompt mentioned in the example above could also offer the
- user with a mechanism to just close the page entirely, without running any <code id=killing-scripts:event-unload><a href=#event-unload>unload</a></code> event handlers.</p>
-
- <h5 id=runtime-script-errors>8.1.3.6 Runtime script errors</h5>
-
- <p>When the user agent is required to <dfn id=report-the-error>report an error</dfn> for a
- particular <a href=#concept-script id=runtime-script-errors:concept-script>script</a> <var>script</var> with a particular
- position <var>line</var>:<var>col</var>, using a particular target <var>target</var>, it must run these steps, after which the error is either <dfn id=concept-error-handled><i>handled</i></dfn> or <dfn id=concept-error-nothandled><i>not
- handled</i></dfn>:</p>
- <ol><li><p>If <var>target</var> is <a href=#in-error-reporting-mode id=runtime-script-errors:in-error-reporting-mode>in error reporting mode</a>, then abort these
- steps; the error is <i id=runtime-script-errors:concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>.<li><p>Let <var>target</var> be <dfn id=in-error-reporting-mode>in error reporting mode</dfn>.<li><p>Let <var>message</var> be a user-agent-defined string describing the error in a
- helpful manner.
- <a href=#fingerprinting-vector id=runtime-script-errors:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- <li><p>Let <var>error object</var> be the object that represents the error: in the case of an
- uncaught exception, that would be the object that was thrown; in the case of a JavaScript error
- that would be an <code id=runtime-script-errors:idl-error><a href=#idl-error>Error</a></code> object. If there is no corresponding
- object, then the null value must be used instead.<li>
- <p>Let <var>location</var> be an <a href=#absolute-url id=runtime-script-errors:absolute-url>absolute URL</a> that corresponds to the
- resource from which <var>script</var> was obtained.</p>
- <p class=note>The resource containing the script will typically be the file from which the
- <code id=runtime-script-errors:document><a href=#document>Document</a></code> was parsed, e.g. for inline <code id=runtime-script-errors:the-script-element><a href=#the-script-element>script</a></code> elements or <a href=#event-handler-content-attributes id=runtime-script-errors:event-handler-content-attributes>event
- handler content attributes</a>; or the JavaScript file that the script was in, for external
- scripts. Even for dynamically-generated scripts, user agents are strongly encouraged to attempt
- to keep track of the original source of a script. For example, if an external script uses the
- <code id=runtime-script-errors:dom-document-write><a href=#dom-document-write>document.write()</a></code> API to insert an inline
- <code id=runtime-script-errors:the-script-element-2><a href=#the-script-element>script</a></code> element during parsing, the URL of the resource containing the script would
- ideally be reported as being the external script, and the line number might ideally be reported
- as the line with the <code id=runtime-script-errors:dom-document-write-2><a href=#dom-document-write>document.write()</a></code> call or where the
- string passed to that call was first constructed. Naturally, implementing this can be somewhat
- non-trivial.</p>
- <p class=note>User agents are similarly encouraged to keep careful track of the original line
- numbers, even in the face of <code id=runtime-script-errors:dom-document-write-3><a href=#dom-document-write>document.write()</a></code> calls
- mutating the document as it is parsed, or <a href=#event-handler-content-attributes id=runtime-script-errors:event-handler-content-attributes-2>event handler content attributes</a> spanning
- multiple lines.</p>
- <li><p>If <var>script</var> has <a href=#muted-errors id=runtime-script-errors:muted-errors>muted errors</a>, then set <var>message</var> to "<code>Script error.</code>", set <var>location</var>
- to the empty string, set <var>line</var> and <var>col</var> to 0, and set <var>error object</var> to null.<li><p>Let <var>event</var> be a new <a href=#concept-events-trusted id=runtime-script-errors:concept-events-trusted>trusted</a>
- <code id=runtime-script-errors:errorevent><a href=#errorevent>ErrorEvent</a></code> object that does not bubble but is cancelable, and which has the event
- name <code id=runtime-script-errors:event-error><a href=#event-error>error</a></code>.<li><p>Initialise <var>event</var>'s <code id=runtime-script-errors:dom-errorevent-message><a href=#dom-errorevent-message>message</a></code>
- attribute to <var>message</var>.<li><p>Initialise <var>event</var>'s <code id=runtime-script-errors:dom-errorevent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute to <var>location</var>.<li><p>Initialise <var>event</var>'s <code id=runtime-script-errors:dom-errorevent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>
- attribute to <var>line</var>.<li><p>Initialise <var>event</var>'s <code id=runtime-script-errors:dom-errorevent-colno><a href=#dom-errorevent-colno>colno</a></code>
- attribute to <var>col</var>.<li><p>Initialise <var>event</var>'s <code id=runtime-script-errors:dom-errorevent-error><a href=#dom-errorevent-error>error</a></code>
- attribute to <var>error object</var>.<li><p><a href=#concept-event-dispatch id=runtime-script-errors:concept-event-dispatch>Dispatch</a> <var>event</var> at <var>target</var>.<li><p>Let <var>target</var> no longer be <a href=#in-error-reporting-mode id=runtime-script-errors:in-error-reporting-mode-2>in error reporting mode</a>.<li><p>If <var>event</var> was canceled, then the error is <i id=runtime-script-errors:concept-error-handled><a href=#concept-error-handled>handled</a></i>. Otherwise, the error is <i id=runtime-script-errors:concept-error-nothandled-2><a href=#concept-error-nothandled>not handled</a></i>.</p>
- </ol>
- <h6 id=runtime-script-errors-in-documents>8.1.3.6.1 Runtime script errors in documents</h6>
- <p>Whenever an uncaught runtime script error occurs in one of the scripts associated with a
- <code id=runtime-script-errors-in-documents:document><a href=#document>Document</a></code>, the user agent must <a href=#report-the-error id=runtime-script-errors-in-documents:report-the-error>report the error</a> for the relevant <a href=#concept-script id=runtime-script-errors-in-documents:concept-script>script</a>, with the problematic position (line number and column
- number) in the resource containing the script, using the <a href=#global-object id=runtime-script-errors-in-documents:global-object>global object</a> specified by
- the script's <a href=#settings-object id=runtime-script-errors-in-documents:settings-object>settings object</a> as the target. If the error is still <i id=runtime-script-errors-in-documents:concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported to
- the user.</p>
- <h6 id=the-errorevent-interface>8.1.3.6.2 The <code id=the-errorevent-interface:errorevent><a href=#errorevent>ErrorEvent</a></code> interface</h6>
-
- <pre class=idl>[Constructor(DOMString type, optional <a href=#erroreventinit id=the-errorevent-interface:erroreventinit>ErrorEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=errorevent>ErrorEvent</dfn> : <a href=#event id=the-errorevent-interface:event>Event</a> {
- readonly attribute DOMString <a href=#dom-errorevent-message id=the-errorevent-interface:dom-errorevent-message>message</a>;
- readonly attribute DOMString <a href=#dom-errorevent-filename id=the-errorevent-interface:dom-errorevent-filename>filename</a>;
- readonly attribute unsigned long <a href=#dom-errorevent-lineno id=the-errorevent-interface:dom-errorevent-lineno>lineno</a>;
- readonly attribute unsigned long <a href=#dom-errorevent-colno id=the-errorevent-interface:dom-errorevent-colno>colno</a>;
- readonly attribute any <a href=#dom-errorevent-error id=the-errorevent-interface:dom-errorevent-error>error</a>;
- };
- dictionary <dfn id=erroreventinit>ErrorEventInit</dfn> : <a href=#eventinit id=the-errorevent-interface:eventinit>EventInit</a> {
- DOMString message;
- DOMString filename;
- unsigned long lineno;
- unsigned long colno;
- any error;
- };</pre>
- <p>The <dfn id=dom-errorevent-message><code>message</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to the
- empty string. It represents the error message.</p>
- <p>The <dfn id=dom-errorevent-filename><code>filename</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to the
- empty string. It represents the <a href=#absolute-url id=the-errorevent-interface:absolute-url>absolute URL</a> of the script in which the error
- originally occurred.</p>
- <p>The <dfn id=dom-errorevent-lineno><code>lineno</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- zero. It represents the line number where the error occurred in the script.</p>
- <p>The <dfn id=dom-errorevent-colno><code>colno</code></dfn> attribute must return the value
- it was initialised to. When the object is created, this attribute must be initialised to zero. It
- represents the column number where the error occurred in the script.</p>
- <p>The <dfn id=dom-errorevent-error><code>error</code></dfn> attribute must return the value
- it was initialised to. When the object is created, this attribute must be initialised to null.
- Where appropriate, it is set to the object representing the error (e.g. the exception object in
- the case of an uncaught DOM exception).</p>
-
- <h4 id=event-loops>8.1.4 Event loops</h4>
- <h5 id=definitions-3>8.1.4.1 Definitions</h5>
- <p>To coordinate events, user interaction, scripts, rendering, networking, and so forth, user
- agents must use <dfn id=event-loop>event loops</dfn> as described in this section. There are
- two kinds of event loops: those for <a href=#browsing-context id=definitions-3:browsing-context>browsing contexts</a>, and
- those for <a href=#workers>workers</a>.</p>
- <p>There must be at least one <a href=#browsing-context id=definitions-3:browsing-context-2>browsing context</a> <a href=#event-loop id=definitions-3:event-loop>event loop</a> per user
- agent, and at most one per <a href=#unit-of-related-similar-origin-browsing-contexts id=definitions-3:unit-of-related-similar-origin-browsing-contexts>unit of related similar-origin browsing contexts</a>.</p>
- <p class=note>When there is more than one <a href=#event-loop id=definitions-3:event-loop-2>event loop</a> for a <a href=#unit-of-related-browsing-contexts id=definitions-3:unit-of-related-browsing-contexts>unit of related
- browsing contexts</a>, complications arise when a <a href=#browsing-context id=definitions-3:browsing-context-3>browsing context</a> in that group
- is <a href=#navigate id=definitions-3:navigate>navigated</a> such that it switches from one <a href=#unit-of-related-similar-origin-browsing-contexts id=definitions-3:unit-of-related-similar-origin-browsing-contexts-2>unit of related
- similar-origin browsing contexts</a> to another. This specification does not currently describe
- how to handle these complications.</p>
- <p>A <a href=#browsing-context id=definitions-3:browsing-context-4>browsing context</a> <a href=#event-loop id=definitions-3:event-loop-3>event loop</a> always has at least one <a href=#browsing-context id=definitions-3:browsing-context-5>browsing
- context</a>. If such an <a href=#event-loop id=definitions-3:event-loop-4>event loop</a>'s <a href=#browsing-context id=definitions-3:browsing-context-6>browsing
- contexts</a> all go away, then the <a href=#event-loop id=definitions-3:event-loop-5>event loop</a> goes away as well. A <a href=#browsing-context id=definitions-3:browsing-context-7>browsing
- context</a> always has an <a href=#event-loop id=definitions-3:event-loop-6>event loop</a> coordinating its activities.</p>
- <p><a href=#worker-event-loop>Worker event loops</a> are simpler: each worker has one
- <a href=#event-loop id=definitions-3:event-loop-7>event loop</a>, and the <a href=#run-a-worker id=definitions-3:run-a-worker>worker processing model</a>
- manages the <a href=#event-loop id=definitions-3:event-loop-8>event loop</a>'s lifetime.</p>
- <hr>
- <p>An <a href=#event-loop id=definitions-3:event-loop-9>event loop</a> has one or more <dfn id=task-queue>task queues</dfn>. A
- <a href=#task-queue id=definitions-3:task-queue>task queue</a> is an ordered list of <dfn id=concept-task>tasks</dfn>, which are
- algorithms that are responsible for such work as:</p>
- <dl><dt>Events<dd>
- <p>Asynchronously dispatching an <code id=definitions-3:event><a href=#event>Event</a></code> object at a particular
- <code id=definitions-3:eventtarget><a href=#eventtarget>EventTarget</a></code> object is often done by a dedicated task.</p>
- <p class=note>Not all events are dispatched using the <a href=#task-queue id=definitions-3:task-queue-2>task queue</a>, many are
- dispatched synchronously during other tasks.</p>
- <dt>Parsing<dd><p>The <a href=#html-parser id=definitions-3:html-parser>HTML parser</a> tokenizing one or more bytes, and then processing any
- resulting tokens, is typically a task.<dt>Callbacks<dd><p>Calling a callback asynchronously is often done by a dedicated task.<dt>Using a resource<dd><p>When an algorithm <a href=#fetch id=definitions-3:fetch>fetches</a> a resource, if the fetching occurs
- asynchronously then the processing of the resource once some or all of the resource is available
- is performed by a task.<dt>Reacting to DOM manipulation<dd><p>Some elements have tasks that trigger in response to DOM manipulation, e.g. when that
- element is <a href=#insert-an-element-into-a-document id=definitions-3:insert-an-element-into-a-document>inserted into the document</a>.</p>
- </dl>
- <p>Each <a href=#concept-task id=definitions-3:concept-task>task</a> in a <a href=#browsing-context id=definitions-3:browsing-context-8>browsing context</a> <a href=#event-loop id=definitions-3:event-loop-10>event
- loop</a> is associated with a <code id=definitions-3:document><a href=#document>Document</a></code>; if the task was queued in the context of
- an element, then it is the element's <a id=definitions-3:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>; if the task was queued in the context
- of a <a href=#browsing-context id=definitions-3:browsing-context-9>browsing context</a>, then it is the <a href=#browsing-context id=definitions-3:browsing-context-10>browsing context</a>'s <a href=#active-document id=definitions-3:active-document>active
- document</a> at the time the task was queued; if the task was queued by or for a <a href=#concept-script id=definitions-3:concept-script>script</a> then the document is the <a href=#responsible-document id=definitions-3:responsible-document>responsible document</a>
- specified by the script's <a href=#settings-object id=definitions-3:settings-object>settings object</a>.</p>
- <p>A <a href=#concept-task id=definitions-3:concept-task-2>task</a> is intended for a specific <a href=#event-loop id=definitions-3:event-loop-11>event loop</a>:
- the <a href=#event-loop id=definitions-3:event-loop-12>event loop</a> that is handling <a href=#concept-task id=definitions-3:concept-task-3>tasks</a> for the
- <a href=#concept-task id=definitions-3:concept-task-4>task</a>'s associated <code id=definitions-3:document-2><a href=#document>Document</a></code> or <a href=#workers>worker</a>.</p>
- <p>When a user agent is to <dfn id=queue-a-task>queue a task</dfn>, it must add the given task to one of the <a href=#task-queue id=definitions-3:task-queue-3>task queues</a> of the relevant <a href=#event-loop id=definitions-3:event-loop-13>event loop</a>.</p>
- <p>Each <a href=#concept-task id=definitions-3:concept-task-5>task</a> is defined as coming from a specific <dfn id=task-source>task
- source</dfn>. All the tasks from one particular <a href=#task-source id=definitions-3:task-source>task source</a> and destined to a
- particular <a href=#event-loop id=definitions-3:event-loop-14>event loop</a> (e.g. the callbacks generated by timers of a
- <code id=definitions-3:document-3><a href=#document>Document</a></code>, the events fired for mouse movements over that <code id=definitions-3:document-4><a href=#document>Document</a></code>, the
- tasks queued for the parser of that <code id=definitions-3:document-5><a href=#document>Document</a></code>) must always be added to the same
- <a href=#task-queue id=definitions-3:task-queue-4>task queue</a>, but <a href=#concept-task id=definitions-3:concept-task-6>tasks</a> from different <a href=#task-source id=definitions-3:task-source-2>task sources</a> may be placed in different <a href=#task-queue id=definitions-3:task-queue-5>task
- queues</a>.</p>
- <p class=example>For example, a user agent could have one <a href=#task-queue id=definitions-3:task-queue-6>task queue</a> for mouse and
- key events (the <a href=#user-interaction-task-source id=definitions-3:user-interaction-task-source>user interaction task source</a>), and another for everything else. The
- user agent could then give keyboard and mouse events preference over other tasks three quarters of
- the time, keeping the interface responsive but not starving other task queues, and never
- processing events from any one <a href=#task-source id=definitions-3:task-source-3>task source</a> out of order.</p>
- <p>Each <a href=#event-loop id=definitions-3:event-loop-15>event loop</a> has a <dfn id=currently-running-task>currently running task</dfn>. Initially, this is null.
- It is used to handle reentrancy. Each <a href=#event-loop id=definitions-3:event-loop-16>event loop</a> also has a <dfn id=performing-a-microtask-checkpoint>performing a
- microtask checkpoint</dfn> flag, which must initially be false. It is used to prevent reentrant
- invocation of the <a href=#perform-a-microtask-checkpoint id=definitions-3:perform-a-microtask-checkpoint>perform a microtask checkpoint</a> algorithm.</p>
- <hr>
- <p>A user agent may have one <dfn id=storage-mutex>storage mutex</dfn>. This mutex is used to control access to
- shared state like cookies. At any one point, the <a href=#storage-mutex id=definitions-3:storage-mutex>storage mutex</a> is either free, or
- owned by a particular <a href=#event-loop id=definitions-3:event-loop-17>event loop</a> or instance of the <a href=#fetch id=definitions-3:fetch-2>fetching</a> algorithm.</p>
- <p>If a user agent does not implement a <a href=#storage-mutex id=definitions-3:storage-mutex-2>storage mutex</a>, it is exempt from implementing
- the requirements that require it to acquire or release it.</p>
- <p class=note>User agent implementors have to make a choice between two evils. On the one hand,
- not implementing the storage mutex means that there is a risk of data corruption: a site could,
- for instance, try to read a cookie, increment its value, then write it back out, using the new
- value of the cookie as a unique identifier for the session; if the site does this twice in two
- different browser windows at the same time, it might end up using the same "unique" identifier for
- both sessions, with potentially disastrous effects. On the other hand, implementing the storage
- mutex has potentially serious performance implications: whenever a site uses Web Storage or
- cookies, all other sites that try to use Web Storage or cookies are blocked until the first site
- finishes.</p>
- <p class=warning>So far, all browsers faced with this decision have opted to not implement the
- <a href=#storage-mutex id=definitions-3:storage-mutex-3>storage mutex</a>.</p>
- <p>Whenever a <a href=#concept-script id=definitions-3:concept-script-2>script</a> calls into a <a href=#plugin id=definitions-3:plugin>plugin</a>, and
- whenever a <a href=#plugin id=definitions-3:plugin-2>plugin</a> calls into a <a href=#concept-script id=definitions-3:concept-script-3>script</a>, the user
- agent must release the <a href=#storage-mutex id=definitions-3:storage-mutex-4>storage mutex</a>.</p>
- <h5 id=processing-model-9>8.1.4.2 Processing model</h5>
- <p>An <a href=#event-loop id=processing-model-9:event-loop>event loop</a> must continually run through the following steps for as long as it
- exists:</p>
- <ol><li><p>Select the oldest <a href=#concept-task id=processing-model-9:concept-task>task</a> on one of the <a href=#event-loop id=processing-model-9:event-loop-2>event
- loop</a>'s <a href=#task-queue id=processing-model-9:task-queue>task queues</a>, if any, ignoring, in the case of a
- <a href=#browsing-context id=processing-model-9:browsing-context>browsing context</a> <a href=#event-loop id=processing-model-9:event-loop-3>event loop</a>, tasks whose associated
- <code id=processing-model-9:document><a href=#document>Document</a></code>s are not <a href=#fully-active id=processing-model-9:fully-active>fully active</a>. The user agent may pick any <a href=#task-queue id=processing-model-9:task-queue-2>task
- queue</a>.<li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-4>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task>currently running task</a> to the <a href=#concept-task id=processing-model-9:concept-task-2>task</a> selected in the previous step.<li><p><i>Run</i>: Run the selected <a href=#concept-task id=processing-model-9:concept-task-3>task</a>.<li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-5>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-2>currently running task</a> back to
- null.<li><p>If the <a href=#storage-mutex id=processing-model-9:storage-mutex>storage mutex</a> is now owned by the <a href=#event-loop id=processing-model-9:event-loop-6>event loop</a>, release it
- so that it is once again free.<li><p>If a task was run in the <i>run</i> step above, remove that task from its <a href=#task-queue id=processing-model-9:task-queue-3>task
- queue</a>.<li><p><a href=#perform-a-microtask-checkpoint id=processing-model-9:perform-a-microtask-checkpoint>Perform a microtask checkpoint</a>.<li><p><i>Update the rendering</i>: If this <a href=#event-loop id=processing-model-9:event-loop-7>event loop</a> is a <a href=#browsing-context id=processing-model-9:browsing-context-2>browsing
- context</a> <a href=#event-loop id=processing-model-9:event-loop-8>event loop</a> (as opposed to a <a href=#workers>worker</a> <a href=#event-loop id=processing-model-9:event-loop-9>event
- loop</a>), then, if necessary, update the rendering or user interface of any
- <code id=processing-model-9:document-2><a href=#document>Document</a></code> or <a href=#browsing-context id=processing-model-9:browsing-context-3>browsing context</a> to reflect the current state.<li><p>If this is a <a href=#workers>worker</a> <a href=#event-loop id=processing-model-9:event-loop-10>event loop</a> (i.e. one running for a
- <code id=processing-model-9:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code>), but there are no <a href=#concept-task id=processing-model-9:concept-task-4>tasks</a> in the
- <a href=#event-loop id=processing-model-9:event-loop-11>event loop</a>'s <a href=#task-queue id=processing-model-9:task-queue-4>task queues</a> and the
- <code id=processing-model-9:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing id=processing-model-9:dom-workerglobalscope-closing>closing</a> flag is true, then destroy the <a href=#event-loop id=processing-model-9:event-loop-12>event
- loop</a>, aborting these steps, resuming the <a href=#run-a-worker id=processing-model-9:run-a-worker>run a worker</a> steps described in the
- Web Workers section below.<li><p>Return to the first step of the <a href=#event-loop id=processing-model-9:event-loop-13>event loop</a>.</ol>
- <hr>
- <p>Each <a href=#event-loop id=processing-model-9:event-loop-14>event loop</a> has a <dfn id=microtask-queue>microtask queue</dfn>. A <dfn id=microtask>microtask</dfn> is a
- <a href=#concept-task id=processing-model-9:concept-task-5>task</a> that is originally to be queued on the <a href=#microtask-queue id=processing-model-9:microtask-queue>microtask
- queue</a> rather than a <a href=#task-queue id=processing-model-9:task-queue-5>task queue</a>. There are two kinds of <a href=#microtask id=processing-model-9:microtask>microtasks</a>: <dfn id=solitary-callback-microtask>solitary callback
- microtasks</dfn>, and <dfn id=compound-microtask>compound microtasks</dfn>.</p>
- <p class=note>This specification only has <a href=#solitary-callback-microtask id=processing-model-9:solitary-callback-microtask>solitary
- callback microtasks</a>. Specifications that use <a href=#compound-microtask id=processing-model-9:compound-microtask>compound
- microtasks</a> have to take extra care to <a href=#execute-a-compound-microtask-subtask id=processing-model-9:execute-a-compound-microtask-subtask>wrap callbacks</a> to handle <a href=#spin-the-event-loop id=processing-model-9:spin-the-event-loop>spinning the event
- loop</a>.</p>
- <p>When an algorithm requires a <a href=#microtask id=processing-model-9:microtask-2>microtask</a> to be <dfn id=queue-a-microtask>queued</dfn>, it must be appended to the relevant <a href=#event-loop id=processing-model-9:event-loop-15>event loop</a>'s
- <a href=#microtask-queue id=processing-model-9:microtask-queue-2>microtask queue</a>; the <a href=#task-source id=processing-model-9:task-source>task source</a> of such a <a href=#microtask id=processing-model-9:microtask-3>microtask</a> is the
- <dfn id=microtask-task-source>microtask task source</dfn>.</p>
- <p class=note>It is possible for a <a href=#microtask id=processing-model-9:microtask-4>microtask</a> to be moved to a regular <a href=#task-queue id=processing-model-9:task-queue-6>task
- queue</a>, if, during its initial execution, it <a href=#spin-the-event-loop id=processing-model-9:spin-the-event-loop-2>spins the
- event loop</a>. In that case, the <a href=#microtask-task-source id=processing-model-9:microtask-task-source>microtask task source</a> is the <a href=#task-source id=processing-model-9:task-source-2>task
- source</a> used. Normally, the <a href=#task-source id=processing-model-9:task-source-3>task source</a> of a <a href=#microtask id=processing-model-9:microtask-5>microtask</a> is
- irrelevant.</p>
- <p>When a user agent is to <dfn id=perform-a-microtask-checkpoint>perform a microtask checkpoint</dfn>, if the <a href=#performing-a-microtask-checkpoint id=processing-model-9:performing-a-microtask-checkpoint>performing a
- microtask checkpoint</a> flag is false, then the user agent must run the following steps:</p>
- <ol><li><p>Let the <a href=#performing-a-microtask-checkpoint id=processing-model-9:performing-a-microtask-checkpoint-2>performing a microtask checkpoint</a> flag be true.<li><p><i>Microtask queue handling</i>: If the <a href=#event-loop id=processing-model-9:event-loop-16>event loop</a>'s <a href=#microtask-queue id=processing-model-9:microtask-queue-3>microtask
- queue</a> is empty, jump to the <i>done</i> step below.<li><p>Select the oldest <a href=#microtask id=processing-model-9:microtask-6>microtask</a> on the <a href=#event-loop id=processing-model-9:event-loop-17>event loop</a>'s <a href=#microtask-queue id=processing-model-9:microtask-queue-4>microtask
- queue</a>.<li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-18>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-3>currently running task</a> to the <a href=#concept-task id=processing-model-9:concept-task-6>task</a> selected in the previous step.<li>
- <p><i>Run</i>: Run the selected <a href=#concept-task id=processing-model-9:concept-task-7>task</a>.</p>
- <p class=note>This might involve invoking scripted callbacks, which eventually calls the
- <a href=#clean-up-after-running-a-callback id=processing-model-9:clean-up-after-running-a-callback>clean up after running a callback</a> steps, which call this <a href=#perform-a-microtask-checkpoint id=processing-model-9:perform-a-microtask-checkpoint-2>perform a microtask
- checkpoint</a> algorithm again, which is why we use the <a href=#performing-a-microtask-checkpoint id=processing-model-9:performing-a-microtask-checkpoint-3>performing a microtask
- checkpoint</a> flag to avoid reentrancy.</p>
- <li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-19>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-4>currently running task</a> back to
- null.<li><p>If the <a href=#storage-mutex id=processing-model-9:storage-mutex-2>storage mutex</a> is now owned by the <a href=#event-loop id=processing-model-9:event-loop-20>event loop</a>, release it
- so that it is once again free.<li><p>Remove the <a href=#microtask id=processing-model-9:microtask-7>microtask</a> run in the step above from the <a href=#microtask-queue id=processing-model-9:microtask-queue-5>microtask
- queue</a>, and return to the <i>microtask queue handling</i> step.<li><p><i>Done</i>: Let the <a href=#performing-a-microtask-checkpoint id=processing-model-9:performing-a-microtask-checkpoint-4>performing a microtask checkpoint</a> flag be
- false.</ol>
- <p>If, while a <a href=#compound-microtask id=processing-model-9:compound-microtask-2>compound microtask</a> is running, the user agent is required to
- <dfn id=execute-a-compound-microtask-subtask>execute a compound microtask subtask</dfn> to run a series of steps, the user agent must run
- the following steps:</p>
- <ol><li><p>Let <var>parent</var> be the <a href=#event-loop id=processing-model-9:event-loop-21>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-5>currently running
- task</a> (the currently running <a href=#compound-microtask id=processing-model-9:compound-microtask-3>compound microtask</a>).<li><p>Let <var>subtask</var> be a new <a href=#concept-task id=processing-model-9:concept-task-8>task</a> that
- consists of running the given series of steps. The <a href=#task-source id=processing-model-9:task-source-4>task source</a> of such a
- <a href=#microtask id=processing-model-9:microtask-8>microtask</a> is the <a href=#microtask-task-source id=processing-model-9:microtask-task-source-2>microtask task source</a>. This is a <dfn id=compound-microtask-subtask>compound
- microtask subtask</dfn>.<li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-22>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-6>currently running task</a> to <var>subtask</var>.<li><p>Run <var>subtask</var>.<li><p>Set the <a href=#event-loop id=processing-model-9:event-loop-23>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-7>currently running task</a> back to <var>parent</var>.</ol>
- <hr>
- <p>When an asynchronously-running algorithm is to <dfn id=await-a-stable-state>await a stable state</dfn>, the user agent
- must <a href=#queue-a-microtask id=processing-model-9:queue-a-microtask>queue a microtask</a> that first runs the algorithm's <dfn id=synchronous-section>synchronous
- section</dfn>, and then resumes running the asynchronous algorithm (if appropriate), as described
- in the algorithm's steps.</p>
- <p class=note>Steps in <a href=#synchronous-section id=processing-model-9:synchronous-section>synchronous sections</a> are marked
- with ⌛.</p>
- <hr>
- <p>When an algorithm says to <dfn id=spin-the-event-loop>spin the event loop</dfn> until a condition <var>goal</var> is met, the user agent must run the following steps:</p>
- <ol><li>
- <p>Let <var>task</var> be the <a href=#event-loop id=processing-model-9:event-loop-24>event loop</a>'s <a href=#currently-running-task id=processing-model-9:currently-running-task-8>currently running
- task</a>.</p>
- <p class=note>This might be a <a href=#microtask id=processing-model-9:microtask-9>microtask</a>, in which case it is a <a href=#solitary-callback-microtask id=processing-model-9:solitary-callback-microtask-2>solitary
- callback microtask</a>. It could also be a <a href=#compound-microtask-subtask id=processing-model-9:compound-microtask-subtask>compound microtask subtask</a>, or a
- regular <a href=#concept-task id=processing-model-9:concept-task-9>task</a> that is not a <a href=#microtask id=processing-model-9:microtask-10>microtask</a>. It will
- <em>not</em> be a <a href=#compound-microtask id=processing-model-9:compound-microtask-4>compound microtask</a>.</p>
- <li><p>Let <var>task source</var> be <var>task</var>'s <a href=#task-source id=processing-model-9:task-source-5>task
- source</a>.<li><p>Let <var>old stack of script settings objects</var> be a copy of the <a href=#stack-of-script-settings-objects id=processing-model-9:stack-of-script-settings-objects>stack
- of script settings objects</a>.<li><p>Empty the <a href=#stack-of-script-settings-objects id=processing-model-9:stack-of-script-settings-objects-2>stack of script settings objects</a>.<li><p><a href=#run-the-global-script-clean-up-jobs id=processing-model-9:run-the-global-script-clean-up-jobs>Run the global script clean-up jobs</a>.<li><p><a href=#perform-a-microtask-checkpoint id=processing-model-9:perform-a-microtask-checkpoint-3>Perform a microtask checkpoint</a>.<li>
- <p>Stop <var>task</var>, allowing whatever algorithm that invoked it to resume, but
- continue these steps asynchronously.</p>
- <p class=note>This causes one of the following algorithms to continue: the <a href=#event-loop id=processing-model-9:event-loop-25>event
- loop</a>'s main set of steps, the <a href=#perform-a-microtask-checkpoint id=processing-model-9:perform-a-microtask-checkpoint-4>perform a microtask checkpoint</a> algorithm, or
- the <a href=#execute-a-compound-microtask-subtask id=processing-model-9:execute-a-compound-microtask-subtask-2>execute a compound microtask subtask</a> algorithm to continue.</p>
- <li><p>Wait until the condition <var>goal</var> is met.<li><p><a href=#queue-a-task id=processing-model-9:queue-a-task>Queue a task</a> to continue running these steps, using the <a href=#task-source id=processing-model-9:task-source-6>task
- source</a> <var>task source</var>. Wait until this new task runs before continuing
- these steps.<li><p>Replace the <a href=#stack-of-script-settings-objects id=processing-model-9:stack-of-script-settings-objects-3>stack of script settings objects</a> with the <var>old
- stack of script settings objects</var>.<li><p>Return to the caller.</ol>
- <hr>
- <p>Some of the algorithms in this specification, for historical reasons, require the user agent to
- <dfn id=pause>pause</dfn> while running a <a href=#concept-task id=processing-model-9:concept-task-10>task</a> until a condition <var>goal</var> is met. This means running the following steps:</p>
- <ol><li><p>If necessary, update the rendering or user interface of any <code id=processing-model-9:document-3><a href=#document>Document</a></code> or
- <a href=#browsing-context id=processing-model-9:browsing-context-4>browsing context</a> to reflect the current state.<li><p>Wait until the condition <var>goal</var> is met. While a user agent has a paused
- <a href=#concept-task id=processing-model-9:concept-task-11>task</a>, the corresponding <a href=#event-loop id=processing-model-9:event-loop-26>event loop</a> must not run
- further <a href=#concept-task id=processing-model-9:concept-task-12>tasks</a>, and any script in the currently running <a href=#concept-task id=processing-model-9:concept-task-13>task</a> must block. User agents should remain responsive to user input
- while paused, however, albeit in a reduced capacity since the <a href=#event-loop id=processing-model-9:event-loop-27>event loop</a> will not be
- doing anything.</ol>
- <hr>
- <p>When a user agent is to <dfn id=obtain-the-storage-mutex>obtain the storage mutex</dfn> as part of running a <a href=#concept-task id=processing-model-9:concept-task-14>task</a>, it must run through the following steps:</p>
- <ol><li><p>If the <a href=#storage-mutex id=processing-model-9:storage-mutex-3>storage mutex</a> is already owned by this <a href=#concept-task id=processing-model-9:concept-task-15>task</a>'s <a href=#event-loop id=processing-model-9:event-loop-28>event loop</a>, then abort these steps.<li><p>Otherwise, <a href=#pause id=processing-model-9:pause>pause</a> until the <a href=#storage-mutex id=processing-model-9:storage-mutex-4>storage mutex</a> can be taken by the
- <a href=#event-loop id=processing-model-9:event-loop-29>event loop</a>.<li><p>Take ownership of the <a href=#storage-mutex id=processing-model-9:storage-mutex-5>storage mutex</a>.</ol>
-
-
- <h5 id=generic-task-sources>8.1.4.3 Generic task sources</h5>
- <p>The following <a href=#task-source id=generic-task-sources:task-source>task sources</a> are used by a number of mostly
- unrelated features in this and other specifications.</p>
- <dl><dt>The <dfn id=dom-manipulation-task-source>DOM manipulation task source</dfn><dd>
- <p>This <a href=#task-source id=generic-task-sources:task-source-2>task source</a> is used for features that react to DOM manipulations, such as
- things that happen asynchronously when an element is <a href=#insert-an-element-into-a-document id=generic-task-sources:insert-an-element-into-a-document>inserted into the document</a>.</p>
- <dt>The <dfn id=user-interaction-task-source>user interaction task source</dfn><dd>
- <p>This <a href=#task-source id=generic-task-sources:task-source-3>task source</a> is used for features that react to user interaction, for
- example keyboard or mouse input.</p>
- <p>Asynchronous events sent in response to user input (e.g. <code id=generic-task-sources:event-click><a href=#event-click>click</a></code> events) must be fired using <a href=#concept-task id=generic-task-sources:concept-task>tasks</a> <a href=#queue-a-task id=generic-task-sources:queue-a-task>queued</a> with the <a href=#user-interaction-task-source id=generic-task-sources:user-interaction-task-source>user
- interaction task source</a>. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <dt>The <dfn id=networking-task-source>networking task source</dfn><dd>
- <p>This <a href=#task-source id=generic-task-sources:task-source-4>task source</a> is used for features that trigger in response to network
- activity.</p>
- <dt>The <dfn id=history-traversal-task-source>history traversal task source</dfn><dd>
- <p>This <a href=#task-source id=generic-task-sources:task-source-5>task source</a> is used to queue calls to <code id=generic-task-sources:dom-history-back><a href=#dom-history-back>history.back()</a></code> and similar APIs.</p>
- </dl>
-
- <h4 id=events>8.1.5 Events</h4>
- <h5 id=event-handler-attributes>8.1.5.1 Event handlers</h5>
-
- <p>Many objects can have <dfn id=event-handlers>event handlers</dfn> specified. These act as non-capture event
- listeners for the object on which they are specified. <a href=#refsDOM>[DOM]</a></p>
- <p>An <a href=#event-handlers id=event-handler-attributes:event-handlers>event handler</a> has a name, which always starts with
- "<code>on</code>" and is followed by the name of the event for which it is intended.</p>
- <p>An <a href=#event-handlers id=event-handler-attributes:event-handlers-2>event handler</a> can either have the value null, or be set
- to a callback object, or be set to an <a href=#internal-raw-uncompiled-handler id=event-handler-attributes:internal-raw-uncompiled-handler>internal raw uncompiled
- handler</a>. The <code id=event-handler-attributes:eventhandler><a href=#eventhandler>EventHandler</a></code> callback function type describes how this is
- exposed to scripts. Initially, event handlers must be set to null.</p>
- <p>Event handlers are exposed in one of two ways.</p>
- <p>The first way, common to all event handlers, is as an <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes>event handler IDL attribute</a>.</p>
- <p>The second way is as an <a href=#event-handler-content-attributes id=event-handler-attributes:event-handler-content-attributes>event handler content
- attribute</a>. Event handlers on <a href=#html-elements id=event-handler-attributes:html-elements>HTML elements</a> and some of the event handlers on
- <code id=event-handler-attributes:window><a href=#window>Window</a></code> objects are exposed in this way.</p>
-
- <hr>
- <p>An <dfn id=event-handler-idl-attributes>event handler IDL attribute</dfn> is an IDL
- attribute for a specific <a href=#event-handlers id=event-handler-attributes:event-handlers-3>event handler</a>. The name of the IDL
- attribute is the same as the name of the <a href=#event-handlers id=event-handler-attributes:event-handlers-4>event handler</a>.</p>
- <p><a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-2>Event handler IDL attributes</a>, on setting, must set the corresponding <a href=#event-handlers id=event-handler-attributes:event-handlers-5>event handler</a> to their new value, and on getting, must return the
- result of <a href=#getting-the-current-value-of-the-event-handler id=event-handler-attributes:getting-the-current-value-of-the-event-handler>getting the current value of the event handler</a> in question (this can throw
- an exception, in which case the getting propagates it to the caller, it does not catch it).</p>
- <p>If an <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-3>event handler IDL attribute</a> exposes an
- <a href=#event-handlers id=event-handler-attributes:event-handlers-6>event handler</a> of an object that doesn't exist, it must always
- return null on getting and must do nothing on setting.</p>
- <p class=note>This can happen in particular for <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-4>event
- handler IDL attribute</a> on <code id=event-handler-attributes:the-body-element><a href=#the-body-element>body</a></code> elements that do not have corresponding
- <code id=event-handler-attributes:window-2><a href=#window>Window</a></code> objects.</p>
- <p class=note>Certain event handler IDL attributes have additional requirements, in particular
- the <code id=event-handler-attributes:handler-messageport-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code> attribute of
- <code id=event-handler-attributes:messageport><a href=#messageport>MessagePort</a></code> objects.</p>
- <hr>
-
- <p>An <dfn id=event-handler-content-attributes>event handler content attribute</dfn> is a
- content attribute for a specific <a href=#event-handlers id=event-handler-attributes:event-handlers-7>event handler</a>. The name of
- the content attribute is the same as the name of the <a href=#event-handlers id=event-handler-attributes:event-handlers-8>event
- handler</a>.</p>
- <p><a href=#event-handler-content-attributes id=event-handler-attributes:event-handler-content-attributes-2>Event handler content attributes</a>, when specified, must contain valid JavaScript
- code which, when parsed, would match the <code>FunctionBody</code> production after
- automatic semicolon insertion. <a href=#refsECMA262>[ECMA262]</a></p>
-
- <p>When an <a href=#event-handler-content-attributes id=event-handler-attributes:event-handler-content-attributes-3>event handler content attribute</a>
- is set, the user agent must set the corresponding <a href=#event-handlers id=event-handler-attributes:event-handlers-9>event
- handler</a> to an <a href=#internal-raw-uncompiled-handler id=event-handler-attributes:internal-raw-uncompiled-handler-2>internal raw uncompiled handler</a> consisting of the attribute's
- new value and the script location where the attribute was set to this value</p>
- <p>When an event handler content attribute is removed, the user agent must set the corresponding
- <a href=#event-handlers id=event-handler-attributes:event-handlers-10>event handler</a> to null.</p>
-
- <hr>
- <p>When an <a href=#event-handlers id=event-handler-attributes:event-handlers-11>event handler</a> <var>H</var> of an element
- or object <var>T</var> implementing the <code id=event-handler-attributes:eventtarget><a href=#eventtarget>EventTarget</a></code> interface is first set
- to a non-null value, the user agent must append an <a href=#concept-event-listener id=event-handler-attributes:concept-event-listener>event
- listener</a> to the list of <a href=#concept-event-listener id=event-handler-attributes:concept-event-listener-2>event listeners</a>
- associated with <var>T</var> with <i>type</i> set to the <dfn id=event-handler-event-type>event handler event
- type</dfn> corresponding to <var>H</var>, <i>capture</i> set to false, and
- <i>listener</i> set to <a href=#the-event-handler-processing-algorithm id=event-handler-attributes:the-event-handler-processing-algorithm>the event handler processing algorithm</a> defined below. <a href=#refsDOM>[DOM]</a></p>
- <p class=note>The <i>listener</i> is emphatically <em>not</em> the <a href=#event-handlers id=event-handler-attributes:event-handlers-12>event handler</a> itself. Every event handler ends up registering the same
- <i>listener</i>, the algorithm defined below, which takes care of invoking the right callback, and
- processing the callback's return value.</p>
- <p class=note>This only happens the first time the <a href=#event-handlers id=event-handler-attributes:event-handlers-13>event
- handler</a>'s value is set. Since listeners are called in the order they were registered, the
- order of event listeners for a particular event type will always be first the event listeners
- registered with <code id=event-handler-attributes:dom-eventtarget-addeventlistener><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code> before
- the first time the <a href=#event-handlers id=event-handler-attributes:event-handlers-14>event handler</a> was set to a non-null value,
- then the callback to which it is currently set, if any, and finally the event listeners registered
- with <code id=event-handler-attributes:dom-eventtarget-addeventlistener-2><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code> <em>after</em> the
- first time the <a href=#event-handlers id=event-handler-attributes:event-handlers-15>event handler</a> was set to a non-null value.</p>
-
- <div class=example>
- <p>This example demonstrates the order in which event listeners are invoked. If the button in
- this example is clicked by the user, the page will show four alerts, with the text "ONE", "TWO",
- "THREE", and "FOUR" respectively.</p>
- <pre><button id="test">Start Demo</button>
- <script>
- var button = document.getElementById('test');
- button.addEventListener('click', function () { alert('ONE') }, false);
- button.setAttribute('onclick', "alert('NOT CALLED')"); // event handler listener is registered here
- button.addEventListener('click', function () { alert('THREE') }, false);
- button.onclick = function () { alert('TWO'); };
- button.addEventListener('click', function () { alert('FOUR') }, false);
- </script></pre>
- </div>
-
- <p class=note>The interfaces implemented by the event object do not influence whether an <a href=#event-handlers id=event-handler-attributes:event-handlers-16>event handler</a> is triggered or not.</p>
- <p><dfn id=the-event-handler-processing-algorithm>The event handler processing algorithm</dfn> for an <a href=#event-handlers id=event-handler-attributes:event-handlers-17>event
- handler</a> <var>H</var> and an <code id=event-handler-attributes:event><a href=#event>Event</a></code> object <var>E</var> is as
- follows:</p>
- <ol><li>
- <p>Let <var>callback</var> be the result of <a href=#getting-the-current-value-of-the-event-handler id=event-handler-attributes:getting-the-current-value-of-the-event-handler-2>getting the current value of the
- event handler</a> <var>H</var>.</p>
- <li><p>If <var>callback</var> is null, then abort these steps.<li>
- <p>Process the <code id=event-handler-attributes:event-2><a href=#event>Event</a></code> object <var>E</var> as follows:</p>
- <dl class=switch><dt>If <var>E</var> is an <code id=event-handler-attributes:errorevent><a href=#errorevent>ErrorEvent</a></code> object and the <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-5>event handler IDL attribute</a>'s type is
- <code id=event-handler-attributes:onerroreventhandler><a href=#onerroreventhandler>OnErrorEventHandler</a></code><dd>
- <p><a href=#concept-invoke-event-handler id=event-handler-attributes:concept-invoke-event-handler>Invoke</a> <var>callback</var> with five
- arguments, the first one having the value of <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-message><a href=#dom-errorevent-message>message</a></code> attribute, the second having the value of
- <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-filename><a href=#dom-errorevent-filename>filename</a></code> attribute, the third
- having the value of <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>
- attribute, the fourth having the value of <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-colno><a href=#dom-errorevent-colno>colno</a></code> attribute, the fifth having the value of
- <var>E</var>'s <code id=event-handler-attributes:dom-errorevent-error><a href=#dom-errorevent-error>error</a></code> attribute, and with the <i id=event-handler-attributes:dfn-callback-this-value><a href=#dfn-callback-this-value>callback this value</a></i> set to <var>E</var>'s <code id=event-handler-attributes:dom-event-currenttarget><a href=#dom-event-currenttarget>currentTarget</a></code>. Let <var>return value</var> be the
- callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- <dt>Otherwise<dd>
- <p><a href=#concept-invoke-event-handler id=event-handler-attributes:concept-invoke-event-handler-2>Invoke</a> <var>callback</var>
- with one argument, the value of which is the <code id=event-handler-attributes:event-3><a href=#event>Event</a></code> object <var>E</var>,
- with the <i id=event-handler-attributes:dfn-callback-this-value-2><a href=#dfn-callback-this-value>callback this value</a></i> set to <var>E</var>'s <code id=event-handler-attributes:dom-event-currenttarget-2><a href=#dom-event-currenttarget>currentTarget</a></code>. Let <var>return value</var> be the callback's return value. <a href=#refsWEBIDL>[WEBIDL]</a></p>
- </dl>
- <p class=XXX>In this step, <dfn id=concept-invoke-event-handler>invoke</dfn> means to run the
- <a href=#jump-to-a-code-entry-point id=event-handler-attributes:jump-to-a-code-entry-point>jump to a code entry-point</a> algorithm.</p>
- <li>
- <p>Process <var>return value</var> as follows:</p>
- <dl class=switch><dt>If the event type is <code id=event-handler-attributes:event-mouseover><a href=#event-mouseover>mouseover</a></code><dt>If the event type is <code id=event-handler-attributes:event-error><a href=#event-error>error</a></code> and <var>E</var> is an <code id=event-handler-attributes:errorevent-2><a href=#errorevent>ErrorEvent</a></code> object<dd><p>If <var>return value</var> is a Web IDL boolean true value, then cancel the event.<dt>If the event type is <code id=event-handler-attributes:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code><dd>
- <p class=note>The <a href=#event-handler-idl-attributes id=event-handler-attributes:event-handler-idl-attributes-6>event handler IDL
- attribute</a>'s type is <code id=event-handler-attributes:onbeforeunloadeventhandler><a href=#onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a></code>, and the <var>return value</var> will therefore have been coerced into either the value null or a
- DOMString.</p>
- <p>If the <var>return value</var> is null, then cancel the event.</p>
- <p>Otherwise, If the <code id=event-handler-attributes:event-4><a href=#event>Event</a></code> object <var>E</var> is a
- <code id=event-handler-attributes:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code> object, and the <code id=event-handler-attributes:event-5><a href=#event>Event</a></code> object <var>E</var>'s <code id=event-handler-attributes:dom-beforeunloadevent-returnvalue><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code>
- attribute's value is the empty string, then set the <code id=event-handler-attributes:dom-beforeunloadevent-returnvalue-2><a href=#dom-beforeunloadevent-returnvalue>returnValue</a></code> attribute's value to <var>return value</var>.</p>
- <dt>Otherwise<dd><p>If <var>return value</var> is a Web IDL boolean false value, then cancel the
- event.</dl>
- </ol>
-
- <hr>
- <p>The <code id=event-handler-attributes:eventhandler-2><a href=#eventhandler>EventHandler</a></code> callback function type represents a callback used for event
- handlers. It is represented in Web IDL as follows:</p>
- <pre class=idl>[TreatNonCallableAsNull]
- callback <dfn id=eventhandlernonnull>EventHandlerNonNull</dfn> = any (<a href=#event id=event-handler-attributes:event-6>Event</a> event);
- typedef <a href=#eventhandlernonnull id=event-handler-attributes:eventhandlernonnull>EventHandlerNonNull</a>? <dfn id=eventhandler>EventHandler</dfn>;</pre>
- <p class=note>In JavaScript, any <code id=event-handler-attributes:idl-function><a href=#idl-function>Function</a></code> object implements
- this interface.</p>
- <div class=example>
- <p>For example, the following document fragment:</p>
- <pre><body onload="alert(this)" onclick="alert(this)"></pre>
- <p>...leads to an alert saying "<code>[object Window]</code>" when the document is
- loaded, and an alert saying "<code>[object HTMLBodyElement]</code>" whenever the
- user clicks something in the page.</p>
- </div>
- <p class=note>The return value of the function affects whether the event is canceled or not:
- as described above, if the return value is false, the event is canceled
- (except for <code id=event-handler-attributes:event-mouseover-2><a href=#event-mouseover>mouseover</a></code> events, where the return value has to
- be true to cancel the event). With <code id=event-handler-attributes:event-beforeunload-2><a href=#event-beforeunload>beforeunload</a></code> events,
- the value is instead used to determine the message to show the user.</p>
- <p>For historical reasons, the <code id=event-handler-attributes:handler-onerror><a href=#handler-onerror>onerror</a></code> handler has different
- arguments:</p>
- <pre class=idl>[TreatNonCallableAsNull]
- callback <dfn id=onerroreventhandlernonnull>OnErrorEventHandlerNonNull</dfn> = any ((<a href=#event id=event-handler-attributes:event-7>Event</a> or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error);
- typedef <a href=#onerroreventhandlernonnull id=event-handler-attributes:onerroreventhandlernonnull>OnErrorEventHandlerNonNull</a>? <dfn id=onerroreventhandler>OnErrorEventHandler</dfn>;</pre>
- <p>Similarly, the <code id=event-handler-attributes:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code> handler has a
- different return value:</p>
- <pre class=idl>[TreatNonCallableAsNull]
- callback <dfn id=onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</dfn> = DOMString? (<a href=#event id=event-handler-attributes:event-8>Event</a> event);
- typedef <a href=#onbeforeunloadeventhandlernonnull id=event-handler-attributes:onbeforeunloadeventhandlernonnull>OnBeforeUnloadEventHandlerNonNull</a>? <dfn id=onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</dfn>;</pre>
-
-
- <hr>
- <p>An <dfn id=internal-raw-uncompiled-handler>internal raw uncompiled handler</dfn> is a tuple with the following information:</p>
- <ul class=brief><li>An uncompiled script body
- <li>A location where the script body originated, in case an error needs to be reported
- </ul>
- <p>When the user agent is to <dfn id=getting-the-current-value-of-the-event-handler>get the
- current value of the event handler</dfn> <var>H</var>, it must run these steps:</p>
- <ol><li>
- <p>If <var>H</var>'s value is an <a href=#internal-raw-uncompiled-handler id=event-handler-attributes:internal-raw-uncompiled-handler-3>internal raw uncompiled handler</a>, run these
- substeps:</p>
- <ol><li>
- <p>If <var>H</var> is an element's <a href=#event-handlers id=event-handler-attributes:event-handlers-18>event
- handler</a>, then let <var>element</var> be the element, and <var>document</var> be the element's <a id=event-handler-attributes:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>.</p>
- <p>Otherwise, <var>H</var> is a <code id=event-handler-attributes:window-3><a href=#window>Window</a></code> object's <a href=#event-handlers id=event-handler-attributes:event-handlers-19>event handler</a>: let <var>element</var> be null, and let <var>document</var> be the <code id=event-handler-attributes:document><a href=#document>Document</a></code> most recently associated with that
- <code id=event-handler-attributes:window-4><a href=#window>Window</a></code> object.</p>
- <li><p>If <var>document</var> is
- not in a <a href=#browsing-context id=event-handler-attributes:browsing-context>browsing context</a>, or if <a href=#concept-bc-script id=event-handler-attributes:concept-bc-script>scripting is
- enabled</a> for <var>document</var>'s <a href=#browsing-context id=event-handler-attributes:browsing-context-2>browsing context</a>, then return
- null and abort the algorithm for <a href=#getting-the-current-value-of-the-event-handler id=event-handler-attributes:getting-the-current-value-of-the-event-handler-3>getting the current value of the event
- handler</a>.<li><p>Let <var>body</var> be the uncompiled script body in the <a href=#internal-raw-uncompiled-handler id=event-handler-attributes:internal-raw-uncompiled-handler-4>internal raw
- uncompiled handler</a>.<li><p>Let <var>location</var> be the location where the script body originated, as
- given by the <a href=#internal-raw-uncompiled-handler id=event-handler-attributes:internal-raw-uncompiled-handler-5>internal raw uncompiled handler</a>.<li><p>If <var>element</var> is not null and <var>element</var> has a
- <a href=#form-owner id=event-handler-attributes:form-owner>form owner</a>, let <var>form owner</var> be that <a href=#form-owner id=event-handler-attributes:form-owner-2>form owner</a>.
- Otherwise, let <var>form owner</var> be null.<li><p>Let <var>script settings</var> be the <a href=#script-settings-object id=event-handler-attributes:script-settings-object>script settings object</a>
- created for the <code id=event-handler-attributes:window-5><a href=#window>Window</a></code> object with which <var>document</var> is
- currently associated.<li><p>Obtain the <a href=#script-execution-environment id=event-handler-attributes:script-execution-environment>script execution environment</a> for JavaScript from <var>script settings</var>.<li>
- <p>If <var>body</var> is not parsable as <i>FunctionBody</i> or if parsing detects
- an <i>early error</i>, then follow these substeps:</p>
- <ol><li><p>Set <var>H</var>'s value to null.<li><p><a href=#report-the-error id=event-handler-attributes:report-the-error>Report the error</a> for the appropriate <a href=#concept-script id=event-handler-attributes:concept-script>script</a> and with the appropriate position (line number and
- column number) given by <var>location</var>, using the <a href=#global-object id=event-handler-attributes:global-object>global object</a>
- specified by <var>script settings</var> as the target. If the error is still <i id=event-handler-attributes:concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i> after this, then the error may be reported
- to the user.<li><p>Jump to the step labeled <i>end</i> below.</ol>
- <p class=note><i>FunctionBody</i> is defined in ECMAScript edition 5 section 13 Function
- Definition. <i>Early error</i> is defined in ECMAScript edition 5 section 16 Errors. <a href=#refsECMA262>[ECMA262]</a></p>
- <li>
- <p>If <var>body</var> begins with a Directive Prologue that contains a Use Strict
- Directive then let <var>strict</var> be true, otherwise let <var>strict</var> be false.</p>
- <p class=note>The terms "Directive Prologue" and "Use Strict Directive" are defined in
- ECMAScript edition 5 section 14.1 Directive Prologues and the Use Strict Directive. <a href=#refsECMA262>[ECMA262]</a></p>
- <li>
- <p>Using the <a href=#script-execution-environment id=event-handler-attributes:script-execution-environment-2>script execution environment</a> obtained above, create a function
- object (as defined in ECMAScript edition 5 section 13.2 Creating Function Objects), with:</p>
- <dl><dt>Parameter list <var>FormalParameterList</var><dd>
- <dl class=switch><dt>If <var>H</var> is an <code id=event-handler-attributes:handler-onerror-2><a href=#handler-onerror>onerror</a></code> <a href=#event-handlers id=event-handler-attributes:event-handlers-20>event handler</a> of a <code id=event-handler-attributes:window-6><a href=#window>Window</a></code> object<dd>Let the function have five arguments, named <code>event</code>, <code>source</code>, <code>lineno</code>, <code>colno</code>, and
- <code>error</code>.<dt>Otherwise<dd>Let the function have a single argument called <code>event</code>.</dl>
- <dt>Function body <var>FunctionBody</var><dd>The result of parsing <var>body</var> above.<dt>Lexical Environment <var>Scope</var><dd>
- <ol><li>
- <p>If <var>H</var> is an element's <a href=#event-handlers id=event-handler-attributes:event-handlers-21>event
- handler</a>, then let <var>Scope</var> be the result of
- NewObjectEnvironment(<var>document</var>, the <var>global
- environment</var>).</p>
- <p>Otherwise, <var>H</var> is a <code id=event-handler-attributes:window-7><a href=#window>Window</a></code> object's <a href=#event-handlers id=event-handler-attributes:event-handlers-22>event handler</a>: let <var>Scope</var> be the <var>global environment</var>.</p>
- <li><p>If <var>form owner</var> is not null, let <var>Scope</var> be
- the result of NewObjectEnvironment(<var>form owner</var>, <var>Scope</var>).<li><p>If <var>element</var> is not null, let <var>Scope</var> be the
- result of NewObjectEnvironment(<var>element</var>, <var>Scope</var>).</ol>
- <p class=note>NewObjectEnvironment() is defined in ECMAScript edition 5 section 10.2.2.3
- NewObjectEnvironment (O, E). <a href=#refsECMA262>[ECMA262]</a></p>
- <dt>Boolean flag <var>Strict</var><dd>The value of <var>strict</var>.</dl>
- <p>Let <var>function</var> be this new function.</p>
- <li><p>Let <var>script</var> be a new <a href=#concept-script id=event-handler-attributes:concept-script-2>script</a>.<li><p>Let <var>script</var>'s <a href=#code-entry-point id=event-handler-attributes:code-entry-point>code entry-point</a> be <var>function</var>.<li><p>Let <var>script</var>'s <a href=#settings-object id=event-handler-attributes:settings-object>settings object</a> be <var>script
- settings</var>.<li><p>Set <var>H</var> to <var>function</var>.</ol>
- <li><p><i>End</i>: Return <var>H</var>'s value.</ol>
-
- <h5 id=event-handlers-on-elements,-document-objects,-and-window-objects>8.1.5.2 Event handlers on elements, <code id=event-handlers-on-elements,-document-objects,-and-window-objects:document><a href=#document>Document</a></code> objects, and <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window><a href=#window>Window</a></code> objects</h5>
- <p>The following are the <a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type>event handler event types</a>) that must be
- supported by all <a href=#html-elements id=event-handlers-on-elements,-document-objects,-and-window-objects:html-elements>HTML elements</a>, as both <a href=#event-handler-content-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes>event handler content attributes</a>
- and <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes>event handler IDL attributes</a>; and that must be
- supported by all <code id=event-handlers-on-elements,-document-objects,-and-window-objects:document-2><a href=#document>Document</a></code> and <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window-2><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-2>event handler IDL
- attributes</a>:</p>
- <table><thead><tr><th><a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-onabort><code>onabort</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-abort><a href=#event-abort>abort</a></code>
- <tr><td><dfn id=handler-onautocomplete><code>onautocomplete</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-autocomplete><a href=#event-autocomplete>autocomplete</a></code>
- <tr><td><dfn id=handler-onautocompleteerror><code>onautocompleteerror</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code>
- <tr><td><dfn id=handler-oncancel><code>oncancel</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-cancel><a href=#event-cancel>cancel</a></code>
- <tr><td><dfn id=handler-oncanplay><code>oncanplay</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-canplay><a href=#event-media-canplay>canplay</a></code>
- <tr><td><dfn id=handler-oncanplaythrough><code>oncanplaythrough</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code>
- <tr><td><dfn id=handler-onchange><code>onchange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-change><a href=#event-change>change</a></code>
- <tr><td><dfn id=handler-onclick><code>onclick</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-click><a href=#event-click>click</a></code>
- <tr><td><dfn id=handler-onclose><code>onclose</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-close><a href=#event-close>close</a></code>
- <tr><td><dfn id=handler-oncontextmenu><code>oncontextmenu</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-contextmenu><a href=#event-contextmenu>contextmenu</a></code>
- <tr><td><dfn id=handler-oncuechange><code>oncuechange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code>
- <tr><td><dfn id=handler-ondblclick><code>ondblclick</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dblclick><a href=#event-dblclick>dblclick</a></code>
- <tr><td><dfn id=handler-ondrag><code>ondrag</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-drag><a href=#event-dnd-drag>drag</a></code>
- <tr><td><dfn id=handler-ondragend><code>ondragend</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code>
- <tr><td><dfn id=handler-ondragenter><code>ondragenter</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code>
- <tr><td><dfn id=handler-ondragexit><code>ondragexit</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragexit><a href=#event-dnd-dragexit>dragexit</a></code>
- <tr><td><dfn id=handler-ondragleave><code>ondragleave</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragleave><a href=#event-dnd-dragleave>dragleave</a></code>
- <tr><td><dfn id=handler-ondragover><code>ondragover</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code>
- <tr><td><dfn id=handler-ondragstart><code>ondragstart</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code>
- <tr><td><dfn id=handler-ondrop><code>ondrop</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-dnd-drop><a href=#event-dnd-drop>drop</a></code>
- <tr><td><dfn id=handler-ondurationchange><code>ondurationchange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code>
- <tr><td><dfn id=handler-onemptied><code>onemptied</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-emptied><a href=#event-media-emptied>emptied</a></code>
- <tr><td><dfn id=handler-onended><code>onended</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-ended><a href=#event-media-ended>ended</a></code>
- <tr><td><dfn id=handler-oninput><code>oninput</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-input><a href=#event-input>input</a></code>
- <tr><td><dfn id=handler-oninvalid><code>oninvalid</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-invalid><a href=#event-invalid>invalid</a></code>
- <tr><td><dfn id=handler-onkeydown><code>onkeydown</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-keydown><a href=#event-keydown>keydown</a></code>
- <tr><td><dfn id=handler-onkeypress><code>onkeypress</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-keypress><a href=#event-keypress>keypress</a></code>
- <tr><td><dfn id=handler-onkeyup><code>onkeyup</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-keyup><a href=#event-keyup>keyup</a></code>
- <tr><td><dfn id=handler-onloadeddata><code>onloadeddata</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code>
- <tr><td><dfn id=handler-onloadedmetadata><code>onloadedmetadata</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code>
- <tr><td><dfn id=handler-onloadstart><code>onloadstart</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code>
- <tr><td><dfn id=handler-onmousedown><code>onmousedown</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mousedown><a href=#event-mousedown>mousedown</a></code>
- <tr><td><dfn id=handler-onmouseenter><code>onmouseenter</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mouseenter><a href=#event-mouseenter>mouseenter</a></code>
- <tr><td><dfn id=handler-onmouseleave><code>onmouseleave</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mouseleave><a href=#event-mouseleave>mouseleave</a></code>
- <tr><td><dfn id=handler-onmousemove><code>onmousemove</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mousemove><a href=#event-mousemove>mousemove</a></code>
- <tr><td><dfn id=handler-onmouseout><code>onmouseout</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mouseout><a href=#event-mouseout>mouseout</a></code>
- <tr><td><dfn id=handler-onmouseover><code>onmouseover</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mouseover><a href=#event-mouseover>mouseover</a></code>
- <tr><td><dfn id=handler-onmouseup><code>onmouseup</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mouseup><a href=#event-mouseup>mouseup</a></code>
- <tr><td><dfn id=handler-onmousewheel><code>onmousewheel</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-mousewheel><a href=#event-mousewheel>mousewheel</a></code>
- <tr><td><dfn id=handler-onpause><code>onpause</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-pause><a href=#event-media-pause>pause</a></code>
- <tr><td><dfn id=handler-onplay><code>onplay</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-play><a href=#event-media-play>play</a></code>
- <tr><td><dfn id=handler-onplaying><code>onplaying</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-playing><a href=#event-media-playing>playing</a></code>
- <tr><td><dfn id=handler-onprogress><code>onprogress</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-progress><a href=#event-media-progress>progress</a></code>
- <tr><td><dfn id=handler-onratechange><code>onratechange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code>
- <tr><td><dfn id=handler-onreset><code>onreset</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-reset><a href=#event-reset>reset</a></code>
- <tr><td><dfn id=handler-onseeked><code>onseeked</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-seeked><a href=#event-media-seeked>seeked</a></code>
- <tr><td><dfn id=handler-onseeking><code>onseeking</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-seeking><a href=#event-media-seeking>seeking</a></code>
- <tr><td><dfn id=handler-onselect><code>onselect</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-select><a href=#event-select>select</a></code>
- <tr><td><dfn id=handler-onshow><code>onshow</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-show><a href=#event-show>show</a></code>
- <tr><td><dfn id=handler-onsort><code>onsort</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-sort><a href=#event-sort>sort</a></code>
- <tr><td><dfn id=handler-onstalled><code>onstalled</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-stalled><a href=#event-media-stalled>stalled</a></code>
- <tr><td><dfn id=handler-onsubmit><code>onsubmit</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-submit><a href=#event-submit>submit</a></code>
- <tr><td><dfn id=handler-onsuspend><code>onsuspend</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-suspend><a href=#event-media-suspend>suspend</a></code>
- <tr><td><dfn id=handler-ontimeupdate><code>ontimeupdate</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code>
- <tr><td><dfn id=handler-ontoggle><code>ontoggle</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-toggle><a href=#event-toggle>toggle</a></code>
- <tr><td><dfn id=handler-onvolumechange><code>onvolumechange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code>
- <tr><td><dfn id=handler-onwaiting><code>onwaiting</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-media-waiting><a href=#event-media-waiting>waiting</a></code>
-
-
-
-
- </table>
- <hr>
- <p>The following are the <a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-3>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-3>event handler event types</a>) that must be
- supported by all <a href=#html-elements id=event-handlers-on-elements,-document-objects,-and-window-objects:html-elements-2>HTML elements</a> other than <code id=event-handlers-on-elements,-document-objects,-and-window-objects:the-body-element><a href=#the-body-element>body</a></code> and <code id=event-handlers-on-elements,-document-objects,-and-window-objects:frameset><a href=#frameset>frameset</a></code>
- elements, as both <a href=#event-handler-content-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-2>event handler content attributes</a> and <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-3>event handler IDL
- attributes</a>; that must be supported by all <code id=event-handlers-on-elements,-document-objects,-and-window-objects:document-3><a href=#document>Document</a></code>
- objects, as <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-4>event handler IDL attributes</a>; and that must be
- supported by all <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window-3><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-5>event handler IDL attributes</a> on the
- <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window-4><a href=#window>Window</a></code> objects themselves, and with corresponding <a href=#event-handler-content-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-3>event handler content
- attributes</a> and <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-6>event handler IDL attributes</a> exposed on all <code id=event-handlers-on-elements,-document-objects,-and-window-objects:the-body-element-2><a href=#the-body-element>body</a></code>
- and <code id=event-handlers-on-elements,-document-objects,-and-window-objects:frameset-2><a href=#frameset>frameset</a></code> elements that are owned by <a href=#concept-document-window id=event-handlers-on-elements,-document-objects,-and-window-objects:concept-document-window>that
- <code>Window</code> object's <code>Document</code>s</a>:</p>
- <table><thead><tr><th><a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-4>Event handler</a> <th><a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-4>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-onblur><code>onblur</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-blur><a href=#event-blur>blur</a></code>
- <tr><td><dfn id=handler-onerror><code>onerror</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-error><a href=#event-error>error</a></code>
- <tr><td><dfn id=handler-onfocus><code>onfocus</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-focus><a href=#event-focus>focus</a></code>
- <tr><td><dfn id=handler-onload><code>onload</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-load><a href=#event-load>load</a></code>
- <tr><td><dfn id=handler-onresize><code>onresize</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-resize><a href=#event-resize>resize</a></code>
- <tr><td><dfn id=handler-onscroll><code>onscroll</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-scroll><a href=#event-scroll>scroll</a></code>
- </table>
- <hr>
- <p>The following are the <a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-5>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-5>event handler event types</a>) that must be
- supported by <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window-5><a href=#window>Window</a></code> objects, as <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-7>event handler IDL attributes</a> on the
- <code id=event-handlers-on-elements,-document-objects,-and-window-objects:window-6><a href=#window>Window</a></code> objects themselves, and with corresponding <a href=#event-handler-content-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-content-attributes-4>event handler content
- attributes</a> and <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-8>event handler IDL attributes</a> exposed on all <code id=event-handlers-on-elements,-document-objects,-and-window-objects:the-body-element-3><a href=#the-body-element>body</a></code>
- and <code id=event-handlers-on-elements,-document-objects,-and-window-objects:frameset-3><a href=#frameset>frameset</a></code> elements that are owned by <a href=#concept-document-window id=event-handlers-on-elements,-document-objects,-and-window-objects:concept-document-window-2>that
- <code>Window</code> object's <code>Document</code>s</a>:</p>
- <table><thead><tr><th><a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-6>Event handler</a> <th><a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-6>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-window-onafterprint><code>onafterprint</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-afterprint><a href=#event-afterprint>afterprint</a></code>
- <tr><td><dfn id=handler-window-onbeforeprint><code>onbeforeprint</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-beforeprint><a href=#event-beforeprint>beforeprint</a></code>
- <tr><td><dfn id=handler-window-onbeforeunload><code>onbeforeunload</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code>
- <tr><td><dfn id=handler-window-onhashchange><code>onhashchange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-hashchange><a href=#event-hashchange>hashchange</a></code>
- <tr><td><dfn id=handler-window-onlanguagechange><code>onlanguagechange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-languagechange><a href=#event-languagechange>languagechange</a></code>
- <tr><td><dfn id=handler-window-onmessage><code>onmessage</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-message><a href=#event-message>message</a></code>
- <tr><td><dfn id=handler-window-onoffline><code>onoffline</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-offline><a href=#event-offline>offline</a></code>
- <tr><td><dfn id=handler-window-ononline><code>ononline</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-online><a href=#event-online>online</a></code>
- <tr><td><dfn id=handler-window-onpagehide><code>onpagehide</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-pagehide><a href=#event-pagehide>pagehide</a></code>
- <tr><td><dfn id=handler-window-onpageshow><code>onpageshow</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-pageshow><a href=#event-pageshow>pageshow</a></code>
- <tr><td><dfn id=handler-window-onpopstate><code>onpopstate</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-popstate><a href=#event-popstate>popstate</a></code>
- <tr><td><dfn id=handler-window-onstorage><code>onstorage</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-storage><a href=#event-storage>storage</a></code>
- <tr><td><dfn id=handler-window-onunload><code>onunload</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-unload><a href=#event-unload>unload</a></code>
- </table>
- <hr>
-
- <p>The following are the <a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-7>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-7>event handler event types</a>) that must be
- supported on <code id=event-handlers-on-elements,-document-objects,-and-window-objects:document-4><a href=#document>Document</a></code> objects as <a href=#event-handler-idl-attributes id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-idl-attributes-9>event handler IDL attributes</a>:</p>
- <table><thead><tr><th><a href=#event-handlers id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handlers-8>Event handler</a> <th><a href=#event-handler-event-type id=event-handlers-on-elements,-document-objects,-and-window-objects:event-handler-event-type-8>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-onreadystatechange><code>onreadystatechange</code></dfn> <td> <code id=event-handlers-on-elements,-document-objects,-and-window-objects:event-readystatechange><a href=#event-readystatechange>readystatechange</a></code>
- </table>
- <h6 id=idl-definitions>8.1.5.2.1 IDL definitions</h6>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=globaleventhandlers>GlobalEventHandlers</dfn> {
- attribute <a href=#eventhandler id=idl-definitions:eventhandler>EventHandler</a> <a href=#handler-onabort id=idl-definitions:handler-onabort>onabort</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-2>EventHandler</a> <a href=#handler-onautocomplete id=idl-definitions:handler-onautocomplete>onautocomplete</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-3>EventHandler</a> <a href=#handler-onautocompleteerror id=idl-definitions:handler-onautocompleteerror>onautocompleteerror</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-4>EventHandler</a> <a href=#handler-onblur id=idl-definitions:handler-onblur>onblur</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-5>EventHandler</a> <a href=#handler-oncancel id=idl-definitions:handler-oncancel>oncancel</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-6>EventHandler</a> <a href=#handler-oncanplay id=idl-definitions:handler-oncanplay>oncanplay</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-7>EventHandler</a> <a href=#handler-oncanplaythrough id=idl-definitions:handler-oncanplaythrough>oncanplaythrough</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-8>EventHandler</a> <a href=#handler-onchange id=idl-definitions:handler-onchange>onchange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-9>EventHandler</a> <a href=#handler-onclick id=idl-definitions:handler-onclick>onclick</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-10>EventHandler</a> <a href=#handler-onclose id=idl-definitions:handler-onclose>onclose</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-11>EventHandler</a> <a href=#handler-oncontextmenu id=idl-definitions:handler-oncontextmenu>oncontextmenu</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-12>EventHandler</a> <a href=#handler-oncuechange id=idl-definitions:handler-oncuechange>oncuechange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-13>EventHandler</a> <a href=#handler-ondblclick id=idl-definitions:handler-ondblclick>ondblclick</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-14>EventHandler</a> <a href=#handler-ondrag id=idl-definitions:handler-ondrag>ondrag</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-15>EventHandler</a> <a href=#handler-ondragend id=idl-definitions:handler-ondragend>ondragend</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-16>EventHandler</a> <a href=#handler-ondragenter id=idl-definitions:handler-ondragenter>ondragenter</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-17>EventHandler</a> <a href=#handler-ondragexit id=idl-definitions:handler-ondragexit>ondragexit</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-18>EventHandler</a> <a href=#handler-ondragleave id=idl-definitions:handler-ondragleave>ondragleave</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-19>EventHandler</a> <a href=#handler-ondragover id=idl-definitions:handler-ondragover>ondragover</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-20>EventHandler</a> <a href=#handler-ondragstart id=idl-definitions:handler-ondragstart>ondragstart</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-21>EventHandler</a> <a href=#handler-ondrop id=idl-definitions:handler-ondrop>ondrop</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-22>EventHandler</a> <a href=#handler-ondurationchange id=idl-definitions:handler-ondurationchange>ondurationchange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-23>EventHandler</a> <a href=#handler-onemptied id=idl-definitions:handler-onemptied>onemptied</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-24>EventHandler</a> <a href=#handler-onended id=idl-definitions:handler-onended>onended</a>;
- attribute <a href=#onerroreventhandler id=idl-definitions:onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-onerror id=idl-definitions:handler-onerror>onerror</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-25>EventHandler</a> <a href=#handler-onfocus id=idl-definitions:handler-onfocus>onfocus</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-26>EventHandler</a> <a href=#handler-oninput id=idl-definitions:handler-oninput>oninput</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-27>EventHandler</a> <a href=#handler-oninvalid id=idl-definitions:handler-oninvalid>oninvalid</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-28>EventHandler</a> <a href=#handler-onkeydown id=idl-definitions:handler-onkeydown>onkeydown</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-29>EventHandler</a> <a href=#handler-onkeypress id=idl-definitions:handler-onkeypress>onkeypress</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-30>EventHandler</a> <a href=#handler-onkeyup id=idl-definitions:handler-onkeyup>onkeyup</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-31>EventHandler</a> <a href=#handler-onload id=idl-definitions:handler-onload>onload</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-32>EventHandler</a> <a href=#handler-onloadeddata id=idl-definitions:handler-onloadeddata>onloadeddata</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-33>EventHandler</a> <a href=#handler-onloadedmetadata id=idl-definitions:handler-onloadedmetadata>onloadedmetadata</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-34>EventHandler</a> <a href=#handler-onloadstart id=idl-definitions:handler-onloadstart>onloadstart</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-35>EventHandler</a> <a href=#handler-onmousedown id=idl-definitions:handler-onmousedown>onmousedown</a>;
- [LenientThis] attribute <a href=#eventhandler id=idl-definitions:eventhandler-36>EventHandler</a> <a href=#handler-onmouseenter id=idl-definitions:handler-onmouseenter>onmouseenter</a>;
- [LenientThis] attribute <a href=#eventhandler id=idl-definitions:eventhandler-37>EventHandler</a> <a href=#handler-onmouseleave id=idl-definitions:handler-onmouseleave>onmouseleave</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-38>EventHandler</a> <a href=#handler-onmousemove id=idl-definitions:handler-onmousemove>onmousemove</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-39>EventHandler</a> <a href=#handler-onmouseout id=idl-definitions:handler-onmouseout>onmouseout</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-40>EventHandler</a> <a href=#handler-onmouseover id=idl-definitions:handler-onmouseover>onmouseover</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-41>EventHandler</a> <a href=#handler-onmouseup id=idl-definitions:handler-onmouseup>onmouseup</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-42>EventHandler</a> <a href=#handler-onmousewheel id=idl-definitions:handler-onmousewheel>onmousewheel</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-43>EventHandler</a> <a href=#handler-onpause id=idl-definitions:handler-onpause>onpause</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-44>EventHandler</a> <a href=#handler-onplay id=idl-definitions:handler-onplay>onplay</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-45>EventHandler</a> <a href=#handler-onplaying id=idl-definitions:handler-onplaying>onplaying</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-46>EventHandler</a> <a href=#handler-onprogress id=idl-definitions:handler-onprogress>onprogress</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-47>EventHandler</a> <a href=#handler-onratechange id=idl-definitions:handler-onratechange>onratechange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-48>EventHandler</a> <a href=#handler-onreset id=idl-definitions:handler-onreset>onreset</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-49>EventHandler</a> <a href=#handler-onresize id=idl-definitions:handler-onresize>onresize</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-50>EventHandler</a> <a href=#handler-onscroll id=idl-definitions:handler-onscroll>onscroll</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-51>EventHandler</a> <a href=#handler-onseeked id=idl-definitions:handler-onseeked>onseeked</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-52>EventHandler</a> <a href=#handler-onseeking id=idl-definitions:handler-onseeking>onseeking</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-53>EventHandler</a> <a href=#handler-onselect id=idl-definitions:handler-onselect>onselect</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-54>EventHandler</a> <a href=#handler-onshow id=idl-definitions:handler-onshow>onshow</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-55>EventHandler</a> <a href=#handler-onsort id=idl-definitions:handler-onsort>onsort</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-56>EventHandler</a> <a href=#handler-onstalled id=idl-definitions:handler-onstalled>onstalled</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-57>EventHandler</a> <a href=#handler-onsubmit id=idl-definitions:handler-onsubmit>onsubmit</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-58>EventHandler</a> <a href=#handler-onsuspend id=idl-definitions:handler-onsuspend>onsuspend</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-59>EventHandler</a> <a href=#handler-ontimeupdate id=idl-definitions:handler-ontimeupdate>ontimeupdate</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-60>EventHandler</a> <a href=#handler-ontoggle id=idl-definitions:handler-ontoggle>ontoggle</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-61>EventHandler</a> <a href=#handler-onvolumechange id=idl-definitions:handler-onvolumechange>onvolumechange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-62>EventHandler</a> <a href=#handler-onwaiting id=idl-definitions:handler-onwaiting>onwaiting</a>;
- };
- [NoInterfaceObject]
- interface <dfn id=windoweventhandlers>WindowEventHandlers</dfn> {
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-63>EventHandler</a> <a href=#handler-window-onafterprint id=idl-definitions:handler-window-onafterprint>onafterprint</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-64>EventHandler</a> <a href=#handler-window-onbeforeprint id=idl-definitions:handler-window-onbeforeprint>onbeforeprint</a>;
- attribute <a href=#onbeforeunloadeventhandler id=idl-definitions:onbeforeunloadeventhandler>OnBeforeUnloadEventHandler</a> <a href=#handler-window-onbeforeunload id=idl-definitions:handler-window-onbeforeunload>onbeforeunload</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-65>EventHandler</a> <a href=#handler-window-onhashchange id=idl-definitions:handler-window-onhashchange>onhashchange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-66>EventHandler</a> <a href=#handler-window-onlanguagechange id=idl-definitions:handler-window-onlanguagechange>onlanguagechange</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-67>EventHandler</a> <a href=#handler-window-onmessage id=idl-definitions:handler-window-onmessage>onmessage</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-68>EventHandler</a> <a href=#handler-window-onoffline id=idl-definitions:handler-window-onoffline>onoffline</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-69>EventHandler</a> <a href=#handler-window-ononline id=idl-definitions:handler-window-ononline>ononline</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-70>EventHandler</a> <a href=#handler-window-onpagehide id=idl-definitions:handler-window-onpagehide>onpagehide</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-71>EventHandler</a> <a href=#handler-window-onpageshow id=idl-definitions:handler-window-onpageshow>onpageshow</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-72>EventHandler</a> <a href=#handler-window-onpopstate id=idl-definitions:handler-window-onpopstate>onpopstate</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-73>EventHandler</a> <a href=#handler-window-onstorage id=idl-definitions:handler-window-onstorage>onstorage</a>;
- attribute <a href=#eventhandler id=idl-definitions:eventhandler-74>EventHandler</a> <a href=#handler-window-onunload id=idl-definitions:handler-window-onunload>onunload</a>;
- };</pre>
-
- <h5 id=event-firing>8.1.5.3 Event firing</h5>
- <p>Certain operations and methods are defined as firing events on elements. For example, the <code id=event-firing:dom-click><a href=#dom-click>click()</a></code> method on the <code id=event-firing:htmlelement><a href=#htmlelement>HTMLElement</a></code> interface is defined as
- firing a <code id=event-firing:event-click><a href=#event-click>click</a></code> event on the element. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p><dfn id=fire-a-simple-event>Firing a simple event named <var>e</var></dfn>
- means that a <a href=#concept-events-trusted id=event-firing:concept-events-trusted>trusted</a> event with the name <var>e</var>, which does not bubble (except where otherwise stated) and is not cancelable
- (except where otherwise stated), and which uses the <code id=event-firing:event><a href=#event>Event</a></code> interface, must be created
- and <a href=#concept-event-dispatch id=event-firing:concept-event-dispatch>dispatched</a> at the given target.</p>
- <p><dfn id=fire-a-synthetic-mouse-event>Firing a synthetic mouse event named <var>e</var></dfn> means that an event with the name <var>e</var>, which is <a href=#concept-events-trusted id=event-firing:concept-events-trusted-2>trusted</a> (except where otherwise stated), does not bubble
- (except where otherwise stated), is not cancelable (except where otherwise stated), and which uses
- the <code id=event-firing:mouseevent><a href=#mouseevent>MouseEvent</a></code> interface, must be created and dispatched at the given target. The
- event object must have its <code>screenX</code>, <code>screenY</code>, <code>clientX</code>, <code>clientY</code>, and <code>button</code>
- attributes initialised to 0, its <code>ctrlKey</code>, <code>shiftKey</code>,
- <code>altKey</code>, and <code>metaKey</code> attributes initialised according
- to the current state of the key input device, if any (false for any keys that are not available),
- its <code>detail</code> attribute initialised to 1, its <code id=event-firing:dom-mouseevent-relatedtarget><a href=#dom-mouseevent-relatedtarget>relatedTarget</a></code> attribute initialised to null (except
- where otherwise stated), and its <code id=event-firing:dom-uievent-view><a href=#dom-uievent-view>view</a></code> attribute initialised to the <code id=event-firing:window><a href=#window>Window</a></code> object of the <code id=event-firing:document><a href=#document>Document</a></code> object of the given target node, if any, or else null. The <code>getModifierState()</code> method on the object must
- return values appropriately describing the state of the key input device at the time the event is
- created.</p>
- <p><dfn id=fire-a-click-event>Firing a <code>click</code> event</dfn>
- means <a href=#fire-a-synthetic-mouse-event id=event-firing:fire-a-synthetic-mouse-event>firing a synthetic mouse event named <code>click</code></a>, which bubbles and is cancelable.</p>
- <p>The default action of these events is to do nothing except where otherwise stated.</p>
-
-
- <h5 id=events-and-the-window-object>8.1.5.4 Events and the <code id=events-and-the-window-object:window><a href=#window>Window</a></code> object</h5>
- <p>When an event is dispatched at a DOM node in a <code id=events-and-the-window-object:document><a href=#document>Document</a></code> in a <a href=#browsing-context id=events-and-the-window-object:browsing-context>browsing
- context</a>, if the event is not a <code id=events-and-the-window-object:event-load><a href=#event-load>load</a></code> event, the user agent
- must act as if, for the purposes of <a href=#concept-event-dispatch id=events-and-the-window-object:concept-event-dispatch>event dispatching</a>,
- the <code id=events-and-the-window-object:window-2><a href=#window>Window</a></code> object is the parent of the <code id=events-and-the-window-object:document-2><a href=#document>Document</a></code> object. <a href=#refsDOM>[DOM]</a></p>
-
-
- <h3 id=atob>8.2 Base64 utility methods</h3>
- <p>The <code id=atob:dom-windowbase64-atob><a href=#dom-windowbase64-atob>atob()</a></code> and <code id=atob:dom-windowbase64-btoa><a href=#dom-windowbase64-btoa>btoa()</a></code> methods allow authors to transform content to and from
- the base64 encoding.</p>
-
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=windowbase64>WindowBase64</dfn> {
- DOMString <a href=#dom-windowbase64-btoa id=atob:dom-windowbase64-btoa-2>btoa</a>(DOMString btoa);
- DOMString <a href=#dom-windowbase64-atob id=atob:dom-windowbase64-atob-2>atob</a>(DOMString atob);
- };
- <a href=#window id=atob:window>Window</a> implements <a href=#windowbase64 id=atob:windowbase64>WindowBase64</a>;</pre>
- <p class=note>In these APIs, for mnemonic purposes, the "b" can be considered to stand for
- "binary", and the "a" for "ASCII". In practice, though, for primarily historical reasons, both the
- input and output of these functions are Unicode strings.</p>
- <dl class=domintro><dt><var>result</var> = <var>window</var> . <code id=atob:dom-windowbase64-btoa-3><a href=#dom-windowbase64-btoa>btoa</a></code>( <var>data</var> )<dd>
- <p>Takes the input data, in the form of a Unicode string containing only characters in the range
- U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF respectively, and
- converts it to its base64 representation, which it returns.</p>
- <p>Throws an <code id=atob:invalidcharactererror><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string contains any
- out-of-range characters.</p>
- <dt><var>result</var> = <var>window</var> . <code id=atob:dom-windowbase64-atob-3><a href=#dom-windowbase64-atob>atob</a></code>( <var>data</var> )<dd>
- <p>Takes the input data, in the form of a Unicode string containing base64-encoded binary data,
- decodes it, and returns a string consisting of characters in the range U+0000 to U+00FF, each
- representing a binary byte with values 0x00 to 0xFF respectively, corresponding to that binary
- data.</p>
- <p>Throws an <code id=atob:invalidcharactererror-2><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the input string is not valid
- base64 data.</p>
- </dl>
-
- <p class=note>The <code id=atob:windowbase64-2><a href=#windowbase64>WindowBase64</a></code> interface adds to the <code id=atob:window-2><a href=#window>Window</a></code> interface
- and the <code id=atob:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web workers).</p>
- <p>The <dfn id=dom-windowbase64-btoa><code>btoa()</code></dfn> method must throw an
- <code id=atob:invalidcharactererror-3><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception if the method's first argument contains any character
- whose code point is greater than U+00FF. Otherwise, the user agent must convert that argument to a
- sequence of octets whose <var>n</var>th octet is the eight-bit representation of the code
- point of the <var>n</var>th character of the argument, and then must apply the base64
- algorithm to that sequence of octets, and return the result. <a href=#refsRFC4648>[RFC4648]</a></p>
- <p>The <dfn id=dom-windowbase64-atob><code>atob()</code></dfn> method must run the following
- steps to parse the string passed in the method's first argument:</p>
- <ol><li><p>Let <var>input</var> be the string being parsed.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially
- pointing at the start of the string.<li><p>Remove all <a href=#space-character id=atob:space-character>space characters</a> from <var>input</var>.<li><p>If the length of <var>input</var> divides by 4 leaving no remainder, then: if
- <var>input</var> ends with one or two U+003D EQUALS SIGN (=) characters, remove them
- from <var>input</var>.<li><p>If the length of <var>input</var> divides by 4 leaving a remainder of 1, throw an
- <code id=atob:invalidcharactererror-4><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort these steps.</p>
- <li>
- <p>If <var>input</var> contains a character that is not in the following list of
- characters and character ranges, throw an <code id=atob:invalidcharactererror-5><a href=#invalidcharactererror>InvalidCharacterError</a></code> exception and abort
- these steps:</p>
- <ul class=brief><li>U+002B PLUS SIGN (+)
- <li>U+002F SOLIDUS (/)
- <li><a href=#alphanumeric-ascii-characters id=atob:alphanumeric-ascii-characters>Alphanumeric ASCII characters</a>
- </ul>
- <li><p>Let <var>output</var> be a string, initially empty.<li><p>Let <var>buffer</var> be a buffer that can have bits appended to it, initially
- empty.<li>
- <p>While <var>position</var> does not point past the end of <var>input</var>,
- run these substeps:</p>
- <ol><li>
- <p>Find the character pointed to by <var>position</var> in the first column of the
- following table. Let <var>n</var> be the number given in the second cell of the same
- row.</p>
- <div id=base64-table>
- <table><thead><tr><th>Character
- <th>Number
- <tbody><tr><td>A<td>0
- <tr><td>B<td>1
- <tr><td>C<td>2
- <tr><td>D<td>3
- <tr><td>E<td>4
- <tr><td>F<td>5
- <tr><td>G<td>6
- <tr><td>H<td>7
- <tr><td>I<td>8
- <tr><td>J<td>9
- <tr><td>K<td>10
- <tr><td>L<td>11
- <tr><td>M<td>12
- <tr><td>N<td>13
- <tr><td>O<td>14
- <tr><td>P<td>15
- <tr><td>Q<td>16
- <tr><td>R<td>17
- <tr><td>S<td>18
- <tr><td>T<td>19
- <tr><td>U<td>20
- <tr><td>V<td>21
- <tr><td>W<td>22
- <tr><td>X<td>23
- <tr><td>Y<td>24
- <tr><td>Z<td>25
- <tr><td>a<td>26
- <tr><td>b<td>27
- <tr><td>c<td>28
- <tr><td>d<td>29
- <tr><td>e<td>30
- <tr><td>f<td>31
- <tr><td>g<td>32
- <tr><td>h<td>33
- <tr><td>i<td>34
- <tr><td>j<td>35
- <tr><td>k<td>36
- <tr><td>l<td>37
- <tr><td>m<td>38
- <tr><td>n<td>39
- <tr><td>o<td>40
- <tr><td>p<td>41
- <tr><td>q<td>42
- <tr><td>r<td>43
- <tr><td>s<td>44
- <tr><td>t<td>45
- <tr><td>u<td>46
- <tr><td>v<td>47
- <tr><td>w<td>48
- <tr><td>x<td>49
- <tr><td>y<td>50
- <tr><td>z<td>51
- <tr><td>0<td>52
- <tr><td>1<td>53
- <tr><td>2<td>54
- <tr><td>3<td>55
- <tr><td>4<td>56
- <tr><td>5<td>57
- <tr><td>6<td>58
- <tr><td>7<td>59
- <tr><td>8<td>60
- <tr><td>9<td>61
- <tr><td>+<td>62
- <tr><td>/<td>63
- </table>
- </div>
- <li><p>Append to <var>buffer</var> the six bits corresponding to <var>number</var>, most significant bit first.<li><p>If <var>buffer</var> has accumulated 24 bits, interpret them as three 8-bit
- big-endian numbers. Append the three characters with code points equal to those numbers to <var>output</var>, in the same order, and then empty <var>buffer</var>.<li><p>Advance <var>position</var> by one character.</ol>
- <li>
- <p>If <var>buffer</var> is not empty, it contains either 12 or 18 bits. If it contains
- 12 bits, discard the last four and interpret the remaining eight as an 8-bit big-endian number.
- If it contains 18 bits, discard the last two and interpret the remaining 16 as two 8-bit
- big-endian numbers. Append the one or two characters with code points equal to those one or two
- numbers to <var>output</var>, in the same order.</p>
- <p class=note>The discarded bits mean that, for instance, <code>atob("YQ")</code> and
- <code>atob("YR")</code> both return "<code>a</code>".</p>
- <li><p>Return <var>output</var>.</ol>
-
-
- <h3 id=dynamic-markup-insertion>8.3 <dfn>Dynamic markup insertion</dfn></h3>
- <p class=note>APIs for dynamically inserting markup into the document interact with the parser,
- and thus their behavior varies depending on whether they are used with <a href=#html-documents id=dynamic-markup-insertion:html-documents>HTML documents</a>
- (and the <a href=#html-parser id=dynamic-markup-insertion:html-parser>HTML parser</a>) or XHTML in <a href=#xml-documents id=dynamic-markup-insertion:xml-documents>XML documents</a> (and the <a href=#xml-parser id=dynamic-markup-insertion:xml-parser>XML
- parser</a>).</p>
- <h4 id=opening-the-input-stream>8.3.1 Opening the input stream</h4>
- <p>The <dfn id=dom-document-open><code>open()</code></dfn> method comes in several variants
- with different numbers of arguments.</p>
- <dl class=domintro><dt><var>document</var> = <var>document</var> . <code id=opening-the-input-stream:dom-document-open><a href=#dom-document-open>open</a></code>( [ <var>type</var> [, <var>replace</var> ] ] )<dd>
- <p>Causes the <code id=opening-the-input-stream:document><a href=#document>Document</a></code> to be replaced in-place, as if it was a new
- <code id=opening-the-input-stream:document-2><a href=#document>Document</a></code> object, but reusing the previous object, which is then returned.</p>
- <p>If the <var>type</var> argument is omitted or has the value
- "<code id=opening-the-input-stream:text/html><a href=#text/html>text/html</a></code>", then the resulting <code id=opening-the-input-stream:document-3><a href=#document>Document</a></code> has an HTML parser associated
- with it, which can be given data to parse using <code id=opening-the-input-stream:dom-document-write><a href=#dom-document-write>document.write()</a></code>. Otherwise, all content passed to <code id=opening-the-input-stream:dom-document-write-2><a href=#dom-document-write>document.write()</a></code> will be parsed as plain text.</p>
- <p>If the <var>replace</var> argument is present and has the value "<code>replace</code>", the existing entries in the session history for the
- <code id=opening-the-input-stream:document-4><a href=#document>Document</a></code> object are removed.</p>
- <p>The method has no effect if the <code id=opening-the-input-stream:document-5><a href=#document>Document</a></code> is still being parsed.</p>
- <p>Throws an <code id=opening-the-input-stream:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the <code id=opening-the-input-stream:document-6><a href=#document>Document</a></code> is an <a href=#xml-documents id=opening-the-input-stream:xml-documents>XML document</a>.</p>
- <dt><var>window</var> = <var>document</var> . <code id=opening-the-input-stream:dom-document-open-2><a href=#dom-document-open>open</a></code>( <var>url</var>, <var>name</var>, <var>features</var> [, <var>replace</var> ] )<dd>
- <p>Works like the <code id=opening-the-input-stream:dom-open><a href=#dom-open>window.open()</a></code> method.</p>
- </dl>
-
- <p><code id=opening-the-input-stream:document-7><a href=#document>Document</a></code> objects have an <dfn id=ignore-opens-during-unload-counter>ignore-opens-during-unload counter</dfn>, which is
- used to prevent scripts from invoking the <code id=opening-the-input-stream:dom-document-open-3><a href=#dom-document-open>document.open()</a></code>
- method (directly or indirectly) while the document is <a href=#unload-a-document id=opening-the-input-stream:unload-a-document>being
- unloaded</a>. Initially, the counter must be set to zero.</p>
- <p>When called with two arguments, the <code id=opening-the-input-stream:dom-document-open-4><a href=#dom-document-open>document.open()</a></code>
- method must act as follows:</p>
- <ol><li><p>If the <code id=opening-the-input-stream:document-8><a href=#document>Document</a></code> object is not flagged as an <a href=#html-documents id=opening-the-input-stream:html-documents>HTML
- document</a>, throw an <code id=opening-the-input-stream:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If the <code id=opening-the-input-stream:document-9><a href=#document>Document</a></code> object is not an <a href=#active-document id=opening-the-input-stream:active-document>active document</a>, then abort
- these steps.<li><p>Let <var>type</var> be the value of the first argument.<li>
- <p>If the second argument is an <a href=#ascii-case-insensitive id=opening-the-input-stream:ascii-case-insensitive>ASCII case-insensitive</a> match for the value
- "replace", then let <var>replace</var> be true.</p>
- <p>Otherwise, if the <a href=#browsing-context id=opening-the-input-stream:browsing-context>browsing context</a>'s <a href=#session-history id=opening-the-input-stream:session-history>session history</a> contains only
- one <code id=opening-the-input-stream:document-10><a href=#document>Document</a></code>, and that was the <code id=opening-the-input-stream:about:blank><a href=#about:blank>about:blank</a></code> <code id=opening-the-input-stream:document-11><a href=#document>Document</a></code>
- created when the <a href=#browsing-context id=opening-the-input-stream:browsing-context-2>browsing context</a> was created, and that <code id=opening-the-input-stream:document-12><a href=#document>Document</a></code> has
- never had the <a href=#unload-a-document id=opening-the-input-stream:unload-a-document-2>unload a document</a> algorithm invoked on it (e.g. by a previous call to
- <code id=opening-the-input-stream:dom-document-open-5><a href=#dom-document-open>document.open()</a></code>), then let <var>replace</var> be
- true.</p>
- <p>Otherwise, let <var>replace</var> be false.</p>
- <li>
- <p>If the <code id=opening-the-input-stream:document-13><a href=#document>Document</a></code> has an <a href=#active-parser id=opening-the-input-stream:active-parser>active parser</a> whose <a href=#script-nesting-level id=opening-the-input-stream:script-nesting-level>script nesting
- level</a> is greater than zero, then the method does nothing. Abort these steps and return
- the <code id=opening-the-input-stream:document-14><a href=#document>Document</a></code> object on which the method was invoked.</p>
- <p class=note>This basically causes <code id=opening-the-input-stream:dom-document-open-6><a href=#dom-document-open>document.open()</a></code> to
- be ignored when it's called in an inline script found during parsing, while still letting it
- have an effect when called asynchronously.</p>
- <li>
- <p>Similarly, if the <code id=opening-the-input-stream:document-15><a href=#document>Document</a></code>'s <a href=#ignore-opens-during-unload-counter id=opening-the-input-stream:ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> is
- greater than zero, then the method does nothing. Abort these steps and return the
- <code id=opening-the-input-stream:document-16><a href=#document>Document</a></code> object on which the method was invoked.</p>
- <p class=note>This basically causes <code id=opening-the-input-stream:dom-document-open-7><a href=#dom-document-open>document.open()</a></code> to
- be ignored when it's called from a <code id=opening-the-input-stream:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code> <code id=opening-the-input-stream:event-pagehide><a href=#event-pagehide>pagehide</a></code>, or <code id=opening-the-input-stream:event-unload><a href=#event-unload>unload</a></code> event
- handler while the <code id=opening-the-input-stream:document-17><a href=#document>Document</a></code> is being unloaded.</p>
- <li><p>Release the <a href=#storage-mutex id=opening-the-input-stream:storage-mutex>storage mutex</a>.<li><p>Set the <code id=opening-the-input-stream:document-18><a href=#document>Document</a></code>'s <i id=opening-the-input-stream:concept-document-salvageable><a href=#concept-document-salvageable>salvageable</a></i> state to false.<li><p><a href=#prompt-to-unload-a-document id=opening-the-input-stream:prompt-to-unload-a-document>Prompt to unload</a> the
- <code id=opening-the-input-stream:document-19><a href=#document>Document</a></code> object. If the user <a href=#refused-to-allow-the-document-to-be-unloaded id=opening-the-input-stream:refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
- unloaded</a>, then abort these steps and return the <code id=opening-the-input-stream:document-20><a href=#document>Document</a></code> object on which the
- method was invoked.<li><p><a href=#unload-a-document id=opening-the-input-stream:unload-a-document-3>Unload</a> the <code id=opening-the-input-stream:document-21><a href=#document>Document</a></code> object, with the
- <var>recycle</var> parameter set to true.<li><p><a href=#abort-a-document id=opening-the-input-stream:abort-a-document>Abort</a> the <code id=opening-the-input-stream:document-22><a href=#document>Document</a></code>.<li><p>Unregister all event listeners registered on the <code id=opening-the-input-stream:document-23><a href=#document>Document</a></code> node and its
- descendants.</p>
- <li><p>Remove any <a href=#concept-task id=opening-the-input-stream:concept-task>tasks</a> associated with the
- <code id=opening-the-input-stream:document-24><a href=#document>Document</a></code> in any <a href=#task-source id=opening-the-input-stream:task-source>task source</a>.<li><p>Remove all child nodes of the document, without firing any mutation events.<li>
- <p>Replace the <code id=opening-the-input-stream:document-25><a href=#document>Document</a></code>'s singleton objects with new instances of those objects.
- (This includes in particular the <code id=opening-the-input-stream:window><a href=#window>Window</a></code>, <code id=opening-the-input-stream:location><a href=#location>Location</a></code>,
- <code id=opening-the-input-stream:history-3><a href=#history-3>History</a></code>, <code id=opening-the-input-stream:applicationcache><a href=#applicationcache>ApplicationCache</a></code>, and <code id=opening-the-input-stream:navigator><a href=#navigator>Navigator</a></code>, objects, the
- various <code id=opening-the-input-stream:barprop><a href=#barprop>BarProp</a></code> objects, the two <code id=opening-the-input-stream:storage-2><a href=#storage-2>Storage</a></code> objects, the various
- <code id=opening-the-input-stream:htmlcollection><a href=#htmlcollection>HTMLCollection</a></code> objects, and objects defined by other specifications, like
- <code id=opening-the-input-stream:selection><a href=#selection>Selection</a></code>. It also includes all the Web
- IDL prototypes in the JavaScript binding, including the <code id=opening-the-input-stream:document-26><a href=#document>Document</a></code> object's
- prototype.)</p>
- <p class=note>The new <code id=opening-the-input-stream:window-2><a href=#window>Window</a></code> object has a new <a href=#script-settings-object id=opening-the-input-stream:script-settings-object>script settings
- object</a>.</p>
- <li><p>Change the <a href="#document's-character-encoding" id="opening-the-input-stream:document's-character-encoding">document's character encoding</a> to UTF-8.<li><p>If the <code id=opening-the-input-stream:document-27><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks id=opening-the-input-stream:ready-for-post-load-tasks>ready for post-load tasks</a>, then set the
- <code id=opening-the-input-stream:document-28><a href=#document>Document</a></code> object's <a href=#reload-override-flag id=opening-the-input-stream:reload-override-flag>reload override flag</a> and set the
- <code id=opening-the-input-stream:document-29><a href=#document>Document</a></code>'s <a href=#reload-override-buffer id=opening-the-input-stream:reload-override-buffer>reload override buffer</a> to the empty string.<li><p>Set the <code id=opening-the-input-stream:document-30><a href=#document>Document</a></code>'s <i id=opening-the-input-stream:concept-document-salvageable-2><a href=#concept-document-salvageable>salvageable</a></i> state back to true.<li><p>Change <a id="opening-the-input-stream:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> to the <a href=http://dom.spec.whatwg.org/#concept-document-url id="opening-the-input-stream:the-document's-address-2" data-x-internal="the-document's-address">address</a> of the <a href=#responsible-document id=opening-the-input-stream:responsible-document>responsible document</a> specified by the <a href=#entry-settings-object id=opening-the-input-stream:entry-settings-object>entry
- settings object</a>.<li><p>If the <code id=opening-the-input-stream:document-31><a href=#document>Document</a></code>'s <a href=#iframe-load-in-progress id=opening-the-input-stream:iframe-load-in-progress>iframe load in progress</a> flag is set, set the
- <code id=opening-the-input-stream:document-32><a href=#document>Document</a></code>'s <a href=#mute-iframe-load id=opening-the-input-stream:mute-iframe-load>mute iframe load</a> flag.<li><p>Create a new <a href=#html-parser id=opening-the-input-stream:html-parser>HTML parser</a> and associate it with the document. This is a
- <dfn id=script-created-parser>script-created parser</dfn> (meaning that it can be closed by the <code id=opening-the-input-stream:dom-document-open-8><a href=#dom-document-open>document.open()</a></code> and <code id=opening-the-input-stream:dom-document-close><a href=#dom-document-close>document.close()</a></code> methods, and that the tokenizer will wait for
- an explicit call to <code id=opening-the-input-stream:dom-document-close-2><a href=#dom-document-close>document.close()</a></code> before emitting an
- end-of-file token). The encoding <a href=#concept-encoding-confidence id=opening-the-input-stream:concept-encoding-confidence>confidence</a> is
- <i>irrelevant</i>.<li><p>Set the <a href=#current-document-readiness id=opening-the-input-stream:current-document-readiness>current document readiness</a> of the document to "<code>loading</code>".<li>
-
- <p>If <var>type</var> is an <a href=#ascii-case-insensitive id=opening-the-input-stream:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string
- "<code>replace</code>", then, for historical reasons, set it to the string "<code>text/html</code>".</p>
- <p>Otherwise:</p>
- <p>If the <var>type</var> string contains a U+003B SEMICOLON character (;), remove the
- first such character and all characters from it up to the end of the string.</p>
- <p><a href=#strip-leading-and-trailing-whitespace id=opening-the-input-stream:strip-leading-and-trailing-whitespace>Strip leading and trailing whitespace</a> from <var>type</var>.</p>
- <li>
- <p>If <var>type</var> is <em>not</em> now an <a href=#ascii-case-insensitive id=opening-the-input-stream:ascii-case-insensitive-3>ASCII case-insensitive</a> match
- for the string "<code id=opening-the-input-stream:text/html-2><a href=#text/html>text/html</a></code>", then act as if the tokenizer had emitted a start tag
- token with the tag name "pre" followed by a single U+000A LINE FEED (LF) character, then switch the
- <a href=#html-parser id=opening-the-input-stream:html-parser-2>HTML parser</a>'s tokenizer to the <a href=#plaintext-state id=opening-the-input-stream:plaintext-state>PLAINTEXT state</a>.</p>
-
- <li>
- <p>Remove all the entries in the <a href=#browsing-context id=opening-the-input-stream:browsing-context-3>browsing context</a>'s <a href=#session-history id=opening-the-input-stream:session-history-2>session history</a>
- after the <a href=#current-entry id=opening-the-input-stream:current-entry>current entry</a>. If the <a href=#current-entry id=opening-the-input-stream:current-entry-2>current entry</a> is the last entry in the
- session history, then no entries are removed.</p>
- <p class=note>This <a href=#history-notes>doesn't necessarily have to affect</a> the user
- agent's user interface.</p>
- <li><p>Remove any <a href=#concept-task id=opening-the-input-stream:concept-task-2>tasks</a> queued by the <a href=#history-traversal-task-source id=opening-the-input-stream:history-traversal-task-source>history traversal
- task source</a> that are associated with any <code id=opening-the-input-stream:document-33><a href=#document>Document</a></code> objects in the
- <a href=#top-level-browsing-context id=opening-the-input-stream:top-level-browsing-context>top-level browsing context</a>'s <a href=#document-family id=opening-the-input-stream:document-family>document family</a>.<li>Remove any earlier entries that share the same <code id=opening-the-input-stream:document-34><a href=#document>Document</a></code>.<li><p>If <var>replace</var> is false, then add a new entry, just before the last entry,
- and associate with the new entry the text that was parsed by the previous parser associated with
- the <code id=opening-the-input-stream:document-35><a href=#document>Document</a></code> object, as well as the state of the document at the start of these
- steps. This allows the user to step backwards in the session history to see the page before it
- was blown away by the <code id=opening-the-input-stream:dom-document-open-9><a href=#dom-document-open>document.open()</a></code> call. This new entry
- does not have a <code id=opening-the-input-stream:document-36><a href=#document>Document</a></code> object, so a new one will be created if the session history
- is traversed to that entry.<li><p>Finally, set the <a href=#insertion-point id=opening-the-input-stream:insertion-point>insertion point</a> to point at just before the end of the
- <a href=#input-stream id=opening-the-input-stream:input-stream>input stream</a> (which at this point will be empty).<li><p>Return the <code id=opening-the-input-stream:document-37><a href=#document>Document</a></code> on which the method was invoked.</ol>
- <p class=note>The <code id=opening-the-input-stream:dom-document-open-10><a href=#dom-document-open>document.open()</a></code> method does not affect
- whether a <code id=opening-the-input-stream:document-38><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks id=opening-the-input-stream:ready-for-post-load-tasks-2>ready for post-load tasks</a> or <a href=#completely-loaded id=opening-the-input-stream:completely-loaded>completely
- loaded</a>.</p>
- <p>When called with four arguments, the <code id=opening-the-input-stream:dom-document-open-11><a href=#dom-document-open>open()</a></code> method on
- the <code id=opening-the-input-stream:document-39><a href=#document>Document</a></code> object must call the <code id=opening-the-input-stream:dom-open-2><a href=#dom-open>open()</a></code> method on the
- <code id=opening-the-input-stream:window-3><a href=#window>Window</a></code> object of the <code id=opening-the-input-stream:document-40><a href=#document>Document</a></code> object, with the same arguments as the
- original call to the <code id=opening-the-input-stream:dom-document-open-12><a href=#dom-document-open>open()</a></code> method, and return whatever
- that method returned. If the <code id=opening-the-input-stream:document-41><a href=#document>Document</a></code> object has no <code id=opening-the-input-stream:window-4><a href=#window>Window</a></code> object, then
- the method must throw an <code id=opening-the-input-stream:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception.</p>
-
- <h4 id=closing-the-input-stream>8.3.2 Closing the input stream</h4>
- <dl class=domintro><dt><var>document</var> . <code id=closing-the-input-stream:dom-document-close><a href=#dom-document-close>close</a></code>()<dd>
- <p>Closes the input stream that was opened by the <code id=closing-the-input-stream:dom-document-open><a href=#dom-document-open>document.open()</a></code> method.</p>
- <p>Throws an <code id=closing-the-input-stream:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the
- <code id=closing-the-input-stream:document><a href=#document>Document</a></code> is an <a href=#xml-documents id=closing-the-input-stream:xml-documents>XML
- document</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-document-close><code>close()</code></dfn> method must run the following
- steps:</p>
- <ol><li><p>If the <code id=closing-the-input-stream:document-2><a href=#document>Document</a></code> object is not flagged as an <a href=#html-documents id=closing-the-input-stream:html-documents>HTML
- document</a>, throw an <code id=closing-the-input-stream:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
- steps.<li><p>If there is no <a href=#script-created-parser id=closing-the-input-stream:script-created-parser>script-created parser</a> associated with the document, then abort
- these steps.<li><p>Insert an <a href=#explicit-eof-character id=closing-the-input-stream:explicit-eof-character>explicit "EOF" character</a> at the end of the parser's <a href=#input-stream id=closing-the-input-stream:input-stream>input
- stream</a>.<li><p>If there is a <a href=#pending-parsing-blocking-script id=closing-the-input-stream:pending-parsing-blocking-script>pending parsing-blocking script</a>, then abort these
- steps.<li><p>Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the
- tokenizer reaches the <a href=#explicit-eof-character id=closing-the-input-stream:explicit-eof-character-2>explicit "EOF" character</a> or <a href=#spin-the-event-loop id=closing-the-input-stream:spin-the-event-loop>spins the event loop</a>.</ol>
-
- <h4 id=document.write()>8.3.3 <code id=document.write():dom-document-write><a href=#dom-document-write>document.write()</a></code></h4>
- <dl class=domintro><dt><var>document</var> . <code id=document.write():dom-document-write-2><a href=#dom-document-write>write</a></code>(<var>text</var>...)<dd>
- <p>In general, adds the given string(s) to the <code id=document.write():document><a href=#document>Document</a></code>'s input stream.</p>
- <p class=warning>This method has very idiosyncratic behavior. In some cases, this method can
- affect the state of the <a href=#html-parser id=document.write():html-parser>HTML parser</a> while the parser is running, resulting in a DOM
- that does not correspond to the source of the document (e.g. if the string written is the string
- "<code><plaintext></code>" or "<code><!--</code>"). In other cases,
- the call can clear the current page first, as if <code id=document.write():dom-document-open><a href=#dom-document-open>document.open()</a></code> had been called. In yet more cases, the method
- is simply ignored, or throws an exception. To make matters worse, the exact behavior of this
- method can in some cases be dependent on network latency, which can lead to failures that are very hard to debug. <strong>For all these reasons, use
- of this method is strongly discouraged.</strong></p>
- <p>This method throws an <code id=document.write():invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception when invoked on <a href=#xml-documents id=document.write():xml-documents>XML
- documents</a>.</p>
- </dl>
-
- <p><code id=document.write():document-2><a href=#document>Document</a></code> objects have an <dfn id=ignore-destructive-writes-counter>ignore-destructive-writes counter</dfn>, which is
- used in conjunction with the processing of <code id=document.write():the-script-element><a href=#the-script-element>script</a></code> elements to prevent external
- scripts from being able to use <code id=document.write():dom-document-write-3><a href=#dom-document-write>document.write()</a></code> to blow
- away the document by implicitly calling <code id=document.write():dom-document-open-2><a href=#dom-document-open>document.open()</a></code>.
- Initially, the counter must be set to zero.</p>
- <p>The <dfn id=dom-document-write><code>document.write(...)</code></dfn> method must act as
- follows:</p>
- <ol><li>
- <p>If the method was invoked on an <a href=#xml-documents id=document.write():xml-documents-2>XML document</a>, throw an
- <code id=document.write():invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.</p>
-
- <li><p>If the <code id=document.write():document-3><a href=#document>Document</a></code> object is not an <a href=#active-document id=document.write():active-document>active document</a>, then abort
- these steps.<li>
- <p>If the <a href=#insertion-point id=document.write():insertion-point>insertion point</a> is undefined and either the <code id=document.write():document-4><a href=#document>Document</a></code>'s
- <a href=#ignore-opens-during-unload-counter id=document.write():ignore-opens-during-unload-counter>ignore-opens-during-unload counter</a> is greater than zero or the
- <code id=document.write():document-5><a href=#document>Document</a></code>'s <a href=#ignore-destructive-writes-counter id=document.write():ignore-destructive-writes-counter>ignore-destructive-writes counter</a> is greater than zero,
- abort these steps.</p>
- <li>
- <p>If the <a href=#insertion-point id=document.write():insertion-point-2>insertion point</a> is undefined, call the <code id=document.write():dom-document-open-3><a href=#dom-document-open>open()</a></code> method on the <code id=document.write():document-6><a href=#document>document</a></code>
- object (with no arguments). If the user <a href=#refused-to-allow-the-document-to-be-unloaded id=document.write():refused-to-allow-the-document-to-be-unloaded>refused to allow the document to be
- unloaded</a>, then abort these steps. Otherwise, the <a href=#insertion-point id=document.write():insertion-point-3>insertion point</a> will point
- at just before the end of the (empty) <a href=#input-stream id=document.write():input-stream>input stream</a>.</p>
- <li>
- <p>Insert the string consisting of the concatenation of all the arguments to the method into the
- <a href=#input-stream id=document.write():input-stream-2>input stream</a> just before the <a href=#insertion-point id=document.write():insertion-point-4>insertion point</a>.</p>
- <li>
- <p>If the <code id=document.write():document-7><a href=#document>Document</a></code> object's <a href=#reload-override-flag id=document.write():reload-override-flag>reload override flag</a> is set, then append
- the string consisting of the concatenation of all the arguments to the method to the
- <code id=document.write():document-8><a href=#document>Document</a></code>'s <a href=#reload-override-buffer id=document.write():reload-override-buffer>reload override buffer</a>.</p>
- <li>
- <p>If there is no <a href=#pending-parsing-blocking-script id=document.write():pending-parsing-blocking-script>pending parsing-blocking script</a>, have the <a href=#html-parser id=document.write():html-parser-2>HTML
- parser</a> process the characters that were inserted, one at a time, processing resulting
- tokens as they are emitted, and stopping when the tokenizer reaches the insertion point or when
- the processing of the tokenizer is aborted by the tree construction stage (this can happen if a
- <code id=document.write():the-script-element-2><a href=#the-script-element>script</a></code> end tag token is emitted by the tokenizer).
- <p class=note>If the <code id=document.write():dom-document-write-4><a href=#dom-document-write>document.write()</a></code> method was
- called from script executing inline (i.e. executing because the parser parsed a set of
- <code id=document.write():the-script-element-3><a href=#the-script-element>script</a></code> tags), then this is a <a href=#nestedParsing>reentrant invocation of the
- parser</a>.</p>
- <li>
- <p>Finally, return from the method.</p>
- </ol>
-
- <h4 id=document.writeln()>8.3.4 <code id=document.writeln():dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code></h4>
- <dl class=domintro><dt><var>document</var> . <code id=document.writeln():dom-document-writeln-2><a href=#dom-document-writeln>writeln</a></code>(<var>text</var>...)<dd>
- <p>Adds the given string(s) to the <code id=document.writeln():document><a href=#document>Document</a></code>'s input stream, followed by a newline
- character. If necessary, calls the <code id=document.writeln():dom-document-open><a href=#dom-document-open>open()</a></code> method
- implicitly first.</p>
- <p>This method throws an <code id=document.writeln():invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception when invoked on <a href=#xml-documents id=document.writeln():xml-documents>XML
- documents</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-document-writeln><code>document.writeln(...)</code></dfn> method, when
- invoked, must act as if the <code id=document.writeln():dom-document-write><a href=#dom-document-write>document.write()</a></code> method had
- been invoked with the same argument(s), plus an extra argument consisting of a string containing a
- single line feed character (U+000A).</p>
-
- <h3 id=timers>8.4 Timers</h3>
- <p>The <code id=timers:dom-windowtimers-settimeout><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
- and <code id=timers:dom-windowtimers-setinterval><a href=#dom-windowtimers-setinterval>setInterval()</a></code>
- methods allow authors to schedule timer-based callbacks.</p>
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=windowtimers>WindowTimers</dfn> {
- long <a href=#dom-windowtimers-settimeout id=timers:dom-windowtimers-settimeout-2>setTimeout</a>(<a href=#idl-function id=timers:idl-function>Function</a> handler, optional long timeout = 0, any... arguments);
- long <a href=#dom-windowtimers-settimeout id=timers:dom-windowtimers-settimeout-3>setTimeout</a>(DOMString handler, optional long timeout = 0, any... arguments);
- void <a href=#dom-windowtimers-cleartimeout id=timers:dom-windowtimers-cleartimeout>clearTimeout</a>(optional long handle = 0);
- long <a href=#dom-windowtimers-setinterval id=timers:dom-windowtimers-setinterval-2>setInterval</a>(<a href=#idl-function id=timers:idl-function-2>Function</a> handler, optional long timeout = 0, any... arguments);
- long <a href=#dom-windowtimers-setinterval id=timers:dom-windowtimers-setinterval-3>setInterval</a>(DOMString handler, optional long timeout = 0, any... arguments);
- void <a href=#dom-windowtimers-clearinterval id=timers:dom-windowtimers-clearinterval>clearInterval</a>(optional long handle = 0);
- };
- <a href=#window id=timers:window>Window</a> implements <a href=#windowtimers id=timers:windowtimers>WindowTimers</a>;</pre>
-
- <dl class=domintro><dt><var>handle</var> = <var>window</var> . <code id=timers:dom-windowtimers-settimeout-4><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var>handler</var> [, <var>timeout</var> [, <var>arguments</var>... ] ] )<dd>
- <p>Schedules a timeout to run <var>handler</var> after <var>timeout</var>
- milliseconds. Any <var>arguments</var> are passed straight through to the <var>handler</var>.</p>
- <dt><var>handle</var> = <var>window</var> . <code id=timers:dom-windowtimers-settimeout-5><a href=#dom-windowtimers-settimeout>setTimeout</a></code>( <var>code</var> [, <var>timeout</var> ] )<dd>
- <p>Schedules a timeout to compile and run <var>code</var> after <var>timeout</var> milliseconds.</p>
- <dt><var>window</var> . <code id=timers:dom-windowtimers-cleartimeout-2><a href=#dom-windowtimers-cleartimeout>clearTimeout</a></code>( <var>handle</var> )<dd>
- <p>Cancels the timeout set with <code id=timers:dom-windowtimers-settimeout-6><a href=#dom-windowtimers-settimeout>setTimeout()</a></code>
- identified by <var>handle</var>.</p>
- <dt><var>handle</var> = <var>window</var> . <code id=timers:dom-windowtimers-setinterval-4><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var>handler</var> [, <var>timeout</var> [, <var>arguments</var>... ] ] )<dd>
- <p>Schedules a timeout to run <var>handler</var> every <var>timeout</var>
- milliseconds. Any <var>arguments</var> are passed straight through to the <var>handler</var>.</p>
- <dt><var>handle</var> = <var>window</var> . <code id=timers:dom-windowtimers-setinterval-5><a href=#dom-windowtimers-setinterval>setInterval</a></code>( <var>code</var> [, <var>timeout</var> ] )<dd>
- <p>Schedules a timeout to compile and run <var>code</var> every <var>timeout</var> milliseconds.</p>
- <dt><var>window</var> . <code id=timers:dom-windowtimers-clearinterval-2><a href=#dom-windowtimers-clearinterval>clearInterval</a></code>( <var>handle</var> )<dd>
- <p>Cancels the timeout set with <code id=timers:dom-windowtimers-setinterval-6><a href=#dom-windowtimers-setinterval>setInterval()</a></code> identified by <var>handle</var>.</p>
- </dl>
- <p class=note>Timers can be nested; after five such nested timers, however, the interval is
- forced to be at least four milliseconds.</p>
- <p class=note>This API does not guarantee that timers will run exactly on schedule. Delays due
- to CPU load, other tasks, etc, are to be expected.</p>
-
- <p class=note>The <code id=timers:windowtimers-2><a href=#windowtimers>WindowTimers</a></code> interface adds to the <code id=timers:window-2><a href=#window>Window</a></code> interface
- and the <code id=timers:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface (part of Web workers).</p>
- <p>Each object that implements the <code id=timers:windowtimers-3><a href=#windowtimers>WindowTimers</a></code> interface has a <dfn id=list-of-active-timers>list of active
- timers</dfn>. Each entry in this lists is identified by a number, which must be unique within the
- list for the lifetime of the object that implements the <code id=timers:windowtimers-4><a href=#windowtimers>WindowTimers</a></code> interface.</p>
- <hr>
- <p>The <dfn id=dom-windowtimers-settimeout><code>setTimeout()</code></dfn> method must return
- the value returned by the <a href=#timer-initialization-steps id=timers:timer-initialization-steps>timer initialization steps</a>, passing them the method's
- arguments, the object on which the method for which the algorithm is running is implemented (a
- <code id=timers:window-3><a href=#window>Window</a></code> or <code id=timers:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object) as the <var>method
- context</var>, and the <var>repeat</var> flag set to false.</p>
- <p>The <dfn id=dom-windowtimers-setinterval><code>setInterval()</code></dfn> method must
- return the value returned by the <a href=#timer-initialization-steps id=timers:timer-initialization-steps-2>timer initialization steps</a>, passing them the
- method's arguments, the object on which the method for which the algorithm is running is
- implemented (a <code id=timers:window-4><a href=#window>Window</a></code> or <code id=timers:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object) as the <var>method context</var>, and the <var>repeat</var> flag set to true.</p>
- <p>The <dfn id=dom-windowtimers-cleartimeout><code>clearTimeout()</code></dfn> and <dfn id=dom-windowtimers-clearinterval><code>clearInterval()</code></dfn> methods must clear the
- entry identified as <var>handle</var> from the <a href=#list-of-active-timers id=timers:list-of-active-timers>list of active timers</a> of the
- <code id=timers:windowtimers-5><a href=#windowtimers>WindowTimers</a></code> object on which the method was invoked, if any, where <var>handle</var> is the argument passed to the method. (If <var>handle</var> does
- not identify an entry in the <a href=#list-of-active-timers id=timers:list-of-active-timers-2>list of active timers</a> of the <code id=timers:windowtimers-6><a href=#windowtimers>WindowTimers</a></code>
- object on which the method was invoked, the method does nothing.)</p>
- <hr>
- <p>The <dfn id=timer-initialization-steps>timer initialization steps</dfn>, which are invoked with some method arguments, a <var>method context</var>, a <var>repeat</var> flag which can be true or false, and
- optionally (and only if the <var>repeat</var> flag is true) a <var>previous
- handle</var>, are as follows:</p>
- <ol><li><p>Let <var>method context proxy</var> be <var>method context</var> if that
- is a <code id=timers:workerglobalscope-4><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, or else the <code id=timers:windowproxy><a href=#windowproxy>WindowProxy</a></code> that corresponds
- to <var>method context</var>.<li><p>If <var>previous handle</var> was provided, let <var>handle</var> be
- <var>previous handle</var>; otherwise, let <var>handle</var> be a
- user-agent-defined integer that is greater than zero that will identify the timeout to be set by
- this call in the <a href=#list-of-active-timers id=timers:list-of-active-timers-3>list of active timers</a>.<li><p>If <var>previous handle</var> was not provided, add an entry to the <a href=#list-of-active-timers id=timers:list-of-active-timers-4>list of
- active timers</a> for <var>handle</var>.<li>
- <p>Let <var>task</var> be a <a href=#concept-task id=timers:concept-task>task</a> that runs the
- following substeps:</p>
- <ol><li><p>If the entry for <var>handle</var> in the <a href=#list-of-active-timers id=timers:list-of-active-timers-5>list of active timers</a>
- has been cleared, then abort this <a href=#concept-task id=timers:concept-task-2>task</a>'s substeps.<li>
- <p>Run the appropriate set of steps from the following list:</p>
- <dl class=switch><dt>If the first method argument is a <code id=timers:idl-function-3><a href=#idl-function>Function</a></code><dd>
- <p>Call the <code id=timers:idl-function-4><a href=#idl-function>Function</a></code>. Use the third and subsequent method
- arguments (if any) as the arguments for invoking the <code id=timers:idl-function-5><a href=#idl-function>Function</a></code>. Use <var>method context proxy</var> as the
- <var>thisArg</var> for invoking the <code id=timers:idl-function-6><a href=#idl-function>Function</a></code>. <a href=#refsECMA262>[ECMA262]</a></p>
- <dt>Otherwise<dd>
- <ol><li><p>Let <var>script source</var> be the first method argument.<li><p>Let <var>script language</var> be JavaScript.<li><p>Let <var>settings object</var> be <var>method context</var>'s <a href=#script-settings-object id=timers:script-settings-object>script settings
- object</a>.<li><p><a href=#create-a-script id=timers:create-a-script>Create a script</a> using <var>script source</var> as the script source,
- the <a href=#url id=timers:url>URL</a> where <var>script source</var> can be found, <var>scripting
- language</var> as the scripting language, and <var>settings object</var> as the
- <a href=#script-settings-object id=timers:script-settings-object-2>script settings object</a>.</ol>
- </dl>
- <li><p>If the <var>repeat</var> flag is true, then call <a href=#timer-initialization-steps id=timers:timer-initialization-steps-3>timer initialization
- steps</a> again, passing them the same method arguments, the same <var>method
- context</var>, with the <var>repeat</var> flag still set to true, and with the <var>previous handle</var> set to <var>handler</var>.</ol>
- <li><p>Let <var>timeout</var> be the second method argument.<li><p>If the currently running <a href=#concept-task id=timers:concept-task-3>task</a> is a task that was created
- by this algorithm, then let <var>nesting level</var> be the <a href=#concept-task id=timers:concept-task-4>task</a>'s <a href=#timer-nesting-level id=timers:timer-nesting-level>timer nesting level</a>. Otherwise, let <var>nesting level</var> be zero.<li><p>If <var>nesting level</var> is greater than 5, and <var>timeout</var> is
- less than 4, then increase <var>timeout</var> to 4.<li><p>Increment <var>nesting level</var> by one.<li><p>Let <var>task</var>'s <dfn id=timer-nesting-level>timer nesting level</dfn> be <var>nesting
- level</var>.<li><p>Return <var>handle</var>, and then continue running this algorithm
- asynchronously.<li>
- <p>If <var>method context</var> is a <code id=timers:window-5><a href=#window>Window</a></code> object, wait until the
- <code id=timers:document><a href=#document>Document</a></code> associated with <var>method context</var> has been <a href=#fully-active id=timers:fully-active>fully
- active</a> for a further <var>timeout</var> milliseconds (not necessarily
- consecutively).</p>
- <p>Otherwise, <var>method context</var> is a <code id=timers:workerglobalscope-5><a href=#workerglobalscope>WorkerGlobalScope</a></code> object;
- wait until <var>timeout</var> milliseconds have passed with the worker not suspended
- (not necessarily consecutively).</p>
- <li>
- <p>Wait until any invocations of this algorithm that had the same <var>method
- context</var>, that started before this one, and whose <var>timeout</var> is equal to
- or less than this one's, have completed.</p>
- <p class=note>Argument conversion as defined by Web IDL (for example, invoking <code>toString()</code> methods on objects passed as the first argument) happens in the
- algorithms defined in Web IDL, before this algorithm is invoked.</p>
- <div class=example>
- <p>So for example, the following rather silly code will result in the log containing "<code>ONE TWO </code>":</p>
- <pre>var log = '';
- function logger(s) { log += s + ' '; }
- setTimeout({ toString: function () {
- setTimeout("logger('ONE')", 100);
- return "logger('TWO')";
- } }, 100);</pre>
- </div>
- <li>
- <p>Optionally, wait a further user-agent defined length of time.</p>
- <p class=note>This is intended to allow user agents to pad timeouts as needed to optimise the
- power usage of the device. For example, some processors have a low-power mode where the
- granularity of timers is reduced; on such platforms, user agents can slow timers down to fit
- this schedule instead of requiring the processor to use the more accurate mode with its
- associated higher power usage.</p>
- <li>
- <p><a href=#queue-a-task id=timers:queue-a-task>Queue</a> the <a href=#concept-task id=timers:concept-task-5>task</a> <var>task</var>.</p>
- <p class=note>Once the task has been processed, if the <var>repeat</var> flag is
- false, it is safe to remove the entry for <var>handle</var> from the <a href=#list-of-active-timers id=timers:list-of-active-timers-6>list of
- active timers</a> (there is no way for the entry's existence to be detected past this point,
- so it does not technically matter one way or the other).</p>
- </ol>
- <p>The <a href=#task-source id=timers:task-source>task source</a> for these <a href=#concept-task id=timers:concept-task-6>tasks</a> is the
- <dfn id=timer-task-source>timer task source</dfn>.</p>
-
- <div class=example>
- <p>To run tasks of several milliseconds back to back without any delay, while still yielding back
- to the browser to avoid starving the user interface (and to avoid the browser killing the script
- for hogging the CPU), simply queue the next timer before performing work:</p>
- <pre>function doExpensiveWork() {
- var done = false;
- // ...
- // this part of the function takes up to five milliseconds
- // set done to true if we're done
- // ...
- return done;
- }
- function rescheduleWork() {
- var handle = setTimeout(rescheduleWork, 0); // preschedule next iteration
- if (doExpensiveWork())
- clearTimeout(handle); // clear the timeout if we don't need it
- }
- function scheduleWork() {
- setTimeout(rescheduleWork, 0);
- }
- scheduleWork(); // queues a task to do lots of work</pre>
- </div>
- <h3 id=user-prompts>8.5 User prompts</h3>
-
- <h4 id=simple-dialogs>8.5.1 Simple dialogs</h4>
- <dl class=domintro><dt><var>window</var> . <code id=simple-dialogs:dom-alert><a href=#dom-alert>alert</a></code>(<var>message</var>)<dd>
- <p>Displays a modal alert with the given message, and waits for the user to dismiss it.</p>
- <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
- implied when this method is invoked.</p>
- <dt><var>result</var> = <var>window</var> . <code id=simple-dialogs:dom-confirm><a href=#dom-confirm>confirm</a></code>(<var>message</var>)<dd>
- <p>Displays a modal OK/Cancel prompt with the given message, waits for the user to dismiss it,
- and returns true if the user clicks OK and false if the user clicks Cancel.</p>
- <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates-2><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
- implied when this method is invoked.</p>
- <dt><var>result</var> = <var>window</var> . <code id=simple-dialogs:dom-prompt><a href=#dom-prompt>prompt</a></code>(<var>message</var> [, <var>default</var>] )<dd>
- <p>Displays a modal text field prompt with the given message, waits for the user to dismiss it,
- and returns the value that the user entered. If the user cancels the prompt, then returns null
- instead. If the second argument is present, then the given value is used as a default.</p>
- <p>A call to the <code id=simple-dialogs:dom-navigator-yieldforstorageupdates-3><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
- implied when this method is invoked.</p>
- </dl>
- <p class=note>Logic that depends on <a href=#concept-task id=simple-dialogs:concept-task>tasks</a> or <a href=#microtask id=simple-dialogs:microtask>microtasks</a>, such as <a href=#media-element id=simple-dialogs:media-element>media elements</a>
- loading their <a href=#media-data id=simple-dialogs:media-data>media data</a>, are stalled when these methods are invoked.</p>
-
- <p>The <dfn id=dom-alert><code>alert(<var>message</var>)</code></dfn> method, when
- invoked, must run the following steps:</p>
- <ol><li><p>If the <a href=#event-loop id=simple-dialogs:event-loop>event loop</a>'s <a href=#termination-nesting-level id=simple-dialogs:termination-nesting-level>termination nesting level</a> is non-zero,
- optionally abort these steps.<li><p>Release the <a href=#storage-mutex id=simple-dialogs:storage-mutex>storage mutex</a>.<li><p>Optionally, abort these steps. (For example, the user agent might give the user the option
- to ignore all alerts, and would thus abort at this step whenever the method was
- invoked.)<li><p>If the method was invoked with no arguments, then let <var>message</var> be the
- empty string; otherwise, let <var>message</var> be the method's first
- argument.<li><p>Show the given <var>message</var> to the user.<li><p>Optionally, <a href=#pause id=simple-dialogs:pause>pause</a> while waiting for the user to acknowledge the
- message.</ol>
- <p>The <dfn id=dom-confirm><code>confirm(<var>message</var>)</code></dfn> method,
- when invoked, must run the following steps:</p>
- <ol><li><p>If the <a href=#event-loop id=simple-dialogs:event-loop-2>event loop</a>'s <a href=#termination-nesting-level id=simple-dialogs:termination-nesting-level-2>termination nesting level</a> is non-zero,
- optionally abort these steps, returning false.<li><p>Release the <a href=#storage-mutex id=simple-dialogs:storage-mutex-2>storage mutex</a>.<li><p>Optionally, return false and abort these steps. (For example, the user agent might give
- the user the option to ignore all prompts, and would thus abort at this step whenever the method
- was invoked.)<li><p>Show the given <var>message</var> to the user, and ask the user to respond with a
- positive or negative response.<li><p><a href=#pause id=simple-dialogs:pause-2>Pause</a> until the user responds either positively or negatively.<li><p>If the user responded positively, return true; otherwise, the user responded negatively:
- return false.</ol>
- <p>The <dfn id=dom-prompt><code>prompt(<var>message</var>, <var>default</var>)</code></dfn> method, when invoked, must run the following steps:</p>
- <ol><li><p>If the <a href=#event-loop id=simple-dialogs:event-loop-3>event loop</a>'s <a href=#termination-nesting-level id=simple-dialogs:termination-nesting-level-3>termination nesting level</a> is non-zero,
- optionally abort these steps, returning null.<li><p>Release the <a href=#storage-mutex id=simple-dialogs:storage-mutex-3>storage mutex</a>.<li><p>Optionally, return null and abort these steps. (For example, the user agent might give the
- user the option to ignore all prompts, and would thus abort at this step whenever the method was
- invoked.)<li><p>Show the given <var>message</var> to the user, and ask the user to either respond
- with a string value or abort. The response must be defaulted to the value given by
- <var>default</var>.<li><p><a href=#pause id=simple-dialogs:pause-3>Pause</a> while waiting for the user's response.<li><p>If the user aborts, then return null; otherwise, return the string that the user responded
- with.</ol>
-
- <h4 id=printing>8.5.2 Printing</h4>
- <dl class=domintro><dt><var>window</var> . <code id=printing:dom-print><a href=#dom-print>print</a></code>()<dd>
- <p>Prompts the user to print the page.</p>
- <p>A call to the <code id=printing:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method is
- implied when this method is invoked.</p>
- </dl>
-
- <p>When the <dfn id=dom-print><code>print()</code></dfn> method is invoked, if the
- <code id=printing:document><a href=#document>Document</a></code> is <a href=#ready-for-post-load-tasks id=printing:ready-for-post-load-tasks>ready for post-load tasks</a>, then the user agent must
- synchronously run the <a href=#printing-steps id=printing:printing-steps>printing steps</a>. Otherwise, the user agent must only set the
- <dfn id=print-when-loaded>print when loaded</dfn> flag on the <code id=printing:document-2><a href=#document>Document</a></code>.</p>
- <p>User agents should also run the <a href=#printing-steps id=printing:printing-steps-2>printing steps</a> whenever the user asks for the
- opportunity to <a href=#obtain-a-physical-form id=printing:obtain-a-physical-form>obtain a physical form</a> (e.g. printed copy), or the representation of a
- physical form (e.g. PDF copy), of a document.</p>
- <p>The <dfn id=printing-steps>printing steps</dfn> are as follows:</p>
- <ol><li>
- <p>The user agent may display a message to the user or abort these steps (or both).</p>
- <p class=example>For instance, a kiosk browser could silently ignore any invocations of the
- <code id=printing:dom-print-2><a href=#dom-print>print()</a></code> method.</p>
- <p class=example>For instance, a browser on a mobile device could detect that there are no
- printers in the vicinity and display a message saying so before continuing to offer a "save to
- PDF" option.</p>
- <li>
- <p>The user agent must <a href=#fire-a-simple-event id=printing:fire-a-simple-event>fire a simple event</a> named <code id=printing:event-beforeprint><a href=#event-beforeprint>beforeprint</a></code> at the <code id=printing:window><a href=#window>Window</a></code> object of the
- <code id=printing:document-3><a href=#document>Document</a></code> that is being printed, as well as any <a href=#nested-browsing-context id=printing:nested-browsing-context>nested browsing contexts</a> in it.</p>
- <p class=example>The <code id=printing:event-beforeprint-2><a href=#event-beforeprint>beforeprint</a></code> event can be used to
- annotate the printed copy, for instance adding the time at which the document was printed.</p>
- <li>
- <p>The user agent must release the <a href=#storage-mutex id=printing:storage-mutex>storage mutex</a>.</p>
- <li>
- <p>The user agent should offer the user the opportunity to <a href=#obtain-a-physical-form id=printing:obtain-a-physical-form-2>obtain a physical form</a>
- (or the representation of a physical form) of the document. The user agent may wait for the user
- to either accept or decline before returning; if so, the user agent must <a href=#pause id=printing:pause>pause</a>
- while the method is waiting. Even if the user agent doesn't wait at this point, the user agent
- must use the state of the relevant documents as they are at this point in the algorithm if and
- when it eventually creates the alternate form.</p>
- <li>
- <p>The user agent must <a href=#fire-a-simple-event id=printing:fire-a-simple-event-2>fire a simple event</a> named <code id=printing:event-afterprint><a href=#event-afterprint>afterprint</a></code> at the <code id=printing:window-2><a href=#window>Window</a></code> object of the
- <code id=printing:document-4><a href=#document>Document</a></code> that is being printed, as well as any <a href=#nested-browsing-context id=printing:nested-browsing-context-2>nested browsing contexts</a> in it.</p>
- <p class=example>The <code id=printing:event-afterprint-2><a href=#event-afterprint>afterprint</a></code> event can be used to
- revert annotations added in the earlier event, as well as showing post-printing UI. For
- instance, if a page is walking the user through the steps of applying for a home loan, the
- script could automatically advance to the next step after having printed a form or other.</p>
- </ol>
-
- <h4 id=dialogs-implemented-using-separate-documents>8.5.3 Dialogs implemented using separate documents</h4>
- <dl class=domintro><dt><var>result</var> = <var>window</var> . <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog><a href=#dom-showmodaldialog>showModalDialog</a></code>(<var>url</var> [, <var>argument</var>] )<dd>
- <p>Prompts the user with the given page, waits for that page to close, and returns the return
- value.</p>
- <p>A call to the <code id=dialogs-implemented-using-separate-documents:dom-navigator-yieldforstorageupdates><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method
- is implied when this method is invoked.</p>
- </dl>
-
- <p>The <dfn id=dom-showmodaldialog><code>showModalDialog(<var>url</var>, <var>argument</var>)</code></dfn> method, when invoked,
- must cause the user agent to run the following steps:</p>
- <ol><li>
- <p><a href=#resolve-a-url id=dialogs-implemented-using-separate-documents:resolve-a-url>Resolve</a> <var>url</var> relative to the
- <a href=#api-base-url id=dialogs-implemented-using-separate-documents:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=dialogs-implemented-using-separate-documents:entry-settings-object>entry settings object</a>.</p>
- <p>If this fails, then throw a <code id=dialogs-implemented-using-separate-documents:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
- <li><p>If the <a href=#event-loop id=dialogs-implemented-using-separate-documents:event-loop>event loop</a>'s <a href=#termination-nesting-level id=dialogs-implemented-using-separate-documents:termination-nesting-level>termination nesting level</a> is non-zero,
- optionally abort these steps, returning the empty string.<li>
- <p>Release the <a href=#storage-mutex id=dialogs-implemented-using-separate-documents:storage-mutex>storage mutex</a>.</p>
- <li>
- <p>If the user agent is configured such that this invocation of <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-2><a href=#dom-showmodaldialog>showModalDialog()</a></code> is somehow disabled, then return the empty
- string and abort these steps.</p>
- <p class=note>User agents are expected to disable this method in certain cases to avoid user
- annoyance (e.g. as part of their popup blocker feature). For instance, a user agent could
- require that a site be white-listed before enabling this method, or the user agent could be
- configured to only allow one modal dialog at a time.</p>
- <li>
- <p>If the <a href=#active-sandboxing-flag-set id=dialogs-implemented-using-separate-documents:active-sandboxing-flag-set>active sandboxing flag set</a> of the <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document>active document</a> of the
- <a href=#responsible-browsing-context id=dialogs-implemented-using-separate-documents:responsible-browsing-context>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=dialogs-implemented-using-separate-documents:incumbent-settings-object>incumbent settings
- object</a> has its <a href=#sandboxed-auxiliary-navigation-browsing-context-flag id=dialogs-implemented-using-separate-documents:sandboxed-auxiliary-navigation-browsing-context-flag>sandboxed auxiliary navigation browsing context flag</a> set,
- then return the empty string and abort these steps.</p>
- <li>
- <p>Let <var>incumbent origin</var> be the <a href=#effective-script-origin id=dialogs-implemented-using-separate-documents:effective-script-origin>effective script origin</a>
- specified by the <a href=#incumbent-settings-object id=dialogs-implemented-using-separate-documents:incumbent-settings-object-2>incumbent settings object</a> at the time the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-3><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called.</p>
- <li>
- <p>Let <var>the list of background browsing contexts</var> be a list of all the
- browsing contexts that:</p>
- <ul><li>are part of the same <a href=#unit-of-related-browsing-contexts id=dialogs-implemented-using-separate-documents:unit-of-related-browsing-contexts>unit of related browsing contexts</a> as the browsing context
- of the <code id=dialogs-implemented-using-separate-documents:window><a href=#window>Window</a></code> object on which the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-4><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called, and that<li>have an <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document-2>active document</a> whose <a href=#origin-2 id=dialogs-implemented-using-separate-documents:origin-2>origin</a> is the <a href=#same-origin id=dialogs-implemented-using-separate-documents:same-origin>same</a> as <var>incumbent origin</var>,</ul>
- <p>...as well as any browsing contexts that are nested inside any of the browsing contexts
- matching those conditions.</p>
- <li>
- <p>Disable the user interface for all the browsing contexts in <var>the list of
- background browsing contexts</var>. This should prevent the user from navigating those browsing
- contexts, causing events to be sent to those browsing context, or editing any content in those
- browsing contexts. However, it does not prevent those browsing contexts from receiving events
- from sources other than the user, from running scripts, from running animations, and so
- forth.</p>
- <li>
- <p>Create a new <a href=#auxiliary-browsing-context id=dialogs-implemented-using-separate-documents:auxiliary-browsing-context>auxiliary browsing context</a>, with the <a href=#opener-browsing-context id=dialogs-implemented-using-separate-documents:opener-browsing-context>opener browsing
- context</a> being the browsing context of the <code id=dialogs-implemented-using-separate-documents:window-2><a href=#window>Window</a></code> object on which the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-5><a href=#dom-showmodaldialog>showModalDialog()</a></code> method was called. The new auxiliary
- browsing context has no name.</p>
- <p class=note>This <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context>browsing context</a>'s <code id=dialogs-implemented-using-separate-documents:document><a href=#document>Document</a></code>s' <code id=dialogs-implemented-using-separate-documents:window-3><a href=#window>Window</a></code>
- objects all implement the <code id=dialogs-implemented-using-separate-documents:windowmodal><a href=#windowmodal>WindowModal</a></code> interface.</p>
- <li>
- <p>Set all the flags in the new browsing context's <a href=#popup-sandboxing-flag-set id=dialogs-implemented-using-separate-documents:popup-sandboxing-flag-set>popup sandboxing flag set</a> that
- are set in the <a href=#active-sandboxing-flag-set id=dialogs-implemented-using-separate-documents:active-sandboxing-flag-set-2>active sandboxing flag set</a> of the <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document-3>active document</a> of
- the <a href=#responsible-browsing-context id=dialogs-implemented-using-separate-documents:responsible-browsing-context-2>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=dialogs-implemented-using-separate-documents:incumbent-settings-object-3>incumbent settings
- object</a>. The <a href=#responsible-browsing-context id=dialogs-implemented-using-separate-documents:responsible-browsing-context-3>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=dialogs-implemented-using-separate-documents:incumbent-settings-object-4>incumbent
- settings object</a> must be set as the new browsing context's <a href=#one-permitted-sandboxed-navigator id=dialogs-implemented-using-separate-documents:one-permitted-sandboxed-navigator>one permitted sandboxed
- navigator</a>.</p>
- <li>
- <p>Let the <a href=#dialog-arguments id=dialogs-implemented-using-separate-documents:dialog-arguments>dialog arguments</a> of the new browsing context be set to the value of <var>argument</var>, or the <i>undefined</i> value if the argument was omitted.</p>
- <li>
- <p>Let the <a href="#dialog-arguments'-origin" id="dialogs-implemented-using-separate-documents:dialog-arguments'-origin">dialog arguments' origin</a> be <var>incumbent origin</var>.</p>
- <li>
- <p>Let the <a href=#return-value id=dialogs-implemented-using-separate-documents:return-value>return value</a> of the new browsing context be the <i>undefined</i> value.</p>
- <li>
- <p>Let the <a href=#return-value-origin id=dialogs-implemented-using-separate-documents:return-value-origin>return value origin</a> be <var>incumbent origin</var>.</p>
- <li>
- <p><a href=#navigate id=dialogs-implemented-using-separate-documents:navigate>Navigate</a> the new <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context-2>browsing context</a> to
- the <a href=#absolute-url id=dialogs-implemented-using-separate-documents:absolute-url>absolute URL</a> that resulted from <a href=#resolve-a-url id=dialogs-implemented-using-separate-documents:resolve-a-url-2>resolving</a>
- <var>url</var> earlier, with <a href=#replacement-enabled id=dialogs-implemented-using-separate-documents:replacement-enabled>replacement enabled</a>, and with the
- <a href=#responsible-browsing-context id=dialogs-implemented-using-separate-documents:responsible-browsing-context-4>responsible browsing context</a> specified by the <a href=#incumbent-settings-object id=dialogs-implemented-using-separate-documents:incumbent-settings-object-5>incumbent settings
- object</a> as the <a href=#source-browsing-context id=dialogs-implemented-using-separate-documents:source-browsing-context>source browsing context</a>.</p>
-
- <li>
- <p><a href=#spin-the-event-loop id=dialogs-implemented-using-separate-documents:spin-the-event-loop>Spin the event loop</a> until the new <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context-3>browsing context</a> is <a href=#close-a-browsing-context id=dialogs-implemented-using-separate-documents:close-a-browsing-context>closed</a>. The user agent must allow the user to indicate
- that the <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context-4>browsing context</a> is to be closed.</p>
- <li>
- <p>Reenable the user interface for all the browsing contexts in <var>the list of
- background browsing contexts</var>.</p>
- <li>
- <p>If the <a href=#auxiliary-browsing-context id=dialogs-implemented-using-separate-documents:auxiliary-browsing-context-2>auxiliary browsing context</a>'s <a href=#return-value-origin id=dialogs-implemented-using-separate-documents:return-value-origin-2>return value origin</a> at the time
- the browsing context was <a href=#close-a-browsing-context id=dialogs-implemented-using-separate-documents:close-a-browsing-context-2>closed</a> was the <a href=#same-origin id=dialogs-implemented-using-separate-documents:same-origin-2>same</a> as <var>incumbent origin</var>, then let <var>return value</var> be the <a href=#auxiliary-browsing-context id=dialogs-implemented-using-separate-documents:auxiliary-browsing-context-3>auxiliary browsing context</a>'s <a href=#return-value id=dialogs-implemented-using-separate-documents:return-value-2>return
- value</a> as it stood when the browsing context was <a href=#close-a-browsing-context id=dialogs-implemented-using-separate-documents:close-a-browsing-context-3>closed</a>.</p>
- <p>Otherwise, let <var>return value</var> be undefined.</p>
- <li>
- <p>Return <var>return value</var>.</p>
- </ol>
- <p>The <code id=dialogs-implemented-using-separate-documents:window-4><a href=#window>Window</a></code> objects of <code id=dialogs-implemented-using-separate-documents:document-2><a href=#document>Document</a></code>s hosted by <a href=#browsing-context id=dialogs-implemented-using-separate-documents:browsing-context-5>browsing contexts</a> created by the above algorithm must also implement the
- <code id=dialogs-implemented-using-separate-documents:windowmodal-2><a href=#windowmodal>WindowModal</a></code> interface.</p>
- <p class=note>When this happens, the members of the <code id=dialogs-implemented-using-separate-documents:windowmodal-3><a href=#windowmodal>WindowModal</a></code> interface, in
- JavaScript environments, appear to actually be part of the <code id=dialogs-implemented-using-separate-documents:window-5><a href=#window>Window</a></code> interface (e.g.
- they are on the same prototype chain as the <code id=dialogs-implemented-using-separate-documents:dom-alert><a href=#dom-alert>window.alert()</a></code>
- method).</p>
-
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=windowmodal>WindowModal</dfn> {
- readonly attribute any <a href=#dom-windowmodal-dialogarguments id=dialogs-implemented-using-separate-documents:dom-windowmodal-dialogarguments>dialogArguments</a>;
- attribute any <a href=#dom-windowmodal-returnvalue id=dialogs-implemented-using-separate-documents:dom-windowmodal-returnvalue>returnValue</a>;
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=dialogs-implemented-using-separate-documents:dom-windowmodal-dialogarguments-2><a href=#dom-windowmodal-dialogarguments>dialogArguments</a></code><dd>
- <p>Returns the <var>argument</var> argument that was passed to the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-6><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>
- <dt><var>window</var> . <code id=dialogs-implemented-using-separate-documents:dom-windowmodal-returnvalue-2><a href=#dom-windowmodal-returnvalue>returnValue</a></code> [ = <var>value</var> ]<dd>
- <p>Returns the current return value for the window.</p>
- <p>Can be set, to change the value that will be returned by the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-7><a href=#dom-showmodaldialog>showModalDialog()</a></code> method.</p>
- </dl>
-
- <p>Such browsing contexts have associated <dfn id=dialog-arguments>dialog arguments</dfn>, which are stored along with
- the <dfn id="dialog-arguments'-origin">dialog arguments' origin</dfn>. These values are set by the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-8><a href=#dom-showmodaldialog>showModalDialog()</a></code> method in the algorithm above, when the
- browsing context is created, based on the arguments provided to the method.</p>
- <p>The <dfn id=dom-windowmodal-dialogarguments><code>dialogArguments</code></dfn> IDL
- attribute, on getting, must check whether its browsing context's <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document-4>active document</a>'s
- <a href=#effective-script-origin id=dialogs-implemented-using-separate-documents:effective-script-origin-2>effective script origin</a> is the <a href=#same-origin id=dialogs-implemented-using-separate-documents:same-origin-3>same</a> as the <a href="#dialog-arguments'-origin" id="dialogs-implemented-using-separate-documents:dialog-arguments'-origin-2">dialog arguments'
- origin</a>. If it is, then the browsing context's <a href=#dialog-arguments id=dialogs-implemented-using-separate-documents:dialog-arguments-2>dialog arguments</a> must be
- returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>.</p>
- <p>These browsing contexts also have an associated <dfn id=return-value>return value</dfn> and <dfn id=return-value-origin>return value
- origin</dfn>. As with the previous two values, these values are set by the <code id=dialogs-implemented-using-separate-documents:dom-showmodaldialog-9><a href=#dom-showmodaldialog>showModalDialog()</a></code> method in the algorithm above, when the
- browsing context is created.</p>
- <p>The <dfn id=dom-windowmodal-returnvalue><code>returnValue</code></dfn> IDL attribute, on
- getting, must check whether its browsing context's <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document-5>active document</a>'s <a href=#effective-script-origin id=dialogs-implemented-using-separate-documents:effective-script-origin-3>effective
- script origin</a> is the <a href=#same-origin id=dialogs-implemented-using-separate-documents:same-origin-4>same</a> as the current <a href=#return-value-origin id=dialogs-implemented-using-separate-documents:return-value-origin-3>return
- value origin</a>. If it is, then the browsing context's <a href=#return-value id=dialogs-implemented-using-separate-documents:return-value-3>return value</a> must be
- returned unchanged. Otherwise, the IDL attribute must return <i>undefined</i>. On setting, the
- attribute must set the <a href=#return-value id=dialogs-implemented-using-separate-documents:return-value-4>return value</a> to the given new value, and the <a href=#return-value-origin id=dialogs-implemented-using-separate-documents:return-value-origin-4>return
- value origin</a> to the browsing context's <a href=#active-document id=dialogs-implemented-using-separate-documents:active-document-6>active document</a>'s <a href=#effective-script-origin id=dialogs-implemented-using-separate-documents:effective-script-origin-4>effective
- script origin</a>.</p>
-
- <p class=note>The <code id=dialogs-implemented-using-separate-documents:dom-window-close><a href=#dom-window-close>window.close()</a></code> method can be used to
- close the browsing context.</p>
- <h3 id=system-state-and-capabilities>8.6 System state and capabilities</h3>
- <h4 id=the-navigator-object>8.6.1 The <code id=the-navigator-object:navigator><a href=#navigator>Navigator</a></code> object</h4>
-
- <p>The <dfn id=dom-navigator><code>navigator</code></dfn> attribute of the
- <code id=the-navigator-object:window><a href=#window>Window</a></code> interface must return an instance of the <code id=the-navigator-object:navigator-2><a href=#navigator>Navigator</a></code> interface,
- which represents the identity and state of the user agent (the client), and allows Web pages to
- register themselves as potential protocol and content handlers:</p>
-
- <pre class=idl>interface <dfn id=navigator>Navigator</dfn> {
- // objects implementing this interface also implement the interfaces given below
- };
- <a href=#navigator id=the-navigator-object:navigator-3>Navigator</a> implements <a href=#navigatorid id=the-navigator-object:navigatorid>NavigatorID</a>;
- <a href=#navigator id=the-navigator-object:navigator-4>Navigator</a> implements <a href=#navigatorlanguage id=the-navigator-object:navigatorlanguage>NavigatorLanguage</a>;
- <a href=#navigator id=the-navigator-object:navigator-5>Navigator</a> implements <a href=#navigatoronline id=the-navigator-object:navigatoronline>NavigatorOnLine</a>;
- <a href=#navigator id=the-navigator-object:navigator-6>Navigator</a> implements <a href=#navigatorcontentutils id=the-navigator-object:navigatorcontentutils>NavigatorContentUtils</a>;
- <a href=#navigator id=the-navigator-object:navigator-7>Navigator</a> implements <a href=#navigatorstorageutils id=the-navigator-object:navigatorstorageutils>NavigatorStorageUtils</a>;
- <a href=#navigator id=the-navigator-object:navigator-8>Navigator</a> implements <a href=#navigatorplugins id=the-navigator-object:navigatorplugins>NavigatorPlugins</a>;</pre>
-
- <p>These interfaces are defined separately so that other specifications can re-use parts of the
- <code id=the-navigator-object:navigator-9><a href=#navigator>Navigator</a></code> interface.</p>
-
- <h5 id=client-identification>8.6.1.1 Client identification</h5>
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=navigatorid>NavigatorID</dfn> {
- readonly attribute DOMString <a href=#dom-navigator-appcodename id=client-identification:dom-navigator-appcodename>appCodeName</a>; // constant "Mozilla"
- readonly attribute DOMString <a href=#dom-navigator-appname id=client-identification:dom-navigator-appname>appName</a>;
- readonly attribute DOMString <a href=#dom-navigator-appversion id=client-identification:dom-navigator-appversion>appVersion</a>;
- readonly attribute DOMString <a href=#dom-navigator-platform id=client-identification:dom-navigator-platform>platform</a>;
- readonly attribute DOMString <a href=#dom-navigator-product id=client-identification:dom-navigator-product>product</a>; // constant "Gecko"
- boolean <a href=#dom-navigator-taintenabled id=client-identification:dom-navigator-taintenabled>taintEnabled</a>(); // constant false
- readonly attribute DOMString <a href=#dom-navigator-useragent id=client-identification:dom-navigator-useragent>userAgent</a>;
- };</pre>
- <p>In certain cases, despite the best efforts of the entire industry, Web browsers have bugs and
- limitations that Web authors are forced to work around.</p>
- <p>This section defines a collection of attributes that can be used to determine, from script, the
- kind of user agent in use, in order to work around these issues.</p>
- <p>Client detection should always be limited to detecting known current versions; future versions
- and unknown versions should always be assumed to be fully compliant.</p>
- <dl class=domintro><dt><var>window</var> . <code id=client-identification:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-appcodename-2><a href=#dom-navigator-appcodename>appCodeName</a></code><dd>
- <p>Returns the string "<code>Mozilla</code>".</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-2><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-appname-2><a href=#dom-navigator-appname>appName</a></code><dd>
- <p>Returns the name of the browser.</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-3><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-appversion-2><a href=#dom-navigator-appversion>appVersion</a></code><dd>
- <p>Returns the version of the browser.</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-4><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-platform-2><a href=#dom-navigator-platform>platform</a></code><dd>
- <p>Returns the name of the platform.</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-5><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-product-2><a href=#dom-navigator-product>product</a></code><dd>
- <p>Returns the string "<code>Gecko</code>".</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-6><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-taintenabled-2><a href=#dom-navigator-taintenabled>taintEnabled</a></code>()<dd>
- <p>Returns false.</p>
- <dt><var>window</var> . <code id=client-identification:dom-navigator-7><a href=#dom-navigator>navigator</a></code> . <code id=client-identification:dom-navigator-useragent-2><a href=#dom-navigator-useragent>userAgent</a></code><dd>
- <p>Returns the complete User-Agent header.</p>
- </dl>
-
- <dl><dt><dfn id=dom-navigator-appcodename><code>appCodeName</code></dfn><dd><p>Must return the string "<code>Mozilla</code>".<dt><dfn id=dom-navigator-appname><code>appName</code></dfn><dd><p>Must return either the string "<code>Netscape</code>" or the full name of the
- browser, e.g. "<code>Mellblom Browsernator</code>".<dt><dfn id=dom-navigator-appversion><code>appVersion</code></dfn><dd><p>Must return either the string "<code>4.0</code>" or a string representing the
- version of the browser in detail, e.g. "<code>1.0 (VMS; en-US)
- Mellblomenator/9000</code>".<dt><dfn id=dom-navigator-platform><code>platform</code></dfn><dd><p>Must return either the empty string or a string representing the platform on which the
- browser is executing, e.g. "<code>MacIntel</code>", "<code>Win32</code>",
- "<code>FreeBSD i386</code>", "<code>WebTV OS</code>".<dt><dfn id=dom-navigator-product><code>product</code></dfn><dd><p>Must return the string "<code>Gecko</code>".<dt><dfn id=dom-navigator-taintenabled><code>taintEnabled()</code></dfn><dd><p>Must return false.<dt><dfn id=dom-navigator-useragent><code>userAgent</code></dfn><dd><p>Must return the string used for the value of the "<code>User-Agent</code>" header
- in HTTP requests, or the empty string if no such header is ever sent.</dl>
-
- <p class=warning>Any information in this API that varies from user to user can be used to
- profile the user. In fact, if enough such information is available, a user can actually be
- uniquely identified. For this reason, user agent implementors are strongly urged to include as
- little information in this API as possible.
- <a href=#fingerprinting-vector id=client-identification:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
-
-
- <h5 id=language-preferences>8.6.1.2 Language preferences</h5>
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=navigatorlanguage>NavigatorLanguage</dfn> {
- readonly attribute DOMString? <a href=#dom-navigator-language id=language-preferences:dom-navigator-language>language</a>;
- readonly attribute DOMString[] <a href=#dom-navigator-languages id=language-preferences:dom-navigator-languages>languages</a>;
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=language-preferences:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=language-preferences:dom-navigator-language-2><a href=#dom-navigator-language>language</a></code><dd>
- <p>Returns a language tag representing the user's preferred language.</p>
- <dt><var>window</var> . <code id=language-preferences:dom-navigator-2><a href=#dom-navigator>navigator</a></code> . <code id=language-preferences:dom-navigator-languages-2><a href=#dom-navigator-languages>languages</a></code><dd>
- <p>Returns an array of language tags representing the user's preferred languages, with the most preferred language first.</p>
- <p>The most preferred language is the one returned by <code id=language-preferences:dom-navigator-language-3><a href=#dom-navigator-language>navigator.language</a></code>.</p>
- </dl>
- <p class=note>A <code id=language-preferences:event-languagechange><a href=#event-languagechange>languagechange</a></code> event is fired at the
- <code id=language-preferences:window><a href=#window>Window</a></code> or <code id=language-preferences:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object when the user agent's understanding
- of what the user's preferred languages are changes.</p>
-
- <dl><dt><dfn id=dom-navigator-language><code>language</code></dfn><dd><p>Must return a valid BCP 47 language tag representing either <a href=#a-plausible-language id=language-preferences:a-plausible-language>a plausible
- language</a> or the user's most preferred language. <a href=#refsBCP47>[BCP47]</a><dt><dfn id=dom-navigator-languages><code>languages</code></dfn><dd>
- <p>Must return a <a href=#dfn-read-only-array id=language-preferences:dfn-read-only-array>read only</a> array of valid BCP 47
- language tags representing either one or more <a href=#a-plausible-language id=language-preferences:a-plausible-language-2>plausible
- languages</a>, or the user's preferred languages, ordered by preference with the most
- preferred language first. The same object must be returned until the user agent needs to return
- different values, or values in a different order. <a href=#refsBCP47>[BCP47]</a></p>
- <p>Whenever the user agent needs to make the <code id=language-preferences:dom-navigator-languages-3><a href=#dom-navigator-languages>navigator.languages</a></code> attribute of a <code id=language-preferences:window-2><a href=#window>Window</a></code>
- or <code id=language-preferences:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object return a new set of language tags, the user agent must
- <a href=#queue-a-task id=language-preferences:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=language-preferences:fire-a-simple-event>fire a simple event</a> named <code id=language-preferences:event-languagechange-2><a href=#event-languagechange>languagechange</a></code> at the <code id=language-preferences:window-3><a href=#window>Window</a></code> or
- <code id=language-preferences:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object and wait until that task begins to be executed before
- actually returning a new value.</p>
- <p>The <a href=#task-source id=language-preferences:task-source>task source</a> for this <a href=#concept-task id=language-preferences:concept-task>task</a> is the
- <a href=#dom-manipulation-task-source id=language-preferences:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- </dl>
- <p>To determine <dfn id=a-plausible-language>a plausible language</dfn>, the user agent should bear in mind the following:</p>
- <ul><li>Any information in this API that varies from user to user can be used to profile or identify
- the user.
- <a href=#fingerprinting-vector id=language-preferences:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- <li>If the user is not using a service that obfuscates the user's point of origin (e.g. the Tor
- anonymity network), then the value that is least likely to distinguish the user from other users
- with similar origins (e.g. from the same IP address block) is the language used by the majority
- of such users. <a href=#refsTOR>[TOR]</a><li>If the user is using an anonymizing service, then the value "<code>en-US</code>" is
- suggested; if all users of the service use that same value, that reduces the possibility of
- distinguishing the users from each other.</ul>
- <p>To avoid introducing any more fingerprinting vectors, user agents should use the same list for
- the APIs defined in this function as for the HTTP <code id=language-preferences:http-accept-language><a href=#http-accept-language>Accept-Language</a></code> header.
- <a href=#fingerprinting-vector id=language-preferences:fingerprinting-vector-2 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
-
- <h5 id=custom-handlers>8.6.1.3 Custom scheme and content handlers</h5>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=navigatorcontentutils>NavigatorContentUtils</dfn> {
- // content handler registration
- void <a href=#dom-navigator-registerprotocolhandler id=custom-handlers:dom-navigator-registerprotocolhandler>registerProtocolHandler</a>(DOMString scheme, DOMString url, DOMString title);
- void <a href=#dom-navigator-registercontenthandler id=custom-handlers:dom-navigator-registercontenthandler>registerContentHandler</a>(DOMString mimeType, DOMString url, DOMString title);
- DOMString <a href=#dom-navigator-isprotocolhandlerregistered id=custom-handlers:dom-navigator-isprotocolhandlerregistered>isProtocolHandlerRegistered</a>(DOMString scheme, DOMString url);
- DOMString <a href=#dom-navigator-iscontenthandlerregistered id=custom-handlers:dom-navigator-iscontenthandlerregistered>isContentHandlerRegistered</a>(DOMString mimeType, DOMString url);
- void <a href=#dom-navigator-unregisterprotocolhandler id=custom-handlers:dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler</a>(DOMString scheme, DOMString url);
- void <a href=#dom-navigator-unregistercontenthandler id=custom-handlers:dom-navigator-unregistercontenthandler>unregisterContentHandler</a>(DOMString mimeType, DOMString url);
- };</pre>
- <p>The <dfn id=dom-navigator-registerprotocolhandler><code>registerProtocolHandler()</code></dfn> method
- allows Web sites to register themselves as possible handlers for particular schemes. For example,
- an online telephone messaging service could register itself as a handler of the <code id=custom-handlers:sms-protocol><a data-x-internal=sms-protocol href=http://tools.ietf.org/html/rfc5724#section-2>sms:</a></code> scheme, so that if the user clicks on such a link, he is given the
- opportunity to use that Web site. Analogously, the <dfn id=dom-navigator-registercontenthandler><code>registerContentHandler()</code></dfn> method allows
- Web sites to register themselves as possible handlers for content in a particular <a href=#mime-type id=custom-handlers:mime-type>MIME
- type</a>. For example, the same online telephone messaging service could register itself as a
- handler for <code id=custom-handlers:text/vcard><a href=#text/vcard>text/vcard</a></code> files, so that if the user has no native application capable
- of handling vCards, his Web browser can instead suggest he use that site to view contact
- information stored on vCards that he opens. <a href=#refsSMS>[SMS]</a> <a href=#refsRFC6350>[RFC6350]</a></p>
- <dl class=domintro><dt><var>window</var> . <code id=custom-handlers:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-registerprotocolhandler-2><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler</a></code>(<var>scheme</var>, <var>url</var>, <var>title</var>)<dt><var>window</var> . <code id=custom-handlers:dom-navigator-2><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-registercontenthandler-2><a href=#dom-navigator-registercontenthandler>registerContentHandler</a></code>(<var>mimeType</var>, <var>url</var>, <var>title</var>)<dd>
- <p>Registers a handler for the given scheme or content type, at the given URL, with the given
- title.</p>
- <p>The string "<code>%s</code>" in the URL is used as a placeholder for where to put
- the URL of the content to be handled.</p>
- <p>Throws a <code id=custom-handlers:securityerror><a href=#securityerror>SecurityError</a></code> exception if the user agent blocks the registration (this
- might happen if trying to register as a handler for "http", for instance).</p>
- <p>Throws a <code id=custom-handlers:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception if the "<code>%s</code>" string is
- missing in the URL.</p>
- </dl>
-
- <p>User agents may, within the constraints described in this section, do whatever they like when
- the methods are called. A UA could, for instance, prompt the user and offer the user the
- opportunity to add the site to a shortlist of handlers, or make the handlers his default, or
- cancel the request. UAs could provide such a UI through modal UI or through a non-modal transient
- notification interface. UAs could also simply silently collect the information, providing it only
- when relevant to the user.</p>
- <p>User agents should keep track of which sites have registered handlers (even if the user has
- declined such registrations) so that the user is not repeatedly prompted with the same
- request.</p>
- <p>The arguments to the methods have the following meanings and corresponding implementation
- requirements. The requirements that involve throwing exceptions must be processed in the order
- given below, stopping at the first exception thrown. (So the exceptions for the first argument
- take precedence over the exceptions for the second argument.)</p>
- <dl><dt><var>scheme</var> (<code id=custom-handlers:dom-navigator-registerprotocolhandler-3><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> only)<dd>
- <p>A scheme, such as "<code>mailto</code>" or "<code>web+auth</code>". The
- scheme must be compared in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive>ASCII case-insensitive</a> manner by user agents for the
- purposes of comparing with the scheme part of URLs that they consider against the list of
- registered handlers.</p>
- <p>The <var>scheme</var> value, if it contains a colon (as in "<code>mailto:</code>"),
- will never match anything, since schemes don't contain colons.</p>
- <p>If the <code id=custom-handlers:dom-navigator-registerprotocolhandler-4><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code>
- method is invoked with a scheme that is neither a <a href=#whitelisted-scheme id=custom-handlers:whitelisted-scheme>whitelisted scheme</a> nor a scheme
- whose value starts with the substring "<code>web+</code>" and otherwise contains only
- <a href=#lowercase-ascii-letters id=custom-handlers:lowercase-ascii-letters>lowercase ASCII letters</a>, and whose length is at least five characters (including
- the "<code>web+</code>" prefix), the user agent must throw a <code id=custom-handlers:securityerror-2><a href=#securityerror>SecurityError</a></code>
- exception.</p>
- <p>The following schemes are the <dfn id=whitelisted-scheme>whitelisted schemes</dfn>:</p>
- <ul class=brief><li><code>bitcoin</code><li><code>geo</code><li><code>im</code><li><code>irc</code><li><code>ircs</code><li><code>magnet</code><li><code>mailto</code><li><code>mms</code><li><code>news</code><li><code>nntp</code><li><code>sip</code><li><code>sms</code><li><code>smsto</code><li><code>ssh</code><li><code>tel</code><li><code>urn</code><li><code>webcal</code><li><code>wtai</code><li><code>xmpp</code></ul>
- <p class=note>This list can be changed. If there are schemes that should be added, please send
- feedback.</p>
- <p class=note>This list excludes any schemes that could reasonably be expected to be supported
- inline, e.g. in an <code id=custom-handlers:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, such as <code>http</code> or (more
- theoretically) <code>gopher</code>. If those were supported, they could potentially be
- used in man-in-the-middle attacks, by replacing pages that have frames with such content with
- content under the control of the protocol handler. If the user agent has native support for the
- schemes, this could further be used for cookie-theft attacks.</p>
- <dt><var>mimeType</var> (<code id=custom-handlers:dom-navigator-registercontenthandler-3><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> only)<dd>
- <p>A <a href=#mime-type id=custom-handlers:mime-type-2>MIME type</a>, such as <code>model/vnd.flatland.3dml</code> or <code>application/vnd.google-earth.kml+xml</code>. The <a href=#mime-type id=custom-handlers:mime-type-3>MIME type</a> must be
- compared in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive-2>ASCII case-insensitive</a> manner by user agents for the purposes of
- comparing with MIME types of documents that they consider against the list of registered
- handlers.</p>
- <p>User agents must compare the given values only to the MIME type/subtype parts of content
- types, not to the complete type including parameters. Thus, if <var>mimeType</var>
- values passed to this method include characters such as commas or whitespace, or include MIME
- parameters, then the handler being registered will never be used.</p>
- <p class=note>The type is compared to the <a href=#mime-type id=custom-handlers:mime-type-4>MIME type</a> used by the user agent
- <em>after</em> the sniffing algorithms have been applied.</p>
- <p>If the <code id=custom-handlers:dom-navigator-registercontenthandler-4><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code>
- method is invoked with a <a href=#mime-type id=custom-handlers:mime-type-5>MIME type</a> that is in the <a href=#type-blacklist id=custom-handlers:type-blacklist>type blacklist</a> or
- that the user agent has deemed a privileged type, the user agent must throw a
- <code id=custom-handlers:securityerror-3><a href=#securityerror>SecurityError</a></code> exception.</p>
- <p>The following <a href=#mime-type id=custom-handlers:mime-type-6>MIME types</a> are in the <dfn id=type-blacklist>type
- blacklist</dfn>:</p>
- <ul class=brief><li><code id=custom-handlers:application/x-www-form-urlencoded><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code><li><code id=custom-handlers:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code><li><code id=custom-handlers:application/xml><a href=#application/xml>application/xml</a></code><li><code id=custom-handlers:image/gif><a href=#image/gif>image/gif</a></code><li><code id=custom-handlers:image/jpeg><a href=#image/jpeg>image/jpeg</a></code><li><code id=custom-handlers:image/png><a href=#image/png>image/png</a></code><li><code id=custom-handlers:image/svg+xml><a href=#image/svg+xml>image/svg+xml</a></code><li><code id=custom-handlers:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code><li><code id=custom-handlers:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code><li><code id=custom-handlers:text/css><a href=#text/css>text/css</a></code><li><code id=custom-handlers:text/html><a href=#text/html>text/html</a></code><li><code id=custom-handlers:text/ping><a href=#text/ping>text/ping</a></code><li><code id=custom-handlers:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code><li><code id=custom-handlers:text/xml><a href=#text/xml>text/xml</a></code><li>All types that the user agent supports displaying natively in a <a href=#browsing-context id=custom-handlers:browsing-context>browsing context</a> during <a href=#navigate id=custom-handlers:navigate>navigation</a>, except for <code id=custom-handlers:application/rss+xml><a href=#application/rss+xml>application/rss+xml</a></code> and <code id=custom-handlers:application/atom+xml><a href=#application/atom+xml>application/atom+xml</a></code></ul>
- <p class=note>This list can be changed. If there are MIME types that should be added, please
- send feedback.</p>
- <dt><var>url</var><dd>
- <p>A string used to build the <a href=#url id=custom-handlers:url>URL</a> of the page that will handle the requests.</p>
- <p>User agents must throw a <code id=custom-handlers:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception if the <var>url</var>
- argument passed to one of these methods does not contain the exact literal string
- "<code>%s</code>".</p>
- <p>User agents must throw a <code id=custom-handlers:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code> exception if <a href=#resolve-a-url id=custom-handlers:resolve-a-url>resolving</a> the <var>url</var> argument relative to the <a href=#api-base-url id=custom-handlers:api-base-url>API base
- URL</a> specified by the <a href=#entry-settings-object id=custom-handlers:entry-settings-object>entry settings object</a> is not successful.</p>
- <p class=note>The resulting <a href=#absolute-url id=custom-handlers:absolute-url>absolute URL</a> would by definition not be a <a href=#valid-url id=custom-handlers:valid-url>valid
- URL</a> as it would include the string "<code>%s</code>" which is not a valid
- component in a URL.</p>
- <p>User agents must throw a <code id=custom-handlers:securityerror-4><a href=#securityerror>SecurityError</a></code> exception if the resulting <a href=#absolute-url id=custom-handlers:absolute-url-2>absolute
- URL</a> has an <a href=#origin-2 id=custom-handlers:origin-2>origin</a> that differs from the <a href=#origin-2 id=custom-handlers:origin-2-2>origin</a> specified by the
- <a href=#entry-settings-object id=custom-handlers:entry-settings-object-2>entry settings object</a>.</p>
- <p class=note>This is forcibly the case if the <code>%s</code> placeholder is in the
- scheme, host, or port parts of the URL.</p>
- <p>The resulting <a href=#absolute-url id=custom-handlers:absolute-url-3>absolute URL</a> is the <dfn id=proto-url>proto-URL</dfn>. It identifies the
- handler for the purposes of the methods described below.</p>
- <p>When the user agent uses this handler, it must replace the first occurrence of the exact
- literal string "<code>%s</code>" in the <var>url</var> argument with an
- escaped version of the <a href=#absolute-url id=custom-handlers:absolute-url-4>absolute URL</a> of the content in question (as defined below),
- then <a href=#resolve-a-url id=custom-handlers:resolve-a-url-2>resolve</a> the resulting URL, relative to the <a href=#api-base-url id=custom-handlers:api-base-url-2>API
- base URL</a> specified by the <a href=#entry-settings-object id=custom-handlers:entry-settings-object-3>entry settings object</a> at the time the <code id=custom-handlers:dom-navigator-registercontenthandler-5><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> or <code id=custom-handlers:dom-navigator-registerprotocolhandler-5><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> methods were
- invoked, and then <a href=#navigate id=custom-handlers:navigate-2>navigate</a> an appropriate <a href=#browsing-context id=custom-handlers:browsing-context-2>browsing
- context</a> to the resulting URL using the GET method (<a href=#concept-http-equivalent-get id=custom-handlers:concept-http-equivalent-get>or equivalent</a> for non-HTTP URLs).</p>
- <p>To get the escaped version of the <a href=#absolute-url id=custom-handlers:absolute-url-5>absolute URL</a> of the content in question, the
- user agent must replace every character in that <a href=#absolute-url id=custom-handlers:absolute-url-6>absolute URL</a> that is not a
- character in the URL <a href=#default-encode-set id=custom-handlers:default-encode-set>default encode set</a> with the result of <a href=#utf-8-percent-encode id=custom-handlers:utf-8-percent-encode>UTF-8 percent encoding</a> that character.</p>
- <div class=example>
- <p>If the user had visited a site at <code>http://example.com/</code> that made the
- following call:</p>
- <pre>navigator.registerContentHandler('application/x-soup', 'soup?url=%s', 'SoupWeb™')</pre>
- <p>...and then, much later, while visiting <code>http://www.example.net/</code>,
- clicked on a link such as:</p>
- <pre><a href="chickenkïwi.soup">Download our Chicken Kïwi soup!</a></pre>
- <p>...then, assuming this <code>chickenkïwi.soup</code> file was served with the
- <a href=#mime-type id=custom-handlers:mime-type-7>MIME type</a> <code>application/x-soup</code>, the UA might navigate to the
- following URL:</p>
- <pre>http://example.com/soup?url=http://www.example.net/chickenk%C3%AFwi.soup</pre>
- <p>This site could then fetch the <code>chickenkïwi.soup</code> file and do
- whatever it is that it does with soup (synthesise it and ship it to the user, or whatever).</p>
- </div>
- <dt><var>title</var><dd>
- <p>A descriptive title of the handler, which the UA might use to remind the user what the site
- in question is.</p>
- </dl>
- <p>This section does not define how the pages registered by these methods are used, beyond the
- requirements on how to process the <var>url</var> value (see above). To some extent, the
- <a href=#navigate id=custom-handlers:navigate-3>processing model for navigating across documents</a> defines some cases
- where these methods are relevant, but in general UAs may use this information wherever they would
- otherwise consider handing content to native plugins or helper applications.</p>
- <p>UAs must not use registered content handlers to handle content that was returned as part of a
- non-GET transaction (or rather, as part of any non-idempotent transaction), as the remote site
- would not be able to fetch the same data.</p>
- <hr>
-
- <p>In addition to the registration methods, there are also methods for determining if particular
- handlers have been registered, and for unregistering handlers.</p>
- <dl class=domintro><dt><var>state</var> = <var>window</var> . <code id=custom-handlers:dom-navigator-3><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-isprotocolhandlerregistered-2><a href=#dom-navigator-isprotocolhandlerregistered>isProtocolHandlerRegistered</a></code>(<var>scheme</var>, <var>url</var>)<dt><var>state</var> = <var>window</var> . <code id=custom-handlers:dom-navigator-4><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-iscontenthandlerregistered-2><a href=#dom-navigator-iscontenthandlerregistered>isContentHandlerRegistered</a></code>(<var>mimeType</var>, <var>url</var>)<dd>
- <p>Returns one of the following strings describing the state of the handler given by the
- arguments:</p>
- <dl><dt><code>new</code>
- <dd>Indicates that no attempt has been made to register the given handler (or that the handler
- has been unregistered). It would be appropriate to promote the availability of the handler or
- to just automatically register the handler.
- <dt><code>registered</code>
- <dd>Indicates that the given handler has been registered or that the site is blocked from
- registering the handler. Trying to register the handler again would have no effect.
- <dt><code>declined</code>
- <dd>Indicates that the given handler has been offered but was rejected. Trying to register the
- handler again may prompt the user again.
- </dl>
- <dt><var>window</var> . <code id=custom-handlers:dom-navigator-5><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-unregisterprotocolhandler-2><a href=#dom-navigator-unregisterprotocolhandler>unregisterProtocolHandler</a></code>(<var>scheme</var>, <var>url</var>)<dt><var>window</var> . <code id=custom-handlers:dom-navigator-6><a href=#dom-navigator>navigator</a></code> . <code id=custom-handlers:dom-navigator-unregistercontenthandler-2><a href=#dom-navigator-unregistercontenthandler>unregisterContentHandler</a></code>(<var>mimeType</var>, <var>url</var>)<dd>
- <p>Unregisters the handler given by the arguments.</p>
- </dl>
-
- <p>The <dfn id=dom-navigator-isprotocolhandlerregistered><code>isProtocolHandlerRegistered()</code></dfn>
- method must return the <a href=#handler-state-string id=custom-handlers:handler-state-string>handler state string</a> that most closely describes the current
- state of the handler described by the two arguments to the method, where the first argument gives
- the scheme and the second gives the string used to build the <a href=#url id=custom-handlers:url-2>URL</a> of the page that
- will handle the requests.
- <a href=#fingerprinting-vector id=custom-handlers:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The first argument must be compared to the schemes for which custom protocol handlers are
- registered in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive-3>ASCII case-insensitive</a> manner to find the relevant handlers.</p>
- <p>The second argument must be preprocessed as described below, and if that is successful, must
- then be matched against the <a href=#proto-url id=custom-handlers:proto-url>proto-URLs</a> of the relevant handlers to
- find the described handler.</p>
- <hr>
- <p>The <dfn id=dom-navigator-iscontenthandlerregistered><code>isContentHandlerRegistered()</code></dfn>
- method must return the <a href=#handler-state-string id=custom-handlers:handler-state-string-2>handler state string</a> that most closely describes the current
- state of the handler described by the two arguments to the method, where the first argument gives
- the <a href=#mime-type id=custom-handlers:mime-type-8>MIME type</a> and the second gives the string used to build the <a href=#url id=custom-handlers:url-3>URL</a> of
- the page that will handle the requests.
- <a href=#fingerprinting-vector id=custom-handlers:fingerprinting-vector-2 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The first argument must be compared to the <a href=#mime-type id=custom-handlers:mime-type-9>MIME types</a> for which
- custom content handlers are registered in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive-4>ASCII case-insensitive</a> manner to find
- the relevant handlers.</p>
- <p>The second argument must be preprocessed as described below, and if that is successful, must
- then be matched against the <a href=#proto-url id=custom-handlers:proto-url-2>proto-URLs</a> of the relevant handlers to
- find the described handler.</p>
- <hr>
- <p>The <dfn id=handler-state-string>handler state strings</dfn> are the following strings.
- Each string describes several situations, as given by the following list.</p>
- <dl><dt><code>new</code>
- <dd>The described handler has never been registered for the given scheme or type.
- <dd>The described handler was once registered for the given scheme or type, but the site has
- since unregistered it. If the handler were to be reregistered, the user would be notified
- accordingly.
- <dd>The described handler was once registered for the given scheme or type, but the site has
- since unregistered it, but the user has indicated that the site is to be blocked from registering
- the type again, so the user agent would ignore further registration attempts.
- <dt><code>registered</code>
- <dd>An attempt was made to register the described handler for the given scheme or type, but the
- user has not yet been notified, and the user agent would ignore further registration attempts.
- (Maybe the user agent batches registration requests to display them when the user requests to be
- notified about them, and the user has not yet requested that the user agent notify it of the
- previous registration attempt.)
- <dd>The described handler is registered for the given scheme or type (maybe, or maybe not, as the
- default handler).
- <dd>The described handler is permanently blocked from being (re)registered. (Maybe the user
- marked the registration attempt as spam, or blocked the site for other reasons.)
- <dt><code>declined</code>
- <dd>An attempt was made to register the described handler for the given scheme or type, but the
- user has not yet been notified; however, the user might be notified if another registration
- attempt were to be made. (Maybe the last registration attempt was made while the page was in the
- background and the user closed the page without looking at it, and the user agent requires
- confirmation for this registration attempt.)
- <dd>An attempt was made to register the described handler for the given scheme or type, but the
- user has not yet responded.
- <dd>An attempt was made to register the described handler for the given scheme or type, but the
- user declined the offer. The user has not indicated that the handler is to be permanently
- blocked, however, so another attempt to register the described handler might result in the user
- being prompted again.
- <dd>The described handler was once registered for the given scheme or type, but the user has
- since removed it. The user has not indicated that the handler is to be permanently blocked,
- however, so another attempt to register the described handler might result in the user being
- prompted again.
- </dl>
- <hr>
- <p>The <dfn id=dom-navigator-unregisterprotocolhandler><code>unregisterProtocolHandler()</code></dfn>
- method must unregister the handler described by the two arguments to the method, where the first
- argument gives the scheme and the second gives the string used to build the <a href=#url id=custom-handlers:url-4>URL</a> of
- the page that will handle the requests.</p>
- <p>The first argument must be compared to the schemes for which custom protocol handlers are
- registered in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive-5>ASCII case-insensitive</a> manner to find the relevant handlers.</p>
- <p>The second argument must be preprocessed as described below, and if that is successful, must
- then be matched against the <a href=#proto-url id=custom-handlers:proto-url-3>proto-URLs</a> of the relevant handlers to
- find the described handler.</p>
- <hr>
- <p>The <dfn id=dom-navigator-unregistercontenthandler><code>unregisterContentHandler()</code></dfn>
- method must unregister the handler described by the two arguments to the method, where the first
- argument gives the <a href=#mime-type id=custom-handlers:mime-type-10>MIME type</a> and the second gives the string used to build the
- <a href=#url id=custom-handlers:url-5>URL</a> of the page that will handle the requests.</p>
- <p>The first argument must be compared to the <a href=#mime-type id=custom-handlers:mime-type-11>MIME types</a> for which
- custom content handlers are registered in an <a href=#ascii-case-insensitive id=custom-handlers:ascii-case-insensitive-6>ASCII case-insensitive</a> manner to find
- the relevant handlers.</p>
- <p>The second argument must be preprocessed as described below, and if that is successful, must
- then be matched against the <a href=#proto-url id=custom-handlers:proto-url-4>proto-URLs</a> of the relevant handlers to
- find the described handler.</p>
- <hr>
- <p>The second argument of the four methods described above must be preprocessed as follows:</p>
- <ol><li><p>If the string does not contain the substring "<code>%s</code>", abort these
- steps. There's no matching handler.<li><p><a href=#resolve-a-url id=custom-handlers:resolve-a-url-3>Resolve</a> the string relative to the <a href=#api-base-url id=custom-handlers:api-base-url-3>API base
- URL</a> specified by the <a href=#entry-settings-object id=custom-handlers:entry-settings-object-4>entry settings object</a>.<li><p>If this fails, then throw a <code id=custom-handlers:syntaxerror-4><a href=#syntaxerror>SyntaxError</a></code> exception, aborting the
- method.<li><p>If the resulting <a href=#absolute-url id=custom-handlers:absolute-url-7>absolute URL</a>'s <a href=#origin-2 id=custom-handlers:origin-2-3>origin</a> is not the <a href=#same-origin id=custom-handlers:same-origin>same
- origin</a> as the <a href=#origin-2 id=custom-handlers:origin-2-4>origin</a> specified by the <a href=#entry-settings-object id=custom-handlers:entry-settings-object-5>entry settings object</a>,
- throw a <code id=custom-handlers:securityerror-5><a href=#securityerror>SecurityError</a></code> exception, aborting the method.<li><p>Return the resulting <a href=#absolute-url id=custom-handlers:absolute-url-8>absolute URL</a> as the result of preprocessing the
- argument.</ol>
-
-
- <h6 id=security-and-privacy>8.6.1.3.1 Security and privacy</h6>
- <p>These mechanisms can introduce a number of concerns, in particular privacy concerns.</p>
- <p><strong>Hijacking all Web usage.</strong> User agents should not allow schemes that are key to
- its normal operation, such as <code>http</code> or <code>https</code>, to be
- rerouted through third-party sites. This would allow a user's activities to be trivially tracked,
- and would allow user information, even in secure connections, to be collected.</p>
- <p><strong>Hijacking defaults.</strong> User agents are strongly urged to not automatically change
- any defaults, as this could lead the user to send data to remote hosts that the user is not
- expecting. New handlers registering themselves should never automatically cause those sites to be
- used.</p>
- <p><strong>Registration spamming.</strong> User agents should consider the possibility that a site
- will attempt to register a large number of handlers, possibly from multiple domains (e.g. by
- redirecting through a series of pages each on a different domain, and each registering a handler
- for <code id=security-and-privacy:video/mpeg><a href=#video/mpeg>video/mpeg</a></code> — analogous practices abusing other Web browser features have
- been used by pornography Web sites for many years). User agents should gracefully handle such
- hostile attempts, protecting the user.</p>
- <p><strong>Misleading titles.</strong> User agents should not rely wholly on the <var>title</var>
- argument to the methods when presenting the registered handlers to the user, since sites could
- easily lie. For example, a site <code>hostile.example.net</code> could claim that it was
- registering the "Cuddly Bear Happy Content Handler". User agents should therefore use the
- handler's domain in any UI along with any title.</p>
- <p><strong>Hostile handler metadata.</strong> User agents should protect against typical attacks
- against strings embedded in their interface, for example ensuring that markup or escape characters
- in such strings are not executed, that null bytes are properly handled, that over-long strings do
- not cause crashes or buffer overruns, and so forth.</p>
- <p><strong>Leaking Intranet URLs.</strong> The mechanism described in this section can result in
- secret Intranet URLs being leaked, in the following manner:</p>
- <ol><li>The user registers a third-party content handler as the default handler for a content
- type.<li>The user then browses his corporate Intranet site and accesses a document that uses that
- content type.<li>The user agent contacts the third party and hands the third party the URL to the Intranet
- content.</ol>
- <p>No actual confidential file data is leaked in this manner, but the URLs themselves could
- contain confidential information. For example, the URL could be <code>http://www.corp.example.com/upcoming-aquisitions/the-sample-company.egf</code>, which
- might tell the third party that Example Corporation is intending to merge with The Sample Company.
- Implementors might wish to consider allowing administrators to disable this feature for certain
- subdomains, content types, or schemes.</p>
- <p><strong>Leaking secure URLs.</strong> User agents should not send HTTPS URLs to third-party
- sites registered as content handlers without the user's informed consent, for the same reason that
- user agents sometimes avoid sending <code id=security-and-privacy:http-referer><a href=#http-referer>Referer</a></code> (sic) HTTP headers
- from secure sites to third-party sites.</p>
- <p><strong>Leaking credentials.</strong> User agents must never send username or password
- information in the URLs that are escaped and included sent to the handler sites. User agents may
- even avoid attempting to pass to Web-based handlers the URLs of resources that are known to
- require authentication to access, as such sites would be unable to access the resources in
- question without prompting the user for credentials themselves (a practice that would require the
- user to know whether to trust the third-party handler, a decision many users are unable to make or
- even understand).</p>
- <p><strong>Interface interference.</strong> User agents should be prepared to handle intentionally
- long arguments to the methods. For example, if the user interface exposed consists of an "accept"
- button and a "deny" button, with the "accept" binding containing the name of the handler, it's
- important that a long name not cause the "deny" button to be pushed off the screen.</p>
- <p><strong>Fingerprinting users.</strong> Since a site can detect if it has attempted to register
- a particular handler or not, whether or not the user responds, the mechanism can be used to store
- data. User agents are therefore strongly urged to treat registrations in the same manner as
- cookies: clearing cookies for a site should also clear all registrations for that site, and
- disabling cookies for a site should also disable registrations.</p>
-
-
- <h6 id=sample-handler-impl>8.6.1.3.2 Sample user interface</h6>
- <p><i>This section is non-normative.</i></p>
- <p>A simple implementation of this feature for a desktop Web browser might work as follows.</p>
- <p>The <code id=sample-handler-impl:dom-navigator-registercontenthandler><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> method
- could display a modal dialog box:</p>
- <p><img src=http://images.whatwg.org/sample-content-handler-registration.png width=534 alt="The modal dialog box could have the title 'Content Handler Registration', and could say 'This Web page: Kittens at work http://kittens.example.org/ ...would like permission to handle files of type: application/x-meowmeow using the following Web-based application: Kittens-at-work displayer http://kittens.example.org/?show=%s Do you trust the administrators of the "kittens.example.org" domain?' with two buttons, 'Trust kittens.example.org' and 'Cancel'." height=374></p>
- <p>In this dialog box, "Kittens at work" is the title of the page that invoked the method,
- "http://kittens.example.org/" is the URL of that page, "application/x-meowmeow" is the string that
- was passed to the <code id=sample-handler-impl:dom-navigator-registercontenthandler-2><a href=#dom-navigator-registercontenthandler>registerContentHandler()</a></code> method as its first
- argument (<var>mimeType</var>), "http://kittens.example.org/?show=%s" was the second
- argument (<var>url</var>), and "Kittens-at-work displayer" was the third argument (<var>title</var>).</p>
- <p>If the user clicks the Cancel button, then nothing further happens. If the user clicks the
- "Trust" button, then the handler is remembered.</p>
- <p>When the user then attempts to fetch a URL that uses the "application/x-meowmeow" <a href=#mime-type id=sample-handler-impl:mime-type>MIME
- type</a>, then it might display a dialog as follows:</p>
- <p><img src=http://images.whatwg.org/sample-content-handler.png width=577 alt="The dialog box could have the title 'Unknown File Type' and could say 'You have attempted to access:' followed by a URL, followed by a prompt such as 'How would you like FerretBrowser to handle this resource?' with three radio buttons, one saying 'Contact the FerretBrowser plugin registry to see if there is an official way to handle this resource.', one saying 'Pass this URL to a local application' with an application selector, and one saying 'Pass this URL to the "Kittens-at-work displayer" application at "kittens.example.org"', with a checkbox labeled 'Always do this for resources using the "application/x-meowmeow" type in future.', and with two buttons, 'Ok' and 'Cancel'." height=428></p>
- <p>In this dialog, the third option is the one that was primed by the site registering itself
- earlier.</p>
- <p>If the user does select that option, then the browser, in accordance with the requirements
- described in the previous two sections, will redirect the user to
- "http://kittens.example.org/?show=data%3Aapplication/x-meowmeow;base64,S2l0dGVucyBhcmUgdGhlIGN1dGVzdCE%253D".</p>
- <p>The <code id=sample-handler-impl:dom-navigator-registerprotocolhandler><a href=#dom-navigator-registerprotocolhandler>registerProtocolHandler()</a></code> method
- would work equivalently, but for schemes instead of unknown content types.</p>
-
- <h5 id=manually-releasing-the-storage-mutex>8.6.1.4 Manually releasing the storage mutex</h5>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=navigatorstorageutils>NavigatorStorageUtils</dfn> {
- readonly attribute boolean <a href=#dom-navigator-cookieenabled id=manually-releasing-the-storage-mutex:dom-navigator-cookieenabled>cookieEnabled</a>;
- void <a href=#dom-navigator-yieldforstorageupdates id=manually-releasing-the-storage-mutex:dom-navigator-yieldforstorageupdates>yieldForStorageUpdates</a>();
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=manually-releasing-the-storage-mutex:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=manually-releasing-the-storage-mutex:dom-navigator-cookieenabled-2><a href=#dom-navigator-cookieenabled>cookieEnabled</a></code><dd>
- <p>Returns false if setting a cookie will be ignored, and true otherwise.</p>
- <dt><var>window</var> . <code id=manually-releasing-the-storage-mutex:dom-navigator-2><a href=#dom-navigator>navigator</a></code> . <code id=manually-releasing-the-storage-mutex:dom-navigator-yieldforstorageupdates-2><a href=#dom-navigator-yieldforstorageupdates>yieldForStorageUpdates</a></code>()<dd>
- <p>If a script uses the <code id=manually-releasing-the-storage-mutex:dom-document-cookie><a href=#dom-document-cookie>document.cookie</a></code> API, or the
- <code id=manually-releasing-the-storage-mutex:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> API, the browser will block other scripts
- from accessing cookies or storage until the first script finishes.</p>
- <p>Calling the <code id=manually-releasing-the-storage-mutex:dom-navigator-yieldforstorageupdates-3><a href=#dom-navigator-yieldforstorageupdates>navigator.yieldForStorageUpdates()</a></code> method
- tells the user agent to unblock any other scripts that may be blocked, even though the script
- hasn't returned.</p>
- <p>Values of cookies and items in the <code id=manually-releasing-the-storage-mutex:storage-2><a href=#storage-2>Storage</a></code> objects of <code id=manually-releasing-the-storage-mutex:dom-localstorage-2><a href=#dom-localstorage>localStorage</a></code> attributes can change after calling this method,
- whence its name.</p>
- </dl>
-
- <p>The <dfn id=dom-navigator-cookieenabled><code>cookieEnabled</code></dfn> attribute must
- return true if the user agent attempts to handle cookies according to the cookie specification,
- and false if it ignores cookie change requests. <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p>The <dfn id=dom-navigator-yieldforstorageupdates><code>yieldForStorageUpdates()</code></dfn> method,
- when invoked, must, if the <a href=#storage-mutex id=manually-releasing-the-storage-mutex:storage-mutex>storage mutex</a> is owned by the <a href=#event-loop id=manually-releasing-the-storage-mutex:event-loop>event loop</a> of
- the <a href=#concept-task id=manually-releasing-the-storage-mutex:concept-task>task</a> that resulted in the method being called, release the
- <a href=#storage-mutex id=manually-releasing-the-storage-mutex:storage-mutex-2>storage mutex</a> so that it is once again free. Otherwise, it must do nothing.</p>
-
- <h5 id=plugins-2>8.6.1.5 Plugins</h5>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=navigatorplugins>NavigatorPlugins</dfn> {
- readonly attribute <a href=#pluginarray id=plugins-2:pluginarray>PluginArray</a> <a href=#dom-navigator-plugins id=plugins-2:dom-navigator-plugins>plugins</a>;
- readonly attribute <a href=#mimetypearray id=plugins-2:mimetypearray>MimeTypeArray</a> <a href=#dom-navigator-mimetypes id=plugins-2:dom-navigator-mimetypes>mimeTypes</a>;
- readonly attribute boolean <a href=#dom-navigator-javaenabled id=plugins-2:dom-navigator-javaenabled>javaEnabled</a>;
- };
- interface <dfn id=pluginarray>PluginArray</dfn> {
- void <a href=#dom-pluginarray-refresh id=plugins-2:dom-pluginarray-refresh>refresh</a>(optional boolean reload = false);
- readonly attribute unsigned long <a href=#dom-pluginarray-length id=plugins-2:dom-pluginarray-length>length</a>;
- getter <a href=#dom-plugin id=plugins-2:dom-plugin>Plugin</a>? <a href=#dom-pluginarray-item id=plugins-2:dom-pluginarray-item>item</a>(unsigned long index);
- getter <a href=#dom-plugin id=plugins-2:dom-plugin-2>Plugin</a>? <a href=#dom-pluginarray-nameditem id=plugins-2:dom-pluginarray-nameditem>namedItem</a>(DOMString name);
- };
- interface <dfn id=mimetypearray>MimeTypeArray</dfn> {
- readonly attribute unsigned long <a href=#dom-mimetypearray-length id=plugins-2:dom-mimetypearray-length>length</a>;
- getter <a href=#mimetype id=plugins-2:mimetype>MimeType</a>? <a href=#dom-mimetypearray-item id=plugins-2:dom-mimetypearray-item>item</a>(unsigned long index);
- getter <a href=#mimetype id=plugins-2:mimetype-2>MimeType</a>? <a href=#dom-mimetypearray-nameditem id=plugins-2:dom-mimetypearray-nameditem>namedItem</a>(DOMString name);
- };
- interface <dfn id=dom-plugin>Plugin</dfn> {
- readonly attribute DOMString <a href=#dom-plugin-name id=plugins-2:dom-plugin-name>name</a>;
- readonly attribute DOMString <a href=#dom-plugin-description id=plugins-2:dom-plugin-description>description</a>;
- readonly attribute DOMString <a href=#dom-plugin-filename id=plugins-2:dom-plugin-filename>filename</a>;
- readonly attribute unsigned long <a href=#dom-plugin-length id=plugins-2:dom-plugin-length>length</a>;
- getter <a href=#mimetype id=plugins-2:mimetype-3>MimeType</a>? <a href=#dom-plugin-item id=plugins-2:dom-plugin-item>item</a>(unsigned long index);
- getter <a href=#mimetype id=plugins-2:mimetype-4>MimeType</a>? <a href=#dom-plugin-nameditem id=plugins-2:dom-plugin-nameditem>namedItem</a>(DOMString name);
- };
- interface <dfn id=mimetype>MimeType</dfn> {
- readonly attribute DOMString <a href=#dom-mimetype-type id=plugins-2:dom-mimetype-type>type</a>;
- readonly attribute DOMString <a href=#dom-mimetype-description id=plugins-2:dom-mimetype-description>description</a>;
- readonly attribute DOMString <a href=#dom-mimetype-suffixes id=plugins-2:dom-mimetype-suffixes>suffixes</a>; // comma-separated
- readonly attribute <a href=#dom-plugin id=plugins-2:dom-plugin-3>Plugin</a> <a href=#dom-mimetype-enabledplugin id=plugins-2:dom-mimetype-enabledplugin>enabledPlugin</a>;
- };</pre>
- <dl class=domintro><dt><var>window</var> . <code id=plugins-2:dom-navigator><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-2><a href=#dom-navigator-plugins>plugins</a></code> . <code id=plugins-2:dom-pluginarray-refresh-2><a href=#dom-pluginarray-refresh>refresh</a></code>( [ <var>refresh</var> ] )<dd>
- <p>Updates the lists of supported plugins and MIME types for this page, and reloads the page if the lists have changed.</p>
-
- <dt><var>window</var> . <code id=plugins-2:dom-navigator-2><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-3><a href=#dom-navigator-plugins>plugins</a></code> . <code id=plugins-2:dom-pluginarray-length-2><a href=#dom-pluginarray-length>length</a></code><dd>
- <p>Returns the number of plugins, represented by <code id=plugins-2:dom-plugin-4><a href=#dom-plugin>Plugin</a></code> objects, that the user agent reports.</p>
- <dt><var>plugin</var> = <var>window</var> . <code id=plugins-2:dom-navigator-3><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-4><a href=#dom-navigator-plugins>plugins</a></code> . <code id=plugins-2:dom-pluginarray-item-2><a href=#dom-pluginarray-item>item</a></code>(<var>index</var>)<dt><var>window</var> . <code id=plugins-2:dom-navigator-4><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-5><a href=#dom-navigator-plugins>plugins</a></code>[<var>index</var>]<dd>
- <p>Returns the specified <code id=plugins-2:dom-plugin-5><a href=#dom-plugin>Plugin</a></code> object.</p>
- <dt><var>plugin</var> = <var>window</var> . <code id=plugins-2:dom-navigator-5><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-6><a href=#dom-navigator-plugins>plugins</a></code> . <code id=plugins-2:dom-pluginarray-item-3><a href=#dom-pluginarray-item>item</a></code>(<var>name</var>)<dt><var>window</var> . <code id=plugins-2:dom-navigator-6><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-plugins-7><a href=#dom-navigator-plugins>plugins</a></code>[<var>name</var>]<dd>
- <p>Returns the <code id=plugins-2:dom-plugin-6><a href=#dom-plugin>Plugin</a></code> object for the plugin with the given name.</p>
- <dt><var>window</var> . <code id=plugins-2:dom-navigator-7><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-mimetypes-2><a href=#dom-navigator-mimetypes>mimeTypes</a></code> . <code id=plugins-2:dom-mimetypearray-length-2><a href=#dom-mimetypearray-length>length</a></code><dd>
- <p>Returns the number of MIME types, represented by <code id=plugins-2:mimetype-5><a href=#mimetype>MimeType</a></code> objects, supported by the plugins that the user agent reports.</p>
- <dt><var>mimeType</var> = <var>window</var> . <code id=plugins-2:dom-navigator-8><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-mimetypes-3><a href=#dom-navigator-mimetypes>mimeTypes</a></code> . <code id=plugins-2:dom-mimetypearray-item-2><a href=#dom-mimetypearray-item>item</a></code>(<var>index</var>)<dt><var>window</var> . <code id=plugins-2:dom-navigator-9><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-mimetypes-4><a href=#dom-navigator-mimetypes>mimeTypes</a></code>[<var>index</var>]<dd>
- <p>Returns the specified <code id=plugins-2:mimetype-6><a href=#mimetype>MimeType</a></code> object.</p>
- <dt><var>mimeType</var> = <var>window</var> . <code id=plugins-2:dom-navigator-10><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-mimetypes-5><a href=#dom-navigator-mimetypes>mimeTypes</a></code> . <code id=plugins-2:dom-mimetypearray-item-3><a href=#dom-mimetypearray-item>item</a></code>(<var>name</var>)<dt><var>window</var> . <code id=plugins-2:dom-navigator-11><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-mimetypes-6><a href=#dom-navigator-mimetypes>mimeTypes</a></code>[<var>name</var>]<dd>
- <p>Returns the <code id=plugins-2:mimetype-7><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
- <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-name-2><a href=#dom-plugin-name>name</a></code>
- <dd>
- <p>Returns the plugin's name.</p>
- <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-description-2><a href=#dom-plugin-description>description</a></code>
- <dd>
- <p>Returns the plugin's description.</p>
- <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-filename-2><a href=#dom-plugin-filename>filename</a></code>
- <dd>
- <p>Returns the plugin library's filename, if applicable on the current platform.</p>
- <dt><var>plugin</var> . <code id=plugins-2:dom-plugin-length-2><a href=#dom-plugin-length>length</a></code><dd>
- <p>Returns the number of MIME types, represented by <code id=plugins-2:mimetype-8><a href=#mimetype>MimeType</a></code> objects, supported by the plugin.</p>
- <dt><var>mimeType</var> = <var>plugin</var> . <code id=plugins-2:dom-plugin-item-2><a href=#dom-plugin-item>item</a></code>(<var>index</var>)<dt><var>plugin</var>[<var>index</var>]<dd>
- <p>Returns the specified <code id=plugins-2:mimetype-9><a href=#mimetype>MimeType</a></code> object.</p>
- <dt><var>mimeType</var> = <var>plugin</var> . <code id=plugins-2:dom-plugin-item-3><a href=#dom-plugin-item>item</a></code>(<var>name</var>)<dt><var>plugin</var>[<var>name</var>]<dd>
- <p>Returns the <code id=plugins-2:mimetype-10><a href=#mimetype>MimeType</a></code> object for the given MIME type.</p>
- <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-type-2><a href=#dom-mimetype-type>type</a></code>
- <dd>
- <p>Returns the MIME type.</p>
- <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-description-2><a href=#dom-mimetype-description>description</a></code>
- <dd>
- <p>Returns the MIME type's description.</p>
- <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-suffixes-2><a href=#dom-mimetype-suffixes>suffixes</a></code>
- <dd>
- <p>Returns the MIME type's typical file extensions, in a comma-separated list.</p>
- <dt><var>mimeType</var> . <code id=plugins-2:dom-mimetype-enabledplugin-2><a href=#dom-mimetype-enabledplugin>enabledPlugin</a></code>
- <dd>
- <p>Returns the <code id=plugins-2:dom-plugin-7><a href=#dom-plugin>Plugin</a></code> object that implements this MIME type.</p>
- <dt><var>window</var> . <code id=plugins-2:dom-navigator-12><a href=#dom-navigator>navigator</a></code> . <code id=plugins-2:dom-navigator-javaenabled-2><a href=#dom-navigator-javaenabled>javaEnabled</a></code><dd>
- <p>Returns true if there's a plugin that supports the MIME type "<code>application/x-java-vm</code>".</p>
- </dl>
-
- <p>The <dfn id=dom-navigator-plugins><code>navigator.plugins</code></dfn> attribute must
- return a <code id=plugins-2:pluginarray-2><a href=#pluginarray>PluginArray</a></code> object. The same object must be returned each time.</p>
- <p>The <dfn id=dom-navigator-mimetypes><code>navigator.mimeTypes</code></dfn> attribute must
- return a <code id=plugins-2:mimetypearray-2><a href=#mimetypearray>MimeTypeArray</a></code> object. The same object must be returned each time.</p>
- <hr>
- <p>A <code id=plugins-2:pluginarray-3><a href=#pluginarray>PluginArray</a></code> object represents none, some, or all of the <a href=#plugin id=plugins-2:plugin>plugins</a> supported by the user agent, each of which is represented by a <code id=plugins-2:dom-plugin-8><a href=#dom-plugin>Plugin</a></code> object. Each of these <code id=plugins-2:dom-plugin-9><a href=#dom-plugin>Plugin</a></code>
- objects may be <dfn id=hidden-plugin>hidden plugins</dfn>. A <a href=#hidden-plugin id=plugins-2:hidden-plugin>hidden plugin</a> can't
- be enumerated, but can still be inspected by using its name.</p>
- <p class=note>The fewer <a href=#plugin id=plugins-2:plugin-2>plugins</a> are represented by the
- <code id=plugins-2:pluginarray-4><a href=#pluginarray>PluginArray</a></code> object, and of those, the more that are <a href=#hidden-plugin id=plugins-2:hidden-plugin-2>hidden</a>, the more the user's privacy will be protected. Each exposed plugin
- increases the number of bits that can be derived for fingerprinting. Hiding a plugin helps, but
- unless it is an extremely rare plugin, it is likely that a site attempting to derive the list of
- plugins can still determine whether the plugin is supported or not by probing for it by name (the
- names of popular plugins are widely known). Therefore not exposing a plugin at all is preferred.
- Unfortunately, many legacy sites use this feature to determine, for example, which plugin to use
- to play video. Not exposing any plugins at all might therefore not be entirely plausible.</p>
- <p>The <code id=plugins-2:pluginarray-5><a href=#pluginarray>PluginArray</a></code> objects created by a user agent must not be <a href=#live id=plugins-2:live>live</a>. The
- set of plugins represented by the objects must not change once an object is created, except when
- it is updated by the <code id=plugins-2:dom-pluginarray-refresh-3><a href=#dom-pluginarray-refresh>refresh()</a></code> method.</p>
- <p>Each <a href=#plugin id=plugins-2:plugin-3>plugin</a> represented by a <code id=plugins-2:pluginarray-6><a href=#pluginarray>PluginArray</a></code> can support a number of
- <a href=#mime-type id=plugins-2:mime-type>MIME types</a>. For each such <a href=#plugin id=plugins-2:plugin-4>plugin</a>, the user agent must
- pick one or more of these <a href=#mime-type id=plugins-2:mime-type-2>MIME types</a> to be those that are
- <dfn id=explicitly-supported>explicitly supported</dfn>.</p>
- <p class=note>The <a href=#explicitly-supported id=plugins-2:explicitly-supported>explicitly supported</a> <a href=#mime-type id=plugins-2:mime-type-3>MIME types</a> of
- a <a href=#plugin id=plugins-2:plugin-5>plugin</a> are those that are exposed through the <code id=plugins-2:dom-plugin-10><a href=#dom-plugin>Plugin</a></code> and <code id=plugins-2:mimetypearray-3><a href=#mimetypearray>MimeTypeArray</a></code> interfaces. As with <a href=#plugin id=plugins-2:plugin-6>plugins</a> themselves, any variation between users regarding what is exposed
- allows sites to fingerprint users. User agents are therefore encouraged to expose the same <a href=#mime-type id=plugins-2:mime-type-4>MIME types</a> for all users of a <a href=#plugin id=plugins-2:plugin-7>plugin</a>, regardless of the
- actual types supported... at least, within the constraints imposed by compatibility with legacy
- content.</p>
- <p>The <a href=#supported-property-indices id=plugins-2:supported-property-indices>supported property indices</a> of a <code id=plugins-2:pluginarray-7><a href=#pluginarray>PluginArray</a></code> object are the
- numbers from zero to the number of non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-3>hidden</a> <a href=#plugin id=plugins-2:plugin-8>plugins</a> represented by the object, if any.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-pluginarray-length><code>length</code></dfn> attribute must return the
- number of non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-4>hidden</a> <a href=#plugin id=plugins-2:plugin-9>plugins</a>
- represented by the object.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-2 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-pluginarray-item><code>item()</code></dfn> method of a
- <code id=plugins-2:pluginarray-8><a href=#pluginarray>PluginArray</a></code> object must return null if the argument is not one of the object's
- <a href=#supported-property-indices id=plugins-2:supported-property-indices-2>supported property indices</a>, and otherwise must return the result of running the
- following steps, using the method's argument as <var>index</var>:</p>
- <ol><li><p>Let <var>list</var> be the <code id=plugins-2:dom-plugin-11><a href=#dom-plugin>Plugin</a></code> objects
- representing the non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-5>hidden</a> <a href=#plugin id=plugins-2:plugin-10>plugins</a> represented by the <code id=plugins-2:pluginarray-9><a href=#pluginarray>PluginArray</a></code> object.<li><p>Sort <var>list</var> alphabetically by the <code id=plugins-2:dom-plugin-name-3><a href=#dom-plugin-name>name</a></code> of each <code id=plugins-2:dom-plugin-12><a href=#dom-plugin>Plugin</a></code>.<li><p>Return the <var>index</var>th entry in <var>list</var>.</ol>
- <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-3 class=no-backref>for
- privacy</a> that the order of plugins not leak additional information, e.g. the order in which
- plugins were installed.</p>
- <p>The <a href=#supported-property-names id=plugins-2:supported-property-names>supported property names</a> of a <code id=plugins-2:pluginarray-10><a href=#pluginarray>PluginArray</a></code> object are the values
- of the <code id=plugins-2:dom-plugin-name-4><a href=#dom-plugin-name>name</a></code> attributes of all the <code id=plugins-2:dom-plugin-13><a href=#dom-plugin>Plugin</a></code> objects represented by the <code id=plugins-2:pluginarray-11><a href=#pluginarray>PluginArray</a></code> object. The
- properties exposed in this way must be <a href=#unenumerable id=plugins-2:unenumerable>unenumerable</a>.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-4 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-pluginarray-nameditem><code>namedItem()</code></dfn> method of a
- <code id=plugins-2:pluginarray-12><a href=#pluginarray>PluginArray</a></code> object must return null if the argument is not one of the object's
- <a href=#supported-property-names id=plugins-2:supported-property-names-2>supported property names</a>, and otherwise must return the <code id=plugins-2:dom-plugin-14><a href=#dom-plugin>Plugin</a></code> object, of those represented by the <code id=plugins-2:pluginarray-13><a href=#pluginarray>PluginArray</a></code>
- object, that has a <code id=plugins-2:dom-plugin-name-5><a href=#dom-plugin-name>name</a></code> equal to the method's argument.</p>
- <p>The <dfn id=dom-pluginarray-refresh><code>refresh()</code></dfn> method of the
- <code id=plugins-2:pluginarray-14><a href=#pluginarray>PluginArray</a></code> object of a <code id=plugins-2:navigator><a href=#navigator>Navigator</a></code> object, when invoked, must check to
- see if any <a href=#plugin id=plugins-2:plugin-11>plugins</a> have been installed or reconfigured since the user
- agent created the <code id=plugins-2:pluginarray-15><a href=#pluginarray>PluginArray</a></code> object. If so, and the method's argument is true, then
- the user agent must act as if the <code id=plugins-2:dom-location-reload><a href=#dom-location-reload>location.reload()</a></code>
- method was called instead. Otherwise, the user agent must update the <code id=plugins-2:pluginarray-16><a href=#pluginarray>PluginArray</a></code>
- object and <code id=plugins-2:mimetypearray-4><a href=#mimetypearray>MimeTypeArray</a></code> object created for attributes of that <code id=plugins-2:navigator-2><a href=#navigator>Navigator</a></code>
- object, and the <code id=plugins-2:dom-plugin-15><a href=#dom-plugin>Plugin</a></code> and <code id=plugins-2:mimetype-11><a href=#mimetype>MimeType</a></code> objects created
- for those <code id=plugins-2:pluginarray-17><a href=#pluginarray>PluginArray</a></code> and <code id=plugins-2:mimetypearray-5><a href=#mimetypearray>MimeTypeArray</a></code> objects, using the same <code id=plugins-2:dom-plugin-16><a href=#dom-plugin>Plugin</a></code> objects for cases where the <code id=plugins-2:dom-plugin-name-6><a href=#dom-plugin-name>name</a></code> is the same, and the same <code id=plugins-2:mimetype-12><a href=#mimetype>MimeType</a></code> objects for
- cases where the <code id=plugins-2:dom-mimetype-type-3><a href=#dom-mimetype-type>type</a></code> is the same, and creating new objects
- for cases where there were no matching objects immediately prior to the <code id=plugins-2:dom-pluginarray-refresh-4><a href=#dom-pluginarray-refresh>refresh()</a></code> call. Old <code id=plugins-2:dom-plugin-17><a href=#dom-plugin>Plugin</a></code>
- and <code id=plugins-2:mimetype-13><a href=#mimetype>MimeType</a></code> objects must continue to return the same values that they had prior to
- the update, though naturally now the data is stale and may appear inconsistent (for example, an
- old <code id=plugins-2:mimetype-14><a href=#mimetype>MimeType</a></code> entry might list as its <code id=plugins-2:dom-mimetype-enabledplugin-3><a href=#dom-mimetype-enabledplugin>enabledPlugin</a></code> a <code id=plugins-2:dom-plugin-18><a href=#dom-plugin>Plugin</a></code>
- object that no longer lists that <code id=plugins-2:mimetype-15><a href=#mimetype>MimeType</a></code> as a supported <code id=plugins-2:mimetype-16><a href=#mimetype>MimeType</a></code>).</p>
- <hr>
- <p>A <code id=plugins-2:mimetypearray-6><a href=#mimetypearray>MimeTypeArray</a></code> object represents the <a href=#mime-type id=plugins-2:mime-type-5>MIME types</a>
- <a href=#explicitly-supported id=plugins-2:explicitly-supported-2>explicitly supported</a> by <a href=#plugin id=plugins-2:plugin-12>plugins</a> supported by the user
- agent, each of which is represented by a <code id=plugins-2:mimetype-17><a href=#mimetype>MimeType</a></code> object.</p>
- <p>The <code id=plugins-2:mimetypearray-7><a href=#mimetypearray>MimeTypeArray</a></code> objects created by a user agent must not be <a href=#live id=plugins-2:live-2>live</a>.
- The set of MIME types represented by the objects must not change once an object is created, except
- when it is updated by the <code id=plugins-2:pluginarray-18><a href=#pluginarray>PluginArray</a></code> object's <code id=plugins-2:dom-pluginarray-refresh-5><a href=#dom-pluginarray-refresh>refresh()</a></code> method.</p>
- <p>The <a href=#supported-property-indices id=plugins-2:supported-property-indices-3>supported property indices</a> of a <code id=plugins-2:mimetypearray-8><a href=#mimetypearray>MimeTypeArray</a></code> object are the
- numbers from zero to the number of <a href=#mime-type id=plugins-2:mime-type-6>MIME types</a> <a href=#explicitly-supported id=plugins-2:explicitly-supported-3>explicitly
- supported</a> by non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-6>hidden</a> <a href=#plugin id=plugins-2:plugin-13>plugins</a> represented by the corresponding <code id=plugins-2:pluginarray-19><a href=#pluginarray>PluginArray</a></code> object, if
- any.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-5 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-mimetypearray-length><code>length</code></dfn> attribute must return the
- number of <a href=#mime-type id=plugins-2:mime-type-7>MIME types</a> <a href=#explicitly-supported id=plugins-2:explicitly-supported-4>explicitly supported</a> by non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-7>hidden</a> <a href=#plugin id=plugins-2:plugin-14>plugins</a> represented by the
- corresponding <code id=plugins-2:pluginarray-20><a href=#pluginarray>PluginArray</a></code> object, if any.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-6 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-mimetypearray-item><code>item()</code></dfn> method of a
- <code id=plugins-2:mimetypearray-9><a href=#mimetypearray>MimeTypeArray</a></code> object must return null if the argument is not one of the object's
- <a href=#supported-property-indices id=plugins-2:supported-property-indices-4>supported property indices</a>, and otherwise must return the result of running the
- following steps, using the method's argument as <var>index</var>:</p>
- <ol><li><p>Let <var>list</var> be the <code id=plugins-2:mimetype-18><a href=#mimetype>MimeType</a></code> objects representing the <a href=#mime-type id=plugins-2:mime-type-8>MIME types</a> <a href=#explicitly-supported id=plugins-2:explicitly-supported-5>explicitly supported</a> by non-<a href=#hidden-plugin id=plugins-2:hidden-plugin-8>hidden</a> <a href=#plugin id=plugins-2:plugin-15>plugins</a> represented by the corresponding
- <code id=plugins-2:pluginarray-21><a href=#pluginarray>PluginArray</a></code> object, if any.<li><p>Sort <var>list</var> alphabetically by the <code id=plugins-2:dom-mimetype-type-4><a href=#dom-mimetype-type>type</a></code> of each <code id=plugins-2:mimetype-19><a href=#mimetype>MimeType</a></code>.<li><p>Return the <var>index</var>th entry in <var>list</var>.</ol>
- <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-7 class=no-backref>for
- privacy</a> that the order of MIME types not leak additional information, e.g. the order in
- which plugins were installed.</p>
- <p>The <a href=#supported-property-names id=plugins-2:supported-property-names-3>supported property names</a> of a <code id=plugins-2:mimetypearray-10><a href=#mimetypearray>MimeTypeArray</a></code> object are the values
- of the <code id=plugins-2:dom-mimetype-type-5><a href=#dom-mimetype-type>type</a></code> attributes of all the <code id=plugins-2:mimetype-20><a href=#mimetype>MimeType</a></code>
- objects represented by the <code id=plugins-2:mimetypearray-11><a href=#mimetypearray>MimeTypeArray</a></code> object. The properties exposed in this way
- must be <a href=#unenumerable id=plugins-2:unenumerable-2>unenumerable</a>.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-8 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-mimetypearray-nameditem><code>namedItem()</code></dfn> method of a
- <code id=plugins-2:mimetypearray-12><a href=#mimetypearray>MimeTypeArray</a></code> object must return null if the argument is not one of the object's
- <a href=#supported-property-names id=plugins-2:supported-property-names-4>supported property names</a>, and otherwise must return the <code id=plugins-2:mimetype-21><a href=#mimetype>MimeType</a></code> object
- that has a <code id=plugins-2:dom-mimetype-type-6><a href=#dom-mimetype-type>type</a></code> equal to the method's argument.</p>
- <hr>
- <p>A <code id=plugins-2:dom-plugin-19><a href=#dom-plugin>Plugin</a></code> object represents a <a href=#plugin id=plugins-2:plugin-16>plugin</a>. It has
- several attributes to provide details about the plugin, and can be enumerated to obtain the list
- of <a href=#mime-type id=plugins-2:mime-type-9>MIME types</a> that it <a href=#explicitly-supported id=plugins-2:explicitly-supported-6>explicitly
- supports</a>.</p>
- <p>The <code id=plugins-2:dom-plugin-20><a href=#dom-plugin>Plugin</a></code> objects created by a user agent must not be
- <a href=#live id=plugins-2:live-3>live</a>. The set of MIME types represented by the objects, and the values of the
- objects' attributes, must not change once an object is created, except when updated by the
- <code id=plugins-2:pluginarray-22><a href=#pluginarray>PluginArray</a></code> object's <code id=plugins-2:dom-pluginarray-refresh-6><a href=#dom-pluginarray-refresh>refresh()</a></code>
- method.</p>
- <p>The <dfn id=reported-mime-types>reported MIME types</dfn> for a <code id=plugins-2:dom-plugin-21><a href=#dom-plugin>Plugin</a></code> object are the
- <a href=#mime-type id=plugins-2:mime-type-10>MIME types</a> <a href=#explicitly-supported id=plugins-2:explicitly-supported-7>explicitly supported</a> by the corresponding
- <a href=#plugin id=plugins-2:plugin-17>plugin</a> when this object was last created or updated by <code id=plugins-2:dom-pluginarray-refresh-7><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code>, whichever happened most
- recently.</p>
- <p>The <a href=#supported-property-indices id=plugins-2:supported-property-indices-5>supported property indices</a> of a <code id=plugins-2:dom-plugin-22><a href=#dom-plugin>Plugin</a></code> object
- are the numbers from zero to the number of <a href=#reported-mime-types id=plugins-2:reported-mime-types>reported MIME types</a>.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-9 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-plugin-length><code>length</code></dfn> attribute must return the number
- of <a href=#reported-mime-types id=plugins-2:reported-mime-types-2>reported MIME types</a>.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-10 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-plugin-item><code>item()</code></dfn> method of a <code id=plugins-2:dom-plugin-23><a href=#dom-plugin>Plugin</a></code> object must return null if the argument is not one of the
- object's <a href=#supported-property-indices id=plugins-2:supported-property-indices-6>supported property indices</a>, and otherwise must return the result of running
- the following steps, using the method's argument as <var>index</var>:</p>
- <ol><li><p>Let <var>list</var> be the <code id=plugins-2:mimetype-22><a href=#mimetype>MimeType</a></code> objects representing the
- <a href=#reported-mime-types id=plugins-2:reported-mime-types-3>reported MIME types</a>.<li><p>Sort <var>list</var> alphabetically by the <code id=plugins-2:dom-mimetype-type-7><a href=#dom-mimetype-type>type</a></code> of each <code id=plugins-2:mimetype-23><a href=#mimetype>MimeType</a></code>.<li><p>Return the <var>index</var>th entry in <var>list</var>.</ol>
- <p class=note>It is important <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-11 class=no-backref>for
- privacy</a> that the order of MIME types not leak additional information, e.g. the order in
- which plugins were installed.</p>
- <p>The <a href=#supported-property-names id=plugins-2:supported-property-names-5>supported property names</a> of a <code id=plugins-2:dom-plugin-24><a href=#dom-plugin>Plugin</a></code> object
- are the values of the <code id=plugins-2:dom-mimetype-type-8><a href=#dom-mimetype-type>type</a></code> attributes of the
- <code id=plugins-2:mimetype-24><a href=#mimetype>MimeType</a></code> objects representing the <a href=#reported-mime-types id=plugins-2:reported-mime-types-4>reported MIME types</a>. The properties
- exposed in this way must be <a href=#unenumerable id=plugins-2:unenumerable-3>unenumerable</a>.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-12 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>The <dfn id=dom-plugin-nameditem><code>namedItem()</code></dfn> method of a <code id=plugins-2:dom-plugin-25><a href=#dom-plugin>Plugin</a></code> object must return null if the argument is not one of the
- object's <a href=#supported-property-names id=plugins-2:supported-property-names-6>supported property names</a>, and otherwise must return the
- <code id=plugins-2:mimetype-25><a href=#mimetype>MimeType</a></code> object that has a <code id=plugins-2:dom-mimetype-type-9><a href=#dom-mimetype-type>type</a></code> equal to the
- method's argument.</p>
- <p>The <dfn id=dom-plugin-name><code>name</code></dfn> attribute must return the
- <a href=#plugin id=plugins-2:plugin-18>plugin</a>'s name.</p>
- <p>The <dfn id=dom-plugin-description><code>description</code></dfn> and <dfn id=dom-plugin-filename><code>filename</code></dfn> attributes must return user-agent-defined
- (or, in all likelihood, <a href=#plugin id=plugins-2:plugin-19>plugin</a>-defined) strings. In each case, the same string must
- be returned each time, except that the strings returned may change when the <code id=plugins-2:dom-pluginarray-refresh-8><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code> method updates the object.</p>
- <p class=warning>If the values returned by the <code id=plugins-2:dom-plugin-description-3><a href=#dom-plugin-description>description</a></code> or <code id=plugins-2:dom-plugin-filename-3><a href=#dom-plugin-filename>filename</a></code> attributes vary between versions of a
- <a href=#plugin id=plugins-2:plugin-20>plugin</a>, they can be used both as a fingerprinting vector and, even more importantly,
- as a trivial way to determine what security vulnerabilities a <a href=#plugin id=plugins-2:plugin-21>plugin</a> (and thus a
- browser) may have. It is thus highly recommended that the <code id=plugins-2:dom-plugin-description-4><a href=#dom-plugin-description>description</a></code> attribute just return the same value as the
- <code id=plugins-2:dom-plugin-name-7><a href=#dom-plugin-name>name</a></code> attribute, and that the <code id=plugins-2:dom-plugin-filename-4><a href=#dom-plugin-filename>filename</a></code> attribute return the empty string.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-13 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <hr>
- <p>A <code id=plugins-2:mimetype-26><a href=#mimetype>MimeType</a></code> object represents a <a href=#mime-type id=plugins-2:mime-type-11>MIME type</a> that is, or was,
- <a href=#explicitly-supported id=plugins-2:explicitly-supported-8>explicitly supported</a> by a <a href=#plugin id=plugins-2:plugin-22>plugin</a>.</p>
- <p>The <code id=plugins-2:mimetype-27><a href=#mimetype>MimeType</a></code> objects created by a user agent must not be <a href=#live id=plugins-2:live-4>live</a>. The
- values of the objects' attributes must not change once an object is created, except when updated
- by the <code id=plugins-2:pluginarray-23><a href=#pluginarray>PluginArray</a></code> object's <code id=plugins-2:dom-pluginarray-refresh-9><a href=#dom-pluginarray-refresh>refresh()</a></code>
- method.</p>
- <p>The <dfn id=dom-mimetype-type><code>type</code></dfn> attribute must return the
- <a href=#valid-mime-type-with-no-parameters id=plugins-2:valid-mime-type-with-no-parameters>valid MIME type with no parameters</a> describing the <a href=#mime-type id=plugins-2:mime-type-12>MIME type</a>.</p>
- <p>The <dfn id=dom-mimetype-description><code>description</code></dfn> and <dfn id=dom-mimetype-suffixes><code>suffixes</code></dfn> attributes must return
- user-agent-defined (or, in all likelihood, <a href=#plugin id=plugins-2:plugin-23>plugin</a>-defined) strings. In each case, the
- same string must be returned each time, except that the strings returned may change when the <code id=plugins-2:dom-pluginarray-refresh-10><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code> method updates the object.</p>
- <p class=warning>If the values returned by the <code id=plugins-2:dom-mimetype-description-3><a href=#dom-mimetype-description>description</a></code> or <code id=plugins-2:dom-mimetype-suffixes-3><a href=#dom-mimetype-suffixes>suffxies</a></code> attributes vary between versions of a
- <a href=#plugin id=plugins-2:plugin-24>plugin</a>, they can be used both as a fingerprinting vector and, even more importantly,
- as a trivial way to determine what security vulnerabilities a <a href=#plugin id=plugins-2:plugin-25>plugin</a> (and thus a
- browser) may have. It is thus highly recommended that the <code id=plugins-2:dom-mimetype-description-4><a href=#dom-mimetype-description>description</a></code> attribute just return the same value as the
- <code id=plugins-2:dom-mimetype-type-10><a href=#dom-mimetype-type>type</a></code> attribute, and that the <code id=plugins-2:dom-mimetype-suffixes-4><a href=#dom-mimetype-suffixes>suffixes</a></code> attribute return the empty string.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-14 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p class=note>Commas in the <code id=plugins-2:dom-mimetype-suffixes-5><a href=#dom-mimetype-suffixes>suffixes</a></code> attribute are
- interpreted as separating subsequent filename extensions, as in "<code>htm,html</code>".</p>
- <p>The <dfn id=dom-mimetype-enabledplugin><code>enabledPlugin</code></dfn> attribute must
- return the <code id=plugins-2:dom-plugin-26><a href=#dom-plugin>Plugin</a></code> object that represents the <a href=#plugin id=plugins-2:plugin-26>plugin</a>
- that <a href=#explicitly-supported id=plugins-2:explicitly-supported-9>explicitly supported</a> the <a href=#mime-type id=plugins-2:mime-type-13>MIME type</a> that this <code id=plugins-2:mimetype-28><a href=#mimetype>MimeType</a></code>
- object represents when this object was last created or updated by <code id=plugins-2:dom-pluginarray-refresh-11><a href=#dom-pluginarray-refresh>PluginArray.refresh()</a></code>, whichever happened most
- recently.</p>
- <hr>
- <p>The <dfn id=dom-navigator-javaenabled><code>navigator.javaEnabled</code></dfn> attribute
- must return true if the user agent supports a <a href=#plugin id=plugins-2:plugin-27>plugin</a> that supports the <a href=#mime-type id=plugins-2:mime-type-14>MIME
- type</a> "<code>application/x-java-vm</code>"; otherwise it must return false.
- <a href=#fingerprinting-vector id=plugins-2:fingerprinting-vector-15 class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
-
- <h4 id=the-external-interface>8.6.2 The <code id=the-external-interface:external><a href=#external>External</a></code> interface</h4>
-
- <p>The <dfn id=dom-external><code>external</code></dfn> attribute of the <code id=the-external-interface:window><a href=#window>Window</a></code>
- interface must return an instance of the <code id=the-external-interface:external-2><a href=#external>External</a></code> interface. The same object must be
- returned each time.</p>
-
- <pre class=idl>interface <dfn id=external>External</dfn> {
- void <a href=#dom-external-addsearchprovider id=the-external-interface:dom-external-addsearchprovider>AddSearchProvider</a>(DOMString engineURL);
- unsigned long <a href=#dom-external-issearchproviderinstalled id=the-external-interface:dom-external-issearchproviderinstalled>IsSearchProviderInstalled</a>(DOMString engineURL);
- };</pre>
- <p class=note>For historical reasons, members on this interface are capitalized.</p>
- <dl class=domintro><dt><var>window</var> . <code id=the-external-interface:dom-external><a href=#dom-external>external</a></code> . <code id=the-external-interface:dom-external-addsearchprovider-2><a href=#dom-external-addsearchprovider>AddSearchProvider</a></code>( <var>url</var> )<dd>
- <p>Adds the search engine described by the OpenSearch description document at <var>url</var>. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></p>
- <p>The OpenSearch description document has to be on the same server as the script that calls
- this method.</p>
- <dt><var>installed</var> = <var>window</var> . <code id=the-external-interface:dom-external-2><a href=#dom-external>external</a></code> . <code id=the-external-interface:dom-external-issearchproviderinstalled-2><a href=#dom-external-issearchproviderinstalled>IsSearchProviderInstalled</a></code>( <var>url</var> )<dd>
- <p>Returns a value based on comparing <var>url</var> to the URLs of the results pages
- of the installed search engines.</p>
- <dl><dt>0 <dd>None of the installed search engines match <var>url</var>.
- <dt>1 <dd>One or more installed search engines match <var>url</var>, but none are the user's default search engine.
- <dt>2 <dd>The user's default search engine matches <var>url</var>.
- </dl>
- <p>The <var>url</var> is compared to the URLs of the results pages of the installed
- search engines using a prefix match. Only results pages on the same domain as the script that
- calls this method are checked.</p>
- </dl>
- <p class=note>Another way of exposing search engines using OpenSearch description documents is
- using a <code id=the-external-interface:the-link-element><a href=#the-link-element>link</a></code> element with the <code id=the-external-interface:link-type-search><a href=#link-type-search>search</a></code> link type.</p>
-
- <p>The <dfn id=dom-external-addsearchprovider><code>AddSearchProvider()</code></dfn> method,
- when invoked, must run the following steps:</p>
- <ol><li><p>Optionally, abort these steps. User agents may implement the method as a stub method that
- never does anything, or may arbitrarily ignore invocations with particular arguments for
- security, privacy, or usability reasons.<li><p><a href=#resolve-a-url id=the-external-interface:resolve-a-url>Resolve</a> the value of the method's first argument
- relative to the <a href=#api-base-url id=the-external-interface:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=the-external-interface:entry-settings-object>entry settings
- object</a>.<li><p>If this fails, abort these steps.<li><p>Process the resulting <a href=#absolute-url id=the-external-interface:absolute-url>absolute URL</a> as the <a href=#url id=the-external-interface:url>URL</a> to an OpenSearch
- description document. <a href=#refsOPENSEARCH>[OPENSEARCH]</a></ol>
- <p>The <dfn id=dom-external-issearchproviderinstalled><code>IsSearchProviderInstalled()</code></dfn>
- method, when invoked, must run the following steps:
- <a href=#fingerprinting-vector id=the-external-interface:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <ol><li><p>Optionally, return 0 and abort these steps. User agents may implement the method as a
- stub method that never returns a non-zero value, or may arbitrarily ignore invocations with
- particular arguments for security, privacy, or usability reasons.<li><p>If the <a href=#origin-2 id=the-external-interface:origin-2>origin</a> specified by the <a href=#entry-settings-object id=the-external-interface:entry-settings-object-2>entry settings object</a> is an
- opaque identifier (i.e. it has no host component), then return 0 and abort these steps.<li><p>Let <var>host1</var> be the host component of the <a href=#origin-2 id=the-external-interface:origin-2-2>origin</a> specified
- by the <a href=#entry-settings-object id=the-external-interface:entry-settings-object-3>entry settings object</a>.<li><p><a href=#resolve-a-url id=the-external-interface:resolve-a-url-2>Resolve</a> the <var>scriptURL</var> argument
- relative to the <a href=#api-base-url id=the-external-interface:api-base-url-2>API base URL</a> specified by the <a href=#entry-settings-object id=the-external-interface:entry-settings-object-4>entry settings
- object</a>.<li><p>If this fails, return 0 and abort these steps.<li><p>Let <var>host2</var> be the <a href=#concept-url-host id=the-external-interface:concept-url-host>host</a> component
- of the resulting <a href=#parsed-url id=the-external-interface:parsed-url>parsed URL</a>.<li>
- <p>If the longest suffix in the Public Suffix List that matches the end of <var>host1</var> is different than the longest suffix in the Public Suffix List that
- matches the end of <var>host2</var>, then return 0 and abort these steps. <a href=#refsPSL>[PSL]</a></p>
- <p>If the next domain component of <var>host1</var> and <var>host2</var>
- after their common suffix are not the same, then return 0 and abort these steps.</p>
-
- <li><p>Let <var>search engines</var> be the list of search engines known by the user
- agent and made available to the user by the user agent for which the resulting <a href=#absolute-url id=the-external-interface:absolute-url-2>absolute
- URL</a> is a <a href=#prefix-match id=the-external-interface:prefix-match>prefix match</a> of the search engine's <a href=#url id=the-external-interface:url-2>URL</a>, if any. For
- search engines registered using OpenSearch description documents, the <a href=#url id=the-external-interface:url-3>URL</a> of the
- search engine corresponds to the URL given in a <code>Url</code> element whose <code>rel</code> attribute is "<code>results</code>" (the default). <a href=#refsOPENSEARCH>[OPENSEARCH]</a><li><p>If <var>search engines</var> is empty, return 0 and abort these steps.<li><p>If the user's default search engine (as determined by the user agent) is one of the
- search engines in <var>search engines</var>, then return 2 and abort these
- steps.<li><p>Return 1.</ol>
-
- <h3 id=images>8.7 Images</h3>
- <pre class=idl>[Exposed=(Window,Worker)]
- interface <dfn id=imagebitmap>ImageBitmap</dfn> {
- readonly attribute unsigned long <a href=#dom-imagebitmap-width id=images:dom-imagebitmap-width>width</a>;
- readonly attribute unsigned long <a href=#dom-imagebitmap-height id=images:dom-imagebitmap-height>height</a>;
- };
- typedef (<a href=#htmlimageelement id=images:htmlimageelement>HTMLImageElement</a> or
- <a href=#htmlvideoelement id=images:htmlvideoelement>HTMLVideoElement</a> or
- <a href=#htmlcanvaselement id=images:htmlcanvaselement>HTMLCanvasElement</a> or
- <a href=#blob id=images:blob>Blob</a> or
- <a href=#imagedata id=images:imagedata>ImageData</a> or
- <a href=#canvasrenderingcontext2d id=images:canvasrenderingcontext2d>CanvasRenderingContext2D</a> or
- <a href=#imagebitmap id=images:imagebitmap>ImageBitmap</a>) <dfn id=imagebitmapsource>ImageBitmapSource</dfn>;
- [NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=imagebitmapfactories>ImageBitmapFactories</dfn> {
- <a href=#promise id=images:promise>Promise</a> <a href=#dom-createimagebitmap id=images:dom-createimagebitmap>createImageBitmap</a>(<a href=#imagebitmapsource id=images:imagebitmapsource>ImageBitmapSource</a> image, optional long sx, long sy, long sw, long sh);
- };
- <a href=#window id=images:window>Window</a> implements <a href=#imagebitmapfactories id=images:imagebitmapfactories>ImageBitmapFactories</a>;
- <a href=#workerglobalscope id=images:workerglobalscope>WorkerGlobalScope</a> implements <a href=#imagebitmapfactories id=images:imagebitmapfactories-2>ImageBitmapFactories</a>;</pre>
- <p>An <code id=images:imagebitmap-2><a href=#imagebitmap>ImageBitmap</a></code> object represents a bitmap image that can be painted to a canvas
- without undue latency.</p>
- <p class=note>The exact judgement of what is undue latency of this is left up to the
- implementer, but in general if making use of the bitmap requires network I/O, or even local disk
- I/O, then the latency is probably undue; whereas if it only requires a blocking read from a GPU or
- system RAM, the latency is probably acceptable.</p>
- <dl class=domintro><dt><var>promise</var> = <var>Window</var> . <code id=images:dom-createimagebitmap-2><a href=#dom-createimagebitmap>createImageBitmap</a></code>(<var>image</var> [, <var>sx</var>, <var>sy</var>, <var>sw</var>, <var>sh</var> ] )<dd>
- <p>Takes <var>image</var>, which can be an <code id=images:the-img-element><a href=#the-img-element>img</a></code> element,
- <code id=images:the-video-element><a href=#the-video-element>video</a></code>, or <code id=images:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element, a <code id=images:blob-2><a href=#blob>Blob</a></code> object, an
- <code id=images:imagedata-2><a href=#imagedata>ImageData</a></code> object, a <code id=images:canvasrenderingcontext2d-2><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object, or another
- <code id=images:imagebitmap-3><a href=#imagebitmap>ImageBitmap</a></code> object, and returns a <code id=images:promise-2><a href=#promise>Promise</a></code> that is resolved when a
- new <code id=images:imagebitmap-4><a href=#imagebitmap>ImageBitmap</a></code> is created.</p>
- <p>If no <code id=images:imagebitmap-5><a href=#imagebitmap>ImageBitmap</a></code> object can be constructed, for example because the provided
- <var>image</var> data is not actually an image, then the promise is rejected instead.</p>
- <p>If <var>sx</var>, <var>sy</var>, <var>sw</var>, and <var>sh</var> arguments are provided, the source image is cropped to the given pixels, with
- any pixels missing in the original replaced by transparent black. These coordinates are in the
- source image's pixel coordinate space, <em>not</em> in CSS pixels.</p>
- <p>Throws an <code id=images:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception if the source image is not in a valid
- state (e.g. an <code id=images:the-img-element-2><a href=#the-img-element>img</a></code> element that hasn't finished loading, or a
- <code id=images:canvasrenderingcontext2d-3><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object whose bitmap data has zero length along one or both
- dimensions, or an <code id=images:imagedata-3><a href=#imagedata>ImageData</a></code> object whose data is <code id=images:dom-imagedata-data><a href=#dom-imagedata-data>data</a></code> attribute has been <a href=#concept-transferable-neutered id=images:concept-transferable-neutered>neutered</a>). Throws a <code id=images:securityerror><a href=#securityerror>SecurityError</a></code>
- exception if the script is not allowed to access the image data of the source image (e.g. a
- <code id=images:the-video-element-2><a href=#the-video-element>video</a></code> that is <a href=#cors-cross-origin id=images:cors-cross-origin>CORS-cross-origin</a>, or a <code id=images:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> being drawn
- on by a script in a worker from another <a href=#origin-2 id=images:origin-2>origin</a>).</p>
- <dt><var>imageBitmap</var> . <code id=images:dom-imagebitmap-width-2><a href=#dom-imagebitmap-width>width</a></code><dd>
- <p>Returns the intrinsic width of the image, in CSS pixels.</p>
- <dt><var>imageBitmap</var> . <code id=images:dom-imagebitmap-height-2><a href=#dom-imagebitmap-height>height</a></code><dd>
- <p>Returns the intrinsic height of the image, in CSS pixels.</p>
- </dl>
-
- <p>An <code id=images:imagebitmap-6><a href=#imagebitmap>ImageBitmap</a></code> object always has associated bitmap data, with a width and a
- height. However, it is possible for this data to be corrupted. If an <code id=images:imagebitmap-7><a href=#imagebitmap>ImageBitmap</a></code>
- object's media data can be decoded without errors, it is said to be <dfn id=concept-imagebitmap-good>fully decodable</dfn>.</p>
- <p>An <code id=images:imagebitmap-8><a href=#imagebitmap>ImageBitmap</a></code> object can be obtained from a variety of different objects, using
- the <dfn id=dom-createimagebitmap><code>createImageBitmap()</code></dfn> method. When invoked, the
- method must act as follows:</p>
-
- <dl><dt>If <var>image</var> is an <code id=images:the-img-element-3><a href=#the-img-element>img</a></code> element
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-img-element-4><a href=#the-img-element>img</a></code> element is not <a href=#img-all id=images:img-all>completely
- available</a>, then throw an <code id=images:invalidstateerror-2><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
- steps.<li><p>If the <a href=#origin-2 id=images:origin-2-2>origin</a> of the <code id=images:the-img-element-5><a href=#the-img-element>img</a></code> element's image is not the <a href=#same-origin id=images:same-origin>same
- origin</a> as the <a href=#origin-2 id=images:origin-2-3>origin</a> specified by the <a href=#entry-settings-object id=images:entry-settings-object>entry settings object</a>,
- then throw a <code id=images:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-img-element-6><a href=#the-img-element>img</a></code> element's media data is not a bitmap (e.g. it's a vector
- graphic), then throw an <code id=images:invalidstateerror-3><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these
- steps.<li><p>Create a new <code id=images:imagebitmap-9><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-10><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the <code id=images:the-img-element-7><a href=#the-img-element>img</a></code>
- element's media data, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle>cropped to the source rectangle</a>. If this is an animated
- image, the <code id=images:imagebitmap-11><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
- image of the animation (the one that the format defines is to be used when animation is not
- supported or is disabled), or, if there is no such image, the first frame of the
- animation.<li><p>Return a new <code id=images:promise-3><a href=#promise>Promise</a></code>, but continue running these steps
- asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill>Fulfill</a> the <code id=images:promise-4><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver>resolver</a>, with the new
- <code id=images:imagebitmap-12><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is a <code id=images:the-video-element-3><a href=#the-video-element>video</a></code> element
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-2><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-video-element-4><a href=#the-video-element>video</a></code> element's <code id=images:dom-media-networkstate><a href=#dom-media-networkstate>networkState</a></code> attribute is <code id=images:dom-media-network_empty><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code>, then throw an
- <code id=images:invalidstateerror-4><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If the <a href=#origin-2 id=images:origin-2-4>origin</a> of the <code id=images:the-video-element-5><a href=#the-video-element>video</a></code> element is not the <a href=#same-origin id=images:same-origin-2>same
- origin</a> as the <a href=#origin-2 id=images:origin-2-5>origin</a> specified by the <a href=#entry-settings-object id=images:entry-settings-object-2>entry settings object</a>,
- then throw a <code id=images:securityerror-3><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-video-element-6><a href=#the-video-element>video</a></code> element's <code id=images:dom-media-readystate><a href=#dom-media-readystate>readyState</a></code> attribute is either <code id=images:dom-media-have_nothing><a href=#dom-media-have_nothing>HAVE_NOTHING</a></code> or <code id=images:dom-media-have_metadata><a href=#dom-media-have_metadata>HAVE_METADATA</a></code>, then throw an
- <code id=images:invalidstateerror-5><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Create a new <code id=images:imagebitmap-13><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-14><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the frame at the
- <a href=#current-playback-position id=images:current-playback-position>current playback position</a>, at the <a href=#media-resource id=images:media-resource>media resource</a>'s <a href=#concept-video-intrinsic-width id=images:concept-video-intrinsic-width>intrinsic width</a> and <a href=#concept-video-intrinsic-height id=images:concept-video-intrinsic-height>intrinsic height</a> (i.e. after any aspect-ratio
- correction has been applied), <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-2>cropped to the source rectangle</a>.</p>
- <li><p>Return a new <code id=images:promise-5><a href=#promise>Promise</a></code>, but continue running these steps
- asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-2>Fulfill</a> the <code id=images:promise-6><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-2>resolver</a>, with the new
- <code id=images:imagebitmap-15><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is a <code id=images:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> element
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-3><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code> element's bitmap data does not have its <a href=#concept-canvas-origin-clean id=images:concept-canvas-origin-clean>origin-clean</a> flag set, then throw an
- <code id=images:invalidstateerror-6><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If the <code id=images:the-canvas-element-5><a href=#the-canvas-element>canvas</a></code> element's bitmap has either a horizontal dimension or a
- vertical dimension equal to zero, then throw an <code id=images:invalidstateerror-7><a href=#invalidstateerror>InvalidStateError</a></code> exception and
- abort these steps.<li><p>Create a new <code id=images:imagebitmap-16><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-17><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the
- <code id=images:the-canvas-element-6><a href=#the-canvas-element>canvas</a></code> element's bitmap data, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-3>cropped to the source
- rectangle</a>.<li><p>Return a new <code id=images:promise-7><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-3>Fulfill</a> the <code id=images:promise-8><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-3>resolver</a>, with the new
- <code id=images:imagebitmap-18><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is a <code id=images:blob-3><a href=#blob>Blob</a></code> object
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-4><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <code id=images:blob-4><a href=#blob>Blob</a></code> object has been disabled through the <code id=images:dom-blob-close><a href=#dom-blob-close>close()</a></code> method, then throw an <code id=images:invalidstateerror-8><a href=#invalidstateerror>InvalidStateError</a></code>
- exception and abort these steps.<li><p>Return a new <code id=images:promise-9><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.<li><p>Read the <code id=images:blob-5><a href=#blob>Blob</a></code> object's data. If an <a href=#file-error-read id=images:file-error-read>error
- occurs during reading of the object</a>, then <a href=#concept-resolver-reject id=images:concept-resolver-reject>reject</a> the <code id=images:promise-10><a href=#promise>Promise</a></code>'s associated <a href=#concept-resolver id=images:concept-resolver-4>resolver</a>, with null as the value, and abort these
- steps.<li><p>Apply the <a href=http://mimesniff.spec.whatwg.org/#rules-for-sniffing-images-specifically id=images:content-type-sniffing:-image data-x-internal=content-type-sniffing:-image>image sniffing rules</a> to
- determine the file format of the image data, with MIME type of the <code id=images:blob-6><a href=#blob>Blob</a></code> (as given
- by the <code id=images:blob-7><a href=#blob>Blob</a></code> object's <code id=images:dom-blob-type><a href=#dom-blob-type>type</a></code> attribute) giving the
- official type.<li><p>If the image data is not in a supported file format (e.g. it's not actually an image at
- all), or if the image data is corrupted in some fatal way such that the image dimensions cannot
- be obtained, then <a href=#concept-resolver-reject id=images:concept-resolver-reject-2>reject</a> the
- <code id=images:promise-11><a href=#promise>Promise</a></code>'s associated <a href=#concept-resolver id=images:concept-resolver-5>resolver</a>, with null as
- the value, and abort these steps.<li><p>Create a new <code id=images:imagebitmap-19><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-20><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data read from the
- <code id=images:blob-8><a href=#blob>Blob</a></code> object, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-4>cropped to the source rectangle</a>. If this is an animated
- image, the <code id=images:imagebitmap-21><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data must only be taken from the default
- image of the animation (the one that the format defines is to be used when animation is not
- supported or is disabled), or, if there is no such image, the first frame of the
- animation.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-4>Fulfill</a> the <code id=images:promise-12><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-6>resolver</a>, with the new
- <code id=images:imagebitmap-22><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is an <code id=images:imagedata-4><a href=#imagedata>ImageData</a></code> object
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-5><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <var>image</var> object's <code id=images:dom-imagedata-data-2><a href=#dom-imagedata-data>data</a></code>
- attribute has been <a href=#concept-transferable-neutered id=images:concept-transferable-neutered-2>neutered</a>, throw an
- <code id=images:invalidstateerror-9><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Create a new <code id=images:imagebitmap-23><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-24><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be the image data given by the
- <code id=images:imagedata-5><a href=#imagedata>ImageData</a></code> object, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-5>cropped to the source rectangle</a>.<li><p>Return a new <code id=images:promise-13><a href=#promise>Promise</a></code>, but continue running these steps asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-5>Fulfill</a> the <code id=images:promise-14><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-7>resolver</a>, with the new
- <code id=images:imagebitmap-25><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is a <code id=images:canvasrenderingcontext2d-4><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-6><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>If the <code id=images:canvasrenderingcontext2d-5><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=images:scratch-bitmap>scratch bitmap</a> does
- not have its <a href=#concept-canvas-origin-clean id=images:concept-canvas-origin-clean-2>origin-clean</a> flag set, then throw
- an <code id=images:invalidstateerror-10><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>If the <code id=images:canvasrenderingcontext2d-6><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=images:scratch-bitmap-2>scratch bitmap</a> has
- either a horizontal dimension or a vertical dimension equal to zero, then throw an
- <code id=images:invalidstateerror-11><a href=#invalidstateerror>InvalidStateError</a></code> exception and abort these steps.<li><p>Create a new <code id=images:imagebitmap-26><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-27><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the
- <code id=images:canvasrenderingcontext2d-7><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code> object's <a href=#scratch-bitmap id=images:scratch-bitmap-3>scratch bitmap</a>, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-6>cropped to
- the source rectangle</a>.<li><p>Return a new <code id=images:promise-15><a href=#promise>Promise</a></code>, but continue running these steps
- asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-6>Fulfill</a> the <code id=images:promise-16><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-8>resolver</a>, with the new
- <code id=images:imagebitmap-28><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- <dt>If <var>image</var> is an <code id=images:imagebitmap-29><a href=#imagebitmap>ImageBitmap</a></code> object
- <dd>
- <ol><li><p>If either the <var>sw</var> or <var>sh</var> arguments are specified
- but zero, throw an <code id=images:indexsizeerror-7><a href=#indexsizeerror>IndexSizeError</a></code> exception and abort these steps.<li><p>Create a new <code id=images:imagebitmap-30><a href=#imagebitmap>ImageBitmap</a></code> object.<li><p>Let the <code id=images:imagebitmap-31><a href=#imagebitmap>ImageBitmap</a></code> object's bitmap data be a copy of the <var>image</var> argument's bitmap data, <a href=#cropped-to-the-source-rectangle id=images:cropped-to-the-source-rectangle-7>cropped to the source
- rectangle</a>.<li><p>Return a new <code id=images:promise-17><a href=#promise>Promise</a></code>, but continue running these steps
- asynchronously.<li><p><a href=#concept-resolver-fulfill id=images:concept-resolver-fulfill-7>Fulfill</a> the <code id=images:promise-18><a href=#promise>Promise</a></code>'s
- associated <a href=#concept-resolver id=images:concept-resolver-9>resolver</a>, with the new
- <code id=images:imagebitmap-32><a href=#imagebitmap>ImageBitmap</a></code> object as the value.</ol>
- </dl>
- <p>When the steps above require that the user agent <dfn id=cropped-to-the-source-rectangle>crop bitmap data to the source rectangle</dfn>, the user agent must run the following
- steps:</p>
- <ol><li><p>Let <var>input</var> be the image data being cropped.<li><p>If the <var>sx</var>, <var>sy</var>, <var>sw</var>, and <var>sh</var> arguments are omitted, return <var>input</var>.<li><p>Place <var>input</var> on an infinite transparent black grid plane, positioned so
- that it's top left corner is at the origin of the plane, with the <var>x</var>-coordinate increasing to the right, and the <var>y</var>-coordinate
- increasing down, and with each pixel in the <var>input</var> image data occupying a cell
- on the plane's grid.<li>
- <p>Let <var>output</var> be the rectangle on the plane denoted by the rectangle whose
- corners are the four points (<var>sx</var>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>, <var>sy</var>), (<span><var>sx</var>+<var>sw</var></span>, <span><var>sy</var>+<var>sh</var></span>), (<var>sx</var>, <span><var>sy</var>+<var>sh</var></span>).</p>
- <p class=note>If either <var>sw</var> or <var>sh</var> are negative, then
- the top-left corner of this rectangle will be to the left or above the (<var>sx</var>,
- <var>sy</var>) point. If any of the pixels on this rectangle are outside the area where
- the <var>input</var> bitmap was placed, then they will be transparent black in <var>output</var>.</p>
- <li><p>Return <var>output</var>.</ol>
- <p>The <dfn id=dom-imagebitmap-width><code>width</code></dfn> attribute must return the
- <code id=images:imagebitmap-33><a href=#imagebitmap>ImageBitmap</a></code> object's width, in CSS pixels.</p>
- <p>The <dfn id=dom-imagebitmap-height><code>height</code></dfn> attribute must return the
- <code id=images:imagebitmap-34><a href=#imagebitmap>ImageBitmap</a></code> object's height, in CSS pixels.</p>
-
- <div class=example>
- <p>Using this API, a sprite sheet can be precut and prepared:</p>
- <pre>var sprites = {};
- function loadMySprites() {
- var image = new Image();
- image.src = 'mysprites.png';
- var resolver;
- var promise = new Promise(function (arg) { resolver = arg });
- image.onload = function () {
- resolver.resolve(Promise.every(
- createImageBitmap(image, 0, 0, 40, 40).then(function (image) { sprites.woman = image }),
- createImageBitmap(image, 40, 0, 40, 40).then(function (image) { sprites.man = image }),
- createImageBitmap(image, 80, 0, 40, 40).then(function (image) { sprites.tree = image }),
- createImageBitmap(image, 0, 40, 40, 40).then(function (image) { sprites.hut = image }),
- createImageBitmap(image, 40, 40, 40, 40).then(function (image) { sprites.apple = image }),
- createImageBitmap(image, 80, 40, 40, 40).then(function (image) { sprites.snake = image }),
- ));
- };
- return promise;
- }
- function runDemo() {
- var canvas = document.querySelector('canvas#demo');
- var context = canvas.getContext('2d');
- context.drawImage(sprites.tree, 30, 10);
- context.drawImage(sprites.snake, 70, 10);
- }
- loadMySprites().then(runDemo);</pre>
- </div>
- <h2 id=comms>9 Communication</h2>
- <h3 id=the-messageevent-interfaces>9.1 The <code id=the-messageevent-interfaces:messageevent><a href=#messageevent>MessageEvent</a></code> interfaces</h3>
- <p>Messages in <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events>server-sent events</a>, <a href=#network id=the-messageevent-interfaces:network>Web sockets</a>, <a href=#web-messaging id=the-messageevent-interfaces:web-messaging>cross-document
- messaging</a>, <a href=#channel-messaging id=the-messageevent-interfaces:channel-messaging>channel messaging</a>, and <a href=#broadcasting-to-other-browsing-contexts id=the-messageevent-interfaces:broadcasting-to-other-browsing-contexts>broadcast channels</a> use the
- <code id=the-messageevent-interfaces:messageevent-2><a href=#messageevent>MessageEvent</a></code> interface for their <code id=the-messageevent-interfaces:event-message><a href=#event-message>message</a></code>
- events:</p>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#messageeventinit id=the-messageevent-interfaces:messageeventinit>MessageEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=messageevent>MessageEvent</dfn> : <a href=#event id=the-messageevent-interfaces:event>Event</a> {
- readonly attribute any <a href=#dom-messageevent-data id=the-messageevent-interfaces:dom-messageevent-data>data</a>;
- readonly attribute DOMString <a href=#dom-messageevent-origin id=the-messageevent-interfaces:dom-messageevent-origin>origin</a>;
- readonly attribute DOMString <a href=#dom-messageevent-lasteventid id=the-messageevent-interfaces:dom-messageevent-lasteventid>lastEventId</a>;
- readonly attribute (<a href=#windowproxy id=the-messageevent-interfaces:windowproxy>WindowProxy</a> or <a href=#messageport id=the-messageevent-interfaces:messageport>MessagePort</a>)? <a href=#dom-messageevent-source id=the-messageevent-interfaces:dom-messageevent-source>source</a>;
- readonly attribute <a href=#messageport id=the-messageevent-interfaces:messageport-2>MessagePort</a>[]? <a href=#dom-messageevent-ports id=the-messageevent-interfaces:dom-messageevent-ports>ports</a>;
- void <a href=#dom-messageevent-initmessageevent id=the-messageevent-interfaces:dom-messageevent-initmessageevent>initMessageEvent</a>(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in any dataArg, in DOMString originArg, in DOMString lastEventIdArg, in (<a href=#windowproxy id=the-messageevent-interfaces:windowproxy-2>WindowProxy</a> or <a href=#messageport id=the-messageevent-interfaces:messageport-3>MessagePort</a>) sourceArg, in <a href=#messageport id=the-messageevent-interfaces:messageport-4>MessagePort</a>[]? portsArg);
- };
- dictionary <dfn id=messageeventinit>MessageEventInit</dfn> : <a href=#eventinit id=the-messageevent-interfaces:eventinit>EventInit</a> {
- any data;
- DOMString origin;
- DOMString lastEventId;
- (<a href=#windowproxy id=the-messageevent-interfaces:windowproxy-3>WindowProxy</a> or <a href=#messageport id=the-messageevent-interfaces:messageport-5>MessagePort</a>)? source;
- sequence<<a href=#messageport id=the-messageevent-interfaces:messageport-6>MessagePort</a>> ports;
- };</pre>
- <dl class=domintro><dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-data-2><a href=#dom-messageevent-data>data</a></code><dd>
- <p>Returns the data of the message.</p>
- <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-origin-2><a href=#dom-messageevent-origin>origin</a></code><dd>
- <p>Returns the origin of the message, for <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events-2>server-sent events</a> and
- <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-2>cross-document messaging</a>.</p>
- <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-lasteventid-2><a href=#dom-messageevent-lasteventid>lastEventId</a></code><dd>
- <p>Returns the <a href=#concept-event-stream-last-event-id id=the-messageevent-interfaces:concept-event-stream-last-event-id>last event ID string</a>, for
- <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events-3>server-sent events</a>.</p>
- <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-source-2><a href=#dom-messageevent-source>source</a></code><dd>
- <p>Returns the <code id=the-messageevent-interfaces:windowproxy-4><a href=#windowproxy>WindowProxy</a></code> of the source window, for <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-3>cross-document
- messaging</a>, and the <code id=the-messageevent-interfaces:messageport-7><a href=#messageport>MessagePort</a></code> being attached, in the <code id=the-messageevent-interfaces:event-workerglobalscope-connect><a href=#event-workerglobalscope-connect>connect</a></code> event fired at
- <code id=the-messageevent-interfaces:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> objects.</p>
- <dt><var>event</var> . <code id=the-messageevent-interfaces:dom-messageevent-ports-2><a href=#dom-messageevent-ports>ports</a></code><dd>
- <p>Returns the <code id=the-messageevent-interfaces:messageport-8><a href=#messageport>MessagePort</a></code> array sent with the message, for <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-4>cross-document
- messaging</a> and <a href=#channel-messaging id=the-messageevent-interfaces:channel-messaging-2>channel messaging</a>.</p>
- </dl>
-
- <p>The <dfn id=dom-messageevent-data><code>data</code></dfn> attribute must return the value
- it was initialised to. When the object is created, this attribute must be initialised to null. It
- represents the message being sent.</p>
- <p>The <dfn id=dom-messageevent-origin><code>origin</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to the
- empty string. It represents, in <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events-4>server-sent events</a> and <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-5>cross-document
- messaging</a>, the <a href=#origin-2 id=the-messageevent-interfaces:origin-2>origin</a> of the document that sent the message (typically the
- scheme, hostname, and port of the document, but not its path or fragment identifier).</p>
- <p>The <dfn id=dom-messageevent-lasteventid><code>lastEventId</code></dfn> attribute must
- return the value it was initialised to. When the object is created, this attribute must be
- initialised to the empty string. It represents, in <a href=#server-sent-events id=the-messageevent-interfaces:server-sent-events-5>server-sent events</a>, the <a href=#concept-event-stream-last-event-id id=the-messageevent-interfaces:concept-event-stream-last-event-id-2>last event ID string</a> of the event source.</p>
- <p>The <dfn id=dom-messageevent-source><code>source</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents, in <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-6>cross-document messaging</a>, the <code id=the-messageevent-interfaces:windowproxy-5><a href=#windowproxy>WindowProxy</a></code> of the
- <a href=#browsing-context id=the-messageevent-interfaces:browsing-context>browsing context</a> of the <code id=the-messageevent-interfaces:window><a href=#window>Window</a></code> object from which the message came; and
- in the <code id=the-messageevent-interfaces:event-workerglobalscope-connect-2><a href=#event-workerglobalscope-connect>connect</a></code> events used by <a href=#sharedworkerglobalscope id=the-messageevent-interfaces:sharedworkerglobalscope-2>shared workers</a>, the newly connecting
- <code id=the-messageevent-interfaces:messageport-9><a href=#messageport>MessagePort</a></code>.</p>
- <p>The <dfn id=dom-messageevent-ports><code>ports</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents, in
- <a href=#web-messaging id=the-messageevent-interfaces:web-messaging-7>cross-document messaging</a> and <a href=#channel-messaging id=the-messageevent-interfaces:channel-messaging-3>channel messaging</a>, the
- <code id=the-messageevent-interfaces:messageport-10><a href=#messageport>MessagePort</a></code> array being sent, if any.</p>
-
- <p>The <dfn id=dom-messageevent-initmessageevent><code>initMessageEvent()</code></dfn>
- method must initialise the event in a manner analogous to the similarly-named <code id=the-messageevent-interfaces:dom-event-initevent><a href=#dom-event-initevent>initEvent()</a></code> method. <a href=#refsDOM>[DOM]</a></p>
-
- <h3 id=server-sent-events>9.2 <dfn>Server-sent events</dfn></h3>
- <h4 id=server-sent-events-intro>9.2.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To enable servers to push data to Web pages over HTTP or using dedicated server-push protocols,
- this specification introduces the <code id=server-sent-events-intro:eventsource><a href=#eventsource>EventSource</a></code> interface.</p>
- <p>Using this API consists of creating an <code id=server-sent-events-intro:eventsource-2><a href=#eventsource>EventSource</a></code> object and registering an event
- listener.</p>
- <pre>var source = new EventSource('updates.cgi');
- source.onmessage = function (event) {
- alert(event.data);
- };</pre>
- <p>On the server-side, the script ("<code>updates.cgi</code>" in this case) sends
- messages in the following form, with the <code id=server-sent-events-intro:text/event-stream><a href=#text/event-stream>text/event-stream</a></code> MIME type:</p>
- <pre>data: This is the first message.
- data: This is the second message, it
- data: has two lines.
- data: This is the third message.</pre>
- <hr>
- <p>Authors can separate events by using different event types. Here is a stream that has two event
- types, "add" and "remove":</p>
- <pre>event: add
- data: 73857293
- event: remove
- data: 2153
- event: add
- data: 113411</pre>
- <p>The script to handle such a stream would look like this (where <code>addHandler</code>
- and <code>removeHandler</code> are functions that take one argument, the event):</p>
- <pre>var source = new EventSource('updates.cgi');
- source.addEventListener('add', addHandler, false);
- source.addEventListener('remove', removeHandler, false);</pre>
- <p>The default event type is "message".</p>
- <p>Event streams are always decoded as UTF-8. There is no way to specify another character
- encoding.</p>
- <hr>
- <p>Event stream requests can be redirected using HTTP 301 and 307 redirects as with normal HTTP
- requests. Clients will reconnect if the connection is closed; a client can be told to stop
- reconnecting using the HTTP 204 No Content response code.</p>
- <p>Using this API rather than emulating it using <code id=server-sent-events-intro:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code> or an
- <code id=server-sent-events-intro:the-iframe-element><a href=#the-iframe-element>iframe</a></code> allows the user agent to make better use of network resources in cases where
- the user agent implementor and the network operator are able to coordinate in advance. Amongst
- other benefits, this can result in significant savings in battery life on portable devices. This
- is discussed further in the section below on <a href=#eventsource-push>connectionless
- push</a>.</p>
- <h4 id=the-eventsource-interface>9.2.2 The <code id=the-eventsource-interface:eventsource><a href=#eventsource>EventSource</a></code> interface</h4>
- <pre class=idl>[<a href=#dom-eventsource id=the-eventsource-interface:dom-eventsource>Constructor</a>(DOMString url, optional <a href=#eventsourceinit id=the-eventsource-interface:eventsourceinit>EventSourceInit</a> eventSourceInitDict), Exposed=(Window,Worker)]
- interface <dfn id=eventsource>EventSource</dfn> : <a href=#eventtarget id=the-eventsource-interface:eventtarget>EventTarget</a> {
- readonly attribute DOMString <a href=#dom-eventsource-url id=the-eventsource-interface:dom-eventsource-url>url</a>;
- readonly attribute boolean <a href=#dom-eventsource-withcredentials id=the-eventsource-interface:dom-eventsource-withcredentials>withCredentials</a>;
- // ready state
- const unsigned short <a href=#dom-eventsource-connecting id=the-eventsource-interface:dom-eventsource-connecting>CONNECTING</a> = 0;
- const unsigned short <a href=#dom-eventsource-open id=the-eventsource-interface:dom-eventsource-open>OPEN</a> = 1;
- const unsigned short <a href=#dom-eventsource-closed id=the-eventsource-interface:dom-eventsource-closed>CLOSED</a> = 2;
- readonly attribute unsigned short <a href=#dom-eventsource-readystate id=the-eventsource-interface:dom-eventsource-readystate>readyState</a>;
- // networking
- attribute <a href=#eventhandler id=the-eventsource-interface:eventhandler>EventHandler</a> <a href=#handler-eventsource-onopen id=the-eventsource-interface:handler-eventsource-onopen>onopen</a>;
- attribute <a href=#eventhandler id=the-eventsource-interface:eventhandler-2>EventHandler</a> <a href=#handler-eventsource-onmessage id=the-eventsource-interface:handler-eventsource-onmessage>onmessage</a>;
- attribute <a href=#eventhandler id=the-eventsource-interface:eventhandler-3>EventHandler</a> <a href=#handler-eventsource-onerror id=the-eventsource-interface:handler-eventsource-onerror>onerror</a>;
- void <a href=#dom-eventsource-close id=the-eventsource-interface:dom-eventsource-close>close</a>();
- };
- dictionary <dfn id=eventsourceinit>EventSourceInit</dfn> {
- boolean <dfn id=dom-eventsourceinit-withcredentials>withCredentials</dfn> = false;
- };</pre>
- <p>The <dfn id=dom-eventsource><code>EventSource()</code></dfn> constructor takes one or two
- arguments. The first specifies the <a href=#url id=the-eventsource-interface:url>URL</a> to which to connect. The second specifies the
- settings, if any, in the form of an <code id=the-eventsource-interface:eventsourceinit-2><a href=#eventsourceinit>EventSourceInit</a></code> dictionary. When the <code id=the-eventsource-interface:dom-eventsource-2><a href=#dom-eventsource>EventSource()</a></code> constructor is invoked, the UA must run these
- steps:</p>
- <ol><li><p><a href=#resolve-a-url id=the-eventsource-interface:resolve-a-url>Resolve</a> the <a href=#url id=the-eventsource-interface:url-2>URL</a> specified in the first
- argument, relative to the <a href=#api-base-url id=the-eventsource-interface:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=the-eventsource-interface:entry-settings-object>entry settings
- object</a>.<li><p>If the previous step failed, then throw a <code id=the-eventsource-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort
- these steps.<li><p>Create a new <code id=the-eventsource-interface:eventsource-2><a href=#eventsource>EventSource</a></code> object.<li><p>Let <var>CORS mode</var> be <a href=#attr-crossorigin-anonymous id=the-eventsource-interface:attr-crossorigin-anonymous>Anonymous</a>.<li><p>If the second argument is present, and the <code id=the-eventsource-interface:dom-eventsourceinit-withcredentials><a href=#dom-eventsourceinit-withcredentials>withCredentials</a></code> dictionary member has the
- value true, then set <var>CORS mode</var> to <a href=#attr-crossorigin-use-credentials id=the-eventsource-interface:attr-crossorigin-use-credentials>Use Credentials</a> and initialise the new
- <code id=the-eventsource-interface:eventsource-3><a href=#eventsource>EventSource</a></code> object's <code id=the-eventsource-interface:dom-eventsource-withcredentials-2><a href=#dom-eventsource-withcredentials>withCredentials</a></code> attribute to true.<li><p>Return the new <code id=the-eventsource-interface:eventsource-4><a href=#eventsource>EventSource</a></code> object, but continue these steps
- asynchronously.<li>
- <p>Do a <a href=#potentially-cors-enabled-fetch id=the-eventsource-interface:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the resulting <a href=#absolute-url id=the-eventsource-interface:absolute-url>absolute
- URL</a> using the <a href=#api-referrer-source id=the-eventsource-interface:api-referrer-source>API referrer source</a> specified by the <a href=#entry-settings-object id=the-eventsource-interface:entry-settings-object-2>entry settings
- object</a>, with the <i>mode</i> being <var>CORS mode</var>, and the <i>origin</i> being the <a href=#origin-2 id=the-eventsource-interface:origin-2>origin</a> specified by the <a href=#entry-settings-object id=the-eventsource-interface:entry-settings-object-3>entry settings
- object</a>, and process the resource obtained in
- this fashion, if any, as described below.</p>
- <p class=note>The definition of the <a href=#fetch id=the-eventsource-interface:fetch>fetching</a> algorithm (which is
- used by CORS) is such that if the browser is already fetching the resource identified by the
- given <a href=#absolute-url id=the-eventsource-interface:absolute-url-2>absolute URL</a>, that connection can be reused, instead of a new connection
- being established. All messages received up to this point are dispatched immediately, in this
- case.</p>
- </ol>
- <hr>
- <p>The <dfn id=dom-eventsource-url><code>url</code></dfn> attribute must return the
- <a href=#absolute-url id=the-eventsource-interface:absolute-url-3>absolute URL</a> that resulted from <a href=#resolve-a-url id=the-eventsource-interface:resolve-a-url-2>resolving</a> the
- value that was passed to the constructor.</p>
- <p>The <dfn id=dom-eventsource-withcredentials><code>withCredentials</code></dfn> attribute
- must return the value to which it was last initialized. When the object is created, it must be
- initialised to false.</p>
- <p>The <dfn id=dom-eventsource-readystate><code>readyState</code></dfn> attribute represents
- the state of the connection. It can have the following values:</p>
- <dl><dt><dfn id=dom-eventsource-connecting><code>CONNECTING</code></dfn> (numeric value 0)<dd>The connection has not yet been established, or it was closed and the user agent is
- reconnecting.<dt><dfn id=dom-eventsource-open><code>OPEN</code></dfn> (numeric value 1)<dd>The user agent has an open connection and is dispatching events as it receives them.<dt><dfn id=dom-eventsource-closed><code>CLOSED</code></dfn> (numeric value 2)<dd>The connection is not open, and the user agent is not trying to reconnect. Either there was a
- fatal error or the <code id=the-eventsource-interface:dom-eventsource-close-2><a href=#dom-eventsource-close>close()</a></code> method was invoked.</dl>
- <p>When the object is created its <code id=the-eventsource-interface:dom-eventsource-readystate-2><a href=#dom-eventsource-readystate>readyState</a></code> must
- be set to <code id=the-eventsource-interface:dom-eventsource-connecting-2><a href=#dom-eventsource-connecting>CONNECTING</a></code> (0). The rules given below
- for handling the connection define when the value changes.</p>
- <p>The <dfn id=dom-eventsource-close><code>close()</code></dfn> method must abort any
- instances of the <a href=#fetch id=the-eventsource-interface:fetch-2>fetch</a> algorithm started for this <code id=the-eventsource-interface:eventsource-5><a href=#eventsource>EventSource</a></code> object,
- and must set the <code id=the-eventsource-interface:dom-eventsource-readystate-3><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code id=the-eventsource-interface:dom-eventsource-closed-2><a href=#dom-eventsource-closed>CLOSED</a></code>.</p>
- <p>The following are the <a href=#event-handlers id=the-eventsource-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=the-eventsource-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=the-eventsource-interface:event-handler-idl-attributes>event
- handler IDL attributes</a>, by all objects implementing the <code id=the-eventsource-interface:eventsource-6><a href=#eventsource>EventSource</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=the-eventsource-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=the-eventsource-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-eventsource-onopen><code>onopen</code></dfn> <td> <code id=the-eventsource-interface:event-open><a href=#event-open>open</a></code>
- <tr><td><dfn id=handler-eventsource-onmessage><code>onmessage</code></dfn> <td> <code id=the-eventsource-interface:event-message><a href=#event-message>message</a></code>
- <tr><td><dfn id=handler-eventsource-onerror><code>onerror</code></dfn> <td> <code id=the-eventsource-interface:event-error><a href=#event-error>error</a></code>
- </table>
- <hr>
- <p>In addition to the above, each <code id=the-eventsource-interface:eventsource-7><a href=#eventsource>EventSource</a></code> object has the following associated
- with it:</p>
- <ul><li>A <dfn id=concept-event-stream-reconnection-time>reconnection time</dfn>, in
- milliseconds. This must initially be a user-agent-defined value, probably in the region of a few
- seconds.<li>A <dfn id=concept-event-stream-last-event-id>last event ID string</dfn>. This must
- initially be the empty string.</ul>
- <p>These values are not currently exposed on the interface.</p>
- <h4 id=processing-model-10>9.2.3 Processing model</h4>
- <p>The resource indicated in the argument to the <code id=processing-model-10:dom-eventsource><a href=#dom-eventsource>EventSource</a></code>
- constructor is <a href=#fetch id=processing-model-10:fetch>fetched</a> when the constructor is run.</p>
- <p>For HTTP connections, the <code id=processing-model-10:http-accept><a href=#http-accept>Accept</a></code> header may be included; if
- included, it must contain only formats of event framing that are supported by the user agent (one
- of which must be <code id=processing-model-10:text/event-stream><a href=#text/event-stream>text/event-stream</a></code>, as described below).</p>
- <p>If the event source's <a href=#concept-event-stream-last-event-id id=processing-model-10:concept-event-stream-last-event-id>last event ID
- string</a> is not the empty string, then a <code id=processing-model-10:last-event-id><a href=#last-event-id>Last-Event-ID</a></code> HTTP header must be included with the request,
- whose value is the value of the event source's <a href=#concept-event-stream-last-event-id id=processing-model-10:concept-event-stream-last-event-id-2>last event ID string</a>, encoded as UTF-8.</p>
- <p>User agents should use the <code id=processing-model-10:http-cache-control><a href=#http-cache-control>Cache-Control: no-cache</a></code>
- header in requests to bypass any caches for requests of event sources. (This header is not a <a href=#custom-request-headers id=processing-model-10:custom-request-headers>custom request header</a>, so the user agent will still use the
- CORS <a href=#simple-cross-origin-request id=processing-model-10:simple-cross-origin-request>simple cross-origin request</a> mechanism.) User agents should ignore HTTP cache
- headers in the response, never caching event sources.</p>
- <hr>
- <p>As data is received, the <a href=#concept-task id=processing-model-10:concept-task>tasks</a> queued by the <a href=#networking-task-source id=processing-model-10:networking-task-source>networking
- task source</a> to handle the data must act as follows.</p>
- <p>HTTP 200 OK responses with a <a href=#content-type id=processing-model-10:content-type>Content-Type</a> header specifying the type
- <code id=processing-model-10:text/event-stream-2><a href=#text/event-stream>text/event-stream</a></code>, ignoring any <a href=#mime-type id=processing-model-10:mime-type>MIME type</a> parameters, must be processed
- line by line <a href=#event-stream-interpretation>as described below</a>.</p>
- <p>When a successful response with a supported <a href=#mime-type id=processing-model-10:mime-type-2>MIME type</a> is received, such that the
- user agent begins parsing the contents of the stream, the user agent must <a href=#announce-the-connection id=processing-model-10:announce-the-connection>announce the
- connection</a>.</p>
- <p>The <a href=#concept-task id=processing-model-10:concept-task-2>task</a> that the <a href=#networking-task-source id=processing-model-10:networking-task-source-2>networking task source</a> places
- on the <a href=#task-queue id=processing-model-10:task-queue>task queue</a> once the <a href=#fetch id=processing-model-10:fetch-2>fetching algorithm</a> for such a
- resource (with the correct <a href=#mime-type id=processing-model-10:mime-type-3>MIME type</a>) has completed must cause the user agent to
- asynchronously <a href=#reestablish-the-connection id=processing-model-10:reestablish-the-connection>reestablish the connection</a>. This applies whether the connection is
- closed gracefully or unexpectedly (but does not apply when the <a href=#fetch id=processing-model-10:fetch-3>fetch</a> algorithm is
- canceled by the user agent, e.g. in response to <code id=processing-model-10:dom-window-stop><a href=#dom-window-stop>window.stop()</a></code>,
- since in those cases the final <a href=#concept-task id=processing-model-10:concept-task-3>task</a> is actually discarded).
- It doesn't apply for the error conditions listed below except
- where explicitly specified.</p>
- <p>HTTP 200 OK responses that have a <a href=#content-type id=processing-model-10:content-type-2>Content-Type</a> specifying an unsupported type, or
- that have no <a href=#content-type id=processing-model-10:content-type-3>Content-Type</a> at all, must cause the user agent to <a href=#fail-the-connection id=processing-model-10:fail-the-connection>fail the
- connection</a>.</p>
- <p>HTTP 305 Use Proxy, 401 Unauthorized, and 407 Proxy Authentication Required should be treated
- transparently as for any other subresource.</p>
- <p>HTTP 301 Moved Permanently, 302 Found, 303 See Other, and 307 Temporary Redirect responses are
- handled by the <a href=#fetch id=processing-model-10:fetch-4>fetching</a> and CORS algorithms. In the case of 301
- redirects, the user agent must also remember the new URL so that subsequent requests for this
- resource for this <code id=processing-model-10:eventsource><a href=#eventsource>EventSource</a></code> object start with the URL given for the last 301 seen
- for requests for this object.</p>
- <p id=event-source-network-errors-reconnect>Network errors that prevents the connection from
- being established in the first place (e.g. DNS errors), must cause the user agent to
- asynchronously <a href=#reestablish-the-connection id=processing-model-10:reestablish-the-connection-2>reestablish the connection</a>.</p>
- <p id=event-source-fail-reasons>Any other HTTP response code not listed here, as well as the
- cancelation of the <a href=#fetch id=processing-model-10:fetch-5>fetch</a> algorithm by the user agent (e.g. in response to <code id=processing-model-10:dom-window-stop-2><a href=#dom-window-stop>window.stop()</a></code> or the user canceling the network connection
- manually) must cause the user agent to <a href=#fail-the-connection id=processing-model-10:fail-the-connection-2>fail the connection</a>.</p>
- <p>For non-HTTP protocols, UAs should act in equivalent ways.</p>
- <hr>
- <p>When a user agent is to <dfn id=announce-the-connection>announce the connection</dfn>, the user agent must <a href=#queue-a-task id=processing-model-10:queue-a-task>queue a
- task</a> which, if the <code id=processing-model-10:dom-eventsource-readystate><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
- set to a value other than <code id=processing-model-10:dom-eventsource-closed><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code id=processing-model-10:dom-eventsource-readystate-2><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code id=processing-model-10:dom-eventsource-open><a href=#dom-eventsource-open>OPEN</a></code> and <a href=#fire-a-simple-event id=processing-model-10:fire-a-simple-event>fires a simple
- event</a> named <code id=processing-model-10:event-open><a href=#event-open>open</a></code> at the <code id=processing-model-10:eventsource-2><a href=#eventsource>EventSource</a></code>
- object.</p>
- <p>When a user agent is to <dfn id=reestablish-the-connection>reestablish the connection</dfn>, the user agent must run the
- following steps. These steps are run asynchronously, not as part of a <a href=#concept-task id=processing-model-10:concept-task-4>task</a>. (The tasks that it queues, of course, are run like normal tasks
- and not asynchronously.)</p>
- <ol><li>
- <p><a href=#queue-a-task id=processing-model-10:queue-a-task-2>Queue a task</a> to run the following steps:</p>
- <ol><li><p>If the <code id=processing-model-10:dom-eventsource-readystate-3><a href=#dom-eventsource-readystate>readyState</a></code> attribute is set to
- <code id=processing-model-10:dom-eventsource-closed-2><a href=#dom-eventsource-closed>CLOSED</a></code>, abort the task.<li><p>Set the <code id=processing-model-10:dom-eventsource-readystate-4><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code id=processing-model-10:dom-eventsource-connecting><a href=#dom-eventsource-connecting>CONNECTING</a></code>.<li><p><a href=#fire-a-simple-event id=processing-model-10:fire-a-simple-event-2>Fire a simple event</a> named <code id=processing-model-10:event-error><a href=#event-error>error</a></code> at the
- <code id=processing-model-10:eventsource-3><a href=#eventsource>EventSource</a></code> object.</ol>
- <li><p>Wait a delay equal to the reconnection time of the event source.<li><p>Optionally, wait some more. In particular, if the previous attempt failed, then user
- agents might introduce an exponential backoff delay to avoid overloading a potentially already
- overloaded server. Alternatively, if the operating system has reported that there is no network
- connectivity, user agents might wait for the operating system to announce that the network
- connection has returned before retrying.<li><p>Wait until the aforementioned task has run, if it has not yet run.<li>
- <p><a href=#queue-a-task id=processing-model-10:queue-a-task-3>Queue a task</a> to run the following steps:</p>
- <ol><li><p>If the <code id=processing-model-10:dom-eventsource-readystate-5><a href=#dom-eventsource-readystate>readyState</a></code> attribute is not set
- to <code id=processing-model-10:dom-eventsource-connecting-2><a href=#dom-eventsource-connecting>CONNECTING</a></code>, abort these steps.<li><p>Perform a <a href=#potentially-cors-enabled-fetch id=processing-model-10:potentially-cors-enabled-fetch>potentially CORS-enabled fetch</a> of the <a href=#absolute-url id=processing-model-10:absolute-url>absolute
- URL</a> of the event source resource, using the same <i>referrer source</i>, and with the
- same <i>mode</i> and <i>origin</i>, as those
- used in the original request triggered by the <code id=processing-model-10:dom-eventsource-2><a href=#dom-eventsource>EventSource()</a></code> constructor, and process the resource obtained in
- this fashion, if any, as described earlier in this section.</ol>
- </ol>
- <p>When a user agent is to <dfn id=fail-the-connection>fail the connection</dfn>, the user agent must <a href=#queue-a-task id=processing-model-10:queue-a-task-4>queue a
- task</a> which, if the <code id=processing-model-10:dom-eventsource-readystate-6><a href=#dom-eventsource-readystate>readyState</a></code> attribute is
- set to a value other than <code id=processing-model-10:dom-eventsource-closed-3><a href=#dom-eventsource-closed>CLOSED</a></code>, sets the <code id=processing-model-10:dom-eventsource-readystate-7><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code id=processing-model-10:dom-eventsource-closed-4><a href=#dom-eventsource-closed>CLOSED</a></code> and <a href=#fire-a-simple-event id=processing-model-10:fire-a-simple-event-3>fires a simple
- event</a> named <code id=processing-model-10:event-error-2><a href=#event-error>error</a></code> at the <code id=processing-model-10:eventsource-4><a href=#eventsource>EventSource</a></code> object.
- <strong>Once the user agent has <a href=#fail-the-connection id=processing-model-10:fail-the-connection-3>failed the connection</a>, it
- does <em>not</em> attempt to reconnect!</strong></p>
- <hr>
- <p>The <a href=#task-source id=processing-model-10:task-source>task source</a> for any <a href=#concept-task id=processing-model-10:concept-task-5>tasks</a> that are <a href=#queue-a-task id=processing-model-10:queue-a-task-5>queued</a> by <code id=processing-model-10:eventsource-5><a href=#eventsource>EventSource</a></code> objects is the <dfn id=remote-event-task-source>remote event
- task source</dfn>.</p>
- <h4 id=parsing-an-event-stream>9.2.4 Parsing an event stream</h4>
- <p>This event stream format's <a href=#mime-type id=parsing-an-event-stream:mime-type>MIME type</a> is <code id=parsing-an-event-stream:text/event-stream><a href=#text/event-stream>text/event-stream</a></code>.</p>
- <p>The event stream format is as described by the <code>stream</code> production of the
- following ABNF, the character set for which is Unicode. <a href=#refsABNF>[ABNF]</a></p>
- <pre>stream = [ bom ] *event
- event = *( comment / field ) end-of-line
- comment = colon *any-char end-of-line
- field = 1*name-char [ colon [ space ] *any-char ] end-of-line
- end-of-line = ( cr lf / cr / lf )
- ; characters
- lf = %x000A ; U+000A LINE FEED (LF)
- cr = %x000D ; U+000D CARRIAGE RETURN (CR)
- space = %x0020 ; U+0020 SPACE
- colon = %x003A ; U+003A COLON (:)
- bom = %xFEFF ; U+FEFF BYTE ORDER MARK
- name-char = %x0000-0009 / %x000B-000C / %x000E-0039 / %x003B-10FFFF
- ; a <a href=#unicode-character id=parsing-an-event-stream:unicode-character>Unicode character</a> other than U+000A LINE FEED (LF), U+000D CARRIAGE RETURN (CR), or U+003A COLON (:)
- any-char = %x0000-0009 / %x000B-000C / %x000E-10FFFF
- ; a <a href=#unicode-character id=parsing-an-event-stream:unicode-character-2>Unicode character</a> other than U+000A LINE FEED (LF) or U+000D CARRIAGE RETURN (CR)</pre>
- <p>Event streams in this format must always be encoded as UTF-8. <a href=#refsENCODING>[ENCODING]</a></p>
- <p>Lines must be separated by either a U+000D CARRIAGE RETURN U+000A LINE FEED (CRLF) character
- pair, a single U+000A LINE FEED (LF) character, or a single U+000D CARRIAGE RETURN (CR)
- character.</p>
- <p>Since connections established to remote servers for such resources are expected to be
- long-lived, UAs should ensure that appropriate buffering is used. In particular, while line
- buffering with lines are defined to end with a single U+000A LINE FEED (LF) character is safe,
- block buffering or line buffering with different expected line endings can cause delays in event
- dispatch.</p>
- <h4 id=event-stream-interpretation>9.2.5 Interpreting an event stream</h4>
- <p>Streams must be decoded using the <a href=#utf-8-decode id=event-stream-interpretation:utf-8-decode>UTF-8 decode</a> algorithm.</p>
- <p class=note>The <a href=#utf-8-decode id=event-stream-interpretation:utf-8-decode-2>UTF-8 decode</a> algorithm strips one leading UTF-8 Byte Order Mark
- (BOM), if any.</p>
- <p>The stream must then be parsed by reading everything line by line, with a U+000D CARRIAGE
- RETURN U+000A LINE FEED (CRLF) character pair, a single U+000A LINE FEED (LF) character not
- preceded by a U+000D CARRIAGE RETURN (CR) character, and a single U+000D CARRIAGE RETURN (CR)
- character not followed by a U+000A LINE FEED (LF) character being the ways in which a line can
- end.</p>
- <p>When a stream is parsed, a <var>data</var> buffer, an <var>event type</var>
- buffer, and a <var>last event ID</var> buffer must be associated with it. They must be
- initialised to the empty string</p>
- <p>Lines must be processed, in the order they are received, as follows:</p>
- <dl class=switch><dt>If the line is empty (a blank line)<dd><p><a href=#dispatchMessage id=event-stream-interpretation:dispatchMessage>Dispatch the event</a>, as defined below.<dt>If the line starts with a U+003A COLON character (:)<dd><p>Ignore the line.<dt>If the line contains a U+003A COLON character (:)<dd>
- <p>Collect the characters on the line before the first U+003A COLON character (:), and let <var>field</var> be that string.</p>
- <p>Collect the characters on the line after the first U+003A COLON character (:), and let <var>value</var> be that string. If <var>value</var> starts with a U+0020 SPACE
- character, remove it from <var>value</var>.</p>
- <p><a href=#processField>Process the field</a> using the steps described below, using <var>field</var> as the field name and <var>value</var> as the field value.</p>
- <dt>Otherwise, the string is not empty but does not contain a U+003A COLON character (:)<dd>
- <p><a href=#processField>Process the field</a> using the steps described below, using the
- whole line as the field name, and the empty string as the field value.</p>
- </dl>
- <p>Once the end of the file is reached, any pending data must be discarded. (If the file ends in
- the middle of an event, before the final empty line, the incomplete event is not dispatched.)</p>
- <hr>
- <p id=processField>The steps to <dfn>process the field</dfn> given a field name and a
- field value depend on the field name, as given in the following list. Field names must be compared
- literally, with no case folding performed.</p>
- <dl class=switch><dt>If the field name is "event"<dd><p>Set the <var>event type</var> buffer to field value.<dt>If the field name is "data"<dd><p>Append the field value to the <var>data</var> buffer, then append a single U+000A
- LINE FEED (LF) character to the <var>data</var> buffer.<dt>If the field name is "id"<dd><p>Set the <var>last event ID</var> buffer to the field value.<dt>If the field name is "retry"<dd><p>If the field value consists of only <a href=#ascii-digits id=event-stream-interpretation:ascii-digits>ASCII digits</a>, then interpret the field
- value as an integer in base ten, and set the event stream's <a href=#concept-event-stream-reconnection-time id=event-stream-interpretation:concept-event-stream-reconnection-time>reconnection time</a> to that integer.
- Otherwise, ignore the field.<dt>Otherwise<dd><p>The field is ignored.</dl>
- <p>When the user agent is required to <dfn id=dispatchMessage>dispatch the
- event</dfn>, the user agent must process the <var>data</var> buffer, the <var>event type</var> buffer, and the <var>last event ID</var> buffer using steps
- appropriate for the user agent.</p>
- <p>For Web browsers, the appropriate steps to <a href=#dispatchMessage id=event-stream-interpretation:dispatchMessage-2>dispatch the event</a> are as follows:</p>
- <ol><li><p>Set the <a href=#concept-event-stream-last-event-id id=event-stream-interpretation:concept-event-stream-last-event-id>last event ID string</a> of
- the event source to the value of the <var>last event ID</var> buffer. The buffer does
- not get reset, so the <a href=#concept-event-stream-last-event-id id=event-stream-interpretation:concept-event-stream-last-event-id-2>last event ID
- string</a> of the event source remains set to this value until the next time it is set by the
- server.<li><p>If the <var>data</var> buffer is an empty string, set the <var>data</var> buffer and the <var>event type</var> buffer to the empty string and
- abort these steps.<li><p>If the <var>data</var> buffer's last character is a U+000A LINE FEED (LF)
- character, then remove the last character from the <var>data</var> buffer.<li><p>Create an event that uses the <code id=event-stream-interpretation:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the event type
- <code id=event-stream-interpretation:event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
- default action. The <code id=event-stream-interpretation:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
- initialized to the value of the <var>data</var> buffer, the <code id=event-stream-interpretation:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialised to the <a href=#unicode-serialisation-of-an-origin id=event-stream-interpretation:unicode-serialisation-of-an-origin>Unicode serialisation</a> of the
- <a href=#origin-2 id=event-stream-interpretation:origin-2>origin</a> of the event stream's final URL (i.e. the URL after redirects), and the <code id=event-stream-interpretation:dom-messageevent-lasteventid><a href=#dom-messageevent-lasteventid>lastEventId</a></code> attribute must be initialised to the
- <a href=#concept-event-stream-last-event-id id=event-stream-interpretation:concept-event-stream-last-event-id-3>last event ID string</a> of the event
- source. This event is not <a href=#concept-events-trusted id=event-stream-interpretation:concept-events-trusted>trusted</a>.<li><p>If the <var>event type</var> buffer has a value other than the empty string, change the
- <a href=#concept-event-type id=event-stream-interpretation:concept-event-type>type</a> of the newly created event to equal the value of
- the <var>event type</var> buffer.<li><p>Set the <var>data</var> buffer and the <var>event type</var> buffer to
- the empty string.<li><p><a href=#queue-a-task id=event-stream-interpretation:queue-a-task>Queue a task</a> which, if the <code id=event-stream-interpretation:dom-eventsource-readystate><a href=#dom-eventsource-readystate>readyState</a></code> attribute is set to a value other than <code id=event-stream-interpretation:dom-eventsource-closed><a href=#dom-eventsource-closed>CLOSED</a></code>, <a href=#concept-event-dispatch id=event-stream-interpretation:concept-event-dispatch>dispatches</a> the newly created event at the
- <code id=event-stream-interpretation:eventsource><a href=#eventsource>EventSource</a></code> object.</ol>
- <p class=note>If an event doesn't have an "id" field, but an earlier event did set the event
- source's <a href=#concept-event-stream-last-event-id id=event-stream-interpretation:concept-event-stream-last-event-id-4>last event ID string</a>, then the
- event's <code id=event-stream-interpretation:dom-messageevent-lasteventid-2><a href=#dom-messageevent-lasteventid>lastEventId</a></code> field will be set to the
- value of whatever the last seen "id" field was.</p>
- <p>For other user agents, the appropriate steps to <a href=#dispatchMessage id=event-stream-interpretation:dispatchMessage-3>dispatch the event</a> are
- implementation dependent, but at a minimum they must set the <var>data</var> and <var>event type</var> buffers to the empty string before returning.</p>
- <div class=example>
- <p>The following event stream, once followed by a blank line:</p>
- <pre>data: YHOO
- data: +2
- data: 10</pre>
- <p>...would cause an event <code id=event-stream-interpretation:event-message-2><a href=#event-message>message</a></code> with the interface
- <code id=event-stream-interpretation:messageevent-2><a href=#messageevent>MessageEvent</a></code> to be dispatched on the <code id=event-stream-interpretation:eventsource-2><a href=#eventsource>EventSource</a></code> object. The event's
- <code id=event-stream-interpretation:dom-messageevent-data-2><a href=#dom-messageevent-data>data</a></code> attribute would contain the string "<code>YHOO\n+2\n10</code>" (where "<code>\n</code>" represents a newline).</p>
- <p>This could be used as follows:
- <pre>var stocks = new EventSource("http://stocks.example.com/ticker.php");
- stocks.onmessage = function (event) {
- var data = event.data.split('\n');
- updateStocks(data[0], data[1], data[2]);
- };</pre>
- <p>...where <code>updateStocks()</code> is a function defined as:</p>
- <pre>function updateStocks(symbol, delta, value) { ... }</pre>
- <p>...or some such.</p>
- </div>
- <div class=example>
- <p>The following stream contains four blocks. The first block has just a comment, and will fire
- nothing. The second block has two fields with names "data" and "id" respectively; an event will
- be fired for this block, with the data "first event", and will then set the last event ID to "1"
- so that if the connection died between this block and the next, the server would be sent a <code id=event-stream-interpretation:last-event-id><a href=#last-event-id>Last-Event-ID</a></code> header with the value "1". The third block fires
- an event with data "second event", and also has an "id" field, this time with no value, which
- resets the last event ID to the empty string (meaning no <code id=event-stream-interpretation:last-event-id-2><a href=#last-event-id>Last-Event-ID</a></code> header will now be sent in the event of a
- reconnection being attempted). Finally, the last block just fires an event with the data
- " third event" (with a single leading space character). Note that the last still has to
- end with a blank line, the end of the stream is not enough to trigger the dispatch of the last
- event.</p>
- <pre>: test stream
- data: first event
- id: 1
- data:second event
- id
- data: third event
- </pre>
- </div>
- <div class=example>
- <p>The following stream fires two events:</p>
- <pre>data
- data
- data
- data:</pre>
- <p>The first block fires events with the data set to the empty string, as would the last block if
- it was followed by a blank line. The middle block fires an event with the data set to a single
- newline character. The last block is discarded because it is not followed by a blank line.</p>
- </div>
- <div class=example>
- <p>The following stream fires two identical events:</p>
- <pre>data:test
- data: test
- </pre>
- <p>This is because the space after the colon is ignored if present.</p>
- </div>
- <h4 id=authoring-notes>9.2.6 Authoring notes</h4>
- <p>Legacy proxy servers are known to, in certain cases, drop HTTP connections after a short
- timeout. To protect against such proxy servers, authors can include a comment line (one starting
- with a ':' character) every 15 seconds or so.</p>
- <p>Authors wishing to relate event source connections to each other or to specific documents
- previously served might find that relying on IP addresses doesn't work, as individual clients can
- have multiple IP addresses (due to having multiple proxy servers) and individual IP addresses can
- have multiple clients (due to sharing a proxy server). It is better to include a unique identifier
- in the document when it is served and then pass that identifier as part of the URL when the
- connection is established.</p>
- <p>Authors are also cautioned that HTTP chunking can have unexpected negative effects on the
- reliability of this protocol. Where possible, chunking should be disabled for serving event
- streams unless the rate of messages is high enough for this not to matter.</p>
- <p>Clients that support HTTP's per-server connection limitation might run into trouble when
- opening multiple pages from a site if each page has an <code id=authoring-notes:eventsource><a href=#eventsource>EventSource</a></code> to the same
- domain. Authors can avoid this using the relatively complex mechanism of using unique domain names
- per connection, or by allowing the user to enable or disable the <code id=authoring-notes:eventsource-2><a href=#eventsource>EventSource</a></code>
- functionality on a per-page basis, or by sharing a single <code id=authoring-notes:eventsource-3><a href=#eventsource>EventSource</a></code> object using a
- <a href=#sharedworkerglobalscope id=authoring-notes:sharedworkerglobalscope>shared worker</a>.</p>
- <h4 id=eventsource-push>9.2.7 Connectionless push and other features</h4>
- <p>User agents running in controlled environments, e.g. browsers on mobile handsets tied to
- specific carriers, may offload the management of the connection to a proxy on the network. In such
- a situation, the user agent for the purposes of conformance is considered to include both the
- handset software and the network proxy.</p>
- <div class=example>
- <p>For example, a browser on a mobile device, after having established a connection, might detect
- that it is on a supporting network and request that a proxy server on the network take over the
- management of the connection. The timeline for such a situation might be as follows:</p>
- <ol><li>Browser connects to a remote HTTP server and requests the resource specified by the author
- in the <code id=eventsource-push:dom-eventsource><a href=#dom-eventsource>EventSource</a></code> constructor.<li>The server sends occasional messages.<li>In between two messages, the browser detects that it is idle except for the network activity
- involved in keeping the TCP connection alive, and decides to switch to sleep mode to save
- power.<li>The browser disconnects from the server.<li>The browser contacts a service on the network, and requests that that service, a "push
- proxy", maintain the connection instead.<li>The "push proxy" service contacts the remote HTTP server and requests the resource specified
- by the author in the <code id=eventsource-push:dom-eventsource-2><a href=#dom-eventsource>EventSource</a></code> constructor (possibly
- including a <code id=eventsource-push:last-event-id><a href=#last-event-id>Last-Event-ID</a></code> HTTP header, etc).<li>The browser allows the mobile device to go to sleep.<li>The server sends another message.<li>The "push proxy" service uses a technology such as OMA push to convey the event to the
- mobile device, which wakes only enough to process the event and then returns to sleep.</ol>
- </div>
- <p>This can reduce the total data usage, and can therefore result in considerable power
- savings.</p>
- <p>As well as implementing the existing API and <code id=eventsource-push:text/event-stream><a href=#text/event-stream>text/event-stream</a></code> wire format as
- defined by this specification and in more distributed ways as described above, formats of event
- framing defined by <a href=#other-applicable-specifications id=eventsource-push:other-applicable-specifications>other applicable specifications</a> may be supported. This
- specification does not define how they are to be parsed or processed.</p>
- <h4 id=garbage-collection-2>9.2.8 Garbage collection</h4>
- <p>While an <code id=garbage-collection-2:eventsource><a href=#eventsource>EventSource</a></code> object's <code id=garbage-collection-2:dom-eventsource-readystate><a href=#dom-eventsource-readystate>readyState</a></code> is <code id=garbage-collection-2:dom-eventsource-connecting><a href=#dom-eventsource-connecting>CONNECTING</a></code>, and the object has one or more event
- listeners registered for <code id=garbage-collection-2:event-open><a href=#event-open>open</a></code>, <code id=garbage-collection-2:event-message><a href=#event-message>message</a></code> or <code id=garbage-collection-2:event-error><a href=#event-error>error</a></code> events, there must
- be a strong reference from the <code id=garbage-collection-2:window><a href=#window>Window</a></code> or <code id=garbage-collection-2:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that
- the <code id=garbage-collection-2:eventsource-2><a href=#eventsource>EventSource</a></code> object's constructor was invoked from to the <code id=garbage-collection-2:eventsource-3><a href=#eventsource>EventSource</a></code>
- object itself.</p>
- <p>While an <code id=garbage-collection-2:eventsource-4><a href=#eventsource>EventSource</a></code> object's <code id=garbage-collection-2:dom-eventsource-readystate-2><a href=#dom-eventsource-readystate>readyState</a></code> is <code id=garbage-collection-2:dom-eventsource-open><a href=#dom-eventsource-open>OPEN</a></code>, and the object has one or more event listeners
- registered for <code id=garbage-collection-2:event-message-2><a href=#event-message>message</a></code> or <code id=garbage-collection-2:event-error-2><a href=#event-error>error</a></code> events, there must be a strong reference from the
- <code id=garbage-collection-2:window-2><a href=#window>Window</a></code> or <code id=garbage-collection-2:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that the <code id=garbage-collection-2:eventsource-5><a href=#eventsource>EventSource</a></code>
- object's constructor was invoked from to the <code id=garbage-collection-2:eventsource-6><a href=#eventsource>EventSource</a></code> object itself.</p>
- <p>While there is a task queued by an <code id=garbage-collection-2:eventsource-7><a href=#eventsource>EventSource</a></code> object on the <a href=#remote-event-task-source id=garbage-collection-2:remote-event-task-source>remote event
- task source</a>, there must be a strong reference from the <code id=garbage-collection-2:window-3><a href=#window>Window</a></code> or
- <code id=garbage-collection-2:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that the <code id=garbage-collection-2:eventsource-8><a href=#eventsource>EventSource</a></code> object's constructor was
- invoked from to that <code id=garbage-collection-2:eventsource-9><a href=#eventsource>EventSource</a></code> object.</p>
- <p>If a user agent is to <dfn id=concept-eventsource-forcibly-close>forcibly close</dfn> an
- <code id=garbage-collection-2:eventsource-10><a href=#eventsource>EventSource</a></code> object (this happens when a <code id=garbage-collection-2:document><a href=#document>Document</a></code> object goes away
- permanently), the user agent must abort any instances of the <a href=#fetch id=garbage-collection-2:fetch>fetch</a> algorithm started
- for this <code id=garbage-collection-2:eventsource-11><a href=#eventsource>EventSource</a></code> object, and must set the <code id=garbage-collection-2:dom-eventsource-readystate-3><a href=#dom-eventsource-readystate>readyState</a></code> attribute to <code id=garbage-collection-2:dom-eventsource-closed><a href=#dom-eventsource-closed>CLOSED</a></code>.</p>
- <p>If an <code id=garbage-collection-2:eventsource-12><a href=#eventsource>EventSource</a></code> object is garbage collected while its connection is still open,
- the user agent must abort any instance of the <a href=#fetch id=garbage-collection-2:fetch-2>fetch</a> algorithm opened by
- this <code id=garbage-collection-2:eventsource-13><a href=#eventsource>EventSource</a></code>.</p>
- <p class=note>It's possible for one active network connection to be shared by multiple
- <code id=garbage-collection-2:eventsource-14><a href=#eventsource>EventSource</a></code> objects and their <a href=#fetch id=garbage-collection-2:fetch-3>fetch</a> algorithms, which is why the above
- is phrased in terms of aborting the <a href=#fetch id=garbage-collection-2:fetch-4>fetch</a> algorithm and not the actual underlying
- download.</p>
- <h4 id=implementation-advice>9.2.9 Implementation advice</h4>
- <p><i>This section is non-normative.</i></p>
- <p>User agents are strongly urged to provide detailed diagnostic information about
- <code id=implementation-advice:eventsource><a href=#eventsource>EventSource</a></code> objects and their related network connections in their development
- consoles, to aid authors in debugging code using this API.</p>
- <p>For example, a user agent could have a panel displaying all the <code id=implementation-advice:eventsource-2><a href=#eventsource>EventSource</a></code>
- objects a page has created, each listing the constructor's arguments, whether there was a network
- error, what the CORS status of the connection is and what headers were sent by the client and
- received from the server to lead to that status, the messages that were received and how they were
- parsed, and so forth.</p>
- <p>Implementations are especially encouraged to report detailed information to their development
- consoles whenever an <code id=implementation-advice:event-error><a href=#event-error>error</a></code> event is fired, since little to no
- information can be made available in the events themselves.</p>
- <h4 id=iana-considerations>9.2.10 IANA considerations</h4>
- <h5 id=text/event-stream>9.2.10.1 <dfn><code>text/event-stream</code></dfn></h5>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>event-stream<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
- <dl><dt><code>charset</code><dd>
- <p>The <code>charset</code> parameter may be provided. The parameter's value must be
- "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
- compatibility with legacy servers.</p>
- </dl>
- <dt>Encoding considerations:<dd>8bit (always UTF-8)<dt>Security considerations:<dd>
- <p>An event stream from an origin distinct from the origin of the content consuming the event
- stream can result in information leakage. To avoid this, user agents are required to apply CORS
- semantics. <a href=#refsFETCH>[FETCH]</a></p>
- <p>Event streams can overwhelm a user agent; a user agent is expected to apply suitable
- restrictions to avoid depleting local resources because of an overabundance of information from
- an event stream.</p>
- <p>Servers can be overwhelmed if a situation develops in which the server is causing clients to
- reconnect rapidly. Servers should use a 5xx status code to indicate capacity problems, as this
- will prevent conforming clients from reconnecting automatically.</p>
- <dt>Interoperability considerations:<dd>
- Rules for processing both conforming and non-conforming content are defined in this
- specification.
- <dt>Published specification:<dd>
- This document is the relevant specification.
- <dt>Applications that use this media type:<dd>
- Web browsers and tools using Web services.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>No sequence of bytes can uniquely identify an event stream.<dt>File extension(s):<dd>No specific file extensions are recommended for this type.<dt>Macintosh file type code(s):<dd>No specific Macintosh file type codes are recommended for this type.</dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>This format is only expected to be used by dynamic open-ended streams served using HTTP or a
- similar protocol. Finite resources are not expected to be labeled with this type.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers have no meaning with
- <code id=text/event-stream:text/event-stream><a href=#text/event-stream>text/event-stream</a></code> resources.</p>
- <h5 id=last-event-id>9.2.10.2 <dfn><code>Last-Event-ID</code></dfn></h5>
- <p>This section describes a header for registration in the Permanent Message Header Field
- Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
- <dl><dt>Header field name:<dd>Last-Event-ID<dt>Applicable protocol:<dd>http<dt>Status:<dd>standard<dt>Author/Change controller:<dd>W3C<dt>Specification document(s):<dd>
- This document is the relevant specification.
- <dt>Related information:<dd>None.</dl>
- <h3 id=network>9.3 <dfn>Web sockets</dfn></h3>
- <h4 id=network-intro>9.3.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To enable Web applications to maintain bidirectional communications with server-side processes,
- this specification introduces the <code id=network-intro:websocket><a href=#websocket>WebSocket</a></code> interface.</p>
- <p class=note>This interface does not allow for raw access to the underlying network. For
- example, this interface could not be used to implement an IRC client without proxying messages
- through a custom server.</p>
- <h4 id=the-websocket-interface>9.3.2 The <code id=the-websocket-interface:websocket><a href=#websocket>WebSocket</a></code> interface</h4>
- <pre class=idl>enum <dfn id=binarytype>BinaryType</dfn> { "<a href=#dom-binarytype-blob id=the-websocket-interface:dom-binarytype-blob>blob</a>", "<a href=#dom-binarytype-arraybuffer id=the-websocket-interface:dom-binarytype-arraybuffer>arraybuffer</a>" };
- [<a href=#dom-websocket id=the-websocket-interface:dom-websocket>Constructor</a>(DOMString url, optional (DOMString or DOMString[]) protocols), Exposed=(Window,Worker)]
- interface <dfn id=websocket>WebSocket</dfn> : <a href=#eventtarget id=the-websocket-interface:eventtarget>EventTarget</a> {
- readonly attribute DOMString <a href=#dom-websocket-url id=the-websocket-interface:dom-websocket-url>url</a>;
- // ready state
- const unsigned short <a href=#dom-websocket-connecting id=the-websocket-interface:dom-websocket-connecting>CONNECTING</a> = 0;
- const unsigned short <a href=#dom-websocket-open id=the-websocket-interface:dom-websocket-open>OPEN</a> = 1;
- const unsigned short <a href=#dom-websocket-closing id=the-websocket-interface:dom-websocket-closing>CLOSING</a> = 2;
- const unsigned short <a href=#dom-websocket-closed id=the-websocket-interface:dom-websocket-closed>CLOSED</a> = 3;
- readonly attribute unsigned short <a href=#dom-websocket-readystate id=the-websocket-interface:dom-websocket-readystate>readyState</a>;
- readonly attribute unsigned long <a href=#dom-websocket-bufferedamount id=the-websocket-interface:dom-websocket-bufferedamount>bufferedAmount</a>;
- // networking
- attribute <a href=#eventhandler id=the-websocket-interface:eventhandler>EventHandler</a> <a href=#handler-websocket-onopen id=the-websocket-interface:handler-websocket-onopen>onopen</a>;
- attribute <a href=#eventhandler id=the-websocket-interface:eventhandler-2>EventHandler</a> <a href=#handler-websocket-onerror id=the-websocket-interface:handler-websocket-onerror>onerror</a>;
- attribute <a href=#eventhandler id=the-websocket-interface:eventhandler-3>EventHandler</a> <a href=#handler-websocket-onclose id=the-websocket-interface:handler-websocket-onclose>onclose</a>;
- readonly attribute DOMString <a href=#dom-websocket-extensions id=the-websocket-interface:dom-websocket-extensions>extensions</a>;
- readonly attribute DOMString <a href=#dom-websocket-protocol id=the-websocket-interface:dom-websocket-protocol>protocol</a>;
- void <a href=#dom-websocket-close id=the-websocket-interface:dom-websocket-close>close</a>([Clamp] optional unsigned short code, optional DOMString reason);
- // messaging
- attribute <a href=#eventhandler id=the-websocket-interface:eventhandler-4>EventHandler</a> <a href=#handler-websocket-onmessage id=the-websocket-interface:handler-websocket-onmessage>onmessage</a>;
- attribute <a href=#binarytype id=the-websocket-interface:binarytype>BinaryType</a> <a href=#dom-websocket-binarytype id=the-websocket-interface:dom-websocket-binarytype>binaryType</a>;
- void <a href=#dom-websocket-send id=the-websocket-interface:dom-websocket-send>send</a>(DOMString data);
- void <a href=#dom-websocket-send id=the-websocket-interface:dom-websocket-send-2>send</a>(<a href=#blob id=the-websocket-interface:blob>Blob</a> data);
- void <a href=#dom-websocket-send id=the-websocket-interface:dom-websocket-send-3>send</a>(<a href=#arraybuffer id=the-websocket-interface:arraybuffer>ArrayBuffer</a> data);
- void <a href=#dom-websocket-send id=the-websocket-interface:dom-websocket-send-4>send</a>(<a href=#arraybufferview id=the-websocket-interface:arraybufferview>ArrayBufferView</a> data);
- };</pre>
- <p>The <dfn id=dom-websocket><code>WebSocket(<var>url</var>,
- <var>protocols</var>)</code></dfn> constructor takes one or two arguments. The first argument,
- <var>url</var>, specifies the <a href=#url id=the-websocket-interface:url>URL</a> to which to connect. The second,
- <var>protocols</var>, if present, is either a string or an array of strings. If it is a string, it
- is equivalent to an array consisting of just that string; if it is omitted, it is equivalent to
- the empty array. Each string in the array is a subprotocol name. The connection will only be
- established if the server reports that it has selected one of these subprotocols. The subprotocol
- names must all be strings that match the requirements for elements that comprise the value of
- <code id=the-websocket-interface:http-sec-websocket-protocol><a href=#http-sec-websocket-protocol>Sec-WebSocket-Protocol</a></code> fields as defined by the
- WebSocket protocol specification. <a href=#refsWSP>[WSP]</a></p>
- <p>When the <code id=the-websocket-interface:dom-websocket-2><a href=#dom-websocket>WebSocket()</a></code> constructor is invoked, the UA must
- run these steps:</p>
- <ol><li><p><i id="the-websocket-interface:parse-a-websocket-url's-components"><a href="#parse-a-websocket-url's-components">Parse a WebSocket URL's components</a></i> from
- the <var>url</var> argument, to obtain <var>host</var>, <var>port</var>, <var>resource
- name</var>, and <var>secure</var>. If this fails, throw a <code id=the-websocket-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and
- abort these steps. <a href=#refsWSP>[WSP]</a><li><p>If <var>secure</var> is false but the <a href=#origin-2 id=the-websocket-interface:origin-2>origin</a> specified by the <a href=#entry-settings-object id=the-websocket-interface:entry-settings-object>entry
- settings object</a> has a scheme component that is itself a secure protocol, e.g. HTTPS, then
- throw a <code id=the-websocket-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li>
- <p>If <var>port</var> is a port to which the user agent is configured to block access, then
- throw a <code id=the-websocket-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps. (User agents typically block
- access to well-known ports like SMTP.)</p>
-
- <p>Access to ports 80 and 443 should not be blocked, including the unlikely cases when
- <var>secure</var> is false but <var>port</var> is 443 or <var>secure</var> is true but
- <var>port</var> is 80.</p>
-
- <li>
- <p>If <var>protocols</var> is absent, let <var>protocols</var> be an empty array.</p>
- <p>Otherwise, if <var>protocols</var> is present and a string, let <var>protocols</var> instead
- be an array consisting of just that string.</p>
- <li><p>If any of the values in <var>protocols</var> occur more than once or otherwise fail to
- match the requirements for elements that comprise the value of <code id=the-websocket-interface:http-sec-websocket-protocol-2><a href=#http-sec-websocket-protocol>Sec-WebSocket-Protocol</a></code> fields as defined by the
- WebSocket protocol specification, then throw a <code id=the-websocket-interface:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception and abort these
- steps. <a href=#refsWSP>[WSP]</a><li><p>Let <var>origin</var> be the <a href=#ascii-serialisation-of-an-origin id=the-websocket-interface:ascii-serialisation-of-an-origin>ASCII
- serialisation</a> of the <a href=#origin-2 id=the-websocket-interface:origin-2-2>origin</a> specified by the <a href=#entry-settings-object id=the-websocket-interface:entry-settings-object-2>entry settings
- object</a>, <a href=#converted-to-ascii-lowercase id=the-websocket-interface:converted-to-ascii-lowercase>converted to ASCII lowercase</a>.<li><p>Return a new <code id=the-websocket-interface:websocket-2><a href=#websocket>WebSocket</a></code> object, but continue these steps
- asynchronously.<li><p>Let the new object's <dfn id=client-specified-protocols>client-specified protocols</dfn> be the values (if any) given in
- <var>protocols</var>.<li>
- <p><i id=the-websocket-interface:concept-websocket-establish><a href=#concept-websocket-establish>Establish a WebSocket connection</a></i> given the set
- (<var>host</var>, <var>port</var>, <var>resource name</var>, <var>secure</var>), along with the
- <var>protocols</var> list, an empty list for the extensions, and <var>origin</var>. The
- <i id=the-websocket-interface:concept-websocket-cookie-headers><a href=#concept-websocket-cookie-headers>headers to send appropriate cookies</a></i> must be a <code id=the-websocket-interface:http-cookie><a href=#http-cookie>Cookie</a></code>
- header whose value is the <a href=#cookie-string id=the-websocket-interface:cookie-string>cookie-string</a> computed from the user's cookie store and
- the URL <var>url</var>; for these purposes this is <em>not</em> a "non-HTTP" API. <a href=#refsWSP>[WSP]</a>
- <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p>When the user agent <i id=the-websocket-interface:concept-websocket-validate><a href=#concept-websocket-validate>validates the server's
- response</a></i> during the "<i id=the-websocket-interface:concept-websocket-establish-2><a href=#concept-websocket-establish>establish a WebSocket
- connection</a></i>" algorithm, if the status code received from the server is not 101 (e.g. it is a
- redirect), the user agent must <i id=the-websocket-interface:concept-websocket-fail><a href=#concept-websocket-fail>fail the WebSocket
- connection</a></i>.</p>
- <p class=warning>Following HTTP procedures here could introduce serious security problems in a
- Web browser context. For example, consider a host with a WebSocket server at one path and an
- open HTTP redirector at another. Suddenly, any script that can be given a particular WebSocket
- URL can be tricked into communicating to (and potentially sharing secrets with) any host on the
- Internet, even if the script checks that the URL has the right hostname.</p>
- <p class=note>If the <i id=the-websocket-interface:concept-websocket-establish-3><a href=#concept-websocket-establish>establish a WebSocket
- connection</a></i> algorithm fails, it triggers the <i id=the-websocket-interface:concept-websocket-fail-2><a href=#concept-websocket-fail>fail the
- WebSocket connection</a></i> algorithm, which then invokes the <i id=the-websocket-interface:concept-websocket-close><a href=#concept-websocket-close>close the WebSocket connection</a></i> algorithm, which then
- establishes that <i id=the-websocket-interface:concept-websocket-closed><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
- which fires the <code id=the-websocket-interface:event-close><a href=#event-close>close</a></code> event <a href=#closeWebSocket>as
- described below</a>.</p>
- </ol>
- <hr>
- <p>The <dfn id=dom-websocket-url><code>url</code></dfn> attribute must return the result of
- <a href=#resolve-a-url id=the-websocket-interface:resolve-a-url>resolving</a> the <a href=#url id=the-websocket-interface:url-2>URL</a> that was passed to the
- constructor, with the URL character encoding set to UTF-8. (It doesn't matter what it is resolved
- relative to, since we already know it is an <a href=#absolute-url id=the-websocket-interface:absolute-url>absolute URL</a>.)</p>
- <p>The <dfn id=dom-websocket-readystate><code>readyState</code></dfn> attribute represents
- the state of the connection. It can have the following values:</p>
- <dl><dt><dfn id=dom-websocket-connecting><code>CONNECTING</code></dfn> (numeric value 0)<dd>The connection has not yet been established.<dt><dfn id=dom-websocket-open><code>OPEN</code></dfn> (numeric value 1)<dd><i id=the-websocket-interface:concept-websocket-established><a href=#concept-websocket-established>The WebSocket connection is established</a></i> and
- communication is possible.<dt><dfn id=dom-websocket-closing><code>CLOSING</code></dfn> (numeric value 2)<dd>The connection is going through the closing handshake, or the <code id=the-websocket-interface:dom-websocket-close-2><a href=#dom-websocket-close>close()</a></code> method has been invoked.<dt><dfn id=dom-websocket-closed><code>CLOSED</code></dfn> (numeric value 3)<dd>The connection has been closed or could not be opened.</dl>
- <p>When the object is created its <code id=the-websocket-interface:dom-websocket-readystate-2><a href=#dom-websocket-readystate>readyState</a></code> must be
- set to <code id=the-websocket-interface:dom-websocket-connecting-2><a href=#dom-websocket-connecting>CONNECTING</a></code> (0).</p>
- <p>The <dfn id=dom-websocket-extensions><code>extensions</code></dfn> attribute must
- initially return the empty string. After <i id=the-websocket-interface:concept-websocket-established-2><a href=#concept-websocket-established>the WebSocket
- connection is established</a></i>, its value might change, as defined below.</p>
- <p class=note>The <code id=the-websocket-interface:dom-websocket-extensions-2><a href=#dom-websocket-extensions>extensions</a></code> attribute returns
- the extensions selected by the server, if any. (Currently this will only ever be the empty
- string.)</p>
- <p>The <dfn id=dom-websocket-protocol><code>protocol</code></dfn> attribute must initially
- return the empty string. After <i>the WebSocket connection is established</i>, its value might
- change, as defined below.</p>
- <p class=note>The <code id=the-websocket-interface:dom-websocket-protocol-2><a href=#dom-websocket-protocol>protocol</a></code> attribute returns the
- subprotocol selected by the server, if any. It can be used in conjunction with the array form of
- the constructor's second argument to perform subprotocol negotiation.</p>
- <p>The <dfn id=dom-websocket-close><code>close()</code></dfn> method must run the following
- steps:</p>
- <ol><li><p>If the method's first argument is present but is neither an integer equal to 1000 nor an
- integer in the range 3000 to 4999, throw an <code id=the-websocket-interface:invalidaccesserror><a href=#invalidaccesserror>InvalidAccessError</a></code> exception and abort
- these steps.<li>
- <p>If the method's second argument is present, then run these substeps:</p>
- <ol><li><p>Let <var>raw reason</var> be the method's second argument.<li><p>Let <var>Unicode reason</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters id=the-websocket-interface:convert-a-domstring-to-a-sequence-of-unicode-characters>converting <var>raw reason</var> to a sequence of
- Unicode characters</a>.<li><p>Let <var>reason</var> be the result of encoding <var>Unicode
- reason</var> as UTF-8.<li><p>If <var>reason</var> is longer than 123 bytes, then throw a
- <code id=the-websocket-interface:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps. <a href=#refsENCODING>[ENCODING]</a></ol>
- <li><p>Run the first matching steps from the following list:</p>
- <dl class=switch><dt>If the <code id=the-websocket-interface:dom-websocket-readystate-3><a href=#dom-websocket-readystate>readyState</a></code> attribute is in the <code id=the-websocket-interface:dom-websocket-closing-2><a href=#dom-websocket-closing>CLOSING</a></code> (2) or <code id=the-websocket-interface:dom-websocket-closed-2><a href=#dom-websocket-closed>CLOSED</a></code> (3) state<dd>
- <p>Do nothing.</p>
- <p class=note>The connection is already closing or is already closed. If it has not already,
- a <code id=the-websocket-interface:event-close-2><a href=#event-close>close</a></code> event will eventually fire <a href=#closeWebSocket>as described below</a>.</p>
- <dt>If the WebSocket connection is not yet <i id=the-websocket-interface:concept-websocket-established-3><a href=#concept-websocket-established>established</a></i> <a href=#refsWSP>[WSP]</a><dd>
- <p><i id=the-websocket-interface:concept-websocket-fail-3><a href=#concept-websocket-fail>Fail the WebSocket connection</a></i> and set the <code id=the-websocket-interface:dom-websocket-readystate-4><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code id=the-websocket-interface:dom-websocket-closing-3><a href=#dom-websocket-closing>CLOSING</a></code> (2). <a href=#refsWSP>[WSP]</a></p>
- <p class=note>The <i id=the-websocket-interface:concept-websocket-fail-4><a href=#concept-websocket-fail>fail the WebSocket connection</a></i>
- algorithm invokes the <i id=the-websocket-interface:concept-websocket-close-2><a href=#concept-websocket-close>close the WebSocket connection</a></i>
- algorithm, which then establishes that <i id=the-websocket-interface:concept-websocket-closed-2><a href=#concept-websocket-closed>the WebSocket
- connection is closed</a></i>, which fires the <code id=the-websocket-interface:event-close-3><a href=#event-close>close</a></code> event <a href=#closeWebSocket>as described below</a>.</p>
- <dt>If the WebSocket closing handshake has not yet been <i id=the-websocket-interface:concept-websocket-closing-handshake><a href=#concept-websocket-closing-handshake>started</a></i> <a href=#refsWSP>[WSP]</a><dd>
- <p><i id=the-websocket-interface:concept-websocket-start-closing-handshake><a href=#concept-websocket-start-closing-handshake>Start the WebSocket closing
- handshake</a></i> and set the <code id=the-websocket-interface:dom-websocket-readystate-5><a href=#dom-websocket-readystate>readyState</a></code>
- attribute's value to <code id=the-websocket-interface:dom-websocket-closing-4><a href=#dom-websocket-closing>CLOSING</a></code> (2). <a href=#refsWSP>[WSP]</a></p>
- <p>If the first argument is present, then the status code to use in the
- WebSocket Close message must be the integer given by the first argument. <a href=#refsWSP>[WSP]</a></p>
- <p>If the second argument is also present, then <var>reason</var> must be provided in the
- Close message after the status code. <a href=#refsENCODING>[ENCODING]</a> <a href=#refsWSP>[WSP]</a></p>
- <p class=note>The <i id=the-websocket-interface:concept-websocket-start-closing-handshake-2><a href=#concept-websocket-start-closing-handshake>start the WebSocket
- closing handshake</a></i> algorithm eventually invokes the <i id=the-websocket-interface:concept-websocket-close-3><a href=#concept-websocket-close>close the WebSocket connection</a></i> algorithm, which then
- establishes that <i id=the-websocket-interface:concept-websocket-closed-3><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
- which fires the <code id=the-websocket-interface:event-close-4><a href=#event-close>close</a></code> event <a href=#closeWebSocket>as
- described below</a>.</p>
- <dt>Otherwise<dd>
- <p>Set the <code id=the-websocket-interface:dom-websocket-readystate-6><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code id=the-websocket-interface:dom-websocket-closing-5><a href=#dom-websocket-closing>CLOSING</a></code> (2).</p>
- <p class=note><i id=the-websocket-interface:concept-websocket-closing-handshake-2><a href=#concept-websocket-closing-handshake>The WebSocket closing
- handshake is started</a></i>, and will eventually invoke the <i id=the-websocket-interface:concept-websocket-close-4><a href=#concept-websocket-close>close the WebSocket connection</a></i> algorithm, which will
- establish that <i id=the-websocket-interface:concept-websocket-closed-4><a href=#concept-websocket-closed>the WebSocket connection is closed</a></i>,
- and thus the <code id=the-websocket-interface:event-close-5><a href=#event-close>close</a></code> event will fire, <a href=#closeWebSocket>as described below</a>.</p>
- </dl>
- </ol>
- <p class=note>The <code id=the-websocket-interface:dom-websocket-close-3><a href=#dom-websocket-close>close()</a></code> method does not discard
- previously sent messages before starting the WebSocket closing handshake — even if, in
- practice, the user agent is still busy sending those messages, the handshake will only start after
- the messages are sent.</p>
- <hr>
- <p>The <dfn id=dom-websocket-bufferedamount><code>bufferedAmount</code></dfn> attribute must
- return the number of bytes of application data (UTF-8 text and binary data) that have been queued
- using <code id=the-websocket-interface:dom-websocket-send-5><a href=#dom-websocket-send>send()</a></code> but that, as of the last time the
- <a href=#event-loop id=the-websocket-interface:event-loop>event loop</a> reached step 1, had not yet been transmitted to the network. (This thus
- includes any text sent during the execution of the current task, regardless of whether the user
- agent is able to transmit text asynchronously with script execution.) This does not include
- framing overhead incurred by the protocol, or buffering done by the operating system or network
- hardware. If the connection is closed, this attribute's value will only increase with each call to
- the <code id=the-websocket-interface:dom-websocket-send-6><a href=#dom-websocket-send>send()</a></code> method (the number does not reset to zero once
- the connection closes).</p>
- <div class=example>
- <p>In this simple example, the <code id=the-websocket-interface:dom-websocket-bufferedamount-2><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code>
- attribute is used to ensure that updates are sent either at the rate of one update every 50ms, if
- the network can handle that rate, or at whatever rate the network <em>can</em> handle, if that is
- too fast.</p>
- <pre>var socket = new WebSocket('ws://game.example.com:12010/updates');
- socket.onopen = function () {
- setInterval(function() {
- if (socket.bufferedAmount == 0)
- socket.send(getUpdateData());
- }, 50);
- };</pre>
- <p>The <code id=the-websocket-interface:dom-websocket-bufferedamount-3><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute can also be
- used to saturate the network without sending the data at a higher rate than the network can
- handle, though this requires more careful monitoring of the value of the attribute over time.</p>
- </div>
- <hr>
- <p>When a <code id=the-websocket-interface:websocket-3><a href=#websocket>WebSocket</a></code> object is created, its <dfn id=dom-websocket-binarytype><code>binaryType</code></dfn> IDL attribute must be set to the string
- "<code id=the-websocket-interface:dom-binarytype-blob-2><a href=#dom-binarytype-blob>blob</a></code>". On getting, it must return the last value it was
- set to. On setting, the user agent must set the IDL attribute to the new value.</p>
- <p class=note>This attribute allows authors to control how binary data is exposed to scripts. By
- setting the attribute to "<dfn id=dom-binarytype-blob><code>blob</code></dfn>", binary data
- is returned in <code id=the-websocket-interface:blob-2><a href=#blob>Blob</a></code> form; by setting it to "<dfn id=dom-binarytype-arraybuffer><code>arraybuffer</code></dfn>", it is returned in
- <code id=the-websocket-interface:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> form. User agents can use this as a hint for how to handle incoming
- binary data: if the attribute is set to "<code id=the-websocket-interface:dom-binarytype-blob-3><a href=#dom-binarytype-blob>blob</a></code>", it is
- safe to spool it to disk, and if it is set to "<code id=the-websocket-interface:dom-binarytype-arraybuffer-2><a href=#dom-binarytype-arraybuffer>arraybuffer</a></code>", it is likely more efficient to keep the
- data in memory. Naturally, user agents are encouraged to use more subtle heuristics to decide
- whether to keep incoming data in memory or not, e.g. based on how big the data is or how common it
- is for a script to change the attribute at the last minute. This latter aspect is important in
- particular because it is quite possible for the attribute to be changed after the user agent has
- received the data but before the user agent has fired the event for it.</p>
- <p>The <dfn id=dom-websocket-send><code>send(<var>data</var>)</code></dfn> method transmits
- data using the connection. If the <code id=the-websocket-interface:dom-websocket-readystate-7><a href=#dom-websocket-readystate>readyState</a></code>
- attribute is <code id=the-websocket-interface:dom-websocket-connecting-3><a href=#dom-websocket-connecting>CONNECTING</a></code>, it must throw an
- <code id=the-websocket-interface:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception. Otherwise, the user agent must run the appropriate set
- of steps from the following list:</p>
- <dl><dt>If the argument is a string<dd>
- <p>Let <var>data</var> be the result of <a href=#convert-a-domstring-to-a-sequence-of-unicode-characters id=the-websocket-interface:convert-a-domstring-to-a-sequence-of-unicode-characters-2>converting the <var>data</var> argument to a sequence of Unicode
- characters</a>. If <i id=the-websocket-interface:concept-websocket-established-4><a href=#concept-websocket-established>the WebSocket connection is
- established</a></i> and <i id=the-websocket-interface:concept-websocket-closing-handshake-3><a href=#concept-websocket-closing-handshake>the WebSocket closing
- handshake has not yet started</a></i>, then the user agent must <i id=the-websocket-interface:concept-websocket-send><a href=#concept-websocket-send>send a WebSocket Message</a></i> comprised of <var>data</var> using
- a text frame opcode; if the data cannot be sent, e.g. because it would need to be buffered but
- the buffer is full, the user agent must <a href=#concept-websocket-close-fail id=the-websocket-interface:concept-websocket-close-fail>flag the
- WebSocket as full</a> and then <i id=the-websocket-interface:concept-websocket-close-5><a href=#concept-websocket-close>close the WebSocket
- connection</a></i>. Any invocation of this method with a string argument that does not throw an
- exception must increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-4><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code>
- attribute by the number of bytes needed to express the argument as UTF-8. <a href=#refsUNICODE>[UNICODE]</a>
- <a href=#refsENCODING>[ENCODING]</a> <a href=#refsWSP>[WSP]</a></p>
- <dt>If the argument is a <code id=the-websocket-interface:blob-3><a href=#blob>Blob</a></code> object<dd>
- <p>If <i id=the-websocket-interface:concept-websocket-established-5><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
- <i id=the-websocket-interface:concept-websocket-closing-handshake-4><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
- started</a></i>, then the user agent must <i id=the-websocket-interface:concept-websocket-send-2><a href=#concept-websocket-send>send a WebSocket
- Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
- sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
- <a href=#concept-websocket-close-fail id=the-websocket-interface:concept-websocket-close-fail-2>flag the WebSocket as full</a> and then <i id=the-websocket-interface:concept-websocket-close-6><a href=#concept-websocket-close>close the WebSocket connection</a></i>. The data to be sent is the
- raw data represented by the <code id=the-websocket-interface:blob-4><a href=#blob>Blob</a></code> object. Any invocation of this method with a
- <code id=the-websocket-interface:blob-5><a href=#blob>Blob</a></code> argument that does not throw an exception must increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-5><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the size of the
- <code id=the-websocket-interface:blob-6><a href=#blob>Blob</a></code> object's raw data, in bytes. <a href=#refsWSP>[WSP]</a> <a href=#refsFILEAPI>[FILEAPI]</a></p>
- <dt>If the argument is an <code id=the-websocket-interface:arraybuffer-3><a href=#arraybuffer>ArrayBuffer</a></code> object<dd>
- <p>If <i id=the-websocket-interface:concept-websocket-established-6><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
- <i id=the-websocket-interface:concept-websocket-closing-handshake-5><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
- started</a></i>, then the user agent must <i id=the-websocket-interface:concept-websocket-send-3><a href=#concept-websocket-send>send a WebSocket
- Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
- sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
- <a href=#concept-websocket-close-fail id=the-websocket-interface:concept-websocket-close-fail-3>flag the WebSocket as full</a> and then <i id=the-websocket-interface:concept-websocket-close-7><a href=#concept-websocket-close>close the WebSocket connection</a></i>. The data to be sent is the
- data stored in the buffer described by the <code id=the-websocket-interface:arraybuffer-4><a href=#arraybuffer>ArrayBuffer</a></code> object. Any invocation of
- this method with an <code id=the-websocket-interface:arraybuffer-5><a href=#arraybuffer>ArrayBuffer</a></code> argument that does not throw an exception must
- increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-6><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the
- length of the <code id=the-websocket-interface:arraybuffer-6><a href=#arraybuffer>ArrayBuffer</a></code> in bytes. <a href=#refsWSP>[WSP]</a> <a href=#refsECMA262>[ECMA262]</a></p>
- <dt>If the argument is an object that matches the <code id=the-websocket-interface:arraybufferview-2><a href=#arraybufferview>ArrayBufferView</a></code> type definition<dd>
- <p>If <i id=the-websocket-interface:concept-websocket-established-7><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, and
- <i id=the-websocket-interface:concept-websocket-closing-handshake-6><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake has not yet
- started</a></i>, then the user agent must <i id=the-websocket-interface:concept-websocket-send-4><a href=#concept-websocket-send>send a WebSocket
- Message</a></i> comprised of <var>data</var> using a binary frame opcode; if the data cannot be
- sent, e.g. because it would need to be buffered but the buffer is full, the user agent must
- <a href=#concept-websocket-close-fail id=the-websocket-interface:concept-websocket-close-fail-4>flag the WebSocket as full</a> and then <i id=the-websocket-interface:concept-websocket-close-8><a href=#concept-websocket-close>close the WebSocket connection</a></i>. The data to be sent is the
- data stored in the section of the buffer described by the <code id=the-websocket-interface:arraybuffer-7><a href=#arraybuffer>ArrayBuffer</a></code> object that
- <var>data</var> references. Any invocation of this method with this kind of argument that does
- not throw an exception must increase the <code id=the-websocket-interface:dom-websocket-bufferedamount-7><a href=#dom-websocket-bufferedamount>bufferedAmount</a></code> attribute by the length of
- <var>data</var>'s buffer in bytes. <a href=#refsWSP>[WSP]</a> <a href=#refsECMA262>[ECMA262]</a></p>
- </dl>
- <hr>
- <p>The following are the <a href=#event-handlers id=the-websocket-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=the-websocket-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=the-websocket-interface:event-handler-idl-attributes>event
- handler IDL attributes</a>, by all objects implementing the <code id=the-websocket-interface:websocket-4><a href=#websocket>WebSocket</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=the-websocket-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=the-websocket-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-websocket-onopen><code>onopen</code></dfn> <td> <code id=the-websocket-interface:event-open><a href=#event-open>open</a></code>
- <tr><td><dfn id=handler-websocket-onmessage><code>onmessage</code></dfn> <td> <code id=the-websocket-interface:event-message><a href=#event-message>message</a></code>
- <tr><td><dfn id=handler-websocket-onerror><code>onerror</code></dfn> <td> <code id=the-websocket-interface:event-error><a href=#event-error>error</a></code>
- <tr><td><dfn id=handler-websocket-onclose><code>onclose</code></dfn> <td> <code id=the-websocket-interface:event-close-6><a href=#event-close>close</a></code>
- </table>
- <h4 id=feedback-from-the-protocol>9.3.3 Feedback from the protocol</h4>
- <p>When <i id=feedback-from-the-protocol:concept-websocket-established><a href=#concept-websocket-established>the WebSocket connection is established</a></i>, the
- user agent must <a href=#queue-a-task id=feedback-from-the-protocol:queue-a-task>queue a task</a> to run these steps:</p>
- <ol><li><p>If the <code id=feedback-from-the-protocol:websocket><a href=#websocket>WebSocket</a></code> object's <a href=#client-specified-protocols id=feedback-from-the-protocol:client-specified-protocols>client-specified protocols</a> was not an
- empty list, but the <i id=feedback-from-the-protocol:concept-websocket-subprotocol><a href=#concept-websocket-subprotocol>subprotocol in use</a></i> is the null
- value, then <i id=feedback-from-the-protocol:concept-websocket-fail><a href=#concept-websocket-fail>fail the WebSocket connection</a></i>, set the <code id=feedback-from-the-protocol:dom-websocket-readystate><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code id=feedback-from-the-protocol:dom-websocket-closing><a href=#dom-websocket-closing>CLOSING</a></code> (2), and abort these steps. <a href=#refsWSP>[WSP]</a><li><p>Change the <code id=feedback-from-the-protocol:dom-websocket-readystate-2><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to
- <code id=feedback-from-the-protocol:dom-websocket-open><a href=#dom-websocket-open>OPEN</a></code> (1).<li><p>Change the <code id=feedback-from-the-protocol:dom-websocket-extensions><a href=#dom-websocket-extensions>extensions</a></code> attribute's value to
- the <i id=feedback-from-the-protocol:concept-websockets-active-extensions><a href=#concept-websockets-active-extensions>extensions in use</a></i>, if is not the null
- value. <a href=#refsWSP>[WSP]</a><li><p>Change the <code id=feedback-from-the-protocol:dom-websocket-protocol><a href=#dom-websocket-protocol>protocol</a></code> attribute's value to the
- <i id=feedback-from-the-protocol:concept-websocket-subprotocol-2><a href=#concept-websocket-subprotocol>subprotocol in use</a></i>, if is not the null value. <a href=#refsWSP>[WSP]</a><li><p>Act as if the user agent had <a href=#receives-a-set-cookie-string id=feedback-from-the-protocol:receives-a-set-cookie-string>received a
- set-cookie-string</a> consisting of the <a href=#concept-websocket-handshake-cookies id=feedback-from-the-protocol:concept-websocket-handshake-cookies>cookies set during the server's opening
- handshake</a>, for the URL <var>url</var> given to the <code id=feedback-from-the-protocol:dom-websocket><a href=#dom-websocket>WebSocket()</a></code> constructor. <a href=#refsCOOKIES>[COOKIES]</a> <a href=#refsENCODING>[ENCODING]</a>
- <a href=#refsWSP>[WSP]</a><li><p><a href=#fire-a-simple-event id=feedback-from-the-protocol:fire-a-simple-event>Fire a simple event</a> named <code id=feedback-from-the-protocol:event-open><a href=#event-open>open</a></code> at the
- <code id=feedback-from-the-protocol:websocket-2><a href=#websocket>WebSocket</a></code> object.</p>
- </ol>
- <hr>
- <p>When <i id=feedback-from-the-protocol:concept-websocket-message-received><a href=#concept-websocket-message-received>a WebSocket message has been received</a></i>
- with type <var>type</var> and data <var>data</var>, the user agent must <a href=#queue-a-task id=feedback-from-the-protocol:queue-a-task-2>queue a task</a>
- to follow these steps: <a href=#refsWSP>[WSP]</a></p>
- <ol><li>
- <p>If the <code id=feedback-from-the-protocol:dom-websocket-readystate-3><a href=#dom-websocket-readystate>readyState</a></code> attribute's value is not
- <code id=feedback-from-the-protocol:dom-websocket-open-2><a href=#dom-websocket-open>OPEN</a></code> (1), then abort these steps.</p>
- <li>
- <p>Let <var>event</var> be a newly created <a href=#concept-events-trusted id=feedback-from-the-protocol:concept-events-trusted>trusted</a>
- event that uses the <code id=feedback-from-the-protocol:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the event type <code id=feedback-from-the-protocol:event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
- default action.</p>
- <li><p>Initialise <var>event</var>'s <code id=feedback-from-the-protocol:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code>
- attribute to the <a href=#unicode-serialisation-of-an-origin id=feedback-from-the-protocol:unicode-serialisation-of-an-origin>Unicode serialisation</a>
- of the <a href=#origin-2 id=feedback-from-the-protocol:origin-2>origin</a> of the <a href=#url id=feedback-from-the-protocol:url>URL</a> that was passed to the <code id=feedback-from-the-protocol:websocket-3><a href=#websocket>WebSocket</a></code>
- object's constructor.<li>
- <p>If <var>type</var> indicates that the data is Text, then initialise <var>event</var>'s <code id=feedback-from-the-protocol:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute to <var>data</var>.
- <p>If <var>type</var> indicates that the data is Binary, and <code id=feedback-from-the-protocol:dom-websocket-binarytype><a href=#dom-websocket-binarytype>binaryType</a></code> is set to "<code id=feedback-from-the-protocol:dom-binarytype-blob><a href=#dom-binarytype-blob>blob</a></code>", then initialise <var>event</var>'s <code id=feedback-from-the-protocol:dom-messageevent-data-2><a href=#dom-messageevent-data>data</a></code> attribute to a new <code id=feedback-from-the-protocol:blob><a href=#blob>Blob</a></code> object that
- represents <var>data</var> as its raw data. <a href=#refsFILEAPI>[FILEAPI]</a></p>
- <p>If <var>type</var> indicates that the data is Binary, and <code id=feedback-from-the-protocol:dom-websocket-binarytype-2><a href=#dom-websocket-binarytype>binaryType</a></code> is set to "<code id=feedback-from-the-protocol:dom-binarytype-arraybuffer><a href=#dom-binarytype-arraybuffer>arraybuffer</a></code>", then initialise <var>event</var>'s
- <code id=feedback-from-the-protocol:dom-messageevent-data-3><a href=#dom-messageevent-data>data</a></code> attribute to a new <code id=feedback-from-the-protocol:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code>
- object whose contents are <var>data</var>. <a href=#refsECMA262>[ECMA262]</a></p>
- <li>
- <p><a href=#concept-event-dispatch id=feedback-from-the-protocol:concept-event-dispatch>Dispatch</a> <var>event</var> at the
- <code id=feedback-from-the-protocol:websocket-4><a href=#websocket>WebSocket</a></code> object.</p>
- </ol>
- <p class=note>User agents are encouraged to check if they can perform the above steps
- efficiently before they run the task, picking tasks from other <a href=#task-queue id=feedback-from-the-protocol:task-queue>task
- queues</a> while they prepare the buffers if not. For example, if the <code id=feedback-from-the-protocol:dom-websocket-binarytype-3><a href=#dom-websocket-binarytype>binaryType</a></code> attribute was set to "<code id=feedback-from-the-protocol:dom-binarytype-blob-2><a href=#dom-binarytype-blob>blob</a></code>" when the data arrived, and the user agent spooled all
- the data to disk, but just before running the above <a href=#concept-task id=feedback-from-the-protocol:concept-task>task</a> for
- this particular message the script switched <code id=feedback-from-the-protocol:dom-websocket-binarytype-4><a href=#dom-websocket-binarytype>binaryType</a></code> to "<code id=feedback-from-the-protocol:dom-binarytype-arraybuffer-2><a href=#dom-binarytype-arraybuffer>arraybuffer</a></code>", the user agent would want to page the
- data back to RAM before running this <a href=#concept-task id=feedback-from-the-protocol:concept-task-2>task</a> so as to avoid
- stalling the main thread while it created the <code id=feedback-from-the-protocol:arraybuffer-2><a href=#arraybuffer>ArrayBuffer</a></code> object.</p>
- <div class=example>
- <p>Here is an example of how to define a handler for the <code id=feedback-from-the-protocol:event-message-2><a href=#event-message>message</a></code> event in the case of text frames:</p>
- <pre>mysocket.onmessage = function (event) {
- if (event.data == 'on') {
- turnLampOn();
- } else if (event.data == 'off') {
- turnLampOff();
- }
- };</pre>
- <p>The protocol here is a trivial one, with the server just sending "on" or "off" messages.</p>
- </div>
- <hr>
- <p>When <i id=feedback-from-the-protocol:concept-websocket-closing-handshake><a href=#concept-websocket-closing-handshake>the WebSocket closing handshake is
- started</a></i>, the user agent must <a href=#queue-a-task id=feedback-from-the-protocol:queue-a-task-3>queue a task</a> to change the <code id=feedback-from-the-protocol:dom-websocket-readystate-4><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to <code id=feedback-from-the-protocol:dom-websocket-closing-2><a href=#dom-websocket-closing>CLOSING</a></code> (2). (If the <code id=feedback-from-the-protocol:dom-websocket-close><a href=#dom-websocket-close>close()</a></code> method was called, the <code id=feedback-from-the-protocol:dom-websocket-readystate-5><a href=#dom-websocket-readystate>readyState</a></code> attribute's value will already be set to <code id=feedback-from-the-protocol:dom-websocket-closing-3><a href=#dom-websocket-closing>CLOSING</a></code> (2) when this task runs.) <a href=#refsWSP>[WSP]</a></p>
- <hr>
- <p id=closeWebSocket>When <i id=feedback-from-the-protocol:concept-websocket-closed><a href=#concept-websocket-closed>the WebSocket connection is
- closed</a></i>, possibly <i>cleanly</i>, the user agent must <a href=#queue-a-task id=feedback-from-the-protocol:queue-a-task-4>queue a task</a> to run the
- following substeps:</p>
- <ol><li><p>Change the <code id=feedback-from-the-protocol:dom-websocket-readystate-6><a href=#dom-websocket-readystate>readyState</a></code> attribute's value to
- <code id=feedback-from-the-protocol:dom-websocket-closed><a href=#dom-websocket-closed>CLOSED</a></code> (3).<li><p>If the user agent was required to <i id=feedback-from-the-protocol:concept-websocket-fail-2><a href=#concept-websocket-fail>fail the WebSocket
- connection</a></i>, or if the <i id=feedback-from-the-protocol:concept-websocket-closed-2><a href=#concept-websocket-closed>the WebSocket connection was
- closed</a></i> after being <dfn id=concept-websocket-close-fail>flagged as full</dfn>,
- <a href=#fire-a-simple-event id=feedback-from-the-protocol:fire-a-simple-event-2>fire a simple event</a> named <code>error</code> at the <code id=feedback-from-the-protocol:websocket-5><a href=#websocket>WebSocket</a></code>
- object. <a href=#refsWSP>[WSP]</a><li><p>Create a <a href=#concept-events-trusted id=feedback-from-the-protocol:concept-events-trusted-2>trusted</a> event that uses the
- <code id=feedback-from-the-protocol:closeevent><a href=#closeevent>CloseEvent</a></code> interface, with the event type <code id=feedback-from-the-protocol:event-close><a href=#event-close>close</a></code>,
- which does not bubble, is not cancelable, has no default action, whose <code id=feedback-from-the-protocol:dom-closeevent-wasclean><a href=#dom-closeevent-wasclean>wasClean</a></code> attribute is initialised to true if the
- connection closed <i>cleanly</i> and false otherwise, whose <code id=feedback-from-the-protocol:dom-closeevent-code><a href=#dom-closeevent-code>code</a></code> attribute is initialised to <i id=feedback-from-the-protocol:concept-websocket-close-code><a href=#concept-websocket-close-code>the WebSocket connection close code</a></i>, and whose <code id=feedback-from-the-protocol:dom-closeevent-reason><a href=#dom-closeevent-reason>reason</a></code> attribute is initialised to the result of applying
- the <a href=#utf-8-decoder id=feedback-from-the-protocol:utf-8-decoder>UTF-8 decoder</a> to <i id=feedback-from-the-protocol:concept-websocket-close-reason><a href=#concept-websocket-close-reason>the WebSocket
- connection close reason</a></i>, and <a href=#concept-event-dispatch id=feedback-from-the-protocol:concept-event-dispatch-2>dispatch</a> the event
- at the <code id=feedback-from-the-protocol:websocket-6><a href=#websocket>WebSocket</a></code> object. <a href=#refsWSP>[WSP]</a></ol>
- <div class=warning>
- <p>User agents must not convey any failure information to scripts in a way that would allow a
- script to distinguish the following situations:</p>
- <ul><li>A server whose host name could not be resolved.
- <li>A server to which packets could not successfully be routed.
- <li>A server that refused the connection on the specified port.
- <li>A server that failed to correctly perform a TLS handshake (e.g., the server certificate
- can't be verified).
- <li>A server that did not complete the opening handshake (e.g. because it was not a WebSocket
- server).
- <li>A WebSocket server that sent a correct opening handshake, but that specified options that
- caused the client to drop the connection (e.g. the server specified a subprotocol that the
- client did not offer).
- <li>A WebSocket server that abruptly closed the connection after successfully completing the
- opening handshake.
- </ul>
- <p>In all of these cases, the <i id=feedback-from-the-protocol:concept-websocket-close-code-2><a href=#concept-websocket-close-code>the WebSocket connection close code</a></i> would be 1006, as
- required by the WebSocket Protocol specification. <a href=#refsWSP>[WSP]</a></p>
- <p>Allowing a script to distinguish these cases would allow a script to probe the user's local
- network in preparation for an attack.</p>
- <p class=note>In particular, this means the code 1015 is not used by the user agent (unless the
- server erroneously uses it in its close frame, of course).</p>
- </div>
- <hr>
- <p>The <a href=#task-source id=feedback-from-the-protocol:task-source>task source</a> for all <a href=#concept-task id=feedback-from-the-protocol:concept-task-3>tasks</a> <a href=#queue-a-task id=feedback-from-the-protocol:queue-a-task-5>queued</a> in this section is the <dfn id=websocket-task-source>WebSocket task source</dfn>.</p>
- <h4 id=ping-and-pong-frames>9.3.4 Ping and Pong frames</h4>
- <p>The WebSocket protocol specification defines Ping and Pong frames that can be used for
- keep-alive, heart-beats, network status probing, latency instrumentation, and so forth. These are
- not currently exposed in the API.</p>
- <p>User agents may send ping and unsolicited pong frames as desired, for example in an attempt to
- maintain local network NAT mappings, to detect failed connections, or to display latency metrics
- to the user. User agents must not use pings or unsolicited pongs to aid the server; it is assumed
- that servers will solicit pongs whenever appropriate for the server's needs.</p>
-
- <h4 id=parsing-websocket-urls>9.3.5 Parsing WebSocket URLs</h4>
- <p>The steps to <dfn id="parse-a-websocket-url's-components">parse a WebSocket URL's components</dfn> from a string <var>url</var> are as
- follows. These steps return either a <var>host</var>, a <var>port</var>, a <var>resource
- name</var>, and a <var>secure</var> flag, or they fail.</p>
- <ol><li><p>If the <var>url</var> string is not an <a href=#absolute-url id=parsing-websocket-urls:absolute-url>absolute URL</a>, then fail this
- algorithm.<li>
- <p><a href=#resolve-a-url id=parsing-websocket-urls:resolve-a-url>Resolve</a> the <var>url</var> string, with the URL character
- encoding set to UTF-8. <a href=#refsENCODING>[ENCODING]</a></p>
- <p class=note>It doesn't matter what it is resolved relative to, since we already know it is
- an <a href=#absolute-url id=parsing-websocket-urls:absolute-url-2>absolute URL</a> at this point.</p>
- <li><p>If the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url>parsed URL</a> does not have a <a href=#concept-url-scheme id=parsing-websocket-urls:concept-url-scheme>scheme</a> component whose value is either "<code>ws</code>" or "<code>wss</code>", then fail this algorithm.<li><p>If the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url-2>parsed URL</a> has a non-null <a href=#concept-url-fragment id=parsing-websocket-urls:concept-url-fragment>fragment</a> component, then fail this algorithm.<li><p>If the <a href=#concept-url-scheme id=parsing-websocket-urls:concept-url-scheme-2>scheme</a> component of the resulting
- <a href=#parsed-url id=parsing-websocket-urls:parsed-url-3>parsed URL</a> is "<code>ws</code>", set <var>secure</var> to false;
- otherwise, the <a href=#concept-url-scheme id=parsing-websocket-urls:concept-url-scheme-3>scheme</a> component is "<code>wss</code>", set <var>secure</var> to true.<li><p>Let <var>host</var> be the value of the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url-4>parsed URL</a>'s <a href=#concept-url-host id=parsing-websocket-urls:concept-url-host>host</a> component.<li><p>If the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url-5>parsed URL</a> has a <a href=#concept-url-port id=parsing-websocket-urls:concept-url-port>port</a>
- component that is not the empty string, then let <var>port</var> be that component's value;
- otherwise, there is no explicit <var>port</var>.<li><p>If there is no explicit <var>port</var>, then: if <var>secure</var> is false, let
- <var>port</var> be 80, otherwise let <var>port</var> be 443.<li><p>Let <var>resource name</var> be the value of the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url-6>parsed URL</a>'s <a href=#concept-url-path id=parsing-websocket-urls:concept-url-path>path</a> component (which might be empty).<li><p>If <var>resource name</var> is the empty string, set it to a single character U+002F
- SOLIDUS (/).<li><p>If the resulting <a href=#parsed-url id=parsing-websocket-urls:parsed-url-7>parsed URL</a> has a non-null <a href=#concept-url-query id=parsing-websocket-urls:concept-url-query>query</a> component, then append a single U+003F QUESTION MARK
- character (?) to <var>resource name</var>, followed by the value of the <a href=#concept-url-query id=parsing-websocket-urls:concept-url-query-2>query</a> component.<li><p>Return <var>host</var>, <var>port</var>, <var>resource name</var>, and
- <var>secure</var>.</ol>
- <h4 id=the-closeevent-interfaces>9.3.6 The <code id=the-closeevent-interfaces:closeevent><a href=#closeevent>CloseEvent</a></code> interfaces</h4>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#closeeventinit id=the-closeevent-interfaces:closeeventinit>CloseEventInit</a> eventInitDict), Exposed=(Window,Worker)]
- interface <dfn id=closeevent>CloseEvent</dfn> : <a href=#event id=the-closeevent-interfaces:event>Event</a> {
- readonly attribute boolean <a href=#dom-closeevent-wasclean id=the-closeevent-interfaces:dom-closeevent-wasclean>wasClean</a>;
- readonly attribute unsigned short <a href=#dom-closeevent-code id=the-closeevent-interfaces:dom-closeevent-code>code</a>;
- readonly attribute DOMString <a href=#dom-closeevent-reason id=the-closeevent-interfaces:dom-closeevent-reason>reason</a>;
- };
- dictionary <dfn id=closeeventinit>CloseEventInit</dfn> : <a href=#eventinit id=the-closeevent-interfaces:eventinit>EventInit</a> {
- boolean wasClean;
- unsigned short code;
- DOMString reason;
- };</pre>
- <p>The <dfn id=dom-closeevent-wasclean><code>wasClean</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- false. It represents whether the connection closed cleanly or not.</p>
- <p>The <dfn id=dom-closeevent-code><code>code</code></dfn> attribute must return the value it
- was initialised to. When the object is created, this attribute must be initialised to zero. It
- represents the WebSocket connection close code provided by the server.</p>
- <p>The <dfn id=dom-closeevent-reason><code>reason</code></dfn> attribute must return the
- value it was initialised to. When the object is created, this attribute must be initialised to
- empty string. It represents the WebSocket connection close reason provided by the server.</p>
- <h4 id=garbage-collection-3>9.3.7 Garbage collection</h4>
- <p>A <code id=garbage-collection-3:websocket><a href=#websocket>WebSocket</a></code> object whose <code id=garbage-collection-3:dom-websocket-readystate><a href=#dom-websocket-readystate>readyState</a></code>
- attribute's value was set to <code id=garbage-collection-3:dom-websocket-connecting><a href=#dom-websocket-connecting>CONNECTING</a></code> (0) as of
- the last time the <a href=#event-loop id=garbage-collection-3:event-loop>event loop</a> reached step 1 must not be garbage collected if there
- are any event listeners registered for <code id=garbage-collection-3:event-open><a href=#event-open>open</a></code> events, <code id=garbage-collection-3:event-message><a href=#event-message>message</a></code> events, <code id=garbage-collection-3:event-error><a href=#event-error>error</a></code> events, or
- <code id=garbage-collection-3:event-close><a href=#event-close>close</a></code> events.</p>
- <p>A <code id=garbage-collection-3:websocket-2><a href=#websocket>WebSocket</a></code> object whose <code id=garbage-collection-3:dom-websocket-readystate-2><a href=#dom-websocket-readystate>readyState</a></code>
- attribute's value was set to <code id=garbage-collection-3:dom-websocket-open><a href=#dom-websocket-open>OPEN</a></code> (1) as of the last time
- the <a href=#event-loop id=garbage-collection-3:event-loop-2>event loop</a> reached step 1 must not be garbage collected if there are any event
- listeners registered for <code id=garbage-collection-3:event-message-2><a href=#event-message>message</a></code> events, <code id=garbage-collection-3:event-error-2><a href=#event-error>error</a></code>, or <code id=garbage-collection-3:event-close-2><a href=#event-close>close</a></code> events.</p>
- <p>A <code id=garbage-collection-3:websocket-3><a href=#websocket>WebSocket</a></code> object whose <code id=garbage-collection-3:dom-websocket-readystate-3><a href=#dom-websocket-readystate>readyState</a></code>
- attribute's value was set to <code id=garbage-collection-3:dom-websocket-closing><a href=#dom-websocket-closing>CLOSING</a></code> (2) as of the
- last time the <a href=#event-loop id=garbage-collection-3:event-loop-3>event loop</a> reached step 1 must not be garbage collected if there are
- any event listeners registered for <code id=garbage-collection-3:event-error-3><a href=#event-error>error</a></code> or <code id=garbage-collection-3:event-close-3><a href=#event-close>close</a></code> events.</p>
- <p>A <code id=garbage-collection-3:websocket-4><a href=#websocket>WebSocket</a></code> object with <i id=garbage-collection-3:concept-websocket-established><a href=#concept-websocket-established>an
- established connection</a></i> that has data queued to be transmitted to the network must not be
- garbage collected. <a href=#refsWSP>[WSP]</a></p>
- <p>If a <code id=garbage-collection-3:websocket-5><a href=#websocket>WebSocket</a></code> object is garbage collected while its connection is still open, the
- user agent must <i id=garbage-collection-3:concept-websocket-start-closing-handshake><a href=#concept-websocket-start-closing-handshake>start the WebSocket closing
- handshake</a></i>, with no status code for the Close message. <a href=#refsWSP>[WSP]</a></p>
- <hr>
- <p>If a user agent is to <dfn id=make-disappear>make disappear</dfn> a <code id=garbage-collection-3:websocket-6><a href=#websocket>WebSocket</a></code> object (this happens
- when a <code id=garbage-collection-3:document><a href=#document>Document</a></code> object goes away), the user agent must follow the first appropriate
- set of steps from the following list:</p>
- <dl class=switch><dt>If the WebSocket connection is not yet <i id=garbage-collection-3:concept-websocket-established-2><a href=#concept-websocket-established>established</a></i> <a href=#refsWSP>[WSP]</a><dd>
- <p><i id=garbage-collection-3:concept-websocket-fail><a href=#concept-websocket-fail>Fail the WebSocket connection</a></i>. <a href=#refsWSP>[WSP]</a></p>
- <dt>If the WebSocket closing handshake has not yet been <i id=garbage-collection-3:concept-websocket-closing-handshake><a href=#concept-websocket-closing-handshake>started</a></i> <a href=#refsWSP>[WSP]</a><dd>
- <p><i id=garbage-collection-3:concept-websocket-start-closing-handshake-2><a href=#concept-websocket-start-closing-handshake>Start the WebSocket closing
- handshake</a></i>, with the status code to use in the WebSocket Close message being
- 1001. <a href=#refsWSP>[WSP]</a></p>
- <dt>Otherwise<dd>
- <p>Do nothing.</p>
- </dl>
- <h3 id=web-messaging>9.4 <dfn id=crossDocumentMessages>Cross-document messaging</dfn></h3>
- <p>Web browsers, for security and privacy reasons, prevent documents in different domains from
- affecting each other; that is, cross-site scripting is disallowed.</p>
- <p>While this is an important security feature, it prevents pages from different domains from
- communicating even when those pages are not hostile. This section introduces a messaging system
- that allows documents to communicate with each other regardless of their source domain, in a way
- designed to not enable cross-site scripting attacks.</p>
- <p class=note>This API <a href=fingerprint-postMessage>has some privacy implications</a> that
- may not be immediately obvious.</p>
-
- <p>The <a href=#task-source id=web-messaging:task-source>task source</a> for the <a href=#concept-task id=web-messaging:concept-task>tasks</a> in
- <a href=#web-messaging id=web-messaging:web-messaging>cross-document messaging</a> is the <dfn id=posted-message-task-source>posted message task source</dfn>.</p>
-
- <h4 id=introduction-13>9.4.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>For example, if document A contains an <code id=introduction-13:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element that contains document B,
- and script in document A calls <code id=introduction-13:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> on the
- <code id=introduction-13:window><a href=#window>Window</a></code> object of document B, then a message event will be fired on that object,
- marked as originating from the <code id=introduction-13:window-2><a href=#window>Window</a></code> of document A. The script in document A might
- look like:</p>
- <pre>var o = document.getElementsByTagName('iframe')[0];
- o.contentWindow.postMessage('Hello world', 'http://b.example.org/');</pre>
- <p>To register an event handler for incoming events, the script would use <code>addEventListener()</code> (or similar mechanisms). For example, the script in document B
- might look like:</p>
- <pre>window.addEventListener('message', receiver, false);
- function receiver(e) {
- if (e.origin == 'http://example.com') {
- if (e.data == 'Hello world') {
- e.source.postMessage('Hello', e.origin);
- } else {
- alert(e.data);
- }
- }
- }</pre>
- <p>This script first checks the domain is the expected domain, and then looks at the message,
- which it either displays to the user, or responds to by sending a message back to the document
- which sent the message in the first place.</p>
- </div>
- <h4 id=security-postmsg>9.4.2 Security</h4>
-
- <h5 id=authors>9.4.2.1 Authors</h5>
-
- <p id=security-4 class=warning>Use of this API requires extra care to protect users from
- hostile entities abusing a site for their own purposes.</p>
- <p>Authors should check the <code id=authors:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute to
- ensure that messages are only accepted from domains that they expect to receive messages from.
- Otherwise, bugs in the author's message handling code could be exploited by hostile sites.</p>
- <p>Furthermore, even after checking the <code id=authors:dom-messageevent-origin-2><a href=#dom-messageevent-origin>origin</a></code>
- attribute, authors should also check that the data in question is of the expected format.
- Otherwise, if the source of the event has been attacked using a cross-site scripting flaw, further
- unchecked processing of information sent using the <code id=authors:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code> method could result in the attack being
- propagated into the receiver.</p>
- <p>Authors should not use the wildcard keyword (*) in the <var>targetOrigin</var>
- argument in messages that contain any confidential information, as otherwise there is no way to
- guarantee that the message is only delivered to the recipient to which it was intended.</p>
- <hr>
- <p>Authors who accept messages from any origin are encouraged to consider the risks of a
- denial-of-service attack. An attacker could send a high volume of messages; if the receiving page
- performs expensive computation or causes network traffic to be sent for each such message, the
- attacker's message could be multplied into a denial-of-service attack. Authors are encouraged to
- employ rate limiting (only accepting a certain number of messages per minute) to make such attacks
- impractical.</p>
-
- <h5 id=user-agents>9.4.2.2 User agents</h5>
- <p>The integrity of this API is based on the inability for scripts of one <a href=#origin-2 id=user-agents:origin-2>origin</a> to
- post arbitrary events (using <code>dispatchEvent()</code> or otherwise) to objects in
- other origins (those that are not the <a href=#same-origin id=user-agents:same-origin>same</a>).</p>
- <p class=note>Implementors are urged to take extra care in the implementation of this feature.
- It allows authors to transmit information from one domain to another domain, which is normally
- disallowed for security reasons. It also requires that UAs be careful to allow access to certain
- properties but not others.</p>
- <hr>
- <p>User agents are also encouraged to consider rate-limiting message traffic between different
- <a href=#origin-2 id=user-agents:origin-2-2>origins</a>, to protect naïve sites from denial-of-service
- attacks.</p>
-
- <h4 id=posting-messages>9.4.3 Posting messages</h4>
- <dl class=domintro><dt><var>window</var> . <code id=posting-messages:dom-window-postmessage><a href=#dom-window-postmessage>postMessage</a></code>(<var>message</var>, <var>targetOrigin</var> [, <var>transfer</var> ] )<dd>
- <p>Posts a message to the given window. Messages can be structured objects, e.g. nested objects
- and arrays, can contain JavaScript values (strings, numbers, <code id=posting-messages:idl-date><a href=#idl-date>Date</a></code>
- objects, etc), and can contain certain data objects such as <code id=posting-messages:file><a href=#file>File</a></code> <code id=posting-messages:blob><a href=#blob>Blob</a></code>,
- <code id=posting-messages:filelist><a href=#filelist>FileList</a></code>, and <code id=posting-messages:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> objects.</p>
- <p>Objects listed in <var>transfer</var> are transferred, not just cloned, meaning that
- they are no longer usable on the sending side.</p>
- <p>If the origin of the target window doesn't match the given origin, the message is discarded,
- to avoid information leakage. To send the message to the target regardless of origin, set the
- target origin to "<code>*</code>". To restrict the message to same-origin targets only,
- without needing to explicitly state the origin, set the target origin to "<code>/</code>".</p>
- <p>Throws a <code id=posting-messages:datacloneerror><a href=#datacloneerror>DataCloneError</a></code> exception if <var>transfer</var> array contains
- duplicate objects or if <var>message</var> could not be cloned.</p>
- </dl>
- <p class=note>When posting a message to a <code id=posting-messages:window><a href=#window>Window</a></code> of a <a href=#browsing-context id=posting-messages:browsing-context>browsing context</a>
- that has just been navigated to a new <code id=posting-messages:document><a href=#document>Document</a></code> is likely to result in the message not
- receiving its intended recipient: the scripts in the target <a href=#browsing-context id=posting-messages:browsing-context-2>browsing context</a> have to
- have had time to set up listeners for the messages. Thus, for instance, in situations where a
- message is to be sent to the <code id=posting-messages:window-2><a href=#window>Window</a></code> of newly created child <code id=posting-messages:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- authors are advised to have the child <code id=posting-messages:document-2><a href=#document>Document</a></code> post a message to their parent
- announcing their readiness to receive messages, and for the parent to wait for this message before
- beginning posting messages.</p>
-
- <p>When a script invokes the <dfn id=dom-window-postmessage><code>postMessage(<var>message</var>, <var>targetOrigin</var>, <var>transfer</var>)</code></dfn> method (with two or three arguments) on a
- <code id=posting-messages:window-3><a href=#window>Window</a></code> object, the user agent must follow these steps:</p>
- <ol><li><p>If the value of the <var>targetOrigin</var> argument is neither a single U+002A
- ASTERISK character (*), a single U+002F SOLIDUS character (/), nor an <a href=#absolute-url id=posting-messages:absolute-url>absolute URL</a>,
- then throw a <code id=posting-messages:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort the overall set of steps.<li><p>Let <var>new ports</var> be an empty array.<li><p>Let <var>transfer map</var> be an empty association list of
- <code id=posting-messages:transferable><a href=#transferable>Transferable</a></code> objects to placeholder objects.<li>
- <p>If the method was invoked with a third argument <var>transfer</var>, run these
- substeps:</p>
- <ol><li><p>If any object is listed in <var>transfer</var> more than once, or any of the
- <code id=posting-messages:transferable-2><a href=#transferable>Transferable</a></code> objects listed in <var>transfer</var> are marked as <a href=#concept-transferable-neutered id=posting-messages:concept-transferable-neutered>neutered</a>, then throw a
- <code id=posting-messages:datacloneerror-2><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.<li><p>For each object <var>x</var> in <var>transfer</var> in turn, add a
- mapping from <var>x</var> to a new unique placeholder object created for <var>x</var> to <var>transfer map</var>, and if <var>x</var> is a
- <code id=posting-messages:messageport><a href=#messageport>MessagePort</a></code> object, also append the placeholder object to the <var>new
- ports</var> array.</ol>
- <li><p>Let <var>message clone</var> be the result of obtaining a <a href=#structured-clone id=posting-messages:structured-clone>structured
- clone</a> of the <var>message</var> argument, with <var>transfer map</var>
- as the <i>transfer map</i>. If this throws an exception, then throw that exception and abort
- these steps.<li>
- <p>If the method was invoked with a third argument <var>transfer</var>, run these
- substeps:</p>
- <ol><li><p>Let <var>new owner</var> be the <a href=#script-settings-object id=posting-messages:script-settings-object>script settings object</a> of the
- <code id=posting-messages:window-4><a href=#window>Window</a></code> object on which the method was invoked.<li><p>For each object <var>x</var> in <var>transfer</var> in turn, obtain
- a new object <var>y</var> by <a href=#transfer-a-transferable-object id=posting-messages:transfer-a-transferable-object>transferring</a> the object <var>x</var> to <var>new
- owner</var>, and replace the placeholder object that was created for the object <var>x</var> by the new object <var>y</var> wherever the placeholder exists
- (i.e. in <var>message clone</var> and in <var>new ports</var>).</ol>
- <li><p>Make <var>new ports</var> into a <a href=#dfn-read-only-array id=posting-messages:dfn-read-only-array>read
- only</a> array.<li><p>Return from the <code id=posting-messages:dom-window-postmessage-2><a href=#dom-window-postmessage>postMessage()</a></code> method, but
- asynchronously continue running these steps.<li>
- <p>If the <var>targetOrigin</var> argument is a single literal U+002F SOLIDUS
- character (/), and the <code id=posting-messages:document-3><a href=#document>Document</a></code> of the <code id=posting-messages:window-5><a href=#window>Window</a></code> object on which the
- method was invoked does not have the <a href=#same-origin id=posting-messages:same-origin>same origin</a> as the <a href=#responsible-document id=posting-messages:responsible-document>responsible
- document</a> specified by the <a href=#entry-settings-object id=posting-messages:entry-settings-object>entry settings object</a>, then abort these steps
- silently.</p>
- <p>Otherwise, if the <var>targetOrigin</var> argument is an <a href=#absolute-url id=posting-messages:absolute-url-2>absolute URL</a>,
- and the <code id=posting-messages:document-4><a href=#document>Document</a></code> of the <code id=posting-messages:window-6><a href=#window>Window</a></code> object on which the method was invoked
- does not have the <a href=#same-origin id=posting-messages:same-origin-2>same origin</a> as <var>targetOrigin</var>, then abort
- these steps silently.</p>
- <p>Otherwise, the <var>targetOrigin</var> argument is a single literal U+002A ASTERISK
- character (*), and no origin check is made.</p>
- <li><p>Create a <a href=#concept-events-trusted id=posting-messages:concept-events-trusted>trusted</a> event that uses the
- <code id=posting-messages:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the event type <code id=posting-messages:event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
- default action. The <code id=posting-messages:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
- initialised to the value of <var>message clone</var>, the <code id=posting-messages:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialised to the <a href=#unicode-serialisation-of-an-origin id=posting-messages:unicode-serialisation-of-an-origin>Unicode serialisation</a> of the
- <a href=#origin-2 id=posting-messages:origin-2>origin</a> specified by the <a href=#incumbent-settings-object id=posting-messages:incumbent-settings-object>incumbent settings object</a>, the <code id=posting-messages:dom-messageevent-source><a href=#dom-messageevent-source>source</a></code> attribute must be initialised to the
- <code id=posting-messages:windowproxy><a href=#windowproxy>WindowProxy</a></code> object corresponding to the <a href=#global-object id=posting-messages:global-object>global object</a> (a
- <code id=posting-messages:window-7><a href=#window>Window</a></code> object) specified by the <a href=#incumbent-settings-object id=posting-messages:incumbent-settings-object-2>incumbent settings object</a>, and the
- <code id=posting-messages:dom-messageevent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute must be initialised to the <var>new
- ports</var> array.<li><p><a href=#queue-a-task id=posting-messages:queue-a-task>Queue a task</a> to <a href=#concept-event-dispatch id=posting-messages:concept-event-dispatch>dispatch</a> the
- event created in the previous step at the <code id=posting-messages:window-8><a href=#window>Window</a></code> object on which the method was
- invoked. The <a href=#task-source id=posting-messages:task-source>task source</a> for this <a href=#concept-task id=posting-messages:concept-task>task</a> is the
- <a href=#posted-message-task-source id=posting-messages:posted-message-task-source>posted message task source</a>.</ol>
-
- <h3 id=channel-messaging>9.5 <dfn>Channel messaging</dfn></h3>
- <h4 id=introduction-14>9.5.1 Introduction</h4>
- <p><i>This section is non-normative.</i></p>
- <p>To enable independent pieces of code (e.g. running in different <a href=#browsing-context id=introduction-14:browsing-context>browsing contexts</a>) to communicate directly, authors can use <a href=#channel-messaging id=introduction-14:channel-messaging>channel
- messaging</a>.</p>
- <p>Communication channels in this mechanism are implemented as two-ways pipes, with a port at each
- end. Messages sent in one port are delivered at the other port, and vice-versa. Messages are
- asynchronous, and delivered as DOM events.</p>
- <p>To create a connection (two "entangled" ports), the <code>MessageChannel()</code>
- constructor is called:</p>
- <pre>var channel = new MessageChannel();</pre>
- <p>One of the ports is kept as the local port, and the other port is sent to the remote code, e.g.
- using <code id=introduction-14:dom-window-postmessage><a href=#dom-window-postmessage>postMessage()</a></code>:</p>
- <pre>otherWindow.postMessage('hello', 'http://example.com', [channel.port2]);</pre>
- <p>To send messages, the <code id=introduction-14:dom-messageport-postmessage><a href=#dom-messageport-postmessage>postMessage()</a></code> method on
- the port is used:</p>
- <pre>channel.port1.postMessage('hello');</pre>
- <p>To receive messages, one listens to <code id=introduction-14:event-message><a href=#event-message>message</a></code> events:</p>
- <pre>channel.port1.onmessage = handleMessage;
- function handleMessage(event) {
- // message is in event.data
- // ...
- }</pre>
- <p>Data sent on a port can be structured data; for example here an array of strings is passed on a
- <code id=introduction-14:messageport><a href=#messageport>MessagePort</a></code>:</p>
- <pre>port1.postMessage(['hello', 'world']);</pre>
- <h5 id=examples-5>9.5.1.1 Examples</h5>
- <p><i>This section is non-normative.</i></p>
- <div class=example>
- <p>In this example, two JavaScript libraries are connected to each other using
- <code id=examples-5:messageport><a href=#messageport>MessagePort</a></code>s. This allows the libraries to later be hosted in different frames, or
- in <code id=examples-5:worker><a href=#worker>Worker</a></code> objects, without any change to the APIs.</p>
- <pre><script src="contacts.js"></script> <!-- exposes a contacts object -->
- <script src="compose-mail.js"></script> <!-- exposes a composer object -->
- <script>
- var channel = new MessageChannel();
- composer.addContactsProvider(channel.port1);
- contacts.registerConsumer(channel.port2);
- </script></pre>
- <p>Here's what the "addContactsProvider()" function's implementation could look like:</p>
- <pre>function addContactsProvider(port) {
- port.onmessage = function (event) {
- switch (event.data.messageType) {
- 'search-result': handleSearchResult(event.data.results); break;
- 'search-done': handleSearchDone(); break;
- 'search-error': handleSearchError(event.data.message); break;
- // ...
- }
- };
- };</pre>
- <p>Alternatively, it could be implemented as follows:</p>
- <pre>function addContactsProvider(port) {
- port.addEventListener('message', function (event) {
- if (event.data.messageType == 'search-result')
- handleSearchResult(event.data.results);
- });
- port.addEventListener('message', function (event) {
- if (event.data.messageType == 'search-done')
- handleSearchDone();
- });
- port.addEventListener('message', function (event) {
- if (event.data.messageType == 'search-error')
- handleSearchError(event.data.message);
- });
- // ...
- port.start();
- };</pre>
- <p>The key difference is that when using <code id=examples-5:dom-eventtarget-addeventlistener><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code>, the <code id=examples-5:dom-messageport-start><a href=#dom-messageport-start>start()</a></code> method must also be invoked. When using <code id=examples-5:handler-messageport-onmessage><a href=#handler-messageport-onmessage>onmessage</a></code>, the call to <code id=examples-5:dom-messageport-start-2><a href=#dom-messageport-start>start()</a></code> is implied.</p>
- <p>The <code id=examples-5:dom-messageport-start-3><a href=#dom-messageport-start>start()</a></code> method, whether called explicitly or
- implicitly (by setting <code id=examples-5:handler-messageport-onmessage-2><a href=#handler-messageport-onmessage>onmessage</a></code>), starts the
- flow of messages: messages posted on message ports are initially paused, so that they don't get
- dropped on the floor before the script has had a chance to set up its handlers.</p>
- </div>
- <h5 id=ports-as-the-basis-of-an-object-capability-model-on-the-web>9.5.1.2 Ports as the basis of an object-capability model on the Web</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Ports can be viewed as a way to expose limited capabilities (in the object-capability model
- sense) to other actors in the system. This can either be a weak capability system, where the ports
- are merely used as a convenient model within a particular origin, or as a strong capability model,
- where they are provided by one origin <var>provider</var> as the only mechanism by which
- another origin <var>consumer</var> can effect change in or obtain information from <var>provider</var>.</p>
- <p>For example, consider a situation in which a social Web site embeds in one <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element><a href=#the-iframe-element>iframe</a></code>
- the user's e-mail contacts provider (an address book site, from a second origin), and in a second
- <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> a game (from a third origin). The outer social site and the game in the second
- <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code> cannot access anything inside the first <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>; together they can
- only:</p>
- <ul class=brief><li><a href=#navigate id=ports-as-the-basis-of-an-object-capability-model-on-the-web:navigate>Navigate</a> the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code> to a new <a href=#url id=ports-as-the-basis-of-an-object-capability-model-on-the-web:url>URL</a>, such as the same
- <a href=#url id=ports-as-the-basis-of-an-object-capability-model-on-the-web:url-2>URL</a> but with a different fragment identifier, causing the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:window><a href=#window>Window</a></code> in the
- <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-6><a href=#the-iframe-element>iframe</a></code> to receive a <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:event-hashchange><a href=#event-hashchange>hashchange</a></code> event.<li>Resize the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-7><a href=#the-iframe-element>iframe</a></code>, causing the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:window-2><a href=#window>Window</a></code> in the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-8><a href=#the-iframe-element>iframe</a></code> to
- receive a <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:event-resize><a href=#event-resize>resize</a></code> event.<li>Send a <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:event-message><a href=#event-message>message</a></code> event to the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:window-3><a href=#window>Window</a></code> in the
- <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:the-iframe-element-9><a href=#the-iframe-element>iframe</a></code> using the <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:dom-window-postmessage><a href=#dom-window-postmessage>window.postMessage()</a></code>
- API.</ul>
- <p>The contacts provider can use these methods, most particularly the third one, to provide an API
- that can be accessed by other origins to manipulate the user's address book. For example, it could
- respond to a message "<code>add-contact Guillaume Tell
- <tell@pomme.example.net></code>" by adding the given person and e-mail address to the user's
- address book.</p>
- <p>To avoid any site on the Web being able to manipulate the user's contacts, the contacts
- provider might only allow certain trusted sites, such as the social site, to do this.</p>
- <p>Now suppose the game wanted to add a contact to the user's address book, and that the social
- site was willing to allow it to do so on its behalf, essentially "sharing" the trust that the
- contacts provider had with the social site. There are several ways it could do this; most simply,
- it could just proxy messages between the game site and the contacts site. However, this solution
- has a number of difficulties: it requires the social site to either completely trust the game site
- not to abuse the privilege, or it requires that the social site verify each request to make sure
- it's not a request that it doesn't want to allow (such as adding multiple contacts, reading the
- contacts, or deleting them); it also requires some additional complexity if there's ever the
- possibility of multiple games simultaneously trying to interact with the contacts provider.</p>
- <p>Using message channels and <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:messageport><a href=#messageport>MessagePort</a></code> objects, however, all of these problems can
- go away. When the game tells the social site that it wants to add a contact, the social site can
- ask the contacts provider not for it to add a contact, but for the <em>capability</em> to add a
- single contact. The contacts provider then creates a pair of <code id=ports-as-the-basis-of-an-object-capability-model-on-the-web:messageport-2><a href=#messageport>MessagePort</a></code> objects, and
- sends one of them back to the social site, who forwards it on to the game. The game and the
- contacts provider then have a direct connection, and the contacts provider knows to only honor a
- single "add contact" request, nothing else. In other words, the game has been granted the
- capability to add a single contact.</p>
- <h5 id=ports-as-the-basis-of-abstracting-out-service-implementations>9.5.1.3 Ports as the basis of abstracting out service implementations</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Continuing the example from the previous section, consider the contacts provider in particular.
- While an initial implementation might have simply used <code id=ports-as-the-basis-of-abstracting-out-service-implementations:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code> objects in the
- service's <code id=ports-as-the-basis-of-abstracting-out-service-implementations:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, an evolution of the service might instead want to use a <a href=#sharedworker id=ports-as-the-basis-of-abstracting-out-service-implementations:sharedworker>shared worker</a> with a single <code id=ports-as-the-basis-of-abstracting-out-service-implementations:websocket><a href=#websocket>WebSocket</a></code> connection.</p>
- <p>If the initial design used <code id=ports-as-the-basis-of-abstracting-out-service-implementations:messageport><a href=#messageport>MessagePort</a></code> objects to grant capabilities, or even just
- to allow multiple simultaneous independent sessions, the service implementation can switch from
- the <code id=ports-as-the-basis-of-abstracting-out-service-implementations:xmlhttprequest-2><a href=#xmlhttprequest>XMLHttpRequest</a></code>s-in-each-<code id=ports-as-the-basis-of-abstracting-out-service-implementations:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> model to the
- shared-<code id=ports-as-the-basis-of-abstracting-out-service-implementations:websocket-2><a href=#websocket>WebSocket</a></code> model without changing the API at all: the ports on the service
- provider side can all be forwarded to the shared worker without it affecting the users of the API
- in the slightest.</p>
- <h4 id=message-channels>9.5.2 Message channels</h4>
- <pre class=idl>[<a href=#dom-messagechannel id=message-channels:dom-messagechannel>Constructor</a>, Exposed=(Window,Worker)]
- interface <dfn id=messagechannel>MessageChannel</dfn> {
- readonly attribute <a href=#messageport id=message-channels:messageport>MessagePort</a> <a href=#dom-messagechannel-port1 id=message-channels:dom-messagechannel-port1>port1</a>;
- readonly attribute <a href=#messageport id=message-channels:messageport-2>MessagePort</a> <a href=#dom-messagechannel-port2 id=message-channels:dom-messagechannel-port2>port2</a>;
- };</pre>
- <dl class=domintro><dt><var>channel</var> = new <code id=message-channels:dom-messagechannel-2><a href=#dom-messagechannel>MessageChannel</a></code>()<dd>
- <p>Returns a new <code id=message-channels:messagechannel><a href=#messagechannel>MessageChannel</a></code> object with two new <code id=message-channels:messageport-3><a href=#messageport>MessagePort</a></code> objects.</p>
- <dt><var>channel</var> . <code id=message-channels:dom-messagechannel-port1-2><a href=#dom-messagechannel-port1>port1</a></code><dd>
- <p>Returns the first <code id=message-channels:messageport-4><a href=#messageport>MessagePort</a></code> object.</p>
- <dt><var>channel</var> . <code id=message-channels:dom-messagechannel-port2-2><a href=#dom-messagechannel-port2>port2</a></code><dd>
- <p>Returns the second <code id=message-channels:messageport-5><a href=#messageport>MessagePort</a></code> object.</p>
- </dl>
-
- <p>When the <dfn id=dom-messagechannel><code>MessageChannel()</code></dfn> constructor is
- called, it must run the following algorithm:</p>
- <ol><li><p><a href=#create-a-new-messageport-object id=message-channels:create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=message-channels:concept-port-owner>owner</a> is the <a href=#incumbent-settings-object id=message-channels:incumbent-settings-object>incumbent settings object</a>, and let
- <var>port1</var> be that object.<li><p><a href=#create-a-new-messageport-object id=message-channels:create-a-new-messageport-object-2>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=message-channels:concept-port-owner-2>owner</a> is the <a href=#incumbent-settings-object id=message-channels:incumbent-settings-object-2>incumbent settings object</a>, and let
- <var>port2</var> be that object.<li><p><a href=#entangle id=message-channels:entangle>Entangle</a> the <var>port1</var> and <var>port2</var> objects.<li><p>Instantiate a new <code id=message-channels:messagechannel-2><a href=#messagechannel>MessageChannel</a></code> object, and let <var>channel</var> be that
- object.<li><p>Let the <code id=message-channels:dom-messagechannel-port1-3><a href=#dom-messagechannel-port1>port1</a></code> attribute of the
- <var>channel</var> object be <var>port1</var>.</p>
- <li><p>Let the <code id=message-channels:dom-messagechannel-port2-3><a href=#dom-messagechannel-port2>port2</a></code> attribute of the
- <var>channel</var> object be <var>port2</var>.</p>
- <li><p>Return <var>channel</var>.</ol>
- <p>The <dfn id=dom-messagechannel-port1><code>port1</code></dfn> and <dfn id=dom-messagechannel-port2><code>port2</code></dfn> attributes must return the values they were
- assigned when the <code id=message-channels:messagechannel-3><a href=#messagechannel>MessageChannel</a></code> object was created.</p>
-
- <h4 id=message-ports>9.5.3 Message ports</h4>
- <p>Each channel has two message ports. Data sent through one port is received by the other port,
- and vice versa.</p>
- <pre class=idl>[Exposed=(Window,Worker)]
- interface <dfn id=messageport>MessagePort</dfn> : <a href=#eventtarget id=message-ports:eventtarget>EventTarget</a> {
- void <a href=#dom-messageport-postmessage id=message-ports:dom-messageport-postmessage>postMessage</a>(any message, optional sequence<<a href=#transferable id=message-ports:transferable>Transferable</a>> transfer);
- void <a href=#dom-messageport-start id=message-ports:dom-messageport-start>start</a>();
- void <a href=#dom-messageport-close id=message-ports:dom-messageport-close>close</a>();
- // event handlers
- attribute <a href=#eventhandler id=message-ports:eventhandler>EventHandler</a> <a href=#handler-messageport-onmessage id=message-ports:handler-messageport-onmessage>onmessage</a>;
- };
- // <a href=#messageport id=message-ports:messageport>MessagePort</a> implements <a href=#transferable id=message-ports:transferable-2>Transferable</a>;</pre>
- <dl class=domintro><dt><var>port</var> . <code id=message-ports:dom-messageport-postmessage-2><a href=#dom-messageport-postmessage>postMessage</a></code>(<var>message</var> [, <var>transfer</var>] )<dd>
- <p>Posts a message through the channel. Objects listed in <var>transfer</var> are
- transferred, not just cloned, meaning that they are no longer usable on the sending side.</p>
- <p>Throws a <code id=message-ports:datacloneerror><a href=#datacloneerror>DataCloneError</a></code> exception if <var>transfer</var> array contains
- duplicate objects or the source or target ports, or if <var>message</var> could not be
- cloned.</p>
- <dt><var>port</var> . <code id=message-ports:dom-messageport-start-2><a href=#dom-messageport-start>start</a></code>()<dd>
- <p>Begins dispatching messages received on the port.</p>
- <dt><var>port</var> . <code id=message-ports:dom-messageport-close-2><a href=#dom-messageport-close>close</a></code>()<dd>
- <p>Disconnects the port, so that it is no longer active.</p>
- </dl>
-
- <p>Each <code id=message-ports:messageport-2><a href=#messageport>MessagePort</a></code> object can be entangled with another (a symmetric relationship).
- Each <code id=message-ports:messageport-3><a href=#messageport>MessagePort</a></code> object also has a <a href=#task-source id=message-ports:task-source>task source</a> called the <dfn id=port-message-queue>port
- message queue</dfn>, initially empty. A <a href=#port-message-queue id=message-ports:port-message-queue>port message queue</a> can be enabled or
- disabled, and is initially disabled. Once enabled, a port can never be disabled again (though
- messages in the queue can get moved to another queue or removed altogether, which has much the
- same effect). A <code id=message-ports:messageport-4><a href=#messageport>MessagePort</a></code> also has a <dfn id=has-been-shipped>has been shipped</dfn> flag, which must
- initially be false, and an <dfn id=concept-port-owner>owner</dfn>, which is a <a href=#settings-object id=message-ports:settings-object>settings
- object</a> set when the object is created, as described below.</p>
- <p>When a port's <a href=#port-message-queue id=message-ports:port-message-queue-2>port message queue</a> is enabled, the <a href=#event-loop id=message-ports:event-loop>event loop</a> must use
- it as one of its <a href=#task-source id=message-ports:task-source-2>task sources</a>. When a port's <a href=#concept-port-owner id=message-ports:concept-port-owner>owner</a> specifies a <a href=#responsible-event-loop id=message-ports:responsible-event-loop>responsible event loop</a> that is a
- <a href=#browsing-context id=message-ports:browsing-context>browsing context</a> <a href=#event-loop id=message-ports:event-loop-2>event loop</a>, all <a href=#concept-task id=message-ports:concept-task>tasks</a> <a href=#queue-a-task id=message-ports:queue-a-task>queued</a> on its <a href=#port-message-queue id=message-ports:port-message-queue-3>port
- message queue</a> must be associated with the <a href=#responsible-document id=message-ports:responsible-document>responsible document</a> specified by
- the port's <a href=#concept-port-owner id=message-ports:concept-port-owner-2>owner</a>.</p>
- <p class=note>If the port's <a href=#concept-port-owner id=message-ports:concept-port-owner-3>owner</a> specifies a
- <a href=#responsible-document id=message-ports:responsible-document-2>responsible document</a> that is <a href=#fully-active id=message-ports:fully-active>fully active</a>, but the event listeners all
- have scripts whose <a href=#settings-object id=message-ports:settings-object-2>settings objects</a> specify <a href=#responsible-document id=message-ports:responsible-document-3>responsible documents</a> that are <em>not</em> <a href=#fully-active id=message-ports:fully-active-2>fully
- active</a>, then the messages will be lost.</p>
- <p>Each <a href=#event-loop id=message-ports:event-loop-3>event loop</a> has a <a href=#task-source id=message-ports:task-source-3>task source</a> called the <dfn id=unshipped-port-message-queue>unshipped port
- message queue</dfn>. This is a virtual <a href=#task-source id=message-ports:task-source-4>task source</a>: it must act as if it contained
- the <a href=#concept-task id=message-ports:concept-task-2>tasks</a> of each <a href=#port-message-queue id=message-ports:port-message-queue-4>port message queue</a> of each
- <code id=message-ports:messageport-5><a href=#messageport>MessagePort</a></code> whose <a href=#has-been-shipped id=message-ports:has-been-shipped>has been shipped</a> flag is false, whose <a href=#port-message-queue id=message-ports:port-message-queue-5>port
- message queue</a> is enabled, and whose <a href=#concept-port-owner id=message-ports:concept-port-owner-4>owner</a>
- specifies that <a href=#event-loop id=message-ports:event-loop-4>event loop</a> as the <a href=#responsible-event-loop id=message-ports:responsible-event-loop-2>responsible event loop</a>, in the order in
- which they were added to their respective <a href=#task-source id=message-ports:task-source-5>task source</a>. When a <a href=#concept-task id=message-ports:concept-task-3>task</a> would be removed from the <a href=#unshipped-port-message-queue id=message-ports:unshipped-port-message-queue>unshipped port message
- queue</a>, it must instead be removed from its <a href=#port-message-queue id=message-ports:port-message-queue-6>port message queue</a>.</p>
- <p>When a <code id=message-ports:messageport-6><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped id=message-ports:has-been-shipped-2>has been shipped</a> flag is false, its <a href=#port-message-queue id=message-ports:port-message-queue-7>port
- message queue</a> must be ignored for the purposes of the <a href=#event-loop id=message-ports:event-loop-5>event loop</a>. (The
- <a href=#unshipped-port-message-queue id=message-ports:unshipped-port-message-queue-2>unshipped port message queue</a> is used instead.)</p>
- <p class=note>The <a href=#has-been-shipped id=message-ports:has-been-shipped-3>has been shipped</a> flag is set to true when a port, its twin, or
- the object it was cloned from, is or has been <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object>transferred</a>. When a <code id=message-ports:messageport-7><a href=#messageport>MessagePort</a></code>'s <a href=#has-been-shipped id=message-ports:has-been-shipped-4>has been shipped</a> flag
- is true, its <a href=#port-message-queue id=message-ports:port-message-queue-8>port message queue</a> acts as a first-class <a href=#task-source id=message-ports:task-source-6>task source</a>,
- unaffected to any <a href=#unshipped-port-message-queue id=message-ports:unshipped-port-message-queue-3>unshipped port message queue</a>.</p>
- <p>When the user agent is to <dfn id=create-a-new-messageport-object>create a new <code>MessagePort</code> object</dfn> with a
- particular <a href=#settings-object id=message-ports:settings-object-3>settings object</a> as its <var>owner</var>, it must instantiate a
- new <code id=message-ports:messageport-8><a href=#messageport>MessagePort</a></code> object, and let its <a href=#concept-port-owner id=message-ports:concept-port-owner-5>owner</a> be
- <var>owner</var>.</p>
- <p>When the user agent is to <dfn id=entangle>entangle</dfn> two <code id=message-ports:messageport-9><a href=#messageport>MessagePort</a></code> objects, it must run
- the following steps:</p>
- <ol><li>
- <p>If one of the ports is already entangled, then disentangle it and the port that it was
- entangled with.</p>
- <p class=note>If those two previously entangled ports were the two ports of a
- <code id=message-ports:messagechannel><a href=#messagechannel>MessageChannel</a></code> object, then that <code id=message-ports:messagechannel-2><a href=#messagechannel>MessageChannel</a></code> object no longer
- represents an actual channel: the two ports in that object are no longer entangled.</p>
- <li>
- <p>Associate the two ports to be entangled, so that they form the two parts of a new channel.
- (There is no <code id=message-ports:messagechannel-3><a href=#messagechannel>MessageChannel</a></code> object that represents this channel.)</p>
- <p>Two ports <var>A</var> and <var>B</var> that have gone through this step
- are now said to be entangled; one is entangled to the other, and vice versa.</p>
- <p class=note>While this specification describes this process as instantaneous,
- implementations are more likely to implement it via message passing. As with all algorithms, the
- key is "merely" that the end result be indistinguishable, in a black-box sense, from the
- specification.</p>
- </ol>
- <p>When the user agent is to <dfn id=clone-a-port>clone a port</dfn> <var>original port</var>, with the
- clone being owned by <var>owner</var>, it must run the following steps, which return a
- new <code id=message-ports:messageport-10><a href=#messageport>MessagePort</a></code> object. These steps must be run atomically.</p>
- <ol><li><p>Set <var>original port</var>'s <a href=#has-been-shipped id=message-ports:has-been-shipped-5>has been shipped</a> flag to
- true.<li><p><a href=#create-a-new-messageport-object id=message-ports:create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=message-ports:concept-port-owner-6>owner</a> is <var>owner</var>, and let <var>new port</var> be that object.<li><p>Set <var>new port</var>'s <a href=#has-been-shipped id=message-ports:has-been-shipped-6>has been shipped</a> flag to true.<li><p>Move all the <a href=#concept-task id=message-ports:concept-task-4>tasks</a> that are to fire <code id=message-ports:event-message><a href=#event-message>message</a></code> events in the <a href=#port-message-queue id=message-ports:port-message-queue-9>port message queue</a> of <var>original port</var> to the <a href=#port-message-queue id=message-ports:port-message-queue-10>port message queue</a> of <var>new
- port</var>, if any, leaving the <var>new port</var>'s <a href=#port-message-queue id=message-ports:port-message-queue-11>port message queue</a>
- in its initial disabled state, and, if the <var>new port</var>'s <a href=#concept-port-owner id=message-ports:concept-port-owner-7>owner</a> specifies a <a href=#responsible-event-loop id=message-ports:responsible-event-loop-3>responsible event loop</a> that is
- a <a href=#browsing-context id=message-ports:browsing-context-2>browsing context</a> <a href=#event-loop id=message-ports:event-loop-6>event loop</a>, associating the moved <a href=#concept-task id=message-ports:concept-task-5>tasks</a> with the <a href=#responsible-document id=message-ports:responsible-document-4>responsible document</a> specified by <var>new port</var>'s <a href=#concept-port-owner id=message-ports:concept-port-owner-8>owner</a>.<li>
- <p>If the <var>original port</var> is entangled with another port, then run these
- substeps:</p>
- <ol><li><p>Let the <var>remote port</var> be the port with which the <var>original port</var> is entangled.<li><p>Set <var>remote port</var>'s <a href=#has-been-shipped id=message-ports:has-been-shipped-7>has been shipped</a> flag to
- true.<li><p><a href=#entangle id=message-ports:entangle>Entangle</a> the <var>remote port</var> and <var>new
- port</var> objects. The <var>original port</var> object will be disentangled by this
- process.</ol>
- <li><p>Return <var>new port</var>. It is the clone.</ol>
- <p id=transferMessagePort>To <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-2>transfer</a> a
- <code id=message-ports:messageport-11><a href=#messageport>MessagePort</a></code> object <var>old</var> to a new owner <var>owner</var>,
- a user agent must <a href=#clone-a-port id=message-ports:clone-a-port>clone</a> the <var>old</var> object with
- the clone being owned by <var>owner</var>, thus obtaining <var>new</var>, must
- <a href=#concept-transferable-neutered id=message-ports:concept-transferable-neutered>neuter</a> the <var>old</var> port, and
- must finally return <var>new</var>.</p>
- <hr>
- <p>The <dfn id=dom-messageport-postmessage><code>postMessage()</code></dfn> method, when
- called on a port <var>source port</var>, must cause the user agent to run the following
- steps:</p>
- <ol><li><p>Let <var>target port</var> be the port with which <var>source port</var>
- is entangled, if any.<li>
- <p>Let <var>doomed</var> be false. It is set to true if a condition is detected that
- will make this message cause the port to be unusable; specifically, if the message contains <var>target port</var> as one of the objects being <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-3>transferred</a>. (This condition cannot necessarily be detected synchronously.)</p>
- <li>
- <p>Let <var>new ports</var> be an empty array.</p>
- <li>
- <p>Let <var>transfer map</var> be an empty association list of
- <code id=message-ports:transferable-3><a href=#transferable>Transferable</a></code> objects to placeholder objects.</p>
- <li>
- <p>If the method was invoked with a second argument <var>transfer</var>, run these
- substeps:</p>
- <ol><li>
- <p>If any object is listed in <var>transfer</var> more than once, or any of the
- <code id=message-ports:transferable-4><a href=#transferable>Transferable</a></code> objects listed in <var>transfer</var> are marked as <a href=#concept-transferable-neutered id=message-ports:concept-transferable-neutered-2>neutered</a>, then throw a
- <code id=message-ports:datacloneerror-2><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
- <li>
- <p>If any of the objects in <var>transfer</var> are the <var>source
- port</var>, then throw a <code id=message-ports:datacloneerror-3><a href=#datacloneerror>DataCloneError</a></code> exception and abort these steps.</p>
- <li>
- <p>If any of the objects in <var>transfer</var> are the <var>target
- port</var>, if any, then let <var>doomed</var> be true, and optionally report to a
- developer console that the target port was posted to itself, causing the communication channel
- to be lost.</p>
- <li>
- <p>For each object <var>x</var> in <var>transfer</var> in turn, add a
- mapping from <var>x</var> to a new unique placeholder object created for <var>x</var> to <var>transfer map</var>, and if <var>x</var> is a
- <code id=message-ports:messageport-12><a href=#messageport>MessagePort</a></code> object, also append the placeholder object to the <var>new
- ports</var> array.</p>
- </ol>
- <li>
- <p>Let <var>message clone</var> be the result of obtaining a <a href=#structured-clone id=message-ports:structured-clone>structured
- clone</a> of the <var>message</var> argument, with <var>transfer map</var>
- as the <i>transfer map</i>. If this throws an exception, then throw that exception and abort
- these steps.</p>
- <li>
- <p>If the method was invoked with a second argument <var>transfer</var>, run these
- substeps:</p>
- <ol><li>
- <p>Let <var>new owner</var> be the <a href=#concept-port-owner id=message-ports:concept-port-owner-9>owner</a> of
- <var>target port</var>, if there is a <var>target port</var> and <var>doomed</var> is false, or else some arbitrary owner. (This <var>new
- owner</var> is used when transferring objects below. If there is no <var>target
- port</var>, or if the <var>target port</var> is one of the objects being <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-4>transferred</a>, the <code id=message-ports:transferable-5><a href=#transferable>Transferable</a></code>
- objects given in the second argument, if any, are still <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-5>transferred</a>, but since they are then discarded, it doesn't matter where they
- are transferred to.)</p>
- <li>
- <p>For each object <var>x</var> in <var>transfer</var> in turn, obtain a
- new object <var>y</var> by <a href=#transfer-a-transferable-object id=message-ports:transfer-a-transferable-object-6>transferring</a> the object <var>x</var> to <var>new
- owner</var>, and replace the placeholder object that was created for the object <var>x</var> by the new object <var>y</var> wherever the placeholder exists
- (i.e. in <var>message clone</var> and in <var>new ports</var>).</p>
- </ol>
- <li>
- <p>Make <var>new ports</var> into a <a href=#dfn-read-only-array id=message-ports:dfn-read-only-array>read only</a>
- array.</p>
- <li><p>If there is no <var>target port</var> (i.e. if <var>source port</var>
- is not entangled), or if <var>doomed</var> is true, then abort these steps.<li><p>Create an event that uses the <code id=message-ports:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the name <code id=message-ports:event-message-2><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has no
- default action.<li><p>Let the <code id=message-ports:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute of the event be
- initialised to the value of <var>message clone</var>.<li><p>Let the <code id=message-ports:dom-messageevent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute of the event be
- initialised to the <var>new ports</var> array.<li><p>Add the event to the <a href=#port-message-queue id=message-ports:port-message-queue-12>port message queue</a> of <var>target
- port</var>.</ol>
- <hr>
- <p>The <dfn id=dom-messageport-start><code>start()</code></dfn> method must enable its port's
- <a href=#port-message-queue id=message-ports:port-message-queue-13>port message queue</a>, if it is not already enabled.</p>
- <hr>
- <p>The <dfn id=dom-messageport-close><code>close()</code></dfn> method, when called on a port
- <var>local port</var> that is entangled with another port, must cause the user agent to
- disentangle the two ports. If the method is called on a port that is not entangled, then the
- method must do nothing.</p>
- <hr>
- <p>The following are the <a href=#event-handlers id=message-ports:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=message-ports:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=message-ports:event-handler-idl-attributes>event
- handler IDL attributes</a>, by all objects implementing the <code id=message-ports:messageport-13><a href=#messageport>MessagePort</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=message-ports:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=message-ports:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-messageport-onmessage><code>onmessage</code></dfn> <td> <code id=message-ports:event-message-3><a href=#event-message>message</a></code>
- </table>
- <p>The first time a <code id=message-ports:messageport-14><a href=#messageport>MessagePort</a></code> object's <code id=message-ports:handler-messageport-onmessage-2><a href=#handler-messageport-onmessage>onmessage</a></code> IDL attribute is set, the port's <a href=#port-message-queue id=message-ports:port-message-queue-14>port
- message queue</a> must be enabled, as if the <code id=message-ports:dom-messageport-start-3><a href=#dom-messageport-start>start()</a></code>
- method had been called.</p>
-
- <h4 id=broadcasting-to-many-ports>9.5.4 Broadcasting to many ports</h4>
- <p class=critical>The API described in this section is controversial, as, in an attempt to solve
- an architectural memory leak, it instead exposes the details of Garbage Collection. This is a
- lose-lose scenario. A better solution is really needed here.</p>
- <p>Broadcasting to many ports is in principle relatively simple: keep an array of
- <code id=broadcasting-to-many-ports:messageport><a href=#messageport>MessagePort</a></code> objects to send messages to, and iterate through the array to send a
- message. However, this has one rather unfortunate effect: it prevents the ports from being garbage
- collected, even if the other side has gone away.</p>
- <p>To avoid this problem, the <code id=broadcasting-to-many-ports:portcollection><a href=#portcollection>PortCollection</a></code> object can be used. It acts as an opaque
- array of <code id=broadcasting-to-many-ports:messageport-2><a href=#messageport>MessagePort</a></code> objects, thus allowing the objects to be garbage collected when
- they stop being relevant, while still allowing scripts to iterate over the
- <code id=broadcasting-to-many-ports:messageport-3><a href=#messageport>MessagePort</a></code> objects.</p>
- <pre class=idl>[<a href=#dom-portcollection id=broadcasting-to-many-ports:dom-portcollection>Constructor</a>, Exposed=(Window,Worker)]
- interface <dfn id=portcollection>PortCollection</dfn> {
- void <a href=#dom-portcollection-add id=broadcasting-to-many-ports:dom-portcollection-add>add</a>(<a href=#messageport id=broadcasting-to-many-ports:messageport-4>MessagePort</a> port);
- void <a href=#dom-portcollection-remove id=broadcasting-to-many-ports:dom-portcollection-remove>remove</a>(<a href=#messageport id=broadcasting-to-many-ports:messageport-5>MessagePort</a> port);
- void <a href=#dom-portcollection-clear id=broadcasting-to-many-ports:dom-portcollection-clear>clear</a>();
- void <a href=#dom-portcollection-iterate id=broadcasting-to-many-ports:dom-portcollection-iterate>iterate</a>(<a href=#portcollectioncallback id=broadcasting-to-many-ports:portcollectioncallback>PortCollectionCallback</a> callback);
- };
- callback <dfn id=portcollectioncallback>PortCollectionCallback</dfn> = void (<a href=#messageport id=broadcasting-to-many-ports:messageport-6>MessagePort</a> port);</pre>
- <dl class=domintro><dt><var>portCollection</var> = new <code id=broadcasting-to-many-ports:dom-portcollection-2><a href=#dom-portcollection>PortCollection</a></code>()<dd>
- <p>Returns a new empty <code id=broadcasting-to-many-ports:portcollection-2><a href=#portcollection>PortCollection</a></code> object.</p>
- <dt><var>portCollection</var> . <code id=broadcasting-to-many-ports:dom-portcollection-add-2><a href=#dom-portcollection-add>add</a></code>(<var>port</var>)<dd>
- <p>Adds <var>port</var> to the collection, if it isn't already present.</p>
- <dt><var>portCollection</var> . <code id=broadcasting-to-many-ports:dom-portcollection-remove-2><a href=#dom-portcollection-remove>remove</a></code>(<var>port</var>)<dd>
- <p>Removes <var>port</var> from the collection, if it is present.</p>
- <dt><var>portCollection</var> . <code id=broadcasting-to-many-ports:dom-portcollection-clear-2><a href=#dom-portcollection-clear>clear</a></code>()<dd>
- <p>Removes all ports from the collection.</p>
- <dt><var>portCollection</var> . <code id=broadcasting-to-many-ports:dom-portcollection-iterate-2><a href=#dom-portcollection-iterate>iterate</a></code>(<var>callback</var>)<dd>
- <p>Calls <var>callback</var> for each port in the collection.</p>
- </dl>
-
- <p>A <code id=broadcasting-to-many-ports:portcollection-3><a href=#portcollection>PortCollection</a></code> object has an initially empty <dfn id=concept-portcollection-list>list of ports</dfn>. When a <code id=broadcasting-to-many-ports:messageport-7><a href=#messageport>MessagePort</a></code> object in
- a <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list>list of ports</a> is garbage collected, it must be
- silently removed from that <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-2>list of ports</a>. Objects
- in a <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-3>list of ports</a> are ordered chronologically by
- the time at which they were most recently added; the least-recently added <code id=broadcasting-to-many-ports:messageport-8><a href=#messageport>MessagePort</a></code>
- object is the first in the list, and the most-recently added <code id=broadcasting-to-many-ports:messageport-9><a href=#messageport>MessagePort</a></code> is the last
- in the list.</p>
- <p>The <dfn id=dom-portcollection><code>PortCollection()</code></dfn> constructor must return
- a new <code id=broadcasting-to-many-ports:portcollection-4><a href=#portcollection>PortCollection</a></code> object (with an empty <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-4>list of ports</a>).</p>
- <p>The <dfn id=dom-portcollection-add><code>add()</code></dfn> method must add the
- <code id=broadcasting-to-many-ports:messageport-10><a href=#messageport>MessagePort</a></code> given by the argument to the <code id=broadcasting-to-many-ports:portcollection-5><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-5>list of ports</a>, unless the <code id=broadcasting-to-many-ports:messageport-11><a href=#messageport>MessagePort</a></code> is
- already in the <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-6>list of ports</a>, in which case the
- method does nothing. (Calling this method with a port already in the list does not move the port
- to the end of the list.)</p>
- <p>The <dfn id=dom-portcollection-remove><code>remove()</code></dfn> method must remove the
- <code id=broadcasting-to-many-ports:messageport-12><a href=#messageport>MessagePort</a></code> given by the argument from the <code id=broadcasting-to-many-ports:portcollection-6><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-7>list of ports</a>, unless the <code id=broadcasting-to-many-ports:messageport-13><a href=#messageport>MessagePort</a></code> is
- not in the <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-8>list of ports</a>, in which case the
- method does nothing.</p>
- <p>The <dfn id=dom-portcollection-clear><code>clear()</code></dfn> method must remove all
- <code id=broadcasting-to-many-ports:messageport-14><a href=#messageport>MessagePort</a></code> objects from the <code id=broadcasting-to-many-ports:portcollection-7><a href=#portcollection>PortCollection</a></code> object's <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-9>list of ports</a>, returning it to the initial empty state.
- If the <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-10>list of ports</a> is already empty, the method
- does nothing.</p>
- <p>The <dfn id=dom-portcollection-iterate><code>iterate()</code></dfn> method must invoke its
- <code id=broadcasting-to-many-ports:portcollectioncallback-2><a href=#portcollectioncallback>PortCollectionCallback</a></code> argument once for each <code id=broadcasting-to-many-ports:messageport-15><a href=#messageport>MessagePort</a></code> object in the
- object's <a href=#concept-portcollection-list id=broadcasting-to-many-ports:concept-portcollection-list-11>list of ports</a>, in the order defined
- above, with each invocation being passed the corresponding <code id=broadcasting-to-many-ports:messageport-16><a href=#messageport>MessagePort</a></code> object as the
- callback's sole argument.</p>
-
- <h4 id=ports-and-garbage-collection>9.5.5 Ports and garbage collection</h4>
-
- <p>When a <code id=ports-and-garbage-collection:messageport><a href=#messageport>MessagePort</a></code> object <var>o</var> is entangled, user agents must
- either act as if <var>o</var>'s entangled <code id=ports-and-garbage-collection:messageport-2><a href=#messageport>MessagePort</a></code> object has a strong
- reference to <var>o</var>, or as if the <a href=#global-object id=ports-and-garbage-collection:global-object>global object</a> specified by <var>o</var>'s <a href=#concept-port-owner id=ports-and-garbage-collection:concept-port-owner>owner</a> has a strong reference to <var>o</var>.</p>
- <div class=note>
- <p>Thus, a message port can be received, given an event listener, and then forgotten, and so long
- as that event listener could receive a message, the channel will be maintained.</p>
- <p>Of course, if this was to occur on both sides of the channel, then both ports could be garbage
- collected, since they would not be reachable from live code, despite having a strong reference to
- each other.</p>
- </div>
- <p>Furthermore, a <code id=ports-and-garbage-collection:messageport-3><a href=#messageport>MessagePort</a></code> object must not be garbage collected while there exists
- an event in a <a href=#task-queue id=ports-and-garbage-collection:task-queue>task queue</a> that is to be dispatched on that <code id=ports-and-garbage-collection:messageport-4><a href=#messageport>MessagePort</a></code>
- object, or while the <code id=ports-and-garbage-collection:messageport-5><a href=#messageport>MessagePort</a></code> object's <a href=#port-message-queue id=ports-and-garbage-collection:port-message-queue>port message queue</a> is enabled
- and there exists a <code id=ports-and-garbage-collection:event-message><a href=#event-message>message</a></code> event in that queue.</p>
-
- <p>There are no strong references from a <code id=ports-and-garbage-collection:portcollection><a href=#portcollection>PortCollection</a></code> object to its
- <code id=ports-and-garbage-collection:messageport-6><a href=#messageport>MessagePort</a></code> objects. (That is in fact the whole point of <code id=ports-and-garbage-collection:portcollection-2><a href=#portcollection>PortCollection</a></code>
- objects: they allow for <code id=ports-and-garbage-collection:messageport-7><a href=#messageport>MessagePort</a></code> objects to be referenced without preventing them
- from being garbage collected.)</p>
-
- <p class=note>Authors are strongly encouraged to explicitly close <code id=ports-and-garbage-collection:messageport-8><a href=#messageport>MessagePort</a></code>
- objects to disentangle them, so that their resources can be recollected. Creating many
- <code id=ports-and-garbage-collection:messageport-9><a href=#messageport>MessagePort</a></code> objects and discarding them without closing them can lead to high
- transient memory usage since garbage collection is not necessarily performed promptly, especially
- for <code id=ports-and-garbage-collection:messageport-10><a href=#messageport>MessagePort</a></code>s where garbage collection can involve cross-process coordination.</p>
- <h3 id=broadcasting-to-other-browsing-contexts>9.6 <dfn>Broadcasting to other browsing contexts</dfn></h3>
- <p>Pages on a single <a href=#origin-2 id=broadcasting-to-other-browsing-contexts:origin-2>origin</a> opened by the same user in the same user agent but in
- different unrelated <a href=#browsing-context id=broadcasting-to-other-browsing-contexts:browsing-context>browsing contexts</a> sometimes need to
- send notifications to each other, for example "hey, the user logged in over here, check your
- credentials again".</p>
- <p>For elaborate cases, e.g. to manage locking of shared state, to manage synchronisation of
- resources between a server and multiple local clients, to share a <code id=broadcasting-to-other-browsing-contexts:websocket><a href=#websocket>WebSocket</a></code>
- connection with a remote host, and so forth, <a href=#sharedworker id=broadcasting-to-other-browsing-contexts:sharedworker>shared workers</a> are
- the most appropriate solution.</p>
- <p>For simple cases, though, where a shared worker would be an unreasonable overhead, authors can
- use the simple channel-based broadcast mechanism described in this section.</p>
- <pre class=idl>[<a href=#dom-broadcastchannel id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel>Constructor</a>(DOMString channel), Exposed=(Window,Worker)]
- interface <dfn id=broadcastchannel>BroadcastChannel</dfn> : <a href=#eventtarget id=broadcasting-to-other-browsing-contexts:eventtarget>EventTarget</a> {
- readonly attribute DOMString <a href=#dom-broadcastchannel-name id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-name>name</a>;
- void <a href=#dom-broadcastchannel-postmessage id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-postmessage>postMessage</a>(any message);
- void <a href=#dom-broadcastchannel-close id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-close>close</a>();
- attribute <a href=#eventhandler id=broadcasting-to-other-browsing-contexts:eventhandler>EventHandler</a> <a href=#handler-broadcastchannel-onmessage id=broadcasting-to-other-browsing-contexts:handler-broadcastchannel-onmessage>onmessage</a>;
- };</pre>
- <dl class=domintro><dt><var>broadcastChannel</var> = new <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-2><a href=#dom-broadcastchannel>BroadcastChannel</a></code>(<var>channel</var>)<dd>
- <p>Returns a new <code id=broadcasting-to-other-browsing-contexts:broadcastchannel><a href=#broadcastchannel>BroadcastChannel</a></code> object via which messages for the given channel can be sent and received.</p>
- <dt><var>broadcastChannel</var> . <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-name-2><a href=#dom-broadcastchannel-name>name</a></code><dd>
- <p>Returns the channel ID (as passed to the constructor).</p>
- <dt><var>broadcastChannel</var> . <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-postmessage-2><a href=#dom-broadcastchannel-postmessage>postMessage</a></code>(<var>message</var>)<dd>
- <p>Sends the given message to other <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-2><a href=#broadcastchannel>BroadcastChannel</a></code> objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays.</p>
- <dt><var>broadcastChannel</var> . <code id=broadcasting-to-other-browsing-contexts:dom-broadcastchannel-close-2><a href=#dom-broadcastchannel-close>close</a></code>()<dd>
- <p>Closes the <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-3><a href=#broadcastchannel>BroadcastChannel</a></code> object, opening it up to garbage collection.</p>
- </dl>
-
- <p>A <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-4><a href=#broadcastchannel>BroadcastChannel</a></code> object has a <dfn id=channel-name>channel name</dfn>, a
- <dfn id=broadcastchannel-settings-object><code>BroadcastChannel</code> settings object</dfn>, and a <dfn id=concept-broadcastchannel-closed>closed flag</dfn>.</p>
- <p>The <dfn id=dom-broadcastchannel><code>BroadcastChannel()</code></dfn> constructor, when
- invoked, must create and return a <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-5><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name>channel
- name</a> is the constructor's first argument, whose <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object><code>BroadcastChannel</code>
- settings object</a> is the <a href=#incumbent-settings-object id=broadcasting-to-other-browsing-contexts:incumbent-settings-object>incumbent settings object</a>, and whose <a href=#concept-broadcastchannel-closed id=broadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed>closed flag</a> is false.</p>
- <p>The <dfn id=dom-broadcastchannel-name><code>name</code></dfn> attribute must return the
- <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name-2>channel name</a>.</p>
- <p>The <dfn id=dom-broadcastchannel-postmessage><code>postMessage()</code></dfn> method,
- when invoked on a <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-6><a href=#broadcastchannel>BroadcastChannel</a></code> object <var>source</var> with an
- argument <var>message</var>, must run the following steps:</p>
- <ol><li><p>Let <var>source settings</var> be <var>source</var>'s
- <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-2><code>BroadcastChannel</code> settings object</a>.</p>
- <li><p>Let <var>source channel</var> be <var>source</var>'s
- <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name-3>channel name</a>.</p>
- <li><p>Let <var>cloned message</var> be a <a href=#structured-clone id=broadcasting-to-other-browsing-contexts:structured-clone>structured clone</a> of the <var>message</var> argument. If this throws an exception, then rethrow that exception and
- abort these steps.<li>
- <p>Let <var>destinations</var> be a list of <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-7><a href=#broadcastchannel>BroadcastChannel</a></code> objects that
- match the following criteria:</p>
- <ul><li>
- <p>Their <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-3><code>BroadcastChannel</code> settings object</a> specifies either:</p>
- <ul><li><p>a <a href=#global-object id=broadcasting-to-other-browsing-contexts:global-object>global object</a> that is a <code id=broadcasting-to-other-browsing-contexts:window><a href=#window>Window</a></code> object and a
- <a href=#responsible-document id=broadcasting-to-other-browsing-contexts:responsible-document>responsible document</a> that is <a href=#fully-active id=broadcasting-to-other-browsing-contexts:fully-active>fully active</a>, or<li><p>a <a href=#global-object id=broadcasting-to-other-browsing-contexts:global-object-2>global object</a> that is a <code id=broadcasting-to-other-browsing-contexts:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object whose
- <code id=broadcasting-to-other-browsing-contexts:dom-workerglobalscope-closing><a href=#dom-workerglobalscope-closing>closing</a></code> flag is false and whose
- <a href=#worker id=broadcasting-to-other-browsing-contexts:worker>worker</a> is a <a href=#suspendable-worker id=broadcasting-to-other-browsing-contexts:suspendable-worker>suspendable worker</a>.</ul>
- <li><p>Their <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-4><code>BroadcastChannel</code> settings object</a> specifies an
- <a href=#origin-2 id=broadcasting-to-other-browsing-contexts:origin-2-2>origin</a> that is the <a href=#same-origin id=broadcasting-to-other-browsing-contexts:same-origin>same origin</a> as the <a href=#origin-2 id=broadcasting-to-other-browsing-contexts:origin-2-3>origin</a> specified
- by <var>source settings</var>.<li><p>Their <a href=#channel-name id=broadcasting-to-other-browsing-contexts:channel-name-4>channel name</a> is a <a href=#case-sensitive id=broadcasting-to-other-browsing-contexts:case-sensitive>case-sensitive</a> match for <var>source channel</var>.<li><p>Their <a href=#concept-broadcastchannel-closed id=broadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-2>closed flag</a> is
- false.</ul>
- <li><p>Remove <var>source</var> from <var>destinations</var>.<li>
- <p>Sort <var>destinations</var> such that all <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-8><a href=#broadcastchannel>BroadcastChannel</a></code> objects
- whose <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-5><code>BroadcastChannel</code> settings
- objects</a> specify the same <a href=#responsible-event-loop id=broadcasting-to-other-browsing-contexts:responsible-event-loop>responsible event loop</a> are sorted in creation
- order, oldest first. (This does not define a complete ordering. Within this constraint, user
- agents may sort the list in any user-agent defined manner.)</p>
- <li>
- <p>For each <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-9><a href=#broadcastchannel>BroadcastChannel</a></code> object in <var>destinations</var>,
- <a href=#queue-a-task id=broadcasting-to-other-browsing-contexts:queue-a-task>queue a task</a> that runs the following steps:</p>
- <ol><li><p>Create an event that uses the <code id=broadcasting-to-other-browsing-contexts:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the event type
- <code id=broadcasting-to-other-browsing-contexts:event-message><a href=#event-message>message</a></code>, which does not bubble, is not cancelable, and has
- no default action. The <code id=broadcasting-to-other-browsing-contexts:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute must be
- initialised to a <a href=#structured-clone id=broadcasting-to-other-browsing-contexts:structured-clone-2>structured clone</a> of <var>cloned message</var>, and the <code id=broadcasting-to-other-browsing-contexts:dom-messageevent-origin><a href=#dom-messageevent-origin>origin</a></code> attribute must be initialised
- to the <a href=#unicode-serialisation-of-an-origin id=broadcasting-to-other-browsing-contexts:unicode-serialisation-of-an-origin>Unicode serialisation</a> of the
- <a href=#origin-2 id=broadcasting-to-other-browsing-contexts:origin-2-4>origin</a> specified by <var>source settings</var>. This event is not <a href=#concept-events-trusted id=broadcasting-to-other-browsing-contexts:concept-events-trusted>trusted</a>.<li><p><a href=#concept-event-dispatch id=broadcasting-to-other-browsing-contexts:concept-event-dispatch>Dispatch</a> the event at the
- <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-10><a href=#broadcastchannel>BroadcastChannel</a></code> object.</ol>
- <p>The <a href=#concept-task id=broadcasting-to-other-browsing-contexts:concept-task>tasks</a> must be associated with the <a href=#responsible-document id=broadcasting-to-other-browsing-contexts:responsible-document-2>responsible
- document</a> specified by the target <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-11><a href=#broadcastchannel>BroadcastChannel</a></code> object's
- <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-6><code>BroadcastChannel</code> settings object</a>, and must use the <a href=#dom-manipulation-task-source id=broadcasting-to-other-browsing-contexts:dom-manipulation-task-source>DOM
- manipulation task source</a>.</p>
- </ol>
- <p>While a <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-12><a href=#broadcastchannel>BroadcastChannel</a></code> object whose <a href=#concept-broadcastchannel-closed id=broadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-3>closed flag</a> is false has an event listener
- registered for <code id=broadcasting-to-other-browsing-contexts:event-message-2><a href=#event-message>message</a></code> events, there must be a strong
- reference from <a href=#global-object id=broadcasting-to-other-browsing-contexts:global-object-3>global object</a> specified by the <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-13><a href=#broadcastchannel>BroadcastChannel</a></code> object's
- <a href=#broadcastchannel-settings-object id=broadcasting-to-other-browsing-contexts:broadcastchannel-settings-object-7><code>BroadcastChannel</code> settings object</a> to the <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-14><a href=#broadcastchannel>BroadcastChannel</a></code>
- object itself.</p>
- <p>The <dfn id=dom-broadcastchannel-close><code>close()</code></dfn> method must set the
- <a href=#concept-broadcastchannel-closed id=broadcasting-to-other-browsing-contexts:concept-broadcastchannel-closed-4>closed flag</a> of the
- <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-15><a href=#broadcastchannel>BroadcastChannel</a></code> object on which it was invoked to true.</p>
- <p class=note>Authors are strongly encouraged to explicitly close <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-16><a href=#broadcastchannel>BroadcastChannel</a></code>
- objects when they are no longer needed, so that they can be garbage collected. Creating many
- <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-17><a href=#broadcastchannel>BroadcastChannel</a></code> objects and discarding them while leaving them with an event
- listener and without closing them can lead to an apparent memory leak, since the objects will
- continue to live for as long as they have an event listener (or until their page or worker is
- closed).</p>
- <hr>
- <p>The following are the <a href=#event-handlers id=broadcasting-to-other-browsing-contexts:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=broadcasting-to-other-browsing-contexts:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=broadcasting-to-other-browsing-contexts:event-handler-idl-attributes>event
- handler IDL attributes</a>, by all objects implementing the <code id=broadcasting-to-other-browsing-contexts:broadcastchannel-18><a href=#broadcastchannel>BroadcastChannel</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=broadcasting-to-other-browsing-contexts:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=broadcasting-to-other-browsing-contexts:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-broadcastchannel-onmessage><code>onmessage</code></dfn> <td> <code id=broadcasting-to-other-browsing-contexts:event-message-3><a href=#event-message>message</a></code>
- </table>
-
- <div class=example>
- <p>Suppose a page wants to know when the user logs out, even when the user does so from another
- tab at the same site:</p>
- <pre>var authChannel = new BroadcastChannel('auth');
- authChannel.onmessage = function (event) {
- if (event.data == 'logout')
- showLogout();
- }
- function logoutRequested() {
- // called when the user asks us to log them out
- doLogout();
- showLogout();
- authChannel.postMessage('logout');
- }
- function doLogout() {
- // actually log the user out (e.g. clearing cookies)
- // ...
- }
- function showLogout() {
- // update the UI to indicate we're logged out
- // ...
- }</pre>
- </div>
- <h2 id=workers>10 Web workers</h2>
- <h3 id=introduction-15>10.1 Introduction</h3>
- <h4 id=scope-2>10.1.1 Scope</h4>
- <p><i>This section is non-normative.</i></p>
- <p>This specification defines an API for running scripts in the background independently of any
- user interface scripts.</p>
- <p>This allows for long-running scripts that are not interrupted by scripts that respond to clicks
- or other user interactions, and allows long tasks to be executed without yielding to keep the page
- responsive.</p>
- <p>Workers (as these background scripts are called herein) are relatively heavy-weight, and are
- not intended to be used in large numbers. For example, it would be inappropriate to launch one
- worker for each pixel of a four megapixel image. The examples below show some appropriate uses of
- workers.</p>
- <p>Generally, workers are expected to be long-lived, have a high start-up performance cost, and a
- high per-instance memory cost.</p>
- <h4 id=examples-6>10.1.2 Examples</h4>
- <p><i>This section is non-normative.</i></p>
- <p>There are a variety of uses that workers can be put to. The following subsections show various
- examples of this use.</p>
- <h5 id=a-background-number-crunching-worker>10.1.2.1 A background number-crunching worker</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The simplest use of workers is for performing a computationally
- expensive task without interrupting the user interface.</p>
- <p>In this example, the main document spawns a worker to (naïvely) compute prime numbers, and
- progressively displays the most recently found prime number.</p>
- <p>The main page is as follows:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Worker example: One-core computation</title>
- </head>
- <body>
- <p>The highest prime number discovered so far is: <output id="result"></output></p>
- <script>
- var worker = new Worker('worker.js');
- worker.onmessage = function (event) {
- document.getElementById('result').textContent = event.data;
- };
- </script>
- </body>
- </html></pre>
- <p>The <code id=a-background-number-crunching-worker:dom-worker><a href=#dom-worker>Worker()</a></code> constructor call creates a worker and returns a
- <code id=a-background-number-crunching-worker:worker><a href=#worker>Worker</a></code> object representing that worker, which is used to communicate with the worker.
- That object's <code id=a-background-number-crunching-worker:handler-worker-onmessage><a href=#handler-worker-onmessage>onmessage</a></code> event handler allows the
- code to receive messages from the worker.</p>
- <p>The worker itself is as follows:</p>
- <pre>var n = 1;
- search: while (true) {
- n += 1;
- for (var i = 2; i <= Math.sqrt(n); i += 1)
- if (n % i == 0)
- continue search;
- // found a prime!
- postMessage(n);
- }</pre>
- <p>The bulk of this code is simply an unoptimised search for a prime number. The <code id=a-background-number-crunching-worker:dom-dedicatedworkerglobalscope-postmessage><a href=#dom-dedicatedworkerglobalscope-postmessage>postMessage()</a></code> method is used to send a
- message back to the page when a prime is found.</p>
- <p><a href=//www.whatwg.org/demos/workers/primes/page.html>View this example online</a>.</p>
- <h5 id=worker-used-for-background-i/o>10.1.2.2 Worker used for background I/O</h5>
- <p><i>This section is non-normative.</i></p>
- <p>In this example, the main document uses two workers, one for fetching stock updates at regular
- intervals, and one for performing search queries that the user requests.</p>
- <p>The main page is as follows:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Worker example: Stock ticker</title>
- <script>
- // TICKER
- var symbol = 'GOOG'; // default symbol to watch
- var ticker = new Worker('ticker.js');
- // SEARCHER
- var searcher = new Worker('searcher.js');
- function search(query) {
- searcher.postMessage(query);
- }
- // SYMBOL SELECTION UI
- function select(newSymbol) {
- symbol = newSymbol;
- ticker.postMessage(symbol);
- }
- </script>
- <meta http-equiv="Refresh" content="120; URL=../">
- </head>
- <body onload="search('')">
- <p><output id="symbol"></output> <output id="value"></output></p>
- <script>
- ticker.onmessage = function (event) {
- var data = event.data.split(' ');
- document.getElementById('symbol').textContent = data[0];
- document.getElementById('value').textContent = data[1];
- };
- ticker.postMessage(symbol);
- </script>
- <p><label>Search: <input type="text" autofocus oninput="search(this.value)"></label></p>
- <ul id="results"></ul>
- <script>
- searcher.onmessage = function (event) {
- var data = event.data.split(' ');
- var results = document.getElementById('results');
- while (results.hasChildNodes()) // clear previous results
- results.removeChild(results.firstChild);
- for (var i = 0; i < data.length; i += 1) {
- // add a list item with a button for each result
- var li = document.createElement('li');
- var button = document.createElement('button');
- button.value = data[i];
- button.type = 'button';
- button.onclick = function () { select(this.value); };
- button.textContent = data[i];
- li.appendChild(button);
- results.appendChild(li);
- }
- };
- </script>
- <p>(The data in this example is not real. Try searching for "Google" or "Apple".)</p>
- </body>
- </html>
- </pre>
- <p>The two workers use a common library for performing the actual network calls. This library is
- as follows:</p>
- <pre>function get(url) {
- try {
- var xhr = new XMLHttpRequest();
- xhr.open('GET', url, false);
- xhr.send();
- return xhr.responseText;
- } catch (e) {
- return ''; // turn all errors into empty results
- }
- }</pre>
- <p>The stock updater worker is as follows:</p>
- <pre>importScripts('io.js');
- var timer;
- var symbol;
- function update() {
- postMessage(symbol + ' ' + get('stock.cgi?' + symbol));
- timer = setTimeout(update, 10000);
- }
- onmessage = function (event) {
- if (timer)
- clearTimeout(timer);
- symbol = event.data;
- update();
- };</pre>
- <p>The search query worker is as follows:</p>
- <pre>importScripts('io.js');
- onmessage = function (event) {
- postMessage(get('search.cgi?' + event.data));
- };</pre>
- <p><a href=//www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</p>
- <h5 id=shared-workers-introduction>10.1.2.3 Shared workers introduction</h5>
- <p><i>This section is non-normative.</i></p>
- <p>This section introduces shared workers using a Hello World example. Shared workers use slightly
- different APIs, since each worker can have multiple connections.</p>
- <p>This first example shows how you connect to a worker and how a worker can send a message back
- to the page when it connects to it. Received messages are displayed in a log.</p>
- <p>Here is the HTML page:</p>
- <pre><!DOCTYPE HTML>
- <title>Shared workers: demo 1</title>
- <pre id="log">Log:</pre>
- <script>
- var worker = new SharedWorker('test.js');
- var log = document.getElementById('log');
- worker.port.onmessage = function(e) { // note: not worker.onmessage!
- log.textContent += '\n' + e.data;
- }
- </script>
- </pre>
- <p>Here is the JavaScript worker:</p>
- <pre>onconnect = function(e) {
- var port = e.ports[0];
- port.postMessage('Hello World!');
- }
- </pre>
- <p><a href=//www.whatwg.org/demos/workers/shared/001/test.html>View this example online</a>.</p>
- <hr>
- <p>This second example extends the first one by changing two things: first, messages are received
- using <code>addEventListener()</code> instead of an <a href=#event-handler-idl-attributes id=shared-workers-introduction:event-handler-idl-attributes>event handler IDL attribute</a>, and second, a message is sent <em>to</em> the
- worker, causing the worker to send another message in return. Received messages are again
- displayed in a log.</p>
- <p>Here is the HTML page:</p>
- <pre><!DOCTYPE HTML>
- <title>Shared workers: demo 2</title>
- <pre id="log">Log:</pre>
- <script>
- var worker = new SharedWorker('test.js');
- var log = document.getElementById('log');
- worker.port.addEventListener('message', function(e) {
- log.textContent += '\n' + e.data;
- }, false);
- worker.port.start(); // note: need this when using addEventListener
- worker.port.postMessage('ping');
- </script>
- </pre>
- <p>Here is the JavaScript worker:</p>
- <pre>onconnect = function(e) {
- var port = e.ports[0];
- port.postMessage('Hello World!');
- port.onmessage = function(e) {
- port.postMessage('pong'); // not e.ports[0].postMessage!
- // e.target.postMessage('pong'); would work also
- }
- }
- </pre>
- <p><a href=//www.whatwg.org/demos/workers/shared/002/test.html>View this example online</a>.</p>
- <hr>
- <p>Finally, the example is extended to show how two pages can connect to the same worker; in this
- case, the second page is merely in an <code id=shared-workers-introduction:the-iframe-element><a href=#the-iframe-element>iframe</a></code> on the first page, but the same
- principle would apply to an entirely separate page in a separate <a href=#top-level-browsing-context id=shared-workers-introduction:top-level-browsing-context>top-level browsing
- context</a>.</p>
- <p>Here is the outer HTML page:</p>
- <pre><!DOCTYPE HTML>
- <title>Shared workers: demo 3</title>
- <pre id="log">Log:</pre>
- <script>
- var worker = new SharedWorker('test.js');
- var log = document.getElementById('log');
- worker.port.addEventListener('message', function(e) {
- log.textContent += '\n' + e.data;
- }, false);
- worker.port.start();
- worker.port.postMessage('ping');
- </script>
- <iframe src="inner.html"></iframe>
- </pre>
- <p>Here is the inner HTML page:</p>
- <pre><!DOCTYPE HTML>
- <title>Shared workers: demo 3 inner frame</title>
- <pre id=log>Inner log:</pre>
- <script>
- var worker = new SharedWorker('test.js');
- var log = document.getElementById('log');
- worker.port.onmessage = function(e) {
- log.textContent += '\n' + e.data;
- }
- </script>
- </pre>
- <p>Here is the JavaScript worker:</p>
- <pre>var count = 0;
- onconnect = function(e) {
- count += 1;
- var port = e.ports[0];
- port.postMessage('Hello World! You are connection #' + count);
- port.onmessage = function(e) {
- port.postMessage('pong');
- }
- }
- </pre>
- <p><a href=//www.whatwg.org/demos/workers/shared/003/test.html>View this example online</a>.</p>
- <h5 id=shared-state-using-a-shared-worker>10.1.2.4 Shared state using a shared worker</h5>
- <p><i>This section is non-normative.</i></p>
- <p>In this example, multiple windows (viewers) can be opened that are all viewing the same map.
- All the windows share the same map information, with a single worker coordinating all the viewers.
- Each viewer can move around independently, but if they set any data on the map, all the viewers
- are updated.</p>
- <p>The main page isn't interesting, it merely provides a way to open the viewers:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Workers example: Multiviewer</title>
- <script>
- function openViewer() {
- window.open('viewer.html');
- }
- </script>
- </head>
- <body>
- <p><button type=button onclick="openViewer()">Open a new
- viewer</button></p>
- <p>Each viewer opens in a new window. You can have as many viewers
- as you like, they all view the same data.</p>
- </body>
- </html></pre>
- <p>The viewer is more involved:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Workers example: Multiviewer viewer</title>
- <script>
- var worker = new SharedWorker('worker.js', 'core');
- // CONFIGURATION
- function configure(event) {
- if (event.data.substr(0, 4) != 'cfg ') return;
- var name = event.data.substr(4).split(' ', 1)[0];
- // update display to mention our name is name
- document.getElementsByTagName('h1')[0].textContent += ' ' + name;
- // no longer need this listener
- worker.port.removeEventListener('message', configure, false);
- }
- worker.port.addEventListener('message', configure, false);
- // MAP
- function paintMap(event) {
- if (event.data.substr(0, 4) != 'map ') return;
- var data = event.data.substr(4).split(',');
- // display tiles data[0] .. data[8]
- var canvas = document.getElementById('map');
- var context = canvas.getContext('2d');
- for (var y = 0; y < 3; y += 1) {
- for (var x = 0; x < 3; x += 1) {
- var tile = data[y * 3 + x];
- if (tile == '0')
- context.fillStyle = 'green';
- else
- context.fillStyle = 'maroon';
- context.fillRect(x * 50, y * 50, 50, 50);
- }
- }
- }
- worker.port.addEventListener('message', paintMap, false);
- // PUBLIC CHAT
- function updatePublicChat(event) {
- if (event.data.substr(0, 4) != 'txt ') return;
- var name = event.data.substr(4).split(' ', 1)[0];
- var message = event.data.substr(4 + name.length + 1);
- // display "<name> message" in public chat
- var public = document.getElementById('public');
- var p = document.createElement('p');
- var n = document.createElement('button');
- n.textContent = '<' + name + '> ';
- n.onclick = function () { worker.port.postMessage('msg ' + name); };
- p.appendChild(n);
- var m = document.createElement('span');
- m.textContent = message;
- p.appendChild(m);
- public.appendChild(p);
- }
- worker.port.addEventListener('message', updatePublicChat, false);
- // PRIVATE CHAT
- function startPrivateChat(event) {
- if (event.data.substr(0, 4) != 'msg ') return;
- var name = event.data.substr(4).split(' ', 1)[0];
- var port = event.ports[0];
- // display a private chat UI
- var ul = document.getElementById('private');
- var li = document.createElement('li');
- var h3 = document.createElement('h3');
- h3.textContent = 'Private chat with ' + name;
- li.appendChild(h3);
- var div = document.createElement('div');
- var addMessage = function(name, message) {
- var p = document.createElement('p');
- var n = document.createElement('strong');
- n.textContent = '<' + name + '> ';
- p.appendChild(n);
- var t = document.createElement('span');
- t.textContent = message;
- p.appendChild(t);
- div.appendChild(p);
- };
- port.onmessage = function (event) {
- addMessage(name, event.data);
- };
- li.appendChild(div);
- var form = document.createElement('form');
- var p = document.createElement('p');
- var input = document.createElement('input');
- input.size = 50;
- p.appendChild(input);
- p.appendChild(document.createTextNode(' '));
- var button = document.createElement('button');
- button.textContent = 'Post';
- p.appendChild(button);
- form.onsubmit = function () {
- port.postMessage(input.value);
- addMessage('me', input.value);
- input.value = '';
- return false;
- };
- form.appendChild(p);
- li.appendChild(form);
- ul.appendChild(li);
- }
- worker.port.addEventListener('message', startPrivateChat, false);
- worker.port.start();
- </script>
- </head>
- <body>
- <h1>Viewer</h1>
- <h2>Map</h2>
- <p><canvas id="map" height=150 width=150></canvas></p>
- <p>
- <button type=button onclick="worker.port.postMessage('mov left')">Left</button>
- <button type=button onclick="worker.port.postMessage('mov up')">Up</button>
- <button type=button onclick="worker.port.postMessage('mov down')">Down</button>
- <button type=button onclick="worker.port.postMessage('mov right')">Right</button>
- <button type=button onclick="worker.port.postMessage('set 0')">Set 0</button>
- <button type=button onclick="worker.port.postMessage('set 1')">Set 1</button>
- </p>
- <h2>Public Chat</h2>
- <div id="public"></div>
- <form onsubmit="worker.port.postMessage('txt ' + message.value); message.value = ''; return false;">
- <p>
- <input type="text" name="message" size="50">
- <button>Post</button>
- </p>
- </form>
- <h2>Private Chat</h2>
- <ul id="private"></ul>
- </body>
- </html>
- </pre>
- <p>There are several key things worth noting about the way the viewer is written.</p>
- <p><strong>Multiple listeners</strong>. Instead of a single message processing function, the code
- here attaches multiple event listeners, each one performing a quick check to see if it is relevant
- for the message. In this example it doesn't make much difference, but if multiple authors wanted
- to collaborate using a single port to communicate with a worker, it would allow for independent
- code instead of changes having to all be made to a single event handling function.</p>
- <p>Registering event listeners in this way also allows you to unregister specific listeners when
- you are done with them, as is done with the <code>configure()</code> method in this
- example.</p>
- <p>Finally, the worker:</p>
- <pre>var nextName = 0;
- function getNextName() {
- // this could use more friendly names
- // but for now just return a number
- return nextName++;
- }
- var map = [
- [0, 0, 0, 0, 0, 0, 0],
- [1, 1, 0, 1, 0, 1, 1],
- [0, 1, 0, 1, 0, 0, 0],
- [0, 1, 0, 1, 0, 1, 1],
- [0, 0, 0, 1, 0, 0, 0],
- [1, 0, 0, 1, 1, 1, 1],
- [1, 1, 0, 1, 1, 0, 1],
- ];
- function wrapX(x) {
- if (x < 0) return wrapX(x + map[0].length);
- if (x >= map[0].length) return wrapX(x - map[0].length);
- return x;
- }
- function wrapY(y) {
- if (y < 0) return wrapY(y + map.length);
- if (y >= map[0].length) return wrapY(y - map.length);
- return y;
- }
- function wrap(val, min, max) {
- if (val < min)
- return val + (max-min)+1;
- if (val > max)
- return val - (max-min)-1;
- return val;
- }
- function sendMapData(viewer) {
- var data = '';
- for (var y = viewer.y-1; y <= viewer.y+1; y += 1) {
- for (var x = viewer.x-1; x <= viewer.x+1; x += 1) {
- if (data != '')
- data += ',';
- data += map[wrap(y, 0, map[0].length-1)][wrap(x, 0, map.length-1)];
- }
- }
- viewer.port.postMessage('map ' + data);
- }
- var viewers = {};
- onconnect = function (event) {
- var name = getNextName();
- event.ports[0]._data = { port: event.ports[0], name: name, x: 0, y: 0, };
- viewers[name] = event.ports[0]._data;
- event.ports[0].postMessage('cfg ' + name);
- event.ports[0].onmessage = getMessage;
- sendMapData(event.ports[0]._data);
- };
- function getMessage(event) {
- switch (event.data.substr(0, 4)) {
- case 'mov ':
- var direction = event.data.substr(4);
- var dx = 0;
- var dy = 0;
- switch (direction) {
- case 'up': dy = -1; break;
- case 'down': dy = 1; break;
- case 'left': dx = -1; break;
- case 'right': dx = 1; break;
- }
- event.target._data.x = wrapX(event.target._data.x + dx);
- event.target._data.y = wrapY(event.target._data.y + dy);
- sendMapData(event.target._data);
- break;
- case 'set ':
- var value = event.data.substr(4);
- map[event.target._data.y][event.target._data.x] = value;
- for (var viewer in viewers)
- sendMapData(viewers[viewer]);
- break;
- case 'txt ':
- var name = event.target._data.name;
- var message = event.data.substr(4);
- for (var viewer in viewers)
- viewers[viewer].port.postMessage('txt ' + name + ' ' + message);
- break;
- case 'msg ':
- var party1 = event.target._data;
- var party2 = viewers[event.data.substr(4).split(' ', 1)[0]];
- if (party2) {
- var channel = new MessageChannel();
- party1.port.postMessage('msg ' + party2.name, [channel.port1]);
- party2.port.postMessage('msg ' + party1.name, [channel.port2]);
- }
- break;
- }
- }</pre>
- <p><strong>Connecting to multiple pages</strong>. The script uses the <code id=shared-state-using-a-shared-worker:handler-sharedworkerglobalscope-onconnect><a href=#handler-sharedworkerglobalscope-onconnect>onconnect</a></code> event listener to listen for
- multiple connections.</p>
- <p><strong>Direct channels</strong>. When the worker receives a "msg" message from one viewer
- naming another viewer, it sets up a direct connection between the two, so that the two viewers can
- communicate directly without the worker having to proxy all the messages.</p>
- <p><a href=//www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</p>
- <h5 id=delegation>10.1.2.5 Delegation</h5>
- <p><i>This section is non-normative.</i></p>
- <p>With multicore CPUs becoming prevalent, one way to obtain better performance is to split
- computationally expensive tasks amongst multiple workers. In this example, a computationally
- expensive task that is to be performed for every number from 1 to 10,000,000 is farmed out to ten
- subworkers.</p>
- <p>The main page is as follows, it just reports the result:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <head>
- <title>Worker example: Multicore computation</title>
- </head>
- <body>
- <p>Result: <output id="result"></output></p>
- <script>
- var worker = new Worker('worker.js');
- worker.onmessage = function (event) {
- document.getElementById('result').textContent = event.data;
- };
- </script>
- </body>
- </html></pre>
- <p>The worker itself is as follows:</p>
- <pre>// settings
- var num_workers = 10;
- var items_per_worker = 1000000;
- // start the workers
- var result = 0;
- var pending_workers = num_workers;
- for (var i = 0; i < num_workers; i += 1) {
- var worker = new Worker('core.js');
- worker.postMessage(i * items_per_worker);
- worker.postMessage((i+1) * items_per_worker);
- worker.onmessage = storeResult;
- }
- // handle the results
- function storeResult(event) {
- result += 1*event.data;
- pending_workers -= 1;
- if (pending_workers <= 0)
- postMessage(result); // finished!
- }</pre>
- <p>It consists of a loop to start the subworkers, and then a handler
- that waits for all the subworkers to respond.</p>
- <p>The subworkers are implemented as follows:</p>
- <pre>var start;
- onmessage = getStart;
- function getStart(event) {
- start = 1*event.data;
- onmessage = getEnd;
- }
- var end;
- function getEnd(event) {
- end = 1*event.data;
- onmessage = null;
- work();
- }
- function work() {
- var result = 0;
- for (var i = start; i < end; i += 1) {
- // perform some complex calculation here
- result += 1;
- }
- postMessage(result);
- close();
- }</pre>
- <p>They receive two numbers in two events, perform the computation for the range of numbers thus
- specified, and then report the result back to the parent.</p>
- <p><a href=//www.whatwg.org/demos/workers/multicore/page.html>View this example online</a>.</p>
- <h4 id=tutorials>10.1.3 Tutorials</h4>
- <h5 id=creating-a-dedicated-worker>10.1.3.1 Creating a dedicated worker</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Creating a worker requires a URL to a JavaScript file. The <code id=creating-a-dedicated-worker:dom-worker><a href=#dom-worker>Worker()</a></code> constructor is invoked with the URL to that file as its only
- argument; a worker is then created and returned:</p>
- <pre>var worker = new Worker('helper.js');</pre>
- <h5 id=communicating-with-a-dedicated-worker>10.1.3.2 Communicating with a dedicated worker</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Dedicated workers use <code id=communicating-with-a-dedicated-worker:messageport><a href=#messageport>MessagePort</a></code> objects behind the scenes, and thus support all
- the same features, such as sending structured data, transferring binary data, and transferring
- other ports.</p>
- <p>To receive messages from a dedicated worker, use the <code id=communicating-with-a-dedicated-worker:handler-worker-onmessage><a href=#handler-worker-onmessage>onmessage</a></code> <a href=#event-handler-idl-attributes id=communicating-with-a-dedicated-worker:event-handler-idl-attributes>event
- handler IDL attribute</a> on the <code id=communicating-with-a-dedicated-worker:worker><a href=#worker>Worker</a></code> object:</p>
- <pre>worker.onmessage = function (event) { ... };</pre>
- <p>You can also use the <code id=communicating-with-a-dedicated-worker:dom-eventtarget-addeventlistener><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code>
- method.</p>
- <p class=note>The implicit <code id=communicating-with-a-dedicated-worker:messageport-2><a href=#messageport>MessagePort</a></code> used by dedicated workers has its <a href=#port-message-queue id=communicating-with-a-dedicated-worker:port-message-queue>port
- message queue</a> implicitly enabled when it is created, so there is no equivalent to the
- <code id=communicating-with-a-dedicated-worker:messageport-3><a href=#messageport>MessagePort</a></code> interface's <code id=communicating-with-a-dedicated-worker:dom-messageport-start><a href=#dom-messageport-start>start()</a></code> method on
- the <code id=communicating-with-a-dedicated-worker:worker-2><a href=#worker>Worker</a></code> interface.</p>
- <p>To <em>send</em> data to a worker, use the <code id=communicating-with-a-dedicated-worker:dom-worker-postmessage><a href=#dom-worker-postmessage>postMessage()</a></code> method. Structured data can be sent over this
- communication channel. To send <code id=communicating-with-a-dedicated-worker:arraybuffer><a href=#arraybuffer>ArrayBuffer</a></code> objects efficiently (by transferring them
- rather than cloning them), list them in an array in the second argument.</p>
- <pre>worker.postMessage({
- operation: 'find-edges',
- input: buffer, // an ArrayBuffer object
- threshold: 0.6,
- }, [buffer]);</pre>
- <p>To receive a message inside the worker, the <code id=communicating-with-a-dedicated-worker:handler-dedicatedworkerglobalscope-onmessage><a href=#handler-dedicatedworkerglobalscope-onmessage>onmessage</a></code> <a href=#event-handler-idl-attributes id=communicating-with-a-dedicated-worker:event-handler-idl-attributes-2>event handler IDL attribute</a> is used.</p>
- <pre>onmessage = function (event) { ... };</pre>
- <p>You can again also use the <code id=communicating-with-a-dedicated-worker:dom-eventtarget-addeventlistener-2><a href=#dom-eventtarget-addeventlistener>addEventListener()</a></code> method.</p>
- <p>In either case, the data is provided in the event object's <code id=communicating-with-a-dedicated-worker:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code> attribute.</p>
- <p>To send messages back, you again use <code id=communicating-with-a-dedicated-worker:dom-dedicatedworkerglobalscope-postmessage><a href=#dom-dedicatedworkerglobalscope-postmessage>postMessage()</a></code>. It supports the
- structured data in the same manner.</p>
- <pre>postMessage(event.data.input, [event.data.input]); // transfer the buffer back</pre>
- <h5 id=shared-workers>10.1.3.3 Shared workers</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Shared workers are identified by the URL of the script used to create it, optionally with an
- explicit name. The name allows multiple instances of a particular shared worker to be started.</p>
- <p>Shared workers are scoped by <a href=#origin-2 id=shared-workers:origin-2>origin</a>. Two different sites using the same names will
- not collide. However, if a page tries to use the same shared worker name as another page on the
- same site, but with a different script URL, it will fail.</p>
- <p>Creating shared workers is done using the <code id=shared-workers:dom-sharedworker><a href=#dom-sharedworker>SharedWorker()</a></code>
- constructor. This constructor takes the URL to the script to use for its first argument, and the
- name of the worker, if any, as the second argument.</p>
- <pre>var worker = new SharedWorker('service.js');</pre>
- <p>Communicating with shared workers is done with explicit <code id=shared-workers:messageport><a href=#messageport>MessagePort</a></code> objects. The
- object returned by the <code id=shared-workers:dom-sharedworker-2><a href=#dom-sharedworker>SharedWorker()</a></code> constructor holds a
- reference to the port on its <code id=shared-workers:dom-sharedworker-port><a href=#dom-sharedworker-port>port</a></code> attribute.</p>
- <pre>worker.port.onmessage = function (event) { ... };
- worker.port.postMessage('some message');
- worker.port.postMessage({ foo: 'structured', bar: ['data', 'also', 'possible']});</pre>
- <p>Inside the shared worker, new clients of the worker are announced using the <code id=shared-workers:event-workerglobalscope-connect><a href=#event-workerglobalscope-connect>connect</a></code> event. The port for the new client is
- given by the event object's <code id=shared-workers:dom-messageevent-source><a href=#dom-messageevent-source>source</a></code> attribute.</p>
- <pre>onconnect = function (event) {
- var newPort = event.source;
- // set up a listener
- newPort.onmessage = function (event) { ... };
- // send a message back to the port
- newPort.postMessage('ready!'); // can also send structured data, of course
- };</pre>
- <h3 id=infrastructure-2>10.2 Infrastructure</h3>
- <p>There are two kinds of workers; dedicated workers, and shared workers. Dedicated workers, once
- created, are linked to their creator; but message ports can be used to communicate from a
- dedicated worker to multiple other browsing contexts or workers. Shared workers, on the other
- hand, are named, and once created any script running in the same <a href=#origin-2 id=infrastructure-2:origin-2>origin</a> can obtain a
- reference to that worker and communicate with it.</p>
- <h4 id=the-global-scope>10.2.1 The global scope</h4>
- <p>The global scope is the "inside" of a worker.</p>
- <h5 id=the-workerglobalscope-common-interface>10.2.1.1 The <code id=the-workerglobalscope-common-interface:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> common interface</h5>
- <pre class=idl>[Exposed=Worker]
- interface <dfn id=workerglobalscope>WorkerGlobalScope</dfn> : <a href=#eventtarget id=the-workerglobalscope-common-interface:eventtarget>EventTarget</a> {
- readonly attribute <a href=#workerglobalscope id=the-workerglobalscope-common-interface:workerglobalscope-2>WorkerGlobalScope</a> <a href=#dom-workerglobalscope-self id=the-workerglobalscope-common-interface:dom-workerglobalscope-self>self</a>;
- readonly attribute <a href=#workerlocation id=the-workerglobalscope-common-interface:workerlocation>WorkerLocation</a> <a href=#dom-workerglobalscope-location id=the-workerglobalscope-common-interface:dom-workerglobalscope-location>location</a>;
- void <a href=#dom-workerglobalscope-close id=the-workerglobalscope-common-interface:dom-workerglobalscope-close>close</a>();
- attribute <a href=#onerroreventhandler id=the-workerglobalscope-common-interface:onerroreventhandler>OnErrorEventHandler</a> <a href=#handler-workerglobalscope-onerror id=the-workerglobalscope-common-interface:handler-workerglobalscope-onerror>onerror</a>;
- attribute <a href=#eventhandler id=the-workerglobalscope-common-interface:eventhandler>EventHandler</a> <a href=#handler-workerglobalscope-onlanguagechange id=the-workerglobalscope-common-interface:handler-workerglobalscope-onlanguagechange>onlanguagechange</a>;
- attribute <a href=#eventhandler id=the-workerglobalscope-common-interface:eventhandler-2>EventHandler</a> <a href=#handler-workerglobalscope-onoffline id=the-workerglobalscope-common-interface:handler-workerglobalscope-onoffline>onoffline</a>;
- attribute <a href=#eventhandler id=the-workerglobalscope-common-interface:eventhandler-3>EventHandler</a> <a href=#handler-workerglobalscope-ononline id=the-workerglobalscope-common-interface:handler-workerglobalscope-ononline>ononline</a>;
- // <a href="#WorkerGlobalScope-partial">also has additional members in a partial interface</a>
- };</pre>
- <p>The <dfn id=dom-workerglobalscope-self><code>self</code></dfn> attribute must return the
- <code id=the-workerglobalscope-common-interface:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object itself.</p>
- <p>The <dfn id=dom-workerglobalscope-location><code>location</code></dfn> attribute must
- return the <code id=the-workerglobalscope-common-interface:workerlocation-2><a href=#workerlocation>WorkerLocation</a></code> object created for the <code id=the-workerglobalscope-common-interface:workerglobalscope-4><a href=#workerglobalscope>WorkerGlobalScope</a></code>
- object when the worker was created. It represents the <a href=#absolute-url id=the-workerglobalscope-common-interface:absolute-url>absolute URL</a> of the script that
- was used to initialise the worker, after any redirects.</p>
- <hr>
- <p>When a script invokes the <dfn id=dom-workerglobalscope-close><code>close()</code></dfn>
- method on a <code id=the-workerglobalscope-common-interface:workerglobalscope-5><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user agent must run the following steps
- (atomically):</p>
- <ol><li><p>Discard any <a href=#concept-task id=the-workerglobalscope-common-interface:concept-task>tasks</a> that have been added to the
- <code id=the-workerglobalscope-common-interface:workerglobalscope-6><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop id=the-workerglobalscope-common-interface:event-loop>event loop</a>'s <a href=#task-queue id=the-workerglobalscope-common-interface:task-queue>task
- queues</a>.</p>
- <li><p>Set the worker's <code id=the-workerglobalscope-common-interface:workerglobalscope-7><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing id=the-workerglobalscope-common-interface:dom-workerglobalscope-closing>closing</a> flag to true. (This prevents any further
- tasks from being queued.)</ol>
- <hr>
- <p>The following are the <a href=#event-handlers id=the-workerglobalscope-common-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=the-workerglobalscope-common-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=the-workerglobalscope-common-interface:event-handler-idl-attributes>event handler IDL attributes</a>,
- by objects implementing the <code id=the-workerglobalscope-common-interface:workerglobalscope-8><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=the-workerglobalscope-common-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=the-workerglobalscope-common-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-workerglobalscope-onerror><code>onerror</code></dfn> <td> <code id=the-workerglobalscope-common-interface:event-error><a href=#event-error>error</a></code>
- <tr><td><dfn id=handler-workerglobalscope-onlanguagechange><code>onlanguagechange</code></dfn> <td> <code id=the-workerglobalscope-common-interface:event-languagechange><a href=#event-languagechange>languagechange</a></code>
- <tr><td><dfn id=handler-workerglobalscope-onoffline><code>onoffline</code></dfn> <td> <code id=the-workerglobalscope-common-interface:event-offline><a href=#event-offline>offline</a></code>
- <tr><td><dfn id=handler-workerglobalscope-ononline><code>ononline</code></dfn> <td> <code id=the-workerglobalscope-common-interface:event-online><a href=#event-online>online</a></code>
- </table>
- <hr>
- <p class=note>For <a href=http://tools.ietf.org/html/rfc2397#section-2 id=the-workerglobalscope-common-interface:data-protocol data-x-internal=data-protocol><code>data:</code> URLs</a>, this is the
- <a href=#origin-2 id=the-workerglobalscope-common-interface:origin-2>origin</a> specified by the <a href=#entry-settings-object id=the-workerglobalscope-common-interface:entry-settings-object>entry settings object</a> when the constructor was
- called. For other <a href=#url id=the-workerglobalscope-common-interface:url>URLs</a>, this is the <a href=#origin-2 id=the-workerglobalscope-common-interface:origin-2-2>origin</a> of the value of
- the <a href=#absolute-url id=the-workerglobalscope-common-interface:absolute-url-2>absolute URL</a> given in the worker's <code id=the-workerglobalscope-common-interface:dom-workerglobalscope-location-2><a href=#dom-workerglobalscope-location>location</a></code> attribute.</p>
- <h5 id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface>10.2.1.2 Dedicated workers and the <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> interface</h5>
- <pre class=idl>[Global=(Worker,DedicatedWorker),Exposed=DedicatedWorker]
- /*sealed*/ interface <dfn id=dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</dfn> : <a href=#workerglobalscope id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope</a> {
- void <a href=#dom-dedicatedworkerglobalscope-postmessage id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-dedicatedworkerglobalscope-postmessage>postMessage</a>(any message, optional sequence<<a href=#transferable id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:transferable>Transferable</a>> transfer);
- attribute <a href=#eventhandler id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:eventhandler>EventHandler</a> <a href=#handler-dedicatedworkerglobalscope-onmessage id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:handler-dedicatedworkerglobalscope-onmessage>onmessage</a>;
- };</pre>
- <p><code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-2><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects act as if they had an implicit
- <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:messageport><a href=#messageport>MessagePort</a></code> associated with them. This port is part of a channel that is set up when
- the worker is created, but it is not exposed. This object must never be garbage collected before
- the <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-3><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>
- <p>All messages received by that port must immediately be retargeted at the
- <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-4><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object.</p>
- <p>The <dfn id=dom-dedicatedworkerglobalscope-postmessage><code>postMessage()</code></dfn>
- method on <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-5><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> objects must act as if, when invoked, it
- immediately invoked <a href=#dom-messageport-postmessage id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dom-messageport-postmessage>the method of the same name</a>
- on the port, with the same arguments, and returned the same return value.</p>
- <p>The following are the <a href=#event-handlers id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handler-idl-attributes>event
- handler IDL attributes</a>, by objects implementing the <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:dedicatedworkerglobalscope-6><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-dedicatedworkerglobalscope-onmessage><code>onmessage</code></dfn> <td> <code id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:event-message><a href=#event-message>message</a></code>
- </table>
- <p>For the purposes of the <a href=#application-cache id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:application-cache>application cache</a> networking model, a dedicated worker is
- an extension of the <a href=#cache-host id=dedicated-workers-and-the-dedicatedworkerglobalscope-interface:cache-host>cache host</a> from which it was created.</p>
- <h5 id=shared-workers-and-the-sharedworkerglobalscope-interface>10.2.1.3 Shared workers and the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> interface</h5>
- <pre class=idl>[Global=(Worker,SharedWorker),Exposed=SharedWorker]
- /*sealed*/ interface <dfn id=sharedworkerglobalscope>SharedWorkerGlobalScope</dfn> : <a href=#workerglobalscope id=shared-workers-and-the-sharedworkerglobalscope-interface:workerglobalscope>WorkerGlobalScope</a> {
- readonly attribute DOMString <a href=#dom-sharedworkerglobalscope-name id=shared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-name>name</a>;
- readonly attribute <a href=#applicationcache id=shared-workers-and-the-sharedworkerglobalscope-interface:applicationcache>ApplicationCache</a> <a href=#dom-sharedworkerglobalscope-applicationcache id=shared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-applicationcache>applicationCache</a>;
- attribute <a href=#eventhandler id=shared-workers-and-the-sharedworkerglobalscope-interface:eventhandler>EventHandler</a> <a href=#handler-sharedworkerglobalscope-onconnect id=shared-workers-and-the-sharedworkerglobalscope-interface:handler-sharedworkerglobalscope-onconnect>onconnect</a>;
- };</pre>
- <p>Shared workers receive message ports through <code id=shared-workers-and-the-sharedworkerglobalscope-interface:event-workerglobalscope-connect><a href=#event-workerglobalscope-connect>connect</a></code> events on their <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-2><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object for each
- connection.</p>
- <p>The <dfn id=dom-sharedworkerglobalscope-name><code>name</code></dfn> attribute must return
- the value it was assigned when the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-3><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object was created by the
- "<a href=#run-a-worker id=shared-workers-and-the-sharedworkerglobalscope-interface:run-a-worker>run a worker</a>" algorithm. Its value represents the name that can be used to obtain a
- reference to the worker using the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworker><a href=#sharedworker>SharedWorker</a></code> constructor.</p>
- <p>The following are the <a href=#event-handlers id=shared-workers-and-the-sharedworkerglobalscope-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=shared-workers-and-the-sharedworkerglobalscope-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=shared-workers-and-the-sharedworkerglobalscope-interface:event-handler-idl-attributes>event
- handler IDL attributes</a>, by objects implementing the <code id=shared-workers-and-the-sharedworkerglobalscope-interface:sharedworkerglobalscope-4><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
- interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=shared-workers-and-the-sharedworkerglobalscope-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=shared-workers-and-the-sharedworkerglobalscope-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-sharedworkerglobalscope-onconnect><code>onconnect</code></dfn> <td> <code id=shared-workers-and-the-sharedworkerglobalscope-interface:event-workerglobalscope-connect-2><a href=#event-workerglobalscope-connect>connect</a></code>
- </table>
- <p>For the purposes of the <a href=#application-cache id=shared-workers-and-the-sharedworkerglobalscope-interface:application-cache>application cache</a> networking model, a shared worker is its
- own <a href=#cache-host id=shared-workers-and-the-sharedworkerglobalscope-interface:cache-host>cache host</a>. The <a href=#run-a-worker id=shared-workers-and-the-sharedworkerglobalscope-interface:run-a-worker-2>run a worker</a> algorithm takes care of associating the
- worker with an <a href=#application-cache id=shared-workers-and-the-sharedworkerglobalscope-interface:application-cache-2>application cache</a>.</p>
- <p class=note>The <code id=shared-workers-and-the-sharedworkerglobalscope-interface:dom-sharedworkerglobalscope-applicationcache-2><a href=#dom-sharedworkerglobalscope-applicationcache>applicationCache</a></code> attribute returns the
- <code id=shared-workers-and-the-sharedworkerglobalscope-interface:applicationcache-2><a href=#applicationcache>ApplicationCache</a></code> object for the worker.</p>
- <h4 id=worker-event-loop>10.2.2 The event loop</h4>
- <p>Each <code id=worker-event-loop:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object has a distinct <a href=#event-loop id=worker-event-loop:event-loop>event loop</a>, separate
- from those used by <a href=#unit-of-related-similar-origin-browsing-contexts id=worker-event-loop:unit-of-related-similar-origin-browsing-contexts>units of related
- similar-origin browsing contexts</a>. This <a href=#event-loop id=worker-event-loop:event-loop-2>event loop</a> has no associated
- <a href=#browsing-context id=worker-event-loop:browsing-context>browsing context</a>, and its <a href=#task-queue id=worker-event-loop:task-queue>task queues</a> only have
- events, callbacks, and networking activity as <a href=#concept-task id=worker-event-loop:concept-task>tasks</a>. These <a href=#event-loop id=worker-event-loop:event-loop-3>event loops</a> are created by the <a href=#run-a-worker id=worker-event-loop:run-a-worker>run a worker</a> algorithm.</p>
- <p>Each <code id=worker-event-loop:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object also has a <dfn id=dom-workerglobalscope-closing>closing</dfn> flag, which must initially be false, but which
- can get set to true by the algorithms in the processing model section below.</p>
- <p>Once the <code id=worker-event-loop:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code>'s <a href=#dom-workerglobalscope-closing id=worker-event-loop:dom-workerglobalscope-closing>closing</a> flag is set to true, the <a href=#event-loop id=worker-event-loop:event-loop-4>event
- loop</a>'s <a href=#task-queue id=worker-event-loop:task-queue-2>task queues</a> must discard any further <a href=#concept-task id=worker-event-loop:concept-task-2>tasks</a> that would be added to them (tasks already on the queue are
- unaffected except where otherwise specified). Effectively, once the <a href=#dom-workerglobalscope-closing id=worker-event-loop:dom-workerglobalscope-closing-2>closing</a> flag is true, timers stop firing,
- notifications for all pending asynchronous operations are dropped, etc.</p>
- <h4 id="the-worker's-lifetime">10.2.3 The worker's lifetime</h4>
- <p>Workers communicate with other workers and with <a href=#browsing-context id="the-worker's-lifetime:browsing-context">browsing
- contexts</a> through <a href=#channel-messaging id="the-worker's-lifetime:channel-messaging">message channels</a> and their
- <code id="the-worker's-lifetime:messageport"><a href=#messageport>MessagePort</a></code> objects.</p>
- <p>Each <code id="the-worker's-lifetime:workerglobalscope"><a href=#workerglobalscope>WorkerGlobalScope</a></code> <var>worker global scope</var> has a list of
- <dfn id="the-worker's-ports">the worker's ports</dfn>, which consists of all the <code id="the-worker's-lifetime:messageport-2"><a href=#messageport>MessagePort</a></code> objects that are
- entangled with another port and that have one (but only one) port owned by <var>worker
- global scope</var>. This list includes the implicit <code id="the-worker's-lifetime:messageport-3"><a href=#messageport>MessagePort</a></code> in the case of <a href=#dedicatedworkerglobalscope id="the-worker's-lifetime:dedicatedworkerglobalscope">dedicated workers</a>.</p>
- <p>Each <code id="the-worker's-lifetime:workerglobalscope-2"><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-workers">the worker's workers</dfn>.
- Initially this list is empty; it is populated when the worker creates or obtains further
- workers.</p>
- <p>Finally, each <code id="the-worker's-lifetime:workerglobalscope-3"><a href=#workerglobalscope>WorkerGlobalScope</a></code> also has a list of <dfn id="the-worker's-documents">the worker's
- <code>Document</code>s</dfn>. Initially this list is empty; it is populated when the worker is
- created.</p>
- <p>Whenever a <code id="the-worker's-lifetime:document"><a href=#document>Document</a></code> <var>d</var> is <dfn id="add-a-document-to-the-worker's-documents">added to the worker's <code>Document</code>s</dfn>, the user agent must, for
- each worker <var>q</var> in the list of <a href="#the-worker's-workers" id="the-worker's-lifetime:the-worker's-workers">the worker's workers</a> whose list of
- <a href="#the-worker's-documents" id="the-worker's-lifetime:the-worker's-documents">the worker's <code>Document</code>s</a> does not contain <var>d</var>, <a href="#add-a-document-to-the-worker's-documents" id="the-worker's-lifetime:add-a-document-to-the-worker's-documents">add <var>d</var> to <var>q</var>'s <code>WorkerGlobalScope</code> owner's list of <span>the worker's
- <code>Document</code>s</span></a>.</p>
- <p>Whenever a <code id="the-worker's-lifetime:document-2"><a href=#document>Document</a></code> object is <a href=#discard-a-document id="the-worker's-lifetime:discard-a-document">discarded</a>,
- it must be removed from the list of <a href="#the-worker's-documents" id="the-worker's-lifetime:the-worker's-documents-2">the worker's <code>Document</code>s</a> of each
- worker whose list contains that <code id="the-worker's-lifetime:document-3"><a href=#document>Document</a></code>.</p>
- <p>Given a <a href=#settings-object id="the-worker's-lifetime:settings-object">settings object</a> <var>o</var> when creating or obtaining a
- worker, the <dfn id=list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to add</dfn> depends on the type
- of <a href=#global-object id="the-worker's-lifetime:global-object">global object</a> specified by <var>o</var>'s. If <var>o</var>
- specifies a <a href=#global-object id="the-worker's-lifetime:global-object-2">global object</a> that is a <code id="the-worker's-lifetime:workerglobalscope-4"><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. if we
- are creating a nested worker), then the relevant <code id="the-worker's-lifetime:document-4"><a href=#document>Document</a></code>s are the <a href="#the-worker's-documents" id="the-worker's-lifetime:the-worker's-documents-3">the worker's
- <code>Document</code>s</a> of the <a href=#global-object id="the-worker's-lifetime:global-object-3">global object</a> specified by <var>o</var>. Otherwise, <var>o</var> specifies a <a href=#global-object id="the-worker's-lifetime:global-object-4">global object</a> that
- is a <code id="the-worker's-lifetime:window"><a href=#window>Window</a></code> object, and the relevant <code id="the-worker's-lifetime:document-5"><a href=#document>Document</a></code> is just the
- <a href=#responsible-document id="the-worker's-lifetime:responsible-document">responsible document</a> specified by <var>o</var>.</p>
- <hr>
- <p>A worker is said to be a <dfn id=permissible-worker>permissible worker</dfn> if its list of <a href="#the-worker's-documents" id="the-worker's-lifetime:the-worker's-documents-4">the worker's
- <code>Document</code>s</a> is not empty.</p>
- <p>A worker is said to be an <dfn id=active-needed-worker>active needed worker</dfn> if any of the <code id="the-worker's-lifetime:document-6"><a href=#document>Document</a></code>
- objects in <a href="#the-worker's-documents" id="the-worker's-lifetime:the-worker's-documents-5">the worker's <code>Document</code>s</a> are <a href=#fully-active id="the-worker's-lifetime:fully-active">fully active</a>.</p>
- <p>A worker is said to be a <dfn id=protected-worker>protected worker</dfn> if it is an <a href=#active-needed-worker id="the-worker's-lifetime:active-needed-worker">active needed
- worker</a> and either it has outstanding timers, database transactions, or network connections,
- or its list of <a href="#the-worker's-ports" id="the-worker's-lifetime:the-worker's-ports">the worker's ports</a> is not empty, or its <code id="the-worker's-lifetime:workerglobalscope-5"><a href=#workerglobalscope>WorkerGlobalScope</a></code>
- is actually a <code id="the-worker's-lifetime:sharedworkerglobalscope"><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object (i.e. the worker is a shared
- worker).</p>
- <p>A worker is said to be a <dfn id=suspendable-worker>suspendable worker</dfn> if it is not an <a href=#active-needed-worker id="the-worker's-lifetime:active-needed-worker-2">active needed
- worker</a> but it is a <a href=#permissible-worker id="the-worker's-lifetime:permissible-worker">permissible worker</a>.</p>
- <h4 id=processing-model-11>10.2.4 Processing model</h4>
- <p>When a user agent is to <dfn id=run-a-worker>run a worker</dfn> for a script with <a href=#url id=processing-model-11:url>URL</a>
- <var>url</var> and a <a href=#script-settings-object id=processing-model-11:script-settings-object>script settings object</a> <var>settings object</var>, it must run
- the following steps:</p>
- <ol><li id=worker-processing-model-top>
- <p>Create a separate parallel execution environment (i.e. a separate thread or process or
- equivalent construct), and run the rest of these steps asynchronously in that context.</p>
- <p>For the purposes of timing APIs, this is the <dfn id=official-moment-of-creation>official moment of creation</dfn> of the
- worker.</p>
- <li><p>Let <var>worker global scope</var> be the <a href=#global-object id=processing-model-11:global-object>global object</a> specified by
- <var>settings object</var>.<li><p>If <var>worker global scope</var> is actually a <code id=processing-model-11:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
- object (i.e. the worker is a shared worker), and there are any <a href=#relevant-application-cache id=processing-model-11:relevant-application-cache>relevant application caches</a> that are identified by a manifest URL with the
- <a href=#same-origin id=processing-model-11:same-origin>same origin</a> as <var>url</var> and that have <var>url</var> as one of their entries,
- <em>not</em> excluding entries marked as <a href=#concept-appcache-foreign id=processing-model-11:concept-appcache-foreign>foreign</a>,
- then associate the <var>worker global scope</var> with the <a href=#concept-appcache-selection id=processing-model-11:concept-appcache-selection>most appropriate application cache</a> of those that
- match.<li>
- <p>Attempt to <a href=#fetch id=processing-model-11:fetch>fetch</a> the resource identified by <var>url</var>, from the
- <a href=#origin-2 id=processing-model-11:origin-2>origin</a> specified by <var>settings object</var>, using the <a href=#responsible-document id=processing-model-11:responsible-document>responsible
- document</a> specified by <var>settings object</var> as the <a href=#referrer-source id=processing-model-11:referrer-source>referrer source</a> (not
- the specified <a href=#api-referrer-source id=processing-model-11:api-referrer-source>API referrer source</a>!), and with the <i>synchronous flag</i> set and
- the <i>force same-origin flag</i> set.</p>
- <p>If the attempt fails, then for each <code id=processing-model-11:worker><a href=#worker>Worker</a></code> or <code id=processing-model-11:sharedworker><a href=#sharedworker>SharedWorker</a></code> object
- associated with <var>worker global scope</var>, <a href=#queue-a-task id=processing-model-11:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=processing-model-11:fire-a-simple-event>fire a simple
- event</a> named <code id=processing-model-11:event-error><a href=#event-error>error</a></code> at that object. Abort these
- steps.</p>
- <p>If the attempt succeeds, then let <var>source</var> be the result of running the <a href=#utf-8-decode id=processing-model-11:utf-8-decode>UTF-8
- decode</a> algorithm on the script resource.</p>
- <p>Let <var>language</var> be JavaScript.</p>
- <p class=note>As with <code id=processing-model-11:the-script-element><a href=#the-script-element>script</a></code> elements, the MIME type of the script is ignored.
- Unlike with <code id=processing-model-11:the-script-element-2><a href=#the-script-element>script</a></code> elements, there is no way to override the type. It's always
- assumed to be JavaScript.</p>
- <li><p>In the newly created execution environment, create a <a href=#javascript-global-environment id=processing-model-11:javascript-global-environment>JavaScript global
- environment</a> whose <i>global object</i> is <var>worker global scope</var>. If <var>worker
- global scope</var> is a <code id=processing-model-11:dedicatedworkerglobalscope><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object, then this is a
- <a href=#dedicated-worker-environment id=processing-model-11:dedicated-worker-environment>dedicated worker environment</a>. Otherwise, <var>worker global scope</var> is a
- <code id=processing-model-11:sharedworkerglobalscope-2><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object, and this is a <a href=#shared-worker-environment id=processing-model-11:shared-worker-environment>shared worker
- environment</a>. (In either case, by definition, it is a <a href=#worker-environment id=processing-model-11:worker-environment>worker
- environment</a>.)<li>
- <p>Let <var>script</var> be a new <a href=#concept-script id=processing-model-11:concept-script>script</a>.</p>
- <p>Obtain the appropriate <a href=#script-execution-environment id=processing-model-11:script-execution-environment>script execution environment</a> for the scripting language
- <var>language</var> from <var>settings object</var>.</p>
- <p>Parse/compile/initialise <var>source</var> using that <a href=#script-execution-environment id=processing-model-11:script-execution-environment-2>script execution
- environment</a>, as appropriate for <var>language</var>, and thus obtain a <a href=#code-entry-point id=processing-model-11:code-entry-point>code
- entry-point</a>. If the script was not compiled successfully, let the <a href=#code-entry-point id=processing-model-11:code-entry-point-2>code
- entry-point</a> be a no-op script, and act as if a corresponding uncaught script error had
- occurred.</p>
- <p>Let <var>script</var>'s <a href=#settings-object id=processing-model-11:settings-object>settings object</a> be <var>settings object</var>.</p>
- <li>
- <p><strong>Closing orphan workers</strong>: Start monitoring the worker such that no sooner than
- it stops being a <a href=#protected-worker id=processing-model-11:protected-worker>protected worker</a>, and no later than it stops being a
- <a href=#permissible-worker id=processing-model-11:permissible-worker>permissible worker</a>, <var>worker global scope</var>'s <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing>closing</a> flag is set to true.</p>
- <li>
- <p><strong>Suspending workers</strong>: Start monitoring the worker, such that whenever
- <var>worker global scope</var>'s <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-2>closing</a>
- flag is false and the worker is a <a href=#suspendable-worker id=processing-model-11:suspendable-worker>suspendable worker</a>, the user agent suspends
- execution of script in that worker until such time as either the <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-3>closing</a> flag switches to true or the worker stops
- being a <a href=#suspendable-worker id=processing-model-11:suspendable-worker-2>suspendable worker</a>.</p>
- <li>
- <p><a href=#jump-to-a-code-entry-point id=processing-model-11:jump-to-a-code-entry-point>Jump</a> to the <a href=#concept-script id=processing-model-11:concept-script-2>script</a>'s <a href=#code-entry-point id=processing-model-11:code-entry-point-3>code entry-point</a>, and let that run until it
- either returns, fails to catch an exception, or gets prematurely aborted by the "<a href=#kill-a-worker id=processing-model-11:kill-a-worker>kill a
- worker</a>" or "<a href=#terminate-a-worker id=processing-model-11:terminate-a-worker>terminate a worker</a>" algorithms defined below.</p>
- <li><p>If <var>worker global scope</var> is actually a <code id=processing-model-11:dedicatedworkerglobalscope-2><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
- object (i.e. the worker is a dedicated worker), then enable the <a href=#port-message-queue id=processing-model-11:port-message-queue>port message queue</a>
- of the worker's implicit port.<li>
- <p><strong>Event loop</strong>: Run the <a href=#responsible-event-loop id=processing-model-11:responsible-event-loop>responsible
- event loop</a> specified by <var>settings object</var> until it is destroyed.</p>
- <p class=note>The handling of events or the execution of callbacks by <a href=#concept-task id=processing-model-11:concept-task>tasks</a> run by the <a href=#event-loop id=processing-model-11:event-loop>event loop</a> might get prematurely
- aborted by the "<a href=#kill-a-worker id=processing-model-11:kill-a-worker-2>kill a worker</a>" or "<a href=#terminate-a-worker id=processing-model-11:terminate-a-worker-2>terminate a worker</a>" algorithms
- defined below.</p>
- <p class=note>The worker processing model remains on this step until the event loop is
- destroyed, which happens after the <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-4>closing</a>
- flag is set to true, as described in the <a href=#event-loop id=processing-model-11:event-loop-2>event loop</a> processing model.</p>
- <li>
- <p>Empty the <var>worker global scope</var>'s <a href=#list-of-active-timers id=processing-model-11:list-of-active-timers>list of active timers</a>.</p>
- <li>
- <p>Disentangle all the ports in the list of <a href="#the-worker's-ports" id="processing-model-11:the-worker's-ports">the worker's ports</a>.</p>
- <li>
- <p>Empty the worker's list of
- <a href="#the-worker's-documents" id="processing-model-11:the-worker's-documents">the worker's <code>Document</code>s</a>.</p>
- </ol>
- <hr>
- <p>When a user agent is to <dfn id=kill-a-worker>kill a worker</dfn> it must run the following steps in parallel
- with the worker's main loop (the "<a href=#run-a-worker id=processing-model-11:run-a-worker>run a worker</a>" processing model defined above):</p>
- <ol><li><p>Set the worker's <code id=processing-model-11:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-5>closing</a> flag to true.<li><p>If there are any <a href=#concept-task id=processing-model-11:concept-task-2>tasks</a> queued in the
- <code id=processing-model-11:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop id=processing-model-11:event-loop-3>event loop</a>'s <a href=#task-queue id=processing-model-11:task-queue>task
- queues</a>, discard them without processing them.<li><p>Wait a user-agent-defined amount of time.<li><p>Abort the script currently running in the worker.</ol>
- <p>User agents may invoke the "<a href=#kill-a-worker id=processing-model-11:kill-a-worker-3>kill a worker</a>" processing model on a worker at any
- time, e.g. in response to user requests, in response to CPU quota management, or when a worker
- stops being an <a href=#active-needed-worker id=processing-model-11:active-needed-worker>active needed worker</a> if the worker continues executing even after its
- <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-6>closing</a> flag was set to true.</p>
- <hr>
- <p>When a user agent is to <dfn id=terminate-a-worker>terminate a worker</dfn> it must run the following steps in
- parallel with the worker's main loop (the "<a href=#run-a-worker id=processing-model-11:run-a-worker-2>run a worker</a>" processing model defined
- above):</p>
- <ol><li><p>Set the worker's <code id=processing-model-11:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#dom-workerglobalscope-closing id=processing-model-11:dom-workerglobalscope-closing-7>closing</a> flag to true.<li><p>If there are any <a href=#concept-task id=processing-model-11:concept-task-3>tasks</a> queued in the
- <code id=processing-model-11:workerglobalscope-4><a href=#workerglobalscope>WorkerGlobalScope</a></code> object's <a href=#event-loop id=processing-model-11:event-loop-4>event loop</a>'s <a href=#task-queue id=processing-model-11:task-queue-2>task
- queues</a>, discard them without processing them.<li><p>Abort the script currently running in the worker.<li><p>If the worker's <code id=processing-model-11:workerglobalscope-5><a href=#workerglobalscope>WorkerGlobalScope</a></code> object is actually a
- <code id=processing-model-11:dedicatedworkerglobalscope-3><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object (i.e. the worker is a dedicated worker), then
- empty the <a href=#port-message-queue id=processing-model-11:port-message-queue-2>port message queue</a> of the port that the worker's implicit port is
- entangled with.</ol>
- <hr>
- <p>The <a href=#task-source id=processing-model-11:task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source id=processing-model-11:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <h4 id=runtime-script-errors-2>10.2.5 Runtime script errors</h4>
- <p>Whenever an uncaught runtime script error occurs in one of the worker's scripts, if the error
- did not occur while handling a previous script error, the user agent must <a href=#report-the-error id=runtime-script-errors-2:report-the-error>report the
- error</a> for that <a href=#concept-script id=runtime-script-errors-2:concept-script>script</a>, with the position (line number
- and column number) where the error occurred, using the <code id=runtime-script-errors-2:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object as
- the target.</p>
- <p>For shared workers, if the error is still <i id=runtime-script-errors-2:concept-error-nothandled><a href=#concept-error-nothandled>not handled</a></i>
- afterwards, the error may be reported to the user.</p>
- <p>For dedicated workers, if the error is still <i id=runtime-script-errors-2:concept-error-nothandled-2><a href=#concept-error-nothandled>not
- handled</a></i> afterwards, the user agent must <a href=#queue-a-task id=runtime-script-errors-2:queue-a-task>queue a task</a> to <a href=#concept-event-fire id=runtime-script-errors-2:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=runtime-script-errors-2:concept-events-trusted>trusted</a>
- event that uses the <code id=runtime-script-errors-2:errorevent><a href=#errorevent>ErrorEvent</a></code> interface, with the name <code id=runtime-script-errors-2:event-error><a href=#event-error>error</a></code>, that doesn't bubble and is cancelable, with its <code id=runtime-script-errors-2:dom-errorevent-message><a href=#dom-errorevent-message>message</a></code>, <code id=runtime-script-errors-2:dom-errorevent-filename><a href=#dom-errorevent-filename>filename</a></code>, <code id=runtime-script-errors-2:dom-errorevent-lineno><a href=#dom-errorevent-lineno>lineno</a></code>, <code id=runtime-script-errors-2:dom-errorevent-colno><a href=#dom-errorevent-colno>colno</a></code>,
- attributes initialised appropriately, and with the <code id=runtime-script-errors-2:dom-errorevent-error><a href=#dom-errorevent-error>error</a></code> attribute initialised to null, at the
- <code id=runtime-script-errors-2:worker><a href=#worker>Worker</a></code> object associated with the worker. If the event is not canceled, the user
- agent must act as if the uncaught runtime script error had occurred in the global scope that the
- <code id=runtime-script-errors-2:worker-2><a href=#worker>Worker</a></code> object is in, thus repeating the entire runtime script error reporting process
- one level up.</p>
- <p>If the implicit port connecting the worker to its <code id=runtime-script-errors-2:worker-3><a href=#worker>Worker</a></code> object has been
- disentangled (i.e. if the parent worker has been terminated), then the user agent must act as if
- the <code id=runtime-script-errors-2:worker-4><a href=#worker>Worker</a></code> object had no <code id=runtime-script-errors-2:event-error-2><a href=#event-error>error</a></code> event handler and as
- if that worker's <code id=runtime-script-errors-2:handler-workerglobalscope-onerror><a href=#handler-workerglobalscope-onerror>onerror</a></code> attribute was
- null, but must otherwise act as described above.</p>
- <p class=note>Thus, error reports propagate up to the chain of dedicated workers up to the
- original <code id=runtime-script-errors-2:document><a href=#document>Document</a></code>, even if some of the workers along this chain have been terminated
- and garbage collected.</p>
- <p>The <a href=#task-source id=runtime-script-errors-2:task-source>task source</a> for the task mentioned above is the <a href=#dom-manipulation-task-source id=runtime-script-errors-2:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <h4 id=creating-workers>10.2.6 Creating workers</h4>
- <h5 id=the-abstractworker-abstract-interface>10.2.6.1 The <code id=the-abstractworker-abstract-interface:abstractworker><a href=#abstractworker>AbstractWorker</a></code> abstract interface</h5>
- <pre class=idl>[NoInterfaceObject, Exposed=(Window,Worker)]
- interface <dfn id=abstractworker>AbstractWorker</dfn> {
- attribute <a href=#eventhandler id=the-abstractworker-abstract-interface:eventhandler>EventHandler</a> <a href=#handler-abstractworker-onerror id=the-abstractworker-abstract-interface:handler-abstractworker-onerror>onerror</a>;
- };</pre>
- <p>The following are the <a href=#event-handlers id=the-abstractworker-abstract-interface:event-handlers>event handlers</a> (and their
- corresponding <a href=#event-handler-event-type id=the-abstractworker-abstract-interface:event-handler-event-type>event handler
- event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=the-abstractworker-abstract-interface:event-handler-idl-attributes>event handler IDL attributes</a>, by
- objects implementing the <code id=the-abstractworker-abstract-interface:abstractworker-2><a href=#abstractworker>AbstractWorker</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=the-abstractworker-abstract-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=the-abstractworker-abstract-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-abstractworker-onerror><code>onerror</code></dfn> <td> <code id=the-abstractworker-abstract-interface:event-error><a href=#event-error>error</a></code>
- </table>
- <h5 id=script-settings-for-workers>10.2.6.2 Script settings for workers</h5>
- <p>When the user agent is required to <dfn id=set-up-a-worker-script-settings-object>set up a worker script settings object</dfn>, given a
- <var>worker global scope</var> and a <a href=#url id=script-settings-for-workers:url>URL</a> <var>script
- address</var>, it must run the following steps:</p>
- <ol><li><p>Let <var>inherited responsible browsing context</var> be the <a href=#responsible-browsing-context id=script-settings-for-workers:responsible-browsing-context>responsible
- browsing context</a> specified by the <a href=#incumbent-settings-object id=script-settings-for-workers:incumbent-settings-object>incumbent settings object</a>.<li><p>Let <var>inherited responsible document</var> be the <a href=#responsible-document id=script-settings-for-workers:responsible-document>responsible
- document</a> specified by the <a href=#incumbent-settings-object id=script-settings-for-workers:incumbent-settings-object-2>incumbent settings object</a>.<li><p>Let <var>inherited origin</var> be the <a href=#origin-2 id=script-settings-for-workers:origin-2>origin</a> specified by the
- <a href=#incumbent-settings-object id=script-settings-for-workers:incumbent-settings-object-3>incumbent settings object</a>.<li><p>Let <var>worker event loop</var> be a newly created <a href=#event-loop id=script-settings-for-workers:event-loop>event
- loop</a>.<li>
- <p>Let <var>settings object</var> be a new <a href=#script-settings-object id=script-settings-for-workers:script-settings-object>script settings object</a> whose algorithms
- are defined as follows:</p>
- <dl><dt>The <a href=#script-execution-environment id=script-settings-for-workers:script-execution-environment>script execution environments</a><dd>
- <p>When the <a href=#script-settings-object id=script-settings-for-workers:script-settings-object-2>script settings object</a> is created, for each language supported by the
- user agent, create an appropriate execution environment as defined by the relevant
- specification.</p>
- <p>When a <a href=#script-execution-environment id=script-settings-for-workers:script-execution-environment-2>script execution environment</a> is needed, return the appropriate one from
- those created when the <a href=#script-settings-object id=script-settings-for-workers:script-settings-object-3>script settings object</a> was created.</p>
- <p class=note>Currently, workers only support JavaScript, so only a JavaScript execution
- environment is actually needed here.</p>
- <dt>The <a href=#global-object id=script-settings-for-workers:global-object>global object</a><dd>
- <p>Return <var>worker global scope</var>.</p>
- <dt>The <a href=#responsible-browsing-context id=script-settings-for-workers:responsible-browsing-context-2>responsible browsing context</a><dd>
- <p>Return <var>inherited responsible browsing context</var>.</p>
- <dt>The <a href=#responsible-document id=script-settings-for-workers:responsible-document-2>responsible document</a><dd>
- <p>Return <var>inherited responsible document</var>.</p>
- <dt>The <a href=#responsible-event-loop id=script-settings-for-workers:responsible-event-loop>responsible event loop</a><dd>
- <p>Return <var>worker event loop</var>.</p>
- <dt>The <a href=#api-referrer-source id=script-settings-for-workers:api-referrer-source>API referrer source</a><dd>
- <p>Return <var>script address</var>.</p>
- <dt>The <a href=#api-url-character-encoding id=script-settings-for-workers:api-url-character-encoding>API URL character encoding</a><dd>
- <p>Return UTF-8.</p>
- <dt>The <a href=#api-base-url id=script-settings-for-workers:api-base-url>API base URL</a><dd>
- <p>Return <var>worker URL</var>.</p>
- <dt>The <a href=#origin-2 id=script-settings-for-workers:origin-2-2>origin</a> and <a href=#effective-script-origin id=script-settings-for-workers:effective-script-origin>effective script origin</a><dd>
- <p>Return <var>inherited origin</var>.</p>
- </dl>
- <li><p>Return <var>settings object</var>.</ol>
- <h5 id=dedicated-workers-and-the-worker-interface>10.2.6.3 Dedicated workers and the <code id=dedicated-workers-and-the-worker-interface:worker><a href=#worker>Worker</a></code> interface</h5>
- <pre class=idl>[<a href=#dom-worker id=dedicated-workers-and-the-worker-interface:dom-worker>Constructor</a>(DOMString scriptURL), Exposed=(Window,Worker)]
- interface <dfn id=worker>Worker</dfn> : <a href=#eventtarget id=dedicated-workers-and-the-worker-interface:eventtarget>EventTarget</a> {
- void <a href=#dom-worker-terminate id=dedicated-workers-and-the-worker-interface:dom-worker-terminate>terminate</a>();
- void <a href=#dom-worker-postmessage id=dedicated-workers-and-the-worker-interface:dom-worker-postmessage>postMessage</a>(any message, optional sequence<<a href=#transferable id=dedicated-workers-and-the-worker-interface:transferable>Transferable</a>> transfer);
- attribute <a href=#eventhandler id=dedicated-workers-and-the-worker-interface:eventhandler>EventHandler</a> <a href=#handler-worker-onmessage id=dedicated-workers-and-the-worker-interface:handler-worker-onmessage>onmessage</a>;
- };
- <a href=#worker id=dedicated-workers-and-the-worker-interface:worker-2>Worker</a> implements <a href=#abstractworker id=dedicated-workers-and-the-worker-interface:abstractworker>AbstractWorker</a>;</pre>
- <p>The <dfn id=dom-worker-terminate><code>terminate()</code></dfn> method, when invoked, must
- cause the "<a href=#terminate-a-worker id=dedicated-workers-and-the-worker-interface:terminate-a-worker>terminate a worker</a>" algorithm to be run on the worker with which the object
- is associated.</p>
- <p><code id=dedicated-workers-and-the-worker-interface:worker-3><a href=#worker>Worker</a></code> objects act as if they had an implicit <code id=dedicated-workers-and-the-worker-interface:messageport><a href=#messageport>MessagePort</a></code> associated
- with them. This port is part of a channel that is set up when the worker is created, but it is not
- exposed. This object must never be garbage collected before the <code id=dedicated-workers-and-the-worker-interface:worker-4><a href=#worker>Worker</a></code> object.</p>
- <p>All messages received by that port must immediately be retargeted at the <code id=dedicated-workers-and-the-worker-interface:worker-5><a href=#worker>Worker</a></code>
- object.</p>
- <p>The <dfn id=dom-worker-postmessage><code>postMessage()</code></dfn> method on
- <code id=dedicated-workers-and-the-worker-interface:worker-6><a href=#worker>Worker</a></code> objects must act as if, when invoked, it immediately invoked <a href=#dom-messageport-postmessage id=dedicated-workers-and-the-worker-interface:dom-messageport-postmessage>the method of the same name</a> on the port, with the same
- arguments, and returned the same return value.</p>
- <div class=example>
- <p>The <code id=dedicated-workers-and-the-worker-interface:dom-worker-postmessage-2><a href=#dom-worker-postmessage>postMessage()</a></code>
- method's first argument can be structured data:</p>
- <pre>worker.postMessage({opcode: 'activate', device: 1938, parameters: [23, 102]});</pre>
- </div>
- <p>The following are the <a href=#event-handlers id=dedicated-workers-and-the-worker-interface:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=dedicated-workers-and-the-worker-interface:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-idl-attributes id=dedicated-workers-and-the-worker-interface:event-handler-idl-attributes>event handler IDL attributes</a>,
- by objects implementing the <code id=dedicated-workers-and-the-worker-interface:worker-7><a href=#worker>Worker</a></code> interface:</p>
- <table><thead><tr><th><a href=#event-handlers id=dedicated-workers-and-the-worker-interface:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=dedicated-workers-and-the-worker-interface:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-worker-onmessage><code>onmessage</code></dfn> <td> <code id=dedicated-workers-and-the-worker-interface:event-message><a href=#event-message>message</a></code>
- </table>
- <hr>
- <p>When the <dfn id=dom-worker><code>Worker(<var>scriptURL</var>)</code></dfn> constructor
- is invoked, the user agent must run the following steps:</p>
- <ol><li><p>The user agent may throw a <code id=dedicated-workers-and-the-worker-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps if
- the request violates a policy decision (e.g. if the user agent is configured to not allow the
- page to start dedicated workers).<li><p><a href=#resolve-a-url id=dedicated-workers-and-the-worker-interface:resolve-a-url>Resolve</a> the <var>scriptURL</var> argument relative to
- the <a href=#api-base-url id=dedicated-workers-and-the-worker-interface:api-base-url>API base URL</a> specified by the <a href=#entry-settings-object id=dedicated-workers-and-the-worker-interface:entry-settings-object>entry settings object</a> when the method
- was invoked.<li><p>If this fails, throw a <code id=dedicated-workers-and-the-worker-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.<li><p>Let <var>worker URL</var> be the resulting <a href=#absolute-url id=dedicated-workers-and-the-worker-interface:absolute-url>absolute URL</a>.<li>
- <p>If the <a href=#concept-url-scheme id=dedicated-workers-and-the-worker-interface:concept-url-scheme>scheme</a> component of <var>worker URL</var> is
- not "<code id=dedicated-workers-and-the-worker-interface:data-protocol><a data-x-internal=data-protocol href=http://tools.ietf.org/html/rfc2397#section-2>data</a></code>", and the <a href=#origin-2 id=dedicated-workers-and-the-worker-interface:origin-2>origin</a> of <var>worker
- URL</var> is not the <a href=#same-origin id=dedicated-workers-and-the-worker-interface:same-origin>same</a> as the <a href=#origin-2 id=dedicated-workers-and-the-worker-interface:origin-2-2>origin</a> specified
- by the <a href=#incumbent-settings-object id=dedicated-workers-and-the-worker-interface:incumbent-settings-object>incumbent settings object</a>, then throw a <code id=dedicated-workers-and-the-worker-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception
- and abort these steps.</p>
- <p class=note>For example, scripts can be external files with the same scheme, host, and port
- as the original page, or <a href=http://tools.ietf.org/html/rfc2397#section-2 id=dedicated-workers-and-the-worker-interface:data-protocol-2 data-x-internal=data-protocol><code>data:</code> URLs</a>, or
- same-origin <code id=dedicated-workers-and-the-worker-interface:blob-protocol><a data-x-internal=blob-protocol href=http://dev.w3.org/2006/webapi/FileAPI/#DefinitionOfScheme>blob:</a></code> URLs. Thus, an <code id=dedicated-workers-and-the-worker-interface:https-protocol><a data-x-internal=https-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.2>https:</a></code> page couldn't start workers using scripts with <code id=dedicated-workers-and-the-worker-interface:http-protocol><a data-x-internal=http-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.1>http:</a></code> URLs. <a href=#refsFILEAPI>[FILEAPI]</a>.</p>
- <li><p>Create a new <code id=dedicated-workers-and-the-worker-interface:dedicatedworkerglobalscope><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code> object. Let <var>worker global
- scope</var> be this new object.<li><p><a href=#set-up-a-worker-script-settings-object id=dedicated-workers-and-the-worker-interface:set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var>worker global scope</var>
- and <var>worker URL</var>, and let <var>settings object</var> be the result.<li><p>Create a new <code id=dedicated-workers-and-the-worker-interface:worker-8><a href=#worker>Worker</a></code> object, associated with <var>worker global scope</var>.
- Let <var>worker</var> be this new object.<li><p><a href=#create-a-new-messageport-object id=dedicated-workers-and-the-worker-interface:create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=dedicated-workers-and-the-worker-interface:concept-port-owner>owner</a> is the <a href=#incumbent-settings-object id=dedicated-workers-and-the-worker-interface:incumbent-settings-object-2>incumbent settings object</a>. Let this
- be the <var>outside port</var>.<li><p>Associate the <var>outside port</var> with <var>worker</var>.<li><p><a href=#create-a-new-messageport-object id=dedicated-workers-and-the-worker-interface:create-a-new-messageport-object-2>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=dedicated-workers-and-the-worker-interface:concept-port-owner-2>owner</a> is <var>settings object</var>. Let <var>inside
- port</var> be this new object.<li><p>Associate <var>inside port</var> with <var>worker global scope</var>.<li><p><a href=#entangle id=dedicated-workers-and-the-worker-interface:entangle>Entangle</a> <var>outside port</var> and <var>inside port</var>.<li><p>Return <var>worker</var>, and run the following steps asynchronously.<li><p>Enable <var>outside port</var>'s <a href=#port-message-queue id=dedicated-workers-and-the-worker-interface:port-message-queue>port message queue</a>.<li><p>Let <var>docs</var> be the <a href=#list-of-relevant-document-objects-to-add id=dedicated-workers-and-the-worker-interface:list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
- add</a> given the <a href=#incumbent-settings-object id=dedicated-workers-and-the-worker-interface:incumbent-settings-object-3>incumbent settings object</a>.<li><p><a href="#add-a-document-to-the-worker's-documents" id="dedicated-workers-and-the-worker-interface:add-a-document-to-the-worker's-documents">Add to <var>worker global
- scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
- <code id=dedicated-workers-and-the-worker-interface:document><a href=#document>Document</a></code> objects in <var>docs</var>.<li><p>If the <a href=#global-object id=dedicated-workers-and-the-worker-interface:global-object>global object</a> specified by the <a href=#incumbent-settings-object id=dedicated-workers-and-the-worker-interface:incumbent-settings-object-4>incumbent settings object</a>
- is a <code id=dedicated-workers-and-the-worker-interface:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object (i.e. we are creating a nested worker), add
- <var>worker global scope</var> to the list of <a href="#the-worker's-workers" id="dedicated-workers-and-the-worker-interface:the-worker's-workers">the worker's workers</a> of the
- <code id=dedicated-workers-and-the-worker-interface:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is the <a href=#global-object id=dedicated-workers-and-the-worker-interface:global-object-2>global object</a> specified by the
- <a href=#incumbent-settings-object id=dedicated-workers-and-the-worker-interface:incumbent-settings-object-5>incumbent settings object</a>.<li><p><a href=#run-a-worker id=dedicated-workers-and-the-worker-interface:run-a-worker>Run a worker</a> for the script with <a href=#url id=dedicated-workers-and-the-worker-interface:url>URL</a> <var>worker URL</var> and
- the <a href=#script-settings-object id=dedicated-workers-and-the-worker-interface:script-settings-object>script settings object</a> <var>settings object</var>.</ol>
- <h5 id=shared-workers-and-the-sharedworker-interface>10.2.6.4 Shared workers and the <code id=shared-workers-and-the-sharedworker-interface:sharedworker><a href=#sharedworker>SharedWorker</a></code> interface</h5>
- <pre class=idl>[<a href=#dom-sharedworker id=shared-workers-and-the-sharedworker-interface:dom-sharedworker>Constructor</a>(DOMString scriptURL, optional DOMString name), Exposed=(Window,Worker)]
- interface <dfn id=sharedworker>SharedWorker</dfn> : <a href=#eventtarget id=shared-workers-and-the-sharedworker-interface:eventtarget>EventTarget</a> {
- readonly attribute <a href=#messageport id=shared-workers-and-the-sharedworker-interface:messageport>MessagePort</a> <a href=#dom-sharedworker-port id=shared-workers-and-the-sharedworker-interface:dom-sharedworker-port>port</a>;
- };
- <a href=#sharedworker id=shared-workers-and-the-sharedworker-interface:sharedworker-2>SharedWorker</a> implements <a href=#abstractworker id=shared-workers-and-the-sharedworker-interface:abstractworker>AbstractWorker</a>;</pre>
- <p>The <dfn id=dom-sharedworker-port><code>port</code></dfn> attribute must return the value
- it was assigned by the object's constructor. It represents the <code id=shared-workers-and-the-sharedworker-interface:messageport-2><a href=#messageport>MessagePort</a></code> for
- communicating with the shared worker.</p>
- <p>When the <dfn id=dom-sharedworker><code>SharedWorker(<var>scriptURL</var>, <var>name</var>)</code></dfn> constructor is invoked, the user agent must run the following
- steps:</p>
- <ol><li><p>The user agent may throw a <code id=shared-workers-and-the-sharedworker-interface:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps if
- the request violates a policy decision (e.g. if the user agent is configured to not allow the
- page to start shared workers).<li><p><a href=#resolve-a-url id=shared-workers-and-the-sharedworker-interface:resolve-a-url>Resolve</a> the <var>scriptURL</var>
- argument.<li><p>If this fails, throw a <code id=shared-workers-and-the-sharedworker-interface:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.<li><p>Let <var>scriptURL</var> be the resulting <a href=#absolute-url id=shared-workers-and-the-sharedworker-interface:absolute-url>absolute URL</a> and <var>parsed scriptURL</var> be the resulting <a href=#parsed-url id=shared-workers-and-the-sharedworker-interface:parsed-url>parsed URL</a>.<li><p>Let <var>name</var> be the value of the second argument, or the empty string if
- the second argument was omitted.<li>
- <p>If the <a href=#concept-url-scheme id=shared-workers-and-the-sharedworker-interface:concept-url-scheme>scheme</a> component of <var>parsed
- scriptURL</var> is not "<code id=shared-workers-and-the-sharedworker-interface:data-protocol><a data-x-internal=data-protocol href=http://tools.ietf.org/html/rfc2397#section-2>data</a></code>", and the <a href=#origin-2 id=shared-workers-and-the-sharedworker-interface:origin-2>origin</a>
- of <var>scriptURL</var> is not the <a href=#same-origin id=shared-workers-and-the-sharedworker-interface:same-origin>same</a> as the
- <a href=#origin-2 id=shared-workers-and-the-sharedworker-interface:origin-2-2>origin</a> specified by the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object>incumbent settings object</a>, then throw a
- <code id=shared-workers-and-the-sharedworker-interface:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.</p>
- <p class=note>Thus, scripts must either be external files with the same scheme, host, and port
- as the original page, or <a href=http://tools.ietf.org/html/rfc2397#section-2 id=shared-workers-and-the-sharedworker-interface:data-protocol-2 data-x-internal=data-protocol><code>data:</code> URLs</a>. For
- example, an <code id=shared-workers-and-the-sharedworker-interface:https-protocol><a data-x-internal=https-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.2>https:</a></code> page couldn't start workers using
- scripts with <code id=shared-workers-and-the-sharedworker-interface:http-protocol><a data-x-internal=http-protocol href=http://tools.ietf.org/html/rfc7230#section-2.7.1>http:</a></code> URLs.</p>
- <li>
- <p>Let <var>docs</var> be the <a href=#list-of-relevant-document-objects-to-add id=shared-workers-and-the-sharedworker-interface:list-of-relevant-document-objects-to-add>list of relevant <code>Document</code> objects to
- add</a> given the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-2>incumbent settings object</a>.</p>
- <li>
- <p>Execute the following substeps atomically:</p>
- <ol><li><p>Create a new <code id=shared-workers-and-the-sharedworker-interface:sharedworker-3><a href=#sharedworker>SharedWorker</a></code> object, which will shortly be associated with a
- <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. Let this <code id=shared-workers-and-the-sharedworker-interface:sharedworker-4><a href=#sharedworker>SharedWorker</a></code> object be <var>worker</var>.<li><p><a href=#create-a-new-messageport-object id=shared-workers-and-the-sharedworker-interface:create-a-new-messageport-object>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=shared-workers-and-the-sharedworker-interface:concept-port-owner>owner</a> is the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-3>incumbent settings object</a>. Let
- this be the <var>outside port</var>.<li><p>Assign <var>outside port</var> to the <code id=shared-workers-and-the-sharedworker-interface:dom-sharedworker-port-2><a href=#dom-sharedworker-port>port</a></code> attribute of <var>worker</var>.<li><p>Let <var>worker global scope</var> be null.<li>
- <p>If <var>name</var> is not the empty string and there exists a
- <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-2><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#dom-workerglobalscope-closing id=shared-workers-and-the-sharedworker-interface:dom-workerglobalscope-closing>closing</a> flag is false, whose <code id=shared-workers-and-the-sharedworker-interface:dom-sharedworkerglobalscope-name><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute is exactly equal to
- <var>name</var>, and that is the <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object>global object</a> specified by a <a href=#script-settings-object id=shared-workers-and-the-sharedworker-interface:script-settings-object>script
- settings object</a> that specifies as its <a href=#origin-2 id=shared-workers-and-the-sharedworker-interface:origin-2-3>origin</a> the <a href=#same-origin id=shared-workers-and-the-sharedworker-interface:same-origin-2>same origin</a>
- as the <a href=#origin-2 id=shared-workers-and-the-sharedworker-interface:origin-2-4>origin</a> of <var>scriptURL</var>, then let <var>worker global scope</var> be
- that <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-3><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>
- <p>Otherwise, if <var>name</var> is the empty string and there exists a
- <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-4><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object whose <a href=#dom-workerglobalscope-closing id=shared-workers-and-the-sharedworker-interface:dom-workerglobalscope-closing-2>closing</a> flag is false, whose <code id=shared-workers-and-the-sharedworker-interface:dom-sharedworkerglobalscope-name-2><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute is the empty string, and whose
- <code id=shared-workers-and-the-sharedworker-interface:dom-workerglobalscope-location><a href=#dom-workerglobalscope-location>location</a></code> attribute represents an
- <a href=#absolute-url id=shared-workers-and-the-sharedworker-interface:absolute-url-2>absolute URL</a> that is exactly equal to <var>scriptURL</var>, then let <var>worker
- global scope</var> be that <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-5><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object.</p>
- <li>
- <p>If <var>worker global scope</var> is not null, but the user agent has been
- configured to disallow communication between the worker represented by the <var>worker global scope</var> and the <a href=#concept-script id=shared-workers-and-the-sharedworker-interface:concept-script>scripts</a> whose
- <a href=#settings-object id=shared-workers-and-the-sharedworker-interface:settings-object>settings objects</a> are the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-4>incumbent settings
- object</a>, then set <var>worker global scope</var> to null.</p>
- <p class=note>For example, a user agent could have a development mode that isolates a
- particular <a href=#top-level-browsing-context id=shared-workers-and-the-sharedworker-interface:top-level-browsing-context>top-level browsing context</a> from all other pages, and scripts in that
- development mode could be blocked from connecting to shared workers running in the normal
- browser mode.</p>
- <li>
- <p>If <var>worker global scope</var> is not null, then run these steps:</p>
- <ol><li><p>If <var>worker global scope</var>'s <code id=shared-workers-and-the-sharedworker-interface:dom-workerglobalscope-location-2><a href=#dom-workerglobalscope-location>location</a></code> attribute represents an <a href=#absolute-url id=shared-workers-and-the-sharedworker-interface:absolute-url-3>absolute
- URL</a> that is not exactly equal to <var>scriptURL</var>, then throw a
- <code id=shared-workers-and-the-sharedworker-interface:urlmismatcherror><a href=#urlmismatcherror>URLMismatchError</a></code> exception and abort all these steps.<li><p>Associate <var>worker</var> with <var>worker global
- scope</var>.<li><p>Let <var>settings object</var> be the <a href=#script-settings-object id=shared-workers-and-the-sharedworker-interface:script-settings-object-2>script settings object</a>
- whose <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object-2>global object</a> is <var>worker global scope</var>.<li><p><a href=#create-a-new-messageport-object id=shared-workers-and-the-sharedworker-interface:create-a-new-messageport-object-2>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=shared-workers-and-the-sharedworker-interface:concept-port-owner-2>owner</a> is <var>settings object</var>. Let this be
- the <var>inside port</var>.<li><p><a href=#entangle id=shared-workers-and-the-sharedworker-interface:entangle>Entangle</a> <var>outside port</var>
- and <var>inside port</var>.<li><p>Create a <a href=#concept-events-trusted id=shared-workers-and-the-sharedworker-interface:concept-events-trusted>trusted</a> event that uses the
- <code id=shared-workers-and-the-sharedworker-interface:messageevent><a href=#messageevent>MessageEvent</a></code> interface, with the name <code id=shared-workers-and-the-sharedworker-interface:event-workerglobalscope-connect><a href=#event-workerglobalscope-connect>connect</a></code>, which does not bubble, is not
- cancelable, has no default action, has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-data><a href=#dom-messageevent-data>data</a></code>
- attribute whose value is initialised to the empty string, has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-ports><a href=#dom-messageevent-ports>ports</a></code> attribute whose value is initialised to a <a href=#dfn-read-only-array id=shared-workers-and-the-sharedworker-interface:dfn-read-only-array>read only</a> array containing only the newly created port,
- and has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-source><a href=#dom-messageevent-source>source</a></code> attribute whose value is
- initialised to the newly created port, and <a href=#queue-a-task id=shared-workers-and-the-sharedworker-interface:queue-a-task>queue a task</a> to <a href=#concept-event-dispatch id=shared-workers-and-the-sharedworker-interface:concept-event-dispatch>dispatch</a> the event at <var>worker global
- scope</var>.<li>
- <p><a href="#add-a-document-to-the-worker's-documents" id="shared-workers-and-the-sharedworker-interface:add-a-document-to-the-worker's-documents">Add to <var>worker global
- scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
- <code id=shared-workers-and-the-sharedworker-interface:document><a href=#document>Document</a></code> objects in <var>docs</var>.</p>
- <li>
- <p>If the <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object-3>global object</a> specified by the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-5>incumbent settings object</a>
- is a <code id=shared-workers-and-the-sharedworker-interface:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var>worker global scope</var> to
- the list of <a href="#the-worker's-workers" id="shared-workers-and-the-sharedworker-interface:the-worker's-workers">the worker's workers</a> of the <code id=shared-workers-and-the-sharedworker-interface:workerglobalscope-2><a href=#workerglobalscope>WorkerGlobalScope</a></code> object
- that is the <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object-4>global object</a> specified by the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-6>incumbent settings
- object</a>.</p>
- <li><p>Return <var>worker</var> and abort all these steps.</ol>
- <li><p>Create a new <code id=shared-workers-and-the-sharedworker-interface:sharedworkerglobalscope-6><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code> object. Let <var>worker
- global scope</var> be this new object.<li><p><a href=#set-up-a-worker-script-settings-object id=shared-workers-and-the-sharedworker-interface:set-up-a-worker-script-settings-object>Set up a worker script settings object</a> with <var>worker global
- scope</var> and <var>scriptURL</var>, and let <var>settings object</var> be
- the result.<li><p>Associate <var>worker</var> with <var>worker global scope</var>.<li><p>Set the <code id=shared-workers-and-the-sharedworker-interface:dom-sharedworkerglobalscope-name-3><a href=#dom-sharedworkerglobalscope-name>name</a></code> attribute of
- <var>worker global scope</var> to <var>name</var>.<li><p><a href=#create-a-new-messageport-object id=shared-workers-and-the-sharedworker-interface:create-a-new-messageport-object-3>Create a new <code>MessagePort</code> object</a> whose <a href=#concept-port-owner id=shared-workers-and-the-sharedworker-interface:concept-port-owner-3>owner</a> is <var>settings object</var>. Let <var>inside
- port</var> be this new object.<li><p><a href=#entangle id=shared-workers-and-the-sharedworker-interface:entangle-2>Entangle</a> <var>outside port</var> and <var>inside port</var>.</ol>
- <li><p>Return <var>worker</var> and perform the remaining steps asynchronously.<li><p>Create a <a href=#concept-events-trusted id=shared-workers-and-the-sharedworker-interface:concept-events-trusted-2>trusted</a> event that uses the
- <code id=shared-workers-and-the-sharedworker-interface:messageevent-2><a href=#messageevent>MessageEvent</a></code> interface, with the name <code id=shared-workers-and-the-sharedworker-interface:event-workerglobalscope-connect-2><a href=#event-workerglobalscope-connect>connect</a></code>, which does not bubble, is not
- cancelable, has no default action, has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-data-2><a href=#dom-messageevent-data>data</a></code>
- attribute whose value is initialised to the empty string, has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-ports-2><a href=#dom-messageevent-ports>ports</a></code> attribute whose value is initialised to a <a href=#dfn-read-only-array id=shared-workers-and-the-sharedworker-interface:dfn-read-only-array-2>read only</a> array containing only the newly created port, and
- has a <code id=shared-workers-and-the-sharedworker-interface:dom-messageevent-source-2><a href=#dom-messageevent-source>source</a></code> attribute whose value is initialized
- to the newly created port, and <a href=#queue-a-task id=shared-workers-and-the-sharedworker-interface:queue-a-task-2>queue a task</a> to <a href=#concept-event-dispatch id=shared-workers-and-the-sharedworker-interface:concept-event-dispatch-2>dispatch</a> the event at <var>worker global
- scope</var>.<li>
- <p><a href="#add-a-document-to-the-worker's-documents" id="shared-workers-and-the-sharedworker-interface:add-a-document-to-the-worker's-documents-2">Add to <var>worker global
- scope</var>'s list of <span>the worker's <code>Document</code>s</span></a> the
- <code id=shared-workers-and-the-sharedworker-interface:document-2><a href=#document>Document</a></code> objects in <var>docs</var>.</p>
- <li>
- <p>If the <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object-5>global object</a> specified by the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-7>incumbent settings object</a> is
- a <code id=shared-workers-and-the-sharedworker-interface:workerglobalscope-3><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, add <var>worker global scope</var> to the
- list of <a href="#the-worker's-workers" id="shared-workers-and-the-sharedworker-interface:the-worker's-workers-2">the worker's workers</a> of the <code id=shared-workers-and-the-sharedworker-interface:workerglobalscope-4><a href=#workerglobalscope>WorkerGlobalScope</a></code> object that is
- the <a href=#global-object id=shared-workers-and-the-sharedworker-interface:global-object-6>global object</a> specified by the <a href=#incumbent-settings-object id=shared-workers-and-the-sharedworker-interface:incumbent-settings-object-8>incumbent settings object</a>.</p>
- <li>
- <p><a href=#run-a-worker id=shared-workers-and-the-sharedworker-interface:run-a-worker>Run a worker</a> for the script with <a href=#url id=shared-workers-and-the-sharedworker-interface:url>URL</a> <var>scriptURL</var>
- and the <a href=#script-settings-object id=shared-workers-and-the-sharedworker-interface:script-settings-object-3>script settings object</a> <var>settings object</var>.</p>
- </ol>
- <p>The <a href=#task-source id=shared-workers-and-the-sharedworker-interface:task-source>task source</a> for the tasks mentioned above is the <a href=#dom-manipulation-task-source id=shared-workers-and-the-sharedworker-interface:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <h3 id=apis-available-to-workers>10.3 APIs available to workers</h3>
- <pre class=idl>[Exposed=Worker]
- partial interface <a href=#workerglobalscope id=WorkerGlobalScope-partial>WorkerGlobalScope</a> { // not obsolete
- void <a href=#dom-workerglobalscope-importscripts id=apis-available-to-workers:dom-workerglobalscope-importscripts>importScripts</a>(DOMString... urls);
- readonly attribute <a href=#workernavigator id=apis-available-to-workers:workernavigator>WorkerNavigator</a> <a href=#dom-worker-navigator id=apis-available-to-workers:dom-worker-navigator>navigator</a>;
- };
- <a href=#workerglobalscope id=apis-available-to-workers:workerglobalscope>WorkerGlobalScope</a> implements <a href=#windowtimers id=apis-available-to-workers:windowtimers>WindowTimers</a>;
- <a href=#workerglobalscope id=apis-available-to-workers:workerglobalscope-2>WorkerGlobalScope</a> implements <a href=#windowbase64 id=apis-available-to-workers:windowbase64>WindowBase64</a>;</pre>
- <h4 id=importing-scripts-and-libraries>10.3.1 Importing scripts and libraries</h4>
- <p>When a script invokes the <dfn id=dom-workerglobalscope-importscripts><code>importScripts(<var>urls</var>)</code></dfn> method on a <code id=importing-scripts-and-libraries:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> object, the user
- agent must run the following steps:</p>
- <ol><li><p>If there are no arguments, return without doing anything. Abort these steps.<li><p>Let <var>settings object</var> be the <a href=#incumbent-settings-object id=importing-scripts-and-libraries:incumbent-settings-object>incumbent settings
- object</a>.<li><p><a href=#resolve-a-url id=importing-scripts-and-libraries:resolve-a-url>Resolve</a> each argument.<li><p>If any fail, throw a <code id=importing-scripts-and-libraries:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.<li>
- <p>Attempt to <a href=#fetch id=importing-scripts-and-libraries:fetch>fetch</a> each resource identified by the resulting <a href=#absolute-url id=importing-scripts-and-libraries:absolute-url>absolute URLs</a>, from the <a href=#origin-2 id=importing-scripts-and-libraries:origin-2>origin</a> specified by <var>settings object</var>, using the <a href=#api-referrer-source id=importing-scripts-and-libraries:api-referrer-source>API referrer source</a> specified by <var>settings object</var>, and with the <i>synchronous flag</i> set.</p>
- <li>
- <p>For each argument in turn, in the order given, starting with the first one, run these
- substeps:</p>
- <ol><li>
- <p>Wait for the fetching attempt for the corresponding resource to complete.</p>
- <p>If the fetching attempt failed, throw a <code id=importing-scripts-and-libraries:networkerror><a href=#networkerror>NetworkError</a></code> exception and abort all
- these steps.</p>
- <p>If the attempt succeeds, then let <var>source</var> be the result of running the
- <a href=#utf-8-decode id=importing-scripts-and-libraries:utf-8-decode>UTF-8 decode</a> algorithm on the script resource.</p>
- <p>Let <var>language</var> be JavaScript.</p>
- <p class=note>As with the worker's script, the script here is always assumed to be
- JavaScript, regardless of the MIME type.</p>
- <li>
- <p><a href=#create-a-script id=importing-scripts-and-libraries:create-a-script>Create a script</a> using <var>source</var> as the script source, the
- <a href=#url id=importing-scripts-and-libraries:url>URL</a> from which <var>source</var> was obtained, <var>language</var> as the scripting language, and <var>settings object</var> as
- the <a href=#script-settings-object id=importing-scripts-and-libraries:script-settings-object>script settings object</a>.</p>
- <p>If the script came from a resource whose <a href=#url id=importing-scripts-and-libraries:url-2>URL</a> does not have the <a href=#same-origin id=importing-scripts-and-libraries:same-origin>same
- origin</a> as the <a href=#origin-2 id=importing-scripts-and-libraries:origin-2-2>origin</a> specified by the <a href=#incumbent-settings-object id=importing-scripts-and-libraries:incumbent-settings-object-2>incumbent settings
- object</a>, then pass the <var>muted errors</var> flag to the <a href=#create-a-script id=importing-scripts-and-libraries:create-a-script-2>create a
- script</a> algorithm as well.</p>
- <p>Let the newly created <a href=#concept-script id=importing-scripts-and-libraries:concept-script>script</a> run until it either
- returns, fails to parse, fails to catch an exception, or gets prematurely aborted by the
- "<a href=#kill-a-worker id=importing-scripts-and-libraries:kill-a-worker>kill a worker</a>" or "<a href=#terminate-a-worker id=importing-scripts-and-libraries:terminate-a-worker>terminate a worker</a>" algorithms defined
- above.</p>
- <p>If it failed to parse, then throw an ECMAScript <code id=importing-scripts-and-libraries:js-syntaxerror><a href=#js-syntaxerror>SyntaxError</a></code> exception and abort all these steps. <a href=#refsECMA262>[ECMA262]</a></p>
- <p>If an exception was thrown or if the script was prematurely aborted, then abort all these
- steps, letting the exception or aborting continue to be processed by the calling <a href=#concept-script id=importing-scripts-and-libraries:concept-script-2>script</a>.</p>
- <p>If the "<a href=#kill-a-worker id=importing-scripts-and-libraries:kill-a-worker-2>kill a worker</a>" or "<a href=#terminate-a-worker id=importing-scripts-and-libraries:terminate-a-worker-2>terminate a worker</a>" algorithms abort
- the script then abort all these steps.</p>
- </ol>
- </ol>
- <h4 id=the-workernavigator-object>10.3.2 The <code id=the-workernavigator-object:workernavigator><a href=#workernavigator>WorkerNavigator</a></code> object</h4>
- <p>The <dfn id=dom-worker-navigator><code>navigator</code></dfn> attribute
- of the <code id=the-workernavigator-object:workerglobalscope><a href=#workerglobalscope>WorkerGlobalScope</a></code> interface must return an instance of
- the <code id=the-workernavigator-object:workernavigator-2><a href=#workernavigator>WorkerNavigator</a></code> interface, which represents the
- identity and state of the user agent (the client):</p>
- <pre class=idl>[Exposed=Worker]
- interface <dfn id=workernavigator>WorkerNavigator</dfn> {};
- <a href=#workernavigator id=the-workernavigator-object:workernavigator-3>WorkerNavigator</a> implements <a href=#navigatorid id=the-workernavigator-object:navigatorid>NavigatorID</a>;
- <a href=#workernavigator id=the-workernavigator-object:workernavigator-4>WorkerNavigator</a> implements <a href=#navigatorlanguage id=the-workernavigator-object:navigatorlanguage>NavigatorLanguage</a>;
- <a href=#workernavigator id=the-workernavigator-object:workernavigator-5>WorkerNavigator</a> implements <a href=#navigatoronline id=the-workernavigator-object:navigatoronline>NavigatorOnLine</a>;</pre>
- <h4 id=worker-locations>10.3.3 Worker locations</h4>
- <pre class=idl>[Exposed=Worker]
- interface <dfn id=workerlocation>WorkerLocation</dfn> { };
- <a href=#workerlocation id=worker-locations:workerlocation>WorkerLocation</a> implements <a href=#urlutilsreadonly id=worker-locations:urlutilsreadonly>URLUtilsReadOnly</a>;</pre>
- <p>A <code id=worker-locations:workerlocation-2><a href=#workerlocation>WorkerLocation</a></code> object represents an <a href=#absolute-url id=worker-locations:absolute-url>absolute URL</a> set at its
- creation.</p>
- <p>The <code id=worker-locations:workerlocation-3><a href=#workerlocation>WorkerLocation</a></code> interface supports the <code id=worker-locations:urlutilsreadonly-2><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code>
- interface. <a href=#refsURL>[URL]</a></p>
- <p>When the object is created, the user agent must invoke the element's
- <code id=worker-locations:urlutilsreadonly-3><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code> interface's <a href=#concept-uu-set-the-input id=worker-locations:concept-uu-set-the-input>set the
- input</a> algorithm with the <a href=#absolute-url id=worker-locations:absolute-url-2>absolute URL</a> that the <code id=worker-locations:workerlocation-4><a href=#workerlocation>WorkerLocation</a></code>
- object represents as the given value.</p>
- <p>The element's <code id=worker-locations:urlutilsreadonly-4><a href=#urlutilsreadonly>URLUtilsReadOnly</a></code> interface's <a href=#concept-uu-get-the-base id=worker-locations:concept-uu-get-the-base>get the base</a> algorithm must return null.</p>
- <h2 id=webstorage>11 Web storage</h2>
- <h3 id=introduction-16>11.1 Introduction</h3>
- <p><i>This section is non-normative.</i></p>
- <p>This specification introduces two related mechanisms, similar to HTTP session cookies, for
- storing name-value pairs on the client side. <a href=#refsCOOKIES>[COOKIES]</a></p>
- <p>The first is designed for scenarios where the user is carrying out a single transaction, but
- could be carrying out multiple transactions in different windows at the same time.</p>
- <p>Cookies don't really handle this case well. For example, a user could be buying plane tickets
- in two different windows, using the same site. If the site used cookies to keep track of which
- ticket the user was buying, then as the user clicked from page to page in both windows, the ticket
- currently being purchased would "leak" from one window to the other, potentially causing the user
- to buy two tickets for the same flight without really noticing.</p>
- <p>To address this, this specification introduces the <code id=introduction-16:dom-sessionstorage><a href=#dom-sessionstorage>sessionStorage</a></code> IDL attribute. Sites can add data to the session
- storage, and it will be accessible to any page from the same site opened in that window.</p>
- <div class=example>
- <p>For example, a page could have a checkbox that the user ticks to
- indicate that he wants insurance:</p>
- <pre><label>
- <input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
- I want insurance on this trip.
- </label></pre>
- <p>A later page could then check, from script, whether the user had checked the checkbox or
- not:</p>
- <pre>if (sessionStorage.insurance) { ... }</pre>
- <p>If the user had multiple windows opened on the site, each one would have its own individual
- copy of the session storage object.</p>
- </div>
-
- <p>The second storage mechanism is designed for storage that spans multiple windows, and lasts
- beyond the current session. In particular, Web applications may wish to store megabytes of user
- data, such as entire user-authored documents or a user's mailbox, on the client side for
- performance reasons.</p>
- <p>Again, cookies do not handle this case well, because they are transmitted with every
- request.</p>
- <p>The <code id=introduction-16:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> IDL attribute is used to access a page's
- local storage area.</p>
- <div class=example>
- <p>The site at example.com can display a count of how many times the user has loaded its page by
- putting the following at the bottom of its page:</p>
- <pre><p>
- You have viewed this page
- <span id="count">an untold number of</span>
- time(s).
- </p>
- <script>
- if (!localStorage.pageLoadCount)
- localStorage.pageLoadCount = 0;
- localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
- document.getElementById('count').textContent = localStorage.pageLoadCount;
- </script></pre>
- </div>
- <p>Each site has its own separate storage area.</p>
- <h3 id=storage>11.2 The API</h3>
- <h4 id=the-storage-interface>11.2.1 The <code id=the-storage-interface:storage-2><a href=#storage-2>Storage</a></code> interface</h4>
- <pre class=idl>interface <dfn id=storage-2>Storage</dfn> {
- readonly attribute unsigned long <a href=#dom-storage-length id=the-storage-interface:dom-storage-length>length</a>;
- DOMString? <a href=#dom-storage-key id=the-storage-interface:dom-storage-key>key</a>(unsigned long index);
- getter DOMString? <a href=#dom-storage-getitem id=the-storage-interface:dom-storage-getitem>getItem</a>(DOMString key);
- setter creator void <a href=#dom-storage-setitem id=the-storage-interface:dom-storage-setitem>setItem</a>(DOMString key, DOMString value);
- deleter void <a href=#dom-storage-removeitem id=the-storage-interface:dom-storage-removeitem>removeItem</a>(DOMString key);
- void <a href=#dom-storage-clear id=the-storage-interface:dom-storage-clear>clear</a>();
- };</pre>
-
- <p>Each <code id=the-storage-interface:storage-2-2><a href=#storage-2>Storage</a></code> object provides access to a list of key/value pairs, which are
- sometimes called items. Keys are strings. Any string (including the empty string) is a valid key.
- Values are similarly strings.</p>
- <p>Each <code id=the-storage-interface:storage-2-3><a href=#storage-2>Storage</a></code> object is associated with a list of key/value pairs when it is
- created, as defined in the sections on the <code id=the-storage-interface:dom-sessionstorage><a href=#dom-sessionstorage>sessionStorage</a></code>
- and <code id=the-storage-interface:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> attributes. Multiple separate objects
- implementing the <code id=the-storage-interface:storage-2-4><a href=#storage-2>Storage</a></code> interface can all be associated with the same list of
- key/value pairs simultaneously.</p>
- <p>The <dfn id=dom-storage-length><code>length</code></dfn> attribute must return the number
- of key/value pairs currently present in the list associated with the object.</p>
- <p>The <dfn id=dom-storage-key><code>key(<var>n</var>)</code></dfn> method must
- return the name of the <var>n</var>th key in the list. The order of keys is user-agent
- defined, but must be consistent within an object so long as the number of keys doesn't change.
- (Thus, <a href=#dom-storage-setitem id=the-storage-interface:dom-storage-setitem-2>adding</a> or <a href=#dom-storage-removeitem id=the-storage-interface:dom-storage-removeitem-2>removing</a> a key may change the order of the keys, but merely
- changing the value of an existing key must not.) If <var>n</var> is
- greater than or equal to the number of key/value pairs
- in the object, then this method must return null.</p>
- <p>The <a href=#supported-property-names id=the-storage-interface:supported-property-names>supported property names</a> on a <code id=the-storage-interface:storage-2-5><a href=#storage-2>Storage</a></code> object are the keys of each
- key/value pair currently present in the list associated with the object, in the order that the
- keys were last added to the storage area.</p>
- <p>The <dfn id=dom-storage-getitem><code>getItem(<var>key</var>)</code></dfn> method
- must return the current value associated with the given <var>key</var>. If the given <var>key</var> does not exist in the list associated with the object then this method must
- return null. </p>
- <p>The <dfn id=dom-storage-setitem><code>setItem(<var>key</var>, <var>value</var>)</code></dfn> method must first check if a key/value pair with the given <var>key</var> already exists in the list associated with the object.</p>
- <p>If it does not, then a new key/value pair must be added to the list, with the given <var>key</var> and with its value set to <var>value</var>.</p>
- <p>If the given <var>key</var> <em>does</em> exist in the list, and its value is not
- equal to <var>value</var>, then it must have its value updated to <var>value</var>. If its previous value <em>is</em> equal to <var>value</var>, then
- the method must do nothing.</p>
- <p>If it couldn't set the new value, the method must throw a <code id=the-storage-interface:quotaexceedederror><a href=#quotaexceedederror>QuotaExceededError</a></code>
- exception. (Setting could fail if, e.g., the user has disabled storage for the site, or if the
- quota has been exceeded.)</p>
- <p>The <dfn id=dom-storage-removeitem><code>removeItem(<var>key</var>)</code></dfn>
- method must cause the key/value pair with the given <var>key</var> to be removed from the
- list associated with the object, if it exists. If no item with that key exists, the method must do
- nothing.</p>
- <p>The <code id=the-storage-interface:dom-storage-setitem-3><a href=#dom-storage-setitem>setItem()</a></code> and <code id=the-storage-interface:dom-storage-removeitem-3><a href=#dom-storage-removeitem>removeItem()</a></code> methods must be atomic with respect to failure.
- In the case of failure, the method does nothing. That is, changes to the data storage area must
- either be successful, or the data storage area must not be changed at all.</p>
- <p>The <dfn id=dom-storage-clear><code>clear()</code></dfn> method must atomically cause the
- list associated with the object to be emptied of all key/value pairs, if there are any. If there
- are none, then the method must do nothing.</p>
- <p class=note>When the <code id=the-storage-interface:dom-storage-setitem-4><a href=#dom-storage-setitem>setItem()</a></code>, <code id=the-storage-interface:dom-storage-removeitem-4><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code id=the-storage-interface:dom-storage-clear-2><a href=#dom-storage-clear>clear()</a></code> methods are invoked, events are fired on the
- <code id=the-storage-interface:window><a href=#window>Window</a></code> objects of other <code id=the-storage-interface:document><a href=#document>Document</a></code>s that can access the newly stored or
- removed data, as defined in the sections on the <code id=the-storage-interface:dom-sessionstorage-2><a href=#dom-sessionstorage>sessionStorage</a></code> and <code id=the-storage-interface:dom-localstorage-2><a href=#dom-localstorage>localStorage</a></code> attributes.</p>
- <p class=note>This specification does not require that the above methods wait until the data has
- been physically written to disk. Only consistency in what different scripts accessing the same
- underlying list of key/value pairs see is required.</p>
- <h4 id=the-sessionstorage-attribute>11.2.2 The <code id=the-sessionstorage-attribute:dom-sessionstorage><a href=#dom-sessionstorage>sessionStorage</a></code> attribute</h4>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=windowsessionstorage>WindowSessionStorage</dfn> {
- readonly attribute <a href=#storage-2 id=the-sessionstorage-attribute:storage-2>Storage</a> <a href=#dom-sessionstorage id=the-sessionstorage-attribute:dom-sessionstorage-2>sessionStorage</a>;
- };
- <a href=#window id=the-sessionstorage-attribute:window>Window</a> implements <a href=#windowsessionstorage id=the-sessionstorage-attribute:windowsessionstorage>WindowSessionStorage</a>;</pre>
- <p>The <dfn id=dom-sessionstorage><code>sessionStorage</code></dfn> attribute represents the
- set of storage areas specific to the current <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context>top-level browsing context</a>.</p>
- <p>Each <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context-2>top-level browsing context</a> has a unique set of session storage areas, one for
- each <a href=#origin-2 id=the-sessionstorage-attribute:origin-2>origin</a>.</p>
- <p>User agents should not expire data from a browsing context's session storage areas, but may do
- so when the user requests that such data be deleted, or when the UA detects that it has limited
- storage space, or for security reasons. User agents should always avoid deleting data while a
- script that could access that data is running. When a top-level browsing context is destroyed (and
- therefore permanently inaccessible to the user) the data stored in its session storage areas can
- be discarded with it, as the API described in this specification provides no way for that data to
- ever be subsequently retrieved.</p>
- <p class=note>The lifetime of a browsing context can be unrelated to the lifetime of the actual
- user agent process itself, as the user agent may support resuming sessions after a restart.</p>
- <p>When a new <code id=the-sessionstorage-attribute:document><a href=#document>Document</a></code> is created in a <a href=#browsing-context id=the-sessionstorage-attribute:browsing-context>browsing context</a> which has a
- <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context-3>top-level browsing context</a>, the user agent must check to see if that <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context-4>top-level
- browsing context</a> has a session storage area for that document's <a href=#origin-2 id=the-sessionstorage-attribute:origin-2-2>origin</a>. If it
- does, then that is the <code id=the-sessionstorage-attribute:document-2><a href=#document>Document</a></code>'s assigned session storage area. If it does not, a
- new storage area for that document's <a href=#origin-2 id=the-sessionstorage-attribute:origin-2-3>origin</a> must be created, and then <em>that</em>
- is the <code id=the-sessionstorage-attribute:document-3><a href=#document>Document</a></code>'s assigned session storage area. A <code id=the-sessionstorage-attribute:document-4><a href=#document>Document</a></code>'s assigned
- storage area does not change during the lifetime of a <code id=the-sessionstorage-attribute:document-5><a href=#document>Document</a></code>.</p>
- <p class=note>In the case of an <code id=the-sessionstorage-attribute:the-iframe-element><a href=#the-iframe-element>iframe</a></code> being moved to another
- <code id=the-sessionstorage-attribute:document-6><a href=#document>Document</a></code>, the nested browsing context is destroyed and a new one created.</p>
- <p>The <code id=the-sessionstorage-attribute:dom-sessionstorage-3><a href=#dom-sessionstorage>sessionStorage</a></code> attribute must return a
- <code id=the-sessionstorage-attribute:storage-2-2><a href=#storage-2>Storage</a></code> object associated with the <code id=the-sessionstorage-attribute:document-7><a href=#document>Document</a></code>'s assigned session storage
- area, if any, or null if there isn't one. Each <code id=the-sessionstorage-attribute:document-8><a href=#document>Document</a></code> object must have a separate
- object for its <code id=the-sessionstorage-attribute:window-2><a href=#window>Window</a></code>'s <code id=the-sessionstorage-attribute:dom-sessionstorage-4><a href=#dom-sessionstorage>sessionStorage</a></code>
- attribute.</p>
- <p>When a new <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context-5>top-level browsing context</a> is created by cloning an existing
- <a href=#browsing-context id=the-sessionstorage-attribute:browsing-context-2>browsing context</a>, the new browsing context must start with the same session storage
- areas as the original, but the two sets must from that point on be considered separate, not
- affecting each other in any way.</p>
- <p>When a new <a href=#top-level-browsing-context id=the-sessionstorage-attribute:top-level-browsing-context-6>top-level browsing context</a> is created by a <a href=#concept-script id=the-sessionstorage-attribute:concept-script>script</a> in an existing <a href=#browsing-context id=the-sessionstorage-attribute:browsing-context-3>browsing context</a>, or by the user
- following a link in an existing browsing context, or in some other way related to a specific
- <code id=the-sessionstorage-attribute:document-9><a href=#document>Document</a></code>, and the creation is not <a href=#a-new-start-for-session-storage id=the-sessionstorage-attribute:a-new-start-for-session-storage>a new start for session storage</a>, then
- the session storage area of the <a href=#origin-2 id=the-sessionstorage-attribute:origin-2-4>origin</a> of that <code id=the-sessionstorage-attribute:document-10><a href=#document>Document</a></code> must be copied
- into the new browsing context when it is created. From that point on, however, the two session
- storage areas must be considered separate, not affecting each other in any way.</p>
- <p id=sessionStorageEvent>When the <code id=the-sessionstorage-attribute:dom-storage-setitem><a href=#dom-storage-setitem>setItem()</a></code>, <code id=the-sessionstorage-attribute:dom-storage-removeitem><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code id=the-sessionstorage-attribute:dom-storage-clear><a href=#dom-storage-clear>clear()</a></code> methods are called on a <code id=the-sessionstorage-attribute:storage-2-3><a href=#storage-2>Storage</a></code> object <var>x</var> that is associated with a session storage area, if the methods did not throw an
- exception or "do nothing" as defined above, then for every <code id=the-sessionstorage-attribute:document-11><a href=#document>Document</a></code> object whose
- <code id=the-sessionstorage-attribute:window-3><a href=#window>Window</a></code> object's <code id=the-sessionstorage-attribute:dom-sessionstorage-5><a href=#dom-sessionstorage>sessionStorage</a></code> attribute's
- <code id=the-sessionstorage-attribute:storage-2-4><a href=#storage-2>Storage</a></code> object is associated with the same storage area, other than <var>x</var>, <a href=#send-a-storage-notification id=the-sessionstorage-attribute:send-a-storage-notification>send a storage notification</a>.</p>
- <h4 id=the-localstorage-attribute>11.2.3 The <code id=the-localstorage-attribute:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> attribute</h4>
- <pre class=idl>[NoInterfaceObject]
- interface <dfn id=windowlocalstorage>WindowLocalStorage</dfn> {
- readonly attribute <a href=#storage-2 id=the-localstorage-attribute:storage-2>Storage</a> <a href=#dom-localstorage id=the-localstorage-attribute:dom-localstorage-2>localStorage</a>;
- };
- <a href=#window id=the-localstorage-attribute:window>Window</a> implements <a href=#windowlocalstorage id=the-localstorage-attribute:windowlocalstorage>WindowLocalStorage</a>;</pre>
- <p>The <dfn id=dom-localstorage><code>localStorage</code></dfn> object provides a
- <code id=the-localstorage-attribute:storage-2-2><a href=#storage-2>Storage</a></code> object for an <a href=#origin-2 id=the-localstorage-attribute:origin-2>origin</a>.
- <a href=#fingerprinting-vector id=the-localstorage-attribute:fingerprinting-vector class=fingerprint title="There is a potential fingerprinting vector here."><img alt="(This is a fingerprinting vector.)" src=http://images.whatwg.org/fingerprint.png width=46 height=64></a>
- </p>
- <p>User agents must have a set of local storage areas, one for each <a href=#origin-2 id=the-localstorage-attribute:origin-2-2>origin</a>.</p>
- <p>User agents should expire data from the local storage areas only for security reasons or when
- requested to do so by the user. User agents should always avoid deleting data while a script that
- could access that data is running.</p>
- <p>When the <code id=the-localstorage-attribute:dom-localstorage-3><a href=#dom-localstorage>localStorage</a></code> attribute is accessed, the user
- agent must run the following steps, which are known as the <dfn id=storage-object-initialization-steps><code>Storage</code> object
- initialization steps</dfn>:</p>
- <ol><li><p>The user agent may throw a <code id=the-localstorage-attribute:securityerror><a href=#securityerror>SecurityError</a></code> exception and abort these steps
- instead of returning a <code id=the-localstorage-attribute:storage-2-3><a href=#storage-2>Storage</a></code> object if the request violates a policy decision
- (e.g. if the user agent is configured to not allow the page to persist data).<li><p>If the <code id=the-localstorage-attribute:document><a href=#document>Document</a></code>'s <a href=#origin-2 id=the-localstorage-attribute:origin-2-3>origin</a> is not a scheme/host/port tuple, then
- throw a <code id=the-localstorage-attribute:securityerror-2><a href=#securityerror>SecurityError</a></code> exception and abort these steps.<li><p>Check to see if the user agent has allocated a local storage area for the
- <a href=#origin-2 id=the-localstorage-attribute:origin-2-4>origin</a> of the <code id=the-localstorage-attribute:document-2><a href=#document>Document</a></code> of the <code id=the-localstorage-attribute:window-2><a href=#window>Window</a></code> object on which the
- attribute was accessed. If it has not, create a new storage area for that
- <a href=#origin-2 id=the-localstorage-attribute:origin-2-5>origin</a>.<li><p>Return the <code id=the-localstorage-attribute:storage-2-4><a href=#storage-2>Storage</a></code> object associated with that origin's local storage area.
- Each <code id=the-localstorage-attribute:document-3><a href=#document>Document</a></code> object must have a separate object for its <code id=the-localstorage-attribute:window-3><a href=#window>Window</a></code>'s <code id=the-localstorage-attribute:dom-localstorage-4><a href=#dom-localstorage>localStorage</a></code> attribute.</p>
- </ol>
- <p id=localStorageEvent>When the <code id=the-localstorage-attribute:dom-storage-setitem><a href=#dom-storage-setitem>setItem()</a></code>, <code id=the-localstorage-attribute:dom-storage-removeitem><a href=#dom-storage-removeitem>removeItem()</a></code>, and <code id=the-localstorage-attribute:dom-storage-clear><a href=#dom-storage-clear>clear()</a></code> methods are called on a <code id=the-localstorage-attribute:storage-2-5><a href=#storage-2>Storage</a></code> object <var>x</var> that is associated with a local storage area, if the methods did not throw an
- exception or "do nothing" as defined above, then for every <code id=the-localstorage-attribute:document-4><a href=#document>Document</a></code> object whose
- <code id=the-localstorage-attribute:window-4><a href=#window>Window</a></code> object's <code id=the-localstorage-attribute:dom-localstorage-5><a href=#dom-localstorage>localStorage</a></code> attribute's
- <code id=the-localstorage-attribute:storage-2-6><a href=#storage-2>Storage</a></code> object is associated with the same storage area, other than <var>x</var>, <a href=#send-a-storage-notification id=the-localstorage-attribute:send-a-storage-notification>send a storage notification</a>.
- <p id=localStorageMutex>Whenever the properties of a <code id=the-localstorage-attribute:dom-localstorage-6><a href=#dom-localstorage>localStorage</a></code> attribute's <code id=the-localstorage-attribute:storage-2-7><a href=#storage-2>Storage</a></code> object are to be
- examined, returned, set, or deleted, whether as part of a direct property access, when checking
- for the presence of a property, during property enumeration, when determining the number of
- properties present, or as part of the execution of any of the methods or attributes defined on the
- <code id=the-localstorage-attribute:storage-2-8><a href=#storage-2>Storage</a></code> interface, the user agent must first <a href=#obtain-the-storage-mutex id=the-localstorage-attribute:obtain-the-storage-mutex>obtain the storage
- mutex</a>.</p>
- <h4 id=the-storage-event>11.2.4 The <code id=the-storage-event:event-storage><a href=#event-storage>storage</a></code> event</h4>
- <p>The <code id=the-storage-event:event-storage-2><a href=#event-storage>storage</a></code> event is fired on a <code id=the-storage-event:document><a href=#document>Document</a></code>'s
- <code id=the-storage-event:window><a href=#window>Window</a></code> object when a storage area changes, as described in the previous two sections
- (<a href=#sessionStorageEvent>for session storage</a>, <a href=#localStorageEvent>for local
- storage</a>).</p>
- <p>When a user agent is to <dfn id=send-a-storage-notification>send a storage notification</dfn> for a <code id=the-storage-event:document-2><a href=#document>Document</a></code>, the
- user agent must <a href=#queue-a-task id=the-storage-event:queue-a-task>queue a task</a> to <a href=#concept-event-fire id=the-storage-event:concept-event-fire>fire</a> a <a href=#concept-events-trusted id=the-storage-event:concept-events-trusted>trusted</a> event with the name <code id=the-storage-event:storage-2><a href=#storage-2>storage</a></code>, which
- does not bubble and is not cancelable, and which uses the <code id=the-storage-event:storageevent><a href=#storageevent>StorageEvent</a></code> interface, at
- the <code id=the-storage-event:document-3><a href=#document>Document</a></code> object's <code id=the-storage-event:window-2><a href=#window>Window</a></code> object.</p>
- <p class=note>Such a <code id=the-storage-event:document-4><a href=#document>Document</a></code> object is not necessarily <a href=#fully-active id=the-storage-event:fully-active>fully active</a>,
- but events fired on such objects are ignored by the <a href=#event-loop id=the-storage-event:event-loop>event loop</a> until the
- <code id=the-storage-event:document-5><a href=#document>Document</a></code> becomes <a href=#fully-active id=the-storage-event:fully-active-2>fully active</a> again.</p>
- <p>The <a href=#task-source id=the-storage-event:task-source>task source</a> for these tasks is the <a href=#dom-manipulation-task-source id=the-storage-event:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
- <p>If the event is being fired due to an invocation of the <code id=the-storage-event:dom-storage-setitem><a href=#dom-storage-setitem>setItem()</a></code> or <code id=the-storage-event:dom-storage-removeitem><a href=#dom-storage-removeitem>removeItem()</a></code> methods, the event must have its <code id=the-storage-event:dom-storageevent-key><a href=#dom-storageevent-key>key</a></code> attribute initialised to the name of the key in question,
- its <code id=the-storage-event:dom-storageevent-oldvalue><a href=#dom-storageevent-oldvalue>oldValue</a></code> attribute initialised to the old
- value of the key in question, or null if the key is newly added, and its <code id=the-storage-event:dom-storageevent-newvalue><a href=#dom-storageevent-newvalue>newValue</a></code> attribute initialised to the new value of the
- key in question, or null if the key was removed.</p>
- <p>Otherwise, if the event is being fired due to an invocation of the <code id=the-storage-event:dom-storage-clear><a href=#dom-storage-clear>clear()</a></code> method, the event must have its <code id=the-storage-event:dom-storageevent-key-2><a href=#dom-storageevent-key>key</a></code>, <code id=the-storage-event:dom-storageevent-oldvalue-2><a href=#dom-storageevent-oldvalue>oldValue</a></code>,
- and <code id=the-storage-event:dom-storageevent-newvalue-2><a href=#dom-storageevent-newvalue>newValue</a></code> attributes initialised to null.</p>
- <p>In addition, the event must have its <code id=the-storage-event:dom-storageevent-url><a href=#dom-storageevent-url>url</a></code> attribute
- initialised to <a href=http://dom.spec.whatwg.org/#concept-document-url id="the-storage-event:the-document's-address" data-x-internal="the-document's-address">the address of the document</a> whose
- <code id=the-storage-event:storage-2-2><a href=#storage-2>Storage</a></code> object was affected; and its <code id=the-storage-event:dom-storageevent-storagearea><a href=#dom-storageevent-storagearea>storageArea</a></code> attribute initialised to the
- <code id=the-storage-event:storage-2-3><a href=#storage-2>Storage</a></code> object from the <code id=the-storage-event:window-3><a href=#window>Window</a></code> object of the target
- <code id=the-storage-event:document-6><a href=#document>Document</a></code> that represents the same kind of <code id=the-storage-event:storage-2-4><a href=#storage-2>Storage</a></code> area as was affected
- (i.e. session or local).</p>
- <h5 id=the-storageevent-interface>11.2.4.1 The <code id=the-storageevent-interface:storageevent><a href=#storageevent>StorageEvent</a></code> interface</h5>
- <pre class=idl>[Constructor(DOMString type, optional <a href=#storageeventinit id=the-storageevent-interface:storageeventinit>StorageEventInit</a> eventInitDict)]
- interface <dfn id=storageevent>StorageEvent</dfn> : <a href=#event id=the-storageevent-interface:event>Event</a> {
- readonly attribute DOMString? <a href=#dom-storageevent-key id=the-storageevent-interface:dom-storageevent-key>key</a>;
- readonly attribute DOMString? <a href=#dom-storageevent-oldvalue id=the-storageevent-interface:dom-storageevent-oldvalue>oldValue</a>;
- readonly attribute DOMString? <a href=#dom-storageevent-newvalue id=the-storageevent-interface:dom-storageevent-newvalue>newValue</a>;
- readonly attribute DOMString <a href=#dom-storageevent-url id=the-storageevent-interface:dom-storageevent-url>url</a>;
- readonly attribute <a href=#storage-2 id=the-storageevent-interface:storage-2>Storage</a>? <a href=#dom-storageevent-storagearea id=the-storageevent-interface:dom-storageevent-storagearea>storageArea</a>;
- };
- dictionary <dfn id=storageeventinit>StorageEventInit</dfn> : <a href=#eventinit id=the-storageevent-interface:eventinit>EventInit</a> {
- DOMString? key;
- DOMString? oldValue;
- DOMString? newValue;
- DOMString url;
- <a href=#storage-2 id=the-storageevent-interface:storage-2-2>Storage</a>? storageArea;
- };</pre>
- <p>The <dfn id=dom-storageevent-key><code>key</code></dfn> attribute must return the value it
- was initialised to. When the object is created, this attribute must be initialised to null. It
- represents the key being changed.</p>
- <p>The <dfn id=dom-storageevent-oldvalue><code>oldValue</code></dfn> attribute must return
- the value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents the old value of the key being changed.</p>
- <p>The <dfn id=dom-storageevent-newvalue><code>newValue</code></dfn> attribute must return
- the value it was initialised to. When the object is created, this attribute must be initialised to
- null. It represents the new value of the key being changed.</p>
- <p>The <dfn id=dom-storageevent-url><code>url</code></dfn> attribute must return the value it
- was initialised to. When the object is created, this attribute must be initialised to the empty
- string. It represents the address of the document whose key changed.</p>
- <p>The <dfn id=dom-storageevent-storagearea><code>storageArea</code></dfn> attribute must
- return the value it was initialised to. When the object is created, this attribute must be
- initialised to null. It represents the <code id=the-storageevent-interface:storage-2-3><a href=#storage-2>Storage</a></code> object that was affected.</p>
- <h4 id=threads>11.2.5 Threads</h4>
- <p>Because of <a href=#localStorageMutex>the use</a> of the <a href=#storage-mutex id=threads:storage-mutex>storage mutex</a>, multiple
- browsing contexts will be able to access the local storage areas simultaneously in such a manner
- that scripts cannot detect any concurrent script execution.</p>
- <p>Thus, the <code id=threads:dom-storage-length><a href=#dom-storage-length>length</a></code> attribute of a <code id=threads:storage-2><a href=#storage-2>Storage</a></code>
- object, and the value of the various properties of that object, cannot change while a script is
- executing, other than in a way that is predictable by the script itself.</p>
- <h3 id=disk-space-2>11.3 Disk space</h3>
- <p>User agents should limit the total amount of space allowed for storage areas, because hostile
- authors could otherwise use this feature to exhaust the user's available disk space.</p>
- <p>User agents should guard against sites storing data under their origin's other affiliated
- sites, e.g. storing up to the limit in a1.example.com, a2.example.com, a3.example.com, etc,
- circumventing the main example.com storage limit.</p>
- <p>User agents may prompt the user when quotas are reached, allowing the user to grant a site more
- space. This enables sites to store many user-created documents on the user's computer, for
- instance.</p>
- <p>User agents should allow users to see how much space each domain is using.</p>
-
- <p>A mostly arbitrary limit of five megabytes per <a href=#origin-2 id=disk-space-2:origin-2>origin</a> is suggested. Implementation
- feedback is welcome and will be used to update this suggestion in the future.</p>
- <p>For predictability, quotas should be based on the uncompressed size of data stored.</p>
-
- <h3 id=privacy>11.4 Privacy</h3>
- <h4 id=user-tracking>11.4.1 User tracking</h4>
- <p>A third-party advertiser (or any entity capable of getting content distributed to multiple
- sites) could use a unique identifier stored in its local storage area to track a user across
- multiple sessions, building a profile of the user's interests to allow for highly targeted
- advertising. In conjunction with a site that is aware of the user's real identity (for example an
- e-commerce site that requires authenticated credentials), this could allow oppressive groups to
- target individuals with greater accuracy than in a world with purely anonymous Web usage.</p>
- <p>There are a number of techniques that can be used to mitigate the risk of user tracking:</p>
- <dl><dt>Blocking third-party storage<dd>
- <p>User agents may restrict access to the <code id=user-tracking:dom-localstorage><a href=#dom-localstorage>localStorage</a></code>
- objects to scripts originating at the domain of the <a href=#active-document id=user-tracking:active-document>active document</a> of the <a href=#top-level-browsing-context id=user-tracking:top-level-browsing-context>top-level browsing
- context</a>, for instance denying access to the API for pages from other domains running in
- <code id=user-tracking:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s.</p>
- <dt>Expiring stored data<dd>
- <p>User agents may, possibly in a manner configured by the user, automatically delete stored
- data after a period of time.</p>
- <p>For example, a user agent could be configured to treat third-party local storage areas as
- session-only storage, deleting the data once the user had closed all the <a href=#browsing-context id=user-tracking:browsing-context>browsing contexts</a> that could access it.</p>
- <p>This can restrict the ability of a site to track a user, as the site would then only be able
- to track the user across multiple sessions when he authenticates with the site itself (e.g. by
- making a purchase or logging in to a service).</p>
- <p>However, this also reduces the usefulness of the API as a long-term storage mechanism. It can
- also put the user's data at risk, if the user does not fully understand the implications of data
- expiration.</p>
-
- <dt>Treating persistent storage as cookies<dd>
- <p>If users attempt to protect their privacy by clearing cookies without also clearing data
- stored in the local storage area, sites can defeat those attempts by using the two features as
- redundant backup for each other. User agents should present the interfaces for clearing these in
- a way that helps users to understand this possibility and enables them to delete data in all
- persistent storage features simultaneously. <a href=#refsCOOKIES>[COOKIES]</a></p>
- <dt>Site-specific white-listing of access to local storage areas<dd>
- <p>User agents may allow sites to access session storage areas in
- an unrestricted manner, but require the user to authorise access
- to local storage areas.</p>
- <dt>Origin-tracking of stored data<dd>
- <p>User agents may record the <a href=#origin-2 id=user-tracking:origin-2>origins</a> of sites that contained
- content from third-party origins that caused data to be stored.</p>
- <p>If this information is then used to present the view of data currently in persistent storage,
- it would allow the user to make informed decisions about which parts of the persistent storage
- to prune. Combined with a blacklist ("delete this data and prevent this domain from ever storing
- data again"), the user can restrict the use of persistent storage to sites that he trusts.</p>
- <dt>Shared blacklists<dd>
- <p>User agents may allow users to share their persistent storage domain blacklists.</p>
- <p>This would allow communities to act together to protect their privacy.</p>
- </dl>
- <p>While these suggestions prevent trivial use of this API for user tracking, they do not block it
- altogether. Within a single domain, a site can continue to track the user during a session, and
- can then pass all this information to the third party along with any identifying information
- (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with
- multiple sites to obtain such information, a profile can still be created.</p>
- <p>However, user tracking is to some extent possible even with no cooperation from the user agent
- whatsoever, for instance by using session identifiers in URLs, a technique already commonly used
- for innocuous purposes but easily repurposed for user tracking (even retroactively). This
- information can then be shared with other sites, using visitors' IP addresses and other
- user-specific data (e.g. user-agent headers and configuration settings) to combine separate
- sessions into coherent user profiles.</p>
- <h4 id=sensitivity-of-data>11.4.2 Sensitivity of data</h4>
- <p>User agents should treat persistently stored data as potentially sensitive; it's quite possible
- for e-mails, calendar appointments, health records, or other confidential documents to be stored
- in this mechanism.</p>
- <p>To this end, user agents should ensure that when deleting data, it is promptly deleted from the
- underlying storage.</p>
- <h3 id=security-storage>11.5 Security</h3>
- <h4 id=dns-spoofing-attacks>11.5.1 DNS spoofing attacks</h4>
- <p>Because of the potential for DNS spoofing attacks, one cannot guarantee that a host claiming to
- be in a certain domain really is from that domain. To mitigate this, pages can use TLS. Pages
- using TLS can be sure that only the user, software working on behalf of the user, and other pages
- using TLS that have certificates identifying them as being from the same domain, can access their
- storage areas.</p>
- <h4 id=cross-directory-attacks>11.5.2 Cross-directory attacks</h4>
- <p>Different authors sharing one host name, for example users hosting content on the now defunct
- <code>geocities.com</code>, all share one local storage object. There is no feature to
- restrict the access by pathname. Authors on shared hosts are therefore urged to avoid using these
- features, as it would be trivial for other authors to read the data and overwrite it.</p>
- <p class=note>Even if a path-restriction feature was made available, the usual DOM scripting
- security model would make it trivial to bypass this protection and access the data from any
- path.</p>
- <h4 id=implementation-risks>11.5.3 Implementation risks</h4>
- <p>The two primary risks when implementing these persistent storage features are letting hostile
- sites read information from other domains, and letting hostile sites write information that is
- then read from other domains.</p>
- <p>Letting third-party sites read data that is not supposed to be read from their domain causes
- <em>information leakage</em>, For example, a user's shopping wishlist on one domain could be used
- by another domain for targeted advertising; or a user's work-in-progress confidential documents
- stored by a word-processing site could be examined by the site of a competing company.</p>
- <p>Letting third-party sites write data to the persistent storage of other domains can result in
- <em>information spoofing</em>, which is equally dangerous. For example, a hostile site could add
- items to a user's wishlist; or a hostile site could set a user's session identifier to a known ID
- that the hostile site can then use to track the user's actions on the victim site.</p>
- <p>Thus, strictly following the <a href=#origin-2 id=implementation-risks:origin-2>origin</a> model described in this specification is
- important for user security.</p>
- <h2 id=syntax>12 <dfn>The HTML syntax</dfn></h2>
- <p class=note>This section only describes the rules for resources labeled with an <a href=#html-mime-type id=syntax:html-mime-type>HTML
- MIME type</a>. Rules for XML resources are discussed in the section below entitled "<a href=#the-xhtml-syntax id=syntax:the-xhtml-syntax>The
- XHTML syntax</a>".</p>
- <h3 id=writing>12.1 Writing HTML documents</h3>
-
- <p><i>This section only applies to documents, authoring tools, and markup generators. In
- particular, it does not apply to conformance checkers; conformance checkers must use the
- requirements given in the next section ("parsing HTML documents").</i></p>
-
- <p>Documents must consist of the following parts, in the given
- order:</p>
- <ol><li>Optionally, a single U+FEFF BYTE ORDER MARK (BOM) character.<li>Any number of <a href=#syntax-comments id=writing:syntax-comments>comments</a> and <a href=#space-character id=writing:space-character>space characters</a>.<li>A <a href=#syntax-doctype id=writing:syntax-doctype>DOCTYPE</a>.
- <li>Any number of <a href=#syntax-comments id=writing:syntax-comments-2>comments</a> and <a href=#space-character id=writing:space-character-2>space characters</a>.<li>The root element, in the form of an <code id=writing:the-html-element><a href=#the-html-element>html</a></code> <a href=#syntax-elements id=writing:syntax-elements>element</a>.<li>Any number of <a href=#syntax-comments id=writing:syntax-comments-3>comments</a> and <a href=#space-character id=writing:space-character-3>space characters</a>.</ol>
- <p>The various types of content mentioned above are described in the next few sections.</p>
- <p>In addition, there are some restrictions on how <a href=#character-encoding-declaration id=writing:character-encoding-declaration>character encoding declarations</a> are to be serialised, as discussed in the
- section on that topic.</p>
- <div class=note>
- <p>Space characters before the root <code id=writing:the-html-element-2><a href=#the-html-element>html</a></code> element, and space characters at the start
- of the <code id=writing:the-html-element-3><a href=#the-html-element>html</a></code> element and before the <code id=writing:the-head-element><a href=#the-head-element>head</a></code> element, will be dropped when
- the document is parsed; space characters <em>after</em> the root <code id=writing:the-html-element-4><a href=#the-html-element>html</a></code> element will
- be parsed as if they were at the end of the <code id=writing:the-body-element><a href=#the-body-element>body</a></code> element. Thus, space characters
- around the root element do not round-trip.</p>
- <p>It is suggested that newlines be inserted after the DOCTYPE, after any comments that are
- before the root element, after the <code id=writing:the-html-element-5><a href=#the-html-element>html</a></code> element's start tag (if it is not <a href=#syntax-tag-omission id=writing:syntax-tag-omission>omitted</a>), and after any comments that are inside the
- <code id=writing:the-html-element-6><a href=#the-html-element>html</a></code> element but before the <code id=writing:the-head-element-2><a href=#the-head-element>head</a></code> element.</p>
- </div>
- <p>Many strings in the HTML syntax (e.g. the names of elements and their attributes) are
- case-insensitive, but only for <a href=#uppercase-ascii-letters id=writing:uppercase-ascii-letters>uppercase ASCII letters</a> and <a href=#lowercase-ascii-letters id=writing:lowercase-ascii-letters>lowercase ASCII
- letters</a>. For convenience, in this section this is just referred to as
- "case-insensitive".</p>
- <h4 id=the-doctype>12.1.1 The DOCTYPE</h4>
- <p>A <dfn id=syntax-doctype>DOCTYPE</dfn> is a
- required preamble.</p>
- <p class=note>DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a
- different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a
- document ensures that the browser makes a best-effort attempt at following the relevant
- specifications.</p>
- <p>A DOCTYPE must consist of the following components, in this order:</p>
- <ol class=brief><li>A string that is an <a href=#ascii-case-insensitive id=the-doctype:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code><!DOCTYPE</code>".<li>One or more <a href=#space-character id=the-doctype:space-character>space characters</a>.<li>A string that is an <a href=#ascii-case-insensitive id=the-doctype:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code>html</code>".<li>Optionally, a <a href=#doctype-legacy-string id=the-doctype:doctype-legacy-string>DOCTYPE legacy string</a> or an <a href=#obsolete-permitted-doctype-string id=the-doctype:obsolete-permitted-doctype-string>obsolete permitted DOCTYPE string</a> (defined below).<li>Zero or more <a href=#space-character id=the-doctype:space-character-2>space characters</a>.<li>A U+003E GREATER-THAN SIGN character (>).</ol>
- <p class=note>In other words, <code><!DOCTYPE html></code>, case-insensitively.</p>
- <hr>
- <p>For the purposes of HTML generators that cannot output HTML markup with the short DOCTYPE
- "<code><!DOCTYPE html></code>", a <dfn id=doctype-legacy-string>DOCTYPE legacy string</dfn> may be inserted
- into the DOCTYPE (in the position defined above). This string must consist of:</p>
- <ol class=brief><li>One or more <a href=#space-character id=the-doctype:space-character-3>space characters</a>.<li>A string that is an <a href=#ascii-case-insensitive id=the-doctype:ascii-case-insensitive-3>ASCII case-insensitive</a> match for the string "<code>SYSTEM</code>".<li>One or more <a href=#space-character id=the-doctype:space-character-4>space characters</a>.<li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>quote mark</i>).<li>The literal string "<code id=the-doctype:about:legacy-compat><a href=#about:legacy-compat>about:legacy-compat</a></code>".<li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>quote mark</i>).</ol>
- <p class=note>In other words, <code><!DOCTYPE html SYSTEM "about:legacy-compat"></code> or
- <code><!DOCTYPE html SYSTEM 'about:legacy-compat'></code>, case-insensitively except for the
- part in single or double quotes.</p>
- <p>The <a href=#doctype-legacy-string id=the-doctype:doctype-legacy-string-2>DOCTYPE legacy string</a> should not be used unless the document is generated from
- a system that cannot output the shorter string.</p>
- <hr>
-
- <p>To help authors transition from HTML4 and XHTML1, an <dfn id=obsolete-permitted-doctype-string>obsolete permitted DOCTYPE
- string</dfn> can be inserted into the DOCTYPE (in the position defined above). This string must
- consist of:</p>
- <ol class=brief><li>One or more <a href=#space-character id=the-doctype:space-character-5>space characters</a>.<li>A string that is an <a href=#ascii-case-insensitive id=the-doctype:ascii-case-insensitive-4>ASCII case-insensitive</a> match for the string "<code>PUBLIC</code>".<li>One or more <a href=#space-character id=the-doctype:space-character-6>space characters</a>.<li>A U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>first quote mark</i>).<li>The string from one of the cells in the first column of the table below. The row to which this cell belongs is the <i>selected row</i>.<li>A matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>first quote mark</i>).<li>If the cell in the second column of the <i>selected row</i> is not blank, one or more <a href=#space-character id=the-doctype:space-character-7>space characters</a>.<li>If the cell in the second column of the <i>selected row</i> is not blank, a U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (the <i>third quote mark</i>).<li>If the cell in the second column of the <i>selected row</i> is not blank, the string from the cell in the second column of the <i>selected row</i>.<li>If the cell in the second column of the <i>selected row</i> is not blank, a matching U+0022 QUOTATION MARK or U+0027 APOSTROPHE character (i.e. the same character as in the earlier step labeled <i>third quote mark</i>).</ol>
- <table><caption>
- Allowed values for public and system identifiers in an <a href=#obsolete-permitted-doctype-string id=the-doctype:obsolete-permitted-doctype-string-2>obsolete permitted DOCTYPE string</a>.
- </caption><thead><tr><th> Public identifier
- <th> System identifier
- <tbody><tr><td> <code>-//W3C//DTD HTML 4.0//EN</code>
- <td>
- <tr><td> <code>-//W3C//DTD HTML 4.0//EN</code>
- <td> <code>http://www.w3.org/TR/REC-html40/strict.dtd</code>
- <tr><td> <code>-//W3C//DTD HTML 4.01//EN</code>
- <td>
- <tr><td> <code>-//W3C//DTD HTML 4.01//EN</code>
- <td> <code>http://www.w3.org/TR/html4/strict.dtd</code>
- <tr><td> <code>-//W3C//DTD XHTML 1.0 Strict//EN</code>
- <td> <code>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>
- <tr><td> <code>-//W3C//DTD XHTML 1.1//EN</code>
- <td> <code>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>
- </table>
- <p>A <a href=#syntax-doctype id=the-doctype:syntax-doctype>DOCTYPE</a> containing an <a href=#obsolete-permitted-doctype-string id=the-doctype:obsolete-permitted-doctype-string-3>obsolete permitted DOCTYPE
- string</a> is an <dfn id=obsolete-permitted-doctype>obsolete permitted DOCTYPE</dfn>. Authors should not use <a href=#obsolete-permitted-doctype id=the-doctype:obsolete-permitted-doctype>obsolete permitted DOCTYPEs</a>, as they are unnecessarily
- long.</p>
- <h4 id=elements-2>12.1.2 Elements</h4>
- <p>There are five different kinds of <dfn id=syntax-elements>elements</dfn>: <a href=#void-elements id=elements-2:void-elements>void
- elements</a>, <a href=#raw-text-elements id=elements-2:raw-text-elements>raw text elements</a>, <a href=#escapable-raw-text-elements id=elements-2:escapable-raw-text-elements>escapable raw text elements</a>,
- <a href=#foreign-elements id=elements-2:foreign-elements>foreign elements</a>, and <a href=#normal-elements id=elements-2:normal-elements>normal elements</a>.</p>
- <dl><dt><dfn id=void-elements>Void elements</dfn><dd><code id=elements-2:the-area-element><a href=#the-area-element>area</a></code>, <code id=elements-2:the-base-element><a href=#the-base-element>base</a></code>, <code id=elements-2:the-br-element><a href=#the-br-element>br</a></code>, <code id=elements-2:the-col-element><a href=#the-col-element>col</a></code>, <code id=elements-2:the-embed-element><a href=#the-embed-element>embed</a></code>,
- <code id=elements-2:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=elements-2:the-img-element><a href=#the-img-element>img</a></code>, <code id=elements-2:the-input-element><a href=#the-input-element>input</a></code>, <code id=elements-2:the-keygen-element><a href=#the-keygen-element>keygen</a></code>, <code id=elements-2:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=elements-2:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>, <code id=elements-2:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=elements-2:the-param-element><a href=#the-param-element>param</a></code>, <code id=elements-2:the-source-element><a href=#the-source-element>source</a></code>,
- <code id=elements-2:the-track-element><a href=#the-track-element>track</a></code>, <code id=elements-2:the-wbr-element><a href=#the-wbr-element>wbr</a></code><dt><dfn id=raw-text-elements>Raw text elements</dfn><dd><code id=elements-2:the-script-element><a href=#the-script-element>script</a></code>, <code id=elements-2:the-style-element><a href=#the-style-element>style</a></code><dt><dfn id=escapable-raw-text-elements>escapable raw text elements</dfn><dd><code id=elements-2:the-textarea-element><a href=#the-textarea-element>textarea</a></code>, <code id=elements-2:the-title-element><a href=#the-title-element>title</a></code><dt><dfn id=foreign-elements>Foreign elements</dfn><dd>Elements from the <a href=#mathml-namespace id=elements-2:mathml-namespace>MathML namespace</a> and the <a href=#svg-namespace id=elements-2:svg-namespace>SVG namespace</a>.<dt><dfn id=normal-elements>Normal elements</dfn><dd>All other allowed <a href=#html-elements id=elements-2:html-elements>HTML elements</a> are normal elements.</dl>
- <p><dfn id=syntax-tags>Tags</dfn> are used to delimit the start and end of elements in the
- markup. <a href=#raw-text-elements id=elements-2:raw-text-elements-2>Raw text</a>, <a href=#escapable-raw-text-elements id=elements-2:escapable-raw-text-elements-2>escapable raw text</a>, and <a href=#normal-elements id=elements-2:normal-elements-2>normal</a> elements have
- a <a href=#syntax-start-tag id=elements-2:syntax-start-tag>start tag</a> to indicate where they begin, and an <a href=#syntax-end-tag id=elements-2:syntax-end-tag>end tag</a> to indicate where they end. The start and end tags of
- certain <a href=#normal-elements id=elements-2:normal-elements-3>normal elements</a> can be <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission>omitted</a>, as
- described below in the section on <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-2>optional tags</a>. Those
- that cannot be omitted must not be omitted. <a href=#void-elements id=elements-2:void-elements-2>Void elements</a> only have a start tag; end
- tags must not be specified for <a href=#void-elements id=elements-2:void-elements-3>void elements</a>. <a href=#foreign-elements id=elements-2:foreign-elements-2>Foreign elements</a> must
- either have a start tag and an end tag, or a start tag that is marked as self-closing, in which
- case they must not have an end tag.</p>
- <p>The <a href=#concept-html-contents id=elements-2:concept-html-contents>contents</a> of the element must be placed between
- just after the start tag (which <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-3>might be implied, in certain
- cases</a>) and just before the end tag (which again, <a href=#syntax-tag-omission id=elements-2:syntax-tag-omission-4>might be
- implied in certain cases</a>). The exact allowed contents of each individual element depend on
- the <a href=#content-models id=elements-2:content-models>content model</a> of that element, as described earlier in
- this specification. Elements must not contain content that their content model disallows. In
- addition to the restrictions placed on the contents by those content models, however, the five
- types of elements have additional <em>syntactic</em> requirements.</p>
- <p><a href=#void-elements id=elements-2:void-elements-4>Void elements</a> can't have any contents (since there's no end tag, no content can be
- put between the start tag and the end tag).</p>
- <p><a href=#raw-text-elements id=elements-2:raw-text-elements-3>Raw text elements</a> can have <a href=#syntax-text id=elements-2:syntax-text>text</a>, though it has <a href=#cdata-rcdata-restrictions>restrictions</a> described below.</p>
- <p><a href=#escapable-raw-text-elements id=elements-2:escapable-raw-text-elements-3>Escapable raw text elements</a> can have <a href=#syntax-text id=elements-2:syntax-text-2>text</a> and
- <a href=#syntax-charref id=elements-2:syntax-charref>character references</a>, but the text must not contain an <a href=#syntax-ambiguous-ampersand id=elements-2:syntax-ambiguous-ampersand>ambiguous ampersand</a>. There are also <a href=#cdata-rcdata-restrictions>further restrictions</a> described below.</p>
- <p><a href=#foreign-elements id=elements-2:foreign-elements-3>Foreign elements</a> whose start tag is marked as self-closing can't have any contents
- (since, again, as there's no end tag, no content can be put between the start tag and the end
- tag). <a href=#foreign-elements id=elements-2:foreign-elements-4>Foreign elements</a> whose start tag is <em>not</em> marked as self-closing can
- have <a href=#syntax-text id=elements-2:syntax-text-3>text</a>, <a href=#syntax-charref id=elements-2:syntax-charref-2>character
- references</a>, <a href=#syntax-cdata id=elements-2:syntax-cdata>CDATA sections</a>, other <a href=#syntax-elements id=elements-2:syntax-elements>elements</a>, and <a href=#syntax-comments id=elements-2:syntax-comments>comments</a>, but
- the text must not contain the character U+003C LESS-THAN SIGN (<) or an <a href=#syntax-ambiguous-ampersand id=elements-2:syntax-ambiguous-ampersand-2>ambiguous ampersand</a>.</p>
- <div class=note>
- <p>The HTML syntax does not support namespace declarations, even in <a href=#foreign-elements id=elements-2:foreign-elements-5>foreign
- elements</a>.</p>
- <p>For instance, consider the following HTML fragment:</p>
- <pre><p>
- <svg>
- <metadata>
- <!-- this is invalid -->
- <cdr:license xmlns:cdr="http://www.example.com/cdr/metadata" name="MIT"/>
- </metadata>
- </svg>
- </p></pre>
- <p>The innermost element, <code>cdr:license</code>, is actually in the SVG namespace, as
- the "<code>xmlns:cdr</code>" attribute has no effect (unlike in XML). In fact, as the
- comment in the fragment above says, the fragment is actually non-conforming. This is because the
- SVG specification does not define any elements called "<code>cdr:license</code>" in the
- SVG namespace.</p>
- </div>
- <p><a href=#normal-elements id=elements-2:normal-elements-4>Normal elements</a> can have <a href=#syntax-text id=elements-2:syntax-text-4>text</a>, <a href=#syntax-charref id=elements-2:syntax-charref-3>character references</a>, other <a href=#syntax-elements id=elements-2:syntax-elements-2>elements</a>, and <a href=#syntax-comments id=elements-2:syntax-comments-2>comments</a>, but
- the text must not contain the character U+003C LESS-THAN SIGN (<) or an <a href=#syntax-ambiguous-ampersand id=elements-2:syntax-ambiguous-ampersand-3>ambiguous ampersand</a>. Some <a href=#normal-elements id=elements-2:normal-elements-5>normal elements</a>
- also have <a href=#element-restrictions>yet more restrictions</a> on what content they are
- allowed to hold, beyond the restrictions imposed by the content model and those described in this
- paragraph. Those restrictions are described below.</p>
- <p>Tags contain a <dfn id=syntax-tag-name>tag name</dfn>, giving the element's name. HTML
- elements all have names that only use <a href=#alphanumeric-ascii-characters id=elements-2:alphanumeric-ascii-characters>alphanumeric ASCII characters</a>. In the HTML
- syntax, tag names, even those for <a href=#foreign-elements id=elements-2:foreign-elements-6>foreign elements</a>, may be written with any mix of
- lower- and uppercase letters that, when converted to all-lowercase, matches the element's tag
- name; tag names are case-insensitive.</p>
- <h5 id=start-tags>12.1.2.1 Start tags</h5>
- <p><dfn id=syntax-start-tag>Start tags</dfn> must have the following format:</p>
- <ol><li>The first character of a start tag must be a U+003C LESS-THAN SIGN character (<).<li>The next few characters of a start tag must be the element's <a href=#syntax-tag-name id=start-tags:syntax-tag-name>tag name</a>.<li>If there are to be any attributes in the next step, there must first be one or more <a href=#space-character id=start-tags:space-character>space characters</a>.<li>Then, the start tag may have a number of attributes, the <a href=#syntax-attributes id=start-tags:syntax-attributes>syntax for which</a> is described below. Attributes must be
- separated from each other by one or more <a href=#space-character id=start-tags:space-character-2>space
- characters</a>.<li>After the attributes, or after the <a href=#syntax-tag-name id=start-tags:syntax-tag-name-2>tag name</a> if there are
- no attributes, there may be one or more <a href=#space-character id=start-tags:space-character-3>space characters</a>.
- (Some attributes are required to be followed by a space. See the <a href=#syntax-attributes id=start-tags:syntax-attributes-2>attributes section</a> below.)<li>Then, if the element is one of the <a href=#void-elements id=start-tags:void-elements>void elements</a>, or if the element is a <a href=#foreign-elements id=start-tags:foreign-elements>foreign element</a>, then there may be a single U+002F SOLIDUS
- character (/). This character has no effect on <a href=#void-elements id=start-tags:void-elements-2>void elements</a>, but on <a href=#foreign-elements id=start-tags:foreign-elements-2>foreign
- elements</a> it marks the start tag as self-closing.<li>Finally, start tags must be closed by a U+003E GREATER-THAN SIGN character (>).</ol>
- <h5 id=end-tags>12.1.2.2 End tags</h5>
- <p><dfn id=syntax-end-tag>End tags</dfn> must have the following format:</p>
- <ol><li>The first character of an end tag must be a U+003C LESS-THAN SIGN character (<).<li>The second character of an end tag must be a U+002F SOLIDUS character (/).<li>The next few characters of an end tag must be the element's <a href=#syntax-tag-name id=end-tags:syntax-tag-name>tag
- name</a>.<li>After the tag name, there may be one or more <a href=#space-character id=end-tags:space-character>space
- characters</a>.<li>Finally, end tags must be closed by a U+003E GREATER-THAN SIGN character (>).</ol>
- <h5 id=attributes-2>12.1.2.3 Attributes</h5>
- <p><dfn id=syntax-attributes>Attributes</dfn> for an element are expressed inside the
- element's start tag.</p>
- <p>Attributes have a name and a value. <dfn id=syntax-attribute-name>Attribute names</dfn>
- must consist of one or more characters other than the <a href=#space-character id=attributes-2:space-character>space
- characters</a>, U+0000 NULL, U+0022 QUOTATION MARK ("), U+0027 APOSTROPHE ('), U+003E
- GREATER-THAN SIGN (>), U+002F SOLIDUS (/), and U+003D EQUALS SIGN (=) characters, the <a href=#control-characters id=attributes-2:control-characters>control
- characters</a>, and any characters that are not defined by Unicode. In the HTML syntax, attribute
- names, even those for <a href=#foreign-elements id=attributes-2:foreign-elements>foreign elements</a>, may be written with any mix of lower- and
- uppercase letters that are an <a href=#ascii-case-insensitive id=attributes-2:ascii-case-insensitive>ASCII case-insensitive</a> match for the attribute's
- name.</p>
- <p><dfn id=syntax-attribute-value>Attribute values</dfn> are a mixture of <a href=#syntax-text id=attributes-2:syntax-text>text</a> and <a href=#syntax-charref id=attributes-2:syntax-charref>character references</a>,
- except with the additional restriction that the text cannot contain an <a href=#syntax-ambiguous-ampersand id=attributes-2:syntax-ambiguous-ampersand>ambiguous ampersand</a>.</p>
- <p>Attributes can be specified in four different ways:</p>
- <dl><dt>Empty attribute syntax<dd>
- <p>Just the <a href=#syntax-attribute-name id=attributes-2:syntax-attribute-name>attribute name</a>. The value is implicitly
- the empty string.</p>
- <div class=example>
- <p>In the following example, the <code id=attributes-2:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code> attribute is
- given with the empty attribute syntax:</p>
- <pre><input <em>disabled</em>></pre>
- </div>
- <p>If an attribute using the empty attribute syntax is to be followed by another attribute, then
- there must be a <a href=#space-character id=attributes-2:space-character-2>space character</a> separating the two.</p>
- <dt id=unquoted>Unquoted attribute value syntax<dd>
- <p>The <a href=#syntax-attribute-name id=attributes-2:syntax-attribute-name-2>attribute name</a>, followed by zero or more <a href=#space-character id=attributes-2:space-character-3>space characters</a>, followed by a single U+003D EQUALS SIGN
- character, followed by zero or more <a href=#space-character id=attributes-2:space-character-4>space characters</a>,
- followed by the <a href=#syntax-attribute-value id=attributes-2:syntax-attribute-value>attribute value</a>, which, in addition
- to the requirements given above for attribute values, must not contain any literal <a href=#space-character id=attributes-2:space-character-5>space characters</a>, any U+0022 QUOTATION MARK characters ("),
- U+0027 APOSTROPHE characters ('), U+003D EQUALS SIGN characters (=), U+003C LESS-THAN SIGN
- characters (<), U+003E GREATER-THAN SIGN characters (>), or U+0060 GRAVE ACCENT characters
- (`), and must not be the empty string.</p>
-
- <div class=example>
- <p>In the following example, the <code id=attributes-2:attr-input-value><a href=#attr-input-value>value</a></code> attribute is given
- with the unquoted attribute value syntax:</p>
- <pre><input <em>value=yes</em>></pre>
- </div>
- <p>If an attribute using the unquoted attribute syntax is to be followed by another attribute or
- by the optional U+002F SOLIDUS character (/) allowed in step 6 of the <a href=#syntax-start-tag id=attributes-2:syntax-start-tag>start tag</a> syntax above, then there must be a <a href=#space-character id=attributes-2:space-character-6>space
- character</a> separating the two.</p>
- <dt>Single-quoted attribute value syntax<dd>
- <p>The <a href=#syntax-attribute-name id=attributes-2:syntax-attribute-name-3>attribute name</a>, followed by zero or more <a href=#space-character id=attributes-2:space-character-7>space characters</a>, followed by a single U+003D EQUALS SIGN
- character, followed by zero or more <a href=#space-character id=attributes-2:space-character-8>space characters</a>,
- followed by a single U+0027 APOSTROPHE character ('), followed by the <a href=#syntax-attribute-value id=attributes-2:syntax-attribute-value-2>attribute value</a>, which, in addition to the requirements
- given above for attribute values, must not contain any literal U+0027 APOSTROPHE characters ('),
- and finally followed by a second single U+0027 APOSTROPHE character (').</p>
- <div class=example>
- <p>In the following example, the <code id=attributes-2:attr-input-type><a href=#attr-input-type>type</a></code> attribute is given
- with the single-quoted attribute value syntax:</p>
- <pre><input <em>type='checkbox'</em>></pre>
- </div>
- <p>If an attribute using the single-quoted attribute syntax is to be followed by another
- attribute, then there must be a <a href=#space-character id=attributes-2:space-character-9>space character</a> separating the two.</p>
- <dt>Double-quoted attribute value syntax<dd>
- <p>The <a href=#syntax-attribute-name id=attributes-2:syntax-attribute-name-4>attribute name</a>, followed by zero or more <a href=#space-character id=attributes-2:space-character-10>space characters</a>, followed by a single U+003D EQUALS SIGN
- character, followed by zero or more <a href=#space-character id=attributes-2:space-character-11>space characters</a>,
- followed by a single U+0022 QUOTATION MARK character ("), followed by the <a href=#syntax-attribute-value id=attributes-2:syntax-attribute-value-3>attribute value</a>, which, in addition to the requirements
- given above for attribute values, must not contain any literal U+0022 QUOTATION MARK characters
- ("), and finally followed by a second single U+0022 QUOTATION MARK character (").</p>
- <div class=example>
- <p>In the following example, the <code id=attributes-2:attr-fe-name><a href=#attr-fe-name>name</a></code> attribute is given with
- the double-quoted attribute value syntax:</p>
- <pre><input <em>name="be evil"</em>></pre>
- </div>
- <p>If an attribute using the double-quoted attribute syntax is to be followed by another
- attribute, then there must be a <a href=#space-character id=attributes-2:space-character-12>space character</a> separating the two.</p>
- </dl>
- <p>There must never be two or more attributes on the same start tag whose names are an <a href=#ascii-case-insensitive id=attributes-2:ascii-case-insensitive-2>ASCII
- case-insensitive</a> match for each other.</p>
- <hr>
- <p>When a <a href=#foreign-elements id=attributes-2:foreign-elements-2>foreign element</a> has one of the namespaced
- attributes given by the local name and namespace of the first and second cells of a row from the
- following table, it must be written using the name given by the third cell from the same row.</p>
- <table><thead><tr><th> Local name <th> Namespace <th> Attribute name
- <tbody><tr><td> <code>actuate</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace>XLink namespace</a> <td> <code>xlink:actuate</code>
- <tr><td> <code>arcrole</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-2>XLink namespace</a> <td> <code>xlink:arcrole</code>
- <tr><td> <code>href</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-3>XLink namespace</a> <td> <code>xlink:href</code>
- <tr><td> <code>role</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-4>XLink namespace</a> <td> <code>xlink:role</code>
- <tr><td> <code>show</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-5>XLink namespace</a> <td> <code>xlink:show</code>
- <tr><td> <code>title</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-6>XLink namespace</a> <td> <code>xlink:title</code>
- <tr><td> <code>type</code> <td> <a href=#xlink-namespace id=attributes-2:xlink-namespace-7>XLink namespace</a> <td> <code>xlink:type</code>
- <tr><td> <code>base</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace>XML namespace</a> <td> <code>xml:base</code>
- <tr><td> <code>lang</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace-2>XML namespace</a> <td> <code>xml:lang</code>
- <tr><td> <code>space</code> <td> <a href=#xml-namespace id=attributes-2:xml-namespace-3>XML namespace</a> <td> <code>xml:space</code>
- <tr><td> <code>xmlns</code> <td> <a href=#xmlns-namespace id=attributes-2:xmlns-namespace>XMLNS namespace</a> <td> <code>xmlns</code>
- <tr><td> <code>xlink</code> <td> <a href=#xmlns-namespace id=attributes-2:xmlns-namespace-2>XMLNS namespace</a> <td> <code>xmlns:xlink</code>
- </table>
- <p>No other namespaced attribute can be expressed in <a href=#syntax id=attributes-2:syntax>the HTML syntax</a>.</p>
- <p class=note>Whether the attributes in the table above are conforming or not is defined by
- other specifications (e.g. the SVG and MathML specifications); this section only describes the
- syntax rules if the attributes are serialised using the HTML syntax.</p>
- <h5 id=optional-tags>12.1.2.4 Optional tags</h5>
- <p>Certain tags can be <dfn id=syntax-tag-omission>omitted</dfn>.</p>
- <p class=note>Omitting an element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag>start tag</a> in the
- situations described below does not mean the element is not present; it is implied, but it is
- still there. For example, an HTML document always has a root <code id=optional-tags:the-html-element><a href=#the-html-element>html</a></code> element, even if
- the string <code><html></code> doesn't appear anywhere in the markup.</p>
-
- <p>An <code id=optional-tags:the-html-element-2><a href=#the-html-element>html</a></code> element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-2>start tag</a> may be omitted
- if the first thing inside the <code id=optional-tags:the-html-element-3><a href=#the-html-element>html</a></code> element is not a <a href=#syntax-comments id=optional-tags:syntax-comments>comment</a>.</p>
- <div class=example>
- <p>For example, in the following case it's ok to remove the "<code><html></code>"
- tag:</p>
- <pre><!DOCTYPE HTML>
- <strong><html></strong>
- <head>
- <title>Hello</title>
- </head>
- <body>
- <p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>Doing so would make the document look like this:</p>
- <pre><!DOCTYPE HTML>
- <head>
- <title>Hello</title>
- </head>
- <body>
- <p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>This has the exact same DOM. In particular, note that white space around the root element is
- ignored by the parser. The following example would also have the exact same DOM:</p>
- <pre><!DOCTYPE HTML><head>
- <title>Hello</title>
- </head>
- <body>
- <p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>However, in the following example, removing the start tag moves the comment to before the
- <code id=optional-tags:the-html-element-4><a href=#the-html-element>html</a></code> element:</p>
- <pre><!DOCTYPE HTML>
- <html>
- <strong><!-- where is this comment in the DOM? --></strong>
- <head>
- <title>Hello</title>
- </head>
- <body>
- <p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>With the tag removed, the document actually turns into the same as this:</p>
- <pre><!DOCTYPE HTML>
- <!-- where is this comment in the DOM? -->
- <small><html></small>
- <head>
- <title>Hello</title>
- </head>
- <body>
- <p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>This is why the tag can only be removed if it is not followed by a comment: removing the tag
- when there is a comment there changes the document's resulting parse tree. Of course, if the
- position of the comment does not matter, then the tag can be omitted, as if the comment had been
- moved to before the start tag in the first place.</p>
- </div>
-
- <p>An <code id=optional-tags:the-html-element-5><a href=#the-html-element>html</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag>end tag</a> may be omitted if
- the <code id=optional-tags:the-html-element-6><a href=#the-html-element>html</a></code> element is not immediately followed by a <a href=#syntax-comments id=optional-tags:syntax-comments-2>comment</a>.</p>
-
- <p>A <code id=optional-tags:the-head-element><a href=#the-head-element>head</a></code> element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-3>start tag</a> may be omitted if
- the element is empty, or if the first thing inside the <code id=optional-tags:the-head-element-2><a href=#the-head-element>head</a></code> element is an
- element.</p>
-
- <p>A <code id=optional-tags:the-head-element-3><a href=#the-head-element>head</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-2>end tag</a> may be omitted if the
- <code id=optional-tags:the-head-element-4><a href=#the-head-element>head</a></code> element is not immediately followed by a <a href=#space-character id=optional-tags:space-character>space character</a> or a <a href=#syntax-comments id=optional-tags:syntax-comments-3>comment</a>.</p>
-
- <p>A <code id=optional-tags:the-body-element><a href=#the-body-element>body</a></code> element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-4>start tag</a> may be omitted
- if the element is empty, or if the first thing inside the <code id=optional-tags:the-body-element-2><a href=#the-body-element>body</a></code> element is not a
- <a href=#space-character id=optional-tags:space-character-2>space character</a> or a <a href=#syntax-comments id=optional-tags:syntax-comments-4>comment</a>, except if the
- first thing inside the <code id=optional-tags:the-body-element-3><a href=#the-body-element>body</a></code> element is a <code id=optional-tags:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=optional-tags:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=optional-tags:the-script-element><a href=#the-script-element>script</a></code>, <code id=optional-tags:the-style-element><a href=#the-style-element>style</a></code>, or <code id=optional-tags:the-template-element><a href=#the-template-element>template</a></code> element. </p>
-
- <p>A <code id=optional-tags:the-body-element-4><a href=#the-body-element>body</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-3>end tag</a> may be omitted if the
- <code id=optional-tags:the-body-element-5><a href=#the-body-element>body</a></code> element is not immediately followed by a <a href=#syntax-comments id=optional-tags:syntax-comments-5>comment</a>.</p>
- <div class=example>
- <p>Note that in the example above, the <code id=optional-tags:the-head-element-5><a href=#the-head-element>head</a></code> element start and end tags, and the
- <code id=optional-tags:the-body-element-6><a href=#the-body-element>body</a></code> element start tag, can't be omitted, because they are surrounded by white
- space:</p>
- <pre><!DOCTYPE HTML>
- <html><strong>
- </strong><head><strong>
- </strong><title>Hello</title><strong>
- </strong></head><strong>
- </strong><body><strong>
- </strong><p>Welcome to this example.</p>
- </body>
- </html></pre>
- <p>(The <code id=optional-tags:the-body-element-7><a href=#the-body-element>body</a></code> and <code id=optional-tags:the-html-element-7><a href=#the-html-element>html</a></code> element end tags could be omitted without
- trouble; any spaces after those get parsed into the <code id=optional-tags:the-body-element-8><a href=#the-body-element>body</a></code> element anyway.)</p>
- <p>Usually, however, white space isn't an issue. If we first remove the white space we don't care
- about:</p>
- <pre><!DOCTYPE HTML><html><head><title>Hello</title></head><body><p>Welcome to this example.</p></body></html></pre>
- <p>Then we can omit a number of tags without affecting the DOM:</p>
- <pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.</p></pre>
- <p>At that point, we can also add some white space back:</p>
- <pre><!DOCTYPE HTML>
- <title>Hello</title>
- <p>Welcome to this example.</p></pre>
- <p>This would be equivalent to this document, with the omitted tags shown in their
- parser-implied positions; the only white space text node that results from this is the newline at
- the end of the <code id=optional-tags:the-head-element-6><a href=#the-head-element>head</a></code> element:</p>
- <pre><!DOCTYPE HTML>
- <small><html><head></small><title>Hello</title>
- <small></head><body></small><p>Welcome to this example.</p><small></body></html></small></pre>
- </div>
-
- <p>An <code id=optional-tags:the-li-element><a href=#the-li-element>li</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-4>end tag</a> may be omitted if the
- <code id=optional-tags:the-li-element-2><a href=#the-li-element>li</a></code> element is immediately followed by another <code id=optional-tags:the-li-element-3><a href=#the-li-element>li</a></code> element or if there is
- no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-dt-element><a href=#the-dt-element>dt</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-5>end tag</a> may be omitted if the
- <code id=optional-tags:the-dt-element-2><a href=#the-dt-element>dt</a></code> element is immediately followed by another <code id=optional-tags:the-dt-element-3><a href=#the-dt-element>dt</a></code> element or a
- <code id=optional-tags:the-dd-element><a href=#the-dd-element>dd</a></code> element.</p>
-
- <p>A <code id=optional-tags:the-dd-element-2><a href=#the-dd-element>dd</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-6>end tag</a> may be omitted if the
- <code id=optional-tags:the-dd-element-3><a href=#the-dd-element>dd</a></code> element is immediately followed by another <code id=optional-tags:the-dd-element-4><a href=#the-dd-element>dd</a></code> element or a
- <code id=optional-tags:the-dt-element-4><a href=#the-dt-element>dt</a></code> element, or if there is no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-p-element><a href=#the-p-element>p</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-7>end tag</a> may be omitted if the
- <code id=optional-tags:the-p-element-2><a href=#the-p-element>p</a></code> element is immediately followed by an <code id=optional-tags:the-address-element><a href=#the-address-element>address</a></code>, <code id=optional-tags:the-article-element><a href=#the-article-element>article</a></code>,
- <code id=optional-tags:the-aside-element><a href=#the-aside-element>aside</a></code>, <code id=optional-tags:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>, <code id=optional-tags:the-div-element><a href=#the-div-element>div</a></code>, <code id=optional-tags:the-dl-element><a href=#the-dl-element>dl</a></code>,
- <code id=optional-tags:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>, <code id=optional-tags:the-footer-element><a href=#the-footer-element>footer</a></code>, <code id=optional-tags:the-form-element><a href=#the-form-element>form</a></code>, <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>,
- <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=optional-tags:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code id=optional-tags:the-header-element><a href=#the-header-element>header</a></code>,
- <code id=optional-tags:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>, <code id=optional-tags:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=optional-tags:the-main-element><a href=#the-main-element>main</a></code>, <code id=optional-tags:the-menu-element><a href=#the-menu-element>menu</a></code>, <code id=optional-tags:the-nav-element><a href=#the-nav-element>nav</a></code>,
- <code id=optional-tags:the-ol-element><a href=#the-ol-element>ol</a></code>, <code id=optional-tags:the-p-element-3><a href=#the-p-element>p</a></code>, <code id=optional-tags:the-pre-element><a href=#the-pre-element>pre</a></code>, <code id=optional-tags:the-section-element><a href=#the-section-element>section</a></code>, <code id=optional-tags:the-table-element><a href=#the-table-element>table</a></code>, or
- <code id=optional-tags:the-ul-element><a href=#the-ul-element>ul</a></code>, element, or if there is no more content in the parent element and the parent
- element is not an <code id=optional-tags:the-a-element><a href=#the-a-element>a</a></code> element.</p>
- <div class=example>
- <p>We can thus simplify the earlier example further:
- <pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.<small></p></small></pre>
- </div>
-
- <p>An <code id=optional-tags:the-rt-element><a href=#the-rt-element>rt</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-8>end tag</a> may be omitted if the
- <code id=optional-tags:the-rt-element-2><a href=#the-rt-element>rt</a></code> element is immediately followed by an <code id=optional-tags:the-rt-element-3><a href=#the-rt-element>rt</a></code> or <code id=optional-tags:the-rp-element><a href=#the-rp-element>rp</a></code> element,
- or if there is no more content in the parent element.</p>
-
- <p>An <code id=optional-tags:the-rp-element-2><a href=#the-rp-element>rp</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-9>end tag</a> may be omitted if the
- <code id=optional-tags:the-rp-element-3><a href=#the-rp-element>rp</a></code> element is immediately followed by an <code id=optional-tags:the-rt-element-4><a href=#the-rt-element>rt</a></code> or <code id=optional-tags:the-rp-element-4><a href=#the-rp-element>rp</a></code> element,
- or if there is no more content in the parent element.</p>
-
- <p>An <code id=optional-tags:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-10>end tag</a> may be omitted
- if the <code id=optional-tags:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element is
- immediately followed by another <code id=optional-tags:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content in
- the parent element.</p>
-
-
- <p>An <code id=optional-tags:the-option-element><a href=#the-option-element>option</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-11>end tag</a> may be omitted if
- the <code id=optional-tags:the-option-element-2><a href=#the-option-element>option</a></code> element is immediately followed by another <code id=optional-tags:the-option-element-3><a href=#the-option-element>option</a></code> element, or
- if it is immediately followed by an <code id=optional-tags:the-optgroup-element-4><a href=#the-optgroup-element>optgroup</a></code> element, or if there is no more content
- in the parent element.</p>
-
- <p>A <code id=optional-tags:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-5>start tag</a> may be
- omitted if the first thing inside the <code id=optional-tags:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> element is a <code id=optional-tags:the-col-element><a href=#the-col-element>col</a></code> element,
- and if the element is not immediately preceded by another <code id=optional-tags:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code> element whose
- <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-12>end tag</a> has been omitted. (It can't be omitted if the element
- is empty.)</p>
-
- <p>A <code id=optional-tags:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-13>end tag</a> may be omitted if
- the <code id=optional-tags:the-colgroup-element-5><a href=#the-colgroup-element>colgroup</a></code> element is not immediately followed by a <a href=#space-character id=optional-tags:space-character-3>space character</a> or
- a <a href=#syntax-comments id=optional-tags:syntax-comments-6>comment</a>.</p>
-
- <p>A <code id=optional-tags:the-caption-element><a href=#the-caption-element>caption</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-14>end tag</a> may be omitted if
- the <code id=optional-tags:the-caption-element-2><a href=#the-caption-element>caption</a></code> element is not immediately followed by a <a href=#space-character id=optional-tags:space-character-4>space character</a> or
- a <a href=#syntax-comments id=optional-tags:syntax-comments-7>comment</a>.</p>
-
- <p>A <code id=optional-tags:the-thead-element><a href=#the-thead-element>thead</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-15>end tag</a> may be omitted if
- the <code id=optional-tags:the-thead-element-2><a href=#the-thead-element>thead</a></code> element is immediately followed by a <code id=optional-tags:the-tbody-element><a href=#the-tbody-element>tbody</a></code> or
- <code id=optional-tags:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element.</p>
-
- <p>A <code id=optional-tags:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-6>start tag</a> may be omitted
- if the first thing inside the <code id=optional-tags:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> element is a <code id=optional-tags:the-tr-element><a href=#the-tr-element>tr</a></code> element, and if the
- element is not immediately preceded by a <code id=optional-tags:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, <code id=optional-tags:the-thead-element-3><a href=#the-thead-element>thead</a></code>, or
- <code id=optional-tags:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element whose <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-16>end tag</a> has been omitted. (It
- can't be omitted if the element is empty.)</p>
-
- <p>A <code id=optional-tags:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-17>end tag</a> may be omitted if
- the <code id=optional-tags:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code> element is immediately followed by a <code id=optional-tags:the-tbody-element-7><a href=#the-tbody-element>tbody</a></code> or
- <code id=optional-tags:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> element, or if there is no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-18>end tag</a> may be omitted if
- the <code id=optional-tags:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code> element is immediately followed by a <code id=optional-tags:the-tbody-element-8><a href=#the-tbody-element>tbody</a></code> element, or if
- there is no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-tr-element-2><a href=#the-tr-element>tr</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-19>end tag</a> may be omitted if the
- <code id=optional-tags:the-tr-element-3><a href=#the-tr-element>tr</a></code> element is immediately followed by another <code id=optional-tags:the-tr-element-4><a href=#the-tr-element>tr</a></code> element, or if there is
- no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-td-element><a href=#the-td-element>td</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-20>end tag</a> may be omitted if the
- <code id=optional-tags:the-td-element-2><a href=#the-td-element>td</a></code> element is immediately followed by a <code id=optional-tags:the-td-element-3><a href=#the-td-element>td</a></code> or <code id=optional-tags:the-th-element><a href=#the-th-element>th</a></code> element,
- or if there is no more content in the parent element.</p>
-
- <p>A <code id=optional-tags:the-th-element-2><a href=#the-th-element>th</a></code> element's <a href=#syntax-end-tag id=optional-tags:syntax-end-tag-21>end tag</a> may be omitted if the
- <code id=optional-tags:the-th-element-3><a href=#the-th-element>th</a></code> element is immediately followed by a <code id=optional-tags:the-td-element-4><a href=#the-td-element>td</a></code> or <code id=optional-tags:the-th-element-4><a href=#the-th-element>th</a></code> element,
- or if there is no more content in the parent element.</p>
- <div class=example>
- <p>The ability to omit all these table-related tags makes table markup much terser.</p>
- <p>Take this example:</p>
- <pre><table>
- <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)</caption>
- <colgroup><col><col><col></colgroup>
- <thead>
- <tr>
- <th>Function</th>
- <th>Control Unit</th>
- <th>Central Station</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>Headlights</td>
- <td>✔</td>
- <td>✔</td>
- </tr>
- <tr>
- <td>Interior Lights</td>
- <td>✔</td>
- <td>✔</td>
- </tr>
- <tr>
- <td>Electric locomotive operating sounds</td>
- <td>✔</td>
- <td>✔</td>
- </tr>
- <tr>
- <td>Engineer's cab lighting</td>
- <td></td>
- <td>✔</td>
- </tr>
- <tr>
- <td>Station Announcements - Swiss</td>
- <td></td>
- <td>✔</td>
- </tr>
- </tbody>
- </table></pre>
- <p>The exact same table, modulo some white space differences, could be marked up as follows:</p>
- <pre><table>
- <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)
- <colgroup><col><col><col>
- <thead>
- <tr>
- <th>Function
- <th>Control Unit
- <th>Central Station
- <tbody>
- <tr>
- <td>Headlights
- <td>✔
- <td>✔
- <tr>
- <td>Interior Lights
- <td>✔
- <td>✔
- <tr>
- <td>Electric locomotive operating sounds
- <td>✔
- <td>✔
- <tr>
- <td>Engineer's cab lighting
- <td>
- <td>✔
- <tr>
- <td>Station Announcements - Swiss
- <td>
- <td>✔
- </table></pre>
- <p>Since the cells take up much less room this way, this can be made even terser by having each
- row on one line:</p>
- <pre><table>
- <caption>37547 TEE Electric Powered Rail Car Train Functions (Abbreviated)
- <colgroup><col><col><col>
- <thead>
- <tr> <th>Function <th>Control Unit <th>Central Station
- <tbody>
- <tr> <td>Headlights <td>✔ <td>✔
- <tr> <td>Interior Lights <td>✔ <td>✔
- <tr> <td>Electric locomotive operating sounds <td>✔ <td>✔
- <tr> <td>Engineer's cab lighting <td> <td>✔
- <tr> <td>Station Announcements - Swiss <td> <td>✔
- </table></pre>
- <p>The only differences between these tables, at the DOM level, is with the precise position of
- the (in any case semantically-neutral) white space.</p>
- </div>
- <p><strong>However</strong>, a <a href=#syntax-start-tag id=optional-tags:syntax-start-tag-7>start tag</a> must never be
- omitted if it has any attributes.</p>
- <div class=example>
- <p>Returning to the earlier example with all the white space removed and then all the optional
- tags removed:</p>
- <pre><!DOCTYPE HTML><title>Hello</title><p>Welcome to this example.</pre>
- <p>If the <code id=optional-tags:the-body-element-9><a href=#the-body-element>body</a></code> element in this example had to have a <code id=optional-tags:classes><a href=#classes>class</a></code> attribute and the <code id=optional-tags:the-html-element-8><a href=#the-html-element>html</a></code> element had to have a <code id=optional-tags:attr-lang><a href=#attr-lang>lang</a></code> attribute, the markup would have to become:</p>
- <pre><!DOCTYPE HTML><html lang="en"><title>Hello</title><body class="demo"><p>Welcome to this example.</pre>
- </div>
- <p class=note>This section assumes that the document is conforming, in particular, that there
- are no <a href=#content-models id=optional-tags:content-models>content model</a> violations. Omitting tags in the fashion
- described in this section in a document that does not conform to the <a href=#content-models id=optional-tags:content-models-2>content models</a>
- described in this specification is likely to result in unexpected DOM differences (this is, in
- part, what the content models are designed to avoid).</p>
- <h5 id=element-restrictions>12.1.2.5 Restrictions on content models</h5>
- <p>For historical reasons, certain elements have extra restrictions beyond even the restrictions
- given by their content model.</p>
- <p>A <code id=element-restrictions:the-table-element><a href=#the-table-element>table</a></code> element must not contain <code id=element-restrictions:the-tr-element><a href=#the-tr-element>tr</a></code> elements, even though these
- elements are technically allowed inside <code id=element-restrictions:the-table-element-2><a href=#the-table-element>table</a></code> elements according to the content
- models described in this specification. (If a <code id=element-restrictions:the-tr-element-2><a href=#the-tr-element>tr</a></code> element is put inside a
- <code id=element-restrictions:the-table-element-3><a href=#the-table-element>table</a></code> in the markup, it will in fact imply a <code id=element-restrictions:the-tbody-element><a href=#the-tbody-element>tbody</a></code> start tag before
- it.)</p>
- <p>A single <a href=#syntax-newlines id=element-restrictions:syntax-newlines>newline</a> may be placed immediately after the <a href=#syntax-start-tag id=element-restrictions:syntax-start-tag>start tag</a> of <code id=element-restrictions:the-pre-element><a href=#the-pre-element>pre</a></code> and <code id=element-restrictions:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements.
- This does not affect the processing of the element. The otherwise optional <a href=#syntax-newlines id=element-restrictions:syntax-newlines-2>newline</a> <em>must</em> be included if the element's contents
- themselves start with a <a href=#syntax-newlines id=element-restrictions:syntax-newlines-3>newline</a> (because otherwise the
- leading newline in the contents would be treated like the optional newline, and ignored).</p>
- <div class=example>
- <p>The following two <code id=element-restrictions:the-pre-element-2><a href=#the-pre-element>pre</a></code> blocks are equivalent:</p>
- <pre><pre>Hello</pre></pre>
- <pre><pre><br>Hello</pre></pre>
- </div>
- <h5 id=cdata-rcdata-restrictions>12.1.2.6 Restrictions on the contents of raw text and escapable raw text elements</h5>
- <p>The text in <a href=#raw-text-elements id=cdata-rcdata-restrictions:raw-text-elements>raw text</a> and <a href=#escapable-raw-text-elements id=cdata-rcdata-restrictions:escapable-raw-text-elements>escapable raw text
- elements</a> must not contain any occurrences of the string "<code></</code>"
- (U+003C LESS-THAN SIGN, U+002F SOLIDUS) followed by characters that case-insensitively match the
- tag name of the element followed by one of U+0009 CHARACTER TABULATION (tab), U+000A LINE FEED
- (LF), U+000C FORM FEED (FF), U+000D CARRIAGE RETURN (CR), U+0020 SPACE, U+003E GREATER-THAN SIGN
- (>), or U+002F SOLIDUS (/).</p>
- <h4 id=text-2>12.1.3 Text</h4>
- <p><dfn id=syntax-text>Text</dfn> is allowed inside elements, attribute values, and comments.
- Extra constraints are placed on what is and what is not allowed in text based on where the text is
- to be put, as described in the other sections.</p>
- <h5 id=newlines>12.1.3.1 Newlines</h5>
- <p><dfn id=syntax-newlines>Newlines</dfn> in HTML may be represented either as U+000D
- CARRIAGE RETURN (CR) characters, U+000A LINE FEED (LF) characters, or pairs of U+000D CARRIAGE
- RETURN (CR), U+000A LINE FEED (LF) characters in that order.</p>
- <p>Where <a href=#syntax-charref id=newlines:syntax-charref>character references</a> are allowed, a character
- reference of a U+000A LINE FEED (LF) character (but not a U+000D CARRIAGE RETURN (CR) character)
- also represents a <a href=#syntax-newlines id=newlines:syntax-newlines>newline</a>.</p>
- <h4 id=character-references>12.1.4 Character references</h4>
- <p>In certain cases described in other sections, <a href=#syntax-text id=character-references:syntax-text>text</a> may be
- mixed with <dfn id=syntax-charref>character references</dfn>. These can be used to escape
- characters that couldn't otherwise legally be included in <a href=#syntax-text id=character-references:syntax-text-2>text</a>.</p>
- <p>Character references must start with a U+0026 AMPERSAND character (&). Following this,
- there are three possible kinds of character references:</p>
- <dl><dt>Named character references<dd>The ampersand must be followed by one of the names given in the <a href=#named-character-references id=character-references:named-character-references>named character
- references</a> section, using the same case. The name must be one that is
- terminated by a U+003B SEMICOLON character (;).<dt>Decimal numeric character reference<dd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), followed by one or more
- <a href=#ascii-digits id=character-references:ascii-digits>ASCII digits</a>, representing a base-ten integer that corresponds to a Unicode code
- point that is allowed according to the definition below. The digits must then be followed by a
- U+003B SEMICOLON character (;).<dt>Hexadecimal numeric character reference<dd>The ampersand must be followed by a U+0023 NUMBER SIGN character (#), which must be followed
- by either a U+0078 LATIN SMALL LETTER X character (x) or a U+0058 LATIN CAPITAL LETTER X
- character (X), which must then be followed by one or more <a href=#ascii-hex-digits id=character-references:ascii-hex-digits>ASCII hex digits</a>,
- representing a hexadecimal integer that corresponds to a Unicode code point that is allowed
- according to the definition below. The digits must then be followed by a U+003B SEMICOLON
- character (;).</dl>
- <p>The numeric character reference forms described above are allowed to reference any Unicode code
- point other than U+0000, U+000D, permanently undefined Unicode characters (noncharacters),
- surrogates (U+D800–U+DFFF), and <a href=#control-characters id=character-references:control-characters>control characters</a> other than <a href=#space-character id=character-references:space-character>space characters</a>.</p>
- <p>An <dfn id=syntax-ambiguous-ampersand>ambiguous ampersand</dfn> is a U+0026 AMPERSAND
- character (&) that is followed by one or more <a href=#alphanumeric-ascii-characters id=character-references:alphanumeric-ascii-characters>alphanumeric ASCII characters</a>,
- followed by a U+003B SEMICOLON character (;), where these characters do not match any of the names
- given in the <a href=#named-character-references id=character-references:named-character-references-2>named character references</a> section.</p>
- <h4 id=cdata-sections>12.1.5 CDATA sections</h4>
- <p><dfn id=syntax-cdata>CDATA sections</dfn> must consist of the following components, in
- this order:</p>
- <ol><li>The string "<code><![CDATA[</code>".<li>Optionally, <a href=#syntax-text id=cdata-sections:syntax-text>text</a>, with the additional restriction that the
- text must not contain the string "<code>]]></code>".<li>The string "<code>]]></code>".</ol>
- <div class=example>
- <p>CDATA sections can only be used in foreign content (MathML or SVG). In this example, a CDATA
- section is used to escape the contents of an <code id=cdata-sections:math:ms><a href=#math:ms>ms</a></code> element:</p>
- <pre><p>You can add a string to a number, but this stringifies the number:</p>
- <math>
- <ms><![CDATA[x<y]]></ms>
- <mo>+</mo>
- <mn>3</mn>
- <mo>=</mo>
- <ms><![CDATA[x<y3]]></ms>
- </math></pre>
- </div>
- <h4 id=comments>12.1.6 Comments</h4>
- <p><dfn id=syntax-comments>Comments</dfn> must start with the four character sequence U+003C
- LESS-THAN SIGN, U+0021 EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS (<code><!--</code>). Following this sequence, the comment may have <a href=#syntax-text id=comments:syntax-text>text</a>, with the additional restriction that the text must not start with
- a single U+003E GREATER-THAN SIGN character (>), nor start with a U+002D HYPHEN-MINUS character
- (-) followed by a U+003E GREATER-THAN SIGN (>) character, nor contain two consecutive U+002D
- HYPHEN-MINUS characters (<code>--</code>), nor end with a U+002D HYPHEN-MINUS character
- (-). Finally, the comment must be ended by the three character sequence U+002D HYPHEN-MINUS,
- U+002D HYPHEN-MINUS, U+003E GREATER-THAN SIGN (<code>--></code>).</p>
-
- <h3 id=parsing>12.2 Parsing HTML documents</h3>
- <p><i>This section only applies to user agents, data mining tools, and conformance
- checkers.</i></p>
- <p class=note>The rules for parsing XML documents into DOM trees are covered by the next
- section, entitled "<a href=#the-xhtml-syntax id=parsing:the-xhtml-syntax>The XHTML syntax</a>".</p>
- <p>User agents must use the parsing rules described in this section to generate the DOM trees from
- <code id=parsing:text/html><a href=#text/html>text/html</a></code> resources. Together, these rules define what is referred to as the
- <dfn id=html-parser>HTML parser</dfn>.</p>
- <div class=note>
- <p>While the HTML syntax described in this specification bears a close resemblance to SGML and
- XML, it is a separate language with its own parsing rules.</p>
- <p>Some earlier versions of HTML (in particular from HTML2 to HTML4) were based on SGML and used
- SGML parsing rules. However, few (if any) web browsers ever implemented true SGML parsing for
- HTML documents; the only user agents to strictly handle HTML as an SGML application have
- historically been validators. The resulting confusion — with validators claiming documents
- to have one representation while widely deployed Web browsers interoperably implemented a
- different representation — has wasted decades of productivity. This version of HTML thus
- returns to a non-SGML basis.</p>
- <p>Authors interested in using SGML tools in their authoring pipeline are encouraged to use XML
- tools and the XML serialisation of HTML.</p>
- </div>
- <p>This specification defines the parsing rules for HTML documents, whether they are syntactically
- correct or not. Certain points in the parsing algorithm are said to be <dfn id=parse-error>parse errors</dfn>. The error handling for parse errors is well-defined (that's the
- processing rules described throughout this specification), but user agents, while parsing an HTML
- document, may <a href=#abort-a-parser id=parsing:abort-a-parser>abort the parser</a> at the first <a href=#parse-error id=parsing:parse-error>parse
- error</a> that they encounter for which they do not wish to apply the rules described in this
- specification.</p>
- <p>Conformance checkers must report at least one parse error condition to the user if one or more
- parse error conditions exist in the document and must not report parse error conditions if none
- exist in the document. Conformance checkers may report more than one parse error condition if more
- than one parse error condition exists in the document.</p>
- <p class=note>Parse errors are only errors with the <em>syntax</em> of HTML. In addition to
- checking for parse errors, conformance checkers will also verify that the document obeys all the
- other conformance requirements described in this specification.</p>
- <p>For the purposes of conformance checkers, if a resource is determined to be in <a href=#syntax id=parsing:syntax>the HTML
- syntax</a>, then it is an <a href=#html-documents id=parsing:html-documents>HTML document</a>.</p>
- <p class=note>As stated <a href=#html-elements id=parsing:html-elements class=no-backref>in the terminology
- section</a>, references to <a href=#element-type id=parsing:element-type>element types</a> that do not
- explicitly specify a namespace always refer to elements in the <a href=#html-namespace-2 id=parsing:html-namespace-2>HTML namespace</a>. For
- example, if the spec talks about "a <code id=parsing:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code> element", then that is an element with
- the local name "<code>menuitem</code>", the namespace "<code>http://www.w3.org/1999/xhtml</code>", and the interface <code id=parsing:htmlmenuitemelement><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code>.
- Where possible, references to such elements are hyperlinked to their definition.</p>
-
-
- <h4 id=overview-of-the-parsing-model>12.2.1 Overview of the parsing model</h4>
- <p class=overview><object width=345 height=535 data=images/parsing-model-overview.svg><img src=http://images.whatwg.org/parsing-model-overview.png width=345 alt="" height=450></object></p>
- <p>The input to the HTML parsing process consists of a stream of <a href=#unicode-code-point id=overview-of-the-parsing-model:unicode-code-point>Unicode code points</a>, which is passed through a <a href=#tokenization id=overview-of-the-parsing-model:tokenization>tokenization</a> stage
- followed by a <a href=#tree-construction id=overview-of-the-parsing-model:tree-construction>tree construction</a> stage. The output is a <code id=overview-of-the-parsing-model:document><a href=#document>Document</a></code>
- object.</p>
- <p class=note>Implementations that <a href=#non-scripted>do not support scripting</a> do not
- have to actually create a DOM <code id=overview-of-the-parsing-model:document-2><a href=#document>Document</a></code> object, but the DOM tree in such cases is
- still used as the model for the rest of the specification.</p>
- <p>In the common case, the data handled by the tokenization stage comes from the network, but
- <a href=#dynamic-markup-insertion id=overview-of-the-parsing-model:dynamic-markup-insertion>it can also come from script</a> running in the user
- agent, e.g. using the <code id=overview-of-the-parsing-model:dom-document-write><a href=#dom-document-write>document.write()</a></code> API.</p>
- <p id=nestedParsing>There is only one set of states for the tokenizer stage and the tree
- construction stage, but the tree construction stage is reentrant, meaning that while the tree
- construction stage is handling one token, the tokenizer might be resumed, causing further tokens
- to be emitted and processed before the first token's processing is complete.</p>
- <div class=example>
- <p>In the following example, the tree construction stage will be called upon to handle a "p"
- start tag token while handling the "script" end tag token:</p>
- <pre>...
- <script>
- document.write('<p>');
- </script>
- ...</pre>
- </div>
- <p>To handle these cases, parsers have a <dfn id=script-nesting-level>script nesting level</dfn>, which must be initially
- set to zero, and a <dfn id=parser-pause-flag>parser pause flag</dfn>, which must be initially set to false.</p>
-
-
- <h4 id=the-input-byte-stream>12.2.2 The <dfn>input byte stream</dfn></h4>
- <p>The stream of Unicode code points that comprises the input to the tokenization stage will be
- initially seen by the user agent as a stream of bytes (typically coming over the network or from
- the local file system). The bytes encode the actual characters according to a particular
- <i>character encoding</i>, which the user agent uses to decode the bytes into characters.</p>
- <p class=note>For XML documents, the algorithm user agents are required to use to determine the
- character encoding is given by the XML specification. This section does not apply to XML
- documents. <a href=#refsXML>[XML]</a></p>
- <p>Usually, the <a href=#encoding-sniffing-algorithm id=the-input-byte-stream:encoding-sniffing-algorithm>encoding sniffing algorithm</a> defined below is used to determine the
- character encoding.</p>
- <p>Given a character encoding, the bytes in the <a href=#the-input-byte-stream id=the-input-byte-stream:the-input-byte-stream>input byte stream</a> must be converted
- to Unicode code points for the tokenizer's <a href=#input-stream id=the-input-byte-stream:input-stream>input stream</a>, as described by the rules
- for that encoding's <a href=#decoder id=the-input-byte-stream:decoder>decoder</a>.</p>
- <p class=note>Bytes or sequences of bytes in the original byte stream that did not conform to
- the Encoding standard (e.g. invalid UTF-8 byte sequences in a UTF-8 input byte stream) are errors
- that conformance checkers are expected to report. <a href=#refsENCODING>[ENCODING]</a></p>
- <p class=note>Leading Byte Order Marks (BOMs) are not stripped by the decoder algorithms, they
- are stripped by the algorithm below.</p>
- <p class=warning>The decoder algorithms describe how to handle invalid input; for security
- reasons, it is imperative that those rules be followed precisely. Differences in how invalid byte
- sequences are handled can result in, amongst other problems, script injection vulnerabilities
- ("XSS").</p>
- <p>When the HTML parser is decoding an input byte stream, it uses a character encoding and a <dfn id=concept-encoding-confidence>confidence</dfn>. The confidence is either <i>tentative</i>,
- <i>certain</i>, or <i>irrelevant</i>. The encoding used, and whether the confidence in that
- encoding is <i>tentative</i> or <i>certain</i>, is <a href=#meta-charset-during-parse>used
- during the parsing</a> to determine whether to <a href=#change-the-encoding id=the-input-byte-stream:change-the-encoding>change the encoding</a>. If no encoding is
- necessary, e.g. because the parser is operating on a Unicode stream and doesn't have to use a
- character encoding at all, then the <a href=#concept-encoding-confidence id=the-input-byte-stream:concept-encoding-confidence>confidence</a> is
- <i>irrelevant</i>.</p>
- <p class=note>Some algorithms feed the parser by directly adding characters to the <a href=#input-stream id=the-input-byte-stream:input-stream-2>input
- stream</a> rather than adding bytes to the <a href=#the-input-byte-stream id=the-input-byte-stream:the-input-byte-stream-2>input byte stream</a>.</p>
- <h5 id=parsing-with-a-known-character-encoding>12.2.2.1 Parsing with a known character encoding</h5>
- <p>When the HTML parser is to operate on an input byte stream that has <dfn id=a-known-definite-encoding>a known definite
- encoding</dfn>, then the character encoding is that encoding and the <a href=#concept-encoding-confidence id=parsing-with-a-known-character-encoding:concept-encoding-confidence>confidence</a> is <i>certain</i>.</p>
- <h5 id=determining-the-character-encoding>12.2.2.2 Determining the character encoding</h5>
- <p>In some cases, it might be impractical to unambiguously determine the encoding before parsing
- the document. Because of this, this specification provides for a two-pass mechanism with an
- optional pre-scan. Implementations are allowed, as described below, to apply a simplified parsing
- algorithm to whatever bytes they have available before beginning to parse the document. Then, the
- real parser is started, using a tentative encoding derived from this pre-parse and other
- out-of-band metadata. If, while the document is being loaded, the user agent discovers a character
- encoding declaration that conflicts with this information, then the parser can get reinvoked to
- perform a parse of the document with the real encoding.</p>
- <p id=documentEncoding>User agents must use the following algorithm, called the <dfn id=encoding-sniffing-algorithm>encoding
- sniffing algorithm</dfn>, to determine the character encoding to use when decoding a document in
- the first pass. This algorithm takes as input any out-of-band metadata available to the user agent
- (e.g. the <a href=#content-type id=determining-the-character-encoding:content-type>Content-Type metadata</a> of the document) and all the
- bytes available so far, and returns a character encoding and a <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence>confidence</a> that is either <i>tentative</i> or
- <i>certain</i>.</p>
- <ol><li>
- <p>If the user has explicitly instructed the user agent to override the document's character
- encoding with a specific encoding, optionally return that encoding with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-2>confidence</a> <i>certain</i> and abort these steps.</p>
- <p class=note>Typically, user agents remember such user requests across sessions, and in some
- cases apply them to documents in <code id=determining-the-character-encoding:the-iframe-element><a href=#the-iframe-element>iframe</a></code>s as well.</p>
- <li>
- <p>The user agent may wait for more bytes of the resource to be available, either in this step
- or at any later step in this algorithm. For instance, a user agent might wait 500ms or 1024
- bytes, whichever came first. In general preparsing the source to find the encoding improves
- performance, as it reduces the need to throw away the data structures used when parsing upon
- finding the encoding information. However, if the user agent delays too long to obtain data to
- determine the encoding, then the cost of the delay could outweigh any performance improvements
- from the preparse.</p>
- <p class=note>The authoring conformance requirements for character encoding declarations limit
- them to only appearing <a href=#charset1024>in the first 1024 bytes</a>. User agents are
- therefore encouraged to use the prescan algorithm below (as invoked by these steps) on the first
- 1024 bytes, but not to stall beyond that.</p>
- <li>
-
- <p>For each of the rows in the following table, starting with the first one and going down, if
- there are as many or more bytes available than the number of bytes in the first column, and the
- first bytes of the file match the bytes given in the first column, then return the encoding
- given in the cell in the second column of that row, with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-3>confidence</a> <i>certain</i>, and abort these steps:</p>
-
- <table><thead><tr><th>Bytes in Hexadecimal
- <th>Encoding
- <tbody><tr><td>FE FF
- <td>Big-endian UTF-16
- <tr><td>FF FE
- <td>Little-endian UTF-16
- <tr><td>EF BB BF
- <td>UTF-8
- </table>
- <p class=note>This step looks for Unicode Byte Order Marks (BOMs).</p>
- <p class=note>That this step happens before the next one honoring the HTTP
- <code id=determining-the-character-encoding:content-type-2><a href=#content-type>Content-Type</a></code> header is a <a href=#willful-violation id=determining-the-character-encoding:willful-violation>willful violation</a> of the HTTP specification,
- motivated by a desire to be maximally compatible with legacy content. <a href=#refsHTTP>[HTTP]</a></p>
- <li><p>If the transport layer specifies a character encoding, and it is supported, return that
- encoding with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-4>confidence</a> <i>certain</i>, and
- abort these steps.<li>
- <p>Optionally <a href=#prescan-a-byte-stream-to-determine-its-encoding id=determining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding>prescan the byte
- stream to determine its encoding</a>. The <var>end condition</var> is that the user
- agent decides that scanning further bytes would not be efficient. User agents are encouraged to
- only prescan the first 1024 bytes. User agents may decide that scanning <em>any</em> bytes is
- not efficient, in which case these substeps are entirely skipped.</p>
- <p>The aforementioned algorithm either aborts unsuccessfully or returns a character encoding. If
- it returns a character encoding, then this algorithm must be aborted, returning the same
- encoding, with <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-5>confidence</a> <i>tentative</i>.</p>
- <li>
- <p>If the <a href=#html-parser id=determining-the-character-encoding:html-parser>HTML parser</a> for which this algorithm is being run is associated with a
- <code id=determining-the-character-encoding:document><a href=#document>Document</a></code> that is itself in a <a href=#nested-browsing-context id=determining-the-character-encoding:nested-browsing-context>nested browsing context</a>, run these
- substeps:</p>
- <ol><li><p>Let <var>new document</var> be the <code id=determining-the-character-encoding:document-2><a href=#document>Document</a></code> with which the
- <a href=#html-parser id=determining-the-character-encoding:html-parser-2>HTML parser</a> is associated.<li><p>Let <var>parent document</var> be the <code id=determining-the-character-encoding:document-3><a href=#document>Document</a></code> <a href=#browsing-context-nested-through id=determining-the-character-encoding:browsing-context-nested-through>through which <var>new document</var> is
- nested</a> (the <a href=#active-document id=determining-the-character-encoding:active-document>active document</a> of the <a href=#parent-browsing-context id=determining-the-character-encoding:parent-browsing-context>parent browsing context</a> of
- <var>new document</var>).<li><p>If <var>parent document</var>'s <a href=#origin-2 id=determining-the-character-encoding:origin-2>origin</a> is not the <a href=#same-origin id=determining-the-character-encoding:same-origin>same
- origin</a> as <var>new document</var>'s <a href=#origin-2 id=determining-the-character-encoding:origin-2-2>origin</a>, then abort these
- substeps.<li><p>If <var>parent document</var>'s <a href="#document's-character-encoding" id="determining-the-character-encoding:document's-character-encoding">character encoding</a> is not an <a href=#ascii-compatible-character-encoding id=determining-the-character-encoding:ascii-compatible-character-encoding>ASCII-compatible character encoding</a>,
- then abort these substeps.<li><p>Return <var>parent document</var>'s <a href="#document's-character-encoding" id="determining-the-character-encoding:document's-character-encoding-2">character encoding</a>, with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-6>confidence</a> <i>tentative</i>, and abort the
- <a href=#encoding-sniffing-algorithm id=determining-the-character-encoding:encoding-sniffing-algorithm>encoding sniffing algorithm</a>'s steps.</ol>
- <li><p>Otherwise, if the user agent has information on the likely encoding for this page, e.g.
- based on the encoding of the page when it was last visited, then return that encoding, with the
- <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-7>confidence</a> <i>tentative</i>, and abort these
- steps.<li>
- <p>The user agent may attempt to autodetect the character encoding from applying frequency
- analysis or other algorithms to the data stream. Such algorithms may use information about the
- resource other than the resource's contents, including the address of the resource. If
- autodetection succeeds in determining a character encoding, and that encoding is a supported
- encoding, then return that encoding, with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-8>confidence</a> <i>tentative</i>, and abort these steps.
- <a href=#refsUNIVCHARDET>[UNIVCHARDET]</a></p>
- <p class=note>User agents are generally discouraged from attempting to autodetect encodings
- for resources obtained over the network, since doing so involves inherently non-interoperable
- heuristics. Attempting to detect encodings based on an HTML document's preamble is especially
- tricky since HTML markup typically uses only ASCII characters, and HTML documents tend to begin
- with a lot of markup rather than with text content.</p>
- <p class=note>The UTF-8 encoding has a highly detectable bit pattern. Files from the local
- file system that contain bytes with values greater than 0x7F which match the UTF-8 pattern are
- very likely to be UTF-8, while documents with byte sequences that do not match it are very
- likely not. When a user agent can examine the whole file, rather than just the preamble,
- detecting for UTF-8 specifically can be especially effective. <a href=#refsPPUTF8>[PPUTF8]</a> <a href=#refsUTF8DET>[UTF8DET]</a></p>
- <li>
- <p>Otherwise, return an implementation-defined or user-specified default character encoding,
- with the <a href=#concept-encoding-confidence id=determining-the-character-encoding:concept-encoding-confidence-9>confidence</a> <i>tentative</i>.</p>
- <p>In controlled environments or in environments where the encoding of documents can be
- prescribed (for example, for user agents intended for dedicated use in new networks), the
- comprehensive <code>UTF-8</code> encoding is suggested.</p>
- <p>In other environments, the default encoding is typically dependent on the user's locale (an
- approximation of the languages, and thus often encodings, of the pages that the user is likely
- to frequent). The following table gives suggested defaults based on the user's locale, for
- compatibility with legacy content. Locales are identified by BCP 47 language tags. <a href=#refsBCP47>[BCP47]</a> <a href=#refsENCODING>[ENCODING]</a></p>
-
- <table><thead><tr><th colspan=2>Locale language
- <th>Suggested default encoding
- <tbody><tr><td>ar
- <td>Arabic
- <td>windows-1256
-
-
-
-
-
- <tr><td>ba
- <td>Bashkir
- <td>windows-1251
-
-
- <tr><td>be
- <td>Belarusian
- <td>windows-1251
-
- <tr><td>bg
- <td>Bulgarian
- <td>windows-1251
-
-
-
-
-
-
- <tr><td>cs
- <td>Czech
- <td>windows-1250
-
-
-
-
-
-
- <tr><td>el
- <td>Greek
- <td>ISO-8859-7
-
-
- <tr><td>et
- <td>Estonian
- <td>windows-1257
-
- <tr><td>fa
- <td>Persian
- <td>windows-1256
-
-
-
-
-
-
-
-
-
-
- <tr><td>he
- <td>Hebrew
- <td>windows-1255
-
- <tr><td>hr
- <td>Croatian
- <td>windows-1250
- <tr><td>hu
- <td>Hungarian
- <td>ISO-8859-2
-
-
-
-
-
-
- <tr><td>ja
- <td>Japanese
- <td>Shift_JIS
-
-
- <tr><td>kk
- <td>Kazakh
- <td>windows-1251
-
-
- <tr><td>ko
- <td>Korean
- <td>euc-kr
- <tr><td>ku
- <td>Kurdish
- <td>windows-1254
-
-
- <tr><td>ky
- <td>Kyrgyz
- <td>windows-1251
-
- <tr><td>lt
- <td>Lithuanian
- <td>windows-1257
- <tr><td>lv
- <td>Latvian
- <td>windows-1257
-
-
- <tr><td>mk
- <td>Macedonian
- <td>windows-1251
-
-
-
-
-
-
-
-
-
-
-
- <tr><td>pl
- <td>Polish
- <td>ISO-8859-2
-
-
-
-
-
-
-
-
-
-
- <tr><td>ru
- <td>Russian
- <td>windows-1251
-
-
-
- <tr><td>sah
- <td>Yakut
- <td>windows-1251
-
-
-
- <tr><td>sk
- <td>Slovak
- <td>windows-1250
- <tr><td>sl
- <td>Slovenian
- <td>ISO-8859-2
-
-
-
-
-
-
-
-
- <tr><td>sr
- <td>Serbian
- <td>windows-1251
-
-
-
-
-
-
-
-
- <tr><td>tg
- <td>Tajik
- <td>windows-1251
- <tr><td>th
- <td>Thai
- <td>windows-874
-
-
- <tr><td>tr
- <td>Turkish
- <td>windows-1254
-
-
- <tr><td>tt
- <td>Tatar
- <td>windows-1251
-
-
- <tr><td>uk
- <td>Ukrainian
- <td>windows-1251
-
-
-
- <tr><td>vi
- <td>Vietnamese
- <td>windows-1258
-
-
-
-
-
- <tr><td>zh-CN
- <td>Chinese (People's Republic of China)
- <td>GB18030
-
-
-
-
-
- <tr><td>zh-TW
- <td>Chinese (Taiwan)
- <td>Big5
-
- <tr><td colspan=2>All other locales
- <td>windows-1252
- </table>
- <p class=tablenote><small>The contents of this table are derived from the intersection of
- Windows, Chrome, and Firefox defaults.</small></p>
- </ol>
- <p>The <a href="#document's-character-encoding" id="determining-the-character-encoding:document's-character-encoding-3">document's character encoding</a> must immediately be set to the value returned
- from this algorithm, at the same time as the user agent uses the returned value to select the
- decoder to use for the input byte stream.</p>
- <hr>
- <p>When an algorithm requires a user agent to <dfn id=prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its
- encoding</dfn>, given some defined <var>end condition</var>, then it must run the
- following steps. These steps either abort unsuccessfully or return a character encoding. If at any
- point during these steps (including during instances of the <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing>get an attribute</a> algorithm invoked by this
- one) the user agent either runs out of bytes (meaning the <var>position</var> pointer
- created in the first step below goes beyond the end of the byte stream obtained so far) or reaches
- its <var>end condition</var>, then abort the <a href=#prescan-a-byte-stream-to-determine-its-encoding id=determining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding-2>prescan a byte stream to determine its
- encoding</a> algorithm unsuccessfully.</p>
- <ol><li>
- <p>Let <var>position</var> be a pointer to a byte in the input byte stream, initially
- pointing at the first byte.</p>
- <li>
- <p><i>Loop</i>: If <var>position</var> points to:</p>
- <dl class=switch><dt>A sequence of bytes starting with: 0x3C 0x21 0x2D 0x2D (ASCII '<!--')<dd>
- <p>Advance the <var>position</var> pointer so that it points at the first 0x3E byte
- which is preceded by two 0x2D bytes (i.e. at the end of an ASCII '-->' sequence) and comes
- after the 0x3C byte that was found. (The two 0x2D bytes can be the same as the those in the
- '<!--' sequence.)</p>
- <dt>A sequence of bytes starting with: 0x3C, 0x4D or 0x6D, 0x45 or 0x65, 0x54 or 0x74, 0x41 or 0x61, and one of 0x09, 0x0A, 0x0C, 0x0D, 0x20, 0x2F (case-insensitive ASCII '<meta' followed by a space or slash)<dd>
- <ol><li><p>Advance the <var>position</var> pointer so that it points at the next 0x09,
- 0x0A, 0x0C, 0x0D, 0x20, or 0x2F byte (the one in sequence of characters matched
- above).<li><p>Let <var>attribute list</var> be an empty list of strings.<li><p>Let <var>got pragma</var> be false.<li><p>Let <var>need pragma</var> be null.<li><p>Let <var>charset</var> be the null value (which, for the purposes of this
- algorithm, is distinct from an unrecognised encoding or the empty string).<li><p><i>Attributes</i>: <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-2>Get an
- attribute</a> and its value. If no attribute was sniffed, then jump to the
- <i>processing</i> step below.<li><p>If the attribute's name is already in <var>attribute list</var>, then return
- to the step labeled <i>attributes</i>.</p>
- <li><p>Add the attribute's name to <var>attribute list</var>.</p>
- <li>
- <p>Run the appropriate step from the following list, if one applies:</p>
- <dl class=switch><dt>If the attribute's name is "<code>http-equiv</code>"<dd><p>If the attribute's value is "<code>content-type</code>", then set <var>got pragma</var> to true.<dt>If the attribute's name is "<code>content</code>"<dd><p>Apply the <a href=#algorithm-for-extracting-a-character-encoding-from-a-meta-element id=determining-the-character-encoding:algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for extracting a character encoding from a
- <code>meta</code> element</a>, giving the attribute's value as the string to parse. If a
- character encoding is returned, and if <var>charset</var> is still set to null,
- let <var>charset</var> be the encoding returned, and set <var>need
- pragma</var> to true.<dt>If the attribute's name is "<code>charset</code>"<dd><p>Let <var>charset</var> be the result of <a id=determining-the-character-encoding:getting-an-encoding href=http://encoding.spec.whatwg.org/#concept-encoding-get data-x-internal=getting-an-encoding>getting an encoding</a>
- from the attribute's value, and set <var>need pragma</var> to false.</dl>
- <li><p>Return to the step labeled <i>attributes</i>.<li><p><i>Processing</i>: If <var>need pragma</var> is null, then jump to the step
- below labeled <i>next byte</i>.<li><p>If <var>need pragma</var> is true but <var>got pragma</var> is
- false, then jump to the step below labeled <i>next byte</i>.<li><p>If <var>charset</var> is <a href=#a-utf-16-encoding id=determining-the-character-encoding:a-utf-16-encoding>a UTF-16 encoding</a>, change the value of
- <var>charset</var> to UTF-8.<li><p>If <var>charset</var> is the x-user-defined encoding, change the value of
- <var>charset</var> to Windows-1252. <a href=#refsENCODING>[ENCODING]</a><li><p>If <var>charset</var> is not a supported character encoding, then jump to the
- step below labeled <i>next byte</i>.<li><p>Abort the <a href=#prescan-a-byte-stream-to-determine-its-encoding id=determining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding-3>prescan a byte stream to determine its encoding</a> algorithm,
- returning the encoding given by <var>charset</var>.</ol>
- <dt>A sequence of bytes starting with a 0x3C byte (ASCII <), optionally a 0x2F byte (ASCII /), and finally a byte in the range 0x41-0x5A or 0x61-0x7A (an ASCII letter)<dd>
- <ol><li><p>Advance the <var>position</var> pointer so that it points at the next 0x09
- (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x3E
- (ASCII >) byte.<li><p>Repeatedly <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-3>get an attribute</a>
- until no further attributes can be found, then jump to the step below labeled <i>next
- byte</i>.</ol>
- <dt>A sequence of bytes starting with: 0x3C 0x21 (ASCII '<!')<dt>A sequence of bytes starting with: 0x3C 0x2F (ASCII '</')<dt>A sequence of bytes starting with: 0x3C 0x3F (ASCII '<?')<dd>
- <p>Advance the <var>position</var> pointer so that it points at the first 0x3E byte
- (ASCII >) that comes after the 0x3C byte that was found.</p>
- <dt>Any other byte<dd>
- <p>Do nothing with that byte.</p>
- </dl>
- <li><i>Next byte</i>: Move <var>position</var> so it points at the next byte in the
- input byte stream, and return to the step above labeled <i>loop</i>.</ol>
- <p>When the <a href=#prescan-a-byte-stream-to-determine-its-encoding id=determining-the-character-encoding:prescan-a-byte-stream-to-determine-its-encoding-4>prescan a byte stream to determine its encoding</a> algorithm says to <dfn id=concept-get-attributes-when-sniffing>get an attribute</dfn>, it means doing this:</p>
- <ol><li><p>If the byte at <var>position</var> is one of 0x09 (ASCII TAB), 0x0A (ASCII LF),
- 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII space), or 0x2F (ASCII /) then advance <var>position</var> to the next byte and redo this step.<li><p>If the byte at <var>position</var> is 0x3E (ASCII >), then abort the <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-4>get an attribute</a> algorithm. There isn't
- one.<li><p>Otherwise, the byte at <var>position</var> is the start of the attribute name.
- Let <var>attribute name</var> and <var>attribute value</var> be the empty
- string.<li><p>Process the byte at <var>position</var> as follows:</p>
- <dl class=switch><dt>If it is 0x3D (ASCII =), and the <var>attribute name</var> is longer than the
- empty string<dd>Advance <var>position</var> to the next byte and jump to the step below labeled
- <i>value</i>.<dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20
- (ASCII space)<dd>Jump to the step below labeled <i>spaces</i>.<dt>If it is 0x2F (ASCII /) or 0x3E (ASCII >)<dd>Abort the <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-5>get an attribute</a>
- algorithm. The attribute's name is the value of <var>attribute name</var>, its value
- is the empty string.<dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII Z)<dd>Append the Unicode character with code point <span><var>b</var>+0x20</span> to <var>attribute name</var> (where <var>b</var>
- is the value of the byte at <var>position</var>). (This converts the input to
- lowercase.)<dt>Anything else<dd>Append the Unicode character with the same code point as the value of the byte at <var>position</var> to <var>attribute name</var>. (It doesn't actually matter how
- bytes outside the ASCII range are handled here, since only ASCII characters can contribute to
- the detection of a character encoding.)</dl>
- <li><p>Advance <var>position</var> to the next byte and return to the previous
- step.<li><p><i>Spaces</i>: If the byte at <var>position</var> is one of 0x09 (ASCII TAB),
- 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then advance <var>position</var> to the next byte, then, repeat this step.<li><p>If the byte at <var>position</var> is <em>not</em> 0x3D (ASCII =), abort the
- <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-6>get an attribute</a> algorithm. The
- attribute's name is the value of <var>attribute name</var>, its value is the empty
- string.<li><p>Advance <var>position</var> past the 0x3D (ASCII =) byte.<li><p><i>Value</i>: If the byte at <var>position</var> is one of 0x09 (ASCII TAB), 0x0A
- (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), or 0x20 (ASCII space) then advance <var>position</var> to the next byte, then, repeat this step.<li><p>Process the byte at <var>position</var> as follows:</p>
- <dl class=switch><dt>If it is 0x22 (ASCII ") or 0x27 (ASCII ')<dd>
- <ol><li>Let <var>b</var> be the value of the byte at <var>position</var>.<li><i>Quote loop</i>: Advance <var>position</var> to the next byte.<li>If the value of the byte at <var>position</var> is the value of <var>b</var>, then advance <var>position</var> to the next byte and abort the
- "get an attribute" algorithm. The attribute's name is the value of <var>attribute
- name</var>, and its value is the value of <var>attribute value</var>.<li>Otherwise, if the value of the byte at <var>position</var> is in the range 0x41
- (ASCII A) to 0x5A (ASCII Z), then append a Unicode character to <var>attribute
- value</var> whose code point is 0x20 more than the value of the byte at <var>position</var>.<li>Otherwise, append a Unicode character to <var>attribute value</var> whose code
- point is the same as the value of the byte at <var>position</var>.<li>Return to the step above labeled <i>quote loop</i>.</ol>
- <dt>If it is 0x3E (ASCII >)<dd>Abort the <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-7>get an attribute</a>
- algorithm. The attribute's name is the value of <var>attribute name</var>, its value
- is the empty string.<dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII Z)<dd>Append the Unicode character with code point <span><var>b</var>+0x20</span> to <var>attribute value</var> (where <var>b</var> is the value of the byte at <var>position</var>). Advance <var>position</var> to the next byte.<dt>Anything else<dd>Append the Unicode character with the same code point as the value of the byte at <var>position</var> to <var>attribute value</var>. Advance <var>position</var> to the next byte.</dl>
- <li><p>Process the byte at <var>position</var> as
- follows:</p>
- <dl class=switch><dt>If it is 0x09 (ASCII TAB), 0x0A (ASCII LF), 0x0C (ASCII FF), 0x0D (ASCII CR), 0x20 (ASCII
- space), or 0x3E (ASCII >)<dd>Abort the <a href=#concept-get-attributes-when-sniffing id=determining-the-character-encoding:concept-get-attributes-when-sniffing-8>get an attribute</a>
- algorithm. The attribute's name is the value of <var>attribute name</var> and its
- value is the value of <var>attribute value</var>.<dt>If it is in the range 0x41 (ASCII A) to 0x5A (ASCII Z)<dd>Append the Unicode character with code point <span><var>b</var>+0x20</span> to <var>attribute value</var> (where <var>b</var> is the value of the byte at <var>position</var>).<dt>Anything else<dd>Append the Unicode character with the same code point as the value of the byte at <var>position</var> to <var>attribute value</var>.</dl>
- <li><p>Advance <var>position</var> to the next byte and return to the previous
- step.</ol>
- <p>For the sake of interoperability, user agents should not use a pre-scan algorithm that returns
- different results than the one described above. (But, if you do, please at least let us know, so
- that we can improve this algorithm and benefit everyone...)</p>
- <h5 id=character-encodings>12.2.2.3 Character encodings</h5>
- <p>User agents must support the encodings defined in the WHATWG Encoding standard. User agents
- should not support other encodings.</p>
- <p>User agents must not support the CESU-8, UTF-7, BOCU-1 and SCSU encodings. <a href=#refsCESU8>[CESU8]</a> <a href=#refsUTF7>[UTF7]</a> <a href=#refsBOCU1>[BOCU1]</a> <a href=#refsSCSU>[SCSU]</a></p>
- <p>Support for encodings based on EBCDIC is especially discouraged. This encoding is rarely used
- for publicly-facing Web content. Support for UTF-32 is also especially discouraged. This encoding
- is rarely used, and frequently implemented incorrectly.</p>
- <p class=note>This specification does not make any attempt to support EBCDIC-based encodings and
- UTF-32 in its algorithms; support and use of these encodings can thus lead to unexpected behavior
- in implementations of this specification.</p>
- <h5 id=changing-the-encoding-while-parsing>12.2.2.4 Changing the encoding while parsing</h5>
- <p>When the parser requires the user agent to <dfn id=change-the-encoding>change the encoding</dfn>, it must run the
- following steps. This might happen if the <a href=#encoding-sniffing-algorithm id=changing-the-encoding-while-parsing:encoding-sniffing-algorithm>encoding sniffing algorithm</a> described above
- failed to find a character encoding, or if it found a character encoding that was not the actual
- encoding of the file.</p>
- <ol><li><p>If the encoding that is already being used to interpret the input stream is <a href=#a-utf-16-encoding id=changing-the-encoding-while-parsing:a-utf-16-encoding>a UTF-16
- encoding</a>, then set the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence>confidence</a> to
- <i>certain</i> and abort these steps. The new encoding is ignored; if it was anything but the
- same encoding, then it would be clearly incorrect.<li><p>If the new encoding is <a href=#a-utf-16-encoding id=changing-the-encoding-while-parsing:a-utf-16-encoding-2>a UTF-16 encoding</a>, change it to UTF-8.<li><p>If the new encoding is the x-user-defined encoding, change it to Windows-1252. <a href=#refsENCODING>[ENCODING]</a><li><p>If the new encoding is identical or equivalent to the encoding that is already being used
- to interpret the input stream, then set the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence-2>confidence</a> to <i>certain</i> and abort these steps.
- This happens when the encoding information found in the file matches what the <a href=#encoding-sniffing-algorithm id=changing-the-encoding-while-parsing:encoding-sniffing-algorithm-2>encoding
- sniffing algorithm</a> determined to be the encoding, and in the second pass through the
- parser if the first pass found that the encoding sniffing algorithm described in the earlier
- section failed to find the right encoding.<li><p>If all the bytes up to the last byte converted by the current decoder have the same
- Unicode interpretations in both the current encoding and the new encoding, and if the user agent
- supports changing the converter on the fly, then the user agent may change to the new converter
- for the encoding on the fly. Set the <a href="#document's-character-encoding" id="changing-the-encoding-while-parsing:document's-character-encoding">document's character encoding</a> and the encoding
- used to convert the input stream to the new encoding, set the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence-3>confidence</a> to <i>certain</i>, and abort these
- steps.<li><p>Otherwise, <a href=#navigate id=changing-the-encoding-while-parsing:navigate>navigate</a> to the document again, with
- <a href=#replacement-enabled id=changing-the-encoding-while-parsing:replacement-enabled>replacement enabled</a>, and using the same <a href=#source-browsing-context id=changing-the-encoding-while-parsing:source-browsing-context>source browsing context</a>, but
- this time skip the <a href=#encoding-sniffing-algorithm id=changing-the-encoding-while-parsing:encoding-sniffing-algorithm-3>encoding sniffing algorithm</a> and instead just set the encoding to
- the new encoding and the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence-4>confidence</a> to
- <i>certain</i>. Whenever possible, this should be done without actually contacting the network
- layer (the bytes should be re-parsed from memory), even if, e.g., the document is marked as not
- being cacheable. If this is not possible and contacting the network layer would involve repeating
- a request that uses a method other than HTTP GET (<a href=#concept-http-equivalent-get id=changing-the-encoding-while-parsing:concept-http-equivalent-get>or
- equivalent</a> for non-HTTP URLs), then instead set the <a href=#concept-encoding-confidence id=changing-the-encoding-while-parsing:concept-encoding-confidence-5>confidence</a> to <i>certain</i> and ignore the new
- encoding. The resource will be misinterpreted. User agents may notify the user of the situation,
- to aid in application development.</ol>
- <p class=note>This algorithm is only invoked when a new encoding is found declared on a
- <code id=changing-the-encoding-while-parsing:the-meta-element><a href=#the-meta-element>meta</a></code> element.</p>
- <h5 id=preprocessing-the-input-stream>12.2.2.5 Preprocessing the input stream</h5>
- <p>The <dfn id=input-stream>input stream</dfn> consists of the characters pushed into it as the <a href=#the-input-byte-stream id=preprocessing-the-input-stream:the-input-byte-stream>input byte
- stream</a> is decoded or from the various APIs that directly manipulate the input stream.</p>
- <p>One leading U+FEFF BYTE ORDER MARK character must be ignored if any are present in the
- <a href=#input-stream id=preprocessing-the-input-stream:input-stream>input stream</a>.</p>
- <p class=note>The requirement to strip a U+FEFF BYTE ORDER MARK character regardless of whether
- that character was used to determine the byte order is a <a href=#willful-violation id=preprocessing-the-input-stream:willful-violation>willful violation</a> of
- Unicode, motivated by a desire to increase the resilience of user agents in the face of naïve
- transcoders.</p>
- <p>Any occurrences of any characters in the ranges U+0001 to U+0008, U+000E to U+001F,
- U+007F to U+009F, U+FDD0 to U+FDEF, and
- characters U+000B, U+FFFE, U+FFFF, U+1FFFE, U+1FFFF, U+2FFFE, U+2FFFF, U+3FFFE, U+3FFFF, U+4FFFE,
- U+4FFFF, U+5FFFE, U+5FFFF, U+6FFFE, U+6FFFF, U+7FFFE, U+7FFFF, U+8FFFE, U+8FFFF, U+9FFFE, U+9FFFF,
- U+AFFFE, U+AFFFF, U+BFFFE, U+BFFFF, U+CFFFE, U+CFFFF, U+DFFFE, U+DFFFF, U+EFFFE, U+EFFFF, U+FFFFE,
- U+FFFFF, U+10FFFE, and U+10FFFF are <a href=#parse-error id=preprocessing-the-input-stream:parse-error>parse errors</a>. These are all
- <a href=#control-characters id=preprocessing-the-input-stream:control-characters>control characters</a> or permanently undefined Unicode characters (noncharacters).</p>
- <p>Any <a href=#character id=preprocessing-the-input-stream:character>character</a> that is a not a <a href=#unicode-character id=preprocessing-the-input-stream:unicode-character>Unicode character</a>, i.e. any isolated
- surrogate, is a <a href=#parse-error id=preprocessing-the-input-stream:parse-error-2>parse error</a>. (These can only find their way into the input stream via
- script APIs such as <code id=preprocessing-the-input-stream:dom-document-write><a href=#dom-document-write>document.write()</a></code>.)</p>
- <p>U+000D CARRIAGE RETURN (CR) characters and U+000A LINE FEED (LF) characters are treated
- specially. All CR characters must be converted to LF characters, and any LF characters that
- immediately follow a CR character must be ignored. Thus, newlines in HTML DOMs are represented by
- LF characters, and there are never any CR characters in the input to the <a href=#tokenization id=preprocessing-the-input-stream:tokenization>tokenization</a>
- stage.</p>
- <p>The <dfn id=next-input-character>next input character</dfn> is the first character in the <a href=#input-stream id=preprocessing-the-input-stream:input-stream-2>input stream</a>
- that has not yet been <dfn>consumed</dfn> or explicitly ignored by the requirements in
- this section. Initially, the <i id=preprocessing-the-input-stream:next-input-character><a href=#next-input-character>next input character</a></i> is the
- first character in the input. The <dfn id=current-input-character>current input character</dfn> is the last character to have
- been <i>consumed</i>.</p>
- <p>The <dfn id=insertion-point>insertion point</dfn> is the position (just before a character or just before the end
- of the input stream) where content inserted using <code id=preprocessing-the-input-stream:dom-document-write-2><a href=#dom-document-write>document.write()</a></code> is actually inserted. The insertion point is
- relative to the position of the character immediately after it, it is not an absolute offset into
- the input stream. Initially, the insertion point is undefined.</p>
- <p>The "EOF" character in the tables below is a conceptual character representing the end of the
- <a href=#input-stream id=preprocessing-the-input-stream:input-stream-3>input stream</a>. If the parser is a <a href=#script-created-parser id=preprocessing-the-input-stream:script-created-parser>script-created parser</a>, then the end of
- the <a href=#input-stream id=preprocessing-the-input-stream:input-stream-4>input stream</a> is reached when an <dfn id=explicit-eof-character>explicit "EOF" character</dfn> (inserted by
- the <code id=preprocessing-the-input-stream:dom-document-close><a href=#dom-document-close>document.close()</a></code> method) is consumed. Otherwise, the
- "EOF" character is not a real character in the stream, but rather the lack of any further
- characters.</p>
- <p class=note>The handling of U+0000 NULL characters varies based on where the characters are
- found. In general, they are ignored except where doing so could plausibly introduce an attack
- vector. This handling is, by necessity, spread across both the tokenization stage and the tree
- construction stage.</p>
-
-
- <h4 id=parse-state>12.2.3 Parse state</h4>
- <h5 id=the-insertion-mode>12.2.3.1 The insertion mode</h5>
- <p>The <dfn id=insertion-mode>insertion mode</dfn> is a state variable that controls the primary operation of the
- tree construction stage.</p>
- <p>Initially, the <a href=#insertion-mode id=the-insertion-mode:insertion-mode>insertion mode</a> is "<a href=#the-initial-insertion-mode id=the-insertion-mode:the-initial-insertion-mode>initial</a>". It can change to "<a href=#the-before-html-insertion-mode id=the-insertion-mode:the-before-html-insertion-mode>before
- html</a>", "<a href=#the-before-head-insertion-mode id=the-insertion-mode:the-before-head-insertion-mode>before head</a>", "<a href=#parsing-main-inhead id=the-insertion-mode:parsing-main-inhead>in head</a>", "<a href=#parsing-main-inheadnoscript id=the-insertion-mode:parsing-main-inheadnoscript>in head noscript</a>", "<a href=#the-after-head-insertion-mode id=the-insertion-mode:the-after-head-insertion-mode>after head</a>",
- "<a href=#parsing-main-inbody id=the-insertion-mode:parsing-main-inbody>in body</a>", "<a href=#parsing-main-incdata id=the-insertion-mode:parsing-main-incdata>text</a>", "<a href=#parsing-main-intable id=the-insertion-mode:parsing-main-intable>in table</a>", "<a href=#parsing-main-intabletext id=the-insertion-mode:parsing-main-intabletext>in table text</a>", "<a href=#parsing-main-incaption id=the-insertion-mode:parsing-main-incaption>in caption</a>", "<a href=#parsing-main-incolgroup id=the-insertion-mode:parsing-main-incolgroup>in column
- group</a>", "<a href=#parsing-main-intbody id=the-insertion-mode:parsing-main-intbody>in table body</a>", "<a href=#parsing-main-intr id=the-insertion-mode:parsing-main-intr>in row</a>", "<a href=#parsing-main-intd id=the-insertion-mode:parsing-main-intd>in
- cell</a>", "<a href=#parsing-main-inselect id=the-insertion-mode:parsing-main-inselect>in select</a>", "<a href=#parsing-main-inselectintable id=the-insertion-mode:parsing-main-inselectintable>in select in table</a>", "<a href=#parsing-main-intemplate id=the-insertion-mode:parsing-main-intemplate>in template</a>", "<a href=#parsing-main-afterbody id=the-insertion-mode:parsing-main-afterbody>after body</a>",
- "<a href=#parsing-main-inframeset id=the-insertion-mode:parsing-main-inframeset>in frameset</a>", "<a href=#parsing-main-afterframeset id=the-insertion-mode:parsing-main-afterframeset>after frameset</a>", "<a href=#the-after-after-body-insertion-mode id=the-insertion-mode:the-after-after-body-insertion-mode>after
- after body</a>", and "<a href=#the-after-after-frameset-insertion-mode id=the-insertion-mode:the-after-after-frameset-insertion-mode>after after
- frameset</a>" during the course of the parsing, as described in the <a href=#tree-construction id=the-insertion-mode:tree-construction>tree
- construction</a> stage. The insertion mode affects how tokens are processed and whether CDATA
- sections are supported.</p>
- <p>Several of these modes, namely "<a href=#parsing-main-inhead id=the-insertion-mode:parsing-main-inhead-2>in head</a>", "<a href=#parsing-main-inbody id=the-insertion-mode:parsing-main-inbody-2>in body</a>", "<a href=#parsing-main-intable id=the-insertion-mode:parsing-main-intable-2>in
- table</a>", and "<a href=#parsing-main-inselect id=the-insertion-mode:parsing-main-inselect-2>in select</a>", are special, in
- that the other modes defer to them at various times. When the algorithm below says that the user
- agent is to do something "<dfn id=using-the-rules-for>using the rules for</dfn> the <var>m</var> insertion
- mode", where <var>m</var> is one of these modes, the user agent must use the rules
- described under the <var>m</var> <a href=#insertion-mode id=the-insertion-mode:insertion-mode-2>insertion mode</a>'s section, but must leave
- the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-3>insertion mode</a> unchanged unless the rules in <var>m</var> themselves
- switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-4>insertion mode</a> to a new value.</p>
- <p>When the insertion mode is switched to "<a href=#parsing-main-incdata id=the-insertion-mode:parsing-main-incdata-2>text</a>" or
- "<a href=#parsing-main-intabletext id=the-insertion-mode:parsing-main-intabletext-2>in table text</a>", the <dfn id=original-insertion-mode>original insertion
- mode</dfn> is also set. This is the insertion mode to which the tree construction stage will
- return.</p>
- <p>Similarly, to parse nested <code id=the-insertion-mode:the-template-element><a href=#the-template-element>template</a></code> elements, a <dfn id=stack-of-template-insertion-modes>stack of template insertion
- modes</dfn> is used. It is initially empty. The <dfn id=current-template-insertion-mode>current template insertion mode</dfn> is the
- insertion mode that was most recently added to the <a href=#stack-of-template-insertion-modes id=the-insertion-mode:stack-of-template-insertion-modes>stack of template insertion modes</a>.
- The algorithms in the sections below will <i>push</i> insertion modes onto this stack, meaning
- that the specified insertion mode is to be added to the stack, and <i>pop</i> insertion modes from
- the stack, which means that the most recently added insertion mode must be removed from the
- stack.</p>
- <hr>
- <p>When the steps below require the UA to <dfn id=reset-the-insertion-mode-appropriately>reset the insertion mode appropriately</dfn>, it
- means the UA must follow these steps:</p>
- <ol><li><p>Let <var>last</var> be false.<li><p>Let <var>node</var> be the last node in the <a href=#stack-of-open-elements id=the-insertion-mode:stack-of-open-elements>stack of open
- elements</a>.<li><p><i>Loop</i>: If <var>node</var> is the first node in the stack of open elements,
- then set <var>last</var> to true, and, if the parser was originally created as part of
- the <a href=#html-fragment-parsing-algorithm id=the-insertion-mode:html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a> (<a href=#fragment-case id=the-insertion-mode:fragment-case>fragment case</a>), set <var>node</var> to the <var id=the-insertion-mode:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var>
- element.<li>
- <p>If <var>node</var> is a <code id=the-insertion-mode:the-select-element><a href=#the-select-element>select</a></code> element, run these substeps:</p>
- <ol><li><p>If <var>last</var> is true, jump to the step below labeled
- <i>done</i>.<li><p>Let <var>ancestor</var> be <var>node</var>.<li><p><i>Loop</i>: If <var>ancestor</var> is the first node in the <a href=#stack-of-open-elements id=the-insertion-mode:stack-of-open-elements-2>stack of
- open elements</a>, jump to the step below labeled <i>done</i>.<li><p>Let <var>ancestor</var> be the node before <var>ancestor</var> in the
- <a href=#stack-of-open-elements id=the-insertion-mode:stack-of-open-elements-3>stack of open elements</a>.<li><p>If <var>ancestor</var> is a <code id=the-insertion-mode:the-template-element-2><a href=#the-template-element>template</a></code> node, jump to the step below
- labeled <i>done</i>.<li><p>If <var>ancestor</var> is a <code id=the-insertion-mode:the-table-element><a href=#the-table-element>table</a></code> node, switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-5>insertion
- mode</a> to "<a href=#parsing-main-inselectintable id=the-insertion-mode:parsing-main-inselectintable-2>in select in table</a>" and
- abort these steps.<li><p>Jump back to the step labeled <i>loop</i>.<li><p><i>Done</i>: Switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-6>insertion mode</a> to "<a href=#parsing-main-inselect id=the-insertion-mode:parsing-main-inselect-3>in select</a>" and abort these steps.</ol>
- <li><p>If <var>node</var> is a <code id=the-insertion-mode:the-td-element><a href=#the-td-element>td</a></code> or <code id=the-insertion-mode:the-th-element><a href=#the-th-element>th</a></code> element and <var>last</var> is false, then switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-7>insertion mode</a> to "<a href=#parsing-main-intd id=the-insertion-mode:parsing-main-intd-2>in cell</a>" and abort these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-tr-element><a href=#the-tr-element>tr</a></code> element, then switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-8>insertion
- mode</a> to "<a href=#parsing-main-intr id=the-insertion-mode:parsing-main-intr-2>in row</a>" and abort these
- steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=the-insertion-mode:the-thead-element><a href=#the-thead-element>thead</a></code>, or
- <code id=the-insertion-mode:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element, then switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-9>insertion mode</a> to "<a href=#parsing-main-intbody id=the-insertion-mode:parsing-main-intbody-2>in table body</a>" and abort these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-caption-element><a href=#the-caption-element>caption</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-10>insertion mode</a> to "<a href=#parsing-main-incaption id=the-insertion-mode:parsing-main-incaption-2>in caption</a>" and
- abort these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-11>insertion mode</a> to "<a href=#parsing-main-incolgroup id=the-insertion-mode:parsing-main-incolgroup-2>in column
- group</a>" and abort these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-table-element-2><a href=#the-table-element>table</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-12>insertion mode</a> to "<a href=#parsing-main-intable id=the-insertion-mode:parsing-main-intable-3>in table</a>" and abort
- these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-template-element-3><a href=#the-template-element>template</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-13>insertion mode</a> to the <a href=#current-template-insertion-mode id=the-insertion-mode:current-template-insertion-mode>current template insertion mode</a> and abort these
- steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-head-element><a href=#the-head-element>head</a></code> element and <var>last</var> is
- false, then switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-14>insertion mode</a> to "<a href=#parsing-main-inhead id=the-insertion-mode:parsing-main-inhead-3>in
- head</a>" and abort these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:the-body-element><a href=#the-body-element>body</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-15>insertion mode</a> to "<a href=#parsing-main-inbody id=the-insertion-mode:parsing-main-inbody-3>in body</a>" and abort
- these steps.<li><p>If <var>node</var> is a <code id=the-insertion-mode:frameset><a href=#frameset>frameset</a></code> element, then switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-16>insertion mode</a> to "<a href=#parsing-main-inframeset id=the-insertion-mode:parsing-main-inframeset-2>in frameset</a>" and
- abort these steps. (<a href=#fragment-case id=the-insertion-mode:fragment-case-2>fragment case</a>)<li>
- <p>If <var>node</var> is an <code id=the-insertion-mode:the-html-element><a href=#the-html-element>html</a></code> element, run these substeps:</p>
- <ol><li><p>If the <a href=#head-element-pointer id=the-insertion-mode:head-element-pointer><code>head</code> element pointer</a> is null, switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-17>insertion mode</a> to "<a href=#the-before-head-insertion-mode id=the-insertion-mode:the-before-head-insertion-mode-2>before head</a>"
- and abort these steps. (<a href=#fragment-case id=the-insertion-mode:fragment-case-3>fragment case</a>)<li><p>Otherwise, the <a href=#head-element-pointer id=the-insertion-mode:head-element-pointer-2><code>head</code> element pointer</a> is not null, switch the
- <a href=#insertion-mode id=the-insertion-mode:insertion-mode-18>insertion mode</a> to "<a href=#the-after-head-insertion-mode id=the-insertion-mode:the-after-head-insertion-mode-2>after head</a>" and
- abort these steps.</ol>
- <li><p>If <var>last</var> is true, then switch the <a href=#insertion-mode id=the-insertion-mode:insertion-mode-19>insertion mode</a> to "<a href=#parsing-main-inbody id=the-insertion-mode:parsing-main-inbody-4>in body</a>" and abort these steps. (<a href=#fragment-case id=the-insertion-mode:fragment-case-4>fragment
- case</a>)<li><p>Let <var>node</var> now be the node before <var>node</var> in the
- <a href=#stack-of-open-elements id=the-insertion-mode:stack-of-open-elements-4>stack of open elements</a>.<li><p>Return to the step labeled <i>loop</i>.</ol>
- <h5 id=the-stack-of-open-elements>12.2.3.2 The stack of open elements</h5>
- <p>Initially, the <dfn id=stack-of-open-elements>stack of open elements</dfn> is empty. The stack grows downwards; the
- topmost node on the stack is the first one added to the stack, and the bottommost node of the
- stack is the most recently added node in the stack (notwithstanding when the stack is manipulated
- in a random access fashion as part of <a href=#adoptionAgency>the handling for misnested
- tags</a>).</p>
- <p class=note>The "<a href=#the-before-html-insertion-mode id=the-stack-of-open-elements:the-before-html-insertion-mode>before html</a>" <a href=#insertion-mode id=the-stack-of-open-elements:insertion-mode>insertion
- mode</a> creates the <code id=the-stack-of-open-elements:the-html-element><a href=#the-html-element>html</a></code> root element node, which is then added to the stack.</p>
- <p class=note>In the <a href=#fragment-case id=the-stack-of-open-elements:fragment-case>fragment case</a>, the <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements>stack of open elements</a> is
- initialised to contain an <code id=the-stack-of-open-elements:the-html-element-2><a href=#the-html-element>html</a></code> element that is created as part of <a href=#html-fragment-parsing-algorithm id=the-stack-of-open-elements:html-fragment-parsing-algorithm>that algorithm</a>. (The <a href=#fragment-case id=the-stack-of-open-elements:fragment-case-2>fragment case</a> skips the
- "<a href=#the-before-html-insertion-mode id=the-stack-of-open-elements:the-before-html-insertion-mode-2>before html</a>" <a href=#insertion-mode id=the-stack-of-open-elements:insertion-mode-2>insertion mode</a>.)</p>
- <p>The <code id=the-stack-of-open-elements:the-html-element-3><a href=#the-html-element>html</a></code> node, however it is created, is the topmost node of the stack. It only
- gets popped off the stack when the parser <a href=#stop-parsing id=the-stack-of-open-elements:stop-parsing>finishes</a>.</p>
- <p>The <dfn id=current-node>current node</dfn> is the bottommost node in this <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-2>stack of open
- elements</a>.</p>
- <p>The <dfn id=adjusted-current-node>adjusted current node</dfn> is the <i id=the-stack-of-open-elements:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></i>
- element if the <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-3>stack of open elements</a> has only one element in it and the parser was
- created by the <a href=#html-fragment-parsing-algorithm id=the-stack-of-open-elements:html-fragment-parsing-algorithm-2>HTML fragment parsing algorithm</a>; otherwise, the <a href=#adjusted-current-node id=the-stack-of-open-elements:adjusted-current-node>adjusted current
- node</a> is the <a href=#current-node id=the-stack-of-open-elements:current-node>current node</a>.</p>
- <p>Elements in the <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-4>stack of open elements</a> fall into the following categories:</p>
- <dl><dt><dfn id=special>Special</dfn><dd><p>The following elements have varying levels of special parsing rules: HTML's
- <code id=the-stack-of-open-elements:the-address-element><a href=#the-address-element>address</a></code>, <code id=the-stack-of-open-elements:the-applet-element><a href=#the-applet-element>applet</a></code>, <code id=the-stack-of-open-elements:the-area-element><a href=#the-area-element>area</a></code>, <code id=the-stack-of-open-elements:the-article-element><a href=#the-article-element>article</a></code>,
- <code id=the-stack-of-open-elements:the-aside-element><a href=#the-aside-element>aside</a></code>, <code id=the-stack-of-open-elements:the-base-element><a href=#the-base-element>base</a></code>, <code id=the-stack-of-open-elements:basefont><a href=#basefont>basefont</a></code>, <code id=the-stack-of-open-elements:bgsound><a href=#bgsound>bgsound</a></code>,
- <code id=the-stack-of-open-elements:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>, <code id=the-stack-of-open-elements:the-body-element><a href=#the-body-element>body</a></code>, <code id=the-stack-of-open-elements:the-br-element><a href=#the-br-element>br</a></code>, <code id=the-stack-of-open-elements:the-button-element><a href=#the-button-element>button</a></code>,
- <code id=the-stack-of-open-elements:the-caption-element><a href=#the-caption-element>caption</a></code>, <code id=the-stack-of-open-elements:center><a href=#center>center</a></code>, <code id=the-stack-of-open-elements:the-col-element><a href=#the-col-element>col</a></code>, <code id=the-stack-of-open-elements:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>,
- <code id=the-stack-of-open-elements:the-dd-element><a href=#the-dd-element>dd</a></code>, <code id=the-stack-of-open-elements:the-details-element><a href=#the-details-element>details</a></code>, <code id=the-stack-of-open-elements:dir><a href=#dir>dir</a></code>, <code id=the-stack-of-open-elements:the-div-element><a href=#the-div-element>div</a></code>, <code id=the-stack-of-open-elements:the-dl-element><a href=#the-dl-element>dl</a></code>,
- <code id=the-stack-of-open-elements:the-dt-element><a href=#the-dt-element>dt</a></code>, <code id=the-stack-of-open-elements:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=the-stack-of-open-elements:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>, <code id=the-stack-of-open-elements:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code>,
- <code id=the-stack-of-open-elements:the-figure-element><a href=#the-figure-element>figure</a></code>, <code id=the-stack-of-open-elements:the-footer-element><a href=#the-footer-element>footer</a></code>, <code id=the-stack-of-open-elements:the-form-element><a href=#the-form-element>form</a></code>, <code id=the-stack-of-open-elements:frame><a href=#frame>frame</a></code>,
- <code id=the-stack-of-open-elements:frameset><a href=#frameset>frameset</a></code>, <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>,
- <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=the-stack-of-open-elements:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code id=the-stack-of-open-elements:the-head-element><a href=#the-head-element>head</a></code>, <code id=the-stack-of-open-elements:the-header-element><a href=#the-header-element>header</a></code>, <code id=the-stack-of-open-elements:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>,
- <code id=the-stack-of-open-elements:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=the-stack-of-open-elements:the-html-element-4><a href=#the-html-element>html</a></code>, <code id=the-stack-of-open-elements:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=the-stack-of-open-elements:the-img-element><a href=#the-img-element>img</a></code>, <code id=the-stack-of-open-elements:the-input-element><a href=#the-input-element>input</a></code>, <code id=the-stack-of-open-elements:isindex-2><a href=#isindex-2>isindex</a></code>, <code id=the-stack-of-open-elements:the-li-element><a href=#the-li-element>li</a></code>, <code id=the-stack-of-open-elements:the-link-element><a href=#the-link-element>link</a></code>,
- <code id=the-stack-of-open-elements:listing><a href=#listing>listing</a></code>, <code id=the-stack-of-open-elements:the-main-element><a href=#the-main-element>main</a></code>, <code id=the-stack-of-open-elements:the-marquee-element-2><a href=#the-marquee-element-2>marquee</a></code>, <code id=the-stack-of-open-elements:the-menu-element><a href=#the-menu-element>menu</a></code>,
- <code id=the-stack-of-open-elements:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>, <code id=the-stack-of-open-elements:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=the-stack-of-open-elements:the-nav-element><a href=#the-nav-element>nav</a></code>, <code id=the-stack-of-open-elements:noembed><a href=#noembed>noembed</a></code>,
- <code id=the-stack-of-open-elements:noframes><a href=#noframes>noframes</a></code>, <code id=the-stack-of-open-elements:the-noscript-element><a href=#the-noscript-element>noscript</a></code>, <code id=the-stack-of-open-elements:the-object-element><a href=#the-object-element>object</a></code>, <code id=the-stack-of-open-elements:the-ol-element><a href=#the-ol-element>ol</a></code>,
- <code id=the-stack-of-open-elements:the-p-element><a href=#the-p-element>p</a></code>, <code id=the-stack-of-open-elements:the-param-element><a href=#the-param-element>param</a></code>, <code id=the-stack-of-open-elements:plaintext><a href=#plaintext>plaintext</a></code>, <code id=the-stack-of-open-elements:the-pre-element><a href=#the-pre-element>pre</a></code>,
- <code id=the-stack-of-open-elements:the-script-element><a href=#the-script-element>script</a></code>, <code id=the-stack-of-open-elements:the-section-element><a href=#the-section-element>section</a></code>, <code id=the-stack-of-open-elements:the-select-element><a href=#the-select-element>select</a></code>, <code id=the-stack-of-open-elements:the-source-element><a href=#the-source-element>source</a></code>,
- <code id=the-stack-of-open-elements:the-style-element><a href=#the-style-element>style</a></code>, <code id=the-stack-of-open-elements:the-summary-element><a href=#the-summary-element>summary</a></code>, <code id=the-stack-of-open-elements:the-table-element><a href=#the-table-element>table</a></code>, <code id=the-stack-of-open-elements:the-tbody-element><a href=#the-tbody-element>tbody</a></code>,
- <code id=the-stack-of-open-elements:the-td-element><a href=#the-td-element>td</a></code>, <code id=the-stack-of-open-elements:the-template-element><a href=#the-template-element>template</a></code>, <code id=the-stack-of-open-elements:the-textarea-element><a href=#the-textarea-element>textarea</a></code>, <code id=the-stack-of-open-elements:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=the-stack-of-open-elements:the-th-element><a href=#the-th-element>th</a></code>, <code id=the-stack-of-open-elements:the-thead-element><a href=#the-thead-element>thead</a></code>, <code id=the-stack-of-open-elements:the-title-element><a href=#the-title-element>title</a></code>, <code id=the-stack-of-open-elements:the-tr-element><a href=#the-tr-element>tr</a></code>, <code id=the-stack-of-open-elements:the-track-element><a href=#the-track-element>track</a></code>,
- <code id=the-stack-of-open-elements:the-ul-element><a href=#the-ul-element>ul</a></code>, <code id=the-stack-of-open-elements:the-wbr-element><a href=#the-wbr-element>wbr</a></code>, and <code id=the-stack-of-open-elements:xmp><a href=#xmp>xmp</a></code>; MathML's <code id=the-stack-of-open-elements:math:mi><a href=#math:mi>mi</a></code>, <code id=the-stack-of-open-elements:math:mo><a href=#math:mo>mo</a></code>, <code id=the-stack-of-open-elements:math:mn><a href=#math:mn>mn</a></code>,
- <code id=the-stack-of-open-elements:math:ms><a href=#math:ms>ms</a></code>, <code id=the-stack-of-open-elements:math:mtext><a href=#math:mtext>mtext</a></code>, and <code id=the-stack-of-open-elements:math:annotation-xml><a href=#math:annotation-xml>annotation-xml</a></code>; and SVG's <code>foreignObject</code>, <code>desc</code>, and <code>title</code>.<dt><dfn id=formatting>Formatting</dfn><dd><p>The following HTML elements are those that end up in the <a href=#list-of-active-formatting-elements id=the-stack-of-open-elements:list-of-active-formatting-elements>list of active formatting
- elements</a>: <code id=the-stack-of-open-elements:the-a-element><a href=#the-a-element>a</a></code>, <code id=the-stack-of-open-elements:the-b-element><a href=#the-b-element>b</a></code>, <code id=the-stack-of-open-elements:big><a href=#big>big</a></code>, <code id=the-stack-of-open-elements:the-code-element><a href=#the-code-element>code</a></code>,
- <code id=the-stack-of-open-elements:the-em-element><a href=#the-em-element>em</a></code>, <code id=the-stack-of-open-elements:font><a href=#font>font</a></code>, <code id=the-stack-of-open-elements:the-i-element><a href=#the-i-element>i</a></code>, <code id=the-stack-of-open-elements:nobr><a href=#nobr>nobr</a></code>, <code id=the-stack-of-open-elements:the-s-element><a href=#the-s-element>s</a></code>,
- <code id=the-stack-of-open-elements:the-small-element><a href=#the-small-element>small</a></code>, <code id=the-stack-of-open-elements:strike><a href=#strike>strike</a></code>, <code id=the-stack-of-open-elements:the-strong-element><a href=#the-strong-element>strong</a></code>, <code id=the-stack-of-open-elements:tt><a href=#tt>tt</a></code>, and
- <code id=the-stack-of-open-elements:the-u-element><a href=#the-u-element>u</a></code>.<dt><dfn id=ordinary>Ordinary</dfn><dd><p>All other elements found while parsing an HTML document.</dl>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-5>stack of open elements</a> is said to <dfn id=has-an-element-in-the-specific-scope>have an element <var>target node</var> in a specific scope</dfn> consisting of a
- list of element types <var>list</var> when the following algorithm terminates in a match
- state:</p>
- <ol><li><p>Initialise <var>node</var> to be the <a href=#current-node id=the-stack-of-open-elements:current-node-2>current node</a> (the bottommost
- node of the stack).<li><p>If <var>node</var> is the target node, terminate in a match state.<li><p>Otherwise, if <var>node</var> is one of the element types in <var>list</var>, terminate in a failure state.<li><p>Otherwise, set <var>node</var> to the previous entry in the <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-6>stack of open
- elements</a> and return to step 2. (This will never fail, since the loop will always terminate
- in the previous step if the top of the stack — an <code id=the-stack-of-open-elements:the-html-element-5><a href=#the-html-element>html</a></code> element — is
- reached.)</ol>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-7>stack of open elements</a> is said to <dfn id=has-an-element-in-scope>have a
- particular element in scope</dfn> when it <a href=#has-an-element-in-the-specific-scope id=the-stack-of-open-elements:has-an-element-in-the-specific-scope>has
- that element in the specific scope</a> consisting of the following element types:</p>
- <ul class=brief><li><code id=the-stack-of-open-elements:the-applet-element-2><a href=#the-applet-element>applet</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2>HTML namespace</a><li><code id=the-stack-of-open-elements:the-caption-element-2><a href=#the-caption-element>caption</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-2>HTML namespace</a><li><code id=the-stack-of-open-elements:the-html-element-6><a href=#the-html-element>html</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-3>HTML namespace</a><li><code id=the-stack-of-open-elements:the-table-element-2><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-4>HTML namespace</a><li><code id=the-stack-of-open-elements:the-td-element-2><a href=#the-td-element>td</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-5>HTML namespace</a><li><code id=the-stack-of-open-elements:the-th-element-2><a href=#the-th-element>th</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-6>HTML namespace</a><li><code id=the-stack-of-open-elements:the-marquee-element-2-2><a href=#the-marquee-element-2>marquee</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-7>HTML namespace</a><li><code id=the-stack-of-open-elements:the-object-element-2><a href=#the-object-element>object</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-8>HTML namespace</a><li><code id=the-stack-of-open-elements:the-template-element-2><a href=#the-template-element>template</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-9>HTML namespace</a><li><code id=the-stack-of-open-elements:math:mi-2><a href=#math:mi>mi</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace>MathML namespace</a><li><code id=the-stack-of-open-elements:math:mo-2><a href=#math:mo>mo</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace-2>MathML namespace</a><li><code id=the-stack-of-open-elements:math:mn-2><a href=#math:mn>mn</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace-3>MathML namespace</a><li><code id=the-stack-of-open-elements:math:ms-2><a href=#math:ms>ms</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace-4>MathML namespace</a><li><code id=the-stack-of-open-elements:math:mtext-2><a href=#math:mtext>mtext</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace-5>MathML namespace</a><li><code id=the-stack-of-open-elements:math:annotation-xml-2><a href=#math:annotation-xml>annotation-xml</a></code> in the <a href=#mathml-namespace id=the-stack-of-open-elements:mathml-namespace-6>MathML namespace</a><li><code>foreignObject</code> in the <a href=#svg-namespace id=the-stack-of-open-elements:svg-namespace>SVG namespace</a><li><code>desc</code> in the <a href=#svg-namespace id=the-stack-of-open-elements:svg-namespace-2>SVG namespace</a><li><code>title</code> in the <a href=#svg-namespace id=the-stack-of-open-elements:svg-namespace-3>SVG namespace</a></ul>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-8>stack of open elements</a> is said to <dfn id=has-an-element-in-list-item-scope>have a particular element in list item scope</dfn> when it <a href=#has-an-element-in-the-specific-scope id=the-stack-of-open-elements:has-an-element-in-the-specific-scope-2>has that element in the specific scope</a> consisting of the following
- element types:</p>
- <ul class=brief><li>All the element types listed above for the <i id=the-stack-of-open-elements:has-an-element-in-scope><a href=#has-an-element-in-scope>has an element in scope</a></i> algorithm.<li><code id=the-stack-of-open-elements:the-ol-element-2><a href=#the-ol-element>ol</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-10>HTML namespace</a><li><code id=the-stack-of-open-elements:the-ul-element-2><a href=#the-ul-element>ul</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-11>HTML namespace</a></ul>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-9>stack of open elements</a> is said to <dfn id=has-an-element-in-button-scope>have a particular element in button scope</dfn> when it <a href=#has-an-element-in-the-specific-scope id=the-stack-of-open-elements:has-an-element-in-the-specific-scope-3>has that element in the specific scope</a> consisting of the following element
- types:</p>
- <ul class=brief><li>All the element types listed above for the <i id=the-stack-of-open-elements:has-an-element-in-scope-2><a href=#has-an-element-in-scope>has an element in scope</a></i> algorithm.<li><code id=the-stack-of-open-elements:the-button-element-2><a href=#the-button-element>button</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-12>HTML namespace</a></ul>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-10>stack of open elements</a> is said to <dfn id=has-an-element-in-table-scope>have a particular element in table scope</dfn> when it <a href=#has-an-element-in-the-specific-scope id=the-stack-of-open-elements:has-an-element-in-the-specific-scope-4>has that element in the specific scope</a> consisting of the following element
- types:</p>
- <ul class=brief><li><code id=the-stack-of-open-elements:the-html-element-7><a href=#the-html-element>html</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-13>HTML namespace</a><li><code id=the-stack-of-open-elements:the-table-element-3><a href=#the-table-element>table</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-14>HTML namespace</a><li><code id=the-stack-of-open-elements:the-template-element-3><a href=#the-template-element>template</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-15>HTML namespace</a></ul>
- <p>The <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-11>stack of open elements</a> is said to <dfn id=has-an-element-in-select-scope>have a particular element in select scope</dfn> when it <a href=#has-an-element-in-the-specific-scope id=the-stack-of-open-elements:has-an-element-in-the-specific-scope-5>has that element in the specific scope</a> consisting of all element types
- <em>except</em> the following:</p>
- <ul class=brief><li><code id=the-stack-of-open-elements:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-16>HTML namespace</a><li><code id=the-stack-of-open-elements:the-option-element><a href=#the-option-element>option</a></code> in the <a href=#html-namespace-2 id=the-stack-of-open-elements:html-namespace-2-17>HTML namespace</a></ul>
- <p>Nothing happens if at any time any of the elements in the <a href=#stack-of-open-elements id=the-stack-of-open-elements:stack-of-open-elements-12>stack of open elements</a>
- are moved to a new location in, or removed from, the <code id=the-stack-of-open-elements:document><a href=#document>Document</a></code> tree. In particular,
- the stack is not changed in this situation. This can cause, amongst other strange effects, content
- to be appended to nodes that are no longer in the DOM.</p>
- <p class=note>In some cases (namely, when <a href=#adoptionAgency>closing misnested formatting
- elements</a>), the stack is manipulated in a random-access fashion.</p>
- <h5 id=the-list-of-active-formatting-elements>12.2.3.3 The list of active formatting elements</h5>
- <p>Initially, the <dfn id=list-of-active-formatting-elements>list of active formatting elements</dfn> is empty. It is used to handle
- mis-nested <a href=#formatting id=the-list-of-active-formatting-elements:formatting>formatting element tags</a>.</p>
- <p>The list contains elements in the <a href=#formatting id=the-list-of-active-formatting-elements:formatting-2>formatting</a> category, and <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker>markers</a>. The <dfn id=concept-parser-marker>markers</dfn> are inserted when entering <code id=the-list-of-active-formatting-elements:the-applet-element><a href=#the-applet-element>applet</a></code>
- elements, buttons, <code id=the-list-of-active-formatting-elements:the-object-element><a href=#the-object-element>object</a></code> elements, marquees, table cells, and table captions, and
- are used to prevent formatting from "leaking" <em>into</em> <code id=the-list-of-active-formatting-elements:the-applet-element-2><a href=#the-applet-element>applet</a></code> elements, buttons,
- <code id=the-list-of-active-formatting-elements:the-object-element-2><a href=#the-object-element>object</a></code> elements, marquees, and tables.</p>
- <p>In addition, each element in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements>list of active formatting elements</a> is associated
- with the token for which it was created, so that further elements can be created for that token if
- necessary.</p>
- <p>When the steps below require the UA to <dfn id=push-onto-the-list-of-active-formatting-elements>push onto the list of active formatting
- elements</dfn> an element <var>element</var>, the UA must perform the following
- steps:</p>
- <ol id=noah><li><p>If there are already three elements in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-2>list of active formatting elements</a>
- after the last <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-2>marker</a>, if any, or anywhere in the
- list if there are no <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-3>markers</a>, that have the same tag
- name, namespace, and attributes as <var>element</var>, then remove the earliest such
- element from the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-3>list of active formatting elements</a>. For these purposes, the
- attributes must be compared as they were when the elements were created by the parser; two
- elements have the same attributes if all their parsed attributes can be paired such that the two
- attributes in each pair have identical names, namespaces, and values (the order of the attributes
- does not matter).</p>
- <p class=note>This is the Noah's Ark clause. But with three per family instead of two.<li><p>Add <var>element</var> to the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-4>list of active formatting
- elements</a>.</ol>
- <p>When the steps below require the UA to <dfn id=reconstruct-the-active-formatting-elements>reconstruct the active formatting elements</dfn>,
- the UA must perform the following steps:</p>
- <ol><li><p>If there are no entries in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-5>list of active formatting elements</a>, then there
- is nothing to reconstruct; stop this algorithm.<li><p>If the last (most recently added) entry in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-6>list of active formatting
- elements</a> is a <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-4>marker</a>, or if it is an element
- that is in the <a href=#stack-of-open-elements id=the-list-of-active-formatting-elements:stack-of-open-elements>stack of open elements</a>, then there is nothing to reconstruct; stop
- this algorithm.<li><p>Let <var>entry</var> be the last (most recently added) element in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-7>list
- of active formatting elements</a>.<li><p><i>Rewind</i>: If there are no entries before <var>entry</var> in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-8>list
- of active formatting elements</a>, then jump to the step labeled <i>create</i>.<li><p>Let <var>entry</var> be the entry one earlier than <var>entry</var> in
- the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-9>list of active formatting elements</a>.<li><p>If <var>entry</var> is neither a <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-5>marker</a> nor an element that is also in the <a href=#stack-of-open-elements id=the-list-of-active-formatting-elements:stack-of-open-elements-2>stack of
- open elements</a>, go to the step labeled <i>rewind</i>.<li><p><i>Advance</i>: Let <var>entry</var> be the element one later than <var>entry</var> in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-10>list of active formatting elements</a>.<li><p><i>Create</i>: <a href=#insert-an-html-element id=the-list-of-active-formatting-elements:insert-an-html-element>Insert an HTML element</a> for the token for which the element
- <var>entry</var> was created, to obtain <var>new element</var>.<li><p>Replace the entry for <var>entry</var> in the list with an entry for <var>new element</var>.<li><p>If the entry for <var>new element</var> in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-11>list of active formatting
- elements</a> is not the last entry in the list, return to the step labeled
- <i>advance</i>.</ol>
- <p>This has the effect of reopening all the formatting elements that were opened in the current
- body, cell, or caption (whichever is youngest) that haven't been explicitly closed.</p>
- <p class=note>The way this specification is written, the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-12>list of active formatting
- elements</a> always consists of elements in chronological order with the least recently added
- element first and the most recently added element last (except for while steps 8 to 11 of the
- above algorithm are being executed, of course).</p>
- <p>When the steps below require the UA to <dfn id=clear-the-list-of-active-formatting-elements-up-to-the-last-marker>clear the list of active formatting elements up to
- the last marker</dfn>, the UA must perform the following steps:</p>
- <ol><li><p>Let <var>entry</var> be the last (most recently added) entry in the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-13>list of
- active formatting elements</a>.<li><p>Remove <var>entry</var> from the <a href=#list-of-active-formatting-elements id=the-list-of-active-formatting-elements:list-of-active-formatting-elements-14>list of active formatting
- elements</a>.<li><p>If <var>entry</var> was a <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-6>marker</a>,
- then stop the algorithm at this point. The list has been cleared up to the last <a href=#concept-parser-marker id=the-list-of-active-formatting-elements:concept-parser-marker-7>marker</a>.<li><p>Go to step 1.</ol>
- <h5 id=the-element-pointers>12.2.3.4 The element pointers</h5>
- <p>Initially, the <dfn id=head-element-pointer><code>head</code> element pointer</dfn> and the <dfn id=form-element-pointer><code>form</code> element pointer</dfn> are both null.</p>
- <p>Once a <code id=the-element-pointers:the-head-element><a href=#the-head-element>head</a></code> element has been parsed (whether implicitly or explicitly) the
- <a href=#head-element-pointer id=the-element-pointers:head-element-pointer><code>head</code> element pointer</a> gets set to point to this node.</p>
- <p>The <a href=#form-element-pointer id=the-element-pointers:form-element-pointer><code>form</code> element pointer</a> points to the last
- <code id=the-element-pointers:the-form-element><a href=#the-form-element>form</a></code> element that was opened and whose end tag has not yet been seen. It is used to
- make form controls associate with forms in the face of dramatically bad markup, for historical
- reasons. It is ignored inside <code id=the-element-pointers:the-template-element><a href=#the-template-element>template</a></code> elements.</p>
- <h5 id=other-parsing-state-flags>12.2.3.5 Other parsing state flags</h5>
- <p>The <dfn id=scripting-flag>scripting flag</dfn> is set to "enabled" if <a href=#concept-n-script id=other-parsing-state-flags:concept-n-script>scripting
- was enabled</a> for the <code id=other-parsing-state-flags:document><a href=#document>Document</a></code> with which the parser is associated when the
- parser was created, and "disabled" otherwise.</p>
- <p class=note>The <a href=#scripting-flag id=other-parsing-state-flags:scripting-flag>scripting flag</a> can be enabled even when the parser was originally
- created for the <a href=#html-fragment-parsing-algorithm id=other-parsing-state-flags:html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a>, even though <code id=other-parsing-state-flags:the-script-element><a href=#the-script-element>script</a></code>
- elements don't execute in that case.</p>
- <p>The <dfn id=frameset-ok-flag>frameset-ok flag</dfn> is set to "ok" when the parser is created. It is set to "not
- ok" after certain tokens are seen.</p>
-
-
- <h4 id=tokenization>12.2.4 <dfn>Tokenization</dfn></h4>
- <p>Implementations must act as if they used the following state machine to tokenise HTML. The
- state machine must start in the <a href=#data-state id=tokenization:data-state>data state</a>. Most states consume a single character,
- which may have various side-effects, and either switches the state machine to a new state to
- <i>reconsume</i> the same character, or switches it to a new state to consume the next character,
- or stays in the same state to consume the next character. Some states have more complicated
- behavior and can consume several characters before switching to another state. In some cases, the
- tokenizer state is also changed by the tree construction stage.</p>
- <p>The exact behavior of certain states depends on the <a href=#insertion-mode id=tokenization:insertion-mode>insertion mode</a> and the
- <a href=#stack-of-open-elements id=tokenization:stack-of-open-elements>stack of open elements</a>. Certain states also use a <dfn id=temporary-buffer><var>temporary buffer</var></dfn> to track progress.</p>
- <p>The output of the tokenization step is a series of zero or more of the following tokens:
- DOCTYPE, start tag, end tag, comment, character, end-of-file. DOCTYPE tokens have a name, a public
- identifier, a system identifier, and a <dfn id=force-quirks-flag><i>force-quirks flag</i></dfn>. When a DOCTYPE token
- is created, its name, public identifier, and system identifier must be marked as missing (which is
- a distinct state from the empty string), and the <i id=tokenization:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> must be set to
- <i>off</i> (its other state is <i>on</i>). Start and end tag tokens have a tag name, a <dfn id=self-closing-flag>self-closing flag</dfn>, and a list of attributes, each of which has a
- name and a value. When a start or end tag token is created, its <i id=tokenization:self-closing-flag><a href=#self-closing-flag>self-closing flag</a></i> must be unset (its other state is that it be set), and its attributes
- list must be empty. Comment and character tokens have data.</p>
- <p>When a token is emitted, it must immediately be handled by the <a href=#tree-construction id=tokenization:tree-construction>tree construction</a>
- stage. The tree construction stage can affect the state of the tokenization stage, and can insert
- additional characters into the stream. (For example, the <code id=tokenization:the-script-element><a href=#the-script-element>script</a></code> element can result in
- scripts executing and using the <a href=#dynamic-markup-insertion id=tokenization:dynamic-markup-insertion>dynamic markup insertion</a> APIs to insert characters
- into the stream being tokenized.)</p>
- <p class=note>Creating a token and emitting it are distinct actions. It is possible for a token
- to be created but implicitly abandoned (never emitted), e.g. if the file ends unexpectedly while
- processing the characters that are being parsed into a start tag token.</p>
- <p>When a start tag token is emitted with its <i id=tokenization:self-closing-flag-2><a href=#self-closing-flag>self-closing flag</a></i> set, if the flag is not
- <dfn id=acknowledge-self-closing-flag>acknowledged</dfn> when it is processed by the tree
- construction stage, that is a <a href=#parse-error id=tokenization:parse-error>parse error</a>.</p>
- <p>When an end tag token is emitted with attributes, that is a <a href=#parse-error id=tokenization:parse-error-2>parse error</a>.</p>
- <p>When an end tag token is emitted with its <i id=tokenization:self-closing-flag-3><a href=#self-closing-flag>self-closing flag</a></i> set, that is a <a href=#parse-error id=tokenization:parse-error-3>parse
- error</a>.</p>
- <p>An <dfn id=appropriate-end-tag-token>appropriate end tag token</dfn> is an end tag token whose tag name matches the tag name
- of the last start tag to have been emitted from this tokenizer, if any. If no start tag has been
- emitted from this tokenizer, then no end tag token is appropriate.</p>
- <p>Before each step of the tokenizer, the user agent must first check the <a href=#parser-pause-flag id=tokenization:parser-pause-flag>parser pause
- flag</a>. If it is true, then the tokenizer must abort the processing of any nested invocations
- of the tokenizer, yielding control back to the caller.</p>
- <p>The tokenizer state machine consists of the states defined in the following subsections.</p>
-
- <h5 id=data-state>12.2.4.1 <dfn>Data state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=data-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#character-reference-in-data-state id=data-state:character-reference-in-data-state>character reference in data state</a>.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#tag-open-state id=data-state:tag-open-state>tag open state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=data-state:parse-error>Parse error</a>. Emit the <a href=#current-input-character id=data-state:current-input-character>current input character</a> as a character
- token.<dt>EOF<dd>Emit an end-of-file token.<dt>Anything else<dd>Emit the <a href=#current-input-character id=data-state:current-input-character-2>current input character</a> as a character token.</dl>
- <h5 id=character-reference-in-data-state>12.2.4.2 <dfn>Character reference in data state</dfn></h5>
- <p>Switch to the <a href=#data-state id=character-reference-in-data-state:data-state>data state</a>.</p>
- <p>Attempt to <a href=#consume-a-character-reference id=character-reference-in-data-state:consume-a-character-reference>consume a character reference</a>, with no <a href=#additional-allowed-character id=character-reference-in-data-state:additional-allowed-character>additional allowed
- character</a>.</p>
- <p>If nothing is returned, emit a U+0026 AMPERSAND character (&) token.</p>
- <p>Otherwise, emit the character tokens that were returned.</p>
- <h5 id=rcdata-state>12.2.4.3 <dfn>RCDATA state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=rcdata-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#character-reference-in-rcdata-state id=rcdata-state:character-reference-in-rcdata-state>character reference in RCDATA state</a>.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#rcdata-less-than-sign-state id=rcdata-state:rcdata-less-than-sign-state>RCDATA less-than sign state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=rcdata-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd>Emit an end-of-file token.<dt>Anything else<dd>Emit the <a href=#current-input-character id=rcdata-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=character-reference-in-rcdata-state>12.2.4.4 <dfn>Character reference in RCDATA state</dfn></h5>
- <p>Switch to the <a href=#rcdata-state id=character-reference-in-rcdata-state:rcdata-state>RCDATA state</a>.</p>
- <p>Attempt to <a href=#consume-a-character-reference id=character-reference-in-rcdata-state:consume-a-character-reference>consume a character reference</a>, with no <a href=#additional-allowed-character id=character-reference-in-rcdata-state:additional-allowed-character>additional allowed
- character</a>.</p>
- <p>If nothing is returned, emit a U+0026 AMPERSAND character (&) token.</p>
- <p>Otherwise, emit the character tokens that were returned.</p>
- <h5 id=rawtext-state>12.2.4.5 <dfn>RAWTEXT state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=rawtext-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#rawtext-less-than-sign-state id=rawtext-state:rawtext-less-than-sign-state>RAWTEXT less-than sign state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=rawtext-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd>Emit an end-of-file token.<dt>Anything else<dd>Emit the <a href=#current-input-character id=rawtext-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=script-data-state>12.2.4.6 <dfn>Script data state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-less-than-sign-state id=script-data-state:script-data-less-than-sign-state>script data less-than sign state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd>Emit an end-of-file token.<dt>Anything else<dd>Emit the <a href=#current-input-character id=script-data-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=plaintext-state>12.2.4.7 <dfn>PLAINTEXT state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=plaintext-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0000 NULL<dd><a href=#parse-error id=plaintext-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd>Emit an end-of-file token.<dt>Anything else<dd>Emit the <a href=#current-input-character id=plaintext-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=tag-open-state>12.2.4.8 <dfn>Tag open state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0021 EXCLAMATION MARK (!)<dd>Switch to the <a href=#markup-declaration-open-state id=tag-open-state:markup-declaration-open-state>markup declaration open state</a>.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#end-tag-open-state id=tag-open-state:end-tag-open-state>end tag open state</a>.<dt><a href=#uppercase-ascii-letters id=tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new start tag token, set its tag name to the lowercase version of the <a href=#current-input-character id=tag-open-state:current-input-character>current
- input character</a> (add 0x0020 to the character's code point), then switch to the <a href=#tag-name-state id=tag-open-state:tag-name-state>tag
- name state</a>. (Don't emit the token yet; further details will be filled in before it is
- emitted.)<dt><a href=#lowercase-ascii-letters id=tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new start tag token, set its tag name to the <a href=#current-input-character id=tag-open-state:current-input-character-2>current input character</a>,
- then switch to the <a href=#tag-name-state id=tag-open-state:tag-name-state-2>tag name state</a>. (Don't emit the token yet; further details will
- be filled in before it is emitted.)<dt>U+003F QUESTION MARK (?)<dd><a href=#parse-error id=tag-open-state:parse-error>Parse error</a>. Switch to the <a href=#bogus-comment-state id=tag-open-state:bogus-comment-state>bogus comment state</a>.<dt>Anything else<dd><a href=#parse-error id=tag-open-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=tag-open-state:data-state>data state</a>. Emit a U+003C LESS-THAN SIGN
- character token. Reconsume the <a href=#current-input-character id=tag-open-state:current-input-character-3>current input character</a>.</dl>
- <h5 id=end-tag-open-state>12.2.4.9 <dfn>End tag open state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=end-tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt><a href=#uppercase-ascii-letters id=end-tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new end tag token, set its tag name to the lowercase version of the <a href=#current-input-character id=end-tag-open-state:current-input-character>current
- input character</a> (add 0x0020 to the character's code point), then switch to the <a href=#tag-name-state id=end-tag-open-state:tag-name-state>tag
- name state</a>. (Don't emit the token yet; further details will be filled in before it is
- emitted.)<dt><a href=#lowercase-ascii-letters id=end-tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new end tag token, set its tag name to the <a href=#current-input-character id=end-tag-open-state:current-input-character-2>current input character</a>,
- then switch to the <a href=#tag-name-state id=end-tag-open-state:tag-name-state-2>tag name state</a>. (Don't emit the token yet; further details will
- be filled in before it is emitted.)<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=end-tag-open-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=end-tag-open-state:data-state>data state</a>.<dt>EOF<dd><a href=#parse-error id=end-tag-open-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=end-tag-open-state:data-state-2>data state</a>. Emit a U+003C LESS-THAN SIGN
- character token and a U+002F SOLIDUS character token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=end-tag-open-state:parse-error-3>Parse error</a>. Switch to the <a href=#bogus-comment-state id=end-tag-open-state:bogus-comment-state>bogus comment state</a>.</dl>
- <h5 id=tag-name-state>12.2.4.10 <dfn>Tag name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=tag-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-attribute-name-state id=tag-name-state:before-attribute-name-state>before attribute name state</a>.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#self-closing-start-tag-state id=tag-name-state:self-closing-start-tag-state>self-closing start tag state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=tag-name-state:data-state>data state</a>. Emit the current tag token.<dt><a href=#uppercase-ascii-letters id=tag-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=tag-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current tag token's tag name.<dt>U+0000 NULL<dd><a href=#parse-error id=tag-name-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current tag
- token's tag name.<dt>EOF<dd><a href=#parse-error id=tag-name-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=tag-name-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=tag-name-state:current-input-character-2>current input character</a> to the current tag token's tag name.</dl>
- <h5 id=rcdata-less-than-sign-state>12.2.4.11 <dfn>RCDATA less-than sign state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rcdata-less-than-sign-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002F SOLIDUS (/)<dd>Set the <var id=rcdata-less-than-sign-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch to
- the <a href=#rcdata-end-tag-open-state id=rcdata-less-than-sign-state:rcdata-end-tag-open-state>RCDATA end tag open state</a>.<dt>Anything else<dd>Switch to the <a href=#rcdata-state id=rcdata-less-than-sign-state:rcdata-state>RCDATA state</a>. Emit a U+003C LESS-THAN SIGN character token.
- Reconsume the <a href=#current-input-character id=rcdata-less-than-sign-state:current-input-character>current input character</a>.</dl>
- <h5 id=rcdata-end-tag-open-state>12.2.4.12 <dfn>RCDATA end tag open state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rcdata-end-tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt><a href=#uppercase-ascii-letters id=rcdata-end-tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the lowercase version of the
- <a href=#current-input-character id=rcdata-end-tag-open-state:current-input-character>current input character</a> (add 0x0020 to the character's code point). Append the
- <a href=#current-input-character id=rcdata-end-tag-open-state:current-input-character-2>current input character</a> to the <var id=rcdata-end-tag-open-state:temporary-buffer><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#rcdata-end-tag-name-state id=rcdata-end-tag-open-state:rcdata-end-tag-name-state>RCDATA end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt><a href=#lowercase-ascii-letters id=rcdata-end-tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the <a href=#current-input-character id=rcdata-end-tag-open-state:current-input-character-3>current input character</a>.
- Append the <a href=#current-input-character id=rcdata-end-tag-open-state:current-input-character-4>current input character</a> to the <var id=rcdata-end-tag-open-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#rcdata-end-tag-name-state id=rcdata-end-tag-open-state:rcdata-end-tag-name-state-2>RCDATA end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt>Anything else<dd>Switch to the <a href=#rcdata-state id=rcdata-end-tag-open-state:rcdata-state>RCDATA state</a>. Emit a U+003C LESS-THAN SIGN character token and a
- U+002F SOLIDUS character token. Reconsume the <a href=#current-input-character id=rcdata-end-tag-open-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=rcdata-end-tag-name-state>12.2.4.13 <dfn>RCDATA end tag name state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rcdata-end-tag-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rcdata-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token</a>, then switch to the
- <a href=#before-attribute-name-state id=rcdata-end-tag-name-state:before-attribute-name-state>before attribute name state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+002F SOLIDUS (/)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rcdata-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token</a>, then switch to the
- <a href=#self-closing-start-tag-state id=rcdata-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+003E GREATER-THAN SIGN (>)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rcdata-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token</a>, then switch to the
- <a href=#data-state id=rcdata-end-tag-name-state:data-state>data state</a> and emit the current tag token. Otherwise, treat it as per the "anything
- else" entry below.<dt><a href=#uppercase-ascii-letters id=rcdata-end-tag-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current tag token's tag name. Append the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character-2>current input
- character</a> to the <var id=rcdata-end-tag-name-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var>.<dt><a href=#lowercase-ascii-letters id=rcdata-end-tag-name-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character-3>current input character</a> to the current tag token's tag name. Append
- the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character-4>current input character</a> to the <var id=rcdata-end-tag-name-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>.<dt>Anything else<dd>Switch to the <a href=#rcdata-state id=rcdata-end-tag-name-state:rcdata-state>RCDATA state</a>. Emit a U+003C LESS-THAN SIGN character token, a
- U+002F SOLIDUS character token, and a character token for each of the characters in the <var id=rcdata-end-tag-name-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the buffer).
- Reconsume the <a href=#current-input-character id=rcdata-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=rawtext-less-than-sign-state>12.2.4.14 <dfn>RAWTEXT less-than sign state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rawtext-less-than-sign-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002F SOLIDUS (/)<dd>Set the <var id=rawtext-less-than-sign-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch to
- the <a href=#rawtext-end-tag-open-state id=rawtext-less-than-sign-state:rawtext-end-tag-open-state>RAWTEXT end tag open state</a>.<dt>Anything else<dd>Switch to the <a href=#rawtext-state id=rawtext-less-than-sign-state:rawtext-state>RAWTEXT state</a>. Emit a U+003C LESS-THAN SIGN character token.
- Reconsume the <a href=#current-input-character id=rawtext-less-than-sign-state:current-input-character>current input character</a>.</dl>
- <h5 id=rawtext-end-tag-open-state>12.2.4.15 <dfn>RAWTEXT end tag open state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rawtext-end-tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt><a href=#uppercase-ascii-letters id=rawtext-end-tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the lowercase version of the
- <a href=#current-input-character id=rawtext-end-tag-open-state:current-input-character>current input character</a> (add 0x0020 to the character's code point). Append the
- <a href=#current-input-character id=rawtext-end-tag-open-state:current-input-character-2>current input character</a> to the <var id=rawtext-end-tag-open-state:temporary-buffer><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#rawtext-end-tag-name-state id=rawtext-end-tag-open-state:rawtext-end-tag-name-state>RAWTEXT end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt><a href=#lowercase-ascii-letters id=rawtext-end-tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the <a href=#current-input-character id=rawtext-end-tag-open-state:current-input-character-3>current input character</a>.
- Append the <a href=#current-input-character id=rawtext-end-tag-open-state:current-input-character-4>current input character</a> to the <var id=rawtext-end-tag-open-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#rawtext-end-tag-name-state id=rawtext-end-tag-open-state:rawtext-end-tag-name-state-2>RAWTEXT end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt>Anything else<dd>Switch to the <a href=#rawtext-state id=rawtext-end-tag-open-state:rawtext-state>RAWTEXT state</a>. Emit a U+003C LESS-THAN SIGN character token and a
- U+002F SOLIDUS character token. Reconsume the <a href=#current-input-character id=rawtext-end-tag-open-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=rawtext-end-tag-name-state>12.2.4.16 <dfn>RAWTEXT end tag name state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=rawtext-end-tag-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rawtext-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token</a>, then switch to the
- <a href=#before-attribute-name-state id=rawtext-end-tag-name-state:before-attribute-name-state>before attribute name state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+002F SOLIDUS (/)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rawtext-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token</a>, then switch to the
- <a href=#self-closing-start-tag-state id=rawtext-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+003E GREATER-THAN SIGN (>)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=rawtext-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token</a>, then switch to the
- <a href=#data-state id=rawtext-end-tag-name-state:data-state>data state</a> and emit the current tag token. Otherwise, treat it as per the "anything
- else" entry below.<dt><a href=#uppercase-ascii-letters id=rawtext-end-tag-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current tag token's tag name. Append the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character-2>current input
- character</a> to the <var id=rawtext-end-tag-name-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var>.<dt><a href=#lowercase-ascii-letters id=rawtext-end-tag-name-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character-3>current input character</a> to the current tag token's tag name. Append
- the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character-4>current input character</a> to the <var id=rawtext-end-tag-name-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>.<dt>Anything else<dd>Switch to the <a href=#rawtext-state id=rawtext-end-tag-name-state:rawtext-state>RAWTEXT state</a>. Emit a U+003C LESS-THAN SIGN character token, a
- U+002F SOLIDUS character token, and a character token for each of the characters in the <var id=rawtext-end-tag-name-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the buffer).
- Reconsume the <a href=#current-input-character id=rawtext-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=script-data-less-than-sign-state>12.2.4.17 <dfn>Script data less-than sign state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-less-than-sign-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002F SOLIDUS (/)<dd>Set the <var id=script-data-less-than-sign-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch to
- the <a href=#script-data-end-tag-open-state id=script-data-less-than-sign-state:script-data-end-tag-open-state>script data end tag open state</a>.<dt>U+0021 EXCLAMATION MARK (!)<dd>Switch to the <a href=#script-data-escape-start-state id=script-data-less-than-sign-state:script-data-escape-start-state>script data escape start state</a>. Emit a U+003C LESS-THAN SIGN
- character token and a U+0021 EXCLAMATION MARK character token.<dt>Anything else<dd>Switch to the <a href=#script-data-state id=script-data-less-than-sign-state:script-data-state>script data state</a>. Emit a U+003C LESS-THAN SIGN character token.
- Reconsume the <a href=#current-input-character id=script-data-less-than-sign-state:current-input-character>current input character</a>.</dl>
- <h5 id=script-data-end-tag-open-state>12.2.4.18 <dfn>Script data end tag open state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=script-data-end-tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt><a href=#uppercase-ascii-letters id=script-data-end-tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the lowercase version of the
- <a href=#current-input-character id=script-data-end-tag-open-state:current-input-character>current input character</a> (add 0x0020 to the character's code point). Append the
- <a href=#current-input-character id=script-data-end-tag-open-state:current-input-character-2>current input character</a> to the <var id=script-data-end-tag-open-state:temporary-buffer><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#script-data-end-tag-name-state id=script-data-end-tag-open-state:script-data-end-tag-name-state>script data end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt><a href=#lowercase-ascii-letters id=script-data-end-tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the <a href=#current-input-character id=script-data-end-tag-open-state:current-input-character-3>current input character</a>.
- Append the <a href=#current-input-character id=script-data-end-tag-open-state:current-input-character-4>current input character</a> to the <var id=script-data-end-tag-open-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#script-data-end-tag-name-state id=script-data-end-tag-open-state:script-data-end-tag-name-state-2>script data end tag name state</a>. (Don't emit the
- token yet; further details will be filled in before it is emitted.)<dt>Anything else<dd>Switch to the <a href=#script-data-state id=script-data-end-tag-open-state:script-data-state>script data state</a>. Emit a U+003C LESS-THAN SIGN character token
- and a U+002F SOLIDUS character token. Reconsume the <a href=#current-input-character id=script-data-end-tag-open-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=script-data-end-tag-name-state>12.2.4.19 <dfn>Script data end tag name state</dfn></h5>
-
- <p>Consume the <a href=#next-input-character id=script-data-end-tag-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token</a>, then switch to the
- <a href=#before-attribute-name-state id=script-data-end-tag-name-state:before-attribute-name-state>before attribute name state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+002F SOLIDUS (/)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token</a>, then switch to the
- <a href=#self-closing-start-tag-state id=script-data-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+003E GREATER-THAN SIGN (>)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token</a>, then switch to the
- <a href=#data-state id=script-data-end-tag-name-state:data-state>data state</a> and emit the current tag token. Otherwise, treat it as per the "anything
- else" entry below.<dt><a href=#uppercase-ascii-letters id=script-data-end-tag-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current tag token's tag name. Append the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character-2>current input
- character</a> to the <var id=script-data-end-tag-name-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var>.<dt><a href=#lowercase-ascii-letters id=script-data-end-tag-name-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character-3>current input character</a> to the current tag token's tag name. Append
- the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character-4>current input character</a> to the <var id=script-data-end-tag-name-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>.<dt>Anything else<dd>Switch to the <a href=#script-data-state id=script-data-end-tag-name-state:script-data-state>script data state</a>. Emit a U+003C LESS-THAN SIGN character token, a
- U+002F SOLIDUS character token, and a character token for each of the characters in the <var id=script-data-end-tag-name-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the buffer).
- Reconsume the <a href=#current-input-character id=script-data-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=script-data-escape-start-state>12.2.4.20 <dfn>Script data escape start state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escape-start-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-escape-start-dash-state id=script-data-escape-start-state:script-data-escape-start-dash-state>script data escape start dash state</a>. Emit a U+002D HYPHEN-MINUS
- character token.<dt>Anything else<dd>Switch to the <a href=#script-data-state id=script-data-escape-start-state:script-data-state>script data state</a>. Reconsume the <a href=#current-input-character id=script-data-escape-start-state:current-input-character>current input
- character</a>.</dl>
- <h5 id=script-data-escape-start-dash-state>12.2.4.21 <dfn>Script data escape start dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escape-start-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-escaped-dash-dash-state id=script-data-escape-start-dash-state:script-data-escaped-dash-dash-state>script data escaped dash dash state</a>. Emit a U+002D HYPHEN-MINUS
- character token.<dt>Anything else<dd>Switch to the <a href=#script-data-state id=script-data-escape-start-dash-state:script-data-state>script data state</a>. Reconsume the <a href=#current-input-character id=script-data-escape-start-dash-state:current-input-character>current input
- character</a>.</dl>
- <h5 id=script-data-escaped-state>12.2.4.22 <dfn>Script data escaped state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-escaped-dash-state id=script-data-escaped-state:script-data-escaped-dash-state>script data escaped dash state</a>. Emit a U+002D HYPHEN-MINUS
- character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-escaped-less-than-sign-state id=script-data-escaped-state:script-data-escaped-less-than-sign-state>script data escaped less-than sign state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-escaped-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd>Switch to the <a href=#data-state id=script-data-escaped-state:data-state>data state</a>. <a href=#parse-error id=script-data-escaped-state:parse-error-2>Parse error</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Emit the <a href=#current-input-character id=script-data-escaped-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=script-data-escaped-dash-state>12.2.4.23 <dfn>Script data escaped dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-escaped-dash-dash-state id=script-data-escaped-dash-state:script-data-escaped-dash-dash-state>script data escaped dash dash state</a>. Emit a U+002D HYPHEN-MINUS
- character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-escaped-less-than-sign-state id=script-data-escaped-dash-state:script-data-escaped-less-than-sign-state>script data escaped less-than sign state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-escaped-dash-state:parse-error>Parse error</a>. Switch to the <a href=#script-data-escaped-state id=script-data-escaped-dash-state:script-data-escaped-state>script data escaped state</a>. Emit a U+FFFD
- REPLACEMENT CHARACTER character token.<dt>EOF<dd><a href=#parse-error id=script-data-escaped-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=script-data-escaped-dash-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-escaped-dash-state:script-data-escaped-state-2>script data escaped state</a>. Emit the <a href=#current-input-character id=script-data-escaped-dash-state:current-input-character>current input
- character</a> as a character token.</dl>
- <h5 id=script-data-escaped-dash-dash-state>12.2.4.24 <dfn>Script data escaped dash dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-dash-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Emit a U+002D HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-escaped-less-than-sign-state id=script-data-escaped-dash-dash-state:script-data-escaped-less-than-sign-state>script data escaped less-than sign state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#script-data-state id=script-data-escaped-dash-dash-state:script-data-state>script data state</a>. Emit a U+003E GREATER-THAN SIGN character
- token.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-escaped-dash-dash-state:parse-error>Parse error</a>. Switch to the <a href=#script-data-escaped-state id=script-data-escaped-dash-dash-state:script-data-escaped-state>script data escaped state</a>. Emit a U+FFFD
- REPLACEMENT CHARACTER character token.<dt>EOF<dd><a href=#parse-error id=script-data-escaped-dash-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=script-data-escaped-dash-dash-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-escaped-dash-dash-state:script-data-escaped-state-2>script data escaped state</a>. Emit the <a href=#current-input-character id=script-data-escaped-dash-dash-state:current-input-character>current input
- character</a> as a character token.</dl>
- <h5 id=script-data-escaped-less-than-sign-state>12.2.4.25 <dfn>Script data escaped less-than sign state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-less-than-sign-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002F SOLIDUS (/)<dd>Set the <var id=script-data-escaped-less-than-sign-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch to
- the <a href=#script-data-escaped-end-tag-open-state id=script-data-escaped-less-than-sign-state:script-data-escaped-end-tag-open-state>script data escaped end tag open state</a>.<dt><a href=#uppercase-ascii-letters id=script-data-escaped-less-than-sign-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Set the <var id=script-data-escaped-less-than-sign-state:temporary-buffer-2><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append the
- lowercase version of the <a href=#current-input-character id=script-data-escaped-less-than-sign-state:current-input-character>current input character</a> (add 0x0020 to the character's code
- point) to the <var id=script-data-escaped-less-than-sign-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state id=script-data-escaped-less-than-sign-state:script-data-double-escape-start-state>script
- data double escape start state</a>. Emit a U+003C LESS-THAN SIGN character token and the
- <a href=#current-input-character id=script-data-escaped-less-than-sign-state:current-input-character-2>current input character</a> as a character token.<dt><a href=#lowercase-ascii-letters id=script-data-escaped-less-than-sign-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Set the <var id=script-data-escaped-less-than-sign-state:temporary-buffer-4><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Append the
- <a href=#current-input-character id=script-data-escaped-less-than-sign-state:current-input-character-3>current input character</a> to the <var id=script-data-escaped-less-than-sign-state:temporary-buffer-5><a href=#temporary-buffer>temporary
- buffer</a></var>. Switch to the <a href=#script-data-double-escape-start-state id=script-data-escaped-less-than-sign-state:script-data-double-escape-start-state-2>script data double escape start state</a>. Emit a U+003C
- LESS-THAN SIGN character token and the <a href=#current-input-character id=script-data-escaped-less-than-sign-state:current-input-character-4>current input character</a> as a character
- token.<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-escaped-less-than-sign-state:script-data-escaped-state>script data escaped state</a>. Emit a U+003C LESS-THAN SIGN character
- token. Reconsume the <a href=#current-input-character id=script-data-escaped-less-than-sign-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=script-data-escaped-end-tag-open-state>12.2.4.26 <dfn>Script data escaped end tag open state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-end-tag-open-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt><a href=#uppercase-ascii-letters id=script-data-escaped-end-tag-open-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the lowercase version of the
- <a href=#current-input-character id=script-data-escaped-end-tag-open-state:current-input-character>current input character</a> (add 0x0020 to the character's code point). Append the
- <a href=#current-input-character id=script-data-escaped-end-tag-open-state:current-input-character-2>current input character</a> to the <var id=script-data-escaped-end-tag-open-state:temporary-buffer><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#script-data-escaped-end-tag-name-state id=script-data-escaped-end-tag-open-state:script-data-escaped-end-tag-name-state>script data escaped end tag name state</a>. (Don't
- emit the token yet; further details will be filled in before it is emitted.)<dt><a href=#lowercase-ascii-letters id=script-data-escaped-end-tag-open-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Create a new end tag token, and set its tag name to the <a href=#current-input-character id=script-data-escaped-end-tag-open-state:current-input-character-3>current input character</a>.
- Append the <a href=#current-input-character id=script-data-escaped-end-tag-open-state:current-input-character-4>current input character</a> to the <var id=script-data-escaped-end-tag-open-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>. Finally, switch to the <a href=#script-data-escaped-end-tag-name-state id=script-data-escaped-end-tag-open-state:script-data-escaped-end-tag-name-state-2>script data escaped end tag name state</a>. (Don't
- emit the token yet; further details will be filled in before it is emitted.)<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-escaped-end-tag-open-state:script-data-escaped-state>script data escaped state</a>. Emit a U+003C LESS-THAN SIGN character
- token and a U+002F SOLIDUS character token. Reconsume the <a href=#current-input-character id=script-data-escaped-end-tag-open-state:current-input-character-5>current input
- character</a>.</dl>
- <h5 id=script-data-escaped-end-tag-name-state>12.2.4.27 <dfn>Script data escaped end tag name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-escaped-end-tag-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-escaped-end-tag-name-state:appropriate-end-tag-token>appropriate end tag token</a>, then switch to the
- <a href=#before-attribute-name-state id=script-data-escaped-end-tag-name-state:before-attribute-name-state>before attribute name state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+002F SOLIDUS (/)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-escaped-end-tag-name-state:appropriate-end-tag-token-2>appropriate end tag token</a>, then switch to the
- <a href=#self-closing-start-tag-state id=script-data-escaped-end-tag-name-state:self-closing-start-tag-state>self-closing start tag state</a>. Otherwise, treat it as per the "anything else" entry
- below.<dt>U+003E GREATER-THAN SIGN (>)<dd>If the current end tag token is an <a href=#appropriate-end-tag-token id=script-data-escaped-end-tag-name-state:appropriate-end-tag-token-3>appropriate end tag token</a>, then switch to the
- <a href=#data-state id=script-data-escaped-end-tag-name-state:data-state>data state</a> and emit the current tag token. Otherwise, treat it as per the "anything
- else" entry below.<dt><a href=#uppercase-ascii-letters id=script-data-escaped-end-tag-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=script-data-escaped-end-tag-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current tag token's tag name. Append the <a href=#current-input-character id=script-data-escaped-end-tag-name-state:current-input-character-2>current input
- character</a> to the <var id=script-data-escaped-end-tag-name-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var>.<dt><a href=#lowercase-ascii-letters id=script-data-escaped-end-tag-name-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=script-data-escaped-end-tag-name-state:current-input-character-3>current input character</a> to the current tag token's tag name. Append
- the <a href=#current-input-character id=script-data-escaped-end-tag-name-state:current-input-character-4>current input character</a> to the <var id=script-data-escaped-end-tag-name-state:temporary-buffer-2><a href=#temporary-buffer>temporary
- buffer</a></var>.<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-escaped-end-tag-name-state:script-data-escaped-state>script data escaped state</a>. Emit a U+003C LESS-THAN SIGN character
- token, a U+002F SOLIDUS character token, and a character token for each of the characters in the
- <var id=script-data-escaped-end-tag-name-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var> (in the order they were added to the
- buffer). Reconsume the <a href=#current-input-character id=script-data-escaped-end-tag-name-state:current-input-character-5>current input character</a>.</dl>
- <h5 id=script-data-double-escape-start-state>12.2.4.28 <dfn>Script data double escape start state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escape-start-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dt>U+002F SOLIDUS (/)<dt>U+003E GREATER-THAN SIGN (>)<dd>If the <var id=script-data-double-escape-start-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code>script</code>", then switch to the <a href=#script-data-double-escaped-state id=script-data-double-escape-start-state:script-data-double-escaped-state>script data double escaped state</a>.
- Otherwise, switch to the <a href=#script-data-escaped-state id=script-data-double-escape-start-state:script-data-escaped-state>script data escaped state</a>. Emit the <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character>current input
- character</a> as a character token.<dt><a href=#uppercase-ascii-letters id=script-data-double-escape-start-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character-2>current input character</a> (add 0x0020 to the
- character's code point) to the <var id=script-data-double-escape-start-state:temporary-buffer-2><a href=#temporary-buffer>temporary buffer</a></var>. Emit the
- <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character-3>current input character</a> as a character token.<dt><a href=#lowercase-ascii-letters id=script-data-double-escape-start-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character-4>current input character</a> to the <var id=script-data-double-escape-start-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character-5>current input character</a> as a character
- token.<dt>Anything else<dd>Switch to the <a href=#script-data-escaped-state id=script-data-double-escape-start-state:script-data-escaped-state-2>script data escaped state</a>. Reconsume the <a href=#current-input-character id=script-data-double-escape-start-state:current-input-character-6>current input
- character</a>.</dl>
- <h5 id=script-data-double-escaped-state>12.2.4.29 <dfn>Script data double escaped state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escaped-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-double-escaped-dash-state id=script-data-double-escaped-state:script-data-double-escaped-dash-state>script data double escaped dash state</a>. Emit a U+002D HYPHEN-MINUS
- character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-double-escaped-less-than-sign-state id=script-data-double-escaped-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state</a>. Emit a U+003C
- LESS-THAN SIGN character token.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-double-escaped-state:parse-error>Parse error</a>. Emit a U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd><a href=#parse-error id=script-data-double-escaped-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=script-data-double-escaped-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Emit the <a href=#current-input-character id=script-data-double-escaped-state:current-input-character>current input character</a> as a character token.</dl>
- <h5 id=script-data-double-escaped-dash-state>12.2.4.30 <dfn>Script data double escaped dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escaped-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#script-data-double-escaped-dash-dash-state id=script-data-double-escaped-dash-state:script-data-double-escaped-dash-dash-state>script data double escaped dash dash state</a>. Emit a U+002D
- HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-double-escaped-less-than-sign-state id=script-data-double-escaped-dash-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state</a>. Emit a U+003C
- LESS-THAN SIGN character token.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-double-escaped-dash-state:parse-error>Parse error</a>. Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escaped-dash-state:script-data-double-escaped-state>script data double escaped state</a>. Emit a
- U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd><a href=#parse-error id=script-data-double-escaped-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=script-data-double-escaped-dash-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escaped-dash-state:script-data-double-escaped-state-2>script data double escaped state</a>. Emit the <a href=#current-input-character id=script-data-double-escaped-dash-state:current-input-character>current input
- character</a> as a character token.</dl>
- <h5 id=script-data-double-escaped-dash-dash-state>12.2.4.31 <dfn>Script data double escaped dash dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escaped-dash-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Emit a U+002D HYPHEN-MINUS character token.<dt>U+003C LESS-THAN SIGN (<)<dd>Switch to the <a href=#script-data-double-escaped-less-than-sign-state id=script-data-double-escaped-dash-dash-state:script-data-double-escaped-less-than-sign-state>script data double escaped less-than sign state</a>. Emit a U+003C
- LESS-THAN SIGN character token.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#script-data-state id=script-data-double-escaped-dash-dash-state:script-data-state>script data state</a>. Emit a U+003E GREATER-THAN SIGN character
- token.<dt>U+0000 NULL<dd><a href=#parse-error id=script-data-double-escaped-dash-dash-state:parse-error>Parse error</a>. Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escaped-dash-dash-state:script-data-double-escaped-state>script data double escaped state</a>. Emit a
- U+FFFD REPLACEMENT CHARACTER character token.<dt>EOF<dd><a href=#parse-error id=script-data-double-escaped-dash-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=script-data-double-escaped-dash-dash-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escaped-dash-dash-state:script-data-double-escaped-state-2>script data double escaped state</a>. Emit the <a href=#current-input-character id=script-data-double-escaped-dash-dash-state:current-input-character>current input
- character</a> as a character token.</dl>
- <h5 id=script-data-double-escaped-less-than-sign-state>12.2.4.32 <dfn>Script data double escaped less-than sign state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escaped-less-than-sign-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002F SOLIDUS (/)<dd>Set the <var id=script-data-double-escaped-less-than-sign-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> to the empty string. Switch to
- the <a href=#script-data-double-escape-end-state id=script-data-double-escaped-less-than-sign-state:script-data-double-escape-end-state>script data double escape end state</a>. Emit a U+002F SOLIDUS character token.<dt>Anything else<dd>Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escaped-less-than-sign-state:script-data-double-escaped-state>script data double escaped state</a>. Reconsume the <a href=#current-input-character id=script-data-double-escaped-less-than-sign-state:current-input-character>current
- input character</a>.</dl>
- <h5 id=script-data-double-escape-end-state>12.2.4.33 <dfn>Script data double escape end state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=script-data-double-escape-end-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dt>U+002F SOLIDUS (/)<dt>U+003E GREATER-THAN SIGN (>)<dd>If the <var id=script-data-double-escape-end-state:temporary-buffer><a href=#temporary-buffer>temporary buffer</a></var> is the string "<code>script</code>", then switch to the <a href=#script-data-escaped-state id=script-data-double-escape-end-state:script-data-escaped-state>script data escaped state</a>. Otherwise,
- switch to the <a href=#script-data-double-escaped-state id=script-data-double-escape-end-state:script-data-double-escaped-state>script data double escaped state</a>. Emit the <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character>current input
- character</a> as a character token.<dt><a href=#uppercase-ascii-letters id=script-data-double-escape-end-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character-2>current input character</a> (add 0x0020 to the
- character's code point) to the <var id=script-data-double-escape-end-state:temporary-buffer-2><a href=#temporary-buffer>temporary buffer</a></var>. Emit the
- <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character-3>current input character</a> as a character token.<dt><a href=#lowercase-ascii-letters id=script-data-double-escape-end-state:lowercase-ascii-letters>Lowercase ASCII letter</a><dd>Append the <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character-4>current input character</a> to the <var id=script-data-double-escape-end-state:temporary-buffer-3><a href=#temporary-buffer>temporary buffer</a></var>. Emit the <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character-5>current input character</a> as a character
- token.<dt>Anything else<dd>Switch to the <a href=#script-data-double-escaped-state id=script-data-double-escape-end-state:script-data-double-escaped-state-2>script data double escaped state</a>. Reconsume the <a href=#current-input-character id=script-data-double-escape-end-state:current-input-character-6>current
- input character</a>.</dl>
- <h5 id=before-attribute-name-state>12.2.4.34 <dfn>Before attribute name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=before-attribute-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#self-closing-start-tag-state id=before-attribute-name-state:self-closing-start-tag-state>self-closing start tag state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=before-attribute-name-state:data-state>data state</a>. Emit the current tag token.<dt><a href=#uppercase-ascii-letters id=before-attribute-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Start a new attribute in the current tag token. Set that attribute's name to the lowercase
- version of the <a href=#current-input-character id=before-attribute-name-state:current-input-character>current input character</a> (add 0x0020 to the character's code point),
- and its value to the empty string. Switch to the <a href=#attribute-name-state id=before-attribute-name-state:attribute-name-state>attribute name state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=before-attribute-name-state:parse-error>Parse error</a>. Start a new attribute in the current tag token. Set that
- attribute's name to a U+FFFD REPLACEMENT CHARACTER character, and its value to the empty string.
- Switch to the <a href=#attribute-name-state id=before-attribute-name-state:attribute-name-state-2>attribute name state</a>.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (<)<dt>U+003D EQUALS SIGN (=)<dd><a href=#parse-error id=before-attribute-name-state:parse-error-2>Parse error</a>. Treat it as per the "anything else" entry below.<dt>EOF<dd><a href=#parse-error id=before-attribute-name-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=before-attribute-name-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Start a new attribute in the current tag token. Set that attribute's name to the
- <a href=#current-input-character id=before-attribute-name-state:current-input-character-2>current input character</a>, and its value to the empty string. Switch to the
- <a href=#attribute-name-state id=before-attribute-name-state:attribute-name-state-3>attribute name state</a>.</dl>
- <h5 id=attribute-name-state>12.2.4.35 <dfn>Attribute name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=attribute-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#after-attribute-name-state id=attribute-name-state:after-attribute-name-state>after attribute name state</a>.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#self-closing-start-tag-state id=attribute-name-state:self-closing-start-tag-state>self-closing start tag state</a>.<dt>U+003D EQUALS SIGN (=)<dd>Switch to the <a href=#before-attribute-value-state id=attribute-name-state:before-attribute-value-state>before attribute value state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=attribute-name-state:data-state>data state</a>. Emit the current tag token.<dt><a href=#uppercase-ascii-letters id=attribute-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=attribute-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current attribute's name.<dt>U+0000 NULL<dd><a href=#parse-error id=attribute-name-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- attribute's name.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (<)<dd><a href=#parse-error id=attribute-name-state:parse-error-2>Parse error</a>. Treat it as per the "anything else" entry below.<dt>EOF<dd><a href=#parse-error id=attribute-name-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=attribute-name-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=attribute-name-state:current-input-character-2>current input character</a> to the current attribute's name.</dl>
- <p>When the user agent leaves the attribute name state (and before emitting the tag token, if
- appropriate), the complete attribute's name must be compared to the other attributes on the same
- token; if there is already an attribute on the token with the exact same name, then this is a
- <a href=#parse-error id=attribute-name-state:parse-error-4>parse error</a> and the new attribute must be removed from the token.</p>
- <p class=note>If an attribute is so removed from a token, it, and the value that gets associated
- with it, if any, are never subsequently used by the parser, and are therefore effectively
- discarded. Removing the attribute in this way does not change its status as the "current
- attribute" for the purposes of the tokenizer, however.</p>
- <h5 id=after-attribute-name-state>12.2.4.36 <dfn>After attribute name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-attribute-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#self-closing-start-tag-state id=after-attribute-name-state:self-closing-start-tag-state>self-closing start tag state</a>.<dt>U+003D EQUALS SIGN (=)<dd>Switch to the <a href=#before-attribute-value-state id=after-attribute-name-state:before-attribute-value-state>before attribute value state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=after-attribute-name-state:data-state>data state</a>. Emit the current tag token.<dt><a href=#uppercase-ascii-letters id=after-attribute-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Start a new attribute in the current tag token. Set that attribute's name to the lowercase
- version of the <a href=#current-input-character id=after-attribute-name-state:current-input-character>current input character</a> (add 0x0020 to the character's code point),
- and its value to the empty string. Switch to the <a href=#attribute-name-state id=after-attribute-name-state:attribute-name-state>attribute name state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=after-attribute-name-state:parse-error>Parse error</a>. Start a new attribute in the current tag token. Set that
- attribute's name to a U+FFFD REPLACEMENT CHARACTER character, and its value to the empty string.
- Switch to the <a href=#attribute-name-state id=after-attribute-name-state:attribute-name-state-2>attribute name state</a>.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (<)<dd><a href=#parse-error id=after-attribute-name-state:parse-error-2>Parse error</a>. Treat it as per the "anything else" entry below.<dt>EOF<dd><a href=#parse-error id=after-attribute-name-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=after-attribute-name-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Start a new attribute in the current tag token. Set that attribute's name to the
- <a href=#current-input-character id=after-attribute-name-state:current-input-character-2>current input character</a>, and its value to the empty string. Switch to the
- <a href=#attribute-name-state id=after-attribute-name-state:attribute-name-state-3>attribute name state</a>.</dl>
- <h5 id=before-attribute-value-state>12.2.4.37 <dfn>Before attribute value state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=before-attribute-value-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+0022 QUOTATION MARK (")<dd>Switch to the <a href=#attribute-value-(double-quoted)-state id=before-attribute-value-state:attribute-value-(double-quoted)-state>attribute value (double-quoted) state</a>.<dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#attribute-value-(unquoted)-state id=before-attribute-value-state:attribute-value-(unquoted)-state>attribute value (unquoted) state</a>. Reconsume the <a href=#current-input-character id=before-attribute-value-state:current-input-character>current
- input character</a>.<dt>U+0027 APOSTROPHE (')<dd>Switch to the <a href=#attribute-value-(single-quoted)-state id=before-attribute-value-state:attribute-value-(single-quoted)-state>attribute value (single-quoted) state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=before-attribute-value-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- attribute's value. Switch to the <a href=#attribute-value-(unquoted)-state id=before-attribute-value-state:attribute-value-(unquoted)-state-2>attribute value (unquoted) state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=before-attribute-value-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=before-attribute-value-state:data-state>data state</a>. Emit the current tag
- token.<dt>U+003C LESS-THAN SIGN (<)<dt>U+003D EQUALS SIGN (=)<dt>U+0060 GRAVE ACCENT (`)<dd><a href=#parse-error id=before-attribute-value-state:parse-error-3>Parse error</a>. Treat it as per the "anything else" entry below.<dt>EOF<dd><a href=#parse-error id=before-attribute-value-state:parse-error-4>Parse error</a>. Switch to the <a href=#data-state id=before-attribute-value-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=before-attribute-value-state:current-input-character-2>current input character</a> to the current attribute's value. Switch to
- the <a href=#attribute-value-(unquoted)-state id=before-attribute-value-state:attribute-value-(unquoted)-state-3>attribute value (unquoted) state</a>.</dl>
- <h5 id=attribute-value-(double-quoted)-state>12.2.4.38 <dfn>Attribute value (double-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=attribute-value-(double-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0022 QUOTATION MARK (")<dd>Switch to the <a href=#after-attribute-value-(quoted)-state id=attribute-value-(double-quoted)-state:after-attribute-value-(quoted)-state>after attribute value (quoted) state</a>.<dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#character-reference-in-attribute-value-state id=attribute-value-(double-quoted)-state:character-reference-in-attribute-value-state>character reference in attribute value state</a>, with the
- <a href=#additional-allowed-character id=attribute-value-(double-quoted)-state:additional-allowed-character>additional allowed character</a> being U+0022 QUOTATION MARK (").<dt>U+0000 NULL<dd><a href=#parse-error id=attribute-value-(double-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- attribute's value.<dt>EOF<dd><a href=#parse-error id=attribute-value-(double-quoted)-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=attribute-value-(double-quoted)-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=attribute-value-(double-quoted)-state:current-input-character>current input character</a> to the current attribute's value.</dl>
- <h5 id=attribute-value-(single-quoted)-state>12.2.4.39 <dfn>Attribute value (single-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=attribute-value-(single-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0027 APOSTROPHE (')<dd>Switch to the <a href=#after-attribute-value-(quoted)-state id=attribute-value-(single-quoted)-state:after-attribute-value-(quoted)-state>after attribute value (quoted) state</a>.<dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#character-reference-in-attribute-value-state id=attribute-value-(single-quoted)-state:character-reference-in-attribute-value-state>character reference in attribute value state</a>, with the
- <a href=#additional-allowed-character id=attribute-value-(single-quoted)-state:additional-allowed-character>additional allowed character</a> being U+0027 APOSTROPHE (').<dt>U+0000 NULL<dd><a href=#parse-error id=attribute-value-(single-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- attribute's value.<dt>EOF<dd><a href=#parse-error id=attribute-value-(single-quoted)-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=attribute-value-(single-quoted)-state:data-state>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=attribute-value-(single-quoted)-state:current-input-character>current input character</a> to the current attribute's value.</dl>
- <h5 id=attribute-value-(unquoted)-state>12.2.4.40 <dfn>Attribute value (unquoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=attribute-value-(unquoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-attribute-name-state id=attribute-value-(unquoted)-state:before-attribute-name-state>before attribute name state</a>.<dt>U+0026 AMPERSAND (&)<dd>Switch to the <a href=#character-reference-in-attribute-value-state id=attribute-value-(unquoted)-state:character-reference-in-attribute-value-state>character reference in attribute value state</a>, with the
- <a href=#additional-allowed-character id=attribute-value-(unquoted)-state:additional-allowed-character>additional allowed character</a> being U+003E GREATER-THAN SIGN (>).<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=attribute-value-(unquoted)-state:data-state>data state</a>. Emit the current tag token.<dt>U+0000 NULL<dd><a href=#parse-error id=attribute-value-(unquoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- attribute's value.<dt>U+0022 QUOTATION MARK (")<dt>U+0027 APOSTROPHE (')<dt>U+003C LESS-THAN SIGN (<)<dt>U+003D EQUALS SIGN (=)<dt>U+0060 GRAVE ACCENT (`)<dd><a href=#parse-error id=attribute-value-(unquoted)-state:parse-error-2>Parse error</a>. Treat it as per the "anything else" entry below.<dt>EOF<dd><a href=#parse-error id=attribute-value-(unquoted)-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=attribute-value-(unquoted)-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd>Append the <a href=#current-input-character id=attribute-value-(unquoted)-state:current-input-character>current input character</a> to the current attribute's value.</dl>
- <h5 id=character-reference-in-attribute-value-state>12.2.4.41 <dfn>Character reference in attribute value state</dfn></h5>
- <p>Attempt to <a href=#consume-a-character-reference id=character-reference-in-attribute-value-state:consume-a-character-reference>consume a character reference</a>.</p>
- <p>If nothing is returned, append a U+0026 AMPERSAND character (&) to the current attribute's
- value.</p>
- <p>Otherwise, append the returned character tokens to the current attribute's value.</p>
- <p>Finally, switch back to the attribute value state that switched into this state.</p>
- <h5 id=after-attribute-value-(quoted)-state>12.2.4.42 <dfn>After attribute value (quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-attribute-value-(quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-attribute-name-state id=after-attribute-value-(quoted)-state:before-attribute-name-state>before attribute name state</a>.<dt>U+002F SOLIDUS (/)<dd>Switch to the <a href=#self-closing-start-tag-state id=after-attribute-value-(quoted)-state:self-closing-start-tag-state>self-closing start tag state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=after-attribute-value-(quoted)-state:data-state>data state</a>. Emit the current tag token.<dt>EOF<dd><a href=#parse-error id=after-attribute-value-(quoted)-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=after-attribute-value-(quoted)-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd><a href=#parse-error id=after-attribute-value-(quoted)-state:parse-error-2>Parse error</a>. Switch to the <a href=#before-attribute-name-state id=after-attribute-value-(quoted)-state:before-attribute-name-state-2>before attribute name state</a>. Reconsume
- the character.</dl>
- <h5 id=self-closing-start-tag-state>12.2.4.43 <dfn>Self-closing start tag state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=self-closing-start-tag-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+003E GREATER-THAN SIGN (>)<dd>Set the <i id=self-closing-start-tag-state:self-closing-flag><a href=#self-closing-flag>self-closing flag</a></i> of the current tag token. Switch to the <a href=#data-state id=self-closing-start-tag-state:data-state>data
- state</a>. Emit the current tag token.<dt>EOF<dd><a href=#parse-error id=self-closing-start-tag-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=self-closing-start-tag-state:data-state-2>data state</a>. Reconsume the EOF
- character.<dt>Anything else<dd><a href=#parse-error id=self-closing-start-tag-state:parse-error-2>Parse error</a>. Switch to the <a href=#before-attribute-name-state id=self-closing-start-tag-state:before-attribute-name-state>before attribute name state</a>. Reconsume
- the character.</dl>
- <h5 id=bogus-comment-state>12.2.4.44 <dfn>Bogus comment state</dfn></h5>
- <p>Consume every character up to and including the first U+003E GREATER-THAN SIGN character (>)
- or the end of the file (EOF), whichever comes first.
- If more than one character was consumed, then emit a comment token whose data is the
- concatenation of all the characters starting from and including the character that caused the
- state machine to switch into the bogus comment state, up to and including the character
- immediately before the last consumed character (i.e. up to the character just before the U+003E or
- EOF character), but with any U+0000 NULL characters replaced by U+FFFD REPLACEMENT CHARACTER
- characters. (If the comment was started by the end of the file (EOF), the token is empty.
- Similarly, the token is empty if it was generated by the string "<code><!></code>".)</p>
- <p>Switch to the <a href=#data-state id=bogus-comment-state:data-state>data state</a>.</p>
- <p>If the end of the file was reached, reconsume the EOF character.</p>
- <h5 id=markup-declaration-open-state>12.2.4.45 <dfn>Markup declaration open state</dfn></h5>
- <p>If the next two characters are both U+002D HYPHEN-MINUS characters (-), consume those two
- characters, create a comment token whose data is the empty string, and switch to the <a href=#comment-start-state id=markup-declaration-open-state:comment-start-state>comment
- start state</a>.</p>
- <p>Otherwise, if the next seven characters are an <a href=#ascii-case-insensitive id=markup-declaration-open-state:ascii-case-insensitive>ASCII case-insensitive</a> match for
- the word "DOCTYPE", then consume those characters and switch to the <a href=#doctype-state id=markup-declaration-open-state:doctype-state>DOCTYPE
- state</a>.</p>
- <p>Otherwise, if there is an <a href=#adjusted-current-node id=markup-declaration-open-state:adjusted-current-node>adjusted current node</a> and it is not an element in the
- <a href=#html-namespace-2 id=markup-declaration-open-state:html-namespace-2>HTML namespace</a> and the next seven characters are a <a href=#case-sensitive id=markup-declaration-open-state:case-sensitive>case-sensitive</a> match
- for the string "[CDATA[" (the five uppercase letters "CDATA" with a U+005B LEFT SQUARE BRACKET
- character before and after), then consume those characters and switch to the <a href=#cdata-section-state id=markup-declaration-open-state:cdata-section-state>CDATA section
- state</a>.</p>
- <p>Otherwise, this is a <a href=#parse-error id=markup-declaration-open-state:parse-error>parse error</a>. Switch to the <a href=#bogus-comment-state id=markup-declaration-open-state:bogus-comment-state>bogus comment state</a>.
- The next character that is consumed, if any, is the first character that will be in the
- comment.</p>
- <h5 id=comment-start-state>12.2.4.46 <dfn>Comment start state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-start-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#comment-start-dash-state id=comment-start-state:comment-start-dash-state>comment start dash state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=comment-start-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the comment
- token's data. Switch to the <a href=#comment-state id=comment-start-state:comment-state>comment state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=comment-start-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=comment-start-state:data-state>data state</a>. Emit the comment token.<dt>EOF<dd><a href=#parse-error id=comment-start-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=comment-start-state:data-state-2>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=comment-start-state:current-input-character>current input character</a> to the comment token's data. Switch to the
- <a href=#comment-state id=comment-start-state:comment-state-2>comment state</a>.</dl>
- <h5 id=comment-start-dash-state>12.2.4.47 <dfn>Comment start dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-start-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#comment-end-state id=comment-start-dash-state:comment-end-state>comment end state</a><dt>U+0000 NULL<dd><a href=#parse-error id=comment-start-dash-state:parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS character (-) and a U+FFFD REPLACEMENT
- CHARACTER character to the comment token's data. Switch to the <a href=#comment-state id=comment-start-dash-state:comment-state>comment state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=comment-start-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=comment-start-dash-state:data-state>data state</a>. Emit the comment token.<dt>EOF<dd><a href=#parse-error id=comment-start-dash-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=comment-start-dash-state:data-state-2>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd>Append a U+002D HYPHEN-MINUS character (-) and the <a href=#current-input-character id=comment-start-dash-state:current-input-character>current input character</a> to
- the comment token's data. Switch to the <a href=#comment-state id=comment-start-dash-state:comment-state-2>comment state</a>.</dl>
- <h5 id=comment-state>12.2.4.48 <dfn id=comment>Comment state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#comment-end-dash-state id=comment-state:comment-end-dash-state>comment end dash state</a><dt>U+0000 NULL<dd><a href=#parse-error id=comment-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the comment
- token's data.<dt>EOF<dd><a href=#parse-error id=comment-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=comment-state:data-state>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=comment-state:current-input-character>current input character</a> to the comment token's data.</dl>
- <h5 id=comment-end-dash-state>12.2.4.49 <dfn>Comment end dash state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-end-dash-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Switch to the <a href=#comment-end-state id=comment-end-dash-state:comment-end-state>comment end state</a><dt>U+0000 NULL<dd><a href=#parse-error id=comment-end-dash-state:parse-error>Parse error</a>. Append a U+002D HYPHEN-MINUS character (-) and a U+FFFD REPLACEMENT
- CHARACTER character to the comment token's data. Switch to the <a href=#comment-state id=comment-end-dash-state:comment-state>comment state</a>.<dt>EOF<dd><a href=#parse-error id=comment-end-dash-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=comment-end-dash-state:data-state>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd>Append a U+002D HYPHEN-MINUS character (-) and the <a href=#current-input-character id=comment-end-dash-state:current-input-character>current input character</a> to
- the comment token's data. Switch to the <a href=#comment-state id=comment-end-dash-state:comment-state-2>comment state</a>.</dl>
- <h5 id=comment-end-state>12.2.4.50 <dfn>Comment end state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-end-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=comment-end-state:data-state>data state</a>. Emit the comment token.<dt>U+0000 NULL<dd><a href=#parse-error id=comment-end-state:parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS characters (-) and a U+FFFD
- REPLACEMENT CHARACTER character to the comment token's data. Switch to the <a href=#comment-state id=comment-end-state:comment-state>comment
- state</a>.<dt>U+0021 EXCLAMATION MARK (!)<dd><a href=#parse-error id=comment-end-state:parse-error-2>Parse error</a>. Switch to the <a href=#comment-end-bang-state id=comment-end-state:comment-end-bang-state>comment end bang state</a>.<dt>U+002D HYPHEN-MINUS (-)<dd><a href=#parse-error id=comment-end-state:parse-error-3>Parse error</a>. Append a U+002D HYPHEN-MINUS character (-) to the comment token's
- data.<dt>EOF<dd><a href=#parse-error id=comment-end-state:parse-error-4>Parse error</a>. Switch to the <a href=#data-state id=comment-end-state:data-state-2>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=comment-end-state:parse-error-5>Parse error</a>. Append two U+002D HYPHEN-MINUS characters (-) and the <a href=#current-input-character id=comment-end-state:current-input-character>current
- input character</a> to the comment token's data. Switch to the <a href=#comment-state id=comment-end-state:comment-state-2>comment
- state</a>.</dl>
- <h5 id=comment-end-bang-state>12.2.4.51 <dfn>Comment end bang state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=comment-end-bang-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+002D HYPHEN-MINUS (-)<dd>Append two U+002D HYPHEN-MINUS characters (-) and a U+0021 EXCLAMATION MARK character (!) to
- the comment token's data. Switch to the <a href=#comment-end-dash-state id=comment-end-bang-state:comment-end-dash-state>comment end dash state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=comment-end-bang-state:data-state>data state</a>. Emit the comment token.<dt>U+0000 NULL<dd><a href=#parse-error id=comment-end-bang-state:parse-error>Parse error</a>. Append two U+002D HYPHEN-MINUS characters (-), a U+0021 EXCLAMATION
- MARK character (!), and a U+FFFD REPLACEMENT CHARACTER character to the comment token's data.
- Switch to the <a href=#comment-state id=comment-end-bang-state:comment-state>comment state</a>.<dt>EOF<dd><a href=#parse-error id=comment-end-bang-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=comment-end-bang-state:data-state-2>data state</a>. Emit the comment token.
- Reconsume the EOF character.<dt>Anything else<dd>Append two U+002D HYPHEN-MINUS characters (-), a U+0021 EXCLAMATION MARK character (!), and
- the <a href=#current-input-character id=comment-end-bang-state:current-input-character>current input character</a> to the comment token's data. Switch to the <a href=#comment-state id=comment-end-bang-state:comment-state-2>comment
- state</a>.</dl>
- <h5 id=doctype-state>12.2.4.52 <dfn>DOCTYPE state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-doctype-name-state id=doctype-state:before-doctype-name-state>before DOCTYPE name state</a>.<dt>EOF<dd><a href=#parse-error id=doctype-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=doctype-state:data-state>data state</a>. Create a new DOCTYPE token.
- Set its <i id=doctype-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit the token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=doctype-state:parse-error-2>Parse error</a>. Switch to the <a href=#before-doctype-name-state id=doctype-state:before-doctype-name-state-2>before DOCTYPE name state</a>. Reconsume the
- character.</dl>
- <h5 id=before-doctype-name-state>12.2.4.53 <dfn>Before DOCTYPE name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=before-doctype-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt><a href=#uppercase-ascii-letters id=before-doctype-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Create a new DOCTYPE token. Set the token's name to the lowercase version of the
- <a href=#current-input-character id=before-doctype-name-state:current-input-character>current input character</a> (add 0x0020 to the character's code point). Switch to the
- <a href=#doctype-name-state id=before-doctype-name-state:doctype-name-state>DOCTYPE name state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=before-doctype-name-state:parse-error>Parse error</a>. Create a new DOCTYPE token. Set the token's name to a U+FFFD
- REPLACEMENT CHARACTER character. Switch to the <a href=#doctype-name-state id=before-doctype-name-state:doctype-name-state-2>DOCTYPE name state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=before-doctype-name-state:parse-error-2>Parse error</a>. Create a new DOCTYPE token. Set its <i id=before-doctype-name-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to
- <i>on</i>. Switch to the <a href=#data-state id=before-doctype-name-state:data-state>data state</a>. Emit the token.<dt>EOF<dd><a href=#parse-error id=before-doctype-name-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=before-doctype-name-state:data-state-2>data state</a>. Create a new DOCTYPE token.
- Set its <i id=before-doctype-name-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit the token. Reconsume the EOF character.<dt>Anything else<dd>Create a new DOCTYPE token. Set the token's name to the <a href=#current-input-character id=before-doctype-name-state:current-input-character-2>current input character</a>.
- Switch to the <a href=#doctype-name-state id=before-doctype-name-state:doctype-name-state-3>DOCTYPE name state</a>.</dl>
- <h5 id=doctype-name-state>12.2.4.54 <dfn>DOCTYPE name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#after-doctype-name-state id=doctype-name-state:after-doctype-name-state>after DOCTYPE name state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=doctype-name-state:data-state>data state</a>. Emit the current DOCTYPE token.<dt><a href=#uppercase-ascii-letters id=doctype-name-state:uppercase-ascii-letters>Uppercase ASCII letter</a><dd>Append the lowercase version of the <a href=#current-input-character id=doctype-name-state:current-input-character>current input character</a> (add 0x0020 to the
- character's code point) to the current DOCTYPE token's name.<dt>U+0000 NULL<dd><a href=#parse-error id=doctype-name-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- DOCTYPE token's name.<dt>EOF<dd><a href=#parse-error id=doctype-name-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=doctype-name-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=doctype-name-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=doctype-name-state:current-input-character-2>current input character</a> to the current DOCTYPE token's name.</dl>
- <h5 id=after-doctype-name-state>12.2.4.55 <dfn>After DOCTYPE name state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-doctype-name-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=after-doctype-name-state:data-state>data state</a>. Emit the current DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=after-doctype-name-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=after-doctype-name-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=after-doctype-name-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>
- <p>If the six characters starting from the <a href=#current-input-character id=after-doctype-name-state:current-input-character>current input character</a> are an
- <a href=#ascii-case-insensitive id=after-doctype-name-state:ascii-case-insensitive>ASCII case-insensitive</a> match for the word "PUBLIC", then consume those characters
- and switch to the <a href=#after-doctype-public-keyword-state id=after-doctype-name-state:after-doctype-public-keyword-state>after DOCTYPE public keyword state</a>.</p>
- <p>Otherwise, if the six characters starting from the <a href=#current-input-character id=after-doctype-name-state:current-input-character-2>current input character</a> are
- an <a href=#ascii-case-insensitive id=after-doctype-name-state:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the word "SYSTEM", then consume those
- characters and switch to the <a href=#after-doctype-system-keyword-state id=after-doctype-name-state:after-doctype-system-keyword-state>after DOCTYPE system keyword state</a>.</p>
- <p>Otherwise, this is a <a href=#parse-error id=after-doctype-name-state:parse-error-2>parse error</a>. Set the DOCTYPE token's <i id=after-doctype-name-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Switch to the <a href=#bogus-doctype-state id=after-doctype-name-state:bogus-doctype-state>bogus DOCTYPE state</a>.</p>
- </dl>
- <h5 id=after-doctype-public-keyword-state>12.2.4.56 <dfn>After DOCTYPE public keyword state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-doctype-public-keyword-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-doctype-public-identifier-state id=after-doctype-public-keyword-state:before-doctype-public-identifier-state>before DOCTYPE public identifier state</a>.<dt>U+0022 QUOTATION MARK (")<dd><a href=#parse-error id=after-doctype-public-keyword-state:parse-error>Parse error</a>. Set the DOCTYPE token's public identifier to the empty string (not
- missing), then switch to the <a href=#doctype-public-identifier-(double-quoted)-state id=after-doctype-public-keyword-state:doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd><a href=#parse-error id=after-doctype-public-keyword-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's public identifier to the empty string (not
- missing), then switch to the <a href=#doctype-public-identifier-(single-quoted)-state id=after-doctype-public-keyword-state:doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=after-doctype-public-keyword-state:parse-error-3>Parse error</a>. Set the DOCTYPE token's <i id=after-doctype-public-keyword-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=after-doctype-public-keyword-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=after-doctype-public-keyword-state:parse-error-4>Parse error</a>. Switch to the <a href=#data-state id=after-doctype-public-keyword-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=after-doctype-public-keyword-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=after-doctype-public-keyword-state:parse-error-5>Parse error</a>. Set the DOCTYPE token's <i id=after-doctype-public-keyword-state:force-quirks-flag-3><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=after-doctype-public-keyword-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=before-doctype-public-identifier-state>12.2.4.57 <dfn>Before DOCTYPE public identifier state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=before-doctype-public-identifier-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+0022 QUOTATION MARK (")<dd>Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to
- the <a href=#doctype-public-identifier-(double-quoted)-state id=before-doctype-public-identifier-state:doctype-public-identifier-(double-quoted)-state>DOCTYPE public identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd>Set the DOCTYPE token's public identifier to the empty string (not missing), then switch to
- the <a href=#doctype-public-identifier-(single-quoted)-state id=before-doctype-public-identifier-state:doctype-public-identifier-(single-quoted)-state>DOCTYPE public identifier (single-quoted) state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=before-doctype-public-identifier-state:parse-error>Parse error</a>. Set the DOCTYPE token's <i id=before-doctype-public-identifier-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=before-doctype-public-identifier-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=before-doctype-public-identifier-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=before-doctype-public-identifier-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=before-doctype-public-identifier-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=before-doctype-public-identifier-state:parse-error-3>Parse error</a>. Set the DOCTYPE token's <i id=before-doctype-public-identifier-state:force-quirks-flag-3><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=before-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=doctype-public-identifier-(double-quoted)-state>12.2.4.58 <dfn>DOCTYPE public identifier (double-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-public-identifier-(double-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0022 QUOTATION MARK (")<dd>Switch to the <a href=#after-doctype-public-identifier-state id=doctype-public-identifier-(double-quoted)-state:after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=doctype-public-identifier-(double-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- DOCTYPE token's public identifier.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=doctype-public-identifier-(double-quoted)-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's <i id=doctype-public-identifier-(double-quoted)-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=doctype-public-identifier-(double-quoted)-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=doctype-public-identifier-(double-quoted)-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=doctype-public-identifier-(double-quoted)-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=doctype-public-identifier-(double-quoted)-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=doctype-public-identifier-(double-quoted)-state:current-input-character>current input character</a> to the current DOCTYPE token's public
- identifier.</dl>
- <h5 id=doctype-public-identifier-(single-quoted)-state>12.2.4.59 <dfn>DOCTYPE public identifier (single-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-public-identifier-(single-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0027 APOSTROPHE (')<dd>Switch to the <a href=#after-doctype-public-identifier-state id=doctype-public-identifier-(single-quoted)-state:after-doctype-public-identifier-state>after DOCTYPE public identifier state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=doctype-public-identifier-(single-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- DOCTYPE token's public identifier.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=doctype-public-identifier-(single-quoted)-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's <i id=doctype-public-identifier-(single-quoted)-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=doctype-public-identifier-(single-quoted)-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=doctype-public-identifier-(single-quoted)-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=doctype-public-identifier-(single-quoted)-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=doctype-public-identifier-(single-quoted)-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=doctype-public-identifier-(single-quoted)-state:current-input-character>current input character</a> to the current DOCTYPE token's public
- identifier.</dl>
- <h5 id=after-doctype-public-identifier-state>12.2.4.60 <dfn>After DOCTYPE public identifier state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-doctype-public-identifier-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#between-doctype-public-and-system-identifiers-state id=after-doctype-public-identifier-state:between-doctype-public-and-system-identifiers-state>between DOCTYPE public and system identifiers state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=after-doctype-public-identifier-state:data-state>data state</a>. Emit the current DOCTYPE token.<dt>U+0022 QUOTATION MARK (")<dd><a href=#parse-error id=after-doctype-public-identifier-state:parse-error>Parse error</a>. Set the DOCTYPE token's system identifier to the empty string (not
- missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state id=after-doctype-public-identifier-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd><a href=#parse-error id=after-doctype-public-identifier-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's system identifier to the empty string (not
- missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state id=after-doctype-public-identifier-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.<dt>EOF<dd><a href=#parse-error id=after-doctype-public-identifier-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=after-doctype-public-identifier-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=after-doctype-public-identifier-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=after-doctype-public-identifier-state:parse-error-4>Parse error</a>. Set the DOCTYPE token's <i id=after-doctype-public-identifier-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=after-doctype-public-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=between-doctype-public-and-system-identifiers-state>12.2.4.61 <dfn>Between DOCTYPE public and system identifiers state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=between-doctype-public-and-system-identifiers-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=between-doctype-public-and-system-identifiers-state:data-state>data state</a>. Emit the current DOCTYPE token.<dt>U+0022 QUOTATION MARK (")<dd>Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to
- the <a href=#doctype-system-identifier-(double-quoted)-state id=between-doctype-public-and-system-identifiers-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd>Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to
- the <a href=#doctype-system-identifier-(single-quoted)-state id=between-doctype-public-and-system-identifiers-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.<dt>EOF<dd><a href=#parse-error id=between-doctype-public-and-system-identifiers-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=between-doctype-public-and-system-identifiers-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=between-doctype-public-and-system-identifiers-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=between-doctype-public-and-system-identifiers-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's <i id=between-doctype-public-and-system-identifiers-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=between-doctype-public-and-system-identifiers-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=after-doctype-system-keyword-state>12.2.4.62 <dfn>After DOCTYPE system keyword state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-doctype-system-keyword-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Switch to the <a href=#before-doctype-system-identifier-state id=after-doctype-system-keyword-state:before-doctype-system-identifier-state>before DOCTYPE system identifier state</a>.<dt>U+0022 QUOTATION MARK (")<dd><a href=#parse-error id=after-doctype-system-keyword-state:parse-error>Parse error</a>. Set the DOCTYPE token's system identifier to the empty string (not
- missing), then switch to the <a href=#doctype-system-identifier-(double-quoted)-state id=after-doctype-system-keyword-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd><a href=#parse-error id=after-doctype-system-keyword-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's system identifier to the empty string (not
- missing), then switch to the <a href=#doctype-system-identifier-(single-quoted)-state id=after-doctype-system-keyword-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=after-doctype-system-keyword-state:parse-error-3>Parse error</a>. Set the DOCTYPE token's <i id=after-doctype-system-keyword-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=after-doctype-system-keyword-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=after-doctype-system-keyword-state:parse-error-4>Parse error</a>. Switch to the <a href=#data-state id=after-doctype-system-keyword-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=after-doctype-system-keyword-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=after-doctype-system-keyword-state:parse-error-5>Parse error</a>. Set the DOCTYPE token's <i id=after-doctype-system-keyword-state:force-quirks-flag-3><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=after-doctype-system-keyword-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=before-doctype-system-identifier-state>12.2.4.63 <dfn>Before DOCTYPE system identifier state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=before-doctype-system-identifier-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+0022 QUOTATION MARK (")<dd>Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to
- the <a href=#doctype-system-identifier-(double-quoted)-state id=before-doctype-system-identifier-state:doctype-system-identifier-(double-quoted)-state>DOCTYPE system identifier (double-quoted) state</a>.<dt>U+0027 APOSTROPHE (')<dd>Set the DOCTYPE token's system identifier to the empty string (not missing), then switch to
- the <a href=#doctype-system-identifier-(single-quoted)-state id=before-doctype-system-identifier-state:doctype-system-identifier-(single-quoted)-state>DOCTYPE system identifier (single-quoted) state</a>.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=before-doctype-system-identifier-state:parse-error>Parse error</a>. Set the DOCTYPE token's <i id=before-doctype-system-identifier-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=before-doctype-system-identifier-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=before-doctype-system-identifier-state:parse-error-2>Parse error</a>. Switch to the <a href=#data-state id=before-doctype-system-identifier-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=before-doctype-system-identifier-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=before-doctype-system-identifier-state:parse-error-3>Parse error</a>. Set the DOCTYPE token's <i id=before-doctype-system-identifier-state:force-quirks-flag-3><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#bogus-doctype-state id=before-doctype-system-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>.</dl>
- <h5 id=doctype-system-identifier-(double-quoted)-state>12.2.4.64 <dfn>DOCTYPE system identifier (double-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-system-identifier-(double-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0022 QUOTATION MARK (")<dd>Switch to the <a href=#after-doctype-system-identifier-state id=doctype-system-identifier-(double-quoted)-state:after-doctype-system-identifier-state>after DOCTYPE system identifier state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=doctype-system-identifier-(double-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- DOCTYPE token's system identifier.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=doctype-system-identifier-(double-quoted)-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's <i id=doctype-system-identifier-(double-quoted)-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=doctype-system-identifier-(double-quoted)-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=doctype-system-identifier-(double-quoted)-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=doctype-system-identifier-(double-quoted)-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=doctype-system-identifier-(double-quoted)-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=doctype-system-identifier-(double-quoted)-state:current-input-character>current input character</a> to the current DOCTYPE token's system
- identifier.</dl>
- <h5 id=doctype-system-identifier-(single-quoted)-state>12.2.4.65 <dfn>DOCTYPE system identifier (single-quoted) state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=doctype-system-identifier-(single-quoted)-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0027 APOSTROPHE (')<dd>Switch to the <a href=#after-doctype-system-identifier-state id=doctype-system-identifier-(single-quoted)-state:after-doctype-system-identifier-state>after DOCTYPE system identifier state</a>.<dt>U+0000 NULL<dd><a href=#parse-error id=doctype-system-identifier-(single-quoted)-state:parse-error>Parse error</a>. Append a U+FFFD REPLACEMENT CHARACTER character to the current
- DOCTYPE token's system identifier.<dt>U+003E GREATER-THAN SIGN (>)<dd><a href=#parse-error id=doctype-system-identifier-(single-quoted)-state:parse-error-2>Parse error</a>. Set the DOCTYPE token's <i id=doctype-system-identifier-(single-quoted)-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.
- Switch to the <a href=#data-state id=doctype-system-identifier-(single-quoted)-state:data-state>data state</a>. Emit that DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=doctype-system-identifier-(single-quoted)-state:parse-error-3>Parse error</a>. Switch to the <a href=#data-state id=doctype-system-identifier-(single-quoted)-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=doctype-system-identifier-(single-quoted)-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd>Append the <a href=#current-input-character id=doctype-system-identifier-(single-quoted)-state:current-input-character>current input character</a> to the current DOCTYPE token's system
- identifier.</dl>
- <h5 id=after-doctype-system-identifier-state>12.2.4.66 <dfn>After DOCTYPE system identifier state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=after-doctype-system-identifier-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dd>Ignore the character.<dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=after-doctype-system-identifier-state:data-state>data state</a>. Emit the current DOCTYPE token.<dt>EOF<dd><a href=#parse-error id=after-doctype-system-identifier-state:parse-error>Parse error</a>. Switch to the <a href=#data-state id=after-doctype-system-identifier-state:data-state-2>data state</a>. Set the DOCTYPE token's
- <i id=after-doctype-system-identifier-state:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>. Emit that DOCTYPE token. Reconsume the EOF character.<dt>Anything else<dd><a href=#parse-error id=after-doctype-system-identifier-state:parse-error-2>Parse error</a>. Switch to the <a href=#bogus-doctype-state id=after-doctype-system-identifier-state:bogus-doctype-state>bogus DOCTYPE state</a>. (This does
- <em>not</em> set the DOCTYPE token's <i id=after-doctype-system-identifier-state:force-quirks-flag-2><a href=#force-quirks-flag>force-quirks flag</a></i> to <i>on</i>.)</dl>
- <h5 id=bogus-doctype-state>12.2.4.67 <dfn>Bogus DOCTYPE state</dfn></h5>
- <p>Consume the <a href=#next-input-character id=bogus-doctype-state:next-input-character>next input character</a>:</p>
- <dl class=switch><dt>U+003E GREATER-THAN SIGN (>)<dd>Switch to the <a href=#data-state id=bogus-doctype-state:data-state>data state</a>. Emit the DOCTYPE token.<dt>EOF<dd>Switch to the <a href=#data-state id=bogus-doctype-state:data-state-2>data state</a>. Emit the DOCTYPE token. Reconsume the EOF
- character.<dt>Anything else<dd>Ignore the character.</dl>
- <h5 id=cdata-section-state>12.2.4.68 <dfn>CDATA section state</dfn></h5>
- <p>Switch to the <a href=#data-state id=cdata-section-state:data-state>data state</a>.</p>
- <p>Consume every character up to the next occurrence of the three character sequence U+005D RIGHT
- SQUARE BRACKET U+005D RIGHT SQUARE BRACKET U+003E GREATER-THAN SIGN (<code>]]></code>),
- or the end of the file (EOF), whichever comes first. Emit a series of character tokens consisting
- of all the characters consumed except the matching three character sequence at the end (if one was
- found before the end of the file).</p>
- <p>If the end of the file was reached, reconsume the EOF character.</p>
- <h5 id=tokenizing-character-references>12.2.4.69 Tokenizing character references</h5>
- <p>This section defines how to <dfn id=consume-a-character-reference>consume a character reference</dfn>, optionally with an
- <dfn id=additional-allowed-character>additional allowed character</dfn>, which, if specified where the algorithm is invoked, adds
- a character to the list of characters that cause there to not be a character reference.</p>
- <p>This definition is used when parsing character references <a href=#character-reference-in-data-state id=tokenizing-character-references:character-reference-in-data-state>in text</a> and <a href=#character-reference-in-attribute-value-state id=tokenizing-character-references:character-reference-in-attribute-value-state>in
- attributes</a>.</p>
- <p>The behavior depends on the identity of the next character (the one immediately after the
- U+0026 AMPERSAND character), as follows:</p>
- <dl class=switch><dt>U+0009 CHARACTER TABULATION (tab)<dt>U+000A LINE FEED (LF)<dt>U+000C FORM FEED (FF)<dt>U+0020 SPACE<dt>U+003C LESS-THAN SIGN<dt>U+0026 AMPERSAND<dt>EOF<dt>The <a href=#additional-allowed-character id=tokenizing-character-references:additional-allowed-character>additional allowed character</a>, if there is one<dd>Not a character reference. No characters are consumed, and nothing is returned. (This is not
- an error, either.)<dt>U+0023 NUMBER SIGN (#)<dd>
- <p>Consume the U+0023 NUMBER SIGN.</p>
- <p>The behavior further depends on the character after the U+0023 NUMBER SIGN:</p>
- <dl class=switch><dt>U+0078 LATIN SMALL LETTER X<dt>U+0058 LATIN CAPITAL LETTER X<dd>
- <p>Consume the X.</p>
- <p>Follow the steps below, but using <a href=#ascii-hex-digits id=tokenizing-character-references:ascii-hex-digits>ASCII hex digits</a>.</p>
- <p>When it comes to interpreting the number, interpret it as a hexadecimal number.</p>
- <dt>Anything else<dd>
- <p>Follow the steps below, but using <a href=#ascii-digits id=tokenizing-character-references:ascii-digits>ASCII digits</a>.</p>
- <p>When it comes to interpreting the number, interpret it as a decimal number.</p>
- </dl>
- <p>Consume as many characters as match the range of characters given above (<a href=#ascii-hex-digits id=tokenizing-character-references:ascii-hex-digits-2>ASCII hex
- digits</a> or <a href=#ascii-digits id=tokenizing-character-references:ascii-digits-2>ASCII digits</a>).</p>
- <p>If no characters match the range, then don't consume any characters (and unconsume the U+0023
- NUMBER SIGN character and, if appropriate, the X character). This is a <a href=#parse-error id=tokenizing-character-references:parse-error>parse error</a>;
- nothing is returned.</p>
- <p>Otherwise, if the next character is a U+003B SEMICOLON, consume that too. If it isn't, there
- is a <a href=#parse-error id=tokenizing-character-references:parse-error-2>parse error</a>.</p>
- <p>If one or more characters match the range, then take them all and interpret the string of
- characters as a number (either hexadecimal or decimal as appropriate).</p>
- <p>If that number is one of the numbers in the first column of the following table, then this is
- a <a href=#parse-error id=tokenizing-character-references:parse-error-3>parse error</a>. Find the row with that number in the first column, and return a
- character token for the Unicode character given in the second column of that row.</p>
- <table id=table-charref-overrides><thead><tr><th>Number <th colspan=2>Unicode character
- <tbody><tr><td>0x00 <td>U+FFFD <td>REPLACEMENT CHARACTER
-
- <tr><td>0x80 <td>U+20AC <td>EURO SIGN (€)
-
- <tr><td>0x82 <td>U+201A <td>SINGLE LOW-9 QUOTATION MARK (‚)
- <tr><td>0x83 <td>U+0192 <td>LATIN SMALL LETTER F WITH HOOK (ƒ)
- <tr><td>0x84 <td>U+201E <td>DOUBLE LOW-9 QUOTATION MARK („)
- <tr><td>0x85 <td>U+2026 <td>HORIZONTAL ELLIPSIS (…)
- <tr><td>0x86 <td>U+2020 <td>DAGGER (†)
- <tr><td>0x87 <td>U+2021 <td>DOUBLE DAGGER (‡)
- <tr><td>0x88 <td>U+02C6 <td>MODIFIER LETTER CIRCUMFLEX ACCENT (ˆ)
- <tr><td>0x89 <td>U+2030 <td>PER MILLE SIGN (‰)
- <tr><td>0x8A <td>U+0160 <td>LATIN CAPITAL LETTER S WITH CARON (Š)
- <tr><td>0x8B <td>U+2039 <td>SINGLE LEFT-POINTING ANGLE QUOTATION MARK (‹)
- <tr><td>0x8C <td>U+0152 <td>LATIN CAPITAL LIGATURE OE (Œ)
-
- <tr><td>0x8E <td>U+017D <td>LATIN CAPITAL LETTER Z WITH CARON (Ž)
-
-
- <tr><td>0x91 <td>U+2018 <td>LEFT SINGLE QUOTATION MARK (‘)
- <tr><td>0x92 <td>U+2019 <td>RIGHT SINGLE QUOTATION MARK (’)
- <tr><td>0x93 <td>U+201C <td>LEFT DOUBLE QUOTATION MARK (“)
- <tr><td>0x94 <td>U+201D <td>RIGHT DOUBLE QUOTATION MARK (”)
- <tr><td>0x95 <td>U+2022 <td>BULLET (•)
- <tr><td>0x96 <td>U+2013 <td>EN DASH (–)
- <tr><td>0x97 <td>U+2014 <td>EM DASH (—)
- <tr><td>0x98 <td>U+02DC <td>SMALL TILDE (˜)
- <tr><td>0x99 <td>U+2122 <td>TRADE MARK SIGN (™)
- <tr><td>0x9A <td>U+0161 <td>LATIN SMALL LETTER S WITH CARON (š)
- <tr><td>0x9B <td>U+203A <td>SINGLE RIGHT-POINTING ANGLE QUOTATION MARK (›)
- <tr><td>0x9C <td>U+0153 <td>LATIN SMALL LIGATURE OE (œ)
-
- <tr><td>0x9E <td>U+017E <td>LATIN SMALL LETTER Z WITH CARON (ž)
- <tr><td>0x9F <td>U+0178 <td>LATIN CAPITAL LETTER Y WITH DIAERESIS (Ÿ)
- </table>
- <p>Otherwise, if the number is in the range 0xD800 to 0xDFFF or is greater
- than 0x10FFFF, then this is a <a href=#parse-error id=tokenizing-character-references:parse-error-4>parse error</a>. Return a U+FFFD REPLACEMENT CHARACTER
- character token.</p>
- <p>Otherwise, return a character token for the Unicode character whose code point is that
- number.
- Additionally, if the number is in the range 0x0001 to 0x0008, 0x000D to 0x001F, 0x007F to 0x009F, 0xFDD0 to 0xFDEF, or is
- one of 0x000B, 0xFFFE, 0xFFFF, 0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, 0x3FFFF, 0x4FFFE,
- 0x4FFFF, 0x5FFFE, 0x5FFFF, 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, 0x8FFFF, 0x9FFFE,
- 0x9FFFF, 0xAFFFE, 0xAFFFF, 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, 0xDFFFF, 0xEFFFE,
- 0xEFFFF, 0xFFFFE, 0xFFFFF, 0x10FFFE, or 0x10FFFF, then this is a <a href=#parse-error id=tokenizing-character-references:parse-error-5>parse error</a>.</p>
- <dt>Anything else<dd>
- <p>Consume the maximum number of characters possible, with the consumed characters matching one
- of the identifiers in the first column of the <a href=#named-character-references id=tokenizing-character-references:named-character-references>named character references</a> table (in
- a <a href=#case-sensitive id=tokenizing-character-references:case-sensitive>case-sensitive</a> manner).</p>
- <p>If no match can be made, then no characters are consumed, and nothing is returned. In this
- case, if the characters after the U+0026 AMPERSAND character (&) consist of a sequence of
- one or more <a href=#alphanumeric-ascii-characters id=tokenizing-character-references:alphanumeric-ascii-characters>alphanumeric ASCII characters</a> followed by a U+003B SEMICOLON character
- (;), then this is a <a href=#parse-error id=tokenizing-character-references:parse-error-6>parse error</a>.</p>
- <p>If the character reference is being consumed <a href=#character-reference-in-attribute-value-state id=tokenizing-character-references:character-reference-in-attribute-value-state-2>as part of an attribute</a>, and the last character matched is not a U+003B
- SEMICOLON character (;), and the next character is either a U+003D EQUALS SIGN character (=) or
- an <a href=#alphanumeric-ascii-characters id=tokenizing-character-references:alphanumeric-ascii-characters-2>alphanumeric ASCII character</a>, then, for
- historical reasons, all the characters that were matched after the U+0026 AMPERSAND character
- (&) must be unconsumed, and nothing is returned.
- However, if this next character is in fact a U+003D EQUALS SIGN character (=), then this is a
- <a href=#parse-error id=tokenizing-character-references:parse-error-7>parse error</a>, because some legacy user agents will
- misinterpret the markup in those cases.</p>
- <p>Otherwise, a character reference is parsed. If the last character matched is not a U+003B
- SEMICOLON character (;), there is a <a href=#parse-error id=tokenizing-character-references:parse-error-8>parse error</a>.</p>
- <p>Return one or two character tokens for the character(s) corresponding to the character
- reference name (as given by the second column of the <a href=#named-character-references id=tokenizing-character-references:named-character-references-2>named character references</a>
- table).</p>
- <div class=example>
- <p>If the markup contains (not in an attribute) the string <code>I'm &notit; I
- tell you</code>, the character reference is parsed as "not", as in, <code>I'm ¬it;
- I tell you</code> (and this is a parse error). But if the markup was <code>I'm
- &notin; I tell you</code>, the character reference would be parsed as "notin;", resulting
- in <code>I'm ∉ I tell you</code> (and no parse error).</p>
- </div>
- </dl>
-
-
-
- <h4 id=tree-construction>12.2.5 <dfn>Tree construction</dfn></h4>
- <p>The input to the tree construction stage is a sequence of tokens from the
- <a href=#tokenization id=tree-construction:tokenization>tokenization</a> stage. The tree construction stage is associated with a DOM
- <code id=tree-construction:document><a href=#document>Document</a></code> object when a parser is created. The "output" of this stage consists of
- dynamically modifying or extending that document's DOM tree.</p>
- <p>This specification does not define when an interactive user agent has to render the
- <code id=tree-construction:document-2><a href=#document>Document</a></code> so that it is available to the user, or when it has to begin accepting user
- input.</p>
- <hr>
- <p>As each token is emitted from the tokenizer, the user agent must follow the appropriate steps
- from the following list, known as the <dfn id=tree-construction-dispatcher>tree construction dispatcher</dfn>:</p>
- <dl class=switch><dt>If the <a href=#stack-of-open-elements id=tree-construction:stack-of-open-elements>stack of open elements</a> is empty<dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node>adjusted current node</a> is an element in the <a href=#html-namespace-2 id=tree-construction:html-namespace-2>HTML namespace</a><dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node-2>adjusted current node</a> is a <a href=#mathml-text-integration-point id=tree-construction:mathml-text-integration-point>MathML text integration point</a> and the token is a start tag whose tag name is neither "mglyph" nor "malignmark"<dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node-3>adjusted current node</a> is a <a href=#mathml-text-integration-point id=tree-construction:mathml-text-integration-point-2>MathML text integration point</a> and the token is a character token<dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node-4>adjusted current node</a> is an <code id=tree-construction:math:annotation-xml><a href=#math:annotation-xml>annotation-xml</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace>MathML namespace</a> and the token is a start tag whose tag name is "svg"<dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node-5>adjusted current node</a> is an <a href=#html-integration-point id=tree-construction:html-integration-point>HTML integration point</a> and the token is a start tag<dt>If the <a href=#adjusted-current-node id=tree-construction:adjusted-current-node-6>adjusted current node</a> is an <a href=#html-integration-point id=tree-construction:html-integration-point-2>HTML integration point</a> and the token is a character token<dt>If the token is an end-of-file token<dd>Process the token according to the rules given in the section corresponding to the current
- <a href=#insertion-mode id=tree-construction:insertion-mode>insertion mode</a> in HTML content.<dt>Otherwise<dd>Process the token according to the rules given in the section for parsing tokens <a href=#parsing-main-inforeign id=tree-construction:parsing-main-inforeign>in foreign content</a>.</dl>
- <p>The <dfn id=next-token>next token</dfn> is the token that is about to be processed by the <a href=#tree-construction-dispatcher id=tree-construction:tree-construction-dispatcher>tree
- construction dispatcher</a> (even if the token is subsequently just ignored).</p>
- <p>A node is a <dfn id=mathml-text-integration-point>MathML text integration point</dfn> if it is one of the following
- elements:</p>
- <ul class=brief><li>An <code id=tree-construction:math:mi><a href=#math:mi>mi</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-2>MathML namespace</a><li>An <code id=tree-construction:math:mo><a href=#math:mo>mo</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-3>MathML namespace</a><li>An <code id=tree-construction:math:mn><a href=#math:mn>mn</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-4>MathML namespace</a><li>An <code id=tree-construction:math:ms><a href=#math:ms>ms</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-5>MathML namespace</a><li>An <code id=tree-construction:math:mtext><a href=#math:mtext>mtext</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-6>MathML namespace</a></ul>
- <p>A node is an <dfn id=html-integration-point>HTML integration point</dfn> if it is one of the following elements:</p>
- <ul class=brief><li>An <code id=tree-construction:math:annotation-xml-2><a href=#math:annotation-xml>annotation-xml</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-7>MathML
- namespace</a> whose start tag token had an attribute with the name "encoding" whose value was
- an <a href=#ascii-case-insensitive id=tree-construction:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>text/html</code>"<li>An <code id=tree-construction:math:annotation-xml-3><a href=#math:annotation-xml>annotation-xml</a></code> element in the <a href=#mathml-namespace id=tree-construction:mathml-namespace-8>MathML
- namespace</a> whose start tag token had an attribute with the name "encoding" whose value was
- an <a href=#ascii-case-insensitive id=tree-construction:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code>application/xhtml+xml</code>"<li>A <code>foreignObject</code> element in the <a href=#svg-namespace id=tree-construction:svg-namespace>SVG namespace</a><li>A <code>desc</code> element in the <a href=#svg-namespace id=tree-construction:svg-namespace-2>SVG namespace</a><li>A <code>title</code> element in the <a href=#svg-namespace id=tree-construction:svg-namespace-3>SVG namespace</a></ul>
- <p class=note>Not all of the tag names mentioned below are conformant tag names in this
- specification; many are included to handle legacy content. They still form part of the algorithm
- that implementations are required to implement to claim conformance.</p>
- <p class=note>The algorithm described below places no limit on the depth of the DOM tree
- generated, or on the length of tag names, attribute names, attribute values, <code id=tree-construction:text><a href=#text>Text</a></code>
- nodes, etc. While implementors are encouraged to avoid arbitrary limits, it is recognised that <a href=#hardwareLimitations>practical concerns</a> will likely force user agents to impose nesting
- depth constraints.</p>
- <h5 id=creating-and-inserting-nodes>12.2.5.1 Creating and inserting nodes</h5>
- <p>While the parser is processing a token, it can enable or disable <dfn id=foster-parent>foster parenting</dfn>. This affects the following algorithm.</p>
- <p>The <dfn id=appropriate-place-for-inserting-a-node>appropriate place for inserting a node</dfn>, optionally using a particular
- <i>override target</i>, is the position in an element returned by running the following steps:</p>
- <ol><li>
- <p>If there was an <i>override target</i> specified, then let <var>target</var> be the
- <i>override target</i>.</p>
- <p>Otherwise, let <var>target</var> be the <a href=#current-node id=creating-and-inserting-nodes:current-node>current node</a>.</p>
- <li>
- <p>Determine the <var>adjusted insertion location</var> using the first matching steps
- from the following list:</p>
- <dl class=switch><dt>If <a href=#foster-parent id=creating-and-inserting-nodes:foster-parent>foster parenting</a> is enabled and <var>target</var> is a <code id=creating-and-inserting-nodes:the-table-element><a href=#the-table-element>table</a></code>, <code id=creating-and-inserting-nodes:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=creating-and-inserting-nodes:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=creating-and-inserting-nodes:the-thead-element><a href=#the-thead-element>thead</a></code>, or <code id=creating-and-inserting-nodes:the-tr-element><a href=#the-tr-element>tr</a></code> element<dd>
- <p class=note>Foster parenting happens when content is misnested in tables.</p>
- <p>Run these substeps:</p>
- <ol><li><p>Let <var>last template</var> be the last <code id=creating-and-inserting-nodes:the-template-element><a href=#the-template-element>template</a></code> element in the
- <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements>stack of open elements</a>, if any.</p>
- <li><p>Let <var>last table</var> be the last <code id=creating-and-inserting-nodes:the-table-element-2><a href=#the-table-element>table</a></code> element in the
- <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-2>stack of open elements</a>, if any.</p>
- <li><p>If there is a <var>last template</var> and either there is no <var>last table</var>, or there is one, but <var>last template</var> is lower
- (more recently added) than <var>last table</var> in the <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-3>stack of open
- elements</a>, then: let <var>adjusted insertion location</var> be inside <var>last template</var>'s <a href=#template-contents id=creating-and-inserting-nodes:template-contents>template contents</a>, after its last child (if any),
- and abort these substeps.<li><p>If there is no <var>last table</var>, then let <var>adjusted insertion
- location</var> be inside the first element in the <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-4>stack of open elements</a> (the
- <code id=creating-and-inserting-nodes:the-html-element><a href=#the-html-element>html</a></code> element), after its last child (if any), and abort these substeps.
- (<a href=#fragment-case id=creating-and-inserting-nodes:fragment-case>fragment case</a>)</p>
-
- <li><p>If <var>last table</var> has a parent node, then let <var>adjusted insertion location</var> be inside <var>last table</var>'s parent
- node, immediately before <var>last table</var>, and abort these
- substeps.<li><p>Let <var>previous element</var> be the element immediately above <var>last table</var> in the <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-5>stack of open elements</a>.<li><p>Let <var>adjusted insertion location</var> be inside <var>previous
- element</var>, after its last child (if any).</ol>
- <p class=note>These steps are involved in part because it's possible for elements, the
- <code id=creating-and-inserting-nodes:the-table-element-3><a href=#the-table-element>table</a></code> element in this case in particular, to have been moved by a script around
- in the DOM, or indeed removed from the DOM entirely, after the element was inserted by the
- parser.</p>
- <dt>Otherwise<dd>
- <p>Let <var>adjusted insertion location</var> be inside <var>target</var>,
- after its last child (if any).</p>
- </dl>
- <li>
- <p>If the <var>adjusted insertion location</var> is inside a <code id=creating-and-inserting-nodes:the-template-element-2><a href=#the-template-element>template</a></code>
- element, let it instead be inside the <code id=creating-and-inserting-nodes:the-template-element-3><a href=#the-template-element>template</a></code> element's <a href=#template-contents id=creating-and-inserting-nodes:template-contents-2>template
- contents</a>, after its last child (if any).</p>
- <li>
- <p>Return the <var>adjusted insertion location</var>.</p>
- </ol>
- <hr>
- <p>When the steps below require the UA to <dfn id=create-an-element-for-the-token>create an
- element for a token</dfn> in a particular <var>given namespace</var> and with a
- particular <var>intended parent</var>, the UA must run the following steps:</p>
- <ol><li>
- <p>Create a node implementing the interface appropriate for the element type corresponding to
- the tag name of the token in <var>given namespace</var> (as given in the specification
- that defines that element, e.g. for an <code id=creating-and-inserting-nodes:the-a-element><a href=#the-a-element>a</a></code> element in the <a href=#html-namespace-2 id=creating-and-inserting-nodes:html-namespace-2>HTML
- namespace</a>, this specification defines it to be the <code id=creating-and-inserting-nodes:htmlanchorelement><a href=#htmlanchorelement>HTMLAnchorElement</a></code>
- interface), with the tag name being the name of that element, with the node being in the given
- namespace, and with the attributes on the node being those given in the given token.</p>
- <p>The interface appropriate for an element in the <a href=#html-namespace-2 id=creating-and-inserting-nodes:html-namespace-2-2>HTML namespace</a> that is not
- defined in this specification (or <a href=#other-applicable-specifications id=creating-and-inserting-nodes:other-applicable-specifications>other applicable specifications</a>) is
- <code id=creating-and-inserting-nodes:htmlunknownelement><a href=#htmlunknownelement>HTMLUnknownElement</a></code>. Elements in other namespaces whose interface is not defined by
- that namespace's specification must use the interface <code id=creating-and-inserting-nodes:element><a href=#element>Element</a></code>.</p>
- <p>The <a id=creating-and-inserting-nodes:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the newly created element
- must be the <a id=creating-and-inserting-nodes:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the <var>intended parent</var>.</p>
- <li><p>If the newly created element has an <code>xmlns</code> attribute <em>in the
- <a href=#xmlns-namespace id=creating-and-inserting-nodes:xmlns-namespace>XMLNS namespace</a></em> whose value is not exactly the same as the element's namespace,
- that is a <a href=#parse-error id=creating-and-inserting-nodes:parse-error>parse error</a>. Similarly, if the newly created element has an <code>xmlns:xlink</code> attribute in the <a href=#xmlns-namespace id=creating-and-inserting-nodes:xmlns-namespace-2>XMLNS namespace</a> whose value is not the
- <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace>XLink Namespace</a>, that is a <a href=#parse-error id=creating-and-inserting-nodes:parse-error-2>parse error</a>.<li><p>If the newly created element is a <a href=#category-reset id=creating-and-inserting-nodes:category-reset>resettable element</a>,
- invoke its <a href=#concept-form-reset-control id=creating-and-inserting-nodes:concept-form-reset-control>reset algorithm</a>. (This initializes the
- element's <a href=#concept-fe-value id=creating-and-inserting-nodes:concept-fe-value>value</a> and <a href=#concept-fe-checked id=creating-and-inserting-nodes:concept-fe-checked>checkedness</a> based on the element's attributes.)<li><p>If the element is a <a href=#form-associated-element id=creating-and-inserting-nodes:form-associated-element>form-associated element</a>, and the <a href=#form-element-pointer id=creating-and-inserting-nodes:form-element-pointer><code>form</code> element pointer</a> is not null, and there is no <code id=creating-and-inserting-nodes:the-template-element-4><a href=#the-template-element>template</a></code>
- element on the <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-6>stack of open elements</a>, and the newly created element is either not
- <a href=#category-form-attr id=creating-and-inserting-nodes:category-form-attr>reassociateable</a> or doesn't have a <code id=creating-and-inserting-nodes:attr-fae-form><a href=#attr-fae-form>form</a></code> attribute, and the <var>intended parent</var> is in
- the same <a href=#home-subtree id=creating-and-inserting-nodes:home-subtree>home subtree</a> as the element pointed to by the <a href=#form-element-pointer id=creating-and-inserting-nodes:form-element-pointer-2><code>form</code> element pointer</a>, <a href=#concept-form-association id=creating-and-inserting-nodes:concept-form-association>associate</a> the newly created element with the
- <code id=creating-and-inserting-nodes:the-form-element><a href=#the-form-element>form</a></code> element pointed to by the <a href=#form-element-pointer id=creating-and-inserting-nodes:form-element-pointer-3><code>form</code> element
- pointer</a>, and suppress the running of the <a href=#reset-the-form-owner id=creating-and-inserting-nodes:reset-the-form-owner>reset the form owner</a> algorithm when
- the parser subsequently attempts to insert the element.<li><p>Return the newly created element.</ol>
- <hr>
-
- <p>When the steps below require the user agent to <dfn id=insert-a-foreign-element>insert a foreign element</dfn> for a token
- in a given namespace, the user agent must run these steps:</p>
- <ol><li><p>Let the <var>adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node id=creating-and-inserting-nodes:appropriate-place-for-inserting-a-node>appropriate place for
- inserting a node</a>.<li><p><a href=#create-an-element-for-the-token id=creating-and-inserting-nodes:create-an-element-for-the-token>Create an element for the token</a> in the given namespace, with the intended
- parent being the element in which the <var>adjusted insertion location</var> finds
- itself.<li>
- <p>If it is possible to insert an element at the <var>adjusted insertion
- location</var>, then insert the newly created element at the <var>adjusted insertion
- location</var>.</p>
- <p class=note>If the <var>adjusted insertion location</var> cannot accept more
- elements, e.g. because it's a <code id=creating-and-inserting-nodes:document><a href=#document>Document</a></code> that already has an element child, then the
- newly created element is dropped on the floor.</p>
- <li><p>Push the element onto the <a href=#stack-of-open-elements id=creating-and-inserting-nodes:stack-of-open-elements-7>stack of open elements</a> so that it is the new
- <a href=#current-node id=creating-and-inserting-nodes:current-node-2>current node</a>.<li><p>Return the newly created element.</ol>
- <p>When the steps below require the user agent to <dfn id=insert-an-html-element>insert an HTML element</dfn> for a token,
- the user agent must <a href=#insert-a-foreign-element id=creating-and-inserting-nodes:insert-a-foreign-element>insert a foreign element</a> for the token, in the <a href=#html-namespace-2 id=creating-and-inserting-nodes:html-namespace-2-3>HTML
- namespace</a>.</p>
- <hr>
- <p>When the steps below require the user agent to <dfn id=adjust-mathml-attributes>adjust MathML attributes</dfn> for a token,
- then, if the token has an attribute named <code>definitionurl</code>, change its name to
- <code>definitionURL</code> (note the case difference).</p>
- <p>When the steps below require the user agent to <dfn id=adjust-svg-attributes>adjust SVG attributes</dfn> for a token,
- then, for each attribute on the token whose attribute name is one of the ones in the first column
- of the following table, change the attribute's name to the name given in the corresponding cell in
- the second column. (This fixes the case of SVG attributes that are not all lowercase.)</p>
- <table><thead><tr><th> Attribute name on token <th> Attribute name on element
- <tbody><tr><td> <code>attributename</code> <td> <code>attributeName</code>
- <tr><td> <code>attributetype</code> <td> <code>attributeType</code>
- <tr><td> <code>basefrequency</code> <td> <code>baseFrequency</code>
- <tr><td> <code>baseprofile</code> <td> <code>baseProfile</code>
- <tr><td> <code>calcmode</code> <td> <code>calcMode</code>
- <tr><td> <code>clippathunits</code> <td> <code>clipPathUnits</code>
- <tr><td> <code>diffuseconstant</code> <td> <code>diffuseConstant</code>
- <tr><td> <code>edgemode</code> <td> <code>edgeMode</code>
- <tr><td> <code>filterunits</code> <td> <code>filterUnits</code>
- <tr><td> <code>glyphref</code> <td> <code>glyphRef</code>
- <tr><td> <code>gradienttransform</code> <td> <code>gradientTransform</code>
- <tr><td> <code>gradientunits</code> <td> <code>gradientUnits</code>
- <tr><td> <code>kernelmatrix</code> <td> <code>kernelMatrix</code>
- <tr><td> <code>kernelunitlength</code> <td> <code>kernelUnitLength</code>
- <tr><td> <code>keypoints</code> <td> <code>keyPoints</code>
- <tr><td> <code>keysplines</code> <td> <code>keySplines</code>
- <tr><td> <code>keytimes</code> <td> <code>keyTimes</code>
- <tr><td> <code>lengthadjust</code> <td> <code>lengthAdjust</code>
- <tr><td> <code>limitingconeangle</code> <td> <code>limitingConeAngle</code>
- <tr><td> <code>markerheight</code> <td> <code>markerHeight</code>
- <tr><td> <code>markerunits</code> <td> <code>markerUnits</code>
- <tr><td> <code>markerwidth</code> <td> <code>markerWidth</code>
- <tr><td> <code>maskcontentunits</code> <td> <code>maskContentUnits</code>
- <tr><td> <code>maskunits</code> <td> <code>maskUnits</code>
- <tr><td> <code>numoctaves</code> <td> <code>numOctaves</code>
- <tr><td> <code>pathlength</code> <td> <code>pathLength</code>
- <tr><td> <code>patterncontentunits</code> <td> <code>patternContentUnits</code>
- <tr><td> <code>patterntransform</code> <td> <code>patternTransform</code>
- <tr><td> <code>patternunits</code> <td> <code>patternUnits</code>
- <tr><td> <code>pointsatx</code> <td> <code>pointsAtX</code>
- <tr><td> <code>pointsaty</code> <td> <code>pointsAtY</code>
- <tr><td> <code>pointsatz</code> <td> <code>pointsAtZ</code>
- <tr><td> <code>preservealpha</code> <td> <code>preserveAlpha</code>
- <tr><td> <code>preserveaspectratio</code> <td> <code>preserveAspectRatio</code>
- <tr><td> <code>primitiveunits</code> <td> <code>primitiveUnits</code>
- <tr><td> <code>refx</code> <td> <code>refX</code>
- <tr><td> <code>refy</code> <td> <code>refY</code>
- <tr><td> <code>repeatcount</code> <td> <code>repeatCount</code>
- <tr><td> <code>repeatdur</code> <td> <code>repeatDur</code>
- <tr><td> <code>requiredextensions</code> <td> <code>requiredExtensions</code>
- <tr><td> <code>requiredfeatures</code> <td> <code>requiredFeatures</code>
- <tr><td> <code>specularconstant</code> <td> <code>specularConstant</code>
- <tr><td> <code>specularexponent</code> <td> <code>specularExponent</code>
- <tr><td> <code>spreadmethod</code> <td> <code>spreadMethod</code>
- <tr><td> <code>startoffset</code> <td> <code>startOffset</code>
- <tr><td> <code>stddeviation</code> <td> <code>stdDeviation</code>
- <tr><td> <code>stitchtiles</code> <td> <code>stitchTiles</code>
- <tr><td> <code>surfacescale</code> <td> <code>surfaceScale</code>
- <tr><td> <code>systemlanguage</code> <td> <code>systemLanguage</code>
- <tr><td> <code>tablevalues</code> <td> <code>tableValues</code>
- <tr><td> <code>targetx</code> <td> <code>targetX</code>
- <tr><td> <code>targety</code> <td> <code>targetY</code>
- <tr><td> <code>textlength</code> <td> <code>textLength</code>
- <tr><td> <code>viewbox</code> <td> <code>viewBox</code>
- <tr><td> <code>viewtarget</code> <td> <code>viewTarget</code>
- <tr><td> <code>xchannelselector</code> <td> <code>xChannelSelector</code>
- <tr><td> <code>ychannelselector</code> <td> <code>yChannelSelector</code>
- <tr><td> <code>zoomandpan</code> <td> <code>zoomAndPan</code>
- </table>
- <p>When the steps below require the user agent to <dfn id=adjust-foreign-attributes>adjust foreign attributes</dfn> for a
- token, then, if any of the attributes on the token match the strings given in the first column of
- the following table, let the attribute be a namespaced attribute, with the prefix being the string
- given in the corresponding cell in the second column, the local name being the string given in the
- corresponding cell in the third column, and the namespace being the namespace given in the
- corresponding cell in the fourth column. (This fixes the use of namespaced attributes, in
- particular <a href=#attr-xml-lang id=creating-and-inserting-nodes:attr-xml-lang><code>lang</code> attributes in the <span>XML
- namespace</span></a>.)</p>
- <table><thead><tr><th> Attribute name <th> Prefix <th> Local name <th> Namespace
- <tbody><tr><td> <code>xlink:actuate</code> <td> <code>xlink</code> <td> <code>actuate</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-2>XLink namespace</a>
- <tr><td> <code>xlink:arcrole</code> <td> <code>xlink</code> <td> <code>arcrole</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-3>XLink namespace</a>
- <tr><td> <code>xlink:href</code> <td> <code>xlink</code> <td> <code>href</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-4>XLink namespace</a>
- <tr><td> <code>xlink:role</code> <td> <code>xlink</code> <td> <code>role</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-5>XLink namespace</a>
- <tr><td> <code>xlink:show</code> <td> <code>xlink</code> <td> <code>show</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-6>XLink namespace</a>
- <tr><td> <code>xlink:title</code> <td> <code>xlink</code> <td> <code>title</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-7>XLink namespace</a>
- <tr><td> <code>xlink:type</code> <td> <code>xlink</code> <td> <code>type</code> <td> <a href=#xlink-namespace id=creating-and-inserting-nodes:xlink-namespace-8>XLink namespace</a>
- <tr><td> <code>xml:base</code> <td> <code>xml</code> <td> <code>base</code> <td> <a href=#xml-namespace id=creating-and-inserting-nodes:xml-namespace>XML namespace</a>
- <tr><td> <code>xml:lang</code> <td> <code>xml</code> <td> <code>lang</code> <td> <a href=#xml-namespace id=creating-and-inserting-nodes:xml-namespace-2>XML namespace</a>
- <tr><td> <code>xml:space</code> <td> <code>xml</code> <td> <code>space</code> <td> <a href=#xml-namespace id=creating-and-inserting-nodes:xml-namespace-3>XML namespace</a>
- <tr><td> <code>xmlns</code> <td> (none) <td> <code>xmlns</code> <td> <a href=#xmlns-namespace id=creating-and-inserting-nodes:xmlns-namespace-3>XMLNS namespace</a>
- <tr><td> <code>xmlns:xlink</code> <td> <code>xmlns</code> <td> <code>xlink</code> <td> <a href=#xmlns-namespace id=creating-and-inserting-nodes:xmlns-namespace-4>XMLNS namespace</a>
- </table>
- <hr>
- <p>When the steps below require the user agent to <dfn id=insert-a-character>insert a character</dfn> while processing a
- token, the user agent must run the following steps:</p>
- <ol><li><p>Let <var>data</var> be the characters passed to the algorithm, or, if no
- characters were explicitly specified, the character of the character token being
- processed.<li><p>Let the <var>adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node id=creating-and-inserting-nodes:appropriate-place-for-inserting-a-node-2>appropriate
- place for inserting a node</a>.<li>
- <p>If the <var>adjusted insertion location</var> is in a <code id=creating-and-inserting-nodes:document-2><a href=#document>Document</a></code> node,
- then abort these steps.
- <p class=note>The DOM will not let <code id=creating-and-inserting-nodes:document-3><a href=#document>Document</a></code> nodes have <code id=creating-and-inserting-nodes:text><a href=#text>Text</a></code> node
- children, so they are dropped on the floor.</p>
- <li>
- <p>If there is a <code id=creating-and-inserting-nodes:text-2><a href=#text>Text</a></code> node immediately before the <var>adjusted insertion
- location</var>, then append <var>data</var> to that <code id=creating-and-inserting-nodes:text-3><a href=#text>Text</a></code> node's data.</p>
- <p>Otherwise, create a new <code id=creating-and-inserting-nodes:text-4><a href=#text>Text</a></code> node whose data is <var>data</var> and
- whose <a id=creating-and-inserting-nodes:node-document-3 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is the same as that of the
- element in which the <var>adjusted insertion location</var> finds itself, and insert
- the newly created node at the <var>adjusted insertion location</var>.</p>
- </ol>
- <div class=example>
- <p>Here are some sample inputs to the parser and the corresponding number of <code id=creating-and-inserting-nodes:text-5><a href=#text>Text</a></code>
- nodes that they result in, assuming a user agent that executes scripts.</p>
- <table><thead><tr><th>Input <th>Number of <code id=creating-and-inserting-nodes:text-6><a href=#text>Text</a></code> nodes
- <tbody><tr><td><pre>A<script>
- var script = document.getElementsByTagName('script')[0];
- document.body.removeChild(script);
- </script>B</pre>
- <td>One <code id=creating-and-inserting-nodes:text-7><a href=#text>Text</a></code> node in the document, containing "AB".
- <tr><td><pre>A<script>
- var text = document.createTextNode('B');
- document.body.appendChild(text);
- </script>C</pre>
- <td>Three <code id=creating-and-inserting-nodes:text-8><a href=#text>Text</a></code> nodes; "A" before the script, the script's contents, and "BC" after the script (the parser appends to the <code id=creating-and-inserting-nodes:text-9><a href=#text>Text</a></code> node created by the script).
- <tr><td><pre>A<script>
- var text = document.getElementsByTagName('script')[0].firstChild;
- text.data = 'B';
- document.body.appendChild(text);
- </script>C</pre>
- <td>Two adjacent <code id=creating-and-inserting-nodes:text-10><a href=#text>Text</a></code> nodes in the document, containing "A" and "BC".
- <tr><td><pre>A<table>B<tr>C</tr>D</table></pre>
- <td>One <code id=creating-and-inserting-nodes:text-11><a href=#text>Text</a></code> node before the table, containing "ABCD". (This is caused by <a href=#foster-parent id=creating-and-inserting-nodes:foster-parent-2>foster parenting</a>.)
- <tr><td><pre>A<table><tr> B</tr> C</table></pre>
- <td>One <code id=creating-and-inserting-nodes:text-12><a href=#text>Text</a></code> node before the table, containing "A B C" (A-space-B-space-C). (This is caused by <a href=#foster-parent id=creating-and-inserting-nodes:foster-parent-3>foster parenting</a>.)
- <tr><td><pre>A<table><tr> B</tr> </em>C</table></pre>
- <td>One <code id=creating-and-inserting-nodes:text-13><a href=#text>Text</a></code> node before the table, containing "A BC" (A-space-B-C), and one <code id=creating-and-inserting-nodes:text-14><a href=#text>Text</a></code> node inside the table (as a child of a <code id=creating-and-inserting-nodes:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code>) with a single space character. (Space characters separated from non-space characters by non-character tokens are not affected by <a href=#foster-parent id=creating-and-inserting-nodes:foster-parent-4>foster parenting</a>, even if those other tokens then get ignored.)
- </table>
- </div>
- <hr>
- <p>When the steps below require the user agent to <dfn id=insert-a-comment>insert a comment</dfn> while processing a
- comment token, optionally with an explicitly insertion position <var>position</var>, the
- user agent must run the following steps:</p>
- <ol><li><p>Let <var>data</var> be the data given in the comment token being
- processed.<li><p>If <var>position</var> was specified, then let the <var>adjusted
- insertion location</var> be <var>position</var>. Otherwise, let <var>adjusted
- insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node id=creating-and-inserting-nodes:appropriate-place-for-inserting-a-node-3>appropriate place for inserting a node</a>.<li><p>Create a <code id=creating-and-inserting-nodes:comment-2><a href=#comment-2>Comment</a></code> node whose <code>data</code> attribute is set to
- <var>data</var> and whose <a id=creating-and-inserting-nodes:node-document-4 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is
- the same as that of the node in which the <var>adjusted insertion location</var> finds
- itself.</p>
- <li><p>Insert the newly created node at the <var>adjusted insertion
- location</var>.</ol>
- <hr>
- <p id=mutation-during-parsing>DOM mutation events must not fire for changes caused by the UA
- parsing the document. This includes the parsing of any content inserted using <code id=creating-and-inserting-nodes:dom-document-write><a href=#dom-document-write>document.write()</a></code> and <code id=creating-and-inserting-nodes:dom-document-writeln><a href=#dom-document-writeln>document.writeln()</a></code> calls. <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>However, mutation observers <em>do</em> fire, as required by the DOM specification.</p>
- <h5 id=parsing-elements-that-contain-only-text>12.2.5.2 Parsing elements that contain only text</h5>
- <p>The <dfn id=generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</dfn> and the <dfn id=generic-rcdata-element-parsing-algorithm>generic RCDATA element
- parsing algorithm</dfn> consist of the following steps. These algorithms are always invoked in
- response to a start tag token.</p>
- <ol><li><p><a href=#insert-an-html-element id=parsing-elements-that-contain-only-text:insert-an-html-element>Insert an HTML element</a> for the token.<li><p>If the algorithm that was invoked is the <a href=#generic-raw-text-element-parsing-algorithm id=parsing-elements-that-contain-only-text:generic-raw-text-element-parsing-algorithm>generic raw text element parsing
- algorithm</a>, switch the tokenizer to the <a href=#rawtext-state id=parsing-elements-that-contain-only-text:rawtext-state>RAWTEXT state</a>; otherwise the algorithm
- invoked was the <a href=#generic-rcdata-element-parsing-algorithm id=parsing-elements-that-contain-only-text:generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>, switch the tokenizer to
- the <a href=#rcdata-state id=parsing-elements-that-contain-only-text:rcdata-state>RCDATA state</a>.<li><p>Let the <a href=#original-insertion-mode id=parsing-elements-that-contain-only-text:original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode id=parsing-elements-that-contain-only-text:insertion-mode>insertion
- mode</a>.</p>
- <li><p>Then, switch the <a href=#insertion-mode id=parsing-elements-that-contain-only-text:insertion-mode-2>insertion mode</a> to "<a href=#parsing-main-incdata id=parsing-elements-that-contain-only-text:parsing-main-incdata>text</a>".</ol>
- <h5 id=closing-elements-that-have-implied-end-tags>12.2.5.3 Closing elements that have implied end tags</h5>
- <p>When the steps below require the UA to <dfn id=generate-implied-end-tags>generate implied end tags</dfn>, then, while the
- <a href=#current-node id=closing-elements-that-have-implied-end-tags:current-node>current node</a> is a <code id=closing-elements-that-have-implied-end-tags:the-dd-element><a href=#the-dd-element>dd</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-dt-element><a href=#the-dt-element>dt</a></code> element, an
- <code id=closing-elements-that-have-implied-end-tags:the-li-element><a href=#the-li-element>li</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-option-element><a href=#the-option-element>option</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element, a
- <code id=closing-elements-that-have-implied-end-tags:the-p-element><a href=#the-p-element>p</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-rp-element><a href=#the-rp-element>rp</a></code> element, or an <code id=closing-elements-that-have-implied-end-tags:the-rt-element><a href=#the-rt-element>rt</a></code> element, the UA must pop
- the <a href=#current-node id=closing-elements-that-have-implied-end-tags:current-node-2>current node</a> off the <a href=#stack-of-open-elements id=closing-elements-that-have-implied-end-tags:stack-of-open-elements>stack of open elements</a>.</p>
- <p>If a step requires the UA to generate implied end tags but lists an element to exclude from the
- process, then the UA must perform the above steps as if that element was not in the above
- list.</p>
- <p>When the steps below require the UA to <dfn id=generate-all-implied-end-tags-thoroughly>generate all implied end tags thoroughly</dfn>,
- then, while the <a href=#current-node id=closing-elements-that-have-implied-end-tags:current-node-3>current node</a> is a <code id=closing-elements-that-have-implied-end-tags:the-caption-element><a href=#the-caption-element>caption</a></code> element, a
- <code id=closing-elements-that-have-implied-end-tags:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-dd-element-2><a href=#the-dd-element>dd</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-dt-element-2><a href=#the-dt-element>dt</a></code> element, an
- <code id=closing-elements-that-have-implied-end-tags:the-li-element-2><a href=#the-li-element>li</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-option-element-2><a href=#the-option-element>option</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element, a
- <code id=closing-elements-that-have-implied-end-tags:the-p-element-2><a href=#the-p-element>p</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-rp-element-2><a href=#the-rp-element>rp</a></code> element, an <code id=closing-elements-that-have-implied-end-tags:the-rt-element-2><a href=#the-rt-element>rt</a></code> element, a
- <code id=closing-elements-that-have-implied-end-tags:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-td-element><a href=#the-td-element>td</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element, a
- <code id=closing-elements-that-have-implied-end-tags:the-th-element><a href=#the-th-element>th</a></code> element, a <code id=closing-elements-that-have-implied-end-tags:the-thead-element><a href=#the-thead-element>thead</a></code> element, or a <code id=closing-elements-that-have-implied-end-tags:the-tr-element><a href=#the-tr-element>tr</a></code> element, the UA must
- pop the <a href=#current-node id=closing-elements-that-have-implied-end-tags:current-node-4>current node</a> off the <a href=#stack-of-open-elements id=closing-elements-that-have-implied-end-tags:stack-of-open-elements-2>stack of open elements</a>.</p>
- <h5 id=parsing-main-inhtml>12.2.5.4 The rules for parsing tokens in HTML content</h5>
- <h6 id=the-initial-insertion-mode>12.2.5.4.1 The "<dfn>initial</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-initial-insertion-mode id=the-initial-insertion-mode:the-initial-insertion-mode>initial</a>" <a href=#insertion-mode id=the-initial-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
- TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
- U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p>Ignore the token.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-initial-insertion-mode:insert-a-comment>Insert a comment</a> as the last child of the <code id=the-initial-insertion-mode:document><a href=#document>Document</a></code> object.</p>
- <dt>A DOCTYPE token<dd>
- <p>If the DOCTYPE token's name is not a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive>case-sensitive</a> match for the string "<code>html</code>", or the token's public identifier is not missing, or the token's system
- identifier is neither missing nor a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-2>case-sensitive</a> match for the string
- "<code id=the-initial-insertion-mode:about:legacy-compat><a href=#about:legacy-compat>about:legacy-compat</a></code>", and none of the sets of conditions in the following list are
- matched, then there is a <a href=#parse-error id=the-initial-insertion-mode:parse-error>parse error</a>.</p>
- <ul><li>The DOCTYPE token's name is a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-3>case-sensitive</a> match for the string "<code>html</code>", the token's public identifier is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-4>case-sensitive</a> string
- "<code>-//W3C//DTD HTML 4.0//EN</code>", and the token's system identifier
- is either missing or the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-5>case-sensitive</a> string "<code>http://www.w3.org/TR/REC-html40/strict.dtd</code>".<li>The DOCTYPE token's name is a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-6>case-sensitive</a> match for the string "<code>html</code>", the token's public identifier is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-7>case-sensitive</a> string
- "<code>-//W3C//DTD HTML 4.01//EN</code>", and the token's system identifier
- is either missing or the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-8>case-sensitive</a> string "<code>http://www.w3.org/TR/html4/strict.dtd</code>".<li>The DOCTYPE token's name is a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-9>case-sensitive</a> match for the string "<code>html</code>", the token's public identifier is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-10>case-sensitive</a> string
- "<code>-//W3C//DTD XHTML 1.0 Strict//EN</code>", and the token's system
- identifier is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-11>case-sensitive</a> string "<code>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</code>".<li>The DOCTYPE token's name is a <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-12>case-sensitive</a> match for the string "<code>html</code>", the token's public identifier is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-13>case-sensitive</a> string
- "<code>-//W3C//DTD XHTML 1.1//EN</code>", and the token's system identifier
- is the <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-14>case-sensitive</a> string "<code>http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd</code>".</ul>
- <p>Conformance checkers may, based on the values (including presence or lack thereof) of the
- DOCTYPE token's name, public identifier, or system identifier, switch to a conformance checking
- mode for another language (e.g. based on the DOCTYPE token a conformance checker could recognise
- that the document is an HTML4-era document, and defer to an HTML4 conformance checker.)</p>
- <p>Append a <code id=the-initial-insertion-mode:documenttype><a href=#documenttype>DocumentType</a></code> node to the <code id=the-initial-insertion-mode:document-2><a href=#document>Document</a></code> node, with the <code>name</code> attribute set to the name given in the DOCTYPE token, or the empty string
- if the name was missing; the <code>publicId</code> attribute set to the public
- identifier given in the DOCTYPE token, or the empty string if the public identifier was missing;
- the <code>systemId</code> attribute set to the system identifier given in the DOCTYPE
- token, or the empty string if the system identifier was missing; and the other attributes
- specific to <code id=the-initial-insertion-mode:documenttype-2><a href=#documenttype>DocumentType</a></code> objects set to null and empty lists as appropriate.
- Associate the <code id=the-initial-insertion-mode:documenttype-3><a href=#documenttype>DocumentType</a></code> node with the <code id=the-initial-insertion-mode:document-3><a href=#document>Document</a></code> object so that it is
- returned as the value of the <code>doctype</code> attribute of the
- <code id=the-initial-insertion-mode:document-4><a href=#document>Document</a></code> object.</p>
- <p id=quirks-mode-doctypes>Then, if the document is <em>not</em> <a href=#an-iframe-srcdoc-document id=the-initial-insertion-mode:an-iframe-srcdoc-document>an <code>iframe</code>
- <code>srcdoc</code> document</a>, and the DOCTYPE token matches
- one of the conditions in the following list, then set the <code id=the-initial-insertion-mode:document-5><a href=#document>Document</a></code> to <a href=#quirks-mode id=the-initial-insertion-mode:quirks-mode>quirks
- mode</a>:</p>
- <ul class=brief><li> The <i id=the-initial-insertion-mode:force-quirks-flag><a href=#force-quirks-flag>force-quirks flag</a></i> is set to <i>on</i>. <li> The name is set to anything other than "<code>html</code>" (compared <a href=#case-sensitive id=the-initial-insertion-mode:case-sensitive-15>case-sensitively</a>). <li> The public identifier is set to: "<code>-//W3O//DTD W3 HTML Strict 3.0//EN//</code>" <li> The public identifier is set to: "<code>-/W3C/DTD HTML 4.0 Transitional/EN</code>" <li> The public identifier is set to: "<code>HTML</code>" <li> The system identifier is set to: "<code>http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd</code>" <li> The public identifier starts with: "<code>+//Silmaril//dtd html Pro v0r11 19970101//</code>" <li> The public identifier starts with: "<code>-//AS//DTD HTML 3.0 asWedit + extensions//</code>" <li> The public identifier starts with: "<code>-//AdvaSoft Ltd//DTD HTML 3.0 asWedit + extensions//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0 Level 1//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0 Level 2//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0 Strict Level 1//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0 Strict Level 2//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0 Strict//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.0//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 2.1E//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 3.0//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 3.2 Final//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 3.2//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML 3//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Level 0//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Level 1//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Level 2//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Level 3//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Strict Level 0//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Strict Level 1//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Strict Level 2//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Strict Level 3//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML Strict//</code>" <li> The public identifier starts with: "<code>-//IETF//DTD HTML//</code>" <li> The public identifier starts with: "<code>-//Metrius//DTD Metrius Presentational//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 2.0 HTML Strict//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 2.0 HTML//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 2.0 Tables//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 3.0 HTML Strict//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 3.0 HTML//</code>" <li> The public identifier starts with: "<code>-//Microsoft//DTD Internet Explorer 3.0 Tables//</code>" <li> The public identifier starts with: "<code>-//Netscape Comm. Corp.//DTD HTML//</code>" <li> The public identifier starts with: "<code>-//Netscape Comm. Corp.//DTD Strict HTML//</code>" <li> The public identifier starts with: "<code>-//O'Reilly and Associates//DTD HTML 2.0//</code>" <li> The public identifier starts with: "<code>-//O'Reilly and Associates//DTD HTML Extended 1.0//</code>" <li> The public identifier starts with: "<code>-//O'Reilly and Associates//DTD HTML Extended Relaxed 1.0//</code>" <li> The public identifier starts with: "<code>-//SQ//DTD HTML 2.0 HoTMetaL + extensions//</code>" <li> The public identifier starts with: "<code>-//SoftQuad Software//DTD HoTMetaL PRO 6.0::19990601::extensions to HTML 4.0//</code>" <li> The public identifier starts with: "<code>-//SoftQuad//DTD HoTMetaL PRO 4.0::19971010::extensions to HTML 4.0//</code>" <li> The public identifier starts with: "<code>-//Spyglass//DTD HTML 2.0 Extended//</code>" <li> The public identifier starts with: "<code>-//Sun Microsystems Corp.//DTD HotJava HTML//</code>" <li> The public identifier starts with: "<code>-//Sun Microsystems Corp.//DTD HotJava Strict HTML//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 3 1995-03-24//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 3.2 Draft//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 3.2 Final//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 3.2//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 3.2S Draft//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 4.0 Frameset//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML 4.0 Transitional//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML Experimental 19960712//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD HTML Experimental 970421//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD W3 HTML//</code>" <li> The public identifier starts with: "<code>-//W3O//DTD W3 HTML 3.0//</code>" <li> The public identifier starts with: "<code>-//WebTechs//DTD Mozilla HTML 2.0//</code>" <li> The public identifier starts with: "<code>-//WebTechs//DTD Mozilla HTML//</code>" <li> The system identifier is missing and the public identifier starts with: "<code>-//W3C//DTD HTML 4.01 Frameset//</code>" <li> The system identifier is missing and the public identifier starts with: "<code>-//W3C//DTD HTML 4.01 Transitional//</code>" </ul>
- <p>Otherwise, if the document is <em>not</em> <a href=#an-iframe-srcdoc-document id=the-initial-insertion-mode:an-iframe-srcdoc-document-2>an <code>iframe</code> <code>srcdoc</code> document</a>, and the DOCTYPE token matches one of
- the conditions in the following list, then set the <code id=the-initial-insertion-mode:document-6><a href=#document>Document</a></code> to <a href=#limited-quirks-mode id=the-initial-insertion-mode:limited-quirks-mode>limited-quirks
- mode</a>:</p>
- <ul class=brief><li> The public identifier starts with: "<code>-//W3C//DTD XHTML 1.0 Frameset//</code>" <li> The public identifier starts with: "<code>-//W3C//DTD XHTML 1.0 Transitional//</code>" <li> The system identifier is not missing and the public identifier starts with: "<code>-//W3C//DTD HTML 4.01 Frameset//</code>" <li> The system identifier is not missing and the public identifier starts with: "<code>-//W3C//DTD HTML 4.01 Transitional//</code>" </ul>
- <p>The system identifier and public identifier strings must be compared to the values given in
- the lists above in an <a href=#ascii-case-insensitive id=the-initial-insertion-mode:ascii-case-insensitive>ASCII case-insensitive</a> manner. A system identifier whose
- value is the empty string is not considered missing for the purposes of the conditions
- above.</p>
- <p>Then, switch the <a href=#insertion-mode id=the-initial-insertion-mode:insertion-mode-2>insertion mode</a> to "<a href=#the-before-html-insertion-mode id=the-initial-insertion-mode:the-before-html-insertion-mode>before html</a>".</p>
- <dt>Anything else<dd>
- <p>If the document is <em>not</em> <a href=#an-iframe-srcdoc-document id=the-initial-insertion-mode:an-iframe-srcdoc-document-3>an <code>iframe</code> <code>srcdoc</code> document</a>, then this is a <a href=#parse-error id=the-initial-insertion-mode:parse-error-2>parse
- error</a>; set the <code id=the-initial-insertion-mode:document-7><a href=#document>Document</a></code> to <a href=#quirks-mode id=the-initial-insertion-mode:quirks-mode-2>quirks mode</a>.</p>
- <p>In any case, switch the <a href=#insertion-mode id=the-initial-insertion-mode:insertion-mode-3>insertion mode</a> to "<a href=#the-before-html-insertion-mode id=the-initial-insertion-mode:the-before-html-insertion-mode-2>before html</a>", then reprocess the token.</p>
- </dl>
- <h6 id=the-before-html-insertion-mode>12.2.5.4.2 The "<dfn>before html</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-before-html-insertion-mode id=the-before-html-insertion-mode:the-before-html-insertion-mode>before html</a>" <a href=#insertion-mode id=the-before-html-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=the-before-html-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-before-html-insertion-mode:insert-a-comment>Insert a comment</a> as the last child of the <code id=the-before-html-insertion-mode:document><a href=#document>Document</a></code> object.</p>
- <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p>Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p><a href=#create-an-element-for-the-token id=the-before-html-insertion-mode:create-an-element-for-the-token>Create an element for the token</a> in the <a href=#html-namespace-2 id=the-before-html-insertion-mode:html-namespace-2>HTML namespace</a>, with the
- <code id=the-before-html-insertion-mode:document-2><a href=#document>Document</a></code> as the intended parent. Append it to the <code id=the-before-html-insertion-mode:document-3><a href=#document>Document</a></code> object. Put
- this element in the <a href=#stack-of-open-elements id=the-before-html-insertion-mode:stack-of-open-elements>stack of open elements</a>.</p>
- <p id=parser-appcache>If the <code id=the-before-html-insertion-mode:document-4><a href=#document>Document</a></code> is being loaded as part of <a href=#navigate id=the-before-html-insertion-mode:navigate>navigation</a> of a <a href=#browsing-context id=the-before-html-insertion-mode:browsing-context>browsing context</a>, then: if the newly
- created element has a <code id=the-before-html-insertion-mode:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code> attribute whose value is
- not the empty string, then <a href=#resolve-a-url id=the-before-html-insertion-mode:resolve-a-url>resolve</a> the value of that
- attribute to an <a href=#absolute-url id=the-before-html-insertion-mode:absolute-url>absolute URL</a>, relative to the newly created element, and if that is
- successful, run the <a href=#concept-appcache-init id=the-before-html-insertion-mode:concept-appcache-init>application cache selection
- algorithm</a> with the result of applying the <a href=#concept-url-serialiser id=the-before-html-insertion-mode:concept-url-serialiser>URL
- serialiser</a> algorithm to the resulting <a href=#parsed-url id=the-before-html-insertion-mode:parsed-url>parsed URL</a> with the <i>exclude
- fragment flag</i> set; otherwise, if there is no such attribute, or its value is the empty
- string, or resolving its value fails, run the <a href=#concept-appcache-init id=the-before-html-insertion-mode:concept-appcache-init-2>application
- cache selection algorithm</a> with no manifest. The algorithm must be passed the
- <code id=the-before-html-insertion-mode:document-5><a href=#document>Document</a></code> object.</p>
- <p>Switch the <a href=#insertion-mode id=the-before-html-insertion-mode:insertion-mode-2>insertion mode</a> to "<a href=#the-before-head-insertion-mode id=the-before-html-insertion-mode:the-before-head-insertion-mode>before
- head</a>".</p>
- <dt>An end tag whose tag name is one of: "head", "body", "html", "br"<dd>
- <p>Act as described in the "anything else" entry below.</p>
- <dt>Any other end tag<dd>
- <p><a href=#parse-error id=the-before-html-insertion-mode:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
- <p>Create an <code id=the-before-html-insertion-mode:the-html-element><a href=#the-html-element>html</a></code> element whose <a id=the-before-html-insertion-mode:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is the <code id=the-before-html-insertion-mode:document-6><a href=#document>Document</a></code> object. Append
- it to the <code id=the-before-html-insertion-mode:document-7><a href=#document>Document</a></code> object. Put this element in the <a href=#stack-of-open-elements id=the-before-html-insertion-mode:stack-of-open-elements-2>stack of open
- elements</a>.</p>
- <p>If the <code id=the-before-html-insertion-mode:document-8><a href=#document>Document</a></code> is being loaded as part of <a href=#navigate id=the-before-html-insertion-mode:navigate-2>navigation</a> of a <a href=#browsing-context id=the-before-html-insertion-mode:browsing-context-2>browsing context</a>, then: run the <a href=#concept-appcache-init id=the-before-html-insertion-mode:concept-appcache-init-3>application cache selection algorithm</a> with no manifest,
- passing it the <code id=the-before-html-insertion-mode:document-9><a href=#document>Document</a></code> object.</p>
- <p>Switch the <a href=#insertion-mode id=the-before-html-insertion-mode:insertion-mode-3>insertion mode</a> to "<a href=#the-before-head-insertion-mode id=the-before-html-insertion-mode:the-before-head-insertion-mode-2>before
- head</a>", then reprocess the token.</p>
- </dl>
- <p>The root element can end up being removed from the <code id=the-before-html-insertion-mode:document-10><a href=#document>Document</a></code> object, e.g. by
- scripts; nothing in particular happens in such cases, content continues being appended to the
- nodes as described in the next section.</p>
- <h6 id=the-before-head-insertion-mode>12.2.5.4.3 The "<dfn>before head</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-before-head-insertion-mode id=the-before-head-insertion-mode:the-before-head-insertion-mode>before head</a>" <a href=#insertion-mode id=the-before-head-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
- TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
- U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p>Ignore the token.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-before-head-insertion-mode:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=the-before-head-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-before-head-insertion-mode:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=the-before-head-insertion-mode:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=the-before-head-insertion-mode:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "head"<dd>
- <p><a href=#insert-an-html-element id=the-before-head-insertion-mode:insert-an-html-element>Insert an HTML element</a> for the token.</p>
- <p>Set the <a href=#head-element-pointer id=the-before-head-insertion-mode:head-element-pointer><code>head</code> element pointer</a> to the newly created
- <code id=the-before-head-insertion-mode:the-head-element><a href=#the-head-element>head</a></code> element.</p>
- <p>Switch the <a href=#insertion-mode id=the-before-head-insertion-mode:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inhead id=the-before-head-insertion-mode:parsing-main-inhead>in
- head</a>".</p>
- <dt>An end tag whose tag name is one of: "head", "body", "html", "br"<dd>
- <p>Act as described in the "anything else" entry below.</p>
- <dt>Any other end tag<dd>
- <p><a href=#parse-error id=the-before-head-insertion-mode:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
-
- <p><a href=#insert-an-html-element id=the-before-head-insertion-mode:insert-an-html-element-2>Insert an HTML element</a> for a "head" start tag token with no attributes.</p>
- <p>Set the <a href=#head-element-pointer id=the-before-head-insertion-mode:head-element-pointer-2><code>head</code> element pointer</a> to the newly created
- <code id=the-before-head-insertion-mode:the-head-element-2><a href=#the-head-element>head</a></code> element.</p>
- <p>Switch the <a href=#insertion-mode id=the-before-head-insertion-mode:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-inhead id=the-before-head-insertion-mode:parsing-main-inhead-2>in
- head</a>".</p>
-
- <p>Reprocess the current token.</p>
- </dl>
- <h6 id=parsing-main-inhead>12.2.5.4.4 The "<dfn>in head</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inhead id=parsing-main-inhead:parsing-main-inhead>in
- head</a>" <a href=#insertion-mode id=parsing-main-inhead:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
- TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
- U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=parsing-main-inhead:insert-a-character>Insert the character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-inhead:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inhead:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inhead:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-inhead:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is one of: "base", "basefont",
- "bgsound", "link"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inhead:insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inhead:current-node>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inhead:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <dt>A start tag whose tag name is "meta"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inhead:insert-an-html-element-2>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inhead:current-node-2>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-2>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inhead:acknowledge-self-closing-flag-2>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <p id=meta-charset-during-parse>If the element has a <code id=parsing-main-inhead:attr-meta-charset><a href=#attr-meta-charset>charset</a></code> attribute, and <a id=parsing-main-inhead:getting-an-encoding href=http://encoding.spec.whatwg.org/#concept-encoding-get data-x-internal=getting-an-encoding>getting an encoding</a> from
- its value results in a supported <a href=#ascii-compatible-character-encoding id=parsing-main-inhead:ascii-compatible-character-encoding>ASCII-compatible character encoding</a> or <a href=#a-utf-16-encoding id=parsing-main-inhead:a-utf-16-encoding>a
- UTF-16 encoding</a>, and the <a href=#concept-encoding-confidence id=parsing-main-inhead:concept-encoding-confidence>confidence</a> is
- currently <i>tentative</i>, then <a href=#change-the-encoding id=parsing-main-inhead:change-the-encoding>change the encoding</a> to the resulting encoding.</p>
- <p>Otherwise, if the element has an <code id=parsing-main-inhead:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>
- attribute whose value is an <a href=#ascii-case-insensitive id=parsing-main-inhead:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>Content-Type</code>", and the element has a <code id=parsing-main-inhead:attr-meta-content><a href=#attr-meta-content>content</a></code> attribute, and applying the <a href=#algorithm-for-extracting-a-character-encoding-from-a-meta-element id=parsing-main-inhead:algorithm-for-extracting-a-character-encoding-from-a-meta-element>algorithm for
- extracting a character encoding from a <code>meta</code> element</a> to that attribute's
- value returns a supported <a href=#ascii-compatible-character-encoding id=parsing-main-inhead:ascii-compatible-character-encoding-2>ASCII-compatible character encoding</a> or <a href=#a-utf-16-encoding id=parsing-main-inhead:a-utf-16-encoding-2>a UTF-16
- encoding</a>, and the <a href=#concept-encoding-confidence id=parsing-main-inhead:concept-encoding-confidence-2>confidence</a> is
- currently <i>tentative</i>, then <a href=#change-the-encoding id=parsing-main-inhead:change-the-encoding-2>change the encoding</a> to the extracted encoding.</p>
- <dt>A start tag whose tag name is "title"<dd>
- <p>Follow the <a href=#generic-rcdata-element-parsing-algorithm id=parsing-main-inhead:generic-rcdata-element-parsing-algorithm>generic RCDATA element parsing algorithm</a>.</p>
- <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag id=parsing-main-inhead:scripting-flag>scripting flag</a> is enabled<dt>A start tag whose tag name is one of: "noframes", "style"<dd>
- <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm id=parsing-main-inhead:generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
- <dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag id=parsing-main-inhead:scripting-flag-2>scripting flag</a> is disabled<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inhead:insert-an-html-element-3>Insert an HTML element</a> for the token.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inheadnoscript id=parsing-main-inhead:parsing-main-inheadnoscript>in
- head noscript</a>".</p>
- <dt id=scriptTag>A start tag whose tag name is "script"<dd>
- <p>Run these steps:</p>
- <ol><li><p>Let the <var>adjusted insertion location</var> be the <a href=#appropriate-place-for-inserting-a-node id=parsing-main-inhead:appropriate-place-for-inserting-a-node>appropriate place
- for inserting a node</a>.<li><p><a href=#create-an-element-for-the-token id=parsing-main-inhead:create-an-element-for-the-token>Create an element for the token</a> in the <a href=#html-namespace-2 id=parsing-main-inhead:html-namespace-2>HTML namespace</a>, with
- the intended parent being the element in which the <var>adjusted insertion
- location</var> finds itself.<li>
- <p>Mark the element as being <a href=#parser-inserted id=parsing-main-inhead:parser-inserted>"parser-inserted"</a> and unset the element's
- <a href=#force-async id=parsing-main-inhead:force-async>"force-async"</a> flag.</p>
- <p class=note>This ensures that, if the script is external, any <code id=parsing-main-inhead:dom-document-write><a href=#dom-document-write>document.write()</a></code> calls in the script will execute in-line,
- instead of blowing the document away, as would happen in most other cases. It also prevents
- the script from executing until the end tag is seen.</p>
- <li><p>If the parser was originally created for the <a href=#html-fragment-parsing-algorithm id=parsing-main-inhead:html-fragment-parsing-algorithm>HTML fragment parsing
- algorithm</a>, then mark the <code id=parsing-main-inhead:the-script-element><a href=#the-script-element>script</a></code> element as <a href=#already-started id=parsing-main-inhead:already-started>"already started"</a>.
- (<a href=#fragment-case id=parsing-main-inhead:fragment-case>fragment case</a>)<li><p>Insert the newly created element at the <var>adjusted insertion
- location</var>.<li><p>Push the element onto the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-3>stack of open elements</a> so that it is the new
- <a href=#current-node id=parsing-main-inhead:current-node-3>current node</a>.<li><p>Switch the tokenizer to the <a href=#script-data-state id=parsing-main-inhead:script-data-state>script data state</a>.<li><p>Let the <a href=#original-insertion-mode id=parsing-main-inhead:original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-4>insertion
- mode</a>.</p>
- <li><p>Switch the <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-incdata id=parsing-main-inhead:parsing-main-incdata>text</a>".</ol>
- <dt>An end tag whose tag name is "head"<dd>
- <p>Pop the <a href=#current-node id=parsing-main-inhead:current-node-4>current node</a> (which will be the <code id=parsing-main-inhead:the-head-element><a href=#the-head-element>head</a></code> element) off the
- <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-4>stack of open elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-6>insertion mode</a> to "<a href=#the-after-head-insertion-mode id=parsing-main-inhead:the-after-head-insertion-mode>after
- head</a>".</p>
- <dt>An end tag whose tag name is one of: "body", "html", "br"<dd>
- <p>Act as described in the "anything else" entry below.</p>
- <dt>A start tag whose tag name is "template"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inhead:insert-an-html-element-4>Insert an HTML element</a> for the token.</p>
- <p>Insert a <a href=#concept-parser-marker id=parsing-main-inhead:concept-parser-marker>marker</a> at the end of the <a href=#list-of-active-formatting-elements id=parsing-main-inhead:list-of-active-formatting-elements>list of
- active formatting elements</a>.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inhead:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-7>insertion mode</a> to "<a href=#parsing-main-intemplate id=parsing-main-inhead:parsing-main-intemplate>in
- template</a>".</p>
- <p>Push "<a href=#parsing-main-intemplate id=parsing-main-inhead:parsing-main-intemplate-2>in template</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-main-inhead:stack-of-template-insertion-modes>stack of
- template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-inhead:current-template-insertion-mode>current template insertion
- mode</a>.</p>
- <dt>An end tag whose tag name is "template"<dd>
- <p>If there is no <code id=parsing-main-inhead:the-template-element><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-5>stack of open elements</a>, then
- this is a <a href=#parse-error id=parsing-main-inhead:parse-error-2>parse error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-all-implied-end-tags-thoroughly id=parsing-main-inhead:generate-all-implied-end-tags-thoroughly>Generate all implied end tags thoroughly</a>.<li><p>If the <a href=#current-node id=parsing-main-inhead:current-node-5>current node</a> is not a <code id=parsing-main-inhead:the-template-element-2><a href=#the-template-element>template</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inhead:parse-error-3>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-6>stack of open elements</a> until a <code id=parsing-main-inhead:the-template-element-3><a href=#the-template-element>template</a></code>
- element has been popped from the stack.<li><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-inhead:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker</a>.<li><p>Pop the <a href=#current-template-insertion-mode id=parsing-main-inhead:current-template-insertion-mode-2>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-inhead:stack-of-template-insertion-modes-2>stack of template
- insertion modes</a>.</p>
- <li><p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inhead:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</ol>
- <dt>A start tag whose tag name is "head"<dt>Any other end tag<dd>
- <p><a href=#parse-error id=parsing-main-inhead:parse-error-4>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
-
-
- <p>Pop the <a href=#current-node id=parsing-main-inhead:current-node-6>current node</a> (which will be the <code id=parsing-main-inhead:the-head-element-2><a href=#the-head-element>head</a></code> element) off the
- <a href=#stack-of-open-elements id=parsing-main-inhead:stack-of-open-elements-7>stack of open elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inhead:insertion-mode-8>insertion mode</a> to "<a href=#the-after-head-insertion-mode id=parsing-main-inhead:the-after-head-insertion-mode-2>after
- head</a>".</p>
-
- <p>Reprocess the token.</p>
- </dl>
- <h6 id=parsing-main-inheadnoscript>12.2.5.4.5 The "<dfn>in head noscript</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inheadnoscript id=parsing-main-inheadnoscript:parsing-main-inheadnoscript>in head noscript</a>" <a href=#insertion-mode id=parsing-main-inheadnoscript:insertion-mode>insertion mode</a>, the user agent must handle the
- token as follows:</p>
- <dl class=switch><dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inheadnoscript:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-inheadnoscript:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-inheadnoscript:insertion-mode-2>insertion mode</a>.</p>
- <dt>An end tag whose tag name is "noscript"<dd>
- <p>Pop the <a href=#current-node id=parsing-main-inheadnoscript:current-node>current node</a> (which will be a <code id=parsing-main-inheadnoscript:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element) from the
- <a href=#stack-of-open-elements id=parsing-main-inheadnoscript:stack-of-open-elements>stack of open elements</a>; the new <a href=#current-node id=parsing-main-inheadnoscript:current-node-2>current node</a> will be a
- <code id=parsing-main-inheadnoscript:the-head-element><a href=#the-head-element>head</a></code> element.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inheadnoscript:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inhead id=parsing-main-inheadnoscript:parsing-main-inhead>in
- head</a>".</p>
- <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dt>A comment token<dt>A start tag whose tag name is one of: "basefont", "bgsound", "link", "meta", "noframes",
- "style"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inheadnoscript:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-inheadnoscript:parsing-main-inhead-2>in head</a>" <a href=#insertion-mode id=parsing-main-inheadnoscript:insertion-mode-4>insertion mode</a>.</p>
- <dt>An end tag whose tag name is "br"<dd>
- <p>Act as described in the "anything else" entry below.</p>
- <dt>A start tag whose tag name is one of: "head", "noscript"<dt>Any other end tag<dd>
- <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
-
- <p><a href=#parse-error id=parsing-main-inheadnoscript:parse-error-3>Parse error</a>.</p>
-
- <p>Pop the <a href=#current-node id=parsing-main-inheadnoscript:current-node-3>current node</a> (which will be a <code id=parsing-main-inheadnoscript:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code> element) from the
- <a href=#stack-of-open-elements id=parsing-main-inheadnoscript:stack-of-open-elements-2>stack of open elements</a>; the new <a href=#current-node id=parsing-main-inheadnoscript:current-node-4>current node</a> will be a
- <code id=parsing-main-inheadnoscript:the-head-element-2><a href=#the-head-element>head</a></code> element.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inheadnoscript:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-inhead id=parsing-main-inheadnoscript:parsing-main-inhead-3>in
- head</a>".</p>
-
- <p>Reprocess the token.</p>
- </dl>
- <h6 id=the-after-head-insertion-mode>12.2.5.4.6 The "<dfn>after head</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-after-head-insertion-mode id=the-after-head-insertion-mode:the-after-head-insertion-mode>after head</a>" <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER
- TABULATION, U+000A LINE FEED (LF), U+000C FORM FEED (FF),
- U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=the-after-head-insertion-mode:insert-a-character>Insert the character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-after-head-insertion-mode:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-after-head-insertion-mode:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=the-after-head-insertion-mode:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "body"<dd>
- <p><a href=#insert-an-html-element id=the-after-head-insertion-mode:insert-an-html-element>Insert an HTML element</a> for the token.</p>
- <p>Set the <a href=#frameset-ok-flag id=the-after-head-insertion-mode:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
- <p>Switch the <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inbody id=the-after-head-insertion-mode:parsing-main-inbody-2>in
- body</a>".</p>
- <dt>A start tag whose tag name is "frameset"<dd>
- <p><a href=#insert-an-html-element id=the-after-head-insertion-mode:insert-an-html-element-2>Insert an HTML element</a> for the token.</p>
- <p>Switch the <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-inframeset id=the-after-head-insertion-mode:parsing-main-inframeset>in
- frameset</a>".</p>
- <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
- "noframes", "script", "style", "template", "title"<dd>
- <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error-2>Parse error</a>.</p>
- <p>Push the node pointed to by the <a href=#head-element-pointer id=the-after-head-insertion-mode:head-element-pointer><code>head</code> element pointer</a> onto
- the <a href=#stack-of-open-elements id=the-after-head-insertion-mode:stack-of-open-elements>stack of open elements</a>.</p>
- <p>Process the token <a href=#using-the-rules-for id=the-after-head-insertion-mode:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=the-after-head-insertion-mode:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-5>insertion mode</a>.</p>
- <p>Remove the node pointed to by the <a href=#head-element-pointer id=the-after-head-insertion-mode:head-element-pointer-2><code>head</code> element pointer</a>
- from the <a href=#stack-of-open-elements id=the-after-head-insertion-mode:stack-of-open-elements-2>stack of open elements</a>. (It might not be the <a href=#current-node id=the-after-head-insertion-mode:current-node>current node</a> at
- this point.)</p>
- <p class=note>The <a href=#head-element-pointer id=the-after-head-insertion-mode:head-element-pointer-3><code>head</code> element pointer</a> cannot be null at
- this point.</p>
- <dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-after-head-insertion-mode:using-the-rules-for-3>using the rules for</a> the "<a href=#parsing-main-inhead id=the-after-head-insertion-mode:parsing-main-inhead-2>in head</a>" <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-6>insertion mode</a>.</p>
- <dt>An end tag whose tag name is one of: "body", "html", "br"<dd>
- <p>Act as described in the "anything else" entry below.</p>
- <dt>A start tag whose tag name is "head"<dt>Any other end tag<dd>
- <p><a href=#parse-error id=the-after-head-insertion-mode:parse-error-3>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
-
- <p><a href=#insert-an-html-element id=the-after-head-insertion-mode:insert-an-html-element-3>Insert an HTML element</a> for a "body" start tag token with no attributes.</p>
- <p>Switch the <a href=#insertion-mode id=the-after-head-insertion-mode:insertion-mode-7>insertion mode</a> to "<a href=#parsing-main-inbody id=the-after-head-insertion-mode:parsing-main-inbody-3>in
- body</a>".</p>
-
- <p>Reprocess the current token.</p>
- </dl>
- <h6 id=parsing-main-inbody>12.2.5.4.7 The "<dfn>in body</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inbody id=parsing-main-inbody:parsing-main-inbody>in
- body</a>" <a href=#insertion-mode id=parsing-main-inbody:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is U+0000 NULL<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error>Parse error</a>. Ignore the token.</p>
-
- <dt>A character token that is one of U+0009 CHARACTER TABULATION,
- U+000A LINE FEED (LF), U+000C FORM FEED (FF), U+000D CARRIAGE
- RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character>Insert the token's character</a>.</p>
- <dt>Any other character token<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-2>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character-2>Insert the token's character</a>.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-inbody:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-3>Parse error</a>.</p>
- <p>If there is a <code id=parsing-main-inbody:the-template-element><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements>stack of open elements</a>, then
- ignore the token.</p>
- <p>Otherwise, for each attribute on the token, check to see if the attribute is already present
- on the top element of the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-2>stack of open elements</a>. If it is not, add the attribute
- and its corresponding value to that element.</p>
- <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta",
- "noframes", "script", "style", "template", "title"<dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inbody:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-inbody:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "body"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-4>Parse error</a>.</p>
- <p>If the second element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-3>stack of open elements</a> is not a <code id=parsing-main-inbody:the-body-element><a href=#the-body-element>body</a></code>
- element, if the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-4>stack of open elements</a> has only one node on it, or if there is a
- <code id=parsing-main-inbody:the-template-element-2><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-5>stack of open elements</a>, then ignore the token.
- (<a href=#fragment-case id=parsing-main-inbody:fragment-case>fragment case</a>)</p>
- <p>Otherwise, set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-2>frameset-ok flag</a> to "not ok"; then, for each attribute on the
- token, check to see if the attribute is already present on the <code id=parsing-main-inbody:the-body-element-2><a href=#the-body-element>body</a></code> element (the
- second element) on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-6>stack of open elements</a>, and if it is not, add the attribute
- and its corresponding value to that element.</p>
- <dt>A start tag whose tag name is "frameset"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-5>Parse error</a>.</p>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-7>stack of open elements</a> has only one node on it, or if the second element
- on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-8>stack of open elements</a> is not a <code id=parsing-main-inbody:the-body-element-3><a href=#the-body-element>body</a></code> element, then ignore the
- token. (<a href=#fragment-case id=parsing-main-inbody:fragment-case-2>fragment case</a>)</p>
- <p>If the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-3>frameset-ok flag</a> is set to "not ok", ignore the token.</p>
- <p>Otherwise, run the following steps:</p>
- <ol><li><p>Remove the second element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-9>stack of open elements</a> from its parent
- node, if it has one.<li><p>Pop all the nodes from the bottom of the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-10>stack of open elements</a>, from the
- <a href=#current-node id=parsing-main-inbody:current-node>current node</a> up to, but not including, the root <code id=parsing-main-inbody:the-html-element><a href=#the-html-element>html</a></code> element.</p>
- <li><p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element>Insert an HTML element</a> for the token.<li><p>Switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inframeset id=parsing-main-inbody:parsing-main-inframeset>in
- frameset</a>".</p>
- </ol>
- <dt>An end-of-file token<dd>
- <p>If the <a href=#stack-of-template-insertion-modes id=parsing-main-inbody:stack-of-template-insertion-modes>stack of template insertion modes</a> is not empty, then process the token
- <a href=#using-the-rules-for id=parsing-main-inbody:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-intemplate id=parsing-main-inbody:parsing-main-intemplate>in
- template</a>" <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-4>insertion mode</a>.</p>
-
- <p>Otherwise, follow these steps:</p>
- <ol><li><p>If there is a node in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-11>stack of open elements</a> that is not either a
- <code id=parsing-main-inbody:the-dd-element><a href=#the-dd-element>dd</a></code> element, a <code id=parsing-main-inbody:the-dt-element><a href=#the-dt-element>dt</a></code> element, an <code id=parsing-main-inbody:the-li-element><a href=#the-li-element>li</a></code> element, an
- <code id=parsing-main-inbody:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element, an <code id=parsing-main-inbody:the-option-element><a href=#the-option-element>option</a></code> element, a <code id=parsing-main-inbody:the-p-element><a href=#the-p-element>p</a></code> element, an
- <code id=parsing-main-inbody:the-rp-element><a href=#the-rp-element>rp</a></code> element, an <code id=parsing-main-inbody:the-rt-element><a href=#the-rt-element>rt</a></code> element, a <code id=parsing-main-inbody:the-tbody-element><a href=#the-tbody-element>tbody</a></code> element, a
- <code id=parsing-main-inbody:the-td-element><a href=#the-td-element>td</a></code> element, a <code id=parsing-main-inbody:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> element, a <code id=parsing-main-inbody:the-th-element><a href=#the-th-element>th</a></code> element, a
- <code id=parsing-main-inbody:the-thead-element><a href=#the-thead-element>thead</a></code> element, a <code id=parsing-main-inbody:the-tr-element><a href=#the-tr-element>tr</a></code> element, the <code id=parsing-main-inbody:the-body-element-4><a href=#the-body-element>body</a></code> element, or the
- <code id=parsing-main-inbody:the-html-element-2><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-6>parse error</a>.<li><p><a href=#stop-parsing id=parsing-main-inbody:stop-parsing>Stop parsing</a>.</ol>
- <dt>An end tag whose tag name is "body"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-12>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope>have a <code>body</code> element in scope</a>, this is a <a href=#parse-error id=parsing-main-inbody:parse-error-7>parse error</a>;
- ignore the token.</p>
-
- <p>Otherwise, if there is a node in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-13>stack of open elements</a> that is not either a
- <code id=parsing-main-inbody:the-dd-element-2><a href=#the-dd-element>dd</a></code> element, a <code id=parsing-main-inbody:the-dt-element-2><a href=#the-dt-element>dt</a></code> element, an <code id=parsing-main-inbody:the-li-element-2><a href=#the-li-element>li</a></code> element, an
- <code id=parsing-main-inbody:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element, an <code id=parsing-main-inbody:the-option-element-2><a href=#the-option-element>option</a></code> element, a <code id=parsing-main-inbody:the-p-element-2><a href=#the-p-element>p</a></code> element, an
- <code id=parsing-main-inbody:the-rp-element-2><a href=#the-rp-element>rp</a></code> element, an <code id=parsing-main-inbody:the-rt-element-2><a href=#the-rt-element>rt</a></code> element, a <code id=parsing-main-inbody:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> element, a
- <code id=parsing-main-inbody:the-td-element-2><a href=#the-td-element>td</a></code> element, a <code id=parsing-main-inbody:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> element, a <code id=parsing-main-inbody:the-th-element-2><a href=#the-th-element>th</a></code> element, a
- <code id=parsing-main-inbody:the-thead-element-2><a href=#the-thead-element>thead</a></code> element, a <code id=parsing-main-inbody:the-tr-element-2><a href=#the-tr-element>tr</a></code> element, the <code id=parsing-main-inbody:the-body-element-5><a href=#the-body-element>body</a></code> element, or the
- <code id=parsing-main-inbody:the-html-element-3><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-8>parse error</a>.</p>
-
- <p>Switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-afterbody id=parsing-main-inbody:parsing-main-afterbody>after
- body</a>".</p>
- <dt>An end tag whose tag name is "html"<dd>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-14>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-2>have a <code>body</code> element in scope</a>, this is a <a href=#parse-error id=parsing-main-inbody:parse-error-9>parse error</a>;
- ignore the token.</p>
-
- <p>Otherwise, if there is a node in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-15>stack of open elements</a> that is not either a
- <code id=parsing-main-inbody:the-dd-element-3><a href=#the-dd-element>dd</a></code> element, a <code id=parsing-main-inbody:the-dt-element-3><a href=#the-dt-element>dt</a></code> element, an <code id=parsing-main-inbody:the-li-element-3><a href=#the-li-element>li</a></code> element, an
- <code id=parsing-main-inbody:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element, an <code id=parsing-main-inbody:the-option-element-3><a href=#the-option-element>option</a></code> element, a <code id=parsing-main-inbody:the-p-element-3><a href=#the-p-element>p</a></code> element, an
- <code id=parsing-main-inbody:the-rp-element-3><a href=#the-rp-element>rp</a></code> element, an <code id=parsing-main-inbody:the-rt-element-3><a href=#the-rt-element>rt</a></code> element, a <code id=parsing-main-inbody:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code> element, a
- <code id=parsing-main-inbody:the-td-element-3><a href=#the-td-element>td</a></code> element, a <code id=parsing-main-inbody:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> element, a <code id=parsing-main-inbody:the-th-element-3><a href=#the-th-element>th</a></code> element, a
- <code id=parsing-main-inbody:the-thead-element-3><a href=#the-thead-element>thead</a></code> element, a <code id=parsing-main-inbody:the-tr-element-3><a href=#the-tr-element>tr</a></code> element, the <code id=parsing-main-inbody:the-body-element-6><a href=#the-body-element>body</a></code> element, or the
- <code id=parsing-main-inbody:the-html-element-4><a href=#the-html-element>html</a></code> element, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-10>parse error</a>.</p>
-
- <p>Switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-6>insertion mode</a> to "<a href=#parsing-main-afterbody id=parsing-main-inbody:parsing-main-afterbody-2>after
- body</a>".</p>
-
- <p>Reprocess the token.</p>
- <dt>A start tag whose tag name is one of: "address", "article", "aside", "blockquote", "center",
- "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer", "header",
- "hgroup", "main", "menu", "nav", "ol", "p", "section", "summary", "ul"<dd>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-16>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-2>Insert an HTML element</a> for the token.</p>
- <dt>A start tag whose tag name is one of: "h1", "h2", "h3", "h4",
- "h5", "h6"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-17>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-2>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-2>close a <code>p</code>
- element</a>.</p>
- <p>If the <a href=#current-node id=parsing-main-inbody:current-node-2>current node</a> is an <a href=#html-elements id=parsing-main-inbody:html-elements>HTML element</a> whose
- tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-11>parse
- error</a>; pop the <a href=#current-node id=parsing-main-inbody:current-node-3>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-18>stack of open elements</a>.</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-3>Insert an HTML element</a> for the token.</p>
- <dt>A start tag whose tag name is one of: "pre", "listing"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-19>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-3>has
- a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-3>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-4>Insert an HTML element</a> for the token.</p>
- <p>If the <a href=#next-token id=parsing-main-inbody:next-token>next token</a> is a U+000A LINE FEED (LF) character token, then ignore that
- token and move on to the next one. (Newlines at the start of <code id=parsing-main-inbody:the-pre-element><a href=#the-pre-element>pre</a></code> blocks are ignored
- as an authoring convenience.)</p>
-
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-4>frameset-ok flag</a> to "not ok".</p>
- <dt>A start tag whose tag name is "form"<dd>
- <p>If the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer><code>form</code> element pointer</a> is not null, and there is
- no <code id=parsing-main-inbody:the-template-element-3><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-20>stack of open elements</a>, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-12>parse error</a>; ignore the token.</p>
- <p>Otherwise:</p>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-21>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-4>has
- a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-4>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-5>Insert an HTML element</a> for the token, and, if there is no <code id=parsing-main-inbody:the-template-element-4><a href=#the-template-element>template</a></code>
- element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-22>stack of open elements</a>, set the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-2><code>form</code> element pointer</a> to point to the element created.</p>
- <dt>A start tag whose tag name is "li"<dd>
- <p>Run these steps:</p>
- <ol><li><p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-5>frameset-ok flag</a> to "not ok".<li><p>Initialise <var>node</var> to be the <a href=#current-node id=parsing-main-inbody:current-node-4>current
- node</a> (the bottommost node of the stack).<li>
- <p><i>Loop</i>: If <var>node</var> is an <code id=parsing-main-inbody:the-li-element-4><a href=#the-li-element>li</a></code> element, then run these
- substeps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags>Generate implied end tags</a>, except for <code id=parsing-main-inbody:the-li-element-5><a href=#the-li-element>li</a></code> elements.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-5>current node</a> is not an <code id=parsing-main-inbody:the-li-element-6><a href=#the-li-element>li</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-13>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-23>stack of open elements</a> until an <code id=parsing-main-inbody:the-li-element-7><a href=#the-li-element>li</a></code>
- element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
- <li><p>If <var>node</var> is in the <a href=#special id=parsing-main-inbody:special>special</a> category, but is not an
- <code id=parsing-main-inbody:the-address-element><a href=#the-address-element>address</a></code>, <code id=parsing-main-inbody:the-div-element><a href=#the-div-element>div</a></code>, or <code id=parsing-main-inbody:the-p-element-4><a href=#the-p-element>p</a></code> element, then jump to the step
- labeled <i>done</i> below.<li><p>Otherwise, set <var>node</var> to the previous entry in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-24>stack of open
- elements</a> and return to the step labeled <i>loop</i>.<li><p><i>Done</i>: If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-25>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-5>has a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-5>close a
- <code>p</code> element</a>.<li><p>Finally, <a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-6>insert an HTML element</a> for the token.</ol>
- <dt>A start tag whose tag name is one of: "dd", "dt"<dd>
- <p>Run these steps:</p>
- <ol><li><p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-6>frameset-ok flag</a> to "not ok".<li><p>Initialise <var>node</var> to be the <a href=#current-node id=parsing-main-inbody:current-node-6>current
- node</a> (the bottommost node of the stack).<li>
- <p><i>Loop</i>: If <var>node</var> is a <code id=parsing-main-inbody:the-dd-element-4><a href=#the-dd-element>dd</a></code> element, then run these
- substeps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-2>Generate implied end tags</a>, except for <code id=parsing-main-inbody:the-dd-element-5><a href=#the-dd-element>dd</a></code> elements.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-7>current node</a> is not a <code id=parsing-main-inbody:the-dd-element-6><a href=#the-dd-element>dd</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-14>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-26>stack of open elements</a> until a <code id=parsing-main-inbody:the-dd-element-7><a href=#the-dd-element>dd</a></code>
- element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
- <li>
- <p>If <var>node</var> is a <code id=parsing-main-inbody:the-dt-element-4><a href=#the-dt-element>dt</a></code> element, then run these substeps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-3>Generate implied end tags</a>, except for <code id=parsing-main-inbody:the-dt-element-5><a href=#the-dt-element>dt</a></code> elements.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-8>current node</a> is not a <code id=parsing-main-inbody:the-dt-element-6><a href=#the-dt-element>dt</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-15>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-27>stack of open elements</a> until a <code id=parsing-main-inbody:the-dt-element-7><a href=#the-dt-element>dt</a></code>
- element has been popped from the stack.<li><p>Jump to the step labeled <i>done</i> below.</ol>
- <li><p>If <var>node</var> is in the <a href=#special id=parsing-main-inbody:special-2>special</a> category, but is not an
- <code id=parsing-main-inbody:the-address-element-2><a href=#the-address-element>address</a></code>, <code id=parsing-main-inbody:the-div-element-2><a href=#the-div-element>div</a></code>, or <code id=parsing-main-inbody:the-p-element-5><a href=#the-p-element>p</a></code> element, then jump to the step
- labeled <i>done</i> below.<li><p>Otherwise, set <var>node</var> to the previous entry in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-28>stack of open
- elements</a> and return to the step labeled <i>loop</i>.<li><p><i>Done</i>: If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-29>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-6>has a <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-6>close a
- <code>p</code> element</a>.<li><p>Finally, <a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-7>insert an HTML element</a> for the token.</ol>
- <dt>A start tag whose tag name is "plaintext"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-30>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-7>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-7>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-8>Insert an HTML element</a> for the token.</p>
- <p>Switch the tokenizer to the <a href=#plaintext-state id=parsing-main-inbody:plaintext-state>PLAINTEXT state</a>.</p>
- <p class=note>Once a start tag with the tag name "plaintext" has been seen, that will be the
- last token ever seen other than character tokens (and the end-of-file token), because there is
- no way to switch out of the <a href=#plaintext-state id=parsing-main-inbody:plaintext-state-2>PLAINTEXT state</a>.</p>
- <dt>A start tag whose tag name is "button"<dd>
- <ol><li>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-31>stack of open elements</a> <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-3>has a
- <code>button</code> element in scope</a>, then run these substeps:</p>
- <ol><li><p><a href=#parse-error id=parsing-main-inbody:parse-error-16>Parse error</a>.<li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-4>Generate implied end tags</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-32>stack of open elements</a> until a <code id=parsing-main-inbody:the-button-element><a href=#the-button-element>button</a></code>
- element has been popped from the stack.</ol>
- <li><p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-3>Reconstruct the active formatting elements</a>, if any.<li><p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-9>Insert an HTML element</a> for the token.<li><p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-7>frameset-ok flag</a> to "not ok".</ol>
- <dt>An end tag whose tag name is one of: "address", "article", "aside", "blockquote", "button",
- "center", "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", "footer",
- "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", "section", "summary",
- "ul"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-33>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-4>have an element in scope</a> that is an <a href=#html-elements id=parsing-main-inbody:html-elements-2>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-17>parse
- error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-5>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-9>current node</a> is not an <a href=#html-elements id=parsing-main-inbody:html-elements-3>HTML element</a> with
- the same tag name as that of the token, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-18>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-34>stack of open elements</a> until an <a href=#html-elements id=parsing-main-inbody:html-elements-4>HTML element</a> with the same tag name as the token has been popped from the
- stack.</ol>
- <dt>An end tag whose tag name is "form"<dd>
- <p>If there is no <code id=parsing-main-inbody:the-template-element-5><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-35>stack of open elements</a>, then
- run these substeps:</p>
- <ol><li><p>Let <var>node</var> be the element that the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-3><code>form</code>
- element pointer</a> is set to, or null if it is not set to an element.<li><p>Set the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-4><code>form</code> element pointer</a> to null.<li><p>If <var>node</var> is null or if the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-36>stack of open elements</a> does
- not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-5>have <var>node</var> in scope</a>, then
- this is a <a href=#parse-error id=parsing-main-inbody:parse-error-19>parse error</a>; abort these steps and ignore the token.<li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-6>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-10>current node</a> is not <var>node</var>, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-20>parse error</a>.<li><p>Remove <var>node</var> from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-37>stack of open elements</a>.</ol>
- <p>If there <em>is</em> a <code id=parsing-main-inbody:the-template-element-6><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-38>stack of open
- elements</a>, then run these substeps instead:</p>
- <ol><li><p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-39>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-6>have a <code>form</code> element in scope</a>, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-21>parse
- error</a>; abort these steps and ignore the token.<li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-7>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-11>current node</a> is not a <code id=parsing-main-inbody:the-form-element><a href=#the-form-element>form</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-22>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-40>stack of open elements</a> until a <code id=parsing-main-inbody:the-form-element-2><a href=#the-form-element>form</a></code>
- element has been popped from the stack.</ol>
- <dt>An end tag whose tag name is "p"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-41>stack of open elements</a> does not <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-8>have a <code>p</code> element in button scope</a>, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-23>parse
- error</a>; <a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-10>insert an HTML element</a> for a "p" start tag token with no
- attributes.</p>
- <p><a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-8>Close a <code>p</code> element</a>.</p>
- <dt>An end tag whose tag name is "li"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-42>stack of open elements</a> does not <a href=#has-an-element-in-list-item-scope id=parsing-main-inbody:has-an-element-in-list-item-scope>have an <code>li</code> element in list item scope</a>, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-24>parse
- error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-8>Generate implied end tags</a>, except for <code id=parsing-main-inbody:the-li-element-8><a href=#the-li-element>li</a></code> elements.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-12>current node</a> is not an <code id=parsing-main-inbody:the-li-element-9><a href=#the-li-element>li</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-25>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-43>stack of open elements</a> until an <code id=parsing-main-inbody:the-li-element-10><a href=#the-li-element>li</a></code>
- element has been popped from the stack.</ol>
- <dt>An end tag whose tag name is one of: "dd", "dt"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-44>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-7>have an element in scope</a> that is an <a href=#html-elements id=parsing-main-inbody:html-elements-5>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-26>parse
- error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-9>Generate implied end tags</a>, except for <a href=#html-elements id=parsing-main-inbody:html-elements-6>HTML elements</a> with the
- same tag name as the token.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-13>current node</a> is not an <a href=#html-elements id=parsing-main-inbody:html-elements-7>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-27>parse
- error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-45>stack of open elements</a> until an <a href=#html-elements id=parsing-main-inbody:html-elements-8>HTML element</a> with the same tag name as the token has been popped from the
- stack.</ol>
- <dt>An end tag whose tag name is one of: "h1", "h2", "h3", "h4", "h5", "h6"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-46>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-8>have an element in scope</a> that is an <a href=#html-elements id=parsing-main-inbody:html-elements-9>HTML
- element</a> and whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6", then this is
- a <a href=#parse-error id=parsing-main-inbody:parse-error-28>parse error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-10>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-14>current node</a> is not an <a href=#html-elements id=parsing-main-inbody:html-elements-10>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-29>parse
- error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-47>stack of open elements</a> until an <a href=#html-elements id=parsing-main-inbody:html-elements-11>HTML element</a> whose tag name is one of "h1", "h2", "h3", "h4", "h5", or "h6"
- has been popped from the stack.</ol>
- <dt>An end tag whose tag name is "sarcasm"<dd>
- <p>Take a deep breath, then act as described in the "any other end
- tag" entry below.</p>
- <dt>A start tag whose tag name is "a"<dd>
- <p>If the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements>list of active formatting elements</a> contains an <code id=parsing-main-inbody:the-a-element><a href=#the-a-element>a</a></code> element
- between the end of the list and the last <a href=#concept-parser-marker id=parsing-main-inbody:concept-parser-marker>marker</a> on
- the list (or the start of the list if there is no <a href=#concept-parser-marker id=parsing-main-inbody:concept-parser-marker-2>marker</a> on the list), then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-30>parse
- error</a>; run the <a href=#adoption-agency-algorithm id=parsing-main-inbody:adoption-agency-algorithm>adoption agency algorithm</a> for the tag name "a", then remove
- that element from the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-2>list of active formatting elements</a> and the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-48>stack of
- open elements</a> if the <a href=#adoption-agency-algorithm id=parsing-main-inbody:adoption-agency-algorithm-2>adoption agency algorithm</a> didn't already remove it (it
- might not have if the element is not <a href=#has-an-element-in-table-scope id=parsing-main-inbody:has-an-element-in-table-scope>in table
- scope</a>).</p>
- <p class=example>In the non-conforming stream
- <code><a href="a">a<table><a href="b">b</table>x</code>, the first
- <code id=parsing-main-inbody:the-a-element-2><a href=#the-a-element>a</a></code> element would be closed upon seeing the second one, and the "x" character would
- be inside a link to "b", not to "a". This is despite the fact that the outer <code id=parsing-main-inbody:the-a-element-3><a href=#the-a-element>a</a></code>
- element is not in table scope (meaning that a regular <code></a></code> end tag at the start
- of the table wouldn't close the outer <code id=parsing-main-inbody:the-a-element-4><a href=#the-a-element>a</a></code> element). The result is that the two
- <code id=parsing-main-inbody:the-a-element-5><a href=#the-a-element>a</a></code> elements are indirectly nested inside each other — non-conforming markup
- will often result in non-conforming DOMs when parsed.</p>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-4>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-11>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements id=parsing-main-inbody:push-onto-the-list-of-active-formatting-elements>Push onto the list of active
- formatting elements</a> that element.</p>
- <dt>A start tag whose tag name is one of: "b", "big", "code", "em",
- "font", "i", "s", "small", "strike", "strong", "tt", "u"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-5>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-12>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements id=parsing-main-inbody:push-onto-the-list-of-active-formatting-elements-2>Push onto the list of active
- formatting elements</a> that element.</p>
- <dt>A start tag whose tag name is "nobr"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-6>Reconstruct the active formatting elements</a>, if any.</p>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-49>stack of open elements</a> <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-9>has a
- <code>nobr</code> element in scope</a>, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-31>parse error</a>; run the
- <a href=#adoption-agency-algorithm id=parsing-main-inbody:adoption-agency-algorithm-3>adoption agency algorithm</a> for the tag name "nobr", then once again
- <a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-7>reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-13>Insert an HTML element</a> for the token. <a href=#push-onto-the-list-of-active-formatting-elements id=parsing-main-inbody:push-onto-the-list-of-active-formatting-elements-3>Push onto the list of active
- formatting elements</a> that element.</p>
- <dt>An end tag whose tag name is one of: "a",
- "b", "big", "code", "em", "font", "i", "nobr", "s", "small",
- "strike", "strong", "tt", "u"<dd>
- <p>Run the <a href=#adoption-agency-algorithm id=parsing-main-inbody:adoption-agency-algorithm-4>adoption agency algorithm</a> for the token's tag name.</p>
- <dt>A start tag whose tag name is one of: "applet", "marquee", "object"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-8>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-14>Insert an HTML element</a> for the token.</p>
- <p>Insert a <a href=#concept-parser-marker id=parsing-main-inbody:concept-parser-marker-3>marker</a> at the end of the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-3>list of
- active formatting elements</a>.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-8>frameset-ok flag</a> to "not ok".</p>
- <dt>An end tag token whose tag name is one of: "applet", "marquee", "object"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-50>stack of open elements</a> does not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-10>have an element in scope</a> that is an <a href=#html-elements id=parsing-main-inbody:html-elements-12>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-32>parse
- error</a>; ignore the token.</p>
- <p>Otherwise, run these steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-11>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-15>current node</a> is not an <a href=#html-elements id=parsing-main-inbody:html-elements-13>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-33>parse
- error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-51>stack of open elements</a> until an <a href=#html-elements id=parsing-main-inbody:html-elements-14>HTML element</a> with the same tag name as the token has been popped from the
- stack.<li><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-inbody:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker</a>.</ol>
- <dt>A start tag whose tag name is "table"<dd>
- <p>If the <code id=parsing-main-inbody:document><a href=#document>Document</a></code> is <em>not</em> set to <a href=#quirks-mode id=parsing-main-inbody:quirks-mode>quirks mode</a>, and the
- <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-52>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-9>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-9>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-15>Insert an HTML element</a> for the token.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-9>frameset-ok flag</a> to "not ok".</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-7>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-inbody:parsing-main-intable>in
- table</a>".</p>
- <dt>An end tag whose tag name is "br"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-34>Parse error</a>. Drop the attributes from the token, and act as described in the
- next entry; i.e. act as if this was a "br" start tag token with no attributes, rather than the
- end tag token that it actually is.</p>
- <dt>A start tag whose tag name is one of: "area", "br", "embed",
- "img", "keygen", "wbr"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-9>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-16>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-16>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-53>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-10>frameset-ok flag</a> to "not ok".</p>
-
- <dt>A start tag whose tag name is "input"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-10>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-17>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-17>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-54>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-2>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <p>If the token does not have an attribute with the name "type", or if it does, but that
- attribute's value is not an <a href=#ascii-case-insensitive id=parsing-main-inbody:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>hidden</code>", then: set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-11>frameset-ok flag</a> to "not ok".</p>
- <dt>A start tag whose tag name is one of: "menuitem", "param", "source", "track"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-18>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-18>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-55>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-3>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <dt>A start tag whose tag name is "hr"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-56>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-10>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-10>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-19>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-19>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-57>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-4>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-12>frameset-ok flag</a> to "not ok".</p>
- <dt>A start tag whose tag name is "image"<dd>
-
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-35>Parse error</a>. Change the token's tag name to "img" and reprocess it. (Don't
- ask.)</p>
- <dt id=isindex>A start tag whose tag name is "isindex"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-36>Parse error</a>.</p>
- <p>If there is no <code id=parsing-main-inbody:the-template-element-7><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-58>stack of open elements</a> and
- the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-5><code>form</code> element pointer</a> is not null, then ignore the
- token.</p>
- <p>Otherwise:</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-5>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-13>frameset-ok flag</a> to "not ok".</p>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-59>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-11>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-11>close a <code>p</code>
- element</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-20>Insert an HTML element</a> for a "form" start tag token with no attributes, and, if
- there is no <code id=parsing-main-inbody:the-template-element-8><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-60>stack of open elements</a>, set the
- <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-6><code>form</code> element pointer</a> to point to the element
- created.</p>
- <p>If the token has an attribute called "action", set the <code id=parsing-main-inbody:attr-fs-action><a href=#attr-fs-action>action</a></code> attribute on the resulting <code id=parsing-main-inbody:the-form-element-3><a href=#the-form-element>form</a></code> element to the
- value of the "action" attribute of the token.</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-21>Insert an HTML element</a> for an "hr" start tag token with no attributes.
- Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-20>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-61>stack of open elements</a>.</p>
-
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-11>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-22>Insert an HTML element</a> for a "label" start tag token with no attributes.</p>
-
- <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character-3>Insert characters</a> (see below for <a href=#attr-isindex-prompt id=parsing-main-inbody:attr-isindex-prompt>what they should say</a>).</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-23>Insert an HTML element</a> for an "input" start tag token with all the attributes
- from the "isindex" token except "name", "action", and "prompt", and with an attribute named
- "name" with the value "isindex". (This creates an <code id=parsing-main-inbody:the-input-element><a href=#the-input-element>input</a></code> element with the <code id=parsing-main-inbody:attr-fe-name><a href=#attr-fe-name>name</a></code> attribute set to the magic value "<code id=parsing-main-inbody:attr-fe-name-isindex><a href=#attr-fe-name-isindex>isindex</a></code>".) Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-21>current node</a> off
- the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-62>stack of open elements</a>.</p>
-
- <p><a href=#insert-a-character id=parsing-main-inbody:insert-a-character-4>Insert more characters</a> (see below for <a href=#attr-isindex-prompt id=parsing-main-inbody:attr-isindex-prompt-2>what they should say</a>).</p>
-
- <p>Pop the <a href=#current-node id=parsing-main-inbody:current-node-22>current node</a> (which will be the <code id=parsing-main-inbody:the-label-element><a href=#the-label-element>label</a></code> element created
- earlier) off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-63>stack of open elements</a>.</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-24>Insert an HTML element</a> for an "hr" start tag token with no attributes.
- Immediately pop the <a href=#current-node id=parsing-main-inbody:current-node-23>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-64>stack of open elements</a>.</p>
-
- <p>Pop the <a href=#current-node id=parsing-main-inbody:current-node-24>current node</a> (which will be the <code id=parsing-main-inbody:the-form-element-4><a href=#the-form-element>form</a></code> element created
- earlier) off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-65>stack of open elements</a>, and, if there is no <code id=parsing-main-inbody:the-template-element-9><a href=#the-template-element>template</a></code>
- element on the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-66>stack of open elements</a>, set the <a href=#form-element-pointer id=parsing-main-inbody:form-element-pointer-7><code>form</code> element pointer</a> back to null.</p>
-
- <p><dfn id=attr-isindex-prompt><strong>Prompt</strong></dfn>: If the token has an attribute
- with the name "prompt", then the first stream of characters must be the same string as given in
- that attribute, and the second stream of characters must be empty. Otherwise, the two streams of
- character tokens together should, together with the <code id=parsing-main-inbody:the-input-element-2><a href=#the-input-element>input</a></code> element, express the
- equivalent of "This is a searchable index. Enter search keywords: (input field)" in the user's
- preferred language.</p>
- <dt>A start tag whose tag name is "textarea"<dd>
- <p>Run these steps:</p>
- <ol><li><p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-25>Insert an HTML element</a> for the token.<li><p>If the <a href=#next-token id=parsing-main-inbody:next-token-2>next token</a> is a U+000A LINE FEED (LF) character token, then ignore
- that token and move on to the next one. (Newlines at the start of <code id=parsing-main-inbody:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
- elements are ignored as an authoring convenience.)<li><p>Switch the tokenizer to the <a href=#rcdata-state id=parsing-main-inbody:rcdata-state>RCDATA state</a>.<li><p>Let the <a href=#original-insertion-mode id=parsing-main-inbody:original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-8>insertion
- mode</a>.</p>
- <li><p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-14>frameset-ok flag</a> to "not ok".<li><p>Switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-9>insertion mode</a> to "<a href=#parsing-main-incdata id=parsing-main-inbody:parsing-main-incdata>text</a>".</ol>
- <dt>A start tag whose tag name is "xmp"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-67>stack of open elements</a> <a href=#has-an-element-in-button-scope id=parsing-main-inbody:has-an-element-in-button-scope-12>has a
- <code>p</code> element in button scope</a>, then <a href=#close-a-p-element id=parsing-main-inbody:close-a-p-element-12>close a <code>p</code>
- element</a>.</p>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-12>Reconstruct the active formatting elements</a>, if any.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-15>frameset-ok flag</a> to "not ok".</p>
- <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm id=parsing-main-inbody:generic-raw-text-element-parsing-algorithm>generic raw text element parsing algorithm</a>.</p>
- <dt>A start tag whose tag name is "iframe"<dd>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-16>frameset-ok flag</a> to "not ok".</p>
- <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm id=parsing-main-inbody:generic-raw-text-element-parsing-algorithm-2>generic raw text element parsing algorithm</a>.</p>
- <dt>A start tag whose tag name is "noembed"<dt>A start tag whose tag name is "noscript", if the <a href=#scripting-flag id=parsing-main-inbody:scripting-flag>scripting flag</a> is enabled<dd>
- <p>Follow the <a href=#generic-raw-text-element-parsing-algorithm id=parsing-main-inbody:generic-raw-text-element-parsing-algorithm-3>generic raw text element parsing algorithm</a>.</p>
- <dt>A start tag whose tag name is "select"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-13>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-26>Insert an HTML element</a> for the token.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inbody:frameset-ok-flag-17>frameset-ok flag</a> to "not ok".</p>
- <p>If the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-10>insertion mode</a> is one of "<a href=#parsing-main-intable id=parsing-main-inbody:parsing-main-intable-2>in
- table</a>", "<a href=#parsing-main-incaption id=parsing-main-inbody:parsing-main-incaption>in caption</a>", "<a href=#parsing-main-intbody id=parsing-main-inbody:parsing-main-intbody>in table body</a>", "<a href=#parsing-main-intr id=parsing-main-inbody:parsing-main-intr>in row</a>", or "<a href=#parsing-main-intd id=parsing-main-inbody:parsing-main-intd>in cell</a>", then switch the
- <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-11>insertion mode</a> to "<a href=#parsing-main-inselectintable id=parsing-main-inbody:parsing-main-inselectintable>in select in
- table</a>". Otherwise, switch the <a href=#insertion-mode id=parsing-main-inbody:insertion-mode-12>insertion mode</a> to "<a href=#parsing-main-inselect id=parsing-main-inbody:parsing-main-inselect>in select</a>".</p>
- <dt>A start tag whose tag name is one of: "optgroup", "option"<dd>
- <p>If the <a href=#current-node id=parsing-main-inbody:current-node-25>current node</a> is an <code id=parsing-main-inbody:the-option-element-4><a href=#the-option-element>option</a></code> element, then pop the
- <a href=#current-node id=parsing-main-inbody:current-node-26>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-68>stack of open elements</a>.</p>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-14>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-27>Insert an HTML element</a> for the token.</p>
- <dt>A start tag whose tag name is one of: "rp", "rt"<dd>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-69>stack of open elements</a> <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-11>has a
- <code>ruby</code> element in scope</a>, then <a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-12>generate implied end tags</a>. If the
- <a href=#current-node id=parsing-main-inbody:current-node-27>current node</a> is not then a <code id=parsing-main-inbody:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element, this is a <a href=#parse-error id=parsing-main-inbody:parse-error-37>parse
- error</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-28>Insert an HTML element</a> for the token.</p>
- <dt>A start tag whose tag name is "math"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-15>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#adjust-mathml-attributes id=parsing-main-inbody:adjust-mathml-attributes>Adjust MathML attributes</a> for the token. (This fixes the case of MathML
- attributes that are not all lowercase.)</p>
- <p><a href=#adjust-foreign-attributes id=parsing-main-inbody:adjust-foreign-attributes>Adjust foreign attributes</a> for the token. (This fixes the use of namespaced
- attributes, in particular XLink.)</p>
- <p><a href=#insert-a-foreign-element id=parsing-main-inbody:insert-a-foreign-element>Insert a foreign element</a> for the token, in the <a href=#mathml-namespace id=parsing-main-inbody:mathml-namespace>MathML
- namespace</a>.</p>
-
- <p>If the token has its <i id=parsing-main-inbody:self-closing-flag><a href=#self-closing-flag>self-closing flag</a></i> set, pop the <a href=#current-node id=parsing-main-inbody:current-node-28>current node</a> off the
- <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-70>stack of open elements</a> and <a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-6>acknowledge
- the token's <i>self-closing flag</i></a>.</p>
- <dt>A start tag whose tag name is "svg"<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-16>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#adjust-svg-attributes id=parsing-main-inbody:adjust-svg-attributes>Adjust SVG attributes</a> for the token. (This fixes the case of SVG attributes that
- are not all lowercase.)</p>
- <p><a href=#adjust-foreign-attributes id=parsing-main-inbody:adjust-foreign-attributes-2>Adjust foreign attributes</a> for the token. (This fixes the use of namespaced
- attributes, in particular XLink in SVG.)</p>
- <p><a href=#insert-a-foreign-element id=parsing-main-inbody:insert-a-foreign-element-2>Insert a foreign element</a> for the token, in the <a href=#svg-namespace id=parsing-main-inbody:svg-namespace>SVG namespace</a>.</p>
-
- <p>If the token has its <i id=parsing-main-inbody:self-closing-flag-2><a href=#self-closing-flag>self-closing flag</a></i> set, pop the <a href=#current-node id=parsing-main-inbody:current-node-29>current node</a> off the
- <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-71>stack of open elements</a> and <a href=#acknowledge-self-closing-flag id=parsing-main-inbody:acknowledge-self-closing-flag-7>acknowledge
- the token's <i>self-closing flag</i></a>.</p>
- <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "frame",
- "head", "tbody", "td", "tfoot", "th", "thead", "tr"<dd>
- <p><a href=#parse-error id=parsing-main-inbody:parse-error-38>Parse error</a>. Ignore the token.</p>
-
- <dt>Any other start tag<dd>
- <p><a href=#reconstruct-the-active-formatting-elements id=parsing-main-inbody:reconstruct-the-active-formatting-elements-17>Reconstruct the active formatting elements</a>, if any.</p>
- <p><a href=#insert-an-html-element id=parsing-main-inbody:insert-an-html-element-29>Insert an HTML element</a> for the token.</p>
- <p class=note>This element will be an <a href=#ordinary id=parsing-main-inbody:ordinary>ordinary</a>
- element.</p>
- <dt>Any other end tag<dd>
- <p>Run these steps:</p>
- <ol><li><p>Initialise <var>node</var> to be the <a href=#current-node id=parsing-main-inbody:current-node-30>current node</a> (the bottommost
- node of the stack).<li><p><i>Loop</i>: If <var>node</var> is an <a href=#html-elements id=parsing-main-inbody:html-elements-15>HTML
- element</a> with the same tag name as the token, then:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-13>Generate implied end tags</a>, except for <a href=#html-elements id=parsing-main-inbody:html-elements-16>HTML elements</a> with the
- same tag name as the token.<li><p>If <var>node</var> is not the <a href=#current-node id=parsing-main-inbody:current-node-31>current node</a>, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-39>parse error</a>.<li><p>Pop all the nodes from the <a href=#current-node id=parsing-main-inbody:current-node-32>current node</a> up to <var>node</var>,
- including <var>node</var>, then stop these steps.</ol>
- <li><p>Otherwise, if <var>node</var> is in the <a href=#special id=parsing-main-inbody:special-3>special</a> category, then
- this is a <a href=#parse-error id=parsing-main-inbody:parse-error-40>parse error</a>; ignore the token, and abort these steps.<li><p>Set <var>node</var> to the previous entry in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-72>stack of open
- elements</a>.<li><p>Return to the step labeled <i>loop</i>.</ol>
- </dl>
- <p>When the steps above say the user agent is to <dfn id=close-a-p-element>close a <code>p</code> element</dfn>, it
- means that the user agent must run the following steps:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-inbody:generate-implied-end-tags-14>Generate implied end tags</a>, except for <code id=parsing-main-inbody:the-p-element-6><a href=#the-p-element>p</a></code> elements.<li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-33>current node</a> is not a <code id=parsing-main-inbody:the-p-element-7><a href=#the-p-element>p</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-41>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-73>stack of open elements</a> until a <code id=parsing-main-inbody:the-p-element-8><a href=#the-p-element>p</a></code> element
- has been popped from the stack.</ol>
-
- <p id=adoptionAgency>The <dfn id=adoption-agency-algorithm>adoption agency algorithm</dfn>, which takes as its only argument
- a tag name <var>subject</var> for which the algorithm is being run, consists of the
- following steps:</p>
- <ol><li><p>If the <a href=#current-node id=parsing-main-inbody:current-node-34>current node</a> is an <a href=#html-elements id=parsing-main-inbody:html-elements-17>HTML element</a>
- whose tag name is <var>subject</var>, and the <a href=#current-node id=parsing-main-inbody:current-node-35>current node</a> is not in the
- <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-4>list of active formatting elements</a>, then pop the <a href=#current-node id=parsing-main-inbody:current-node-36>current node</a> off the
- <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-74>stack of open elements</a>, and abort these steps.<li><p>Let <var>outer loop counter</var> be zero.<li><p><i>Outer loop</i>: If <var>outer loop counter</var> is greater than or equal to
- eight, then abort these steps.<li><p>Increment <var>outer loop counter</var> by one.<li>
- <p>Let <var>formatting element</var> be the last element in the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-5>list of active
- formatting elements</a> that:</p>
- <ul><li>is between the end of the list and the last <a href=#concept-parser-marker id=parsing-main-inbody:concept-parser-marker-4>marker</a> in the list, if any, or the start of the list
- otherwise, and<li>has the tag name <var>subject</var>.</ul>
- <p>If there is no such element, then abort these steps and instead act as described in the "any
- other end tag" entry above.</p>
- <li><p>If <var>formatting element</var> is not in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-75>stack of open
- elements</a>, then this is a <a href=#parse-error id=parsing-main-inbody:parse-error-42>parse error</a>; remove the element from the list, and
- abort these steps.<li><p>If <var>formatting element</var> is in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-76>stack of open elements</a>,
- but the element is not <a href=#has-an-element-in-scope id=parsing-main-inbody:has-an-element-in-scope-12>in scope</a>, then this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-43>parse error</a>; abort these steps.<li><p>If <var>formatting element</var> is not the <a href=#current-node id=parsing-main-inbody:current-node-37>current node</a>, this is a
- <a href=#parse-error id=parsing-main-inbody:parse-error-44>parse error</a>. (But do not abort these steps.)<li><p>Let <var>furthest block</var> be the topmost node in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-77>stack of open
- elements</a> that is lower in the stack than <var>formatting element</var>, and is an
- element in the <a href=#special id=parsing-main-inbody:special-4>special</a> category. There might not be one.<li><p>If there is no <var>furthest block</var>, then the UA must first pop all the
- nodes from the bottom of the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-78>stack of open elements</a>, from the <a href=#current-node id=parsing-main-inbody:current-node-38>current
- node</a> up to and including <var>formatting element</var>, then remove <var>formatting element</var> from the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-6>list of active formatting elements</a>, and
- finally abort these steps.<li><p>Let <var>common ancestor</var> be the element immediately above <var>formatting element</var> in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-79>stack of open elements</a>.<li><p>Let a bookmark note the position of <var>formatting element</var> in the
- <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-7>list of active formatting elements</a> relative to the elements on either side of it in
- the list.<li>
- <p>Let <var>node</var> and <var>last node</var> be <var>furthest
- block</var>. Follow these steps:</p>
- <ol><li><p>Let <var>inner loop counter</var> be zero.<li><p><i>Inner loop</i>: Increment <var>inner loop counter</var> by one.<li><p>Let <var>node</var> be the element immediately above <var>node</var>
- in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-80>stack of open elements</a>, or if <var>node</var> is no longer in the
- <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-81>stack of open elements</a> (e.g. because it got removed by this algorithm), the element that was immediately above <var>node</var> in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-82>stack of open elements</a> before <var>node</var>
- was removed.<li><p>If <var>node</var> is <var>formatting element</var>, then go to the
- next step in the overall algorithm.<li><p>If <var>inner loop counter</var> is greater than three and <var>node</var> is in the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-8>list of active formatting elements</a>, then remove <var>node</var> from the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-9>list of active formatting elements</a>.<li><p>If <var>node</var> is not in the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-10>list of active
- formatting elements</a>, then remove <var>node</var> from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-83>stack of open
- elements</a> and then go back to the step labeled <i>inner loop</i>.<li><p><a href=#create-an-element-for-the-token id=parsing-main-inbody:create-an-element-for-the-token>Create an element for the token</a> for which the element <var>node</var> was created, in the <a href=#html-namespace-2 id=parsing-main-inbody:html-namespace-2>HTML namespace</a>, with <var>common
- ancestor</var> as the intended parent; replace the entry for <var>node</var> in the
- <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-11>list of active formatting elements</a> with an entry for the new element, replace the
- entry for <var>node</var> in the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-84>stack of open elements</a> with an entry for
- the new element, and let <var>node</var> be the new element.<li><p>If <var>last node</var> is <var>furthest block</var>, then move the
- aforementioned bookmark to be immediately after the new <var>node</var> in the
- <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-12>list of active formatting elements</a>.<li><p>Insert <var>last node</var> into <var>node</var>, first removing it
- from its previous parent node if any.<li><p>Let <var>last node</var> be <var>node</var>.<li><p>Return to the step labeled <i>inner loop</i>.</ol>
- <li><p>Insert whatever <var>last node</var> ended up being in the previous step at the
- <a href=#appropriate-place-for-inserting-a-node id=parsing-main-inbody:appropriate-place-for-inserting-a-node>appropriate place for inserting a node</a>, but using <var>common
- ancestor</var> as the <i>override target</i>.<li><p><a href=#create-an-element-for-the-token id=parsing-main-inbody:create-an-element-for-the-token-2>Create an element for the token</a> for which <var>formatting
- element</var> was created, in the <a href=#html-namespace-2 id=parsing-main-inbody:html-namespace-2-2>HTML namespace</a>, with <var>furthest
- block</var> as the intended parent.<li><p>Take all of the child nodes of <var>furthest block</var> and append them to the
- element created in the last step.<li><p>Append that new element to <var>furthest block</var>.<li><p>Remove <var>formatting element</var> from the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-13>list of active formatting
- elements</a>, and insert the new element into the <a href=#list-of-active-formatting-elements id=parsing-main-inbody:list-of-active-formatting-elements-14>list of active formatting
- elements</a> at the position of the aforementioned bookmark.<li><p>Remove <var>formatting element</var> from the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-85>stack of open
- elements</a>, and insert the new element into the <a href=#stack-of-open-elements id=parsing-main-inbody:stack-of-open-elements-86>stack of open elements</a>
- immediately below the position of <var>furthest block</var> in that stack.<li><p>Jump back to the step labeled <i>outer loop</i>.</ol>
- <p class=note>This algorithm's name, the "adoption agency algorithm", comes from the way it
- causes elements to change parents, and is in contrast with other possible algorithms for dealing
- with misnested content, which included the "incest algorithm", the "secret affair algorithm", and
- the "Heisenberg algorithm".</p>
- <h6 id=parsing-main-incdata>12.2.5.4.8 The "<dfn>text</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incdata id=parsing-main-incdata:parsing-main-incdata>text</a>" <a href=#insertion-mode id=parsing-main-incdata:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A character token<dd>
- <p><a href=#insert-a-character id=parsing-main-incdata:insert-a-character>Insert the token's character</a>.</p>
- <p class=note>This can never be a U+0000 NULL character; the tokenizer converts those to
- U+FFFD REPLACEMENT CHARACTER characters.</p>
- <dt>An end-of-file token<dd>
-
- <p><a href=#parse-error id=parsing-main-incdata:parse-error>Parse error</a>.</p>
- <p>If the <a href=#current-node id=parsing-main-incdata:current-node>current node</a> is a <code id=parsing-main-incdata:the-script-element><a href=#the-script-element>script</a></code> element, mark the
- <code id=parsing-main-incdata:the-script-element-2><a href=#the-script-element>script</a></code> element as <a href=#already-started id=parsing-main-incdata:already-started>"already started"</a>.</p>
- <p>Pop the <a href=#current-node id=parsing-main-incdata:current-node-2>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-incdata:stack-of-open-elements>stack of open elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incdata:insertion-mode-2>insertion mode</a> to the <a href=#original-insertion-mode id=parsing-main-incdata:original-insertion-mode>original insertion mode</a> and
- reprocess the token.</p>
- <dt id=scriptEndTag>An end tag whose tag name is "script"<dd>
- <p>If the <a href=#stack-of-script-settings-objects id=parsing-main-incdata:stack-of-script-settings-objects>stack of script settings objects</a> is empty, <a href=#perform-a-microtask-checkpoint id=parsing-main-incdata:perform-a-microtask-checkpoint>perform a microtask checkpoint</a>.</p>
- <p>Let <var>script</var> be the <a href=#current-node id=parsing-main-incdata:current-node-3>current node</a> (which will be a
- <code id=parsing-main-incdata:the-script-element-3><a href=#the-script-element>script</a></code> element).</p>
- <p>Pop the <a href=#current-node id=parsing-main-incdata:current-node-4>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-incdata:stack-of-open-elements-2>stack of open elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incdata:insertion-mode-3>insertion mode</a> to the <a href=#original-insertion-mode id=parsing-main-incdata:original-insertion-mode-2>original insertion mode</a>.</p>
- <p>Let the <var>old insertion point</var> have the same value as the current
- <a href=#insertion-point id=parsing-main-incdata:insertion-point>insertion point</a>. Let the <a href=#insertion-point id=parsing-main-incdata:insertion-point-2>insertion point</a> be just before the <a href=#next-input-character id=parsing-main-incdata:next-input-character>next
- input character</a>.</p>
- <p>Increment the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level>script nesting level</a> by one.</p>
- <p><a href=#prepare-a-script id=parsing-main-incdata:prepare-a-script>Prepare</a> the <var>script</var>. This might
- cause some script to execute, which might cause <a href=#dom-document-write id=parsing-main-incdata:dom-document-write>new characters
- to be inserted into the tokenizer</a>, and might cause the tokenizer to output more tokens,
- resulting in a <a href=#nestedParsing>reentrant invocation of the parser</a>.</p>
- <p>Decrement the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-2>script nesting level</a> by one. If the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-3>script
- nesting level</a> is zero, then set the <a href=#parser-pause-flag id=parsing-main-incdata:parser-pause-flag>parser pause flag</a> to false.</p>
- <p>Let the <a href=#insertion-point id=parsing-main-incdata:insertion-point-3>insertion point</a> have the value of the <var>old insertion
- point</var>. (In other words, restore the <a href=#insertion-point id=parsing-main-incdata:insertion-point-4>insertion point</a> to its previous value.
- This value might be the "undefined" value.)</p>
- <p id=scriptTagParserResumes>At this stage, if there is a <a href=#pending-parsing-blocking-script id=parsing-main-incdata:pending-parsing-blocking-script>pending parsing-blocking
- script</a>, then:</p>
- <dl class=switch><dt>If the <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-4>script nesting level</a> is not zero:<dd>
- <p>Set the <a href=#parser-pause-flag id=parsing-main-incdata:parser-pause-flag-2>parser pause flag</a> to true, and abort the processing of any nested
- invocations of the tokenizer, yielding control back to the caller. (Tokenization will resume
- when the caller returns to the "outer" tree construction stage.)</p>
- <p class=note>The tree construction stage of this particular parser is <a href=#nestedParsing>being called reentrantly</a>, say from a call to <code id=parsing-main-incdata:dom-document-write-2><a href=#dom-document-write>document.write()</a></code>.</p>
- <dt>Otherwise:<dd>
- <p>Run these steps:</p>
- <ol><li><p>Let <var>the script</var> be the <a href=#pending-parsing-blocking-script id=parsing-main-incdata:pending-parsing-blocking-script-2>pending parsing-blocking
- script</a>. There is no longer a <a href=#pending-parsing-blocking-script id=parsing-main-incdata:pending-parsing-blocking-script-3>pending parsing-blocking script</a>.<li><p>Block the <a href=#tokenization id=parsing-main-incdata:tokenization>tokenizer</a> for this instance of the
- <a href=#html-parser id=parsing-main-incdata:html-parser>HTML parser</a>, such that the <a href=#event-loop id=parsing-main-incdata:event-loop>event loop</a> will not run <a href=#concept-task id=parsing-main-incdata:concept-task>tasks</a> that invoke the <a href=#tokenization id=parsing-main-incdata:tokenization-2>tokenizer</a>.<li><p>If the parser's <code id=parsing-main-incdata:document><a href=#document>Document</a></code> <a href=#has-a-style-sheet-that-is-blocking-scripts id=parsing-main-incdata:has-a-style-sheet-that-is-blocking-scripts>has a style sheet that is blocking
- scripts</a> or <var>the script</var>'s <a href=#ready-to-be-parser-executed id=parsing-main-incdata:ready-to-be-parser-executed>"ready to be parser-executed"</a>
- flag is not set: <a href=#spin-the-event-loop id=parsing-main-incdata:spin-the-event-loop>spin the event loop</a> until the parser's <code id=parsing-main-incdata:document-2><a href=#document>Document</a></code>
- <a href=#has-no-style-sheet-that-is-blocking-scripts id=parsing-main-incdata:has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</a> and <var>the script</var>'s
- <a href=#ready-to-be-parser-executed id=parsing-main-incdata:ready-to-be-parser-executed-2>"ready to be parser-executed"</a> flag is set.<li>
- <p>If this <a href=#abort-a-parser id=parsing-main-incdata:abort-a-parser>parser has been aborted</a> in the meantime,
- abort these steps.</p>
- <p class=note>This could happen if, e.g., while the <a href=#spin-the-event-loop id=parsing-main-incdata:spin-the-event-loop-2>spin the event loop</a>
- algorithm is running, the <a href=#browsing-context id=parsing-main-incdata:browsing-context>browsing context</a> gets closed, or the <code id=parsing-main-incdata:dom-document-open><a href=#dom-document-open>document.open()</a></code> method gets invoked on the
- <code id=parsing-main-incdata:document-3><a href=#document>Document</a></code>.</p>
- <li><p>Unblock the <a href=#tokenization id=parsing-main-incdata:tokenization-3>tokenizer</a> for this instance of the
- <a href=#html-parser id=parsing-main-incdata:html-parser-2>HTML parser</a>, such that <a href=#concept-task id=parsing-main-incdata:concept-task-2>tasks</a> that invoke the
- <a href=#tokenization id=parsing-main-incdata:tokenization-4>tokenizer</a> can again be run.<li><p>Let the <a href=#insertion-point id=parsing-main-incdata:insertion-point-5>insertion point</a> be just before the <a href=#next-input-character id=parsing-main-incdata:next-input-character-2>next input
- character</a>.<li><p>Increment the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-5>script nesting level</a> by one (it should be zero
- before this step, so this sets it to one).<li><p><a href=#execute-the-script-block id=parsing-main-incdata:execute-the-script-block>Execute</a> <var>the
- script</var>.<li><p>Decrement the parser's <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-6>script nesting level</a> by one. If the parser's
- <a href=#script-nesting-level id=parsing-main-incdata:script-nesting-level-7>script nesting level</a> is zero (which it always should be at this point), then set
- the <a href=#parser-pause-flag id=parsing-main-incdata:parser-pause-flag-3>parser pause flag</a> to false.</p>
- <li><p>Let the <a href=#insertion-point id=parsing-main-incdata:insertion-point-6>insertion point</a> be undefined again.<li><p>If there is once again a <a href=#pending-parsing-blocking-script id=parsing-main-incdata:pending-parsing-blocking-script-4>pending parsing-blocking script</a>, then repeat
- these steps from step 1.</ol>
- </dl>
- <dt>Any other end tag<dd>
- <p>Pop the <a href=#current-node id=parsing-main-incdata:current-node-5>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-incdata:stack-of-open-elements-3>stack of open elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incdata:insertion-mode-4>insertion mode</a> to the <a href=#original-insertion-mode id=parsing-main-incdata:original-insertion-mode-3>original insertion mode</a>.</p>
- </dl>
- <h6 id=parsing-main-intable>12.2.5.4.9 The "<dfn>in table</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intable id=parsing-main-intable:parsing-main-intable>in
- table</a>" <a href=#insertion-mode id=parsing-main-intable:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token, if the <a href=#current-node id=parsing-main-intable:current-node>current node</a> is <code id=parsing-main-intable:the-table-element><a href=#the-table-element>table</a></code>, <code id=parsing-main-intable:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=parsing-main-intable:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>, <code id=parsing-main-intable:the-thead-element><a href=#the-thead-element>thead</a></code>, or <code id=parsing-main-intable:the-tr-element><a href=#the-tr-element>tr</a></code> element<dd>
- <p>Let the <dfn id=concept-pending-table-char-tokens><var>pending table character
- tokens</var></dfn> be an empty list of tokens.</p>
- <p>Let the <a href=#original-insertion-mode id=parsing-main-intable:original-insertion-mode>original insertion mode</a> be the current <a href=#insertion-mode id=parsing-main-intable:insertion-mode-2>insertion mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-intabletext id=parsing-main-intable:parsing-main-intabletext>in
- table text</a>" and reprocess the token.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-intable:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-intable:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "caption"<dd>
- <p><a href=#clear-the-stack-back-to-a-table-context id=parsing-main-intable:clear-the-stack-back-to-a-table-context>Clear the stack back to a table context</a>. (See below.)</p>
- <p>Insert a <a href=#concept-parser-marker id=parsing-main-intable:concept-parser-marker>marker</a> at the end of the <a href=#list-of-active-formatting-elements id=parsing-main-intable:list-of-active-formatting-elements>list of
- active formatting elements</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element>Insert an HTML element</a> for the token, then switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-4>insertion
- mode</a> to "<a href=#parsing-main-incaption id=parsing-main-intable:parsing-main-incaption>in caption</a>".</p>
- <dt>A start tag whose tag name is "colgroup"<dd>
- <p><a href=#clear-the-stack-back-to-a-table-context id=parsing-main-intable:clear-the-stack-back-to-a-table-context-2>Clear the stack back to a table context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-2>Insert an HTML element</a> for the token, then switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-5>insertion
- mode</a> to "<a href=#parsing-main-incolgroup id=parsing-main-intable:parsing-main-incolgroup>in column group</a>".</p>
- <dt>A start tag whose tag name is "col"<dd>
-
- <p><a href=#clear-the-stack-back-to-a-table-context id=parsing-main-intable:clear-the-stack-back-to-a-table-context-3>Clear the stack back to a table context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-3>Insert an HTML element</a> for a "colgroup" start tag token with no attributes, then
- switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-6>insertion mode</a> to "<a href=#parsing-main-incolgroup id=parsing-main-intable:parsing-main-incolgroup-2>in
- column group</a>".</p>
-
- <p>Reprocess the current token.</p>
- <dt>A start tag whose tag name is one of: "tbody", "tfoot", "thead"<dd>
- <p><a href=#clear-the-stack-back-to-a-table-context id=parsing-main-intable:clear-the-stack-back-to-a-table-context-4>Clear the stack back to a table context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-4>Insert an HTML element</a> for the token, then switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-7>insertion
- mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intable:parsing-main-intbody>in table body</a>".</p>
- <dt>A start tag whose tag name is one of: "td", "th", "tr"<dd>
-
- <p><a href=#clear-the-stack-back-to-a-table-context id=parsing-main-intable:clear-the-stack-back-to-a-table-context-5>Clear the stack back to a table context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-5>Insert an HTML element</a> for a "tbody" start tag token with no attributes, then
- switch the <a href=#insertion-mode id=parsing-main-intable:insertion-mode-8>insertion mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intable:parsing-main-intbody-2>in table
- body</a>".</p>
-
- <p>Reprocess the current token.</p>
- <dt>A start tag whose tag name is "table"<dd>
- <p><a href=#parse-error id=parsing-main-intable:parse-error-2>Parse error</a>.</p>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intable:has-an-element-in-table-scope>have a <code>table</code> element in table scope</a>, ignore the token.</p>
- <p>Otherwise:</p>
- <p>Pop elements from this stack until a <code id=parsing-main-intable:the-table-element-2><a href=#the-table-element>table</a></code> element has been popped from the
- stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-intable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is "table"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements-2>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intable:has-an-element-in-table-scope-2>have a <code>table</code> element in table scope</a>, this is a <a href=#parse-error id=parsing-main-intable:parse-error-3>parse
- error</a>; ignore the token.</p>
- <p>Otherwise:</p>
- <p>Pop elements from this stack until a <code id=parsing-main-intable:the-table-element-3><a href=#the-table-element>table</a></code> element has been popped from the
- stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-intable:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately</a>.</p>
- <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "tbody",
- "td", "tfoot", "th", "thead", "tr"<dd>
- <p><a href=#parse-error id=parsing-main-intable:parse-error-4>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is one of: "style", "script", "template"<dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intable:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-intable:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-intable:insertion-mode-9>insertion
- mode</a>.</p>
- <dt>A start tag whose tag name is "input"<dd>
- <p>If the token does not have an attribute with the name "type", or if it does, but that
- attribute's value is not an <a href=#ascii-case-insensitive id=parsing-main-intable:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>hidden</code>", then: act as described in the "anything else" entry below.</p>
- <p>Otherwise:</p>
- <p><a href=#parse-error id=parsing-main-intable:parse-error-5>Parse error</a>.</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-6>Insert an HTML element</a> for the token.</p>
- <p>Pop that <code id=parsing-main-intable:the-input-element><a href=#the-input-element>input</a></code> element off the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements-3>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-intable:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <dt>A start tag whose tag name is "form"<dd>
- <p><a href=#parse-error id=parsing-main-intable:parse-error-6>Parse error</a>.</p>
- <p>If there is a <code id=parsing-main-intable:the-template-element><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements-4>stack of open elements</a>, or if
- the <a href=#form-element-pointer id=parsing-main-intable:form-element-pointer><code>form</code> element pointer</a> is not null, ignore the
- token.</p>
- <p>Otherwise:</p>
- <p><a href=#insert-an-html-element id=parsing-main-intable:insert-an-html-element-7>Insert an HTML element</a> for the token, and set the <a href=#form-element-pointer id=parsing-main-intable:form-element-pointer-2><code>form</code> element pointer</a> to point to the element created.</p>
- <p>Pop that <code id=parsing-main-intable:the-form-element><a href=#the-form-element>form</a></code> element off the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements-5>stack of open elements</a>.</p>
- <dt>An end-of-file token<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intable:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-intable:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-intable:insertion-mode-10>insertion mode</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=parsing-main-intable:parse-error-7>Parse error</a>. Enable <a href=#foster-parent id=parsing-main-intable:foster-parent>foster parenting</a>, process
- the token <a href=#using-the-rules-for id=parsing-main-intable:using-the-rules-for-3>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-intable:parsing-main-inbody-2>in
- body</a>" <a href=#insertion-mode id=parsing-main-intable:insertion-mode-11>insertion mode</a>, and then disable <a href=#foster-parent id=parsing-main-intable:foster-parent-2>foster
- parenting</a>.</p>
- </dl>
- <p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-context>clear the stack back to a table context</dfn>, it
- means that the UA must, while the <a href=#current-node id=parsing-main-intable:current-node-2>current node</a> is not a <code id=parsing-main-intable:the-table-element-4><a href=#the-table-element>table</a></code>,
- <code id=parsing-main-intable:the-template-element-2><a href=#the-template-element>template</a></code>, or <code id=parsing-main-intable:the-html-element><a href=#the-html-element>html</a></code> element, pop elements from the <a href=#stack-of-open-elements id=parsing-main-intable:stack-of-open-elements-6>stack of open
- elements</a>.</p>
- <p class=note>This is the same list of elements as used in the <i id=parsing-main-intable:has-an-element-in-table-scope-3><a href=#has-an-element-in-table-scope>has an element in table scope</a></i> steps.</p>
- <p class=note>The <a href=#current-node id=parsing-main-intable:current-node-3>current node</a> being an <code id=parsing-main-intable:the-html-element-2><a href=#the-html-element>html</a></code> element after this
- process is a <a href=#fragment-case id=parsing-main-intable:fragment-case>fragment case</a>.</p>
- <h6 id=parsing-main-intabletext>12.2.5.4.10 The "<dfn>in table text</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intabletext id=parsing-main-intabletext:parsing-main-intabletext>in table text</a>" <a href=#insertion-mode id=parsing-main-intabletext:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A character token that is U+0000 NULL<dd>
- <p><a href=#parse-error id=parsing-main-intabletext:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>Any other character token<dd>
- <p>Append the character token to the <var id=parsing-main-intabletext:concept-pending-table-char-tokens><a href=#concept-pending-table-char-tokens>pending
- table character tokens</a></var> list.</p>
- <dt>Anything else<dd>
-
- <p>If any of the tokens in the <var id=parsing-main-intabletext:concept-pending-table-char-tokens-2><a href=#concept-pending-table-char-tokens>pending table
- character tokens</a></var> list are character tokens that are not <a href=#space-character id=parsing-main-intabletext:space-character>space characters</a>, then this is a <a href=#parse-error id=parsing-main-intabletext:parse-error-2>parse error</a>: reprocess the
- character tokens in the <var id=parsing-main-intabletext:concept-pending-table-char-tokens-3><a href=#concept-pending-table-char-tokens>pending table character
- tokens</a></var> list using the rules given in the "anything else" entry in the "<a href=#parsing-main-intable id=parsing-main-intabletext:parsing-main-intable>in table</a>" insertion mode.</p>
-
- <p>Otherwise, <a href=#insert-a-character id=parsing-main-intabletext:insert-a-character>insert the characters</a> given by the <var id=parsing-main-intabletext:concept-pending-table-char-tokens-4><a href=#concept-pending-table-char-tokens>pending table character tokens</a></var> list.</p>
-
- <p>Switch the <a href=#insertion-mode id=parsing-main-intabletext:insertion-mode-2>insertion mode</a> to the <a href=#original-insertion-mode id=parsing-main-intabletext:original-insertion-mode>original insertion mode</a> and
- reprocess the token.</p>
- </dl>
- <h6 id=parsing-main-incaption>12.2.5.4.11 The "<dfn>in caption</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incaption id=parsing-main-incaption:parsing-main-incaption>in
- caption</a>" <a href=#insertion-mode id=parsing-main-incaption:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>An end tag whose tag name is "caption"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-incaption:stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-incaption:has-an-element-in-table-scope>have a <code>caption</code> element in table scope</a>, this is a <a href=#parse-error id=parsing-main-incaption:parse-error>parse
- error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-incaption:fragment-case>fragment case</a>)</p>
- <p>Otherwise:</p>
- <p><a href=#generate-implied-end-tags id=parsing-main-incaption:generate-implied-end-tags>Generate implied end tags</a>.</p>
- <p>Now, if the <a href=#current-node id=parsing-main-incaption:current-node>current node</a> is not a <code id=parsing-main-incaption:the-caption-element><a href=#the-caption-element>caption</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-incaption:parse-error-2>parse error</a>.</p>
- <p>Pop elements from this stack until a <code id=parsing-main-incaption:the-caption-element-2><a href=#the-caption-element>caption</a></code> element has been popped from the
- stack.</p>
- <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-incaption:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incaption:insertion-mode-2>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-incaption:parsing-main-intable>in
- table</a>".</p>
- <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "td", "tfoot",
- "th", "thead", "tr"<dt>An end tag whose tag name is "table"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-incaption:stack-of-open-elements-2>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-incaption:has-an-element-in-table-scope-2>have a <code>caption</code> element in table scope</a>, this is a <a href=#parse-error id=parsing-main-incaption:parse-error-3>parse
- error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-incaption:fragment-case-2>fragment case</a>)</p>
- <p>Otherwise:</p>
-
- <p><a href=#generate-implied-end-tags id=parsing-main-incaption:generate-implied-end-tags-2>Generate implied end tags</a>.</p>
- <p>Now, if the <a href=#current-node id=parsing-main-incaption:current-node-2>current node</a> is not a <code id=parsing-main-incaption:the-caption-element-3><a href=#the-caption-element>caption</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-incaption:parse-error-4>parse error</a>.</p>
- <p>Pop elements from this stack until a <code id=parsing-main-incaption:the-caption-element-4><a href=#the-caption-element>caption</a></code> element has been popped from the
- stack.</p>
- <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-incaption:clear-the-list-of-active-formatting-elements-up-to-the-last-marker-2>Clear the list of active formatting elements up to the last marker</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incaption:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-incaption:parsing-main-intable-2>in
- table</a>".</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "body", "col", "colgroup", "html", "tbody", "td",
- "tfoot", "th", "thead", "tr"<dd>
- <p><a href=#parse-error id=parsing-main-incaption:parse-error-5>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-incaption:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-incaption:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-incaption:insertion-mode-4>insertion mode</a>.</p>
- </dl>
- <h6 id=parsing-main-incolgroup>12.2.5.4.12 The "<dfn>in column group</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-incolgroup id=parsing-main-incolgroup:parsing-main-incolgroup>in column group</a>" <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode>insertion mode</a>, the user agent must handle the token
- as follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=parsing-main-incolgroup:insert-a-character>Insert the character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-incolgroup:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-incolgroup:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-incolgroup:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-incolgroup:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "col"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-incolgroup:insert-an-html-element>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-incolgroup:current-node>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-incolgroup:stack-of-open-elements>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-incolgroup:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <dt>An end tag whose tag name is "colgroup"<dd>
- <p>If the <a href=#current-node id=parsing-main-incolgroup:current-node-2>current node</a> is not a <code id=parsing-main-incolgroup:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-incolgroup:parse-error-2>parse error</a>; ignore the token.</p>
- <p>Otherwise, pop the <a href=#current-node id=parsing-main-incolgroup:current-node-3>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-incolgroup:stack-of-open-elements-2>stack of open elements</a>.
- Switch the <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-incolgroup:parsing-main-intable>in
- table</a>".</p>
- <dt>An end tag whose tag name is "col"<dd>
- <p><a href=#parse-error id=parsing-main-incolgroup:parse-error-3>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "template"<dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-incolgroup:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-incolgroup:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode-4>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-incolgroup:using-the-rules-for-3>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-incolgroup:parsing-main-inbody-2>in body</a>" <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode-5>insertion mode</a>.</p>
- <dt>Anything else<dd>
-
- <p>If the <a href=#current-node id=parsing-main-incolgroup:current-node-4>current node</a> is not a <code id=parsing-main-incolgroup:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-incolgroup:parse-error-4>parse error</a>; ignore the token.</p>
- <p>Otherwise, pop the <a href=#current-node id=parsing-main-incolgroup:current-node-5>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-incolgroup:stack-of-open-elements-3>stack of open
- elements</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-incolgroup:insertion-mode-6>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-incolgroup:parsing-main-intable-2>in
- table</a>".</p>
-
- <p>Reprocess the token.</p>
- </dl>
- <h6 id=parsing-main-intbody>12.2.5.4.13 The "<dfn>in table body</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intbody id=parsing-main-intbody:parsing-main-intbody>in table body</a>" <a href=#insertion-mode id=parsing-main-intbody:insertion-mode>insertion mode</a>, the user agent must handle the token as
- follows:</p>
- <dl class=switch><dt>A start tag whose tag name is "tr"<dd>
- <p><a href=#clear-the-stack-back-to-a-table-body-context id=parsing-main-intbody:clear-the-stack-back-to-a-table-body-context>Clear the stack back to a table body context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intbody:insert-an-html-element>Insert an HTML element</a> for the token, then switch the <a href=#insertion-mode id=parsing-main-intbody:insertion-mode-2>insertion
- mode</a> to "<a href=#parsing-main-intr id=parsing-main-intbody:parsing-main-intr>in row</a>".</p>
- <dt>A start tag whose tag name is one of: "th", "td"<dd>
- <p><a href=#parse-error id=parsing-main-intbody:parse-error>Parse error</a>.</p>
-
- <p><a href=#clear-the-stack-back-to-a-table-body-context id=parsing-main-intbody:clear-the-stack-back-to-a-table-body-context-2>Clear the stack back to a table body context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intbody:insert-an-html-element-2>Insert an HTML element</a> for a "tr" start tag token with no attributes, then
- switch the <a href=#insertion-mode id=parsing-main-intbody:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-intr id=parsing-main-intbody:parsing-main-intr-2>in
- row</a>".</p>
-
- <p>Reprocess the current token.</p>
- <dt>An end tag whose tag name is one of: "tbody", "tfoot",
- "thead"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intbody:has-an-element-in-table-scope>have an element in table scope</a> that is an <a href=#html-elements id=parsing-main-intbody:html-elements>HTML
- element</a> with the same tag name as the token, this is a <a href=#parse-error id=parsing-main-intbody:parse-error-2>parse error</a>;
- ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#clear-the-stack-back-to-a-table-body-context id=parsing-main-intbody:clear-the-stack-back-to-a-table-body-context-3>Clear the stack back to a table body context</a>. (See below.)</p>
- <p>Pop the <a href=#current-node id=parsing-main-intbody:current-node>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements-2>stack of open elements</a>. Switch the
- <a href=#insertion-mode id=parsing-main-intbody:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-intbody:parsing-main-intable>in table</a>".</p>
- <dt>A start tag whose tag name is one of: "caption", "col",
- "colgroup", "tbody", "tfoot", "thead"<dt>An end tag whose tag name is "table"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements-3>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intbody:has-an-element-in-table-scope-2>have a <code>tbody</code>, <code>thead</code>, or <code>tfoot</code> element in table
- scope</a>, this is a <a href=#parse-error id=parsing-main-intbody:parse-error-3>parse error</a>; ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#clear-the-stack-back-to-a-table-body-context id=parsing-main-intbody:clear-the-stack-back-to-a-table-body-context-4>Clear the stack back to a table body context</a>. (See below.)</p>
-
- <p>Pop the <a href=#current-node id=parsing-main-intbody:current-node-2>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements-4>stack of open elements</a>. Switch the
- <a href=#insertion-mode id=parsing-main-intbody:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-intbody:parsing-main-intable-2>in table</a>".</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td",
- "th", "tr"<dd>
- <p><a href=#parse-error id=parsing-main-intbody:parse-error-4>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intbody:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable id=parsing-main-intbody:parsing-main-intable-3>in table</a>" <a href=#insertion-mode id=parsing-main-intbody:insertion-mode-6>insertion mode</a>.</p>
- </dl>
- <p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-body-context>clear the stack back to a table body context</dfn>,
- it means that the UA must, while the <a href=#current-node id=parsing-main-intbody:current-node-3>current node</a> is not a <code id=parsing-main-intbody:the-tbody-element><a href=#the-tbody-element>tbody</a></code>,
- <code id=parsing-main-intbody:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>, <code id=parsing-main-intbody:the-thead-element><a href=#the-thead-element>thead</a></code>, <code id=parsing-main-intbody:the-template-element><a href=#the-template-element>template</a></code>, or <code id=parsing-main-intbody:the-html-element><a href=#the-html-element>html</a></code> element, pop
- elements from the <a href=#stack-of-open-elements id=parsing-main-intbody:stack-of-open-elements-5>stack of open elements</a>.</p>
- <p class=note>The <a href=#current-node id=parsing-main-intbody:current-node-4>current node</a> being an <code id=parsing-main-intbody:the-html-element-2><a href=#the-html-element>html</a></code> element after this
- process is a <a href=#fragment-case id=parsing-main-intbody:fragment-case>fragment case</a>.</p>
- <h6 id=parsing-main-intr>12.2.5.4.14 The "<dfn>in row</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intr id=parsing-main-intr:parsing-main-intr>in
- row</a>" <a href=#insertion-mode id=parsing-main-intr:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A start tag whose tag name is one of: "th", "td"<dd>
- <p><a href=#clear-the-stack-back-to-a-table-row-context id=parsing-main-intr:clear-the-stack-back-to-a-table-row-context>Clear the stack back to a table row context</a>. (See below.)</p>
- <p><a href=#insert-an-html-element id=parsing-main-intr:insert-an-html-element>Insert an HTML element</a> for the token, then switch the <a href=#insertion-mode id=parsing-main-intr:insertion-mode-2>insertion
- mode</a> to "<a href=#parsing-main-intd id=parsing-main-intr:parsing-main-intd>in cell</a>".</p>
- <p>Insert a <a href=#concept-parser-marker id=parsing-main-intr:concept-parser-marker>marker</a> at the end of the <a href=#list-of-active-formatting-elements id=parsing-main-intr:list-of-active-formatting-elements>list of
- active formatting elements</a>.</p>
- <dt>An end tag whose tag name is "tr"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intr:has-an-element-in-table-scope>have a <code>tr</code> element in table scope</a>, this is a <a href=#parse-error id=parsing-main-intr:parse-error>parse error</a>;
- ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#clear-the-stack-back-to-a-table-row-context id=parsing-main-intr:clear-the-stack-back-to-a-table-row-context-2>Clear the stack back to a table row context</a>. (See below.)</p>
- <p>Pop the <a href=#current-node id=parsing-main-intr:current-node>current node</a> (which will be a <code id=parsing-main-intr:the-tr-element><a href=#the-tr-element>tr</a></code> element) from the
- <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-2>stack of open elements</a>. Switch the <a href=#insertion-mode id=parsing-main-intr:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intr:parsing-main-intbody>in table body</a>".</p>
- <dt>A start tag whose tag name is one of: "caption", "col", "colgroup", "tbody", "tfoot",
- "thead", "tr"<dt>An end tag whose tag name is "table"<dd>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-3>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intr:has-an-element-in-table-scope-2>have a <code>tr</code> element in table scope</a>, this is a <a href=#parse-error id=parsing-main-intr:parse-error-2>parse error</a>;
- ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#clear-the-stack-back-to-a-table-row-context id=parsing-main-intr:clear-the-stack-back-to-a-table-row-context-3>Clear the stack back to a table row context</a>. (See below.)</p>
- <p>Pop the <a href=#current-node id=parsing-main-intr:current-node-2>current node</a> (which will be a <code id=parsing-main-intr:the-tr-element-2><a href=#the-tr-element>tr</a></code> element) from the
- <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-4>stack of open elements</a>. Switch the <a href=#insertion-mode id=parsing-main-intr:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intr:parsing-main-intbody-2>in table body</a>".</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "tbody", "tfoot", "thead"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-5>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intr:has-an-element-in-table-scope-3>have an element in table scope</a> that is an <a href=#html-elements id=parsing-main-intr:html-elements>HTML
- element</a> with the same tag name as the token, this is a <a href=#parse-error id=parsing-main-intr:parse-error-3>parse error</a>;
- ignore the token.</p>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-6>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intr:has-an-element-in-table-scope-4>have a <code>tr</code> element in table scope</a>, ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#clear-the-stack-back-to-a-table-row-context id=parsing-main-intr:clear-the-stack-back-to-a-table-row-context-4>Clear the stack back to a table row context</a>. (See below.)</p>
- <p>Pop the <a href=#current-node id=parsing-main-intr:current-node-3>current node</a> (which will be a <code id=parsing-main-intr:the-tr-element-3><a href=#the-tr-element>tr</a></code> element) from the
- <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-7>stack of open elements</a>. Switch the <a href=#insertion-mode id=parsing-main-intr:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intr:parsing-main-intbody-3>in table body</a>".</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "body", "caption", "col", "colgroup", "html", "td",
- "th"<dd>
- <p><a href=#parse-error id=parsing-main-intr:parse-error-4>Parse error</a>. Ignore the token.</p>
- <dt>Anything else<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intr:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-intable id=parsing-main-intr:parsing-main-intable>in table</a>" <a href=#insertion-mode id=parsing-main-intr:insertion-mode-6>insertion mode</a>.</p>
- </dl>
- <p>When the steps above require the UA to <dfn id=clear-the-stack-back-to-a-table-row-context>clear the stack back to a table row context</dfn>,
- it means that the UA must, while the <a href=#current-node id=parsing-main-intr:current-node-4>current node</a> is not a <code id=parsing-main-intr:the-tr-element-4><a href=#the-tr-element>tr</a></code>,
- <code id=parsing-main-intr:the-template-element><a href=#the-template-element>template</a></code>, or <code id=parsing-main-intr:the-html-element><a href=#the-html-element>html</a></code> element, pop elements from the <a href=#stack-of-open-elements id=parsing-main-intr:stack-of-open-elements-8>stack of open
- elements</a>.</p>
- <p class=note>The <a href=#current-node id=parsing-main-intr:current-node-5>current node</a> being an <code id=parsing-main-intr:the-html-element-2><a href=#the-html-element>html</a></code> element after this
- process is a <a href=#fragment-case id=parsing-main-intr:fragment-case>fragment case</a>.</p>
- <h6 id=parsing-main-intd>12.2.5.4.15 The "<dfn>in cell</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intd id=parsing-main-intd:parsing-main-intd>in cell</a>" <a href=#insertion-mode id=parsing-main-intd:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>An end tag whose tag name is one of: "td", "th"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intd:has-an-element-in-table-scope>have an element in table scope</a> that is an <a href=#html-elements id=parsing-main-intd:html-elements>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-intd:parse-error>parse
- error</a>; ignore the token.</p>
- <p>Otherwise:</p>
- <p><a href=#generate-implied-end-tags id=parsing-main-intd:generate-implied-end-tags>Generate implied end tags</a>.</p>
- <p>Now, if the <a href=#current-node id=parsing-main-intd:current-node>current node</a> is not an <a href=#html-elements id=parsing-main-intd:html-elements-2>HTML
- element</a> with the same tag name as the token, then this is a <a href=#parse-error id=parsing-main-intd:parse-error-2>parse error</a>.</p>
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements-2>stack of open elements</a> stack until an <a href=#html-elements id=parsing-main-intd:html-elements-3>HTML element</a> with the same tag name as the token has been popped from the
- stack.</p>
- <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-intd:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intd:insertion-mode-2>insertion mode</a> to "<a href=#parsing-main-intr id=parsing-main-intd:parsing-main-intr>in
- row</a>".</p>
- <dt>A start tag whose tag name is one of: "caption", "col",
- "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements-3>stack of open elements</a> does <em>not</em> <a href=#has-an-element-in-table-scope id=parsing-main-intd:has-an-element-in-table-scope-2>have a <code>td</code> or <code>th</code> element in table scope</a>, then this
- is a <a href=#parse-error id=parsing-main-intd:parse-error-3>parse error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-intd:fragment-case>fragment case</a>)</p>
- <p>Otherwise, <a href=#close-the-cell id=parsing-main-intd:close-the-cell>close the cell</a> (see below) and reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "body", "caption",
- "col", "colgroup", "html"<dd>
- <p><a href=#parse-error id=parsing-main-intd:parse-error-4>Parse error</a>. Ignore the token.</p>
- <dt>An end tag whose tag name is one of: "table", "tbody",
- "tfoot", "thead", "tr"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements-4>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-intd:has-an-element-in-table-scope-3>have an element in table scope</a> that is an <a href=#html-elements id=parsing-main-intd:html-elements-4>HTML
- element</a> with the same tag name as that of the token, then this is a <a href=#parse-error id=parsing-main-intd:parse-error-5>parse
- error</a>; ignore the token.</p>
- <p>Otherwise, <a href=#close-the-cell id=parsing-main-intd:close-the-cell-2>close the cell</a> (see below) and reprocess the token.</p>
- <dt>Anything else<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intd:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-intd:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-intd:insertion-mode-3>insertion mode</a>.</p>
- </dl>
- <p>Where the steps above say to <dfn id=close-the-cell>close the cell</dfn>, they mean to run the following
- algorithm:</p>
- <ol><li><p><a href=#generate-implied-end-tags id=parsing-main-intd:generate-implied-end-tags-2>Generate implied end tags</a>.<li><p>If the <a href=#current-node id=parsing-main-intd:current-node-2>current node</a> is not now a <code id=parsing-main-intd:the-td-element><a href=#the-td-element>td</a></code> element or a <code id=parsing-main-intd:the-th-element><a href=#the-th-element>th</a></code>
- element, then this is a <a href=#parse-error id=parsing-main-intd:parse-error-6>parse error</a>.<li><p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements-5>stack of open elements</a> stack until a <code id=parsing-main-intd:the-td-element-2><a href=#the-td-element>td</a></code>
- element or a <code id=parsing-main-intd:the-th-element-2><a href=#the-th-element>th</a></code> element has been popped from the stack.<li><p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-intd:clear-the-list-of-active-formatting-elements-up-to-the-last-marker-2>Clear the list of active formatting elements up to the last marker</a>.<li><p>Switch the <a href=#insertion-mode id=parsing-main-intd:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-intr id=parsing-main-intd:parsing-main-intr-2>in
- row</a>".</ol>
- <p class=note>The <a href=#stack-of-open-elements id=parsing-main-intd:stack-of-open-elements-6>stack of open elements</a> cannot have both a <code id=parsing-main-intd:the-td-element-3><a href=#the-td-element>td</a></code> and a
- <code id=parsing-main-intd:the-th-element-3><a href=#the-th-element>th</a></code> element <a href=#has-an-element-in-table-scope id=parsing-main-intd:has-an-element-in-table-scope-4>in table scope</a> at the
- same time, nor can it have neither when the <a href=#close-the-cell id=parsing-main-intd:close-the-cell-3>close the cell</a> algorithm is invoked.</p>
- <h6 id=parsing-main-inselect>12.2.5.4.16 The "<dfn>in select</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inselect id=parsing-main-inselect:parsing-main-inselect>in
- select</a>" <a href=#insertion-mode id=parsing-main-inselect:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is U+0000 NULL<dd>
- <p><a href=#parse-error id=parsing-main-inselect:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>Any other character token<dd>
- <p><a href=#insert-a-character id=parsing-main-inselect:insert-a-character>Insert the token's character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-inselect:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inselect:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inselect:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-inselect:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-inselect:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "option"<dd>
-
- <p>If the <a href=#current-node id=parsing-main-inselect:current-node>current node</a> is an <code id=parsing-main-inselect:the-option-element><a href=#the-option-element>option</a></code> element, pop that node from the
- <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements>stack of open elements</a>.</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inselect:insert-an-html-element>Insert an HTML element</a> for the token.</p>
- <dt>A start tag whose tag name is "optgroup"<dd>
-
- <p>If the <a href=#current-node id=parsing-main-inselect:current-node-2>current node</a> is an <code id=parsing-main-inselect:the-option-element-2><a href=#the-option-element>option</a></code> element, pop that node from the
- <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-2>stack of open elements</a>.</p>
-
-
- <p>If the <a href=#current-node id=parsing-main-inselect:current-node-3>current node</a> is an <code id=parsing-main-inselect:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element, pop that node from the
- <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-3>stack of open elements</a>.</p>
-
- <p><a href=#insert-an-html-element id=parsing-main-inselect:insert-an-html-element-2>Insert an HTML element</a> for the token.</p>
- <dt>An end tag whose tag name is "optgroup"<dd>
-
- <p>First, if the <a href=#current-node id=parsing-main-inselect:current-node-4>current node</a> is an <code id=parsing-main-inselect:the-option-element-3><a href=#the-option-element>option</a></code> element, and the node
- immediately before it in the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-4>stack of open elements</a> is an <code id=parsing-main-inselect:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code>
- element, then pop the <a href=#current-node id=parsing-main-inselect:current-node-5>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-5>stack of open
- elements</a>.</p>
-
- <p>If the <a href=#current-node id=parsing-main-inselect:current-node-6>current node</a> is an <code id=parsing-main-inselect:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element, then pop that node from
- the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-6>stack of open elements</a>. Otherwise, this is a <a href=#parse-error id=parsing-main-inselect:parse-error-3>parse error</a>; ignore
- the token.</p>
- <dt>An end tag whose tag name is "option"<dd>
- <p>If the <a href=#current-node id=parsing-main-inselect:current-node-7>current node</a> is an <code id=parsing-main-inselect:the-option-element-4><a href=#the-option-element>option</a></code> element, then pop that node from
- the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-7>stack of open elements</a>. Otherwise, this is a <a href=#parse-error id=parsing-main-inselect:parse-error-4>parse error</a>; ignore
- the token.</p>
- <dt>An end tag whose tag name is "select"<dd>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-8>stack of open elements</a> does not <a href=#has-an-element-in-select-scope id=parsing-main-inselect:has-an-element-in-select-scope>have a <code>select</code> element in select scope</a>, this is a <a href=#parse-error id=parsing-main-inselect:parse-error-5>parse
- error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-inselect:fragment-case>fragment case</a>)</p>
- <p>Otherwise:</p>
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-9>stack of open elements</a> until a <code id=parsing-main-inselect:the-select-element><a href=#the-select-element>select</a></code> element
- has been popped from the stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselect:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
- <dt>A start tag whose tag name is "select"<dd>
- <p><a href=#parse-error id=parsing-main-inselect:parse-error-6>Parse error</a>.</p>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-10>stack of open elements</a> does not <a href=#has-an-element-in-select-scope id=parsing-main-inselect:has-an-element-in-select-scope-2>have a <code>select</code> element in select scope</a>, ignore the token.
- (<a href=#fragment-case id=parsing-main-inselect:fragment-case-2>fragment case</a>)</p>
- <p>Otherwise:</p>
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-11>stack of open elements</a> until a <code id=parsing-main-inselect:the-select-element-2><a href=#the-select-element>select</a></code> element
- has been popped from the stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselect:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately</a>.</p>
-
- <p class=note>It just gets treated like an end tag.</p>
- <dt>A start tag whose tag name is one of: "input", "keygen", "textarea"<dd>
- <p><a href=#parse-error id=parsing-main-inselect:parse-error-7>Parse error</a>.</p>
-
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-12>stack of open elements</a> does not <a href=#has-an-element-in-select-scope id=parsing-main-inselect:has-an-element-in-select-scope-3>have a <code>select</code> element in select scope</a>, ignore the token.
- (<a href=#fragment-case id=parsing-main-inselect:fragment-case-3>fragment case</a>)</p>
- <p>Otherwise:</p>
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inselect:stack-of-open-elements-13>stack of open elements</a> until a <code id=parsing-main-inselect:the-select-element-3><a href=#the-select-element>select</a></code> element
- has been popped from the stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselect:reset-the-insertion-mode-appropriately-3>Reset the insertion mode appropriately</a>.</p>
-
- <p>Reprocess the token.</p>
- <dt>A start tag whose tag name is one of: "script", "template"<dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inselect:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-inselect:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-inselect:insertion-mode-3>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inselect:using-the-rules-for-3>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-inselect:parsing-main-inbody-2>in body</a>" <a href=#insertion-mode id=parsing-main-inselect:insertion-mode-4>insertion mode</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=parsing-main-inselect:parse-error-8>Parse error</a>. Ignore the token.</p>
- </dl>
- <h6 id=parsing-main-inselectintable>12.2.5.4.17 The "<dfn>in select in table</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inselectintable id=parsing-main-inselectintable:parsing-main-inselectintable>in select in table</a>" <a href=#insertion-mode id=parsing-main-inselectintable:insertion-mode>insertion mode</a>, the user agent must handle the
- token as follows:</p>
- <dl class=switch><dt>A start tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr",
- "td", "th"<dd>
- <p><a href=#parse-error id=parsing-main-inselectintable:parse-error>Parse error</a>.</p>
-
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inselectintable:stack-of-open-elements>stack of open elements</a> until a <code id=parsing-main-inselectintable:the-select-element><a href=#the-select-element>select</a></code> element
- has been popped from the stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselectintable:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
-
- <p>Reprocess the token.</p>
- <dt>An end tag whose tag name is one of: "caption", "table", "tbody", "tfoot", "thead", "tr",
- "td", "th"<dd>
- <p><a href=#parse-error id=parsing-main-inselectintable:parse-error-2>Parse error</a>.</p>
- <p>If the <a href=#stack-of-open-elements id=parsing-main-inselectintable:stack-of-open-elements-2>stack of open elements</a> does not <a href=#has-an-element-in-table-scope id=parsing-main-inselectintable:has-an-element-in-table-scope>have an element in table scope</a> that is an <a href=#html-elements id=parsing-main-inselectintable:html-elements>HTML
- element</a> with the same tag name as that of the token, then ignore the token.</p>
- <p>Otherwise:</p>
-
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-inselectintable:stack-of-open-elements-3>stack of open elements</a> until a <code id=parsing-main-inselectintable:the-select-element-2><a href=#the-select-element>select</a></code> element
- has been popped from the stack.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-inselectintable:reset-the-insertion-mode-appropriately-2>Reset the insertion mode appropriately</a>.</p>
-
- <p>Reprocess the token.</p>
- <dt>Anything else<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inselectintable:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inselect id=parsing-main-inselectintable:parsing-main-inselect>in select</a>" <a href=#insertion-mode id=parsing-main-inselectintable:insertion-mode-2>insertion mode</a>.</p>
- </dl>
- <h6 id=parsing-main-intemplate>12.2.5.4.18 The "<dfn>in template</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-intemplate id=parsing-main-intemplate:parsing-main-intemplate>in
- template</a>" <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token<dt>A comment token<dt>A DOCTYPE token<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intemplate:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-intemplate:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is one of: "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "template", "title"<dt>An end tag whose tag name is "template"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-intemplate:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-intemplate:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-3>insertion mode</a>.</p>
- <dt>A start tag whose tag name is one of: "caption", "colgroup", "tbody", "tfoot", "thead"<dd>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes>stack of template
- insertion modes</a>.</p>
- <p>Push "<a href=#parsing-main-intable id=parsing-main-intemplate:parsing-main-intable>in table</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-2>stack of
- template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-2>current template insertion
- mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-4>insertion mode</a> to "<a href=#parsing-main-intable id=parsing-main-intemplate:parsing-main-intable-2>in
- table</a>", and reprocess the token.</p>
- <dt>A start tag whose tag name is "col"<dd>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-3>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-3>stack of template
- insertion modes</a>.</p>
- <p>Push "<a href=#parsing-main-incolgroup id=parsing-main-intemplate:parsing-main-incolgroup>in column group</a>" onto the
- <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-4>stack of template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-4>current template
- insertion mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-incolgroup id=parsing-main-intemplate:parsing-main-incolgroup-2>in
- column group</a>", and reprocess the token.</p>
- <dt>A start tag whose tag name is "tr"<dd>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-5>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-5>stack of template
- insertion modes</a>.</p>
- <p>Push "<a href=#parsing-main-intbody id=parsing-main-intemplate:parsing-main-intbody>in table body</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-6>stack
- of template insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-6>current template insertion
- mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-6>insertion mode</a> to "<a href=#parsing-main-intbody id=parsing-main-intemplate:parsing-main-intbody-2>in
- table body</a>", and reprocess the token.</p>
- <dt>A start tag whose tag name is one of: "td", "th"<dd>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-7>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-7>stack of template
- insertion modes</a>.</p>
- <p>Push "<a href=#parsing-main-intr id=parsing-main-intemplate:parsing-main-intr>in row</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-8>stack of template
- insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-8>current template insertion mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-7>insertion mode</a> to "<a href=#parsing-main-intr id=parsing-main-intemplate:parsing-main-intr-2>in
- row</a>", and reprocess the token.</p>
- <dt>Any other start tag<dd>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-9>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-9>stack of template
- insertion modes</a>.</p>
- <p>Push "<a href=#parsing-main-inbody id=parsing-main-intemplate:parsing-main-inbody-2>in body</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-10>stack of template
- insertion modes</a> so that it is the new <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-10>current template insertion mode</a>.</p>
- <p>Switch the <a href=#insertion-mode id=parsing-main-intemplate:insertion-mode-8>insertion mode</a> to "<a href=#parsing-main-inbody id=parsing-main-intemplate:parsing-main-inbody-3>in
- body</a>", and reprocess the token.</p>
- <dt>Any other end tag<dd>
- <p><a href=#parse-error id=parsing-main-intemplate:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>An end-of-file token<dd>
- <p>If there is no <code id=parsing-main-intemplate:the-template-element><a href=#the-template-element>template</a></code> element on the <a href=#stack-of-open-elements id=parsing-main-intemplate:stack-of-open-elements>stack of open elements</a>, then
- <a href=#stop-parsing id=parsing-main-intemplate:stop-parsing>stop parsing</a>. (<a href=#fragment-case id=parsing-main-intemplate:fragment-case>fragment case</a>)</p>
- <p>Otherwise, this is a <a href=#parse-error id=parsing-main-intemplate:parse-error-2>parse error</a>.</p>
-
- <p>Pop elements from the <a href=#stack-of-open-elements id=parsing-main-intemplate:stack-of-open-elements-2>stack of open elements</a> until a <code id=parsing-main-intemplate:the-template-element-2><a href=#the-template-element>template</a></code>
- element has been popped from the stack.</p>
- <p><a href=#clear-the-list-of-active-formatting-elements-up-to-the-last-marker id=parsing-main-intemplate:clear-the-list-of-active-formatting-elements-up-to-the-last-marker>Clear the list of active formatting elements up to the last marker</a>.</p>
- <p>Pop the <a href=#current-template-insertion-mode id=parsing-main-intemplate:current-template-insertion-mode-11>current template insertion mode</a> off the <a href=#stack-of-template-insertion-modes id=parsing-main-intemplate:stack-of-template-insertion-modes-11>stack of template
- insertion modes</a>.</p>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-main-intemplate:reset-the-insertion-mode-appropriately>Reset the insertion mode appropriately</a>.</p>
-
- <p>Reprocess the token.</p>
- </dl>
- <h6 id=parsing-main-afterbody>12.2.5.4.19 The "<dfn>after body</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-afterbody id=parsing-main-afterbody:parsing-main-afterbody>after body</a>" <a href=#insertion-mode id=parsing-main-afterbody:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-afterbody:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-afterbody:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-afterbody:insertion-mode-2>insertion mode</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-afterbody:insert-a-comment>Insert a comment</a> as the last child of the first element in the <a href=#stack-of-open-elements id=parsing-main-afterbody:stack-of-open-elements>stack of
- open elements</a> (the <code id=parsing-main-afterbody:the-html-element><a href=#the-html-element>html</a></code> element).</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-afterbody:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-afterbody:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-afterbody:parsing-main-inbody-2>in body</a>" <a href=#insertion-mode id=parsing-main-afterbody:insertion-mode-3>insertion mode</a>.</p>
- <dt>An end tag whose tag name is "html"<dd>
- <p>If the parser was originally created as part of the <a href=#html-fragment-parsing-algorithm id=parsing-main-afterbody:html-fragment-parsing-algorithm>HTML fragment parsing
- algorithm</a>, this is a <a href=#parse-error id=parsing-main-afterbody:parse-error-2>parse error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-afterbody:fragment-case>fragment
- case</a>)</p>
- <p>Otherwise, switch the <a href=#insertion-mode id=parsing-main-afterbody:insertion-mode-4>insertion mode</a> to "<a href=#the-after-after-body-insertion-mode id=parsing-main-afterbody:the-after-after-body-insertion-mode>after after body</a>".</p>
- <dt>An end-of-file token<dd>
- <p><a href=#stop-parsing id=parsing-main-afterbody:stop-parsing>Stop parsing</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=parsing-main-afterbody:parse-error-3>Parse error</a>. Switch the <a href=#insertion-mode id=parsing-main-afterbody:insertion-mode-5>insertion mode</a> to "<a href=#parsing-main-inbody id=parsing-main-afterbody:parsing-main-inbody-3>in body</a>" and reprocess the token.</p>
- </dl>
- <h6 id=parsing-main-inframeset>12.2.5.4.20 The "<dfn>in frameset</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-inframeset id=parsing-main-inframeset:parsing-main-inframeset>in
- frameset</a>" <a href=#insertion-mode id=parsing-main-inframeset:insertion-mode>insertion mode</a>, the user agent must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=parsing-main-inframeset:insert-a-character>Insert the character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-inframeset:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inframeset:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inframeset:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-inframeset:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-inframeset:insertion-mode-2>insertion mode</a>.</p>
- <dt>A start tag whose tag name is "frameset"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inframeset:insert-an-html-element>Insert an HTML element</a> for the token.</p>
- <dt>An end tag whose tag name is "frameset"<dd>
- <p>If the <a href=#current-node id=parsing-main-inframeset:current-node>current node</a> is the root <code id=parsing-main-inframeset:the-html-element><a href=#the-html-element>html</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inframeset:parse-error-2>parse error</a>; ignore the token. (<a href=#fragment-case id=parsing-main-inframeset:fragment-case>fragment case</a>)</p>
- <p>Otherwise, pop the <a href=#current-node id=parsing-main-inframeset:current-node-2>current node</a> from the <a href=#stack-of-open-elements id=parsing-main-inframeset:stack-of-open-elements>stack of open
- elements</a>.</p>
- <p>If the parser was <em>not</em> originally created as part of the <a href=#html-fragment-parsing-algorithm id=parsing-main-inframeset:html-fragment-parsing-algorithm>HTML fragment parsing
- algorithm</a> (<a href=#fragment-case id=parsing-main-inframeset:fragment-case-2>fragment case</a>), and the <a href=#current-node id=parsing-main-inframeset:current-node-3>current node</a> is no longer a
- <code id=parsing-main-inframeset:frameset><a href=#frameset>frameset</a></code> element, then switch the <a href=#insertion-mode id=parsing-main-inframeset:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-afterframeset id=parsing-main-inframeset:parsing-main-afterframeset>after frameset</a>".</p>
- <dt>A start tag whose tag name is "frame"<dd>
- <p><a href=#insert-an-html-element id=parsing-main-inframeset:insert-an-html-element-2>Insert an HTML element</a> for the token. Immediately pop the <a href=#current-node id=parsing-main-inframeset:current-node-4>current
- node</a> off the <a href=#stack-of-open-elements id=parsing-main-inframeset:stack-of-open-elements-2>stack of open elements</a>.</p>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inframeset:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, if it is set.</p>
- <dt>A start tag whose tag name is "noframes"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-inframeset:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-inframeset:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-inframeset:insertion-mode-4>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p>If the <a href=#current-node id=parsing-main-inframeset:current-node-5>current node</a> is not the root <code id=parsing-main-inframeset:the-html-element-2><a href=#the-html-element>html</a></code> element, then this is a
- <a href=#parse-error id=parsing-main-inframeset:parse-error-3>parse error</a>.</p>
- <p class=note>The <a href=#current-node id=parsing-main-inframeset:current-node-6>current node</a> can only be the root
- <code id=parsing-main-inframeset:the-html-element-3><a href=#the-html-element>html</a></code> element in the <a href=#fragment-case id=parsing-main-inframeset:fragment-case-3>fragment case</a>.</p>
- <p><a href=#stop-parsing id=parsing-main-inframeset:stop-parsing>Stop parsing</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=parsing-main-inframeset:parse-error-4>Parse error</a>. Ignore the token.</p>
- </dl>
- <h6 id=parsing-main-afterframeset>12.2.5.4.21 The "<dfn>after frameset</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#parsing-main-afterframeset id=parsing-main-afterframeset:parsing-main-afterframeset>after frameset</a>" <a href=#insertion-mode id=parsing-main-afterframeset:insertion-mode>insertion mode</a>, the user agent must handle the token
- as follows:</p>
-
- <dl class=switch><dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=parsing-main-afterframeset:insert-a-character>Insert the character</a>.</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-afterframeset:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-afterframeset:parse-error>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-afterframeset:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=parsing-main-afterframeset:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=parsing-main-afterframeset:insertion-mode-2>insertion mode</a>.</p>
- <dt>An end tag whose tag name is "html"<dd>
- <p>Switch the <a href=#insertion-mode id=parsing-main-afterframeset:insertion-mode-3>insertion mode</a> to "<a href=#the-after-after-frameset-insertion-mode id=parsing-main-afterframeset:the-after-after-frameset-insertion-mode>after after frameset</a>".</p>
- <dt>A start tag whose tag name is "noframes"<dd>
- <p>Process the token <a href=#using-the-rules-for id=parsing-main-afterframeset:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=parsing-main-afterframeset:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=parsing-main-afterframeset:insertion-mode-4>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p><a href=#stop-parsing id=parsing-main-afterframeset:stop-parsing>Stop parsing</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=parsing-main-afterframeset:parse-error-2>Parse error</a>. Ignore the token.</p>
- </dl>
- <h6 id=the-after-after-body-insertion-mode>12.2.5.4.22 The "<dfn>after after body</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-after-after-body-insertion-mode id=the-after-after-body-insertion-mode:the-after-after-body-insertion-mode>after after body</a>" <a href=#insertion-mode id=the-after-after-body-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the token
- as follows:</p>
- <dl class=switch><dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-after-after-body-insertion-mode:insert-a-comment>Insert a comment</a> as the last child of the <code id=the-after-after-body-insertion-mode:document><a href=#document>Document</a></code> object.</p>
- <dt>A DOCTYPE token<dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-after-after-body-insertion-mode:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=the-after-after-body-insertion-mode:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=the-after-after-body-insertion-mode:insertion-mode-2>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p><a href=#stop-parsing id=the-after-after-body-insertion-mode:stop-parsing>Stop parsing</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=the-after-after-body-insertion-mode:parse-error>Parse error</a>. Switch the <a href=#insertion-mode id=the-after-after-body-insertion-mode:insertion-mode-3>insertion mode</a> to "<a href=#parsing-main-inbody id=the-after-after-body-insertion-mode:parsing-main-inbody-2>in body</a>" and reprocess the token.</p>
- </dl>
- <h6 id=the-after-after-frameset-insertion-mode>12.2.5.4.23 The "<dfn>after after frameset</dfn>" insertion mode</h6>
- <p>When the user agent is to apply the rules for the "<a href=#the-after-after-frameset-insertion-mode id=the-after-after-frameset-insertion-mode:the-after-after-frameset-insertion-mode>after after frameset</a>" <a href=#insertion-mode id=the-after-after-frameset-insertion-mode:insertion-mode>insertion mode</a>, the user agent must handle the
- token as follows:</p>
- <dl class=switch><dt>A comment token<dd>
- <p><a href=#insert-a-comment id=the-after-after-frameset-insertion-mode:insert-a-comment>Insert a comment</a> as the last child of the <code id=the-after-after-frameset-insertion-mode:document><a href=#document>Document</a></code> object.</p>
- <dt>A DOCTYPE token<dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dt>A start tag whose tag name is "html"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-after-after-frameset-insertion-mode:using-the-rules-for>using the rules for</a> the "<a href=#parsing-main-inbody id=the-after-after-frameset-insertion-mode:parsing-main-inbody>in body</a>" <a href=#insertion-mode id=the-after-after-frameset-insertion-mode:insertion-mode-2>insertion mode</a>.</p>
- <dt>An end-of-file token<dd>
- <p><a href=#stop-parsing id=the-after-after-frameset-insertion-mode:stop-parsing>Stop parsing</a>.</p>
- <dt>A start tag whose tag name is "noframes"<dd>
- <p>Process the token <a href=#using-the-rules-for id=the-after-after-frameset-insertion-mode:using-the-rules-for-2>using the rules for</a> the "<a href=#parsing-main-inhead id=the-after-after-frameset-insertion-mode:parsing-main-inhead>in head</a>" <a href=#insertion-mode id=the-after-after-frameset-insertion-mode:insertion-mode-3>insertion mode</a>.</p>
- <dt>Anything else<dd>
- <p><a href=#parse-error id=the-after-after-frameset-insertion-mode:parse-error>Parse error</a>. Ignore the token.</p>
- </dl>
- <h5 id=parsing-main-inforeign>12.2.5.5 The rules for parsing tokens <dfn>in foreign content</dfn></h5>
- <p>When the user agent is to apply the rules for parsing tokens in foreign content, the user agent
- must handle the token as follows:</p>
- <dl class=switch><dt>A character token that is U+0000 NULL<dd>
- <p><a href=#parse-error id=parsing-main-inforeign:parse-error>Parse error</a>. <a href=#insert-a-character id=parsing-main-inforeign:insert-a-character>Insert a U+FFFD REPLACEMENT
- CHARACTER character</a>.</p>
- <dt>A character token that is one of U+0009 CHARACTER TABULATION, U+000A LINE FEED (LF), U+000C
- FORM FEED (FF), U+000D CARRIAGE RETURN (CR), or U+0020 SPACE<dd>
- <p><a href=#insert-a-character id=parsing-main-inforeign:insert-a-character-2>Insert the token's character</a>.</p>
- <dt>Any other character token<dd>
- <p><a href=#insert-a-character id=parsing-main-inforeign:insert-a-character-3>Insert the token's character</a>.</p>
- <p>Set the <a href=#frameset-ok-flag id=parsing-main-inforeign:frameset-ok-flag>frameset-ok flag</a> to "not ok".</p>
- <dt>A comment token<dd>
- <p><a href=#insert-a-comment id=parsing-main-inforeign:insert-a-comment>Insert a comment</a>.</p>
- <dt>A DOCTYPE token<dd>
- <p><a href=#parse-error id=parsing-main-inforeign:parse-error-2>Parse error</a>. Ignore the token.</p>
- <dt>A start tag whose tag name is one of: "b", "big", "blockquote", "body", "br", "center", "code", "dd", "div", "dl", "dt", "em", "embed", "h1", "h2", "h3", "h4", "h5", "h6", "head", "hr", "i", "img",
- "li", "listing",
- "menu", "meta", "nobr", "ol", "p", "pre", "ruby", "s", "small", "span", "strong", "strike", "sub",
- "sup", "table", "tt", "u", "ul", "var"<dt>A start tag whose tag name is "font", if the token has any attributes named "color", "face",
- or "size"<dd>
- <p><a href=#parse-error id=parsing-main-inforeign:parse-error-3>Parse error</a>.</p>
-
- <p>If the parser was originally created for the <a href=#html-fragment-parsing-algorithm id=parsing-main-inforeign:html-fragment-parsing-algorithm>HTML fragment parsing algorithm</a>,
- then act as described in the "any other start tag" entry below. (<a href=#fragment-case id=parsing-main-inforeign:fragment-case>fragment case</a>)</p>
- <p>Otherwise:</p>
- <p>Pop an element from the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements>stack of open elements</a>, and then keep popping more
- elements from the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-2>stack of open elements</a> until the <a href=#current-node id=parsing-main-inforeign:current-node>current node</a> is a
- <a href=#mathml-text-integration-point id=parsing-main-inforeign:mathml-text-integration-point>MathML text integration point</a>, an <a href=#html-integration-point id=parsing-main-inforeign:html-integration-point>HTML integration point</a>, or an
- element in the <a href=#html-namespace-2 id=parsing-main-inforeign:html-namespace-2>HTML namespace</a>.</p>
- <p>Then, reprocess the token.</p>
- <dt>Any other start tag<dd>
- <p>If the <a href=#adjusted-current-node id=parsing-main-inforeign:adjusted-current-node>adjusted current node</a> is an element in the <a href=#mathml-namespace id=parsing-main-inforeign:mathml-namespace>MathML namespace</a>,
- <a href=#adjust-mathml-attributes id=parsing-main-inforeign:adjust-mathml-attributes>adjust MathML attributes</a> for the token. (This fixes the case of MathML attributes
- that are not all lowercase.)</p>
- <p>If the <a href=#adjusted-current-node id=parsing-main-inforeign:adjusted-current-node-2>adjusted current node</a> is an element in the <a href=#svg-namespace id=parsing-main-inforeign:svg-namespace>SVG namespace</a>, and the
- token's tag name is one of the ones in the first column of the following table, change the tag
- name to the name given in the corresponding cell in the second column. (This fixes the case of
- SVG elements that are not all lowercase.)</p>
- <table><thead><tr><th> Tag name <th> Element name
- <tbody><tr><td> <code>altglyph</code> <td> <code>altGlyph</code>
- <tr><td> <code>altglyphdef</code> <td> <code>altGlyphDef</code>
- <tr><td> <code>altglyphitem</code> <td> <code>altGlyphItem</code>
- <tr><td> <code>animatecolor</code> <td> <code>animateColor</code>
- <tr><td> <code>animatemotion</code> <td> <code>animateMotion</code>
- <tr><td> <code>animatetransform</code> <td> <code>animateTransform</code>
- <tr><td> <code>clippath</code> <td> <code>clipPath</code>
- <tr><td> <code>feblend</code> <td> <code>feBlend</code>
- <tr><td> <code>fecolormatrix</code> <td> <code>feColorMatrix</code>
- <tr><td> <code>fecomponenttransfer</code> <td> <code>feComponentTransfer</code>
- <tr><td> <code>fecomposite</code> <td> <code>feComposite</code>
- <tr><td> <code>feconvolvematrix</code> <td> <code>feConvolveMatrix</code>
- <tr><td> <code>fediffuselighting</code> <td> <code>feDiffuseLighting</code>
- <tr><td> <code>fedisplacementmap</code> <td> <code>feDisplacementMap</code>
- <tr><td> <code>fedistantlight</code> <td> <code>feDistantLight</code>
- <tr><td> <code>fedropshadow</code> <td> <code>feDropShadow</code>
- <tr><td> <code>feflood</code> <td> <code>feFlood</code>
- <tr><td> <code>fefunca</code> <td> <code>feFuncA</code>
- <tr><td> <code>fefuncb</code> <td> <code>feFuncB</code>
- <tr><td> <code>fefuncg</code> <td> <code>feFuncG</code>
- <tr><td> <code>fefuncr</code> <td> <code>feFuncR</code>
- <tr><td> <code>fegaussianblur</code> <td> <code>feGaussianBlur</code>
- <tr><td> <code>feimage</code> <td> <code>feImage</code>
- <tr><td> <code>femerge</code> <td> <code>feMerge</code>
- <tr><td> <code>femergenode</code> <td> <code>feMergeNode</code>
- <tr><td> <code>femorphology</code> <td> <code>feMorphology</code>
- <tr><td> <code>feoffset</code> <td> <code>feOffset</code>
- <tr><td> <code>fepointlight</code> <td> <code>fePointLight</code>
- <tr><td> <code>fespecularlighting</code> <td> <code>feSpecularLighting</code>
- <tr><td> <code>fespotlight</code> <td> <code>feSpotLight</code>
- <tr><td> <code>fetile</code> <td> <code>feTile</code>
- <tr><td> <code>feturbulence</code> <td> <code>feTurbulence</code>
- <tr><td> <code>foreignobject</code> <td> <code>foreignObject</code>
- <tr><td> <code>glyphref</code> <td> <code>glyphRef</code>
- <tr><td> <code>lineargradient</code> <td> <code>linearGradient</code>
- <tr><td> <code>radialgradient</code> <td> <code>radialGradient</code>
-
- <tr><td> <code>textpath</code> <td> <code>textPath</code>
- </table>
- <p>If the <a href=#adjusted-current-node id=parsing-main-inforeign:adjusted-current-node-3>adjusted current node</a> is an element in the <a href=#svg-namespace id=parsing-main-inforeign:svg-namespace-2>SVG namespace</a>,
- <a href=#adjust-svg-attributes id=parsing-main-inforeign:adjust-svg-attributes>adjust SVG attributes</a> for the token. (This fixes the case of SVG attributes that
- are not all lowercase.)</p>
- <p><a href=#adjust-foreign-attributes id=parsing-main-inforeign:adjust-foreign-attributes>Adjust foreign attributes</a> for the token. (This fixes the use of namespaced
- attributes, in particular XLink in SVG.)</p>
- <p><a href=#insert-a-foreign-element id=parsing-main-inforeign:insert-a-foreign-element>Insert a foreign element</a> for the token, in the same namespace as the
- <a href=#adjusted-current-node id=parsing-main-inforeign:adjusted-current-node-4>adjusted current node</a>.</p>
- <p>If the token has its <i id=parsing-main-inforeign:self-closing-flag><a href=#self-closing-flag>self-closing flag</a></i> set, then run the appropriate steps from the
- following list:</p>
- <dl class=switch><dt>If the token's tag name is "script", and the new <a href=#current-node id=parsing-main-inforeign:current-node-2>current node</a> is in the <a href=#svg-namespace id=parsing-main-inforeign:svg-namespace-3>SVG namespace</a><dd>
- <p><a href=#acknowledge-self-closing-flag id=parsing-main-inforeign:acknowledge-self-closing-flag>Acknowledge the token's <i>self-closing
- flag</i></a>, and then act as described in the steps for a "script" end tag below.</p>
- <dt>Otherwise<dd>
- <p>Pop the <a href=#current-node id=parsing-main-inforeign:current-node-3>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-3>stack of open elements</a> and <a href=#acknowledge-self-closing-flag id=parsing-main-inforeign:acknowledge-self-closing-flag-2>acknowledge the token's <i>self-closing
- flag</i></a>.</p>
- </dl>
- <dt id=scriptForeignEndTag>An end tag whose tag name is "script", if the <a href=#current-node id=parsing-main-inforeign:current-node-4>current node</a> is a <code>script</code> element in the <a href=#svg-namespace id=parsing-main-inforeign:svg-namespace-4>SVG namespace</a><dd>
- <p>Pop the <a href=#current-node id=parsing-main-inforeign:current-node-5>current node</a> off the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-4>stack of open elements</a>.</p>
- <p>Let the <var>old insertion point</var> have the same value as the current
- <a href=#insertion-point id=parsing-main-inforeign:insertion-point>insertion point</a>. Let the <a href=#insertion-point id=parsing-main-inforeign:insertion-point-2>insertion point</a> be just before the <a href=#next-input-character id=parsing-main-inforeign:next-input-character>next
- input character</a>.</p>
- <p>Increment the parser's <a href=#script-nesting-level id=parsing-main-inforeign:script-nesting-level>script nesting level</a> by one. Set the <a href=#parser-pause-flag id=parsing-main-inforeign:parser-pause-flag>parser pause
- flag</a> to true.</p>
- <p><a href=http://www.w3.org/TR/SVGMobile12/script.html#ScriptContentProcessing>Process the
- <code>script</code> element</a> according to the SVG rules, if the user agent supports
- SVG. <a href=#refsSVG>[SVG]</a></p>
- <p class=note>Even if this causes <a href=#dom-document-write id=parsing-main-inforeign:dom-document-write>new characters to be
- inserted into the tokenizer</a>, the parser will not be executed reentrantly, since the
- <a href=#parser-pause-flag id=parsing-main-inforeign:parser-pause-flag-2>parser pause flag</a> is true.</p>
- <p>Decrement the parser's <a href=#script-nesting-level id=parsing-main-inforeign:script-nesting-level-2>script nesting level</a> by one. If the parser's <a href=#script-nesting-level id=parsing-main-inforeign:script-nesting-level-3>script
- nesting level</a> is zero, then set the <a href=#parser-pause-flag id=parsing-main-inforeign:parser-pause-flag-3>parser pause flag</a> to false.</p>
- <p>Let the <a href=#insertion-point id=parsing-main-inforeign:insertion-point-3>insertion point</a> have the value of the <var>old insertion
- point</var>. (In other words, restore the <a href=#insertion-point id=parsing-main-inforeign:insertion-point-4>insertion point</a> to its previous value.
- This value might be the "undefined" value.)</p>
- <dt>Any other end tag<dd>
- <p>Run these steps:</p>
- <ol><li><p>Initialise <var>node</var> to be the <a href=#current-node id=parsing-main-inforeign:current-node-6>current node</a> (the bottommost
- node of the stack).<li><p>If <var>node</var>'s tag name, <a href=#converted-to-ascii-lowercase id=parsing-main-inforeign:converted-to-ascii-lowercase>converted to ASCII lowercase</a>, is
- not the same as the tag name of the token, then this is a <a href=#parse-error id=parsing-main-inforeign:parse-error-4>parse error</a>.<li><p><i>Loop</i>: If <var>node</var> is the topmost element in the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-5>stack of
- open elements</a>, abort these steps. (<a href=#fragment-case id=parsing-main-inforeign:fragment-case-2>fragment case</a>)<li><p>If <var>node</var>'s tag name, <a href=#converted-to-ascii-lowercase id=parsing-main-inforeign:converted-to-ascii-lowercase-2>converted to ASCII lowercase</a>, is
- the same as the tag name of the token, pop elements from the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-6>stack of open
- elements</a> until <var>node</var> has been popped from the stack, and then abort
- these steps.<li><p>Set <var>node</var> to the previous entry in the <a href=#stack-of-open-elements id=parsing-main-inforeign:stack-of-open-elements-7>stack of open
- elements</a>.<li><p>If <var>node</var> is not an element in the <a href=#html-namespace-2 id=parsing-main-inforeign:html-namespace-2-2>HTML namespace</a>, return
- to the step labeled <i>loop</i>.<li><p>Otherwise, process the token according to the rules given in the section corresponding
- to the current <a href=#insertion-mode id=parsing-main-inforeign:insertion-mode>insertion mode</a> in HTML content.</ol>
- </dl>
-
-
- <h4 id=the-end>12.2.6 The end</h4>
- <p>Once the user agent <dfn id=stop-parsing>stops parsing</dfn> the document, the user agent
- must run the following steps:</p>
- <ol><li><p>Set the <a href=#current-document-readiness id=the-end:current-document-readiness>current document readiness</a> to "<code>interactive</code>"
- and the <a href=#insertion-point id=the-end:insertion-point>insertion point</a> to
- undefined.<li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements id=the-end:stack-of-open-elements>stack of open elements</a>.<li><p>If the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing id=the-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing>list of scripts that will execute when the document has finished
- parsing</a> is not empty, run these substeps:</p>
- <ol><li><p><a href=#spin-the-event-loop id=the-end:spin-the-event-loop>Spin the event loop</a> until the first <code id=the-end:the-script-element><a href=#the-script-element>script</a></code> in the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing id=the-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-2>list
- of scripts that will execute when the document has finished parsing</a> has its <a href=#ready-to-be-parser-executed id=the-end:ready-to-be-parser-executed>"ready
- to be parser-executed"</a> flag set <em>and</em> the parser's <code id=the-end:document><a href=#document>Document</a></code>
- <a href=#has-no-style-sheet-that-is-blocking-scripts id=the-end:has-no-style-sheet-that-is-blocking-scripts>has no style sheet that is blocking scripts</a>.<li><p><a href=#execute-the-script-block id=the-end:execute-the-script-block>Execute</a> the first <code id=the-end:the-script-element-2><a href=#the-script-element>script</a></code> in
- the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing id=the-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-3>list of scripts that will execute when the document has finished
- parsing</a>.<li><p>Remove the first <code id=the-end:the-script-element-3><a href=#the-script-element>script</a></code> element from the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing id=the-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-4>list of scripts that will
- execute when the document has finished parsing</a> (i.e. shift out the first entry in the
- list).<li><p>If the <a href=#list-of-scripts-that-will-execute-when-the-document-has-finished-parsing id=the-end:list-of-scripts-that-will-execute-when-the-document-has-finished-parsing-5>list of scripts that will execute when the document has finished
- parsing</a> is still not empty, repeat these substeps again from substep 1.</p>
- </ol>
- <li><p><a href=#queue-a-task id=the-end:queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event id=the-end:fire-a-simple-event>fire a simple event</a> that bubbles named <code id=the-end:event-domcontentloaded><a href=#event-domcontentloaded>DOMContentLoaded</a></code> at the <code id=the-end:document-2><a href=#document>Document</a></code>.<li><p><a href=#spin-the-event-loop id=the-end:spin-the-event-loop-2>Spin the event loop</a> until the <a href=#set-of-scripts-that-will-execute-as-soon-as-possible id=the-end:set-of-scripts-that-will-execute-as-soon-as-possible>set of scripts that will execute as soon
- as possible</a> and the <a href=#list-of-scripts-that-will-execute-in-order-as-soon-as-possible id=the-end:list-of-scripts-that-will-execute-in-order-as-soon-as-possible>list of scripts that will execute in order as soon as
- possible</a> are empty.<li><p><a href=#spin-the-event-loop id=the-end:spin-the-event-loop-3>Spin the event loop</a> until there is nothing that <dfn id=delay-the-load-event>delays the load event</dfn> in the <code id=the-end:document-3><a href=#document>Document</a></code>.<li>
- <p><a href=#queue-a-task id=the-end:queue-a-task-2>Queue a task</a> to run the following substeps:</p>
- <ol><li><p>Set the <a href=#current-document-readiness id=the-end:current-document-readiness-2>current document readiness</a> to "<code>complete</code>".<li><p><i>Load event</i>: If the <code id=the-end:document-4><a href=#document>Document</a></code> is in a <a href=#browsing-context id=the-end:browsing-context>browsing context</a>,
- <a href=#fire-a-simple-event id=the-end:fire-a-simple-event-2>fire a simple event</a> named <code id=the-end:event-load><a href=#event-load>load</a></code> at the
- <code id=the-end:document-5><a href=#document>Document</a></code>'s <code id=the-end:window><a href=#window>Window</a></code> object, with <i id=the-end:concept-event-target-override><a href=#concept-event-target-override>target override</a></i> set to the <code id=the-end:document-6><a href=#document>Document</a></code>
- object.</ol>
- <li>
- <p>If the <code id=the-end:document-7><a href=#document>Document</a></code> is in a <a href=#browsing-context id=the-end:browsing-context-2>browsing context</a>, then <a href=#queue-a-task id=the-end:queue-a-task-3>queue a
- task</a> to run the following substeps:</p>
- <ol><li><p>If the <code id=the-end:document-8><a href=#document>Document</a></code>'s <a href=#page-showing id=the-end:page-showing>page showing</a> flag is true, then abort this
- task (i.e. don't fire the event below).<li><p>Set the <code id=the-end:document-9><a href=#document>Document</a></code>'s <a href=#page-showing id=the-end:page-showing-2>page showing</a> flag to true.<li><p><a href=#concept-event-fire id=the-end:concept-event-fire>Fire</a> a <a href=#concept-events-trusted id=the-end:concept-events-trusted>trusted</a> event with the name <code id=the-end:event-pageshow><a href=#event-pageshow>pageshow</a></code> at the <code id=the-end:window-2><a href=#window>Window</a></code> object of the
- <code id=the-end:document-10><a href=#document>Document</a></code>, with <i id=the-end:concept-event-target-override-2><a href=#concept-event-target-override>target override</a></i> set to the <code id=the-end:document-11><a href=#document>Document</a></code>
- object,
- using the <code id=the-end:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code> interface, with the <code id=the-end:dom-pagetransitionevent-persisted><a href=#dom-pagetransitionevent-persisted>persisted</a></code> attribute initialised to false. This
- event must not bubble, must not be cancelable, and has no default action.</ol>
- <li><p>If the <code id=the-end:document-12><a href=#document>Document</a></code> has any <a href=#pending-application-cache-download-process-tasks id=the-end:pending-application-cache-download-process-tasks>pending application cache download process
- tasks</a>, then <a href=#queue-a-task id=the-end:queue-a-task-4>queue</a> each such <a href=#concept-task id=the-end:concept-task>task</a> in the order they were added to the list of <a href=#pending-application-cache-download-process-tasks id=the-end:pending-application-cache-download-process-tasks-2>pending
- application cache download process tasks</a>, and then empty the list of <a href=#pending-application-cache-download-process-tasks id=the-end:pending-application-cache-download-process-tasks-3>pending
- application cache download process tasks</a>. The <a href=#task-source id=the-end:task-source>task source</a> for these <a href=#concept-task id=the-end:concept-task-2>tasks</a> is the <a href=#networking-task-source id=the-end:networking-task-source>networking task source</a>.<li><p>If the <code id=the-end:document-13><a href=#document>Document</a></code>'s <a href=#print-when-loaded id=the-end:print-when-loaded>print when loaded</a> flag is set, then run the
- <a href=#printing-steps id=the-end:printing-steps>printing steps</a>.<li><p>The <code id=the-end:document-14><a href=#document>Document</a></code> is now <dfn id=ready-for-post-load-tasks>ready for post-load tasks</dfn>.<li><p><a href=#queue-a-task id=the-end:queue-a-task-5>Queue a task</a> to mark the <code id=the-end:document-15><a href=#document>Document</a></code> as <dfn id=completely-loaded>completely
- loaded</dfn>.</ol>
- <p>When the user agent is to <dfn id=abort-a-parser>abort a parser</dfn>, it must run the following steps:</p>
- <ol><li><p>Throw away any pending content in the <a href=#input-stream id=the-end:input-stream>input stream</a>, and discard any future
- content that would have been added to it.<li><p>Set the <a href=#current-document-readiness id=the-end:current-document-readiness-3>current document readiness</a> to "<code>interactive</code>".<li><p>Pop <em>all</em> the nodes off the <a href=#stack-of-open-elements id=the-end:stack-of-open-elements-2>stack of open elements</a>.<li><p>Set the <a href=#current-document-readiness id=the-end:current-document-readiness-4>current document readiness</a> to "<code>complete</code>".</ol>
- <p>Except where otherwise specified, the <a href=#task-source id=the-end:task-source-2>task source</a> for the <a href=#concept-task id=the-end:concept-task-3>tasks</a> mentioned in this section is the <a href=#dom-manipulation-task-source id=the-end:dom-manipulation-task-source>DOM manipulation task
- source</a>.</p>
-
-
- <h4 id=coercing-an-html-dom-into-an-infoset>12.2.7 Coercing an HTML DOM into an infoset</h4>
- <p>When an application uses an <a href=#html-parser id=coercing-an-html-dom-into-an-infoset:html-parser>HTML parser</a> in conjunction with an XML pipeline, it is
- possible that the constructed DOM is not compatible with the XML tool chain in certain subtle
- ways. For example, an XML toolchain might not be able to represent attributes with the name <code>xmlns</code>, since they conflict with the Namespaces in XML syntax. There is also some
- data that the <a href=#html-parser id=coercing-an-html-dom-into-an-infoset:html-parser-2>HTML parser</a> generates that isn't included in the DOM itself. This
- section specifies some rules for handling these issues.</p>
- <p>If the XML API being used doesn't support DOCTYPEs, the tool may drop DOCTYPEs altogether.</p>
- <p>If the XML API doesn't support attributes in no namespace that are named "<code>xmlns</code>", attributes whose names start with "<code>xmlns:</code>", or
- attributes in the <a href=#xmlns-namespace id=coercing-an-html-dom-into-an-infoset:xmlns-namespace>XMLNS namespace</a>, then the tool may drop such attributes.</p>
- <p>The tool may annotate the output with any namespace declarations required for proper
- operation.</p>
- <p>If the XML API being used restricts the allowable characters in the local names of elements and
- attributes, then the tool may map all element and attribute local names that the API wouldn't
- support to a set of names that <em>are</em> allowed, by replacing any character that isn't
- supported with the uppercase letter U and the six digits of the character's Unicode code point
- when expressed in hexadecimal, using digits 0-9 and capital letters A-F as the symbols, in
- increasing numeric order.</p>
- <p class=example>For example, the element name <code>foo<bar</code>, which can be
- output by the <a href=#html-parser id=coercing-an-html-dom-into-an-infoset:html-parser-3>HTML parser</a>, though it is neither a legal HTML element name nor a
- well-formed XML element name, would be converted into <code>fooU00003Cbar</code>, which
- <em>is</em> a well-formed XML element name (though it's still not legal in HTML by any means).</p>
- <p class=example>As another example, consider the attribute <code>xlink:href</code>.
- Used on a MathML element, it becomes, after being <a href=#adjust-foreign-attributes id=coercing-an-html-dom-into-an-infoset:adjust-foreign-attributes>adjusted</a>, an attribute with a prefix "<code>xlink</code>" and a local
- name "<code>href</code>". However, used on an HTML element, it becomes an attribute with
- no prefix and the local name "<code>xlink:href</code>", which is not a valid NCName, and
- thus might not be accepted by an XML API. It could thus get converted, becoming "<code>xlinkU00003Ahref</code>".</p>
- <p class=note>The resulting names from this conversion conveniently can't clash with any
- attribute generated by the <a href=#html-parser id=coercing-an-html-dom-into-an-infoset:html-parser-4>HTML parser</a>, since those are all either lowercase or those
- listed in the <a href=#adjust-foreign-attributes id=coercing-an-html-dom-into-an-infoset:adjust-foreign-attributes-2>adjust foreign attributes</a> algorithm's table.</p>
- <p>If the XML API restricts comments from having two consecutive U+002D HYPHEN-MINUS characters
- (--), the tool may insert a single U+0020 SPACE character between any such offending
- characters.</p>
- <p>If the XML API restricts comments from ending in a U+002D HYPHEN-MINUS character (-), the tool
- may insert a single U+0020 SPACE character at the end of such comments.</p>
- <p>If the XML API restricts allowed characters in character data, attribute values, or comments,
- the tool may replace any U+000C FORM FEED (FF) character with a U+0020 SPACE character, and any
- other literal non-XML character with a U+FFFD REPLACEMENT CHARACTER.</p>
- <p>If the tool has no way to convey out-of-band information, then the tool may drop the following
- information:</p>
- <ul><li>Whether the document is set to <i id=coercing-an-html-dom-into-an-infoset:no-quirks-mode><a href=#no-quirks-mode>no-quirks mode</a></i>, <i id=coercing-an-html-dom-into-an-infoset:limited-quirks-mode><a href=#limited-quirks-mode>limited-quirks mode</a></i>, or
- <i id=coercing-an-html-dom-into-an-infoset:quirks-mode><a href=#quirks-mode>quirks mode</a></i><li>The association between form controls and forms that aren't their nearest <code id=coercing-an-html-dom-into-an-infoset:the-form-element><a href=#the-form-element>form</a></code>
- element ancestor (use of the <a href=#form-element-pointer id=coercing-an-html-dom-into-an-infoset:form-element-pointer><code>form</code> element pointer</a> in the parser)<li>The <a href=#template-contents id=coercing-an-html-dom-into-an-infoset:template-contents>template contents</a> of any <code id=coercing-an-html-dom-into-an-infoset:the-template-element><a href=#the-template-element>template</a></code> elements.</ul>
- <p class=note>The mutations allowed by this section apply <em>after</em> the <a href=#html-parser id=coercing-an-html-dom-into-an-infoset:html-parser-5>HTML
- parser</a>'s rules have been applied. For example, a <code><a::></code> start tag
- will be closed by a <code></a::></code> end tag, and never by a <code></aU00003AU00003A></code> end tag, even if the user agent is using the rules above to
- then generate an actual element in the DOM with the name <code>aU00003AU00003A</code> for
- that start tag.</p>
-
-
- <h4 id=an-introduction-to-error-handling-and-strange-cases-in-the-parser>12.2.8 An introduction to error handling and strange cases in the parser</h4>
- <p><i>This section is non-normative.</i></p>
- <p>This section examines some erroneous markup and discusses how the <a href=#html-parser id=an-introduction-to-error-handling-and-strange-cases-in-the-parser:html-parser>HTML parser</a>
- handles these cases.</p>
- <h5 id=misnested-tags:-b-i-/b-/i>12.2.8.1 Misnested tags: <b><i></b></i></h5>
- <p><i>This section is non-normative.</i></p>
- <p>The most-often discussed example of erroneous markup is as follows:</p>
- <pre><p>1<b>2<i>3</b>4</i>5</p></pre>
- <p>The parsing of this markup is straightforward up to the "3". At this point, the DOM looks like
- this:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-head-element><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-p-element><a href=#the-p-element>p</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text><a href=#text>#text</a></code>: <span>1</span><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-b-element><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-2><a href=#text>#text</a></code>: <span>2</span><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-i-element><a href=#the-i-element>i</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-3><a href=#text>#text</a></code>: <span>3</span></ul></ul></ul></ul></ul></ul>
- <p>Here, the <a href=#stack-of-open-elements id=misnested-tags:-b-i-/b-/i:stack-of-open-elements>stack of open elements</a> has five elements on it: <code id=misnested-tags:-b-i-/b-/i:the-html-element-2><a href=#the-html-element>html</a></code>,
- <code id=misnested-tags:-b-i-/b-/i:the-body-element-2><a href=#the-body-element>body</a></code>, <code id=misnested-tags:-b-i-/b-/i:the-p-element-2><a href=#the-p-element>p</a></code>, <code id=misnested-tags:-b-i-/b-/i:the-b-element-2><a href=#the-b-element>b</a></code>, and <code id=misnested-tags:-b-i-/b-/i:the-i-element-2><a href=#the-i-element>i</a></code>. The <a href=#list-of-active-formatting-elements id=misnested-tags:-b-i-/b-/i:list-of-active-formatting-elements>list of active
- formatting elements</a> just has two: <code id=misnested-tags:-b-i-/b-/i:the-b-element-3><a href=#the-b-element>b</a></code> and <code id=misnested-tags:-b-i-/b-/i:the-i-element-3><a href=#the-i-element>i</a></code>. The <a href=#insertion-mode id=misnested-tags:-b-i-/b-/i:insertion-mode>insertion
- mode</a> is "<a href=#parsing-main-inbody id=misnested-tags:-b-i-/b-/i:parsing-main-inbody>in body</a>".</p>
- <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption
- agency algorithm</a>" is invoked. This is a simple case, in that the <var>formatting
- element</var> is the <code id=misnested-tags:-b-i-/b-/i:the-b-element-4><a href=#the-b-element>b</a></code> element, and there is no <var>furthest block</var>.
- Thus, the <a href=#stack-of-open-elements id=misnested-tags:-b-i-/b-/i:stack-of-open-elements-2>stack of open elements</a> ends up with just three elements: <code id=misnested-tags:-b-i-/b-/i:the-html-element-3><a href=#the-html-element>html</a></code>,
- <code id=misnested-tags:-b-i-/b-/i:the-body-element-3><a href=#the-body-element>body</a></code>, and <code id=misnested-tags:-b-i-/b-/i:the-p-element-3><a href=#the-p-element>p</a></code>, while the <a href=#list-of-active-formatting-elements id=misnested-tags:-b-i-/b-/i:list-of-active-formatting-elements-2>list of active formatting elements</a>
- has just one: <code id=misnested-tags:-b-i-/b-/i:the-i-element-4><a href=#the-i-element>i</a></code>. The DOM tree is unmodified at this point.</p>
- <p>The next token is a character ("4"), triggers the <a href=#reconstruct-the-active-formatting-elements id=misnested-tags:-b-i-/b-/i:reconstruct-the-active-formatting-elements>reconstruction of the active formatting elements</a>, in this case just
- the <code id=misnested-tags:-b-i-/b-/i:the-i-element-5><a href=#the-i-element>i</a></code> element. A new <code id=misnested-tags:-b-i-/b-/i:the-i-element-6><a href=#the-i-element>i</a></code> element is thus created for the "4"
- <code id=misnested-tags:-b-i-/b-/i:text-4><a href=#text>Text</a></code> node. After the end tag token for the "i" is also received, and the "5"
- <code id=misnested-tags:-b-i-/b-/i:text-5><a href=#text>Text</a></code> node is inserted, the DOM looks as follows:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-html-element-4><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-head-element-2><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-body-element-4><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-p-element-4><a href=#the-p-element>p</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-6><a href=#text>#text</a></code>: <span>1</span><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-b-element-5><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-7><a href=#text>#text</a></code>: <span>2</span><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-i-element-7><a href=#the-i-element>i</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-8><a href=#text>#text</a></code>: <span>3</span></ul></ul><li class=t1><code id=misnested-tags:-b-i-/b-/i:the-i-element-8><a href=#the-i-element>i</a></code><ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-9><a href=#text>#text</a></code>: <span>4</span></ul><li class=t3><code id=misnested-tags:-b-i-/b-/i:text-10><a href=#text>#text</a></code>: <span>5</span></ul></ul></ul></ul>
- <h5 id=misnested-tags:-b-p-/b-/p>12.2.8.2 Misnested tags: <b><p></b></p></h5>
- <p><i>This section is non-normative.</i></p>
- <p>A case similar to the previous one is the following:</p>
- <pre><b>1<p>2</b>3</p></pre>
- <p>Up to the "2" the parsing here is straightforward:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-head-element><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text><a href=#text>#text</a></code>: <span>1</span><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-p-element><a href=#the-p-element>p</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-2><a href=#text>#text</a></code>: <span>2</span></ul></ul></ul></ul></ul>
- <p>The interesting part is when the end tag token with the tag name "b" is parsed.</p>
- <p>Before that token is seen, the <a href=#stack-of-open-elements id=misnested-tags:-b-p-/b-/p:stack-of-open-elements>stack of open elements</a> has four elements on it:
- <code id=misnested-tags:-b-p-/b-/p:the-html-element-2><a href=#the-html-element>html</a></code>, <code id=misnested-tags:-b-p-/b-/p:the-body-element-2><a href=#the-body-element>body</a></code>, <code id=misnested-tags:-b-p-/b-/p:the-b-element-2><a href=#the-b-element>b</a></code>, and <code id=misnested-tags:-b-p-/b-/p:the-p-element-2><a href=#the-p-element>p</a></code>. The <a href=#list-of-active-formatting-elements id=misnested-tags:-b-p-/b-/p:list-of-active-formatting-elements>list of active
- formatting elements</a> just has the one: <code id=misnested-tags:-b-p-/b-/p:the-b-element-3><a href=#the-b-element>b</a></code>. The <a href=#insertion-mode id=misnested-tags:-b-p-/b-/p:insertion-mode>insertion mode</a> is
- "<a href=#parsing-main-inbody id=misnested-tags:-b-p-/b-/p:parsing-main-inbody>in body</a>".</p>
- <p>Upon receiving the end tag token with the tag name "b", the "<a href=#adoptionAgency>adoption
- agency algorithm</a>" is invoked, as in the previous example. However, in this case, there
- <em>is</em> a <var>furthest block</var>, namely the <code id=misnested-tags:-b-p-/b-/p:the-p-element-3><a href=#the-p-element>p</a></code> element. Thus, this
- time the adoption agency algorithm isn't skipped over.</p>
- <p>The <var>common ancestor</var> is the <code id=misnested-tags:-b-p-/b-/p:the-body-element-3><a href=#the-body-element>body</a></code> element. A conceptual
- "bookmark" marks the position of the <code id=misnested-tags:-b-p-/b-/p:the-b-element-4><a href=#the-b-element>b</a></code> in the <a href=#list-of-active-formatting-elements id=misnested-tags:-b-p-/b-/p:list-of-active-formatting-elements-2>list of active formatting
- elements</a>, but since that list has only one element in it, the bookmark won't have much
- effect.</p>
- <p>As the algorithm progresses, <var>node</var> ends up set to the formatting element
- (<code id=misnested-tags:-b-p-/b-/p:the-b-element-5><a href=#the-b-element>b</a></code>), and <var>last node</var> ends up set to the <var>furthest
- block</var> (<code id=misnested-tags:-b-p-/b-/p:the-p-element-4><a href=#the-p-element>p</a></code>).</p>
- <p>The <var>last node</var> gets appended (moved) to the <var>common
- ancestor</var>, so that the DOM looks like:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-html-element-3><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-head-element-2><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-body-element-4><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-6><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-3><a href=#text>#text</a></code>: <span>1</span></ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-p-element-5><a href=#the-p-element>p</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-4><a href=#text>#text</a></code>: <span>2</span></ul></ul></ul></ul>
- <p>A new <code id=misnested-tags:-b-p-/b-/p:the-b-element-7><a href=#the-b-element>b</a></code> element is created, and the children of the <code id=misnested-tags:-b-p-/b-/p:the-p-element-6><a href=#the-p-element>p</a></code> element are
- moved to it:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-html-element-4><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-head-element-3><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-body-element-5><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-8><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-5><a href=#text>#text</a></code>: <span>1</span></ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-p-element-7><a href=#the-p-element>p</a></code></ul></ul></ul>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-9><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-6><a href=#text>#text</a></code>: <span>2</span></ul></ul>
- <p>Finally, the new <code id=misnested-tags:-b-p-/b-/p:the-b-element-10><a href=#the-b-element>b</a></code> element is appended to the <code id=misnested-tags:-b-p-/b-/p:the-p-element-8><a href=#the-p-element>p</a></code> element, so that the
- DOM looks like:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-html-element-5><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-head-element-4><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-body-element-6><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-11><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-7><a href=#text>#text</a></code>: <span>1</span></ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-p-element-9><a href=#the-p-element>p</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-12><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-8><a href=#text>#text</a></code>: <span>2</span></ul></ul></ul></ul></ul>
- <p>The <code id=misnested-tags:-b-p-/b-/p:the-b-element-13><a href=#the-b-element>b</a></code> element is removed from the <a href=#list-of-active-formatting-elements id=misnested-tags:-b-p-/b-/p:list-of-active-formatting-elements-3>list of active formatting elements</a>
- and the <a href=#stack-of-open-elements id=misnested-tags:-b-p-/b-/p:stack-of-open-elements-2>stack of open elements</a>, so that when the "3" is parsed, it is appended to the
- <code id=misnested-tags:-b-p-/b-/p:the-p-element-10><a href=#the-p-element>p</a></code> element:</p>
- <ul class=domTree><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-html-element-6><a href=#the-html-element>html</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-head-element-5><a href=#the-head-element>head</a></code><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-body-element-7><a href=#the-body-element>body</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-14><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-9><a href=#text>#text</a></code>: <span>1</span></ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-p-element-11><a href=#the-p-element>p</a></code><ul><li class=t1><code id=misnested-tags:-b-p-/b-/p:the-b-element-15><a href=#the-b-element>b</a></code><ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-10><a href=#text>#text</a></code>: <span>2</span></ul><li class=t3><code id=misnested-tags:-b-p-/b-/p:text-11><a href=#text>#text</a></code>: <span>3</span></ul></ul></ul></ul>
- <h5 id=unexpected-markup-in-tables>12.2.8.3 Unexpected markup in tables</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Error handling in tables is, for historical reasons, especially strange. For example, consider
- the following markup:</p>
- <pre><table><strong><b></strong><tr><td>aaa</td></tr><strong>bbb</strong></table>ccc</pre>
- <p>The highlighted <code id=unexpected-markup-in-tables:the-b-element><a href=#the-b-element>b</a></code> element start tag is not allowed directly inside a table like
- that, and the parser handles this case by placing the element <em>before</em> the table. (This is
- called <i id=unexpected-markup-in-tables:foster-parent><a href=#foster-parent>foster parenting</a></i>.) This can be seen by examining the DOM tree
- as it stands just after the <code id=unexpected-markup-in-tables:the-table-element><a href=#the-table-element>table</a></code> element's start tag has been seen:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-table-element-2><a href=#the-table-element>table</a></code></ul></ul></ul>
- <p>...and then immediately after the <code id=unexpected-markup-in-tables:the-b-element-2><a href=#the-b-element>b</a></code> element start tag has been seen:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-2><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-2><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-2><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-3><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-table-element-3><a href=#the-table-element>table</a></code></ul></ul></ul>
- <p>At this point, the <a href=#stack-of-open-elements id=unexpected-markup-in-tables:stack-of-open-elements>stack of open elements</a> has on it the elements
- <code id=unexpected-markup-in-tables:the-html-element-3><a href=#the-html-element>html</a></code>, <code id=unexpected-markup-in-tables:the-body-element-3><a href=#the-body-element>body</a></code>, <code id=unexpected-markup-in-tables:the-table-element-4><a href=#the-table-element>table</a></code>, and <code id=unexpected-markup-in-tables:the-b-element-4><a href=#the-b-element>b</a></code> (in that order,
- despite the resulting DOM tree); the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements>list of active formatting elements</a> just has the
- <code id=unexpected-markup-in-tables:the-b-element-5><a href=#the-b-element>b</a></code> element in it; and the <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode>insertion mode</a> is "<a href=#parsing-main-intable id=unexpected-markup-in-tables:parsing-main-intable>in table</a>".</p>
- <p>The <code id=unexpected-markup-in-tables:the-tr-element><a href=#the-tr-element>tr</a></code> start tag causes the <code id=unexpected-markup-in-tables:the-b-element-6><a href=#the-b-element>b</a></code> element to be popped off the stack and
- a <code id=unexpected-markup-in-tables:the-tbody-element><a href=#the-tbody-element>tbody</a></code> start tag to be implied; the <code id=unexpected-markup-in-tables:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code> and <code id=unexpected-markup-in-tables:the-tr-element-2><a href=#the-tr-element>tr</a></code> elements
- are then handled in a rather straight-forward manner, taking the parser through the "<a href=#parsing-main-intbody id=unexpected-markup-in-tables:parsing-main-intbody>in table body</a>" and "<a href=#parsing-main-intr id=unexpected-markup-in-tables:parsing-main-intr>in row</a>" insertion modes, after which the DOM looks as follows:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-4><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-3><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-4><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-7><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-table-element-5><a href=#the-table-element>table</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tr-element-3><a href=#the-tr-element>tr</a></code></ul></ul></ul></ul></ul>
- <p>Here, the <a href=#stack-of-open-elements id=unexpected-markup-in-tables:stack-of-open-elements-2>stack of open elements</a> has on it the elements <code id=unexpected-markup-in-tables:the-html-element-5><a href=#the-html-element>html</a></code>,
- <code id=unexpected-markup-in-tables:the-body-element-5><a href=#the-body-element>body</a></code>, <code id=unexpected-markup-in-tables:the-table-element-6><a href=#the-table-element>table</a></code>, <code id=unexpected-markup-in-tables:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, and <code id=unexpected-markup-in-tables:the-tr-element-4><a href=#the-tr-element>tr</a></code>; the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements-2>list of
- active formatting elements</a> still has the <code id=unexpected-markup-in-tables:the-b-element-8><a href=#the-b-element>b</a></code> element in it; and the
- <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode-2>insertion mode</a> is "<a href=#parsing-main-intr id=unexpected-markup-in-tables:parsing-main-intr-2>in row</a>".</p>
- <p>The <code id=unexpected-markup-in-tables:the-td-element><a href=#the-td-element>td</a></code> element start tag token, after putting a <code id=unexpected-markup-in-tables:the-td-element-2><a href=#the-td-element>td</a></code> element on the
- tree, puts a <a href=#concept-parser-marker id=unexpected-markup-in-tables:concept-parser-marker>marker</a> on the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements-3>list of active
- formatting elements</a> (it also switches to the "<a href=#parsing-main-intd id=unexpected-markup-in-tables:parsing-main-intd>in
- cell</a>" <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode-3>insertion mode</a>).</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-6><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-4><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-6><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-9><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-table-element-7><a href=#the-table-element>table</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tr-element-5><a href=#the-tr-element>tr</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-td-element-3><a href=#the-td-element>td</a></code></ul></ul></ul></ul></ul></ul>
- <p>The <a href=#concept-parser-marker id=unexpected-markup-in-tables:concept-parser-marker-2>marker</a> means that when the "aaa" character
- tokens are seen, no <code id=unexpected-markup-in-tables:the-b-element-10><a href=#the-b-element>b</a></code> element is created to hold the resulting <code id=unexpected-markup-in-tables:text><a href=#text>Text</a></code>
- node:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-7><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-5><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-7><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-11><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-table-element-8><a href=#the-table-element>table</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tr-element-6><a href=#the-tr-element>tr</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-td-element-4><a href=#the-td-element>td</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-2><a href=#text>#text</a></code>: <span>aaa</span></ul></ul></ul></ul></ul></ul></ul>
- <p>The end tags are handled in a straight-forward manner; after handling them, the <a href=#stack-of-open-elements id=unexpected-markup-in-tables:stack-of-open-elements-3>stack of
- open elements</a> has on it the elements <code id=unexpected-markup-in-tables:the-html-element-8><a href=#the-html-element>html</a></code>, <code id=unexpected-markup-in-tables:the-body-element-8><a href=#the-body-element>body</a></code>,
- <code id=unexpected-markup-in-tables:the-table-element-9><a href=#the-table-element>table</a></code>, and <code id=unexpected-markup-in-tables:the-tbody-element-7><a href=#the-tbody-element>tbody</a></code>; the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements-4>list of active formatting elements</a>
- still has the <code id=unexpected-markup-in-tables:the-b-element-12><a href=#the-b-element>b</a></code> element in it (the <a href=#concept-parser-marker id=unexpected-markup-in-tables:concept-parser-marker-3>marker</a>
- having been removed by the "td" end tag token); and the <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode-4>insertion mode</a> is "<a href=#parsing-main-intbody id=unexpected-markup-in-tables:parsing-main-intbody-2>in table body</a>".</p>
- <p>Thus it is that the "bbb" character tokens are found. These trigger the "<a href=#parsing-main-intabletext id=unexpected-markup-in-tables:parsing-main-intabletext>in table text</a>" insertion mode to be used (with the <a href=#original-insertion-mode id=unexpected-markup-in-tables:original-insertion-mode>original
- insertion mode</a> set to "<a href=#parsing-main-intbody id=unexpected-markup-in-tables:parsing-main-intbody-3>in table body</a>").
- The character tokens are collected, and when the next token (the <code id=unexpected-markup-in-tables:the-table-element-10><a href=#the-table-element>table</a></code> element end
- tag) is seen, they are processed as a group. Since they are not all spaces, they are handled as
- per the "anything else" rules in the "<a href=#parsing-main-intable id=unexpected-markup-in-tables:parsing-main-intable-2>in table</a>"
- insertion mode, which defer to the "<a href=#parsing-main-inbody id=unexpected-markup-in-tables:parsing-main-inbody>in body</a>"
- insertion mode but with <a href=#foster-parent id=unexpected-markup-in-tables:foster-parent-2>foster parenting</a>.</p>
- <p>When <a href=#reconstruct-the-active-formatting-elements id=unexpected-markup-in-tables:reconstruct-the-active-formatting-elements>the active formatting elements
- are reconstructed</a>, a <code id=unexpected-markup-in-tables:the-b-element-13><a href=#the-b-element>b</a></code> element is created and <a href=#foster-parent id=unexpected-markup-in-tables:foster-parent-3>foster parented</a>, and then the "bbb" <code id=unexpected-markup-in-tables:text-3><a href=#text>Text</a></code> node is appended to it:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-9><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-6><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-9><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-14><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-b-element-15><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-4><a href=#text>#text</a></code>: <span>bbb</span></ul><li class=t1><code id=unexpected-markup-in-tables:the-table-element-11><a href=#the-table-element>table</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tbody-element-8><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tr-element-7><a href=#the-tr-element>tr</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-td-element-5><a href=#the-td-element>td</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-5><a href=#text>#text</a></code>: <span>aaa</span></ul></ul></ul></ul></ul></ul></ul>
- <p>The <a href=#stack-of-open-elements id=unexpected-markup-in-tables:stack-of-open-elements-4>stack of open elements</a> has on it the elements <code id=unexpected-markup-in-tables:the-html-element-10><a href=#the-html-element>html</a></code>,
- <code id=unexpected-markup-in-tables:the-body-element-10><a href=#the-body-element>body</a></code>, <code id=unexpected-markup-in-tables:the-table-element-12><a href=#the-table-element>table</a></code>, <code id=unexpected-markup-in-tables:the-tbody-element-9><a href=#the-tbody-element>tbody</a></code>, and the new <code id=unexpected-markup-in-tables:the-b-element-16><a href=#the-b-element>b</a></code> (again, note
- that this doesn't match the resulting tree!); the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements-5>list of active formatting elements</a>
- has the new <code id=unexpected-markup-in-tables:the-b-element-17><a href=#the-b-element>b</a></code> element in it; and the <a href=#insertion-mode id=unexpected-markup-in-tables:insertion-mode-5>insertion mode</a> is still "<a href=#parsing-main-intbody id=unexpected-markup-in-tables:parsing-main-intbody-4>in table body</a>".</p>
- <p>Had the character tokens been only <a href=#space-character id=unexpected-markup-in-tables:space-character>space characters</a>
- instead of "bbb", then those <a href=#space-character id=unexpected-markup-in-tables:space-character-2>space characters</a> would just be
- appended to the <code id=unexpected-markup-in-tables:the-tbody-element-10><a href=#the-tbody-element>tbody</a></code> element.</p>
- <p>Finally, the <code id=unexpected-markup-in-tables:the-table-element-13><a href=#the-table-element>table</a></code> is closed by a "table" end tag. This pops all the nodes from
- the <a href=#stack-of-open-elements id=unexpected-markup-in-tables:stack-of-open-elements-5>stack of open elements</a> up to and including the <code id=unexpected-markup-in-tables:the-table-element-14><a href=#the-table-element>table</a></code> element, but it
- doesn't affect the <a href=#list-of-active-formatting-elements id=unexpected-markup-in-tables:list-of-active-formatting-elements-6>list of active formatting elements</a>, so the "ccc" character tokens
- after the table result in yet another <code id=unexpected-markup-in-tables:the-b-element-18><a href=#the-b-element>b</a></code> element being created, this time after the
- table:</p>
- <ul class=domTree><li class=t1><code id=unexpected-markup-in-tables:the-html-element-11><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-head-element-7><a href=#the-head-element>head</a></code><li class=t1><code id=unexpected-markup-in-tables:the-body-element-11><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-19><a href=#the-b-element>b</a></code><li class=t1><code id=unexpected-markup-in-tables:the-b-element-20><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-6><a href=#text>#text</a></code>: <span>bbb</span></ul><li class=t1><code id=unexpected-markup-in-tables:the-table-element-15><a href=#the-table-element>table</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tbody-element-11><a href=#the-tbody-element>tbody</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-tr-element-8><a href=#the-tr-element>tr</a></code><ul><li class=t1><code id=unexpected-markup-in-tables:the-td-element-6><a href=#the-td-element>td</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-7><a href=#text>#text</a></code>: <span>aaa</span></ul></ul></ul></ul><li class=t1><code id=unexpected-markup-in-tables:the-b-element-21><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unexpected-markup-in-tables:text-8><a href=#text>#text</a></code>: <span>ccc</span></ul></ul></ul></ul>
- <h5 id=scripts-that-modify-the-page-as-it-is-being-parsed>12.2.8.4 Scripts that modify the page as it is being parsed</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Consider the following markup, which for this example we will assume is the document with
- <a href=#url id=scripts-that-modify-the-page-as-it-is-being-parsed:url>URL</a> <code>http://example.com/inner</code>, being rendered as the content of
- an <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-iframe-element><a href=#the-iframe-element>iframe</a></code> in another document with the <a href=#url id=scripts-that-modify-the-page-as-it-is-being-parsed:url-2>URL</a> <code>http://example.com/outer</code>:</p>
- <pre><div id=a>
- <script>
- var div = document.getElementById('a');
- parent.document.body.appendChild(div);
- </script>
- <script>
- alert(document.URL);
- </script>
- </div>
- <script>
- alert(document.URL);
- </script></pre>
- <p>Up to the first "script" end tag, before the script is parsed, the result is relatively
- straightforward:</p>
- <ul class=domTree><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-head-element><a href=#the-head-element>head</a></code><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-div-element><a href=#the-div-element>div</a></code> <span class=t2><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-id-attribute class="attribute name"><a href=#the-id-attribute>id</a></code>="<code class="attribute value">a</code>"</span><ul><li class=t3><code id=scripts-that-modify-the-page-as-it-is-being-parsed:text><a href=#text>#text</a></code>: <span>
- </span><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-script-element><a href=#the-script-element>script</a></code><ul><li class=t3><code id=scripts-that-modify-the-page-as-it-is-being-parsed:text-2><a href=#text>#text</a></code>: <span>var div = document.getElementById('a'); ⏎ parent.document.body.appendChild(div);</span></ul></ul></ul></ul></ul>
- <p>After the script is parsed, though, the <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-2><a href=#the-div-element>div</a></code> element and its child
- <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-2><a href=#the-script-element>script</a></code> element are gone:</p>
- <ul class=domTree><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-html-element-2><a href=#the-html-element>html</a></code><ul><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-head-element-2><a href=#the-head-element>head</a></code><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-body-element-2><a href=#the-body-element>body</a></code></ul></ul>
- <p>They are, at this point, in the <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document><a href=#document>Document</a></code> of the aforementioned outer
- <a href=#browsing-context id=scripts-that-modify-the-page-as-it-is-being-parsed:browsing-context>browsing context</a>. However, the <a href=#stack-of-open-elements id=scripts-that-modify-the-page-as-it-is-being-parsed:stack-of-open-elements>stack of open elements</a> <em>still contains
- the <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-3><a href=#the-div-element>div</a></code> element</em>.</p>
- <p>Thus, when the second <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-3><a href=#the-script-element>script</a></code> element is parsed, it is inserted <em>into the outer
- <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document-2><a href=#document>Document</a></code> object</em>.</p>
- <p>Those parsed into different <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document-3><a href=#document>Document</a></code>s than the one the parser was created for do
- not execute, so the first alert does not show.</p>
- <p>Once the <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-4><a href=#the-div-element>div</a></code> element's end tag is parsed, the <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-div-element-5><a href=#the-div-element>div</a></code> element is popped
- off the stack, and so the next <code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-4><a href=#the-script-element>script</a></code> element is in the inner
- <code id=scripts-that-modify-the-page-as-it-is-being-parsed:document-4><a href=#document>Document</a></code>:</p>
- <ul class=domTree><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-html-element-3><a href=#the-html-element>html</a></code><ul><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-head-element-3><a href=#the-head-element>head</a></code><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-body-element-3><a href=#the-body-element>body</a></code><ul><li class=t1><code id=scripts-that-modify-the-page-as-it-is-being-parsed:the-script-element-5><a href=#the-script-element>script</a></code><ul><li class=t3><code id=scripts-that-modify-the-page-as-it-is-being-parsed:text-3><a href=#text>#text</a></code>: <span>alert(document.URL);</span></ul></ul></ul></ul>
- <p>This script does execute, resulting in an alert that says "http://example.com/inner".</p>
- <h5 id=the-execution-of-scripts-that-are-moving-across-multiple-documents>12.2.8.5 The execution of scripts that are moving across multiple documents</h5>
- <p><i>This section is non-normative.</i></p>
- <p>Elaborating on the example in the previous section, consider the case where the second
- <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:the-script-element><a href=#the-script-element>script</a></code> element is an external script (i.e. one with a <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:attr-script-src><a href=#attr-script-src>src</a></code> attribute). Since the element was not in the parser's
- <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:document><a href=#document>Document</a></code> when it was created, that external script is not even downloaded.</p>
- <p>In a case where a <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:the-script-element-2><a href=#the-script-element>script</a></code> element with a <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:attr-script-src-2><a href=#attr-script-src>src</a></code>
- attribute is parsed normally into its parser's <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:document-2><a href=#document>Document</a></code>, but while the external
- script is being downloaded, the element is moved to another document, the script continues to
- download, but does not execute.</p>
- <p class=note>In general, moving <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:the-script-element-3><a href=#the-script-element>script</a></code> elements between <code id=the-execution-of-scripts-that-are-moving-across-multiple-documents:document-3><a href=#document>Document</a></code>s is
- considered a bad practice.</p>
- <h5 id=unclosed-formatting-elements>12.2.8.6 Unclosed formatting elements</h5>
- <p><i>This section is non-normative.</i></p>
- <p>The following markup shows how nested formatting elements (such as <code id=unclosed-formatting-elements:the-b-element><a href=#the-b-element>b</a></code>) get
- collected and continue to be applied even as the elements they are contained in are closed, but
- that excessive duplicates are thrown away.</p>
- <pre><!DOCTYPE html>
- <p><b class=x><b class=x><b><b class=x><b class=x><b>X
- <p>X
- <p><b><b class=x><b>X
- <p></b></b></b></b></b></b>X</pre>
- <p>The resulting DOM tree is as follows:</p>
- <ul class=domTree><li class=t10>DOCTYPE: <code>html</code><li class=t1><code id=unclosed-formatting-elements:the-html-element><a href=#the-html-element>html</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-head-element><a href=#the-head-element>head</a></code><li class=t1><code id=unclosed-formatting-elements:the-body-element><a href=#the-body-element>body</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-p-element><a href=#the-p-element>p</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-2><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-3><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-2 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-4><a href=#the-b-element>b</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-5><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-3 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-6><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-4 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-7><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unclosed-formatting-elements:text><a href=#text>#text</a></code>: <span>X⏎</span></ul></ul></ul></ul></ul></ul></ul><li class=t1><code id=unclosed-formatting-elements:the-p-element-2><a href=#the-p-element>p</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-8><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-5 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-9><a href=#the-b-element>b</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-10><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-6 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-11><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-7 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-12><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unclosed-formatting-elements:text-2><a href=#text>#text</a></code>: <span>X⏎</span></ul></ul></ul></ul></ul></ul><li class=t1><code id=unclosed-formatting-elements:the-p-element-3><a href=#the-p-element>p</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-13><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-8 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-14><a href=#the-b-element>b</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-15><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-9 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-16><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-10 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-17><a href=#the-b-element>b</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-18><a href=#the-b-element>b</a></code><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-19><a href=#the-b-element>b</a></code> <span class=t2><code id=unclosed-formatting-elements:classes-11 class="attribute name"><a href=#classes>class</a></code>="<code class="attribute value">x</code>"</span><ul><li class=t1><code id=unclosed-formatting-elements:the-b-element-20><a href=#the-b-element>b</a></code><ul><li class=t3><code id=unclosed-formatting-elements:text-3><a href=#text>#text</a></code>: <span>X⏎</span></ul></ul></ul></ul></ul></ul></ul></ul></ul><li class=t1><code id=unclosed-formatting-elements:the-p-element-4><a href=#the-p-element>p</a></code><ul><li class=t3><code id=unclosed-formatting-elements:text-4><a href=#text>#text</a></code>: <span>X⏎</span></ul></ul></ul></ul>
- <p>Note how the second <code id=unclosed-formatting-elements:the-p-element-5><a href=#the-p-element>p</a></code> element in the markup has no explicit <code id=unclosed-formatting-elements:the-b-element-21><a href=#the-b-element>b</a></code>
- elements, but in the resulting DOM, up to three of each kind of formatting element (in this case
- three <code id=unclosed-formatting-elements:the-b-element-22><a href=#the-b-element>b</a></code> elements with the class attribute, and two unadorned <code id=unclosed-formatting-elements:the-b-element-23><a href=#the-b-element>b</a></code> elements)
- get reconstructed before the element's "X".</p>
- <p>Also note how this means that in the final paragraph only six <code id=unclosed-formatting-elements:the-b-element-24><a href=#the-b-element>b</a></code> end tags are
- needed to completely clear the <a href=#list-of-active-formatting-elements id=unclosed-formatting-elements:list-of-active-formatting-elements>list of active formatting elements</a>, even though nine
- <code id=unclosed-formatting-elements:the-b-element-25><a href=#the-b-element>b</a></code> start tags have been seen up to this point.</p>
- <h3 id=serialising-html-fragments>12.3 Serialising HTML fragments</h3>
- <p>The following steps form the <dfn id=html-fragment-serialisation-algorithm>HTML fragment serialisation algorithm</dfn>. The algorithm
- takes as input a DOM <code id=serialising-html-fragments:element><a href=#element>Element</a></code>, <code id=serialising-html-fragments:document><a href=#document>Document</a></code>, or <code id=serialising-html-fragments:documentfragment><a href=#documentfragment>DocumentFragment</a></code>
- referred to as <var>the node</var>, and either returns a string or throws an
- exception.</p>
- <p class=note>This algorithm serialises the <em>children</em> of the node being serialised, not
- the node itself.</p>
- <ol><li><p>Let <var>s</var> be a string, and initialise it to the empty string.<li><p>If <var>the node</var> is a <code id=serialising-html-fragments:the-template-element><a href=#the-template-element>template</a></code> element, then let <var>the node</var> instead be the <code id=serialising-html-fragments:the-template-element-2><a href=#the-template-element>template</a></code> element's <a href=#template-contents id=serialising-html-fragments:template-contents>template
- contents</a> (a <code id=serialising-html-fragments:documentfragment-2><a href=#documentfragment>DocumentFragment</a></code> node).<li>
- <p>For each child node of <var>the node</var>, in <a href=#tree-order id=serialising-html-fragments:tree-order>tree order</a>, run the
- following steps:
- <ol><li><p>Let <var>current node</var> be the child node being processed.<li>
- <p>Append the appropriate string from the following list to <var>s</var>:</p>
- <dl class=switch><dt>If <var>current node</var> is an <code>Element</code><dd>
- <p>If <var>current node</var> is an element in the <a href=#html-namespace-2 id=serialising-html-fragments:html-namespace-2>HTML namespace</a>, the
- <a href=#mathml-namespace id=serialising-html-fragments:mathml-namespace>MathML namespace</a>, or the <a href=#svg-namespace id=serialising-html-fragments:svg-namespace>SVG namespace</a>, then let <var>tagname</var> be <var>current node</var>'s local name. Otherwise, let <var>tagname</var> be <var>current node</var>'s qualified name.</p>
- <p>Append a U+003C LESS-THAN SIGN character (<), followed by <var>tagname</var>.</p>
- <p class=note>For <a href=#html-elements id=serialising-html-fragments:html-elements>HTML elements</a> created by the <a href=#html-parser id=serialising-html-fragments:html-parser>HTML parser</a> or
- <code>Document.createElement()</code>, <var>tagname</var> will be
- lowercase.</p>
- <p>For each attribute that the element has, append a U+0020 SPACE character, the <a href="#attribute's-serialised-name" id="serialising-html-fragments:attribute's-serialised-name">attribute's serialised name as described below</a>, a
- U+003D EQUALS SIGN character (=), a U+0022 QUOTATION MARK character ("), the
- attribute's value, <a href=#escapingString id=serialising-html-fragments:escapingString>escaped as described below</a> in
- <i>attribute mode</i>, and a second U+0022 QUOTATION MARK character (").</p>
- <p>An <dfn id="attribute's-serialised-name">attribute's serialised name</dfn> for the purposes of the previous paragraph must
- be determined as follows:</p>
- <dl class=switch><dt>If the attribute has no namespace<dd>
- <p>The attribute's serialised name is the attribute's local name.</p>
- <p class=note>For attributes on <a href=#html-elements id=serialising-html-fragments:html-elements-2>HTML elements</a> set by the <a href=#html-parser id=serialising-html-fragments:html-parser-2>HTML
- parser</a> or by <code>Element.setAttribute()</code>, the local name will be
- lowercase.</p>
- <dt>If the attribute is in the <a href=#xml-namespace id=serialising-html-fragments:xml-namespace>XML namespace</a><dd><p>The attribute's serialised name is the string "<code>xml:</code>" followed
- by the attribute's local name.<dt>If the attribute is in the <a href=#xmlns-namespace id=serialising-html-fragments:xmlns-namespace>XMLNS namespace</a> and the attribute's local name
- is <code>xmlns</code><dd><p>The attribute's serialised name is the string "<code>xmlns</code>".<dt>If the attribute is in the <a href=#xmlns-namespace id=serialising-html-fragments:xmlns-namespace-2>XMLNS namespace</a> and the attribute's local name
- is not <code>xmlns</code><dd><p>The attribute's serialised name is the string "<code>xmlns:</code>"
- followed by the attribute's local name.<dt>If the attribute is in the <a href=#xlink-namespace id=serialising-html-fragments:xlink-namespace>XLink namespace</a><dd><p>The attribute's serialised name is the string "<code>xlink:</code>"
- followed by the attribute's local name.<dt>If the attribute is in some other namespace<dd><p>The attribute's serialised name is the attribute's qualified name.</dl>
- <p>While the exact order of attributes is UA-defined, and may depend on factors such as the
- order that the attributes were given in the original markup, the sort order must be stable,
- such that consecutive invocations of this algorithm serialise an element's attributes in the
- same order.</p>
- <p>Append a U+003E GREATER-THAN SIGN character (>).</p>
- <p>If <var>current node</var> is an <code id=serialising-html-fragments:the-area-element><a href=#the-area-element>area</a></code>, <code id=serialising-html-fragments:the-base-element><a href=#the-base-element>base</a></code>,
- <code id=serialising-html-fragments:basefont><a href=#basefont>basefont</a></code>, <code id=serialising-html-fragments:bgsound><a href=#bgsound>bgsound</a></code>, <code id=serialising-html-fragments:the-br-element><a href=#the-br-element>br</a></code>, <code id=serialising-html-fragments:the-col-element><a href=#the-col-element>col</a></code>,
- <code id=serialising-html-fragments:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=serialising-html-fragments:frame><a href=#frame>frame</a></code>, <code id=serialising-html-fragments:the-hr-element><a href=#the-hr-element>hr</a></code>, <code id=serialising-html-fragments:the-img-element><a href=#the-img-element>img</a></code>,
- <code id=serialising-html-fragments:the-input-element><a href=#the-input-element>input</a></code>, <code id=serialising-html-fragments:the-keygen-element><a href=#the-keygen-element>keygen</a></code>, <code id=serialising-html-fragments:the-link-element><a href=#the-link-element>link</a></code>, <code id=serialising-html-fragments:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>,
- <code id=serialising-html-fragments:the-meta-element><a href=#the-meta-element>meta</a></code>, <code id=serialising-html-fragments:the-param-element><a href=#the-param-element>param</a></code>, <code id=serialising-html-fragments:the-source-element><a href=#the-source-element>source</a></code>, <code id=serialising-html-fragments:the-track-element><a href=#the-track-element>track</a></code> or
- <code id=serialising-html-fragments:the-wbr-element><a href=#the-wbr-element>wbr</a></code> element, then continue on to the next child node at this point.</p>
-
-
- <p>If <var>current node</var> is a <code id=serialising-html-fragments:the-pre-element><a href=#the-pre-element>pre</a></code>, <code id=serialising-html-fragments:the-textarea-element><a href=#the-textarea-element>textarea</a></code>, or
- <code id=serialising-html-fragments:listing><a href=#listing>listing</a></code> element, and the first child node of the element, if any, is a
- <code id=serialising-html-fragments:text><a href=#text>Text</a></code> node whose character data has as its first character a U+000A LINE FEED
- (LF) character, then append a U+000A LINE FEED (LF) character.</p>
- <p>Append the value of running the <a href=#html-fragment-serialisation-algorithm id=serialising-html-fragments:html-fragment-serialisation-algorithm>HTML fragment serialisation algorithm</a> on the
- <var>current node</var> element (thus recursing into this algorithm for that
- element), followed by a U+003C LESS-THAN SIGN character (<), a U+002F SOLIDUS character
- (/), <var>tagname</var> again, and finally a U+003E GREATER-THAN SIGN character
- (>).</p>
- <dt>If <var>current node</var> is a <code>Text</code> node<dd>
- <p>If the parent of <var>current node</var> is a <code id=serialising-html-fragments:the-style-element><a href=#the-style-element>style</a></code>,
- <code id=serialising-html-fragments:the-script-element><a href=#the-script-element>script</a></code>, <code id=serialising-html-fragments:xmp><a href=#xmp>xmp</a></code>, <code id=serialising-html-fragments:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, <code id=serialising-html-fragments:noembed><a href=#noembed>noembed</a></code>,
- <code id=serialising-html-fragments:noframes><a href=#noframes>noframes</a></code>, or <code id=serialising-html-fragments:plaintext><a href=#plaintext>plaintext</a></code> element, or if the parent of <var>current node</var> is a <code id=serialising-html-fragments:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element and <a href=#concept-n-script id=serialising-html-fragments:concept-n-script>scripting is enabled</a> for the node, then append the value of
- <var>current node</var>'s <code>data</code> IDL attribute literally.</p>
- <p>Otherwise, append the value of <var>current node</var>'s <code>data</code> IDL attribute, <a href=#escapingString id=serialising-html-fragments:escapingString-2>escaped as described
- below</a>.</p>
- <dt>If <var>current node</var> is a <code>Comment</code><dd>
- <p>Append the literal string "<code><!--</code>" (U+003C LESS-THAN SIGN, U+0021
- EXCLAMATION MARK, U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS), followed by the value of <var>current node</var>'s <code>data</code> IDL attribute, followed by the
- literal string "<code>--></code>" (U+002D HYPHEN-MINUS, U+002D HYPHEN-MINUS,
- U+003E GREATER-THAN SIGN).</p>
- <dt>If <var>current node</var> is a <code>ProcessingInstruction</code><dd>
- <p>Append the literal string "<code><?</code>" (U+003C LESS-THAN SIGN, U+003F
- QUESTION MARK), followed by the value of <var>current node</var>'s <code>target</code> IDL attribute, followed by a single U+0020 SPACE character, followed
- by the value of <var>current node</var>'s <code>data</code> IDL
- attribute, followed by a single U+003E GREATER-THAN SIGN character (>).</p>
- <dt>If <var>current node</var> is a <code>DocumentType</code><dd>
- <p>Append the literal string "<code><!DOCTYPE</code>" (U+003C LESS-THAN SIGN, U+0021
- EXCLAMATION MARK, U+0044 LATIN CAPITAL LETTER D, U+004F LATIN CAPITAL LETTER O, U+0043 LATIN
- CAPITAL LETTER C, U+0054 LATIN CAPITAL LETTER T, U+0059 LATIN CAPITAL LETTER Y, U+0050 LATIN
- CAPITAL LETTER P, U+0045 LATIN CAPITAL LETTER E), followed by a space (U+0020 SPACE),
- followed by the value of <var>current node</var>'s <code>name</code> IDL
- attribute, followed by the literal string "<code>></code>" (U+003E GREATER-THAN SIGN).</p>
- </dl>
-
- </ol>
- <li><p>The result of the algorithm is the string <var>s</var>.</ol>
- <p class=warning>It is possible that the output of this algorithm, if parsed with an <a href=#html-parser id=serialising-html-fragments:html-parser-3>HTML
- parser</a>, will not return the original tree structure.</p>
- <div class=example>
- <p>For instance, if a <code id=serialising-html-fragments:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element to which a <code>Comment</code> node
- has been appended is serialised and the output is then reparsed, the comment will end up being
- displayed in the text field. Similarly, if, as a result of DOM manipulation, an element contains
- a comment that contains the literal string "<code>--></code>", then when the result
- of serialising the element is parsed, the comment will be truncated at that point and the rest of
- the comment will be interpreted as markup. More examples would be making a <code id=serialising-html-fragments:the-script-element-2><a href=#the-script-element>script</a></code>
- element contain a <code id=serialising-html-fragments:text-2><a href=#text>Text</a></code> node with the text string "<code></script></code>", or
- having a <code id=serialising-html-fragments:the-p-element><a href=#the-p-element>p</a></code> element that contains a <code id=serialising-html-fragments:the-ul-element><a href=#the-ul-element>ul</a></code> element (as the <code id=serialising-html-fragments:the-ul-element-2><a href=#the-ul-element>ul</a></code>
- element's <a href=#syntax-start-tag id=serialising-html-fragments:syntax-start-tag>start tag</a> would imply the end tag for the
- <code id=serialising-html-fragments:the-p-element-2><a href=#the-p-element>p</a></code>).</p>
- <p>This can enable cross-site scripting attacks. An example of this would be a page that lets the
- user enter some font family names that are then inserted into a CSS <code id=serialising-html-fragments:the-style-element-2><a href=#the-style-element>style</a></code> block via
- the DOM and which then uses the <code id=serialising-html-fragments:dom-innerhtml><a href=#dom-innerhtml>innerHTML</a></code> IDL attribute to get
- the HTML serialisation of that <code id=serialising-html-fragments:the-style-element-3><a href=#the-style-element>style</a></code> element: if the user enters
- "<code></style><script>attack</script></code>" as a font family name, <code id=serialising-html-fragments:dom-innerhtml-2><a href=#dom-innerhtml>innerHTML</a></code> will return markup that, if parsed in a different context,
- would contain a <code id=serialising-html-fragments:the-script-element-3><a href=#the-script-element>script</a></code> node, even though no <code id=serialising-html-fragments:the-script-element-4><a href=#the-script-element>script</a></code> node existed in the
- original DOM.</p>
- </div>
- <p><dfn id=escapingString>Escaping a string</dfn> (for the purposes of the algorithm above)
- consists of running the following steps:</p>
- <ol><li><p>Replace any occurrence of the "<code>&</code>" character by the string "<code>&amp;</code>".<li><p>Replace any occurrences of the U+00A0 NO-BREAK SPACE character by the string "<code>&nbsp;</code>".<li><p>If the algorithm was invoked in the <i>attribute mode</i>, replace any occurrences of the
- "<code>"</code>" character by the string "<code>&quot;</code>".<li><p>If the algorithm was <em>not</em> invoked in the <i>attribute mode</i>, replace any
- occurrences of the "<code><</code>" character by the string "<code>&lt;</code>", and any occurrences of the "<code>></code>" character by
- the string "<code>&gt;</code>".</ol>
- <h3 id=parsing-html-fragments>12.4 Parsing HTML fragments</h3>
- <p>The following steps form the <dfn id=html-fragment-parsing-algorithm>HTML fragment parsing algorithm</dfn>. The algorithm
- optionally takes as input an <code id=parsing-html-fragments:element><a href=#element>Element</a></code> node, referred to as the <dfn id=concept-frag-parse-context><var>context</var></dfn> element, which gives the context for
- the parser, as well as <var>input</var>, a string to parse, and returns a list of zero or
- more nodes.</p>
- <p class=note>Parts marked <dfn id=fragment-case>fragment case</dfn> in algorithms in the parser section are
- parts that only occur if the parser was created for the purposes of this algorithm (and with a
- <var id=parsing-html-fragments:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var> element). The algorithms have been annotated
- with such markings for informational purposes only; such markings have no normative weight. If it
- is possible for a condition described as a <a href=#fragment-case id=parsing-html-fragments:fragment-case>fragment case</a> to occur even when the
- parser wasn't created for the purposes of handling this algorithm, then that is an error in the
- specification.</p>
- <ol><li>
- <p>Create a new <code id=parsing-html-fragments:document><a href=#document>Document</a></code> node, and mark it as being an <a href=#html-documents id=parsing-html-fragments:html-documents>HTML document</a>.</p>
- <li>
- <p>If there is a <var id=parsing-html-fragments:concept-frag-parse-context-2><a href=#concept-frag-parse-context>context</a></var> element, and the
- <a id=parsing-html-fragments:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the <var id=parsing-html-fragments:concept-frag-parse-context-3><a href=#concept-frag-parse-context>context</a></var> element is in
- <a href=#quirks-mode id=parsing-html-fragments:quirks-mode>quirks mode</a>, then let the <code id=parsing-html-fragments:document-2><a href=#document>Document</a></code> be in <a href=#quirks-mode id=parsing-html-fragments:quirks-mode-2>quirks mode</a>.
- Otherwise, if there is a <var id=parsing-html-fragments:concept-frag-parse-context-4><a href=#concept-frag-parse-context>context</a></var> element, and the
- <a id=parsing-html-fragments:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of the <var id=parsing-html-fragments:concept-frag-parse-context-5><a href=#concept-frag-parse-context>context</a></var> element is in
- <a href=#limited-quirks-mode id=parsing-html-fragments:limited-quirks-mode>limited-quirks mode</a>, then let the <code id=parsing-html-fragments:document-3><a href=#document>Document</a></code> be in <a href=#limited-quirks-mode id=parsing-html-fragments:limited-quirks-mode-2>limited-quirks
- mode</a>. Otherwise, leave the <code id=parsing-html-fragments:document-4><a href=#document>Document</a></code> in <a href=#no-quirks-mode id=parsing-html-fragments:no-quirks-mode>no-quirks mode</a>.</p>
- <li>
- <p>Create a new <a href=#html-parser id=parsing-html-fragments:html-parser>HTML parser</a>, and associate it with the just created
- <code id=parsing-html-fragments:document-5><a href=#document>Document</a></code> node.</p>
- <li>
- <p>If there is a <var id=parsing-html-fragments:concept-frag-parse-context-6><a href=#concept-frag-parse-context>context</a></var> element, run these
- substeps:</p>
- <ol><li>
- <p>Set the state of the <a href=#html-parser id=parsing-html-fragments:html-parser-2>HTML parser</a>'s <a href=#tokenization id=parsing-html-fragments:tokenization>tokenization</a> stage as
- follows:</p>
- <dl class=switch><dt>If it is a <code id=parsing-html-fragments:the-title-element><a href=#the-title-element>title</a></code> or <code id=parsing-html-fragments:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element<dd>Switch the tokenizer to the <a href=#rcdata-state id=parsing-html-fragments:rcdata-state>RCDATA state</a>.<dt>If it is a <code id=parsing-html-fragments:the-style-element><a href=#the-style-element>style</a></code>, <code id=parsing-html-fragments:xmp><a href=#xmp>xmp</a></code>, <code id=parsing-html-fragments:the-iframe-element><a href=#the-iframe-element>iframe</a></code>,
- <code id=parsing-html-fragments:noembed><a href=#noembed>noembed</a></code>, or <code id=parsing-html-fragments:noframes><a href=#noframes>noframes</a></code> element<dd>Switch the tokenizer to the <a href=#rawtext-state id=parsing-html-fragments:rawtext-state>RAWTEXT state</a>.<dt>If it is a <code id=parsing-html-fragments:the-script-element><a href=#the-script-element>script</a></code> element<dd>Switch the tokenizer to the <a href=#script-data-state id=parsing-html-fragments:script-data-state>script data state</a>.<dt>If it is a <code id=parsing-html-fragments:the-noscript-element><a href=#the-noscript-element>noscript</a></code> element<dd>If the <a href=#scripting-flag id=parsing-html-fragments:scripting-flag>scripting flag</a> is enabled, switch the tokenizer to the <a href=#rawtext-state id=parsing-html-fragments:rawtext-state-2>RAWTEXT
- state</a>. Otherwise, leave the tokenizer in the <a href=#data-state id=parsing-html-fragments:data-state>data state</a>.<dt>If it is a <code id=parsing-html-fragments:plaintext><a href=#plaintext>plaintext</a></code> element<dd>Switch the tokenizer to the <a href=#plaintext-state id=parsing-html-fragments:plaintext-state>PLAINTEXT state</a>.<dt>Otherwise<dd>Leave the tokenizer in the <a href=#data-state id=parsing-html-fragments:data-state-2>data state</a>.</dl>
- <p class=note>For performance reasons, an implementation that does not report errors and
- that uses the actual state machine described in this specification directly could use the
- PLAINTEXT state instead of the RAWTEXT and script data states where those are mentioned in the
- list above. Except for rules regarding parse errors, they are equivalent, since there is no
- <a href=#appropriate-end-tag-token id=parsing-html-fragments:appropriate-end-tag-token>appropriate end tag token</a> in the fragment case, yet they involve far fewer state
- transitions.</p>
- <li>
- <p>Let <var>root</var> be a new <code id=parsing-html-fragments:the-html-element><a href=#the-html-element>html</a></code> element with no attributes.</p>
- <li>
- <p>Append the element <var>root</var> to the <code id=parsing-html-fragments:document-6><a href=#document>Document</a></code> node created
- above.</p>
- <li>
- <p>Set up the parser's <a href=#stack-of-open-elements id=parsing-html-fragments:stack-of-open-elements>stack of open elements</a> so that it contains just the single
- element <var>root</var>.</p>
- <li>
- <p>If the <var id=parsing-html-fragments:concept-frag-parse-context-7><a href=#concept-frag-parse-context>context</a></var> element is a
- <code id=parsing-html-fragments:the-template-element><a href=#the-template-element>template</a></code> element, push "<a href=#parsing-main-intemplate id=parsing-html-fragments:parsing-main-intemplate>in
- template</a>" onto the <a href=#stack-of-template-insertion-modes id=parsing-html-fragments:stack-of-template-insertion-modes>stack of template insertion modes</a> so that it is the new
- <a href=#current-template-insertion-mode id=parsing-html-fragments:current-template-insertion-mode>current template insertion mode</a>.</p>
- <li>
- <p><a href=#reset-the-insertion-mode-appropriately id=parsing-html-fragments:reset-the-insertion-mode-appropriately>Reset the parser's insertion mode
- appropriately</a>.</p>
- <p class=note>The parser will reference the <var id=parsing-html-fragments:concept-frag-parse-context-8><a href=#concept-frag-parse-context>context</a></var> element as part of that algorithm.</p>
- <li>
- <p>Set the parser's <a href=#form-element-pointer id=parsing-html-fragments:form-element-pointer><code>form</code> element pointer</a> to the nearest node to the
- <var id=parsing-html-fragments:concept-frag-parse-context-9><a href=#concept-frag-parse-context>context</a></var> element that is a <code id=parsing-html-fragments:the-form-element><a href=#the-form-element>form</a></code>
- element (going straight up the ancestor chain, and including the element itself, if it is a
- <code id=parsing-html-fragments:the-form-element-2><a href=#the-form-element>form</a></code> element), if any. (If there is no such <code id=parsing-html-fragments:the-form-element-3><a href=#the-form-element>form</a></code> element, the
- <a href=#form-element-pointer id=parsing-html-fragments:form-element-pointer-2><code>form</code> element pointer</a> keeps its initial value, null.)</p>
- </ol>
- <li>
- <p>Place the <var>input</var> into the <a href=#input-stream id=parsing-html-fragments:input-stream>input stream</a> for the <a href=#html-parser id=parsing-html-fragments:html-parser-3>HTML
- parser</a> just created. The encoding <a href=#concept-encoding-confidence id=parsing-html-fragments:concept-encoding-confidence>confidence</a> is <i>irrelevant</i>.</p>
- <li>
- <p>Start the parser and let it run until it has consumed all the characters just inserted into
- the input stream.</p>
- <li>
- <p>If there is a <var id=parsing-html-fragments:concept-frag-parse-context-10><a href=#concept-frag-parse-context>context</a></var> element, return the child
- nodes of <var>root</var>, in <a href=#tree-order id=parsing-html-fragments:tree-order>tree order</a>.</p>
- <p>Otherwise, return the children of the <code id=parsing-html-fragments:document-7><a href=#document>Document</a></code> object, in <a href=#tree-order id=parsing-html-fragments:tree-order-2>tree
- order</a>.</p>
- </ol>
-
- <h3 id=named-character-references>12.5 <dfn>Named character references</dfn></h3>
- <p>This table lists the character reference names that are supported by HTML, and the code points
- to which they refer. It is referenced by the previous sections.</p>
- <div id=named-character-references-table>
- <table><thead><tr><th> Name <th> Character(s) <th> Glyph <tbody><tr id=entity-Aacute><td> <code>Aacute;</code> <td> U+000C1 <td> <span class=glyph>Á</span> <tr id=entity-Aacute-legacy class=impl><td> <code>Aacute</code> <td> U+000C1 <td> <span>Á</span> <tr id=entity-aacute><td> <code>aacute;</code> <td> U+000E1 <td> <span class=glyph>á</span> <tr id=entity-aacute-legacy class=impl><td> <code>aacute</code> <td> U+000E1 <td> <span>á</span> <tr id=entity-Abreve><td> <code>Abreve;</code> <td> U+00102 <td> <span class=glyph>Ă</span> <tr id=entity-abreve><td> <code>abreve;</code> <td> U+00103 <td> <span class=glyph>ă</span> <tr id=entity-ac><td> <code>ac;</code> <td> U+0223E <td> <span class=glyph>∾</span> <tr id=entity-acd><td> <code>acd;</code> <td> U+0223F <td> <span class=glyph>∿</span> <tr id=entity-acE><td> <code>acE;</code> <td> U+0223E U+00333 <td> <span class="glyph compound">∾̳</span> <tr id=entity-Acirc><td> <code>Acirc;</code> <td> U+000C2 <td> <span class=glyph>Â</span> <tr id=entity-Acirc-legacy class=impl><td> <code>Acirc</code> <td> U+000C2 <td> <span>Â</span> <tr id=entity-acirc><td> <code>acirc;</code> <td> U+000E2 <td> <span class=glyph>â</span> <tr id=entity-acirc-legacy class=impl><td> <code>acirc</code> <td> U+000E2 <td> <span>â</span> <tr id=entity-acute><td> <code>acute;</code> <td> U+000B4 <td> <span class=glyph>´</span> <tr id=entity-acute-legacy class=impl><td> <code>acute</code> <td> U+000B4 <td> <span>´</span> <tr id=entity-Acy><td> <code>Acy;</code> <td> U+00410 <td> <span class=glyph>А</span> <tr id=entity-acy><td> <code>acy;</code> <td> U+00430 <td> <span class=glyph>а</span> <tr id=entity-AElig><td> <code>AElig;</code> <td> U+000C6 <td> <span class=glyph>Æ</span> <tr id=entity-AElig-legacy class=impl><td> <code>AElig</code> <td> U+000C6 <td> <span>Æ</span> <tr id=entity-aelig><td> <code>aelig;</code> <td> U+000E6 <td> <span class=glyph>æ</span> <tr id=entity-aelig-legacy class=impl><td> <code>aelig</code> <td> U+000E6 <td> <span>æ</span> <tr id=entity-af><td> <code>af;</code> <td> U+02061 <td> <span class=glyph></span> <tr id=entity-Afr><td> <code>Afr;</code> <td> U+1D504 <td> <span class=glyph>𝔄</span> <tr id=entity-afr><td> <code>afr;</code> <td> U+1D51E <td> <span class=glyph>𝔞</span> <tr id=entity-Agrave><td> <code>Agrave;</code> <td> U+000C0 <td> <span class=glyph>À</span> <tr id=entity-Agrave-legacy class=impl><td> <code>Agrave</code> <td> U+000C0 <td> <span>À</span> <tr id=entity-agrave><td> <code>agrave;</code> <td> U+000E0 <td> <span class=glyph>à</span> <tr id=entity-agrave-legacy class=impl><td> <code>agrave</code> <td> U+000E0 <td> <span>à</span> <tr id=entity-alefsym><td> <code>alefsym;</code> <td> U+02135 <td> <span class=glyph>ℵ</span> <tr id=entity-aleph><td> <code>aleph;</code> <td> U+02135 <td> <span class=glyph>ℵ</span> <tr id=entity-Alpha><td> <code>Alpha;</code> <td> U+00391 <td> <span class=glyph>Α</span> <tr id=entity-alpha><td> <code>alpha;</code> <td> U+003B1 <td> <span class=glyph>α</span> <tr id=entity-Amacr><td> <code>Amacr;</code> <td> U+00100 <td> <span class=glyph>Ā</span> <tr id=entity-amacr><td> <code>amacr;</code> <td> U+00101 <td> <span class=glyph>ā</span> <tr id=entity-amalg><td> <code>amalg;</code> <td> U+02A3F <td> <span class=glyph>⨿</span> <tr id=entity-AMP><td> <code>AMP;</code> <td> U+00026 <td> <span class=glyph>&</span> <tr id=entity-AMP-legacy class=impl><td> <code>AMP</code> <td> U+00026 <td> <span>&</span> <tr id=entity-amp><td> <code>amp;</code> <td> U+00026 <td> <span class=glyph>&</span> <tr id=entity-amp-legacy class=impl><td> <code>amp</code> <td> U+00026 <td> <span>&</span> <tr id=entity-And><td> <code>And;</code> <td> U+02A53 <td> <span class=glyph>⩓</span> <tr id=entity-and><td> <code>and;</code> <td> U+02227 <td> <span class=glyph>∧</span> <tr id=entity-andand><td> <code>andand;</code> <td> U+02A55 <td> <span class=glyph>⩕</span> <tr id=entity-andd><td> <code>andd;</code> <td> U+02A5C <td> <span class=glyph>⩜</span> <tr id=entity-andslope><td> <code>andslope;</code> <td> U+02A58 <td> <span class=glyph>⩘</span> <tr id=entity-andv><td> <code>andv;</code> <td> U+02A5A <td> <span class=glyph>⩚</span> <tr id=entity-ang><td> <code>ang;</code> <td> U+02220 <td> <span class=glyph>∠</span> <tr id=entity-ange><td> <code>ange;</code> <td> U+029A4 <td> <span class=glyph>⦤</span> <tr id=entity-angle><td> <code>angle;</code> <td> U+02220 <td> <span class=glyph>∠</span> <tr id=entity-angmsd><td> <code>angmsd;</code> <td> U+02221 <td> <span class=glyph>∡</span> <tr id=entity-angmsdaa><td> <code>angmsdaa;</code> <td> U+029A8 <td> <span class=glyph>⦨</span> <tr id=entity-angmsdab><td> <code>angmsdab;</code> <td> U+029A9 <td> <span class=glyph>⦩</span> <tr id=entity-angmsdac><td> <code>angmsdac;</code> <td> U+029AA <td> <span class=glyph>⦪</span> <tr id=entity-angmsdad><td> <code>angmsdad;</code> <td> U+029AB <td> <span class=glyph>⦫</span> <tr id=entity-angmsdae><td> <code>angmsdae;</code> <td> U+029AC <td> <span class=glyph>⦬</span> <tr id=entity-angmsdaf><td> <code>angmsdaf;</code> <td> U+029AD <td> <span class=glyph>⦭</span> <tr id=entity-angmsdag><td> <code>angmsdag;</code> <td> U+029AE <td> <span class=glyph>⦮</span> <tr id=entity-angmsdah><td> <code>angmsdah;</code> <td> U+029AF <td> <span class=glyph>⦯</span> <tr id=entity-angrt><td> <code>angrt;</code> <td> U+0221F <td> <span class=glyph>∟</span> <tr id=entity-angrtvb><td> <code>angrtvb;</code> <td> U+022BE <td> <span class=glyph>⊾</span> <tr id=entity-angrtvbd><td> <code>angrtvbd;</code> <td> U+0299D <td> <span class=glyph>⦝</span> <tr id=entity-angsph><td> <code>angsph;</code> <td> U+02222 <td> <span class=glyph>∢</span> <tr id=entity-angst><td> <code>angst;</code> <td> U+000C5 <td> <span class=glyph>Å</span> <tr id=entity-angzarr><td> <code>angzarr;</code> <td> U+0237C <td> <span class=glyph>⍼</span> <tr id=entity-Aogon><td> <code>Aogon;</code> <td> U+00104 <td> <span class=glyph>Ą</span> <tr id=entity-aogon><td> <code>aogon;</code> <td> U+00105 <td> <span class=glyph>ą</span> <tr id=entity-Aopf><td> <code>Aopf;</code> <td> U+1D538 <td> <span class=glyph>𝔸</span> <tr id=entity-aopf><td> <code>aopf;</code> <td> U+1D552 <td> <span class=glyph>𝕒</span> <tr id=entity-ap><td> <code>ap;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-apacir><td> <code>apacir;</code> <td> U+02A6F <td> <span class=glyph>⩯</span> <tr id=entity-apE><td> <code>apE;</code> <td> U+02A70 <td> <span class=glyph>⩰</span> <tr id=entity-ape><td> <code>ape;</code> <td> U+0224A <td> <span class=glyph>≊</span> <tr id=entity-apid><td> <code>apid;</code> <td> U+0224B <td> <span class=glyph>≋</span> <tr id=entity-apos><td> <code>apos;</code> <td> U+00027 <td> <span class=glyph>'</span> <tr id=entity-ApplyFunction><td> <code>ApplyFunction;</code> <td> U+02061 <td> <span class=glyph></span> <tr id=entity-approx><td> <code>approx;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-approxeq><td> <code>approxeq;</code> <td> U+0224A <td> <span class=glyph>≊</span> <tr id=entity-Aring><td> <code>Aring;</code> <td> U+000C5 <td> <span class=glyph>Å</span> <tr id=entity-Aring-legacy class=impl><td> <code>Aring</code> <td> U+000C5 <td> <span>Å</span> <tr id=entity-aring><td> <code>aring;</code> <td> U+000E5 <td> <span class=glyph>å</span> <tr id=entity-aring-legacy class=impl><td> <code>aring</code> <td> U+000E5 <td> <span>å</span> <tr id=entity-Ascr><td> <code>Ascr;</code> <td> U+1D49C <td> <span class=glyph>𝒜</span> <tr id=entity-ascr><td> <code>ascr;</code> <td> U+1D4B6 <td> <span class=glyph>𝒶</span> <tr id=entity-Assign><td> <code>Assign;</code> <td> U+02254 <td> <span class=glyph>≔</span> <tr id=entity-ast><td> <code>ast;</code> <td> U+0002A <td> <span class=glyph>*</span> <tr id=entity-asymp><td> <code>asymp;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-asympeq><td> <code>asympeq;</code> <td> U+0224D <td> <span class=glyph>≍</span> <tr id=entity-Atilde><td> <code>Atilde;</code> <td> U+000C3 <td> <span class=glyph>Ã</span> <tr id=entity-Atilde-legacy class=impl><td> <code>Atilde</code> <td> U+000C3 <td> <span>Ã</span> <tr id=entity-atilde><td> <code>atilde;</code> <td> U+000E3 <td> <span class=glyph>ã</span> <tr id=entity-atilde-legacy class=impl><td> <code>atilde</code> <td> U+000E3 <td> <span>ã</span> <tr id=entity-Auml><td> <code>Auml;</code> <td> U+000C4 <td> <span class=glyph>Ä</span> <tr id=entity-Auml-legacy class=impl><td> <code>Auml</code> <td> U+000C4 <td> <span>Ä</span> <tr id=entity-auml><td> <code>auml;</code> <td> U+000E4 <td> <span class=glyph>ä</span> <tr id=entity-auml-legacy class=impl><td> <code>auml</code> <td> U+000E4 <td> <span>ä</span> <tr id=entity-awconint><td> <code>awconint;</code> <td> U+02233 <td> <span class=glyph>∳</span> <tr id=entity-awint><td> <code>awint;</code> <td> U+02A11 <td> <span class=glyph>⨑</span> <tr id=entity-backcong><td> <code>backcong;</code> <td> U+0224C <td> <span class=glyph>≌</span> <tr id=entity-backepsilon><td> <code>backepsilon;</code> <td> U+003F6 <td> <span class=glyph>϶</span> <tr id=entity-backprime><td> <code>backprime;</code> <td> U+02035 <td> <span class=glyph>‵</span> <tr id=entity-backsim><td> <code>backsim;</code> <td> U+0223D <td> <span class=glyph>∽</span> <tr id=entity-backsimeq><td> <code>backsimeq;</code> <td> U+022CD <td> <span class=glyph>⋍</span> <tr id=entity-Backslash><td> <code>Backslash;</code> <td> U+02216 <td> <span class=glyph>∖</span> <tr id=entity-Barv><td> <code>Barv;</code> <td> U+02AE7 <td> <span class=glyph>⫧</span> <tr id=entity-barvee><td> <code>barvee;</code> <td> U+022BD <td> <span class=glyph>⊽</span> <tr id=entity-Barwed><td> <code>Barwed;</code> <td> U+02306 <td> <span class=glyph>⌆</span> <tr id=entity-barwed><td> <code>barwed;</code> <td> U+02305 <td> <span class=glyph>⌅</span> <tr id=entity-barwedge><td> <code>barwedge;</code> <td> U+02305 <td> <span class=glyph>⌅</span> <tr id=entity-bbrk><td> <code>bbrk;</code> <td> U+023B5 <td> <span class=glyph>⎵</span> <tr id=entity-bbrktbrk><td> <code>bbrktbrk;</code> <td> U+023B6 <td> <span class=glyph>⎶</span> <tr id=entity-bcong><td> <code>bcong;</code> <td> U+0224C <td> <span class=glyph>≌</span> <tr id=entity-Bcy><td> <code>Bcy;</code> <td> U+00411 <td> <span class=glyph>Б</span> <tr id=entity-bcy><td> <code>bcy;</code> <td> U+00431 <td> <span class=glyph>б</span> <tr id=entity-bdquo><td> <code>bdquo;</code> <td> U+0201E <td> <span class=glyph>„</span> <tr id=entity-becaus><td> <code>becaus;</code> <td> U+02235 <td> <span class=glyph>∵</span> <tr id=entity-Because><td> <code>Because;</code> <td> U+02235 <td> <span class=glyph>∵</span> <tr id=entity-because><td> <code>because;</code> <td> U+02235 <td> <span class=glyph>∵</span> <tr id=entity-bemptyv><td> <code>bemptyv;</code> <td> U+029B0 <td> <span class=glyph>⦰</span> <tr id=entity-bepsi><td> <code>bepsi;</code> <td> U+003F6 <td> <span class=glyph>϶</span> <tr id=entity-bernou><td> <code>bernou;</code> <td> U+0212C <td> <span class=glyph>ℬ</span> <tr id=entity-Bernoullis><td> <code>Bernoullis;</code> <td> U+0212C <td> <span class=glyph>ℬ</span> <tr id=entity-Beta><td> <code>Beta;</code> <td> U+00392 <td> <span class=glyph>Β</span> <tr id=entity-beta><td> <code>beta;</code> <td> U+003B2 <td> <span class=glyph>β</span> <tr id=entity-beth><td> <code>beth;</code> <td> U+02136 <td> <span class=glyph>ℶ</span> <tr id=entity-between><td> <code>between;</code> <td> U+0226C <td> <span class=glyph>≬</span> <tr id=entity-Bfr><td> <code>Bfr;</code> <td> U+1D505 <td> <span class=glyph>𝔅</span> <tr id=entity-bfr><td> <code>bfr;</code> <td> U+1D51F <td> <span class=glyph>𝔟</span> <tr id=entity-bigcap><td> <code>bigcap;</code> <td> U+022C2 <td> <span class=glyph>⋂</span> <tr id=entity-bigcirc><td> <code>bigcirc;</code> <td> U+025EF <td> <span class=glyph>◯</span> <tr id=entity-bigcup><td> <code>bigcup;</code> <td> U+022C3 <td> <span class=glyph>⋃</span> <tr id=entity-bigodot><td> <code>bigodot;</code> <td> U+02A00 <td> <span class=glyph>⨀</span> <tr id=entity-bigoplus><td> <code>bigoplus;</code> <td> U+02A01 <td> <span class=glyph>⨁</span> <tr id=entity-bigotimes><td> <code>bigotimes;</code> <td> U+02A02 <td> <span class=glyph>⨂</span> <tr id=entity-bigsqcup><td> <code>bigsqcup;</code> <td> U+02A06 <td> <span class=glyph>⨆</span> <tr id=entity-bigstar><td> <code>bigstar;</code> <td> U+02605 <td> <span class=glyph>★</span> <tr id=entity-bigtriangledown><td> <code>bigtriangledown;</code> <td> U+025BD <td> <span class=glyph>▽</span> <tr id=entity-bigtriangleup><td> <code>bigtriangleup;</code> <td> U+025B3 <td> <span class=glyph>△</span> <tr id=entity-biguplus><td> <code>biguplus;</code> <td> U+02A04 <td> <span class=glyph>⨄</span> <tr id=entity-bigvee><td> <code>bigvee;</code> <td> U+022C1 <td> <span class=glyph>⋁</span> <tr id=entity-bigwedge><td> <code>bigwedge;</code> <td> U+022C0 <td> <span class=glyph>⋀</span> <tr id=entity-bkarow><td> <code>bkarow;</code> <td> U+0290D <td> <span class=glyph>⤍</span> <tr id=entity-blacklozenge><td> <code>blacklozenge;</code> <td> U+029EB <td> <span class=glyph>⧫</span> <tr id=entity-blacksquare><td> <code>blacksquare;</code> <td> U+025AA <td> <span class=glyph>▪</span> <tr id=entity-blacktriangle><td> <code>blacktriangle;</code> <td> U+025B4 <td> <span class=glyph>▴</span> <tr id=entity-blacktriangledown><td> <code>blacktriangledown;</code> <td> U+025BE <td> <span class=glyph>▾</span> <tr id=entity-blacktriangleleft><td> <code>blacktriangleleft;</code> <td> U+025C2 <td> <span class=glyph>◂</span> <tr id=entity-blacktriangleright><td> <code>blacktriangleright;</code> <td> U+025B8 <td> <span class=glyph>▸</span> <tr id=entity-blank><td> <code>blank;</code> <td> U+02423 <td> <span class=glyph>␣</span> <tr id=entity-blk12><td> <code>blk12;</code> <td> U+02592 <td> <span class=glyph>▒</span> <tr id=entity-blk14><td> <code>blk14;</code> <td> U+02591 <td> <span class=glyph>░</span> <tr id=entity-blk34><td> <code>blk34;</code> <td> U+02593 <td> <span class=glyph>▓</span> <tr id=entity-block><td> <code>block;</code> <td> U+02588 <td> <span class=glyph>█</span> <tr id=entity-bne><td> <code>bne;</code> <td> U+0003D U+020E5 <td> <span class="glyph compound">=⃥</span> <tr id=entity-bnequiv><td> <code>bnequiv;</code> <td> U+02261 U+020E5 <td> <span class="glyph compound">≡⃥</span> <tr id=entity-bNot><td> <code>bNot;</code> <td> U+02AED <td> <span class=glyph>⫭</span> <tr id=entity-bnot><td> <code>bnot;</code> <td> U+02310 <td> <span class=glyph>⌐</span> <tr id=entity-Bopf><td> <code>Bopf;</code> <td> U+1D539 <td> <span class=glyph>𝔹</span> <tr id=entity-bopf><td> <code>bopf;</code> <td> U+1D553 <td> <span class=glyph>𝕓</span> <tr id=entity-bot><td> <code>bot;</code> <td> U+022A5 <td> <span class=glyph>⊥</span> <tr id=entity-bottom><td> <code>bottom;</code> <td> U+022A5 <td> <span class=glyph>⊥</span> <tr id=entity-bowtie><td> <code>bowtie;</code> <td> U+022C8 <td> <span class=glyph>⋈</span> <tr id=entity-boxbox><td> <code>boxbox;</code> <td> U+029C9 <td> <span class=glyph>⧉</span> <tr id=entity-boxDL><td> <code>boxDL;</code> <td> U+02557 <td> <span class=glyph>╗</span> <tr id=entity-boxDl><td> <code>boxDl;</code> <td> U+02556 <td> <span class=glyph>╖</span> <tr id=entity-boxdL><td> <code>boxdL;</code> <td> U+02555 <td> <span class=glyph>╕</span> <tr id=entity-boxdl><td> <code>boxdl;</code> <td> U+02510 <td> <span class=glyph>┐</span> <tr id=entity-boxDR><td> <code>boxDR;</code> <td> U+02554 <td> <span class=glyph>╔</span> <tr id=entity-boxDr><td> <code>boxDr;</code> <td> U+02553 <td> <span class=glyph>╓</span> <tr id=entity-boxdR><td> <code>boxdR;</code> <td> U+02552 <td> <span class=glyph>╒</span> <tr id=entity-boxdr><td> <code>boxdr;</code> <td> U+0250C <td> <span class=glyph>┌</span> <tr id=entity-boxH><td> <code>boxH;</code> <td> U+02550 <td> <span class=glyph>═</span> <tr id=entity-boxh><td> <code>boxh;</code> <td> U+02500 <td> <span class=glyph>─</span> <tr id=entity-boxHD><td> <code>boxHD;</code> <td> U+02566 <td> <span class=glyph>╦</span> <tr id=entity-boxHd><td> <code>boxHd;</code> <td> U+02564 <td> <span class=glyph>╤</span> <tr id=entity-boxhD><td> <code>boxhD;</code> <td> U+02565 <td> <span class=glyph>╥</span> <tr id=entity-boxhd><td> <code>boxhd;</code> <td> U+0252C <td> <span class=glyph>┬</span> <tr id=entity-boxHU><td> <code>boxHU;</code> <td> U+02569 <td> <span class=glyph>╩</span> <tr id=entity-boxHu><td> <code>boxHu;</code> <td> U+02567 <td> <span class=glyph>╧</span> <tr id=entity-boxhU><td> <code>boxhU;</code> <td> U+02568 <td> <span class=glyph>╨</span> <tr id=entity-boxhu><td> <code>boxhu;</code> <td> U+02534 <td> <span class=glyph>┴</span> <tr id=entity-boxminus><td> <code>boxminus;</code> <td> U+0229F <td> <span class=glyph>⊟</span> <tr id=entity-boxplus><td> <code>boxplus;</code> <td> U+0229E <td> <span class=glyph>⊞</span> <tr id=entity-boxtimes><td> <code>boxtimes;</code> <td> U+022A0 <td> <span class=glyph>⊠</span> <tr id=entity-boxUL><td> <code>boxUL;</code> <td> U+0255D <td> <span class=glyph>╝</span> <tr id=entity-boxUl><td> <code>boxUl;</code> <td> U+0255C <td> <span class=glyph>╜</span> <tr id=entity-boxuL><td> <code>boxuL;</code> <td> U+0255B <td> <span class=glyph>╛</span> <tr id=entity-boxul><td> <code>boxul;</code> <td> U+02518 <td> <span class=glyph>┘</span> <tr id=entity-boxUR><td> <code>boxUR;</code> <td> U+0255A <td> <span class=glyph>╚</span> <tr id=entity-boxUr><td> <code>boxUr;</code> <td> U+02559 <td> <span class=glyph>╙</span> <tr id=entity-boxuR><td> <code>boxuR;</code> <td> U+02558 <td> <span class=glyph>╘</span> <tr id=entity-boxur><td> <code>boxur;</code> <td> U+02514 <td> <span class=glyph>└</span> <tr id=entity-boxV><td> <code>boxV;</code> <td> U+02551 <td> <span class=glyph>║</span> <tr id=entity-boxv><td> <code>boxv;</code> <td> U+02502 <td> <span class=glyph>│</span> <tr id=entity-boxVH><td> <code>boxVH;</code> <td> U+0256C <td> <span class=glyph>╬</span> <tr id=entity-boxVh><td> <code>boxVh;</code> <td> U+0256B <td> <span class=glyph>╫</span> <tr id=entity-boxvH><td> <code>boxvH;</code> <td> U+0256A <td> <span class=glyph>╪</span> <tr id=entity-boxvh><td> <code>boxvh;</code> <td> U+0253C <td> <span class=glyph>┼</span> <tr id=entity-boxVL><td> <code>boxVL;</code> <td> U+02563 <td> <span class=glyph>╣</span> <tr id=entity-boxVl><td> <code>boxVl;</code> <td> U+02562 <td> <span class=glyph>╢</span> <tr id=entity-boxvL><td> <code>boxvL;</code> <td> U+02561 <td> <span class=glyph>╡</span> <tr id=entity-boxvl><td> <code>boxvl;</code> <td> U+02524 <td> <span class=glyph>┤</span> <tr id=entity-boxVR><td> <code>boxVR;</code> <td> U+02560 <td> <span class=glyph>╠</span> <tr id=entity-boxVr><td> <code>boxVr;</code> <td> U+0255F <td> <span class=glyph>╟</span> <tr id=entity-boxvR><td> <code>boxvR;</code> <td> U+0255E <td> <span class=glyph>╞</span> <tr id=entity-boxvr><td> <code>boxvr;</code> <td> U+0251C <td> <span class=glyph>├</span> <tr id=entity-bprime><td> <code>bprime;</code> <td> U+02035 <td> <span class=glyph>‵</span> <tr id=entity-Breve><td> <code>Breve;</code> <td> U+002D8 <td> <span class=glyph>˘</span> <tr id=entity-breve><td> <code>breve;</code> <td> U+002D8 <td> <span class=glyph>˘</span> <tr id=entity-brvbar><td> <code>brvbar;</code> <td> U+000A6 <td> <span class=glyph>¦</span> <tr id=entity-brvbar-legacy class=impl><td> <code>brvbar</code> <td> U+000A6 <td> <span>¦</span> <tr id=entity-Bscr><td> <code>Bscr;</code> <td> U+0212C <td> <span class=glyph>ℬ</span> <tr id=entity-bscr><td> <code>bscr;</code> <td> U+1D4B7 <td> <span class=glyph>𝒷</span> <tr id=entity-bsemi><td> <code>bsemi;</code> <td> U+0204F <td> <span class=glyph>⁏</span> <tr id=entity-bsim><td> <code>bsim;</code> <td> U+0223D <td> <span class=glyph>∽</span> <tr id=entity-bsime><td> <code>bsime;</code> <td> U+022CD <td> <span class=glyph>⋍</span> <tr id=entity-bsol><td> <code>bsol;</code> <td> U+0005C <td> <span class=glyph>\</span> <tr id=entity-bsolb><td> <code>bsolb;</code> <td> U+029C5 <td> <span class=glyph>⧅</span> <tr id=entity-bsolhsub><td> <code>bsolhsub;</code> <td> U+027C8 <td> <span class=glyph>⟈</span> <tr id=entity-bull><td> <code>bull;</code> <td> U+02022 <td> <span class=glyph>•</span> <tr id=entity-bullet><td> <code>bullet;</code> <td> U+02022 <td> <span class=glyph>•</span> <tr id=entity-bump><td> <code>bump;</code> <td> U+0224E <td> <span class=glyph>≎</span> <tr id=entity-bumpE><td> <code>bumpE;</code> <td> U+02AAE <td> <span class=glyph>⪮</span> <tr id=entity-bumpe><td> <code>bumpe;</code> <td> U+0224F <td> <span class=glyph>≏</span> <tr id=entity-Bumpeq><td> <code>Bumpeq;</code> <td> U+0224E <td> <span class=glyph>≎</span> <tr id=entity-bumpeq><td> <code>bumpeq;</code> <td> U+0224F <td> <span class=glyph>≏</span> <tr id=entity-Cacute><td> <code>Cacute;</code> <td> U+00106 <td> <span class=glyph>Ć</span> <tr id=entity-cacute><td> <code>cacute;</code> <td> U+00107 <td> <span class=glyph>ć</span> <tr id=entity-Cap><td> <code>Cap;</code> <td> U+022D2 <td> <span class=glyph>⋒</span> <tr id=entity-cap><td> <code>cap;</code> <td> U+02229 <td> <span class=glyph>∩</span> <tr id=entity-capand><td> <code>capand;</code> <td> U+02A44 <td> <span class=glyph>⩄</span> <tr id=entity-capbrcup><td> <code>capbrcup;</code> <td> U+02A49 <td> <span class=glyph>⩉</span> <tr id=entity-capcap><td> <code>capcap;</code> <td> U+02A4B <td> <span class=glyph>⩋</span> <tr id=entity-capcup><td> <code>capcup;</code> <td> U+02A47 <td> <span class=glyph>⩇</span> <tr id=entity-capdot><td> <code>capdot;</code> <td> U+02A40 <td> <span class=glyph>⩀</span> <tr id=entity-CapitalDifferentialD><td> <code>CapitalDifferentialD;</code> <td> U+02145 <td> <span class=glyph>ⅅ</span> <tr id=entity-caps><td> <code>caps;</code> <td> U+02229 U+0FE00 <td> <span class="glyph compound">∩︀</span> <tr id=entity-caret><td> <code>caret;</code> <td> U+02041 <td> <span class=glyph>⁁</span> <tr id=entity-caron><td> <code>caron;</code> <td> U+002C7 <td> <span class=glyph>ˇ</span> <tr id=entity-Cayleys><td> <code>Cayleys;</code> <td> U+0212D <td> <span class=glyph>ℭ</span> <tr id=entity-ccaps><td> <code>ccaps;</code> <td> U+02A4D <td> <span class=glyph>⩍</span> <tr id=entity-Ccaron><td> <code>Ccaron;</code> <td> U+0010C <td> <span class=glyph>Č</span> <tr id=entity-ccaron><td> <code>ccaron;</code> <td> U+0010D <td> <span class=glyph>č</span> <tr id=entity-Ccedil><td> <code>Ccedil;</code> <td> U+000C7 <td> <span class=glyph>Ç</span> <tr id=entity-Ccedil-legacy class=impl><td> <code>Ccedil</code> <td> U+000C7 <td> <span>Ç</span> <tr id=entity-ccedil><td> <code>ccedil;</code> <td> U+000E7 <td> <span class=glyph>ç</span> <tr id=entity-ccedil-legacy class=impl><td> <code>ccedil</code> <td> U+000E7 <td> <span>ç</span> <tr id=entity-Ccirc><td> <code>Ccirc;</code> <td> U+00108 <td> <span class=glyph>Ĉ</span> <tr id=entity-ccirc><td> <code>ccirc;</code> <td> U+00109 <td> <span class=glyph>ĉ</span> <tr id=entity-Cconint><td> <code>Cconint;</code> <td> U+02230 <td> <span class=glyph>∰</span> <tr id=entity-ccups><td> <code>ccups;</code> <td> U+02A4C <td> <span class=glyph>⩌</span> <tr id=entity-ccupssm><td> <code>ccupssm;</code> <td> U+02A50 <td> <span class=glyph>⩐</span> <tr id=entity-Cdot><td> <code>Cdot;</code> <td> U+0010A <td> <span class=glyph>Ċ</span> <tr id=entity-cdot><td> <code>cdot;</code> <td> U+0010B <td> <span class=glyph>ċ</span> <tr id=entity-cedil><td> <code>cedil;</code> <td> U+000B8 <td> <span class=glyph>¸</span> <tr id=entity-cedil-legacy class=impl><td> <code>cedil</code> <td> U+000B8 <td> <span>¸</span> <tr id=entity-Cedilla><td> <code>Cedilla;</code> <td> U+000B8 <td> <span class=glyph>¸</span> <tr id=entity-cemptyv><td> <code>cemptyv;</code> <td> U+029B2 <td> <span class=glyph>⦲</span> <tr id=entity-cent><td> <code>cent;</code> <td> U+000A2 <td> <span class=glyph>¢</span> <tr id=entity-cent-legacy class=impl><td> <code>cent</code> <td> U+000A2 <td> <span>¢</span> <tr id=entity-CenterDot><td> <code>CenterDot;</code> <td> U+000B7 <td> <span class=glyph>·</span> <tr id=entity-centerdot><td> <code>centerdot;</code> <td> U+000B7 <td> <span class=glyph>·</span> <tr id=entity-Cfr><td> <code>Cfr;</code> <td> U+0212D <td> <span class=glyph>ℭ</span> <tr id=entity-cfr><td> <code>cfr;</code> <td> U+1D520 <td> <span class=glyph>𝔠</span> <tr id=entity-CHcy><td> <code>CHcy;</code> <td> U+00427 <td> <span class=glyph>Ч</span> <tr id=entity-chcy><td> <code>chcy;</code> <td> U+00447 <td> <span class=glyph>ч</span> <tr id=entity-check><td> <code>check;</code> <td> U+02713 <td> <span class=glyph>✓</span> <tr id=entity-checkmark><td> <code>checkmark;</code> <td> U+02713 <td> <span class=glyph>✓</span> <tr id=entity-Chi><td> <code>Chi;</code> <td> U+003A7 <td> <span class=glyph>Χ</span> <tr id=entity-chi><td> <code>chi;</code> <td> U+003C7 <td> <span class=glyph>χ</span> <tr id=entity-cir><td> <code>cir;</code> <td> U+025CB <td> <span class=glyph>○</span> <tr id=entity-circ><td> <code>circ;</code> <td> U+002C6 <td> <span class=glyph>ˆ</span> <tr id=entity-circeq><td> <code>circeq;</code> <td> U+02257 <td> <span class=glyph>≗</span> <tr id=entity-circlearrowleft><td> <code>circlearrowleft;</code> <td> U+021BA <td> <span class=glyph>↺</span> <tr id=entity-circlearrowright><td> <code>circlearrowright;</code> <td> U+021BB <td> <span class=glyph>↻</span> <tr id=entity-circledast><td> <code>circledast;</code> <td> U+0229B <td> <span class=glyph>⊛</span> <tr id=entity-circledcirc><td> <code>circledcirc;</code> <td> U+0229A <td> <span class=glyph>⊚</span> <tr id=entity-circleddash><td> <code>circleddash;</code> <td> U+0229D <td> <span class=glyph>⊝</span> <tr id=entity-CircleDot><td> <code>CircleDot;</code> <td> U+02299 <td> <span class=glyph>⊙</span> <tr id=entity-circledR><td> <code>circledR;</code> <td> U+000AE <td> <span class=glyph>®</span> <tr id=entity-circledS><td> <code>circledS;</code> <td> U+024C8 <td> <span class=glyph>Ⓢ</span> <tr id=entity-CircleMinus><td> <code>CircleMinus;</code> <td> U+02296 <td> <span class=glyph>⊖</span> <tr id=entity-CirclePlus><td> <code>CirclePlus;</code> <td> U+02295 <td> <span class=glyph>⊕</span> <tr id=entity-CircleTimes><td> <code>CircleTimes;</code> <td> U+02297 <td> <span class=glyph>⊗</span> <tr id=entity-cirE><td> <code>cirE;</code> <td> U+029C3 <td> <span class=glyph>⧃</span> <tr id=entity-cire><td> <code>cire;</code> <td> U+02257 <td> <span class=glyph>≗</span> <tr id=entity-cirfnint><td> <code>cirfnint;</code> <td> U+02A10 <td> <span class=glyph>⨐</span> <tr id=entity-cirmid><td> <code>cirmid;</code> <td> U+02AEF <td> <span class=glyph>⫯</span> <tr id=entity-cirscir><td> <code>cirscir;</code> <td> U+029C2 <td> <span class=glyph>⧂</span> <tr id=entity-ClockwiseContourIntegral><td> <code>ClockwiseContourIntegral;</code> <td> U+02232 <td> <span class=glyph>∲</span> <tr id=entity-CloseCurlyDoubleQuote><td> <code>CloseCurlyDoubleQuote;</code> <td> U+0201D <td> <span class=glyph>”</span> <tr id=entity-CloseCurlyQuote><td> <code>CloseCurlyQuote;</code> <td> U+02019 <td> <span class=glyph>’</span> <tr id=entity-clubs><td> <code>clubs;</code> <td> U+02663 <td> <span class=glyph>♣</span> <tr id=entity-clubsuit><td> <code>clubsuit;</code> <td> U+02663 <td> <span class=glyph>♣</span> <tr id=entity-Colon><td> <code>Colon;</code> <td> U+02237 <td> <span class=glyph>∷</span> <tr id=entity-colon><td> <code>colon;</code> <td> U+0003A <td> <span class=glyph>:</span> <tr id=entity-Colone><td> <code>Colone;</code> <td> U+02A74 <td> <span class=glyph>⩴</span> <tr id=entity-colone><td> <code>colone;</code> <td> U+02254 <td> <span class=glyph>≔</span> <tr id=entity-coloneq><td> <code>coloneq;</code> <td> U+02254 <td> <span class=glyph>≔</span> <tr id=entity-comma><td> <code>comma;</code> <td> U+0002C <td> <span class=glyph>,</span> <tr id=entity-commat><td> <code>commat;</code> <td> U+00040 <td> <span class=glyph>@</span> <tr id=entity-comp><td> <code>comp;</code> <td> U+02201 <td> <span class=glyph>∁</span> <tr id=entity-compfn><td> <code>compfn;</code> <td> U+02218 <td> <span class=glyph>∘</span> <tr id=entity-complement><td> <code>complement;</code> <td> U+02201 <td> <span class=glyph>∁</span> <tr id=entity-complexes><td> <code>complexes;</code> <td> U+02102 <td> <span class=glyph>ℂ</span> <tr id=entity-cong><td> <code>cong;</code> <td> U+02245 <td> <span class=glyph>≅</span> <tr id=entity-congdot><td> <code>congdot;</code> <td> U+02A6D <td> <span class=glyph>⩭</span> <tr id=entity-Congruent><td> <code>Congruent;</code> <td> U+02261 <td> <span class=glyph>≡</span> <tr id=entity-Conint><td> <code>Conint;</code> <td> U+0222F <td> <span class=glyph>∯</span> <tr id=entity-conint><td> <code>conint;</code> <td> U+0222E <td> <span class=glyph>∮</span> <tr id=entity-ContourIntegral><td> <code>ContourIntegral;</code> <td> U+0222E <td> <span class=glyph>∮</span> <tr id=entity-Copf><td> <code>Copf;</code> <td> U+02102 <td> <span class=glyph>ℂ</span> <tr id=entity-copf><td> <code>copf;</code> <td> U+1D554 <td> <span class=glyph>𝕔</span> <tr id=entity-coprod><td> <code>coprod;</code> <td> U+02210 <td> <span class=glyph>∐</span> <tr id=entity-Coproduct><td> <code>Coproduct;</code> <td> U+02210 <td> <span class=glyph>∐</span> <tr id=entity-COPY><td> <code>COPY;</code> <td> U+000A9 <td> <span class=glyph>©</span> <tr id=entity-COPY-legacy class=impl><td> <code>COPY</code> <td> U+000A9 <td> <span>©</span> <tr id=entity-copy><td> <code>copy;</code> <td> U+000A9 <td> <span class=glyph>©</span> <tr id=entity-copy-legacy class=impl><td> <code>copy</code> <td> U+000A9 <td> <span>©</span> <tr id=entity-copysr><td> <code>copysr;</code> <td> U+02117 <td> <span class=glyph>℗</span> <tr id=entity-CounterClockwiseContourIntegral><td> <code>CounterClockwiseContourIntegral;</code> <td> U+02233 <td> <span class=glyph>∳</span> <tr id=entity-crarr><td> <code>crarr;</code> <td> U+021B5 <td> <span class=glyph>↵</span> <tr id=entity-Cross><td> <code>Cross;</code> <td> U+02A2F <td> <span class=glyph>⨯</span> <tr id=entity-cross><td> <code>cross;</code> <td> U+02717 <td> <span class=glyph>✗</span> <tr id=entity-Cscr><td> <code>Cscr;</code> <td> U+1D49E <td> <span class=glyph>𝒞</span> <tr id=entity-cscr><td> <code>cscr;</code> <td> U+1D4B8 <td> <span class=glyph>𝒸</span> <tr id=entity-csub><td> <code>csub;</code> <td> U+02ACF <td> <span class=glyph>⫏</span> <tr id=entity-csube><td> <code>csube;</code> <td> U+02AD1 <td> <span class=glyph>⫑</span> <tr id=entity-csup><td> <code>csup;</code> <td> U+02AD0 <td> <span class=glyph>⫐</span> <tr id=entity-csupe><td> <code>csupe;</code> <td> U+02AD2 <td> <span class=glyph>⫒</span> <tr id=entity-ctdot><td> <code>ctdot;</code> <td> U+022EF <td> <span class=glyph>⋯</span> <tr id=entity-cudarrl><td> <code>cudarrl;</code> <td> U+02938 <td> <span class=glyph>⤸</span> <tr id=entity-cudarrr><td> <code>cudarrr;</code> <td> U+02935 <td> <span class=glyph>⤵</span> <tr id=entity-cuepr><td> <code>cuepr;</code> <td> U+022DE <td> <span class=glyph>⋞</span> <tr id=entity-cuesc><td> <code>cuesc;</code> <td> U+022DF <td> <span class=glyph>⋟</span> <tr id=entity-cularr><td> <code>cularr;</code> <td> U+021B6 <td> <span class=glyph>↶</span> <tr id=entity-cularrp><td> <code>cularrp;</code> <td> U+0293D <td> <span class=glyph>⤽</span> <tr id=entity-Cup><td> <code>Cup;</code> <td> U+022D3 <td> <span class=glyph>⋓</span> <tr id=entity-cup><td> <code>cup;</code> <td> U+0222A <td> <span class=glyph>∪</span> <tr id=entity-cupbrcap><td> <code>cupbrcap;</code> <td> U+02A48 <td> <span class=glyph>⩈</span> <tr id=entity-CupCap><td> <code>CupCap;</code> <td> U+0224D <td> <span class=glyph>≍</span> <tr id=entity-cupcap><td> <code>cupcap;</code> <td> U+02A46 <td> <span class=glyph>⩆</span> <tr id=entity-cupcup><td> <code>cupcup;</code> <td> U+02A4A <td> <span class=glyph>⩊</span> <tr id=entity-cupdot><td> <code>cupdot;</code> <td> U+0228D <td> <span class=glyph>⊍</span> <tr id=entity-cupor><td> <code>cupor;</code> <td> U+02A45 <td> <span class=glyph>⩅</span> <tr id=entity-cups><td> <code>cups;</code> <td> U+0222A U+0FE00 <td> <span class="glyph compound">∪︀</span> <tr id=entity-curarr><td> <code>curarr;</code> <td> U+021B7 <td> <span class=glyph>↷</span> <tr id=entity-curarrm><td> <code>curarrm;</code> <td> U+0293C <td> <span class=glyph>⤼</span> <tr id=entity-curlyeqprec><td> <code>curlyeqprec;</code> <td> U+022DE <td> <span class=glyph>⋞</span> <tr id=entity-curlyeqsucc><td> <code>curlyeqsucc;</code> <td> U+022DF <td> <span class=glyph>⋟</span> <tr id=entity-curlyvee><td> <code>curlyvee;</code> <td> U+022CE <td> <span class=glyph>⋎</span> <tr id=entity-curlywedge><td> <code>curlywedge;</code> <td> U+022CF <td> <span class=glyph>⋏</span> <tr id=entity-curren><td> <code>curren;</code> <td> U+000A4 <td> <span class=glyph>¤</span> <tr id=entity-curren-legacy class=impl><td> <code>curren</code> <td> U+000A4 <td> <span>¤</span> <tr id=entity-curvearrowleft><td> <code>curvearrowleft;</code> <td> U+021B6 <td> <span class=glyph>↶</span> <tr id=entity-curvearrowright><td> <code>curvearrowright;</code> <td> U+021B7 <td> <span class=glyph>↷</span> <tr id=entity-cuvee><td> <code>cuvee;</code> <td> U+022CE <td> <span class=glyph>⋎</span> <tr id=entity-cuwed><td> <code>cuwed;</code> <td> U+022CF <td> <span class=glyph>⋏</span> <tr id=entity-cwconint><td> <code>cwconint;</code> <td> U+02232 <td> <span class=glyph>∲</span> <tr id=entity-cwint><td> <code>cwint;</code> <td> U+02231 <td> <span class=glyph>∱</span> <tr id=entity-cylcty><td> <code>cylcty;</code> <td> U+0232D <td> <span class=glyph>⌭</span> <tr id=entity-Dagger><td> <code>Dagger;</code> <td> U+02021 <td> <span class=glyph>‡</span> <tr id=entity-dagger><td> <code>dagger;</code> <td> U+02020 <td> <span class=glyph>†</span> <tr id=entity-daleth><td> <code>daleth;</code> <td> U+02138 <td> <span class=glyph>ℸ</span> <tr id=entity-Darr><td> <code>Darr;</code> <td> U+021A1 <td> <span class=glyph>↡</span> <tr id=entity-dArr><td> <code>dArr;</code> <td> U+021D3 <td> <span class=glyph>⇓</span> <tr id=entity-darr><td> <code>darr;</code> <td> U+02193 <td> <span class=glyph>↓</span> <tr id=entity-dash><td> <code>dash;</code> <td> U+02010 <td> <span class=glyph>‐</span> <tr id=entity-Dashv><td> <code>Dashv;</code> <td> U+02AE4 <td> <span class=glyph>⫤</span> <tr id=entity-dashv><td> <code>dashv;</code> <td> U+022A3 <td> <span class=glyph>⊣</span> <tr id=entity-dbkarow><td> <code>dbkarow;</code> <td> U+0290F <td> <span class=glyph>⤏</span> <tr id=entity-dblac><td> <code>dblac;</code> <td> U+002DD <td> <span class=glyph>˝</span> <tr id=entity-Dcaron><td> <code>Dcaron;</code> <td> U+0010E <td> <span class=glyph>Ď</span> <tr id=entity-dcaron><td> <code>dcaron;</code> <td> U+0010F <td> <span class=glyph>ď</span> <tr id=entity-Dcy><td> <code>Dcy;</code> <td> U+00414 <td> <span class=glyph>Д</span> <tr id=entity-dcy><td> <code>dcy;</code> <td> U+00434 <td> <span class=glyph>д</span> <tr id=entity-DD><td> <code>DD;</code> <td> U+02145 <td> <span class=glyph>ⅅ</span> <tr id=entity-dd><td> <code>dd;</code> <td> U+02146 <td> <span class=glyph>ⅆ</span> <tr id=entity-ddagger><td> <code>ddagger;</code> <td> U+02021 <td> <span class=glyph>‡</span> <tr id=entity-ddarr><td> <code>ddarr;</code> <td> U+021CA <td> <span class=glyph>⇊</span> <tr id=entity-DDotrahd><td> <code>DDotrahd;</code> <td> U+02911 <td> <span class=glyph>⤑</span> <tr id=entity-ddotseq><td> <code>ddotseq;</code> <td> U+02A77 <td> <span class=glyph>⩷</span> <tr id=entity-deg><td> <code>deg;</code> <td> U+000B0 <td> <span class=glyph>°</span> <tr id=entity-deg-legacy class=impl><td> <code>deg</code> <td> U+000B0 <td> <span>°</span> <tr id=entity-Del><td> <code>Del;</code> <td> U+02207 <td> <span class=glyph>∇</span> <tr id=entity-Delta><td> <code>Delta;</code> <td> U+00394 <td> <span class=glyph>Δ</span> <tr id=entity-delta><td> <code>delta;</code> <td> U+003B4 <td> <span class=glyph>δ</span> <tr id=entity-demptyv><td> <code>demptyv;</code> <td> U+029B1 <td> <span class=glyph>⦱</span> <tr id=entity-dfisht><td> <code>dfisht;</code> <td> U+0297F <td> <span class=glyph>⥿</span> <tr id=entity-Dfr><td> <code>Dfr;</code> <td> U+1D507 <td> <span class=glyph>𝔇</span> <tr id=entity-dfr><td> <code>dfr;</code> <td> U+1D521 <td> <span class=glyph>𝔡</span> <tr id=entity-dHar><td> <code>dHar;</code> <td> U+02965 <td> <span class=glyph>⥥</span> <tr id=entity-dharl><td> <code>dharl;</code> <td> U+021C3 <td> <span class=glyph>⇃</span> <tr id=entity-dharr><td> <code>dharr;</code> <td> U+021C2 <td> <span class=glyph>⇂</span> <tr id=entity-DiacriticalAcute><td> <code>DiacriticalAcute;</code> <td> U+000B4 <td> <span class=glyph>´</span> <tr id=entity-DiacriticalDot><td> <code>DiacriticalDot;</code> <td> U+002D9 <td> <span class=glyph>˙</span> <tr id=entity-DiacriticalDoubleAcute><td> <code>DiacriticalDoubleAcute;</code> <td> U+002DD <td> <span class=glyph>˝</span> <tr id=entity-DiacriticalGrave><td> <code>DiacriticalGrave;</code> <td> U+00060 <td> <span class=glyph>`</span> <tr id=entity-DiacriticalTilde><td> <code>DiacriticalTilde;</code> <td> U+002DC <td> <span class=glyph>˜</span> <tr id=entity-diam><td> <code>diam;</code> <td> U+022C4 <td> <span class=glyph>⋄</span> <tr id=entity-Diamond><td> <code>Diamond;</code> <td> U+022C4 <td> <span class=glyph>⋄</span> <tr id=entity-diamond><td> <code>diamond;</code> <td> U+022C4 <td> <span class=glyph>⋄</span> <tr id=entity-diamondsuit><td> <code>diamondsuit;</code> <td> U+02666 <td> <span class=glyph>♦</span> <tr id=entity-diams><td> <code>diams;</code> <td> U+02666 <td> <span class=glyph>♦</span> <tr id=entity-die><td> <code>die;</code> <td> U+000A8 <td> <span class=glyph>¨</span> <tr id=entity-DifferentialD><td> <code>DifferentialD;</code> <td> U+02146 <td> <span class=glyph>ⅆ</span> <tr id=entity-digamma><td> <code>digamma;</code> <td> U+003DD <td> <span class=glyph>ϝ</span> <tr id=entity-disin><td> <code>disin;</code> <td> U+022F2 <td> <span class=glyph>⋲</span> <tr id=entity-div><td> <code>div;</code> <td> U+000F7 <td> <span class=glyph>÷</span> <tr id=entity-divide><td> <code>divide;</code> <td> U+000F7 <td> <span class=glyph>÷</span> <tr id=entity-divide-legacy class=impl><td> <code>divide</code> <td> U+000F7 <td> <span>÷</span> <tr id=entity-divideontimes><td> <code>divideontimes;</code> <td> U+022C7 <td> <span class=glyph>⋇</span> <tr id=entity-divonx><td> <code>divonx;</code> <td> U+022C7 <td> <span class=glyph>⋇</span> <tr id=entity-DJcy><td> <code>DJcy;</code> <td> U+00402 <td> <span class=glyph>Ђ</span> <tr id=entity-djcy><td> <code>djcy;</code> <td> U+00452 <td> <span class=glyph>ђ</span> <tr id=entity-dlcorn><td> <code>dlcorn;</code> <td> U+0231E <td> <span class=glyph>⌞</span> <tr id=entity-dlcrop><td> <code>dlcrop;</code> <td> U+0230D <td> <span class=glyph>⌍</span> <tr id=entity-dollar><td> <code>dollar;</code> <td> U+00024 <td> <span class=glyph>$</span> <tr id=entity-Dopf><td> <code>Dopf;</code> <td> U+1D53B <td> <span class=glyph>𝔻</span> <tr id=entity-dopf><td> <code>dopf;</code> <td> U+1D555 <td> <span class=glyph>𝕕</span> <tr id=entity-Dot><td> <code>Dot;</code> <td> U+000A8 <td> <span class=glyph>¨</span> <tr id=entity-dot><td> <code>dot;</code> <td> U+002D9 <td> <span class=glyph>˙</span> <tr id=entity-DotDot><td> <code>DotDot;</code> <td> U+020DC <td> <span class="glyph composition">◌⃜</span> <tr id=entity-doteq><td> <code>doteq;</code> <td> U+02250 <td> <span class=glyph>≐</span> <tr id=entity-doteqdot><td> <code>doteqdot;</code> <td> U+02251 <td> <span class=glyph>≑</span> <tr id=entity-DotEqual><td> <code>DotEqual;</code> <td> U+02250 <td> <span class=glyph>≐</span> <tr id=entity-dotminus><td> <code>dotminus;</code> <td> U+02238 <td> <span class=glyph>∸</span> <tr id=entity-dotplus><td> <code>dotplus;</code> <td> U+02214 <td> <span class=glyph>∔</span> <tr id=entity-dotsquare><td> <code>dotsquare;</code> <td> U+022A1 <td> <span class=glyph>⊡</span> <tr id=entity-doublebarwedge><td> <code>doublebarwedge;</code> <td> U+02306 <td> <span class=glyph>⌆</span> <tr id=entity-DoubleContourIntegral><td> <code>DoubleContourIntegral;</code> <td> U+0222F <td> <span class=glyph>∯</span> <tr id=entity-DoubleDot><td> <code>DoubleDot;</code> <td> U+000A8 <td> <span class=glyph>¨</span> <tr id=entity-DoubleDownArrow><td> <code>DoubleDownArrow;</code> <td> U+021D3 <td> <span class=glyph>⇓</span> <tr id=entity-DoubleLeftArrow><td> <code>DoubleLeftArrow;</code> <td> U+021D0 <td> <span class=glyph>⇐</span> <tr id=entity-DoubleLeftRightArrow><td> <code>DoubleLeftRightArrow;</code> <td> U+021D4 <td> <span class=glyph>⇔</span> <tr id=entity-DoubleLeftTee><td> <code>DoubleLeftTee;</code> <td> U+02AE4 <td> <span class=glyph>⫤</span> <tr id=entity-DoubleLongLeftArrow><td> <code>DoubleLongLeftArrow;</code> <td> U+027F8 <td> <span class=glyph>⟸</span> <tr id=entity-DoubleLongLeftRightArrow><td> <code>DoubleLongLeftRightArrow;</code> <td> U+027FA <td> <span class=glyph>⟺</span> <tr id=entity-DoubleLongRightArrow><td> <code>DoubleLongRightArrow;</code> <td> U+027F9 <td> <span class=glyph>⟹</span> <tr id=entity-DoubleRightArrow><td> <code>DoubleRightArrow;</code> <td> U+021D2 <td> <span class=glyph>⇒</span> <tr id=entity-DoubleRightTee><td> <code>DoubleRightTee;</code> <td> U+022A8 <td> <span class=glyph>⊨</span> <tr id=entity-DoubleUpArrow><td> <code>DoubleUpArrow;</code> <td> U+021D1 <td> <span class=glyph>⇑</span> <tr id=entity-DoubleUpDownArrow><td> <code>DoubleUpDownArrow;</code> <td> U+021D5 <td> <span class=glyph>⇕</span> <tr id=entity-DoubleVerticalBar><td> <code>DoubleVerticalBar;</code> <td> U+02225 <td> <span class=glyph>∥</span> <tr id=entity-DownArrow><td> <code>DownArrow;</code> <td> U+02193 <td> <span class=glyph>↓</span> <tr id=entity-Downarrow><td> <code>Downarrow;</code> <td> U+021D3 <td> <span class=glyph>⇓</span> <tr id=entity-downarrow><td> <code>downarrow;</code> <td> U+02193 <td> <span class=glyph>↓</span> <tr id=entity-DownArrowBar><td> <code>DownArrowBar;</code> <td> U+02913 <td> <span class=glyph>⤓</span> <tr id=entity-DownArrowUpArrow><td> <code>DownArrowUpArrow;</code> <td> U+021F5 <td> <span class=glyph>⇵</span> <tr id=entity-DownBreve><td> <code>DownBreve;</code> <td> U+00311 <td> <span class="glyph composition">◌̑</span> <tr id=entity-downdownarrows><td> <code>downdownarrows;</code> <td> U+021CA <td> <span class=glyph>⇊</span> <tr id=entity-downharpoonleft><td> <code>downharpoonleft;</code> <td> U+021C3 <td> <span class=glyph>⇃</span> <tr id=entity-downharpoonright><td> <code>downharpoonright;</code> <td> U+021C2 <td> <span class=glyph>⇂</span> <tr id=entity-DownLeftRightVector><td> <code>DownLeftRightVector;</code> <td> U+02950 <td> <span class=glyph>⥐</span> <tr id=entity-DownLeftTeeVector><td> <code>DownLeftTeeVector;</code> <td> U+0295E <td> <span class=glyph>⥞</span> <tr id=entity-DownLeftVector><td> <code>DownLeftVector;</code> <td> U+021BD <td> <span class=glyph>↽</span> <tr id=entity-DownLeftVectorBar><td> <code>DownLeftVectorBar;</code> <td> U+02956 <td> <span class=glyph>⥖</span> <tr id=entity-DownRightTeeVector><td> <code>DownRightTeeVector;</code> <td> U+0295F <td> <span class=glyph>⥟</span> <tr id=entity-DownRightVector><td> <code>DownRightVector;</code> <td> U+021C1 <td> <span class=glyph>⇁</span> <tr id=entity-DownRightVectorBar><td> <code>DownRightVectorBar;</code> <td> U+02957 <td> <span class=glyph>⥗</span> <tr id=entity-DownTee><td> <code>DownTee;</code> <td> U+022A4 <td> <span class=glyph>⊤</span> <tr id=entity-DownTeeArrow><td> <code>DownTeeArrow;</code> <td> U+021A7 <td> <span class=glyph>↧</span> <tr id=entity-drbkarow><td> <code>drbkarow;</code> <td> U+02910 <td> <span class=glyph>⤐</span> <tr id=entity-drcorn><td> <code>drcorn;</code> <td> U+0231F <td> <span class=glyph>⌟</span> <tr id=entity-drcrop><td> <code>drcrop;</code> <td> U+0230C <td> <span class=glyph>⌌</span> <tr id=entity-Dscr><td> <code>Dscr;</code> <td> U+1D49F <td> <span class=glyph>𝒟</span> <tr id=entity-dscr><td> <code>dscr;</code> <td> U+1D4B9 <td> <span class=glyph>𝒹</span> <tr id=entity-DScy><td> <code>DScy;</code> <td> U+00405 <td> <span class=glyph>Ѕ</span> <tr id=entity-dscy><td> <code>dscy;</code> <td> U+00455 <td> <span class=glyph>ѕ</span> <tr id=entity-dsol><td> <code>dsol;</code> <td> U+029F6 <td> <span class=glyph>⧶</span> <tr id=entity-Dstrok><td> <code>Dstrok;</code> <td> U+00110 <td> <span class=glyph>Đ</span> <tr id=entity-dstrok><td> <code>dstrok;</code> <td> U+00111 <td> <span class=glyph>đ</span> <tr id=entity-dtdot><td> <code>dtdot;</code> <td> U+022F1 <td> <span class=glyph>⋱</span> <tr id=entity-dtri><td> <code>dtri;</code> <td> U+025BF <td> <span class=glyph>▿</span> <tr id=entity-dtrif><td> <code>dtrif;</code> <td> U+025BE <td> <span class=glyph>▾</span> <tr id=entity-duarr><td> <code>duarr;</code> <td> U+021F5 <td> <span class=glyph>⇵</span> <tr id=entity-duhar><td> <code>duhar;</code> <td> U+0296F <td> <span class=glyph>⥯</span> <tr id=entity-dwangle><td> <code>dwangle;</code> <td> U+029A6 <td> <span class=glyph>⦦</span> <tr id=entity-DZcy><td> <code>DZcy;</code> <td> U+0040F <td> <span class=glyph>Џ</span> <tr id=entity-dzcy><td> <code>dzcy;</code> <td> U+0045F <td> <span class=glyph>џ</span> <tr id=entity-dzigrarr><td> <code>dzigrarr;</code> <td> U+027FF <td> <span class=glyph>⟿</span> <tr id=entity-Eacute><td> <code>Eacute;</code> <td> U+000C9 <td> <span class=glyph>É</span> <tr id=entity-Eacute-legacy class=impl><td> <code>Eacute</code> <td> U+000C9 <td> <span>É</span> <tr id=entity-eacute><td> <code>eacute;</code> <td> U+000E9 <td> <span class=glyph>é</span> <tr id=entity-eacute-legacy class=impl><td> <code>eacute</code> <td> U+000E9 <td> <span>é</span> <tr id=entity-easter><td> <code>easter;</code> <td> U+02A6E <td> <span class=glyph>⩮</span> <tr id=entity-Ecaron><td> <code>Ecaron;</code> <td> U+0011A <td> <span class=glyph>Ě</span> <tr id=entity-ecaron><td> <code>ecaron;</code> <td> U+0011B <td> <span class=glyph>ě</span> <tr id=entity-ecir><td> <code>ecir;</code> <td> U+02256 <td> <span class=glyph>≖</span> <tr id=entity-Ecirc><td> <code>Ecirc;</code> <td> U+000CA <td> <span class=glyph>Ê</span> <tr id=entity-Ecirc-legacy class=impl><td> <code>Ecirc</code> <td> U+000CA <td> <span>Ê</span> <tr id=entity-ecirc><td> <code>ecirc;</code> <td> U+000EA <td> <span class=glyph>ê</span> <tr id=entity-ecirc-legacy class=impl><td> <code>ecirc</code> <td> U+000EA <td> <span>ê</span> <tr id=entity-ecolon><td> <code>ecolon;</code> <td> U+02255 <td> <span class=glyph>≕</span> <tr id=entity-Ecy><td> <code>Ecy;</code> <td> U+0042D <td> <span class=glyph>Э</span> <tr id=entity-ecy><td> <code>ecy;</code> <td> U+0044D <td> <span class=glyph>э</span> <tr id=entity-eDDot><td> <code>eDDot;</code> <td> U+02A77 <td> <span class=glyph>⩷</span> <tr id=entity-Edot><td> <code>Edot;</code> <td> U+00116 <td> <span class=glyph>Ė</span> <tr id=entity-eDot><td> <code>eDot;</code> <td> U+02251 <td> <span class=glyph>≑</span> <tr id=entity-edot><td> <code>edot;</code> <td> U+00117 <td> <span class=glyph>ė</span> <tr id=entity-ee><td> <code>ee;</code> <td> U+02147 <td> <span class=glyph>ⅇ</span> <tr id=entity-efDot><td> <code>efDot;</code> <td> U+02252 <td> <span class=glyph>≒</span> <tr id=entity-Efr><td> <code>Efr;</code> <td> U+1D508 <td> <span class=glyph>𝔈</span> <tr id=entity-efr><td> <code>efr;</code> <td> U+1D522 <td> <span class=glyph>𝔢</span> <tr id=entity-eg><td> <code>eg;</code> <td> U+02A9A <td> <span class=glyph>⪚</span> <tr id=entity-Egrave><td> <code>Egrave;</code> <td> U+000C8 <td> <span class=glyph>È</span> <tr id=entity-Egrave-legacy class=impl><td> <code>Egrave</code> <td> U+000C8 <td> <span>È</span> <tr id=entity-egrave><td> <code>egrave;</code> <td> U+000E8 <td> <span class=glyph>è</span> <tr id=entity-egrave-legacy class=impl><td> <code>egrave</code> <td> U+000E8 <td> <span>è</span> <tr id=entity-egs><td> <code>egs;</code> <td> U+02A96 <td> <span class=glyph>⪖</span> <tr id=entity-egsdot><td> <code>egsdot;</code> <td> U+02A98 <td> <span class=glyph>⪘</span> <tr id=entity-el><td> <code>el;</code> <td> U+02A99 <td> <span class=glyph>⪙</span> <tr id=entity-Element><td> <code>Element;</code> <td> U+02208 <td> <span class=glyph>∈</span> <tr id=entity-elinters><td> <code>elinters;</code> <td> U+023E7 <td> <span class=glyph>⏧</span> <tr id=entity-ell><td> <code>ell;</code> <td> U+02113 <td> <span class=glyph>ℓ</span> <tr id=entity-els><td> <code>els;</code> <td> U+02A95 <td> <span class=glyph>⪕</span> <tr id=entity-elsdot><td> <code>elsdot;</code> <td> U+02A97 <td> <span class=glyph>⪗</span> <tr id=entity-Emacr><td> <code>Emacr;</code> <td> U+00112 <td> <span class=glyph>Ē</span> <tr id=entity-emacr><td> <code>emacr;</code> <td> U+00113 <td> <span class=glyph>ē</span> <tr id=entity-empty><td> <code>empty;</code> <td> U+02205 <td> <span class=glyph>∅</span> <tr id=entity-emptyset><td> <code>emptyset;</code> <td> U+02205 <td> <span class=glyph>∅</span> <tr id=entity-EmptySmallSquare><td> <code>EmptySmallSquare;</code> <td> U+025FB <td> <span class=glyph>◻</span> <tr id=entity-emptyv><td> <code>emptyv;</code> <td> U+02205 <td> <span class=glyph>∅</span> <tr id=entity-EmptyVerySmallSquare><td> <code>EmptyVerySmallSquare;</code> <td> U+025AB <td> <span class=glyph>▫</span> <tr id=entity-emsp><td> <code>emsp;</code> <td> U+02003 <td> <span class=glyph> </span> <tr id=entity-emsp13><td> <code>emsp13;</code> <td> U+02004 <td> <span class=glyph> </span> <tr id=entity-emsp14><td> <code>emsp14;</code> <td> U+02005 <td> <span class=glyph> </span> <tr id=entity-ENG><td> <code>ENG;</code> <td> U+0014A <td> <span class=glyph>Ŋ</span> <tr id=entity-eng><td> <code>eng;</code> <td> U+0014B <td> <span class=glyph>ŋ</span> <tr id=entity-ensp><td> <code>ensp;</code> <td> U+02002 <td> <span class=glyph> </span> <tr id=entity-Eogon><td> <code>Eogon;</code> <td> U+00118 <td> <span class=glyph>Ę</span> <tr id=entity-eogon><td> <code>eogon;</code> <td> U+00119 <td> <span class=glyph>ę</span> <tr id=entity-Eopf><td> <code>Eopf;</code> <td> U+1D53C <td> <span class=glyph>𝔼</span> <tr id=entity-eopf><td> <code>eopf;</code> <td> U+1D556 <td> <span class=glyph>𝕖</span> <tr id=entity-epar><td> <code>epar;</code> <td> U+022D5 <td> <span class=glyph>⋕</span> <tr id=entity-eparsl><td> <code>eparsl;</code> <td> U+029E3 <td> <span class=glyph>⧣</span> <tr id=entity-eplus><td> <code>eplus;</code> <td> U+02A71 <td> <span class=glyph>⩱</span> <tr id=entity-epsi><td> <code>epsi;</code> <td> U+003B5 <td> <span class=glyph>ε</span> <tr id=entity-Epsilon><td> <code>Epsilon;</code> <td> U+00395 <td> <span class=glyph>Ε</span> <tr id=entity-epsilon><td> <code>epsilon;</code> <td> U+003B5 <td> <span class=glyph>ε</span> <tr id=entity-epsiv><td> <code>epsiv;</code> <td> U+003F5 <td> <span class=glyph>ϵ</span> <tr id=entity-eqcirc><td> <code>eqcirc;</code> <td> U+02256 <td> <span class=glyph>≖</span> <tr id=entity-eqcolon><td> <code>eqcolon;</code> <td> U+02255 <td> <span class=glyph>≕</span> <tr id=entity-eqsim><td> <code>eqsim;</code> <td> U+02242 <td> <span class=glyph>≂</span> <tr id=entity-eqslantgtr><td> <code>eqslantgtr;</code> <td> U+02A96 <td> <span class=glyph>⪖</span> <tr id=entity-eqslantless><td> <code>eqslantless;</code> <td> U+02A95 <td> <span class=glyph>⪕</span> <tr id=entity-Equal><td> <code>Equal;</code> <td> U+02A75 <td> <span class=glyph>⩵</span> <tr id=entity-equals><td> <code>equals;</code> <td> U+0003D <td> <span class=glyph>=</span> <tr id=entity-EqualTilde><td> <code>EqualTilde;</code> <td> U+02242 <td> <span class=glyph>≂</span> <tr id=entity-equest><td> <code>equest;</code> <td> U+0225F <td> <span class=glyph>≟</span> <tr id=entity-Equilibrium><td> <code>Equilibrium;</code> <td> U+021CC <td> <span class=glyph>⇌</span> <tr id=entity-equiv><td> <code>equiv;</code> <td> U+02261 <td> <span class=glyph>≡</span> <tr id=entity-equivDD><td> <code>equivDD;</code> <td> U+02A78 <td> <span class=glyph>⩸</span> <tr id=entity-eqvparsl><td> <code>eqvparsl;</code> <td> U+029E5 <td> <span class=glyph>⧥</span> <tr id=entity-erarr><td> <code>erarr;</code> <td> U+02971 <td> <span class=glyph>⥱</span> <tr id=entity-erDot><td> <code>erDot;</code> <td> U+02253 <td> <span class=glyph>≓</span> <tr id=entity-Escr><td> <code>Escr;</code> <td> U+02130 <td> <span class=glyph>ℰ</span> <tr id=entity-escr><td> <code>escr;</code> <td> U+0212F <td> <span class=glyph>ℯ</span> <tr id=entity-esdot><td> <code>esdot;</code> <td> U+02250 <td> <span class=glyph>≐</span> <tr id=entity-Esim><td> <code>Esim;</code> <td> U+02A73 <td> <span class=glyph>⩳</span> <tr id=entity-esim><td> <code>esim;</code> <td> U+02242 <td> <span class=glyph>≂</span> <tr id=entity-Eta><td> <code>Eta;</code> <td> U+00397 <td> <span class=glyph>Η</span> <tr id=entity-eta><td> <code>eta;</code> <td> U+003B7 <td> <span class=glyph>η</span> <tr id=entity-ETH><td> <code>ETH;</code> <td> U+000D0 <td> <span class=glyph>Ð</span> <tr id=entity-ETH-legacy class=impl><td> <code>ETH</code> <td> U+000D0 <td> <span>Ð</span> <tr id=entity-eth><td> <code>eth;</code> <td> U+000F0 <td> <span class=glyph>ð</span> <tr id=entity-eth-legacy class=impl><td> <code>eth</code> <td> U+000F0 <td> <span>ð</span> <tr id=entity-Euml><td> <code>Euml;</code> <td> U+000CB <td> <span class=glyph>Ë</span> <tr id=entity-Euml-legacy class=impl><td> <code>Euml</code> <td> U+000CB <td> <span>Ë</span> <tr id=entity-euml><td> <code>euml;</code> <td> U+000EB <td> <span class=glyph>ë</span> <tr id=entity-euml-legacy class=impl><td> <code>euml</code> <td> U+000EB <td> <span>ë</span> <tr id=entity-euro><td> <code>euro;</code> <td> U+020AC <td> <span class=glyph>€</span> <tr id=entity-excl><td> <code>excl;</code> <td> U+00021 <td> <span class=glyph>!</span> <tr id=entity-exist><td> <code>exist;</code> <td> U+02203 <td> <span class=glyph>∃</span> <tr id=entity-Exists><td> <code>Exists;</code> <td> U+02203 <td> <span class=glyph>∃</span> <tr id=entity-expectation><td> <code>expectation;</code> <td> U+02130 <td> <span class=glyph>ℰ</span> <tr id=entity-ExponentialE><td> <code>ExponentialE;</code> <td> U+02147 <td> <span class=glyph>ⅇ</span> <tr id=entity-exponentiale><td> <code>exponentiale;</code> <td> U+02147 <td> <span class=glyph>ⅇ</span> <tr id=entity-fallingdotseq><td> <code>fallingdotseq;</code> <td> U+02252 <td> <span class=glyph>≒</span> <tr id=entity-Fcy><td> <code>Fcy;</code> <td> U+00424 <td> <span class=glyph>Ф</span> <tr id=entity-fcy><td> <code>fcy;</code> <td> U+00444 <td> <span class=glyph>ф</span> <tr id=entity-female><td> <code>female;</code> <td> U+02640 <td> <span class=glyph>♀</span> <tr id=entity-ffilig><td> <code>ffilig;</code> <td> U+0FB03 <td> <span class=glyph>ffi</span> <tr id=entity-fflig><td> <code>fflig;</code> <td> U+0FB00 <td> <span class=glyph>ff</span> <tr id=entity-ffllig><td> <code>ffllig;</code> <td> U+0FB04 <td> <span class=glyph>ffl</span> <tr id=entity-Ffr><td> <code>Ffr;</code> <td> U+1D509 <td> <span class=glyph>𝔉</span> <tr id=entity-ffr><td> <code>ffr;</code> <td> U+1D523 <td> <span class=glyph>𝔣</span> <tr id=entity-filig><td> <code>filig;</code> <td> U+0FB01 <td> <span class=glyph>fi</span> <tr id=entity-FilledSmallSquare><td> <code>FilledSmallSquare;</code> <td> U+025FC <td> <span class=glyph>◼</span> <tr id=entity-FilledVerySmallSquare><td> <code>FilledVerySmallSquare;</code> <td> U+025AA <td> <span class=glyph>▪</span> <tr id=entity-fjlig><td> <code>fjlig;</code> <td> U+00066 U+0006A <td> <span class="glyph compound">fj</span> <tr id=entity-flat><td> <code>flat;</code> <td> U+0266D <td> <span class=glyph>♭</span> <tr id=entity-fllig><td> <code>fllig;</code> <td> U+0FB02 <td> <span class=glyph>fl</span> <tr id=entity-fltns><td> <code>fltns;</code> <td> U+025B1 <td> <span class=glyph>▱</span> <tr id=entity-fnof><td> <code>fnof;</code> <td> U+00192 <td> <span class=glyph>ƒ</span> <tr id=entity-Fopf><td> <code>Fopf;</code> <td> U+1D53D <td> <span class=glyph>𝔽</span> <tr id=entity-fopf><td> <code>fopf;</code> <td> U+1D557 <td> <span class=glyph>𝕗</span> <tr id=entity-ForAll><td> <code>ForAll;</code> <td> U+02200 <td> <span class=glyph>∀</span> <tr id=entity-forall><td> <code>forall;</code> <td> U+02200 <td> <span class=glyph>∀</span> <tr id=entity-fork><td> <code>fork;</code> <td> U+022D4 <td> <span class=glyph>⋔</span> <tr id=entity-forkv><td> <code>forkv;</code> <td> U+02AD9 <td> <span class=glyph>⫙</span> <tr id=entity-Fouriertrf><td> <code>Fouriertrf;</code> <td> U+02131 <td> <span class=glyph>ℱ</span> <tr id=entity-fpartint><td> <code>fpartint;</code> <td> U+02A0D <td> <span class=glyph>⨍</span> <tr id=entity-frac12><td> <code>frac12;</code> <td> U+000BD <td> <span class=glyph>½</span> <tr id=entity-frac12-legacy class=impl><td> <code>frac12</code> <td> U+000BD <td> <span>½</span> <tr id=entity-frac13><td> <code>frac13;</code> <td> U+02153 <td> <span class=glyph>⅓</span> <tr id=entity-frac14><td> <code>frac14;</code> <td> U+000BC <td> <span class=glyph>¼</span> <tr id=entity-frac14-legacy class=impl><td> <code>frac14</code> <td> U+000BC <td> <span>¼</span> <tr id=entity-frac15><td> <code>frac15;</code> <td> U+02155 <td> <span class=glyph>⅕</span> <tr id=entity-frac16><td> <code>frac16;</code> <td> U+02159 <td> <span class=glyph>⅙</span> <tr id=entity-frac18><td> <code>frac18;</code> <td> U+0215B <td> <span class=glyph>⅛</span> <tr id=entity-frac23><td> <code>frac23;</code> <td> U+02154 <td> <span class=glyph>⅔</span> <tr id=entity-frac25><td> <code>frac25;</code> <td> U+02156 <td> <span class=glyph>⅖</span> <tr id=entity-frac34><td> <code>frac34;</code> <td> U+000BE <td> <span class=glyph>¾</span> <tr id=entity-frac34-legacy class=impl><td> <code>frac34</code> <td> U+000BE <td> <span>¾</span> <tr id=entity-frac35><td> <code>frac35;</code> <td> U+02157 <td> <span class=glyph>⅗</span> <tr id=entity-frac38><td> <code>frac38;</code> <td> U+0215C <td> <span class=glyph>⅜</span> <tr id=entity-frac45><td> <code>frac45;</code> <td> U+02158 <td> <span class=glyph>⅘</span> <tr id=entity-frac56><td> <code>frac56;</code> <td> U+0215A <td> <span class=glyph>⅚</span> <tr id=entity-frac58><td> <code>frac58;</code> <td> U+0215D <td> <span class=glyph>⅝</span> <tr id=entity-frac78><td> <code>frac78;</code> <td> U+0215E <td> <span class=glyph>⅞</span> <tr id=entity-frasl><td> <code>frasl;</code> <td> U+02044 <td> <span class=glyph>⁄</span> <tr id=entity-frown><td> <code>frown;</code> <td> U+02322 <td> <span class=glyph>⌢</span> <tr id=entity-Fscr><td> <code>Fscr;</code> <td> U+02131 <td> <span class=glyph>ℱ</span> <tr id=entity-fscr><td> <code>fscr;</code> <td> U+1D4BB <td> <span class=glyph>𝒻</span> <tr id=entity-gacute><td> <code>gacute;</code> <td> U+001F5 <td> <span class=glyph>ǵ</span> <tr id=entity-Gamma><td> <code>Gamma;</code> <td> U+00393 <td> <span class=glyph>Γ</span> <tr id=entity-gamma><td> <code>gamma;</code> <td> U+003B3 <td> <span class=glyph>γ</span> <tr id=entity-Gammad><td> <code>Gammad;</code> <td> U+003DC <td> <span class=glyph>Ϝ</span> <tr id=entity-gammad><td> <code>gammad;</code> <td> U+003DD <td> <span class=glyph>ϝ</span> <tr id=entity-gap><td> <code>gap;</code> <td> U+02A86 <td> <span class=glyph>⪆</span> <tr id=entity-Gbreve><td> <code>Gbreve;</code> <td> U+0011E <td> <span class=glyph>Ğ</span> <tr id=entity-gbreve><td> <code>gbreve;</code> <td> U+0011F <td> <span class=glyph>ğ</span> <tr id=entity-Gcedil><td> <code>Gcedil;</code> <td> U+00122 <td> <span class=glyph>Ģ</span> <tr id=entity-Gcirc><td> <code>Gcirc;</code> <td> U+0011C <td> <span class=glyph>Ĝ</span> <tr id=entity-gcirc><td> <code>gcirc;</code> <td> U+0011D <td> <span class=glyph>ĝ</span> <tr id=entity-Gcy><td> <code>Gcy;</code> <td> U+00413 <td> <span class=glyph>Г</span> <tr id=entity-gcy><td> <code>gcy;</code> <td> U+00433 <td> <span class=glyph>г</span> <tr id=entity-Gdot><td> <code>Gdot;</code> <td> U+00120 <td> <span class=glyph>Ġ</span> <tr id=entity-gdot><td> <code>gdot;</code> <td> U+00121 <td> <span class=glyph>ġ</span> <tr id=entity-gE><td> <code>gE;</code> <td> U+02267 <td> <span class=glyph>≧</span> <tr id=entity-ge><td> <code>ge;</code> <td> U+02265 <td> <span class=glyph>≥</span> <tr id=entity-gEl><td> <code>gEl;</code> <td> U+02A8C <td> <span class=glyph>⪌</span> <tr id=entity-gel><td> <code>gel;</code> <td> U+022DB <td> <span class=glyph>⋛</span> <tr id=entity-geq><td> <code>geq;</code> <td> U+02265 <td> <span class=glyph>≥</span> <tr id=entity-geqq><td> <code>geqq;</code> <td> U+02267 <td> <span class=glyph>≧</span> <tr id=entity-geqslant><td> <code>geqslant;</code> <td> U+02A7E <td> <span class=glyph>⩾</span> <tr id=entity-ges><td> <code>ges;</code> <td> U+02A7E <td> <span class=glyph>⩾</span> <tr id=entity-gescc><td> <code>gescc;</code> <td> U+02AA9 <td> <span class=glyph>⪩</span> <tr id=entity-gesdot><td> <code>gesdot;</code> <td> U+02A80 <td> <span class=glyph>⪀</span> <tr id=entity-gesdoto><td> <code>gesdoto;</code> <td> U+02A82 <td> <span class=glyph>⪂</span> <tr id=entity-gesdotol><td> <code>gesdotol;</code> <td> U+02A84 <td> <span class=glyph>⪄</span> <tr id=entity-gesl><td> <code>gesl;</code> <td> U+022DB U+0FE00 <td> <span class="glyph compound">⋛︀</span> <tr id=entity-gesles><td> <code>gesles;</code> <td> U+02A94 <td> <span class=glyph>⪔</span> <tr id=entity-Gfr><td> <code>Gfr;</code> <td> U+1D50A <td> <span class=glyph>𝔊</span> <tr id=entity-gfr><td> <code>gfr;</code> <td> U+1D524 <td> <span class=glyph>𝔤</span> <tr id=entity-Gg><td> <code>Gg;</code> <td> U+022D9 <td> <span class=glyph>⋙</span> <tr id=entity-gg><td> <code>gg;</code> <td> U+0226B <td> <span class=glyph>≫</span> <tr id=entity-ggg><td> <code>ggg;</code> <td> U+022D9 <td> <span class=glyph>⋙</span> <tr id=entity-gimel><td> <code>gimel;</code> <td> U+02137 <td> <span class=glyph>ℷ</span> <tr id=entity-GJcy><td> <code>GJcy;</code> <td> U+00403 <td> <span class=glyph>Ѓ</span> <tr id=entity-gjcy><td> <code>gjcy;</code> <td> U+00453 <td> <span class=glyph>ѓ</span> <tr id=entity-gl><td> <code>gl;</code> <td> U+02277 <td> <span class=glyph>≷</span> <tr id=entity-gla><td> <code>gla;</code> <td> U+02AA5 <td> <span class=glyph>⪥</span> <tr id=entity-glE><td> <code>glE;</code> <td> U+02A92 <td> <span class=glyph>⪒</span> <tr id=entity-glj><td> <code>glj;</code> <td> U+02AA4 <td> <span class=glyph>⪤</span> <tr id=entity-gnap><td> <code>gnap;</code> <td> U+02A8A <td> <span class=glyph>⪊</span> <tr id=entity-gnapprox><td> <code>gnapprox;</code> <td> U+02A8A <td> <span class=glyph>⪊</span> <tr id=entity-gnE><td> <code>gnE;</code> <td> U+02269 <td> <span class=glyph>≩</span> <tr id=entity-gne><td> <code>gne;</code> <td> U+02A88 <td> <span class=glyph>⪈</span> <tr id=entity-gneq><td> <code>gneq;</code> <td> U+02A88 <td> <span class=glyph>⪈</span> <tr id=entity-gneqq><td> <code>gneqq;</code> <td> U+02269 <td> <span class=glyph>≩</span> <tr id=entity-gnsim><td> <code>gnsim;</code> <td> U+022E7 <td> <span class=glyph>⋧</span> <tr id=entity-Gopf><td> <code>Gopf;</code> <td> U+1D53E <td> <span class=glyph>𝔾</span> <tr id=entity-gopf><td> <code>gopf;</code> <td> U+1D558 <td> <span class=glyph>𝕘</span> <tr id=entity-grave><td> <code>grave;</code> <td> U+00060 <td> <span class=glyph>`</span> <tr id=entity-GreaterEqual><td> <code>GreaterEqual;</code> <td> U+02265 <td> <span class=glyph>≥</span> <tr id=entity-GreaterEqualLess><td> <code>GreaterEqualLess;</code> <td> U+022DB <td> <span class=glyph>⋛</span> <tr id=entity-GreaterFullEqual><td> <code>GreaterFullEqual;</code> <td> U+02267 <td> <span class=glyph>≧</span> <tr id=entity-GreaterGreater><td> <code>GreaterGreater;</code> <td> U+02AA2 <td> <span class=glyph>⪢</span> <tr id=entity-GreaterLess><td> <code>GreaterLess;</code> <td> U+02277 <td> <span class=glyph>≷</span> <tr id=entity-GreaterSlantEqual><td> <code>GreaterSlantEqual;</code> <td> U+02A7E <td> <span class=glyph>⩾</span> <tr id=entity-GreaterTilde><td> <code>GreaterTilde;</code> <td> U+02273 <td> <span class=glyph>≳</span> <tr id=entity-Gscr><td> <code>Gscr;</code> <td> U+1D4A2 <td> <span class=glyph>𝒢</span> <tr id=entity-gscr><td> <code>gscr;</code> <td> U+0210A <td> <span class=glyph>ℊ</span> <tr id=entity-gsim><td> <code>gsim;</code> <td> U+02273 <td> <span class=glyph>≳</span> <tr id=entity-gsime><td> <code>gsime;</code> <td> U+02A8E <td> <span class=glyph>⪎</span> <tr id=entity-gsiml><td> <code>gsiml;</code> <td> U+02A90 <td> <span class=glyph>⪐</span> <tr id=entity-GT><td> <code>GT;</code> <td> U+0003E <td> <span class=glyph>></span> <tr id=entity-GT-legacy class=impl><td> <code>GT</code> <td> U+0003E <td> <span>></span> <tr id=entity-Gt><td> <code>Gt;</code> <td> U+0226B <td> <span class=glyph>≫</span> <tr id=entity-gt><td> <code>gt;</code> <td> U+0003E <td> <span class=glyph>></span> <tr id=entity-gt-legacy class=impl><td> <code>gt</code> <td> U+0003E <td> <span>></span> <tr id=entity-gtcc><td> <code>gtcc;</code> <td> U+02AA7 <td> <span class=glyph>⪧</span> <tr id=entity-gtcir><td> <code>gtcir;</code> <td> U+02A7A <td> <span class=glyph>⩺</span> <tr id=entity-gtdot><td> <code>gtdot;</code> <td> U+022D7 <td> <span class=glyph>⋗</span> <tr id=entity-gtlPar><td> <code>gtlPar;</code> <td> U+02995 <td> <span class=glyph>⦕</span> <tr id=entity-gtquest><td> <code>gtquest;</code> <td> U+02A7C <td> <span class=glyph>⩼</span> <tr id=entity-gtrapprox><td> <code>gtrapprox;</code> <td> U+02A86 <td> <span class=glyph>⪆</span> <tr id=entity-gtrarr><td> <code>gtrarr;</code> <td> U+02978 <td> <span class=glyph>⥸</span> <tr id=entity-gtrdot><td> <code>gtrdot;</code> <td> U+022D7 <td> <span class=glyph>⋗</span> <tr id=entity-gtreqless><td> <code>gtreqless;</code> <td> U+022DB <td> <span class=glyph>⋛</span> <tr id=entity-gtreqqless><td> <code>gtreqqless;</code> <td> U+02A8C <td> <span class=glyph>⪌</span> <tr id=entity-gtrless><td> <code>gtrless;</code> <td> U+02277 <td> <span class=glyph>≷</span> <tr id=entity-gtrsim><td> <code>gtrsim;</code> <td> U+02273 <td> <span class=glyph>≳</span> <tr id=entity-gvertneqq><td> <code>gvertneqq;</code> <td> U+02269 U+0FE00 <td> <span class="glyph compound">≩︀</span> <tr id=entity-gvnE><td> <code>gvnE;</code> <td> U+02269 U+0FE00 <td> <span class="glyph compound">≩︀</span> <tr id=entity-Hacek><td> <code>Hacek;</code> <td> U+002C7 <td> <span class=glyph>ˇ</span> <tr id=entity-hairsp><td> <code>hairsp;</code> <td> U+0200A <td> <span class=glyph> </span> <tr id=entity-half><td> <code>half;</code> <td> U+000BD <td> <span class=glyph>½</span> <tr id=entity-hamilt><td> <code>hamilt;</code> <td> U+0210B <td> <span class=glyph>ℋ</span> <tr id=entity-HARDcy><td> <code>HARDcy;</code> <td> U+0042A <td> <span class=glyph>Ъ</span> <tr id=entity-hardcy><td> <code>hardcy;</code> <td> U+0044A <td> <span class=glyph>ъ</span> <tr id=entity-hArr><td> <code>hArr;</code> <td> U+021D4 <td> <span class=glyph>⇔</span> <tr id=entity-harr><td> <code>harr;</code> <td> U+02194 <td> <span class=glyph>↔</span> <tr id=entity-harrcir><td> <code>harrcir;</code> <td> U+02948 <td> <span class=glyph>⥈</span> <tr id=entity-harrw><td> <code>harrw;</code> <td> U+021AD <td> <span class=glyph>↭</span> <tr id=entity-Hat><td> <code>Hat;</code> <td> U+0005E <td> <span class=glyph>^</span> <tr id=entity-hbar><td> <code>hbar;</code> <td> U+0210F <td> <span class=glyph>ℏ</span> <tr id=entity-Hcirc><td> <code>Hcirc;</code> <td> U+00124 <td> <span class=glyph>Ĥ</span> <tr id=entity-hcirc><td> <code>hcirc;</code> <td> U+00125 <td> <span class=glyph>ĥ</span> <tr id=entity-hearts><td> <code>hearts;</code> <td> U+02665 <td> <span class=glyph>♥</span> <tr id=entity-heartsuit><td> <code>heartsuit;</code> <td> U+02665 <td> <span class=glyph>♥</span> <tr id=entity-hellip><td> <code>hellip;</code> <td> U+02026 <td> <span class=glyph>…</span> <tr id=entity-hercon><td> <code>hercon;</code> <td> U+022B9 <td> <span class=glyph>⊹</span> <tr id=entity-Hfr><td> <code>Hfr;</code> <td> U+0210C <td> <span class=glyph>ℌ</span> <tr id=entity-hfr><td> <code>hfr;</code> <td> U+1D525 <td> <span class=glyph>𝔥</span> <tr id=entity-HilbertSpace><td> <code>HilbertSpace;</code> <td> U+0210B <td> <span class=glyph>ℋ</span> <tr id=entity-hksearow><td> <code>hksearow;</code> <td> U+02925 <td> <span class=glyph>⤥</span> <tr id=entity-hkswarow><td> <code>hkswarow;</code> <td> U+02926 <td> <span class=glyph>⤦</span> <tr id=entity-hoarr><td> <code>hoarr;</code> <td> U+021FF <td> <span class=glyph>⇿</span> <tr id=entity-homtht><td> <code>homtht;</code> <td> U+0223B <td> <span class=glyph>∻</span> <tr id=entity-hookleftarrow><td> <code>hookleftarrow;</code> <td> U+021A9 <td> <span class=glyph>↩</span> <tr id=entity-hookrightarrow><td> <code>hookrightarrow;</code> <td> U+021AA <td> <span class=glyph>↪</span> <tr id=entity-Hopf><td> <code>Hopf;</code> <td> U+0210D <td> <span class=glyph>ℍ</span> <tr id=entity-hopf><td> <code>hopf;</code> <td> U+1D559 <td> <span class=glyph>𝕙</span> <tr id=entity-horbar><td> <code>horbar;</code> <td> U+02015 <td> <span class=glyph>―</span> <tr id=entity-HorizontalLine><td> <code>HorizontalLine;</code> <td> U+02500 <td> <span class=glyph>─</span> <tr id=entity-Hscr><td> <code>Hscr;</code> <td> U+0210B <td> <span class=glyph>ℋ</span> <tr id=entity-hscr><td> <code>hscr;</code> <td> U+1D4BD <td> <span class=glyph>𝒽</span> <tr id=entity-hslash><td> <code>hslash;</code> <td> U+0210F <td> <span class=glyph>ℏ</span> <tr id=entity-Hstrok><td> <code>Hstrok;</code> <td> U+00126 <td> <span class=glyph>Ħ</span> <tr id=entity-hstrok><td> <code>hstrok;</code> <td> U+00127 <td> <span class=glyph>ħ</span> <tr id=entity-HumpDownHump><td> <code>HumpDownHump;</code> <td> U+0224E <td> <span class=glyph>≎</span> <tr id=entity-HumpEqual><td> <code>HumpEqual;</code> <td> U+0224F <td> <span class=glyph>≏</span> <tr id=entity-hybull><td> <code>hybull;</code> <td> U+02043 <td> <span class=glyph>⁃</span> <tr id=entity-hyphen><td> <code>hyphen;</code> <td> U+02010 <td> <span class=glyph>‐</span> <tr id=entity-Iacute><td> <code>Iacute;</code> <td> U+000CD <td> <span class=glyph>Í</span> <tr id=entity-Iacute-legacy class=impl><td> <code>Iacute</code> <td> U+000CD <td> <span>Í</span> <tr id=entity-iacute><td> <code>iacute;</code> <td> U+000ED <td> <span class=glyph>í</span> <tr id=entity-iacute-legacy class=impl><td> <code>iacute</code> <td> U+000ED <td> <span>í</span> <tr id=entity-ic><td> <code>ic;</code> <td> U+02063 <td> <span class=glyph></span> <tr id=entity-Icirc><td> <code>Icirc;</code> <td> U+000CE <td> <span class=glyph>Î</span> <tr id=entity-Icirc-legacy class=impl><td> <code>Icirc</code> <td> U+000CE <td> <span>Î</span> <tr id=entity-icirc><td> <code>icirc;</code> <td> U+000EE <td> <span class=glyph>î</span> <tr id=entity-icirc-legacy class=impl><td> <code>icirc</code> <td> U+000EE <td> <span>î</span> <tr id=entity-Icy><td> <code>Icy;</code> <td> U+00418 <td> <span class=glyph>И</span> <tr id=entity-icy><td> <code>icy;</code> <td> U+00438 <td> <span class=glyph>и</span> <tr id=entity-Idot><td> <code>Idot;</code> <td> U+00130 <td> <span class=glyph>İ</span> <tr id=entity-IEcy><td> <code>IEcy;</code> <td> U+00415 <td> <span class=glyph>Е</span> <tr id=entity-iecy><td> <code>iecy;</code> <td> U+00435 <td> <span class=glyph>е</span> <tr id=entity-iexcl><td> <code>iexcl;</code> <td> U+000A1 <td> <span class=glyph>¡</span> <tr id=entity-iexcl-legacy class=impl><td> <code>iexcl</code> <td> U+000A1 <td> <span>¡</span> <tr id=entity-iff><td> <code>iff;</code> <td> U+021D4 <td> <span class=glyph>⇔</span> <tr id=entity-Ifr><td> <code>Ifr;</code> <td> U+02111 <td> <span class=glyph>ℑ</span> <tr id=entity-ifr><td> <code>ifr;</code> <td> U+1D526 <td> <span class=glyph>𝔦</span> <tr id=entity-Igrave><td> <code>Igrave;</code> <td> U+000CC <td> <span class=glyph>Ì</span> <tr id=entity-Igrave-legacy class=impl><td> <code>Igrave</code> <td> U+000CC <td> <span>Ì</span> <tr id=entity-igrave><td> <code>igrave;</code> <td> U+000EC <td> <span class=glyph>ì</span> <tr id=entity-igrave-legacy class=impl><td> <code>igrave</code> <td> U+000EC <td> <span>ì</span> <tr id=entity-ii><td> <code>ii;</code> <td> U+02148 <td> <span class=glyph>ⅈ</span> <tr id=entity-iiiint><td> <code>iiiint;</code> <td> U+02A0C <td> <span class=glyph>⨌</span> <tr id=entity-iiint><td> <code>iiint;</code> <td> U+0222D <td> <span class=glyph>∭</span> <tr id=entity-iinfin><td> <code>iinfin;</code> <td> U+029DC <td> <span class=glyph>⧜</span> <tr id=entity-iiota><td> <code>iiota;</code> <td> U+02129 <td> <span class=glyph>℩</span> <tr id=entity-IJlig><td> <code>IJlig;</code> <td> U+00132 <td> <span class=glyph>IJ</span> <tr id=entity-ijlig><td> <code>ijlig;</code> <td> U+00133 <td> <span class=glyph>ij</span> <tr id=entity-Im><td> <code>Im;</code> <td> U+02111 <td> <span class=glyph>ℑ</span> <tr id=entity-Imacr><td> <code>Imacr;</code> <td> U+0012A <td> <span class=glyph>Ī</span> <tr id=entity-imacr><td> <code>imacr;</code> <td> U+0012B <td> <span class=glyph>ī</span> <tr id=entity-image><td> <code>image;</code> <td> U+02111 <td> <span class=glyph>ℑ</span> <tr id=entity-ImaginaryI><td> <code>ImaginaryI;</code> <td> U+02148 <td> <span class=glyph>ⅈ</span> <tr id=entity-imagline><td> <code>imagline;</code> <td> U+02110 <td> <span class=glyph>ℐ</span> <tr id=entity-imagpart><td> <code>imagpart;</code> <td> U+02111 <td> <span class=glyph>ℑ</span> <tr id=entity-imath><td> <code>imath;</code> <td> U+00131 <td> <span class=glyph>ı</span> <tr id=entity-imof><td> <code>imof;</code> <td> U+022B7 <td> <span class=glyph>⊷</span> <tr id=entity-imped><td> <code>imped;</code> <td> U+001B5 <td> <span class=glyph>Ƶ</span> <tr id=entity-Implies><td> <code>Implies;</code> <td> U+021D2 <td> <span class=glyph>⇒</span> <tr id=entity-in><td> <code>in;</code> <td> U+02208 <td> <span class=glyph>∈</span> <tr id=entity-incare><td> <code>incare;</code> <td> U+02105 <td> <span class=glyph>℅</span> <tr id=entity-infin><td> <code>infin;</code> <td> U+0221E <td> <span class=glyph>∞</span> <tr id=entity-infintie><td> <code>infintie;</code> <td> U+029DD <td> <span class=glyph>⧝</span> <tr id=entity-inodot><td> <code>inodot;</code> <td> U+00131 <td> <span class=glyph>ı</span> <tr id=entity-Int><td> <code>Int;</code> <td> U+0222C <td> <span class=glyph>∬</span> <tr id=entity-int><td> <code>int;</code> <td> U+0222B <td> <span class=glyph>∫</span> <tr id=entity-intcal><td> <code>intcal;</code> <td> U+022BA <td> <span class=glyph>⊺</span> <tr id=entity-integers><td> <code>integers;</code> <td> U+02124 <td> <span class=glyph>ℤ</span> <tr id=entity-Integral><td> <code>Integral;</code> <td> U+0222B <td> <span class=glyph>∫</span> <tr id=entity-intercal><td> <code>intercal;</code> <td> U+022BA <td> <span class=glyph>⊺</span> <tr id=entity-Intersection><td> <code>Intersection;</code> <td> U+022C2 <td> <span class=glyph>⋂</span> <tr id=entity-intlarhk><td> <code>intlarhk;</code> <td> U+02A17 <td> <span class=glyph>⨗</span> <tr id=entity-intprod><td> <code>intprod;</code> <td> U+02A3C <td> <span class=glyph>⨼</span> <tr id=entity-InvisibleComma><td> <code>InvisibleComma;</code> <td> U+02063 <td> <span class=glyph></span> <tr id=entity-InvisibleTimes><td> <code>InvisibleTimes;</code> <td> U+02062 <td> <span class=glyph></span> <tr id=entity-IOcy><td> <code>IOcy;</code> <td> U+00401 <td> <span class=glyph>Ё</span> <tr id=entity-iocy><td> <code>iocy;</code> <td> U+00451 <td> <span class=glyph>ё</span> <tr id=entity-Iogon><td> <code>Iogon;</code> <td> U+0012E <td> <span class=glyph>Į</span> <tr id=entity-iogon><td> <code>iogon;</code> <td> U+0012F <td> <span class=glyph>į</span> <tr id=entity-Iopf><td> <code>Iopf;</code> <td> U+1D540 <td> <span class=glyph>𝕀</span> <tr id=entity-iopf><td> <code>iopf;</code> <td> U+1D55A <td> <span class=glyph>𝕚</span> <tr id=entity-Iota><td> <code>Iota;</code> <td> U+00399 <td> <span class=glyph>Ι</span> <tr id=entity-iota><td> <code>iota;</code> <td> U+003B9 <td> <span class=glyph>ι</span> <tr id=entity-iprod><td> <code>iprod;</code> <td> U+02A3C <td> <span class=glyph>⨼</span> <tr id=entity-iquest><td> <code>iquest;</code> <td> U+000BF <td> <span class=glyph>¿</span> <tr id=entity-iquest-legacy class=impl><td> <code>iquest</code> <td> U+000BF <td> <span>¿</span> <tr id=entity-Iscr><td> <code>Iscr;</code> <td> U+02110 <td> <span class=glyph>ℐ</span> <tr id=entity-iscr><td> <code>iscr;</code> <td> U+1D4BE <td> <span class=glyph>𝒾</span> <tr id=entity-isin><td> <code>isin;</code> <td> U+02208 <td> <span class=glyph>∈</span> <tr id=entity-isindot><td> <code>isindot;</code> <td> U+022F5 <td> <span class=glyph>⋵</span> <tr id=entity-isinE><td> <code>isinE;</code> <td> U+022F9 <td> <span class=glyph>⋹</span> <tr id=entity-isins><td> <code>isins;</code> <td> U+022F4 <td> <span class=glyph>⋴</span> <tr id=entity-isinsv><td> <code>isinsv;</code> <td> U+022F3 <td> <span class=glyph>⋳</span> <tr id=entity-isinv><td> <code>isinv;</code> <td> U+02208 <td> <span class=glyph>∈</span> <tr id=entity-it><td> <code>it;</code> <td> U+02062 <td> <span class=glyph></span> <tr id=entity-Itilde><td> <code>Itilde;</code> <td> U+00128 <td> <span class=glyph>Ĩ</span> <tr id=entity-itilde><td> <code>itilde;</code> <td> U+00129 <td> <span class=glyph>ĩ</span> <tr id=entity-Iukcy><td> <code>Iukcy;</code> <td> U+00406 <td> <span class=glyph>І</span> <tr id=entity-iukcy><td> <code>iukcy;</code> <td> U+00456 <td> <span class=glyph>і</span> <tr id=entity-Iuml><td> <code>Iuml;</code> <td> U+000CF <td> <span class=glyph>Ï</span> <tr id=entity-Iuml-legacy class=impl><td> <code>Iuml</code> <td> U+000CF <td> <span>Ï</span> <tr id=entity-iuml><td> <code>iuml;</code> <td> U+000EF <td> <span class=glyph>ï</span> <tr id=entity-iuml-legacy class=impl><td> <code>iuml</code> <td> U+000EF <td> <span>ï</span> <tr id=entity-Jcirc><td> <code>Jcirc;</code> <td> U+00134 <td> <span class=glyph>Ĵ</span> <tr id=entity-jcirc><td> <code>jcirc;</code> <td> U+00135 <td> <span class=glyph>ĵ</span> <tr id=entity-Jcy><td> <code>Jcy;</code> <td> U+00419 <td> <span class=glyph>Й</span> <tr id=entity-jcy><td> <code>jcy;</code> <td> U+00439 <td> <span class=glyph>й</span> <tr id=entity-Jfr><td> <code>Jfr;</code> <td> U+1D50D <td> <span class=glyph>𝔍</span> <tr id=entity-jfr><td> <code>jfr;</code> <td> U+1D527 <td> <span class=glyph>𝔧</span> <tr id=entity-jmath><td> <code>jmath;</code> <td> U+00237 <td> <span class=glyph>ȷ</span> <tr id=entity-Jopf><td> <code>Jopf;</code> <td> U+1D541 <td> <span class=glyph>𝕁</span> <tr id=entity-jopf><td> <code>jopf;</code> <td> U+1D55B <td> <span class=glyph>𝕛</span> <tr id=entity-Jscr><td> <code>Jscr;</code> <td> U+1D4A5 <td> <span class=glyph>𝒥</span> <tr id=entity-jscr><td> <code>jscr;</code> <td> U+1D4BF <td> <span class=glyph>𝒿</span> <tr id=entity-Jsercy><td> <code>Jsercy;</code> <td> U+00408 <td> <span class=glyph>Ј</span> <tr id=entity-jsercy><td> <code>jsercy;</code> <td> U+00458 <td> <span class=glyph>ј</span> <tr id=entity-Jukcy><td> <code>Jukcy;</code> <td> U+00404 <td> <span class=glyph>Є</span> <tr id=entity-jukcy><td> <code>jukcy;</code> <td> U+00454 <td> <span class=glyph>є</span> <tr id=entity-Kappa><td> <code>Kappa;</code> <td> U+0039A <td> <span class=glyph>Κ</span> <tr id=entity-kappa><td> <code>kappa;</code> <td> U+003BA <td> <span class=glyph>κ</span> <tr id=entity-kappav><td> <code>kappav;</code> <td> U+003F0 <td> <span class=glyph>ϰ</span> <tr id=entity-Kcedil><td> <code>Kcedil;</code> <td> U+00136 <td> <span class=glyph>Ķ</span> <tr id=entity-kcedil><td> <code>kcedil;</code> <td> U+00137 <td> <span class=glyph>ķ</span> <tr id=entity-Kcy><td> <code>Kcy;</code> <td> U+0041A <td> <span class=glyph>К</span> <tr id=entity-kcy><td> <code>kcy;</code> <td> U+0043A <td> <span class=glyph>к</span> <tr id=entity-Kfr><td> <code>Kfr;</code> <td> U+1D50E <td> <span class=glyph>𝔎</span> <tr id=entity-kfr><td> <code>kfr;</code> <td> U+1D528 <td> <span class=glyph>𝔨</span> <tr id=entity-kgreen><td> <code>kgreen;</code> <td> U+00138 <td> <span class=glyph>ĸ</span> <tr id=entity-KHcy><td> <code>KHcy;</code> <td> U+00425 <td> <span class=glyph>Х</span> <tr id=entity-khcy><td> <code>khcy;</code> <td> U+00445 <td> <span class=glyph>х</span> <tr id=entity-KJcy><td> <code>KJcy;</code> <td> U+0040C <td> <span class=glyph>Ќ</span> <tr id=entity-kjcy><td> <code>kjcy;</code> <td> U+0045C <td> <span class=glyph>ќ</span> <tr id=entity-Kopf><td> <code>Kopf;</code> <td> U+1D542 <td> <span class=glyph>𝕂</span> <tr id=entity-kopf><td> <code>kopf;</code> <td> U+1D55C <td> <span class=glyph>𝕜</span> <tr id=entity-Kscr><td> <code>Kscr;</code> <td> U+1D4A6 <td> <span class=glyph>𝒦</span> <tr id=entity-kscr><td> <code>kscr;</code> <td> U+1D4C0 <td> <span class=glyph>𝓀</span> <tr id=entity-lAarr><td> <code>lAarr;</code> <td> U+021DA <td> <span class=glyph>⇚</span> <tr id=entity-Lacute><td> <code>Lacute;</code> <td> U+00139 <td> <span class=glyph>Ĺ</span> <tr id=entity-lacute><td> <code>lacute;</code> <td> U+0013A <td> <span class=glyph>ĺ</span> <tr id=entity-laemptyv><td> <code>laemptyv;</code> <td> U+029B4 <td> <span class=glyph>⦴</span> <tr id=entity-lagran><td> <code>lagran;</code> <td> U+02112 <td> <span class=glyph>ℒ</span> <tr id=entity-Lambda><td> <code>Lambda;</code> <td> U+0039B <td> <span class=glyph>Λ</span> <tr id=entity-lambda><td> <code>lambda;</code> <td> U+003BB <td> <span class=glyph>λ</span> <tr id=entity-Lang><td> <code>Lang;</code> <td> U+027EA <td> <span class=glyph>⟪</span> <tr id=entity-lang><td> <code>lang;</code> <td> U+027E8 <td> <span class=glyph>⟨</span> <tr id=entity-langd><td> <code>langd;</code> <td> U+02991 <td> <span class=glyph>⦑</span> <tr id=entity-langle><td> <code>langle;</code> <td> U+027E8 <td> <span class=glyph>⟨</span> <tr id=entity-lap><td> <code>lap;</code> <td> U+02A85 <td> <span class=glyph>⪅</span> <tr id=entity-Laplacetrf><td> <code>Laplacetrf;</code> <td> U+02112 <td> <span class=glyph>ℒ</span> <tr id=entity-laquo><td> <code>laquo;</code> <td> U+000AB <td> <span class=glyph>«</span> <tr id=entity-laquo-legacy class=impl><td> <code>laquo</code> <td> U+000AB <td> <span>«</span> <tr id=entity-Larr><td> <code>Larr;</code> <td> U+0219E <td> <span class=glyph>↞</span> <tr id=entity-lArr><td> <code>lArr;</code> <td> U+021D0 <td> <span class=glyph>⇐</span> <tr id=entity-larr><td> <code>larr;</code> <td> U+02190 <td> <span class=glyph>←</span> <tr id=entity-larrb><td> <code>larrb;</code> <td> U+021E4 <td> <span class=glyph>⇤</span> <tr id=entity-larrbfs><td> <code>larrbfs;</code> <td> U+0291F <td> <span class=glyph>⤟</span> <tr id=entity-larrfs><td> <code>larrfs;</code> <td> U+0291D <td> <span class=glyph>⤝</span> <tr id=entity-larrhk><td> <code>larrhk;</code> <td> U+021A9 <td> <span class=glyph>↩</span> <tr id=entity-larrlp><td> <code>larrlp;</code> <td> U+021AB <td> <span class=glyph>↫</span> <tr id=entity-larrpl><td> <code>larrpl;</code> <td> U+02939 <td> <span class=glyph>⤹</span> <tr id=entity-larrsim><td> <code>larrsim;</code> <td> U+02973 <td> <span class=glyph>⥳</span> <tr id=entity-larrtl><td> <code>larrtl;</code> <td> U+021A2 <td> <span class=glyph>↢</span> <tr id=entity-lat><td> <code>lat;</code> <td> U+02AAB <td> <span class=glyph>⪫</span> <tr id=entity-lAtail><td> <code>lAtail;</code> <td> U+0291B <td> <span class=glyph>⤛</span> <tr id=entity-latail><td> <code>latail;</code> <td> U+02919 <td> <span class=glyph>⤙</span> <tr id=entity-late><td> <code>late;</code> <td> U+02AAD <td> <span class=glyph>⪭</span> <tr id=entity-lates><td> <code>lates;</code> <td> U+02AAD U+0FE00 <td> <span class="glyph compound">⪭︀</span> <tr id=entity-lBarr><td> <code>lBarr;</code> <td> U+0290E <td> <span class=glyph>⤎</span> <tr id=entity-lbarr><td> <code>lbarr;</code> <td> U+0290C <td> <span class=glyph>⤌</span> <tr id=entity-lbbrk><td> <code>lbbrk;</code> <td> U+02772 <td> <span class=glyph>❲</span> <tr id=entity-lbrace><td> <code>lbrace;</code> <td> U+0007B <td> <span class=glyph>{</span> <tr id=entity-lbrack><td> <code>lbrack;</code> <td> U+0005B <td> <span class=glyph>[</span> <tr id=entity-lbrke><td> <code>lbrke;</code> <td> U+0298B <td> <span class=glyph>⦋</span> <tr id=entity-lbrksld><td> <code>lbrksld;</code> <td> U+0298F <td> <span class=glyph>⦏</span> <tr id=entity-lbrkslu><td> <code>lbrkslu;</code> <td> U+0298D <td> <span class=glyph>⦍</span> <tr id=entity-Lcaron><td> <code>Lcaron;</code> <td> U+0013D <td> <span class=glyph>Ľ</span> <tr id=entity-lcaron><td> <code>lcaron;</code> <td> U+0013E <td> <span class=glyph>ľ</span> <tr id=entity-Lcedil><td> <code>Lcedil;</code> <td> U+0013B <td> <span class=glyph>Ļ</span> <tr id=entity-lcedil><td> <code>lcedil;</code> <td> U+0013C <td> <span class=glyph>ļ</span> <tr id=entity-lceil><td> <code>lceil;</code> <td> U+02308 <td> <span class=glyph>⌈</span> <tr id=entity-lcub><td> <code>lcub;</code> <td> U+0007B <td> <span class=glyph>{</span> <tr id=entity-Lcy><td> <code>Lcy;</code> <td> U+0041B <td> <span class=glyph>Л</span> <tr id=entity-lcy><td> <code>lcy;</code> <td> U+0043B <td> <span class=glyph>л</span> <tr id=entity-ldca><td> <code>ldca;</code> <td> U+02936 <td> <span class=glyph>⤶</span> <tr id=entity-ldquo><td> <code>ldquo;</code> <td> U+0201C <td> <span class=glyph>“</span> <tr id=entity-ldquor><td> <code>ldquor;</code> <td> U+0201E <td> <span class=glyph>„</span> <tr id=entity-ldrdhar><td> <code>ldrdhar;</code> <td> U+02967 <td> <span class=glyph>⥧</span> <tr id=entity-ldrushar><td> <code>ldrushar;</code> <td> U+0294B <td> <span class=glyph>⥋</span> <tr id=entity-ldsh><td> <code>ldsh;</code> <td> U+021B2 <td> <span class=glyph>↲</span> <tr id=entity-lE><td> <code>lE;</code> <td> U+02266 <td> <span class=glyph>≦</span> <tr id=entity-le><td> <code>le;</code> <td> U+02264 <td> <span class=glyph>≤</span> <tr id=entity-LeftAngleBracket><td> <code>LeftAngleBracket;</code> <td> U+027E8 <td> <span class=glyph>⟨</span> <tr id=entity-LeftArrow><td> <code>LeftArrow;</code> <td> U+02190 <td> <span class=glyph>←</span> <tr id=entity-Leftarrow><td> <code>Leftarrow;</code> <td> U+021D0 <td> <span class=glyph>⇐</span> <tr id=entity-leftarrow><td> <code>leftarrow;</code> <td> U+02190 <td> <span class=glyph>←</span> <tr id=entity-LeftArrowBar><td> <code>LeftArrowBar;</code> <td> U+021E4 <td> <span class=glyph>⇤</span> <tr id=entity-LeftArrowRightArrow><td> <code>LeftArrowRightArrow;</code> <td> U+021C6 <td> <span class=glyph>⇆</span> <tr id=entity-leftarrowtail><td> <code>leftarrowtail;</code> <td> U+021A2 <td> <span class=glyph>↢</span> <tr id=entity-LeftCeiling><td> <code>LeftCeiling;</code> <td> U+02308 <td> <span class=glyph>⌈</span> <tr id=entity-LeftDoubleBracket><td> <code>LeftDoubleBracket;</code> <td> U+027E6 <td> <span class=glyph>⟦</span> <tr id=entity-LeftDownTeeVector><td> <code>LeftDownTeeVector;</code> <td> U+02961 <td> <span class=glyph>⥡</span> <tr id=entity-LeftDownVector><td> <code>LeftDownVector;</code> <td> U+021C3 <td> <span class=glyph>⇃</span> <tr id=entity-LeftDownVectorBar><td> <code>LeftDownVectorBar;</code> <td> U+02959 <td> <span class=glyph>⥙</span> <tr id=entity-LeftFloor><td> <code>LeftFloor;</code> <td> U+0230A <td> <span class=glyph>⌊</span> <tr id=entity-leftharpoondown><td> <code>leftharpoondown;</code> <td> U+021BD <td> <span class=glyph>↽</span> <tr id=entity-leftharpoonup><td> <code>leftharpoonup;</code> <td> U+021BC <td> <span class=glyph>↼</span> <tr id=entity-leftleftarrows><td> <code>leftleftarrows;</code> <td> U+021C7 <td> <span class=glyph>⇇</span> <tr id=entity-LeftRightArrow><td> <code>LeftRightArrow;</code> <td> U+02194 <td> <span class=glyph>↔</span> <tr id=entity-Leftrightarrow><td> <code>Leftrightarrow;</code> <td> U+021D4 <td> <span class=glyph>⇔</span> <tr id=entity-leftrightarrow><td> <code>leftrightarrow;</code> <td> U+02194 <td> <span class=glyph>↔</span> <tr id=entity-leftrightarrows><td> <code>leftrightarrows;</code> <td> U+021C6 <td> <span class=glyph>⇆</span> <tr id=entity-leftrightharpoons><td> <code>leftrightharpoons;</code> <td> U+021CB <td> <span class=glyph>⇋</span> <tr id=entity-leftrightsquigarrow><td> <code>leftrightsquigarrow;</code> <td> U+021AD <td> <span class=glyph>↭</span> <tr id=entity-LeftRightVector><td> <code>LeftRightVector;</code> <td> U+0294E <td> <span class=glyph>⥎</span> <tr id=entity-LeftTee><td> <code>LeftTee;</code> <td> U+022A3 <td> <span class=glyph>⊣</span> <tr id=entity-LeftTeeArrow><td> <code>LeftTeeArrow;</code> <td> U+021A4 <td> <span class=glyph>↤</span> <tr id=entity-LeftTeeVector><td> <code>LeftTeeVector;</code> <td> U+0295A <td> <span class=glyph>⥚</span> <tr id=entity-leftthreetimes><td> <code>leftthreetimes;</code> <td> U+022CB <td> <span class=glyph>⋋</span> <tr id=entity-LeftTriangle><td> <code>LeftTriangle;</code> <td> U+022B2 <td> <span class=glyph>⊲</span> <tr id=entity-LeftTriangleBar><td> <code>LeftTriangleBar;</code> <td> U+029CF <td> <span class=glyph>⧏</span> <tr id=entity-LeftTriangleEqual><td> <code>LeftTriangleEqual;</code> <td> U+022B4 <td> <span class=glyph>⊴</span> <tr id=entity-LeftUpDownVector><td> <code>LeftUpDownVector;</code> <td> U+02951 <td> <span class=glyph>⥑</span> <tr id=entity-LeftUpTeeVector><td> <code>LeftUpTeeVector;</code> <td> U+02960 <td> <span class=glyph>⥠</span> <tr id=entity-LeftUpVector><td> <code>LeftUpVector;</code> <td> U+021BF <td> <span class=glyph>↿</span> <tr id=entity-LeftUpVectorBar><td> <code>LeftUpVectorBar;</code> <td> U+02958 <td> <span class=glyph>⥘</span> <tr id=entity-LeftVector><td> <code>LeftVector;</code> <td> U+021BC <td> <span class=glyph>↼</span> <tr id=entity-LeftVectorBar><td> <code>LeftVectorBar;</code> <td> U+02952 <td> <span class=glyph>⥒</span> <tr id=entity-lEg><td> <code>lEg;</code> <td> U+02A8B <td> <span class=glyph>⪋</span> <tr id=entity-leg><td> <code>leg;</code> <td> U+022DA <td> <span class=glyph>⋚</span> <tr id=entity-leq><td> <code>leq;</code> <td> U+02264 <td> <span class=glyph>≤</span> <tr id=entity-leqq><td> <code>leqq;</code> <td> U+02266 <td> <span class=glyph>≦</span> <tr id=entity-leqslant><td> <code>leqslant;</code> <td> U+02A7D <td> <span class=glyph>⩽</span> <tr id=entity-les><td> <code>les;</code> <td> U+02A7D <td> <span class=glyph>⩽</span> <tr id=entity-lescc><td> <code>lescc;</code> <td> U+02AA8 <td> <span class=glyph>⪨</span> <tr id=entity-lesdot><td> <code>lesdot;</code> <td> U+02A7F <td> <span class=glyph>⩿</span> <tr id=entity-lesdoto><td> <code>lesdoto;</code> <td> U+02A81 <td> <span class=glyph>⪁</span> <tr id=entity-lesdotor><td> <code>lesdotor;</code> <td> U+02A83 <td> <span class=glyph>⪃</span> <tr id=entity-lesg><td> <code>lesg;</code> <td> U+022DA U+0FE00 <td> <span class="glyph compound">⋚︀</span> <tr id=entity-lesges><td> <code>lesges;</code> <td> U+02A93 <td> <span class=glyph>⪓</span> <tr id=entity-lessapprox><td> <code>lessapprox;</code> <td> U+02A85 <td> <span class=glyph>⪅</span> <tr id=entity-lessdot><td> <code>lessdot;</code> <td> U+022D6 <td> <span class=glyph>⋖</span> <tr id=entity-lesseqgtr><td> <code>lesseqgtr;</code> <td> U+022DA <td> <span class=glyph>⋚</span> <tr id=entity-lesseqqgtr><td> <code>lesseqqgtr;</code> <td> U+02A8B <td> <span class=glyph>⪋</span> <tr id=entity-LessEqualGreater><td> <code>LessEqualGreater;</code> <td> U+022DA <td> <span class=glyph>⋚</span> <tr id=entity-LessFullEqual><td> <code>LessFullEqual;</code> <td> U+02266 <td> <span class=glyph>≦</span> <tr id=entity-LessGreater><td> <code>LessGreater;</code> <td> U+02276 <td> <span class=glyph>≶</span> <tr id=entity-lessgtr><td> <code>lessgtr;</code> <td> U+02276 <td> <span class=glyph>≶</span> <tr id=entity-LessLess><td> <code>LessLess;</code> <td> U+02AA1 <td> <span class=glyph>⪡</span> <tr id=entity-lesssim><td> <code>lesssim;</code> <td> U+02272 <td> <span class=glyph>≲</span> <tr id=entity-LessSlantEqual><td> <code>LessSlantEqual;</code> <td> U+02A7D <td> <span class=glyph>⩽</span> <tr id=entity-LessTilde><td> <code>LessTilde;</code> <td> U+02272 <td> <span class=glyph>≲</span> <tr id=entity-lfisht><td> <code>lfisht;</code> <td> U+0297C <td> <span class=glyph>⥼</span> <tr id=entity-lfloor><td> <code>lfloor;</code> <td> U+0230A <td> <span class=glyph>⌊</span> <tr id=entity-Lfr><td> <code>Lfr;</code> <td> U+1D50F <td> <span class=glyph>𝔏</span> <tr id=entity-lfr><td> <code>lfr;</code> <td> U+1D529 <td> <span class=glyph>𝔩</span> <tr id=entity-lg><td> <code>lg;</code> <td> U+02276 <td> <span class=glyph>≶</span> <tr id=entity-lgE><td> <code>lgE;</code> <td> U+02A91 <td> <span class=glyph>⪑</span> <tr id=entity-lHar><td> <code>lHar;</code> <td> U+02962 <td> <span class=glyph>⥢</span> <tr id=entity-lhard><td> <code>lhard;</code> <td> U+021BD <td> <span class=glyph>↽</span> <tr id=entity-lharu><td> <code>lharu;</code> <td> U+021BC <td> <span class=glyph>↼</span> <tr id=entity-lharul><td> <code>lharul;</code> <td> U+0296A <td> <span class=glyph>⥪</span> <tr id=entity-lhblk><td> <code>lhblk;</code> <td> U+02584 <td> <span class=glyph>▄</span> <tr id=entity-LJcy><td> <code>LJcy;</code> <td> U+00409 <td> <span class=glyph>Љ</span> <tr id=entity-ljcy><td> <code>ljcy;</code> <td> U+00459 <td> <span class=glyph>љ</span> <tr id=entity-Ll><td> <code>Ll;</code> <td> U+022D8 <td> <span class=glyph>⋘</span> <tr id=entity-ll><td> <code>ll;</code> <td> U+0226A <td> <span class=glyph>≪</span> <tr id=entity-llarr><td> <code>llarr;</code> <td> U+021C7 <td> <span class=glyph>⇇</span> <tr id=entity-llcorner><td> <code>llcorner;</code> <td> U+0231E <td> <span class=glyph>⌞</span> <tr id=entity-Lleftarrow><td> <code>Lleftarrow;</code> <td> U+021DA <td> <span class=glyph>⇚</span> <tr id=entity-llhard><td> <code>llhard;</code> <td> U+0296B <td> <span class=glyph>⥫</span> <tr id=entity-lltri><td> <code>lltri;</code> <td> U+025FA <td> <span class=glyph>◺</span> <tr id=entity-Lmidot><td> <code>Lmidot;</code> <td> U+0013F <td> <span class=glyph>Ŀ</span> <tr id=entity-lmidot><td> <code>lmidot;</code> <td> U+00140 <td> <span class=glyph>ŀ</span> <tr id=entity-lmoust><td> <code>lmoust;</code> <td> U+023B0 <td> <span class=glyph>⎰</span> <tr id=entity-lmoustache><td> <code>lmoustache;</code> <td> U+023B0 <td> <span class=glyph>⎰</span> <tr id=entity-lnap><td> <code>lnap;</code> <td> U+02A89 <td> <span class=glyph>⪉</span> <tr id=entity-lnapprox><td> <code>lnapprox;</code> <td> U+02A89 <td> <span class=glyph>⪉</span> <tr id=entity-lnE><td> <code>lnE;</code> <td> U+02268 <td> <span class=glyph>≨</span> <tr id=entity-lne><td> <code>lne;</code> <td> U+02A87 <td> <span class=glyph>⪇</span> <tr id=entity-lneq><td> <code>lneq;</code> <td> U+02A87 <td> <span class=glyph>⪇</span> <tr id=entity-lneqq><td> <code>lneqq;</code> <td> U+02268 <td> <span class=glyph>≨</span> <tr id=entity-lnsim><td> <code>lnsim;</code> <td> U+022E6 <td> <span class=glyph>⋦</span> <tr id=entity-loang><td> <code>loang;</code> <td> U+027EC <td> <span class=glyph>⟬</span> <tr id=entity-loarr><td> <code>loarr;</code> <td> U+021FD <td> <span class=glyph>⇽</span> <tr id=entity-lobrk><td> <code>lobrk;</code> <td> U+027E6 <td> <span class=glyph>⟦</span> <tr id=entity-LongLeftArrow><td> <code>LongLeftArrow;</code> <td> U+027F5 <td> <span class=glyph>⟵</span> <tr id=entity-Longleftarrow><td> <code>Longleftarrow;</code> <td> U+027F8 <td> <span class=glyph>⟸</span> <tr id=entity-longleftarrow><td> <code>longleftarrow;</code> <td> U+027F5 <td> <span class=glyph>⟵</span> <tr id=entity-LongLeftRightArrow><td> <code>LongLeftRightArrow;</code> <td> U+027F7 <td> <span class=glyph>⟷</span> <tr id=entity-Longleftrightarrow><td> <code>Longleftrightarrow;</code> <td> U+027FA <td> <span class=glyph>⟺</span> <tr id=entity-longleftrightarrow><td> <code>longleftrightarrow;</code> <td> U+027F7 <td> <span class=glyph>⟷</span> <tr id=entity-longmapsto><td> <code>longmapsto;</code> <td> U+027FC <td> <span class=glyph>⟼</span> <tr id=entity-LongRightArrow><td> <code>LongRightArrow;</code> <td> U+027F6 <td> <span class=glyph>⟶</span> <tr id=entity-Longrightarrow><td> <code>Longrightarrow;</code> <td> U+027F9 <td> <span class=glyph>⟹</span> <tr id=entity-longrightarrow><td> <code>longrightarrow;</code> <td> U+027F6 <td> <span class=glyph>⟶</span> <tr id=entity-looparrowleft><td> <code>looparrowleft;</code> <td> U+021AB <td> <span class=glyph>↫</span> <tr id=entity-looparrowright><td> <code>looparrowright;</code> <td> U+021AC <td> <span class=glyph>↬</span> <tr id=entity-lopar><td> <code>lopar;</code> <td> U+02985 <td> <span class=glyph>⦅</span> <tr id=entity-Lopf><td> <code>Lopf;</code> <td> U+1D543 <td> <span class=glyph>𝕃</span> <tr id=entity-lopf><td> <code>lopf;</code> <td> U+1D55D <td> <span class=glyph>𝕝</span> <tr id=entity-loplus><td> <code>loplus;</code> <td> U+02A2D <td> <span class=glyph>⨭</span> <tr id=entity-lotimes><td> <code>lotimes;</code> <td> U+02A34 <td> <span class=glyph>⨴</span> <tr id=entity-lowast><td> <code>lowast;</code> <td> U+02217 <td> <span class=glyph>∗</span> <tr id=entity-lowbar><td> <code>lowbar;</code> <td> U+0005F <td> <span class=glyph>_</span> <tr id=entity-LowerLeftArrow><td> <code>LowerLeftArrow;</code> <td> U+02199 <td> <span class=glyph>↙</span> <tr id=entity-LowerRightArrow><td> <code>LowerRightArrow;</code> <td> U+02198 <td> <span class=glyph>↘</span> <tr id=entity-loz><td> <code>loz;</code> <td> U+025CA <td> <span class=glyph>◊</span> <tr id=entity-lozenge><td> <code>lozenge;</code> <td> U+025CA <td> <span class=glyph>◊</span> <tr id=entity-lozf><td> <code>lozf;</code> <td> U+029EB <td> <span class=glyph>⧫</span> <tr id=entity-lpar><td> <code>lpar;</code> <td> U+00028 <td> <span class=glyph>(</span> <tr id=entity-lparlt><td> <code>lparlt;</code> <td> U+02993 <td> <span class=glyph>⦓</span> <tr id=entity-lrarr><td> <code>lrarr;</code> <td> U+021C6 <td> <span class=glyph>⇆</span> <tr id=entity-lrcorner><td> <code>lrcorner;</code> <td> U+0231F <td> <span class=glyph>⌟</span> <tr id=entity-lrhar><td> <code>lrhar;</code> <td> U+021CB <td> <span class=glyph>⇋</span> <tr id=entity-lrhard><td> <code>lrhard;</code> <td> U+0296D <td> <span class=glyph>⥭</span> <tr id=entity-lrm><td> <code>lrm;</code> <td> U+0200E <td> <span class=glyph></span> <tr id=entity-lrtri><td> <code>lrtri;</code> <td> U+022BF <td> <span class=glyph>⊿</span> <tr id=entity-lsaquo><td> <code>lsaquo;</code> <td> U+02039 <td> <span class=glyph>‹</span> <tr id=entity-Lscr><td> <code>Lscr;</code> <td> U+02112 <td> <span class=glyph>ℒ</span> <tr id=entity-lscr><td> <code>lscr;</code> <td> U+1D4C1 <td> <span class=glyph>𝓁</span> <tr id=entity-Lsh><td> <code>Lsh;</code> <td> U+021B0 <td> <span class=glyph>↰</span> <tr id=entity-lsh><td> <code>lsh;</code> <td> U+021B0 <td> <span class=glyph>↰</span> <tr id=entity-lsim><td> <code>lsim;</code> <td> U+02272 <td> <span class=glyph>≲</span> <tr id=entity-lsime><td> <code>lsime;</code> <td> U+02A8D <td> <span class=glyph>⪍</span> <tr id=entity-lsimg><td> <code>lsimg;</code> <td> U+02A8F <td> <span class=glyph>⪏</span> <tr id=entity-lsqb><td> <code>lsqb;</code> <td> U+0005B <td> <span class=glyph>[</span> <tr id=entity-lsquo><td> <code>lsquo;</code> <td> U+02018 <td> <span class=glyph>‘</span> <tr id=entity-lsquor><td> <code>lsquor;</code> <td> U+0201A <td> <span class=glyph>‚</span> <tr id=entity-Lstrok><td> <code>Lstrok;</code> <td> U+00141 <td> <span class=glyph>Ł</span> <tr id=entity-lstrok><td> <code>lstrok;</code> <td> U+00142 <td> <span class=glyph>ł</span> <tr id=entity-LT><td> <code>LT;</code> <td> U+0003C <td> <span class=glyph><</span> <tr id=entity-LT-legacy class=impl><td> <code>LT</code> <td> U+0003C <td> <span><</span> <tr id=entity-Lt><td> <code>Lt;</code> <td> U+0226A <td> <span class=glyph>≪</span> <tr id=entity-lt><td> <code>lt;</code> <td> U+0003C <td> <span class=glyph><</span> <tr id=entity-lt-legacy class=impl><td> <code>lt</code> <td> U+0003C <td> <span><</span> <tr id=entity-ltcc><td> <code>ltcc;</code> <td> U+02AA6 <td> <span class=glyph>⪦</span> <tr id=entity-ltcir><td> <code>ltcir;</code> <td> U+02A79 <td> <span class=glyph>⩹</span> <tr id=entity-ltdot><td> <code>ltdot;</code> <td> U+022D6 <td> <span class=glyph>⋖</span> <tr id=entity-lthree><td> <code>lthree;</code> <td> U+022CB <td> <span class=glyph>⋋</span> <tr id=entity-ltimes><td> <code>ltimes;</code> <td> U+022C9 <td> <span class=glyph>⋉</span> <tr id=entity-ltlarr><td> <code>ltlarr;</code> <td> U+02976 <td> <span class=glyph>⥶</span> <tr id=entity-ltquest><td> <code>ltquest;</code> <td> U+02A7B <td> <span class=glyph>⩻</span> <tr id=entity-ltri><td> <code>ltri;</code> <td> U+025C3 <td> <span class=glyph>◃</span> <tr id=entity-ltrie><td> <code>ltrie;</code> <td> U+022B4 <td> <span class=glyph>⊴</span> <tr id=entity-ltrif><td> <code>ltrif;</code> <td> U+025C2 <td> <span class=glyph>◂</span> <tr id=entity-ltrPar><td> <code>ltrPar;</code> <td> U+02996 <td> <span class=glyph>⦖</span> <tr id=entity-lurdshar><td> <code>lurdshar;</code> <td> U+0294A <td> <span class=glyph>⥊</span> <tr id=entity-luruhar><td> <code>luruhar;</code> <td> U+02966 <td> <span class=glyph>⥦</span> <tr id=entity-lvertneqq><td> <code>lvertneqq;</code> <td> U+02268 U+0FE00 <td> <span class="glyph compound">≨︀</span> <tr id=entity-lvnE><td> <code>lvnE;</code> <td> U+02268 U+0FE00 <td> <span class="glyph compound">≨︀</span> <tr id=entity-macr><td> <code>macr;</code> <td> U+000AF <td> <span class=glyph>¯</span> <tr id=entity-macr-legacy class=impl><td> <code>macr</code> <td> U+000AF <td> <span>¯</span> <tr id=entity-male><td> <code>male;</code> <td> U+02642 <td> <span class=glyph>♂</span> <tr id=entity-malt><td> <code>malt;</code> <td> U+02720 <td> <span class=glyph>✠</span> <tr id=entity-maltese><td> <code>maltese;</code> <td> U+02720 <td> <span class=glyph>✠</span> <tr id=entity-Map><td> <code>Map;</code> <td> U+02905 <td> <span class=glyph>⤅</span> <tr id=entity-map><td> <code>map;</code> <td> U+021A6 <td> <span class=glyph>↦</span> <tr id=entity-mapsto><td> <code>mapsto;</code> <td> U+021A6 <td> <span class=glyph>↦</span> <tr id=entity-mapstodown><td> <code>mapstodown;</code> <td> U+021A7 <td> <span class=glyph>↧</span> <tr id=entity-mapstoleft><td> <code>mapstoleft;</code> <td> U+021A4 <td> <span class=glyph>↤</span> <tr id=entity-mapstoup><td> <code>mapstoup;</code> <td> U+021A5 <td> <span class=glyph>↥</span> <tr id=entity-marker><td> <code>marker;</code> <td> U+025AE <td> <span class=glyph>▮</span> <tr id=entity-mcomma><td> <code>mcomma;</code> <td> U+02A29 <td> <span class=glyph>⨩</span> <tr id=entity-Mcy><td> <code>Mcy;</code> <td> U+0041C <td> <span class=glyph>М</span> <tr id=entity-mcy><td> <code>mcy;</code> <td> U+0043C <td> <span class=glyph>м</span> <tr id=entity-mdash><td> <code>mdash;</code> <td> U+02014 <td> <span class=glyph>—</span> <tr id=entity-mDDot><td> <code>mDDot;</code> <td> U+0223A <td> <span class=glyph>∺</span> <tr id=entity-measuredangle><td> <code>measuredangle;</code> <td> U+02221 <td> <span class=glyph>∡</span> <tr id=entity-MediumSpace><td> <code>MediumSpace;</code> <td> U+0205F <td> <span class=glyph> </span> <tr id=entity-Mellintrf><td> <code>Mellintrf;</code> <td> U+02133 <td> <span class=glyph>ℳ</span> <tr id=entity-Mfr><td> <code>Mfr;</code> <td> U+1D510 <td> <span class=glyph>𝔐</span> <tr id=entity-mfr><td> <code>mfr;</code> <td> U+1D52A <td> <span class=glyph>𝔪</span> <tr id=entity-mho><td> <code>mho;</code> <td> U+02127 <td> <span class=glyph>℧</span> <tr id=entity-micro><td> <code>micro;</code> <td> U+000B5 <td> <span class=glyph>µ</span> <tr id=entity-micro-legacy class=impl><td> <code>micro</code> <td> U+000B5 <td> <span>µ</span> <tr id=entity-mid><td> <code>mid;</code> <td> U+02223 <td> <span class=glyph>∣</span> <tr id=entity-midast><td> <code>midast;</code> <td> U+0002A <td> <span class=glyph>*</span> <tr id=entity-midcir><td> <code>midcir;</code> <td> U+02AF0 <td> <span class=glyph>⫰</span> <tr id=entity-middot><td> <code>middot;</code> <td> U+000B7 <td> <span class=glyph>·</span> <tr id=entity-middot-legacy class=impl><td> <code>middot</code> <td> U+000B7 <td> <span>·</span> <tr id=entity-minus><td> <code>minus;</code> <td> U+02212 <td> <span class=glyph>−</span> <tr id=entity-minusb><td> <code>minusb;</code> <td> U+0229F <td> <span class=glyph>⊟</span> <tr id=entity-minusd><td> <code>minusd;</code> <td> U+02238 <td> <span class=glyph>∸</span> <tr id=entity-minusdu><td> <code>minusdu;</code> <td> U+02A2A <td> <span class=glyph>⨪</span> <tr id=entity-MinusPlus><td> <code>MinusPlus;</code> <td> U+02213 <td> <span class=glyph>∓</span> <tr id=entity-mlcp><td> <code>mlcp;</code> <td> U+02ADB <td> <span class=glyph>⫛</span> <tr id=entity-mldr><td> <code>mldr;</code> <td> U+02026 <td> <span class=glyph>…</span> <tr id=entity-mnplus><td> <code>mnplus;</code> <td> U+02213 <td> <span class=glyph>∓</span> <tr id=entity-models><td> <code>models;</code> <td> U+022A7 <td> <span class=glyph>⊧</span> <tr id=entity-Mopf><td> <code>Mopf;</code> <td> U+1D544 <td> <span class=glyph>𝕄</span> <tr id=entity-mopf><td> <code>mopf;</code> <td> U+1D55E <td> <span class=glyph>𝕞</span> <tr id=entity-mp><td> <code>mp;</code> <td> U+02213 <td> <span class=glyph>∓</span> <tr id=entity-Mscr><td> <code>Mscr;</code> <td> U+02133 <td> <span class=glyph>ℳ</span> <tr id=entity-mscr><td> <code>mscr;</code> <td> U+1D4C2 <td> <span class=glyph>𝓂</span> <tr id=entity-mstpos><td> <code>mstpos;</code> <td> U+0223E <td> <span class=glyph>∾</span> <tr id=entity-Mu><td> <code>Mu;</code> <td> U+0039C <td> <span class=glyph>Μ</span> <tr id=entity-mu><td> <code>mu;</code> <td> U+003BC <td> <span class=glyph>μ</span> <tr id=entity-multimap><td> <code>multimap;</code> <td> U+022B8 <td> <span class=glyph>⊸</span> <tr id=entity-mumap><td> <code>mumap;</code> <td> U+022B8 <td> <span class=glyph>⊸</span> <tr id=entity-nabla><td> <code>nabla;</code> <td> U+02207 <td> <span class=glyph>∇</span> <tr id=entity-Nacute><td> <code>Nacute;</code> <td> U+00143 <td> <span class=glyph>Ń</span> <tr id=entity-nacute><td> <code>nacute;</code> <td> U+00144 <td> <span class=glyph>ń</span> <tr id=entity-nang><td> <code>nang;</code> <td> U+02220 U+020D2 <td> <span class="glyph compound">∠⃒</span> <tr id=entity-nap><td> <code>nap;</code> <td> U+02249 <td> <span class=glyph>≉</span> <tr id=entity-napE><td> <code>napE;</code> <td> U+02A70 U+00338 <td> <span class="glyph compound">⩰̸</span> <tr id=entity-napid><td> <code>napid;</code> <td> U+0224B U+00338 <td> <span class="glyph compound">≋̸</span> <tr id=entity-napos><td> <code>napos;</code> <td> U+00149 <td> <span class=glyph>ʼn</span> <tr id=entity-napprox><td> <code>napprox;</code> <td> U+02249 <td> <span class=glyph>≉</span> <tr id=entity-natur><td> <code>natur;</code> <td> U+0266E <td> <span class=glyph>♮</span> <tr id=entity-natural><td> <code>natural;</code> <td> U+0266E <td> <span class=glyph>♮</span> <tr id=entity-naturals><td> <code>naturals;</code> <td> U+02115 <td> <span class=glyph>ℕ</span> <tr id=entity-nbsp><td> <code>nbsp;</code> <td> U+000A0 <td> <span class=glyph> </span> <tr id=entity-nbsp-legacy class=impl><td> <code>nbsp</code> <td> U+000A0 <td> <span> </span> <tr id=entity-nbump><td> <code>nbump;</code> <td> U+0224E U+00338 <td> <span class="glyph compound">≎̸</span> <tr id=entity-nbumpe><td> <code>nbumpe;</code> <td> U+0224F U+00338 <td> <span class="glyph compound">≏̸</span> <tr id=entity-ncap><td> <code>ncap;</code> <td> U+02A43 <td> <span class=glyph>⩃</span> <tr id=entity-Ncaron><td> <code>Ncaron;</code> <td> U+00147 <td> <span class=glyph>Ň</span> <tr id=entity-ncaron><td> <code>ncaron;</code> <td> U+00148 <td> <span class=glyph>ň</span> <tr id=entity-Ncedil><td> <code>Ncedil;</code> <td> U+00145 <td> <span class=glyph>Ņ</span> <tr id=entity-ncedil><td> <code>ncedil;</code> <td> U+00146 <td> <span class=glyph>ņ</span> <tr id=entity-ncong><td> <code>ncong;</code> <td> U+02247 <td> <span class=glyph>≇</span> <tr id=entity-ncongdot><td> <code>ncongdot;</code> <td> U+02A6D U+00338 <td> <span class="glyph compound">⩭̸</span> <tr id=entity-ncup><td> <code>ncup;</code> <td> U+02A42 <td> <span class=glyph>⩂</span> <tr id=entity-Ncy><td> <code>Ncy;</code> <td> U+0041D <td> <span class=glyph>Н</span> <tr id=entity-ncy><td> <code>ncy;</code> <td> U+0043D <td> <span class=glyph>н</span> <tr id=entity-ndash><td> <code>ndash;</code> <td> U+02013 <td> <span class=glyph>–</span> <tr id=entity-ne><td> <code>ne;</code> <td> U+02260 <td> <span class=glyph>≠</span> <tr id=entity-nearhk><td> <code>nearhk;</code> <td> U+02924 <td> <span class=glyph>⤤</span> <tr id=entity-neArr><td> <code>neArr;</code> <td> U+021D7 <td> <span class=glyph>⇗</span> <tr id=entity-nearr><td> <code>nearr;</code> <td> U+02197 <td> <span class=glyph>↗</span> <tr id=entity-nearrow><td> <code>nearrow;</code> <td> U+02197 <td> <span class=glyph>↗</span> <tr id=entity-nedot><td> <code>nedot;</code> <td> U+02250 U+00338 <td> <span class="glyph compound">≐̸</span> <tr id=entity-NegativeMediumSpace><td> <code>NegativeMediumSpace;</code> <td> U+0200B <td> <span class=glyph></span> <tr id=entity-NegativeThickSpace><td> <code>NegativeThickSpace;</code> <td> U+0200B <td> <span class=glyph></span> <tr id=entity-NegativeThinSpace><td> <code>NegativeThinSpace;</code> <td> U+0200B <td> <span class=glyph></span> <tr id=entity-NegativeVeryThinSpace><td> <code>NegativeVeryThinSpace;</code> <td> U+0200B <td> <span class=glyph></span> <tr id=entity-nequiv><td> <code>nequiv;</code> <td> U+02262 <td> <span class=glyph>≢</span> <tr id=entity-nesear><td> <code>nesear;</code> <td> U+02928 <td> <span class=glyph>⤨</span> <tr id=entity-nesim><td> <code>nesim;</code> <td> U+02242 U+00338 <td> <span class="glyph compound">≂̸</span> <tr id=entity-NestedGreaterGreater><td> <code>NestedGreaterGreater;</code> <td> U+0226B <td> <span class=glyph>≫</span> <tr id=entity-NestedLessLess><td> <code>NestedLessLess;</code> <td> U+0226A <td> <span class=glyph>≪</span> <tr id=entity-NewLine><td> <code>NewLine;</code> <td> U+0000A <td> <span class="glyph control">␊</span> <tr id=entity-nexist><td> <code>nexist;</code> <td> U+02204 <td> <span class=glyph>∄</span> <tr id=entity-nexists><td> <code>nexists;</code> <td> U+02204 <td> <span class=glyph>∄</span> <tr id=entity-Nfr><td> <code>Nfr;</code> <td> U+1D511 <td> <span class=glyph>𝔑</span> <tr id=entity-nfr><td> <code>nfr;</code> <td> U+1D52B <td> <span class=glyph>𝔫</span> <tr id=entity-ngE><td> <code>ngE;</code> <td> U+02267 U+00338 <td> <span class="glyph compound">≧̸</span> <tr id=entity-nge><td> <code>nge;</code> <td> U+02271 <td> <span class=glyph>≱</span> <tr id=entity-ngeq><td> <code>ngeq;</code> <td> U+02271 <td> <span class=glyph>≱</span> <tr id=entity-ngeqq><td> <code>ngeqq;</code> <td> U+02267 U+00338 <td> <span class="glyph compound">≧̸</span> <tr id=entity-ngeqslant><td> <code>ngeqslant;</code> <td> U+02A7E U+00338 <td> <span class="glyph compound">⩾̸</span> <tr id=entity-nges><td> <code>nges;</code> <td> U+02A7E U+00338 <td> <span class="glyph compound">⩾̸</span> <tr id=entity-nGg><td> <code>nGg;</code> <td> U+022D9 U+00338 <td> <span class="glyph compound">⋙̸</span> <tr id=entity-ngsim><td> <code>ngsim;</code> <td> U+02275 <td> <span class=glyph>≵</span> <tr id=entity-nGt><td> <code>nGt;</code> <td> U+0226B U+020D2 <td> <span class="glyph compound">≫⃒</span> <tr id=entity-ngt><td> <code>ngt;</code> <td> U+0226F <td> <span class=glyph>≯</span> <tr id=entity-ngtr><td> <code>ngtr;</code> <td> U+0226F <td> <span class=glyph>≯</span> <tr id=entity-nGtv><td> <code>nGtv;</code> <td> U+0226B U+00338 <td> <span class="glyph compound">≫̸</span> <tr id=entity-nhArr><td> <code>nhArr;</code> <td> U+021CE <td> <span class=glyph>⇎</span> <tr id=entity-nharr><td> <code>nharr;</code> <td> U+021AE <td> <span class=glyph>↮</span> <tr id=entity-nhpar><td> <code>nhpar;</code> <td> U+02AF2 <td> <span class=glyph>⫲</span> <tr id=entity-ni><td> <code>ni;</code> <td> U+0220B <td> <span class=glyph>∋</span> <tr id=entity-nis><td> <code>nis;</code> <td> U+022FC <td> <span class=glyph>⋼</span> <tr id=entity-nisd><td> <code>nisd;</code> <td> U+022FA <td> <span class=glyph>⋺</span> <tr id=entity-niv><td> <code>niv;</code> <td> U+0220B <td> <span class=glyph>∋</span> <tr id=entity-NJcy><td> <code>NJcy;</code> <td> U+0040A <td> <span class=glyph>Њ</span> <tr id=entity-njcy><td> <code>njcy;</code> <td> U+0045A <td> <span class=glyph>њ</span> <tr id=entity-nlArr><td> <code>nlArr;</code> <td> U+021CD <td> <span class=glyph>⇍</span> <tr id=entity-nlarr><td> <code>nlarr;</code> <td> U+0219A <td> <span class=glyph>↚</span> <tr id=entity-nldr><td> <code>nldr;</code> <td> U+02025 <td> <span class=glyph>‥</span> <tr id=entity-nlE><td> <code>nlE;</code> <td> U+02266 U+00338 <td> <span class="glyph compound">≦̸</span> <tr id=entity-nle><td> <code>nle;</code> <td> U+02270 <td> <span class=glyph>≰</span> <tr id=entity-nLeftarrow><td> <code>nLeftarrow;</code> <td> U+021CD <td> <span class=glyph>⇍</span> <tr id=entity-nleftarrow><td> <code>nleftarrow;</code> <td> U+0219A <td> <span class=glyph>↚</span> <tr id=entity-nLeftrightarrow><td> <code>nLeftrightarrow;</code> <td> U+021CE <td> <span class=glyph>⇎</span> <tr id=entity-nleftrightarrow><td> <code>nleftrightarrow;</code> <td> U+021AE <td> <span class=glyph>↮</span> <tr id=entity-nleq><td> <code>nleq;</code> <td> U+02270 <td> <span class=glyph>≰</span> <tr id=entity-nleqq><td> <code>nleqq;</code> <td> U+02266 U+00338 <td> <span class="glyph compound">≦̸</span> <tr id=entity-nleqslant><td> <code>nleqslant;</code> <td> U+02A7D U+00338 <td> <span class="glyph compound">⩽̸</span> <tr id=entity-nles><td> <code>nles;</code> <td> U+02A7D U+00338 <td> <span class="glyph compound">⩽̸</span> <tr id=entity-nless><td> <code>nless;</code> <td> U+0226E <td> <span class=glyph>≮</span> <tr id=entity-nLl><td> <code>nLl;</code> <td> U+022D8 U+00338 <td> <span class="glyph compound">⋘̸</span> <tr id=entity-nlsim><td> <code>nlsim;</code> <td> U+02274 <td> <span class=glyph>≴</span> <tr id=entity-nLt><td> <code>nLt;</code> <td> U+0226A U+020D2 <td> <span class="glyph compound">≪⃒</span> <tr id=entity-nlt><td> <code>nlt;</code> <td> U+0226E <td> <span class=glyph>≮</span> <tr id=entity-nltri><td> <code>nltri;</code> <td> U+022EA <td> <span class=glyph>⋪</span> <tr id=entity-nltrie><td> <code>nltrie;</code> <td> U+022EC <td> <span class=glyph>⋬</span> <tr id=entity-nLtv><td> <code>nLtv;</code> <td> U+0226A U+00338 <td> <span class="glyph compound">≪̸</span> <tr id=entity-nmid><td> <code>nmid;</code> <td> U+02224 <td> <span class=glyph>∤</span> <tr id=entity-NoBreak><td> <code>NoBreak;</code> <td> U+02060 <td> <span class=glyph></span> <tr id=entity-NonBreakingSpace><td> <code>NonBreakingSpace;</code> <td> U+000A0 <td> <span class=glyph> </span> <tr id=entity-Nopf><td> <code>Nopf;</code> <td> U+02115 <td> <span class=glyph>ℕ</span> <tr id=entity-nopf><td> <code>nopf;</code> <td> U+1D55F <td> <span class=glyph>𝕟</span> <tr id=entity-Not><td> <code>Not;</code> <td> U+02AEC <td> <span class=glyph>⫬</span> <tr id=entity-not><td> <code>not;</code> <td> U+000AC <td> <span class=glyph>¬</span> <tr id=entity-not-legacy class=impl><td> <code>not</code> <td> U+000AC <td> <span>¬</span> <tr id=entity-NotCongruent><td> <code>NotCongruent;</code> <td> U+02262 <td> <span class=glyph>≢</span> <tr id=entity-NotCupCap><td> <code>NotCupCap;</code> <td> U+0226D <td> <span class=glyph>≭</span> <tr id=entity-NotDoubleVerticalBar><td> <code>NotDoubleVerticalBar;</code> <td> U+02226 <td> <span class=glyph>∦</span> <tr id=entity-NotElement><td> <code>NotElement;</code> <td> U+02209 <td> <span class=glyph>∉</span> <tr id=entity-NotEqual><td> <code>NotEqual;</code> <td> U+02260 <td> <span class=glyph>≠</span> <tr id=entity-NotEqualTilde><td> <code>NotEqualTilde;</code> <td> U+02242 U+00338 <td> <span class="glyph compound">≂̸</span> <tr id=entity-NotExists><td> <code>NotExists;</code> <td> U+02204 <td> <span class=glyph>∄</span> <tr id=entity-NotGreater><td> <code>NotGreater;</code> <td> U+0226F <td> <span class=glyph>≯</span> <tr id=entity-NotGreaterEqual><td> <code>NotGreaterEqual;</code> <td> U+02271 <td> <span class=glyph>≱</span> <tr id=entity-NotGreaterFullEqual><td> <code>NotGreaterFullEqual;</code> <td> U+02267 U+00338 <td> <span class="glyph compound">≧̸</span> <tr id=entity-NotGreaterGreater><td> <code>NotGreaterGreater;</code> <td> U+0226B U+00338 <td> <span class="glyph compound">≫̸</span> <tr id=entity-NotGreaterLess><td> <code>NotGreaterLess;</code> <td> U+02279 <td> <span class=glyph>≹</span> <tr id=entity-NotGreaterSlantEqual><td> <code>NotGreaterSlantEqual;</code> <td> U+02A7E U+00338 <td> <span class="glyph compound">⩾̸</span> <tr id=entity-NotGreaterTilde><td> <code>NotGreaterTilde;</code> <td> U+02275 <td> <span class=glyph>≵</span> <tr id=entity-NotHumpDownHump><td> <code>NotHumpDownHump;</code> <td> U+0224E U+00338 <td> <span class="glyph compound">≎̸</span> <tr id=entity-NotHumpEqual><td> <code>NotHumpEqual;</code> <td> U+0224F U+00338 <td> <span class="glyph compound">≏̸</span> <tr id=entity-notin><td> <code>notin;</code> <td> U+02209 <td> <span class=glyph>∉</span> <tr id=entity-notindot><td> <code>notindot;</code> <td> U+022F5 U+00338 <td> <span class="glyph compound">⋵̸</span> <tr id=entity-notinE><td> <code>notinE;</code> <td> U+022F9 U+00338 <td> <span class="glyph compound">⋹̸</span> <tr id=entity-notinva><td> <code>notinva;</code> <td> U+02209 <td> <span class=glyph>∉</span> <tr id=entity-notinvb><td> <code>notinvb;</code> <td> U+022F7 <td> <span class=glyph>⋷</span> <tr id=entity-notinvc><td> <code>notinvc;</code> <td> U+022F6 <td> <span class=glyph>⋶</span> <tr id=entity-NotLeftTriangle><td> <code>NotLeftTriangle;</code> <td> U+022EA <td> <span class=glyph>⋪</span> <tr id=entity-NotLeftTriangleBar><td> <code>NotLeftTriangleBar;</code> <td> U+029CF U+00338 <td> <span class="glyph compound">⧏̸</span> <tr id=entity-NotLeftTriangleEqual><td> <code>NotLeftTriangleEqual;</code> <td> U+022EC <td> <span class=glyph>⋬</span> <tr id=entity-NotLess><td> <code>NotLess;</code> <td> U+0226E <td> <span class=glyph>≮</span> <tr id=entity-NotLessEqual><td> <code>NotLessEqual;</code> <td> U+02270 <td> <span class=glyph>≰</span> <tr id=entity-NotLessGreater><td> <code>NotLessGreater;</code> <td> U+02278 <td> <span class=glyph>≸</span> <tr id=entity-NotLessLess><td> <code>NotLessLess;</code> <td> U+0226A U+00338 <td> <span class="glyph compound">≪̸</span> <tr id=entity-NotLessSlantEqual><td> <code>NotLessSlantEqual;</code> <td> U+02A7D U+00338 <td> <span class="glyph compound">⩽̸</span> <tr id=entity-NotLessTilde><td> <code>NotLessTilde;</code> <td> U+02274 <td> <span class=glyph>≴</span> <tr id=entity-NotNestedGreaterGreater><td> <code>NotNestedGreaterGreater;</code> <td> U+02AA2 U+00338 <td> <span class="glyph compound">⪢̸</span> <tr id=entity-NotNestedLessLess><td> <code>NotNestedLessLess;</code> <td> U+02AA1 U+00338 <td> <span class="glyph compound">⪡̸</span> <tr id=entity-notni><td> <code>notni;</code> <td> U+0220C <td> <span class=glyph>∌</span> <tr id=entity-notniva><td> <code>notniva;</code> <td> U+0220C <td> <span class=glyph>∌</span> <tr id=entity-notnivb><td> <code>notnivb;</code> <td> U+022FE <td> <span class=glyph>⋾</span> <tr id=entity-notnivc><td> <code>notnivc;</code> <td> U+022FD <td> <span class=glyph>⋽</span> <tr id=entity-NotPrecedes><td> <code>NotPrecedes;</code> <td> U+02280 <td> <span class=glyph>⊀</span> <tr id=entity-NotPrecedesEqual><td> <code>NotPrecedesEqual;</code> <td> U+02AAF U+00338 <td> <span class="glyph compound">⪯̸</span> <tr id=entity-NotPrecedesSlantEqual><td> <code>NotPrecedesSlantEqual;</code> <td> U+022E0 <td> <span class=glyph>⋠</span> <tr id=entity-NotReverseElement><td> <code>NotReverseElement;</code> <td> U+0220C <td> <span class=glyph>∌</span> <tr id=entity-NotRightTriangle><td> <code>NotRightTriangle;</code> <td> U+022EB <td> <span class=glyph>⋫</span> <tr id=entity-NotRightTriangleBar><td> <code>NotRightTriangleBar;</code> <td> U+029D0 U+00338 <td> <span class="glyph compound">⧐̸</span> <tr id=entity-NotRightTriangleEqual><td> <code>NotRightTriangleEqual;</code> <td> U+022ED <td> <span class=glyph>⋭</span> <tr id=entity-NotSquareSubset><td> <code>NotSquareSubset;</code> <td> U+0228F U+00338 <td> <span class="glyph compound">⊏̸</span> <tr id=entity-NotSquareSubsetEqual><td> <code>NotSquareSubsetEqual;</code> <td> U+022E2 <td> <span class=glyph>⋢</span> <tr id=entity-NotSquareSuperset><td> <code>NotSquareSuperset;</code> <td> U+02290 U+00338 <td> <span class="glyph compound">⊐̸</span> <tr id=entity-NotSquareSupersetEqual><td> <code>NotSquareSupersetEqual;</code> <td> U+022E3 <td> <span class=glyph>⋣</span> <tr id=entity-NotSubset><td> <code>NotSubset;</code> <td> U+02282 U+020D2 <td> <span class="glyph compound">⊂⃒</span> <tr id=entity-NotSubsetEqual><td> <code>NotSubsetEqual;</code> <td> U+02288 <td> <span class=glyph>⊈</span> <tr id=entity-NotSucceeds><td> <code>NotSucceeds;</code> <td> U+02281 <td> <span class=glyph>⊁</span> <tr id=entity-NotSucceedsEqual><td> <code>NotSucceedsEqual;</code> <td> U+02AB0 U+00338 <td> <span class="glyph compound">⪰̸</span> <tr id=entity-NotSucceedsSlantEqual><td> <code>NotSucceedsSlantEqual;</code> <td> U+022E1 <td> <span class=glyph>⋡</span> <tr id=entity-NotSucceedsTilde><td> <code>NotSucceedsTilde;</code> <td> U+0227F U+00338 <td> <span class="glyph compound">≿̸</span> <tr id=entity-NotSuperset><td> <code>NotSuperset;</code> <td> U+02283 U+020D2 <td> <span class="glyph compound">⊃⃒</span> <tr id=entity-NotSupersetEqual><td> <code>NotSupersetEqual;</code> <td> U+02289 <td> <span class=glyph>⊉</span> <tr id=entity-NotTilde><td> <code>NotTilde;</code> <td> U+02241 <td> <span class=glyph>≁</span> <tr id=entity-NotTildeEqual><td> <code>NotTildeEqual;</code> <td> U+02244 <td> <span class=glyph>≄</span> <tr id=entity-NotTildeFullEqual><td> <code>NotTildeFullEqual;</code> <td> U+02247 <td> <span class=glyph>≇</span> <tr id=entity-NotTildeTilde><td> <code>NotTildeTilde;</code> <td> U+02249 <td> <span class=glyph>≉</span> <tr id=entity-NotVerticalBar><td> <code>NotVerticalBar;</code> <td> U+02224 <td> <span class=glyph>∤</span> <tr id=entity-npar><td> <code>npar;</code> <td> U+02226 <td> <span class=glyph>∦</span> <tr id=entity-nparallel><td> <code>nparallel;</code> <td> U+02226 <td> <span class=glyph>∦</span> <tr id=entity-nparsl><td> <code>nparsl;</code> <td> U+02AFD U+020E5 <td> <span class="glyph compound">⫽⃥</span> <tr id=entity-npart><td> <code>npart;</code> <td> U+02202 U+00338 <td> <span class="glyph compound">∂̸</span> <tr id=entity-npolint><td> <code>npolint;</code> <td> U+02A14 <td> <span class=glyph>⨔</span> <tr id=entity-npr><td> <code>npr;</code> <td> U+02280 <td> <span class=glyph>⊀</span> <tr id=entity-nprcue><td> <code>nprcue;</code> <td> U+022E0 <td> <span class=glyph>⋠</span> <tr id=entity-npre><td> <code>npre;</code> <td> U+02AAF U+00338 <td> <span class="glyph compound">⪯̸</span> <tr id=entity-nprec><td> <code>nprec;</code> <td> U+02280 <td> <span class=glyph>⊀</span> <tr id=entity-npreceq><td> <code>npreceq;</code> <td> U+02AAF U+00338 <td> <span class="glyph compound">⪯̸</span> <tr id=entity-nrArr><td> <code>nrArr;</code> <td> U+021CF <td> <span class=glyph>⇏</span> <tr id=entity-nrarr><td> <code>nrarr;</code> <td> U+0219B <td> <span class=glyph>↛</span> <tr id=entity-nrarrc><td> <code>nrarrc;</code> <td> U+02933 U+00338 <td> <span class="glyph compound">⤳̸</span> <tr id=entity-nrarrw><td> <code>nrarrw;</code> <td> U+0219D U+00338 <td> <span class="glyph compound">↝̸</span> <tr id=entity-nRightarrow><td> <code>nRightarrow;</code> <td> U+021CF <td> <span class=glyph>⇏</span> <tr id=entity-nrightarrow><td> <code>nrightarrow;</code> <td> U+0219B <td> <span class=glyph>↛</span> <tr id=entity-nrtri><td> <code>nrtri;</code> <td> U+022EB <td> <span class=glyph>⋫</span> <tr id=entity-nrtrie><td> <code>nrtrie;</code> <td> U+022ED <td> <span class=glyph>⋭</span> <tr id=entity-nsc><td> <code>nsc;</code> <td> U+02281 <td> <span class=glyph>⊁</span> <tr id=entity-nsccue><td> <code>nsccue;</code> <td> U+022E1 <td> <span class=glyph>⋡</span> <tr id=entity-nsce><td> <code>nsce;</code> <td> U+02AB0 U+00338 <td> <span class="glyph compound">⪰̸</span> <tr id=entity-Nscr><td> <code>Nscr;</code> <td> U+1D4A9 <td> <span class=glyph>𝒩</span> <tr id=entity-nscr><td> <code>nscr;</code> <td> U+1D4C3 <td> <span class=glyph>𝓃</span> <tr id=entity-nshortmid><td> <code>nshortmid;</code> <td> U+02224 <td> <span class=glyph>∤</span> <tr id=entity-nshortparallel><td> <code>nshortparallel;</code> <td> U+02226 <td> <span class=glyph>∦</span> <tr id=entity-nsim><td> <code>nsim;</code> <td> U+02241 <td> <span class=glyph>≁</span> <tr id=entity-nsime><td> <code>nsime;</code> <td> U+02244 <td> <span class=glyph>≄</span> <tr id=entity-nsimeq><td> <code>nsimeq;</code> <td> U+02244 <td> <span class=glyph>≄</span> <tr id=entity-nsmid><td> <code>nsmid;</code> <td> U+02224 <td> <span class=glyph>∤</span> <tr id=entity-nspar><td> <code>nspar;</code> <td> U+02226 <td> <span class=glyph>∦</span> <tr id=entity-nsqsube><td> <code>nsqsube;</code> <td> U+022E2 <td> <span class=glyph>⋢</span> <tr id=entity-nsqsupe><td> <code>nsqsupe;</code> <td> U+022E3 <td> <span class=glyph>⋣</span> <tr id=entity-nsub><td> <code>nsub;</code> <td> U+02284 <td> <span class=glyph>⊄</span> <tr id=entity-nsubE><td> <code>nsubE;</code> <td> U+02AC5 U+00338 <td> <span class="glyph compound">⫅̸</span> <tr id=entity-nsube><td> <code>nsube;</code> <td> U+02288 <td> <span class=glyph>⊈</span> <tr id=entity-nsubset><td> <code>nsubset;</code> <td> U+02282 U+020D2 <td> <span class="glyph compound">⊂⃒</span> <tr id=entity-nsubseteq><td> <code>nsubseteq;</code> <td> U+02288 <td> <span class=glyph>⊈</span> <tr id=entity-nsubseteqq><td> <code>nsubseteqq;</code> <td> U+02AC5 U+00338 <td> <span class="glyph compound">⫅̸</span> <tr id=entity-nsucc><td> <code>nsucc;</code> <td> U+02281 <td> <span class=glyph>⊁</span> <tr id=entity-nsucceq><td> <code>nsucceq;</code> <td> U+02AB0 U+00338 <td> <span class="glyph compound">⪰̸</span> <tr id=entity-nsup><td> <code>nsup;</code> <td> U+02285 <td> <span class=glyph>⊅</span> <tr id=entity-nsupE><td> <code>nsupE;</code> <td> U+02AC6 U+00338 <td> <span class="glyph compound">⫆̸</span> <tr id=entity-nsupe><td> <code>nsupe;</code> <td> U+02289 <td> <span class=glyph>⊉</span> <tr id=entity-nsupset><td> <code>nsupset;</code> <td> U+02283 U+020D2 <td> <span class="glyph compound">⊃⃒</span> <tr id=entity-nsupseteq><td> <code>nsupseteq;</code> <td> U+02289 <td> <span class=glyph>⊉</span> <tr id=entity-nsupseteqq><td> <code>nsupseteqq;</code> <td> U+02AC6 U+00338 <td> <span class="glyph compound">⫆̸</span> <tr id=entity-ntgl><td> <code>ntgl;</code> <td> U+02279 <td> <span class=glyph>≹</span> <tr id=entity-Ntilde><td> <code>Ntilde;</code> <td> U+000D1 <td> <span class=glyph>Ñ</span> <tr id=entity-Ntilde-legacy class=impl><td> <code>Ntilde</code> <td> U+000D1 <td> <span>Ñ</span> <tr id=entity-ntilde><td> <code>ntilde;</code> <td> U+000F1 <td> <span class=glyph>ñ</span> <tr id=entity-ntilde-legacy class=impl><td> <code>ntilde</code> <td> U+000F1 <td> <span>ñ</span> <tr id=entity-ntlg><td> <code>ntlg;</code> <td> U+02278 <td> <span class=glyph>≸</span> <tr id=entity-ntriangleleft><td> <code>ntriangleleft;</code> <td> U+022EA <td> <span class=glyph>⋪</span> <tr id=entity-ntrianglelefteq><td> <code>ntrianglelefteq;</code> <td> U+022EC <td> <span class=glyph>⋬</span> <tr id=entity-ntriangleright><td> <code>ntriangleright;</code> <td> U+022EB <td> <span class=glyph>⋫</span> <tr id=entity-ntrianglerighteq><td> <code>ntrianglerighteq;</code> <td> U+022ED <td> <span class=glyph>⋭</span> <tr id=entity-Nu><td> <code>Nu;</code> <td> U+0039D <td> <span class=glyph>Ν</span> <tr id=entity-nu><td> <code>nu;</code> <td> U+003BD <td> <span class=glyph>ν</span> <tr id=entity-num><td> <code>num;</code> <td> U+00023 <td> <span class=glyph>#</span> <tr id=entity-numero><td> <code>numero;</code> <td> U+02116 <td> <span class=glyph>№</span> <tr id=entity-numsp><td> <code>numsp;</code> <td> U+02007 <td> <span class=glyph> </span> <tr id=entity-nvap><td> <code>nvap;</code> <td> U+0224D U+020D2 <td> <span class="glyph compound">≍⃒</span> <tr id=entity-nVDash><td> <code>nVDash;</code> <td> U+022AF <td> <span class=glyph>⊯</span> <tr id=entity-nVdash><td> <code>nVdash;</code> <td> U+022AE <td> <span class=glyph>⊮</span> <tr id=entity-nvDash><td> <code>nvDash;</code> <td> U+022AD <td> <span class=glyph>⊭</span> <tr id=entity-nvdash><td> <code>nvdash;</code> <td> U+022AC <td> <span class=glyph>⊬</span> <tr id=entity-nvge><td> <code>nvge;</code> <td> U+02265 U+020D2 <td> <span class="glyph compound">≥⃒</span> <tr id=entity-nvgt><td> <code>nvgt;</code> <td> U+0003E U+020D2 <td> <span class="glyph compound">>⃒</span> <tr id=entity-nvHarr><td> <code>nvHarr;</code> <td> U+02904 <td> <span class=glyph>⤄</span> <tr id=entity-nvinfin><td> <code>nvinfin;</code> <td> U+029DE <td> <span class=glyph>⧞</span> <tr id=entity-nvlArr><td> <code>nvlArr;</code> <td> U+02902 <td> <span class=glyph>⤂</span> <tr id=entity-nvle><td> <code>nvle;</code> <td> U+02264 U+020D2 <td> <span class="glyph compound">≤⃒</span> <tr id=entity-nvlt><td> <code>nvlt;</code> <td> U+0003C U+020D2 <td> <span class="glyph compound"><⃒</span> <tr id=entity-nvltrie><td> <code>nvltrie;</code> <td> U+022B4 U+020D2 <td> <span class="glyph compound">⊴⃒</span> <tr id=entity-nvrArr><td> <code>nvrArr;</code> <td> U+02903 <td> <span class=glyph>⤃</span> <tr id=entity-nvrtrie><td> <code>nvrtrie;</code> <td> U+022B5 U+020D2 <td> <span class="glyph compound">⊵⃒</span> <tr id=entity-nvsim><td> <code>nvsim;</code> <td> U+0223C U+020D2 <td> <span class="glyph compound">∼⃒</span> <tr id=entity-nwarhk><td> <code>nwarhk;</code> <td> U+02923 <td> <span class=glyph>⤣</span> <tr id=entity-nwArr><td> <code>nwArr;</code> <td> U+021D6 <td> <span class=glyph>⇖</span> <tr id=entity-nwarr><td> <code>nwarr;</code> <td> U+02196 <td> <span class=glyph>↖</span> <tr id=entity-nwarrow><td> <code>nwarrow;</code> <td> U+02196 <td> <span class=glyph>↖</span> <tr id=entity-nwnear><td> <code>nwnear;</code> <td> U+02927 <td> <span class=glyph>⤧</span> <tr id=entity-Oacute><td> <code>Oacute;</code> <td> U+000D3 <td> <span class=glyph>Ó</span> <tr id=entity-Oacute-legacy class=impl><td> <code>Oacute</code> <td> U+000D3 <td> <span>Ó</span> <tr id=entity-oacute><td> <code>oacute;</code> <td> U+000F3 <td> <span class=glyph>ó</span> <tr id=entity-oacute-legacy class=impl><td> <code>oacute</code> <td> U+000F3 <td> <span>ó</span> <tr id=entity-oast><td> <code>oast;</code> <td> U+0229B <td> <span class=glyph>⊛</span> <tr id=entity-ocir><td> <code>ocir;</code> <td> U+0229A <td> <span class=glyph>⊚</span> <tr id=entity-Ocirc><td> <code>Ocirc;</code> <td> U+000D4 <td> <span class=glyph>Ô</span> <tr id=entity-Ocirc-legacy class=impl><td> <code>Ocirc</code> <td> U+000D4 <td> <span>Ô</span> <tr id=entity-ocirc><td> <code>ocirc;</code> <td> U+000F4 <td> <span class=glyph>ô</span> <tr id=entity-ocirc-legacy class=impl><td> <code>ocirc</code> <td> U+000F4 <td> <span>ô</span> <tr id=entity-Ocy><td> <code>Ocy;</code> <td> U+0041E <td> <span class=glyph>О</span> <tr id=entity-ocy><td> <code>ocy;</code> <td> U+0043E <td> <span class=glyph>о</span> <tr id=entity-odash><td> <code>odash;</code> <td> U+0229D <td> <span class=glyph>⊝</span> <tr id=entity-Odblac><td> <code>Odblac;</code> <td> U+00150 <td> <span class=glyph>Ő</span> <tr id=entity-odblac><td> <code>odblac;</code> <td> U+00151 <td> <span class=glyph>ő</span> <tr id=entity-odiv><td> <code>odiv;</code> <td> U+02A38 <td> <span class=glyph>⨸</span> <tr id=entity-odot><td> <code>odot;</code> <td> U+02299 <td> <span class=glyph>⊙</span> <tr id=entity-odsold><td> <code>odsold;</code> <td> U+029BC <td> <span class=glyph>⦼</span> <tr id=entity-OElig><td> <code>OElig;</code> <td> U+00152 <td> <span class=glyph>Œ</span> <tr id=entity-oelig><td> <code>oelig;</code> <td> U+00153 <td> <span class=glyph>œ</span> <tr id=entity-ofcir><td> <code>ofcir;</code> <td> U+029BF <td> <span class=glyph>⦿</span> <tr id=entity-Ofr><td> <code>Ofr;</code> <td> U+1D512 <td> <span class=glyph>𝔒</span> <tr id=entity-ofr><td> <code>ofr;</code> <td> U+1D52C <td> <span class=glyph>𝔬</span> <tr id=entity-ogon><td> <code>ogon;</code> <td> U+002DB <td> <span class=glyph>˛</span> <tr id=entity-Ograve><td> <code>Ograve;</code> <td> U+000D2 <td> <span class=glyph>Ò</span> <tr id=entity-Ograve-legacy class=impl><td> <code>Ograve</code> <td> U+000D2 <td> <span>Ò</span> <tr id=entity-ograve><td> <code>ograve;</code> <td> U+000F2 <td> <span class=glyph>ò</span> <tr id=entity-ograve-legacy class=impl><td> <code>ograve</code> <td> U+000F2 <td> <span>ò</span> <tr id=entity-ogt><td> <code>ogt;</code> <td> U+029C1 <td> <span class=glyph>⧁</span> <tr id=entity-ohbar><td> <code>ohbar;</code> <td> U+029B5 <td> <span class=glyph>⦵</span> <tr id=entity-ohm><td> <code>ohm;</code> <td> U+003A9 <td> <span class=glyph>Ω</span> <tr id=entity-oint><td> <code>oint;</code> <td> U+0222E <td> <span class=glyph>∮</span> <tr id=entity-olarr><td> <code>olarr;</code> <td> U+021BA <td> <span class=glyph>↺</span> <tr id=entity-olcir><td> <code>olcir;</code> <td> U+029BE <td> <span class=glyph>⦾</span> <tr id=entity-olcross><td> <code>olcross;</code> <td> U+029BB <td> <span class=glyph>⦻</span> <tr id=entity-oline><td> <code>oline;</code> <td> U+0203E <td> <span class=glyph>‾</span> <tr id=entity-olt><td> <code>olt;</code> <td> U+029C0 <td> <span class=glyph>⧀</span> <tr id=entity-Omacr><td> <code>Omacr;</code> <td> U+0014C <td> <span class=glyph>Ō</span> <tr id=entity-omacr><td> <code>omacr;</code> <td> U+0014D <td> <span class=glyph>ō</span> <tr id=entity-Omega><td> <code>Omega;</code> <td> U+003A9 <td> <span class=glyph>Ω</span> <tr id=entity-omega><td> <code>omega;</code> <td> U+003C9 <td> <span class=glyph>ω</span> <tr id=entity-Omicron><td> <code>Omicron;</code> <td> U+0039F <td> <span class=glyph>Ο</span> <tr id=entity-omicron><td> <code>omicron;</code> <td> U+003BF <td> <span class=glyph>ο</span> <tr id=entity-omid><td> <code>omid;</code> <td> U+029B6 <td> <span class=glyph>⦶</span> <tr id=entity-ominus><td> <code>ominus;</code> <td> U+02296 <td> <span class=glyph>⊖</span> <tr id=entity-Oopf><td> <code>Oopf;</code> <td> U+1D546 <td> <span class=glyph>𝕆</span> <tr id=entity-oopf><td> <code>oopf;</code> <td> U+1D560 <td> <span class=glyph>𝕠</span> <tr id=entity-opar><td> <code>opar;</code> <td> U+029B7 <td> <span class=glyph>⦷</span> <tr id=entity-OpenCurlyDoubleQuote><td> <code>OpenCurlyDoubleQuote;</code> <td> U+0201C <td> <span class=glyph>“</span> <tr id=entity-OpenCurlyQuote><td> <code>OpenCurlyQuote;</code> <td> U+02018 <td> <span class=glyph>‘</span> <tr id=entity-operp><td> <code>operp;</code> <td> U+029B9 <td> <span class=glyph>⦹</span> <tr id=entity-oplus><td> <code>oplus;</code> <td> U+02295 <td> <span class=glyph>⊕</span> <tr id=entity-Or><td> <code>Or;</code> <td> U+02A54 <td> <span class=glyph>⩔</span> <tr id=entity-or><td> <code>or;</code> <td> U+02228 <td> <span class=glyph>∨</span> <tr id=entity-orarr><td> <code>orarr;</code> <td> U+021BB <td> <span class=glyph>↻</span> <tr id=entity-ord><td> <code>ord;</code> <td> U+02A5D <td> <span class=glyph>⩝</span> <tr id=entity-order><td> <code>order;</code> <td> U+02134 <td> <span class=glyph>ℴ</span> <tr id=entity-orderof><td> <code>orderof;</code> <td> U+02134 <td> <span class=glyph>ℴ</span> <tr id=entity-ordf><td> <code>ordf;</code> <td> U+000AA <td> <span class=glyph>ª</span> <tr id=entity-ordf-legacy class=impl><td> <code>ordf</code> <td> U+000AA <td> <span>ª</span> <tr id=entity-ordm><td> <code>ordm;</code> <td> U+000BA <td> <span class=glyph>º</span> <tr id=entity-ordm-legacy class=impl><td> <code>ordm</code> <td> U+000BA <td> <span>º</span> <tr id=entity-origof><td> <code>origof;</code> <td> U+022B6 <td> <span class=glyph>⊶</span> <tr id=entity-oror><td> <code>oror;</code> <td> U+02A56 <td> <span class=glyph>⩖</span> <tr id=entity-orslope><td> <code>orslope;</code> <td> U+02A57 <td> <span class=glyph>⩗</span> <tr id=entity-orv><td> <code>orv;</code> <td> U+02A5B <td> <span class=glyph>⩛</span> <tr id=entity-oS><td> <code>oS;</code> <td> U+024C8 <td> <span class=glyph>Ⓢ</span> <tr id=entity-Oscr><td> <code>Oscr;</code> <td> U+1D4AA <td> <span class=glyph>𝒪</span> <tr id=entity-oscr><td> <code>oscr;</code> <td> U+02134 <td> <span class=glyph>ℴ</span> <tr id=entity-Oslash><td> <code>Oslash;</code> <td> U+000D8 <td> <span class=glyph>Ø</span> <tr id=entity-Oslash-legacy class=impl><td> <code>Oslash</code> <td> U+000D8 <td> <span>Ø</span> <tr id=entity-oslash><td> <code>oslash;</code> <td> U+000F8 <td> <span class=glyph>ø</span> <tr id=entity-oslash-legacy class=impl><td> <code>oslash</code> <td> U+000F8 <td> <span>ø</span> <tr id=entity-osol><td> <code>osol;</code> <td> U+02298 <td> <span class=glyph>⊘</span> <tr id=entity-Otilde><td> <code>Otilde;</code> <td> U+000D5 <td> <span class=glyph>Õ</span> <tr id=entity-Otilde-legacy class=impl><td> <code>Otilde</code> <td> U+000D5 <td> <span>Õ</span> <tr id=entity-otilde><td> <code>otilde;</code> <td> U+000F5 <td> <span class=glyph>õ</span> <tr id=entity-otilde-legacy class=impl><td> <code>otilde</code> <td> U+000F5 <td> <span>õ</span> <tr id=entity-Otimes><td> <code>Otimes;</code> <td> U+02A37 <td> <span class=glyph>⨷</span> <tr id=entity-otimes><td> <code>otimes;</code> <td> U+02297 <td> <span class=glyph>⊗</span> <tr id=entity-otimesas><td> <code>otimesas;</code> <td> U+02A36 <td> <span class=glyph>⨶</span> <tr id=entity-Ouml><td> <code>Ouml;</code> <td> U+000D6 <td> <span class=glyph>Ö</span> <tr id=entity-Ouml-legacy class=impl><td> <code>Ouml</code> <td> U+000D6 <td> <span>Ö</span> <tr id=entity-ouml><td> <code>ouml;</code> <td> U+000F6 <td> <span class=glyph>ö</span> <tr id=entity-ouml-legacy class=impl><td> <code>ouml</code> <td> U+000F6 <td> <span>ö</span> <tr id=entity-ovbar><td> <code>ovbar;</code> <td> U+0233D <td> <span class=glyph>⌽</span> <tr id=entity-OverBar><td> <code>OverBar;</code> <td> U+0203E <td> <span class=glyph>‾</span> <tr id=entity-OverBrace><td> <code>OverBrace;</code> <td> U+023DE <td> <span class=glyph>⏞</span> <tr id=entity-OverBracket><td> <code>OverBracket;</code> <td> U+023B4 <td> <span class=glyph>⎴</span> <tr id=entity-OverParenthesis><td> <code>OverParenthesis;</code> <td> U+023DC <td> <span class=glyph>⏜</span> <tr id=entity-par><td> <code>par;</code> <td> U+02225 <td> <span class=glyph>∥</span> <tr id=entity-para><td> <code>para;</code> <td> U+000B6 <td> <span class=glyph>¶</span> <tr id=entity-para-legacy class=impl><td> <code>para</code> <td> U+000B6 <td> <span>¶</span> <tr id=entity-parallel><td> <code>parallel;</code> <td> U+02225 <td> <span class=glyph>∥</span> <tr id=entity-parsim><td> <code>parsim;</code> <td> U+02AF3 <td> <span class=glyph>⫳</span> <tr id=entity-parsl><td> <code>parsl;</code> <td> U+02AFD <td> <span class=glyph>⫽</span> <tr id=entity-part><td> <code>part;</code> <td> U+02202 <td> <span class=glyph>∂</span> <tr id=entity-PartialD><td> <code>PartialD;</code> <td> U+02202 <td> <span class=glyph>∂</span> <tr id=entity-Pcy><td> <code>Pcy;</code> <td> U+0041F <td> <span class=glyph>П</span> <tr id=entity-pcy><td> <code>pcy;</code> <td> U+0043F <td> <span class=glyph>п</span> <tr id=entity-percnt><td> <code>percnt;</code> <td> U+00025 <td> <span class=glyph>%</span> <tr id=entity-period><td> <code>period;</code> <td> U+0002E <td> <span class=glyph>.</span> <tr id=entity-permil><td> <code>permil;</code> <td> U+02030 <td> <span class=glyph>‰</span> <tr id=entity-perp><td> <code>perp;</code> <td> U+022A5 <td> <span class=glyph>⊥</span> <tr id=entity-pertenk><td> <code>pertenk;</code> <td> U+02031 <td> <span class=glyph>‱</span> <tr id=entity-Pfr><td> <code>Pfr;</code> <td> U+1D513 <td> <span class=glyph>𝔓</span> <tr id=entity-pfr><td> <code>pfr;</code> <td> U+1D52D <td> <span class=glyph>𝔭</span> <tr id=entity-Phi><td> <code>Phi;</code> <td> U+003A6 <td> <span class=glyph>Φ</span> <tr id=entity-phi><td> <code>phi;</code> <td> U+003C6 <td> <span class=glyph>φ</span> <tr id=entity-phiv><td> <code>phiv;</code> <td> U+003D5 <td> <span class=glyph>ϕ</span> <tr id=entity-phmmat><td> <code>phmmat;</code> <td> U+02133 <td> <span class=glyph>ℳ</span> <tr id=entity-phone><td> <code>phone;</code> <td> U+0260E <td> <span class=glyph>☎</span> <tr id=entity-Pi><td> <code>Pi;</code> <td> U+003A0 <td> <span class=glyph>Π</span> <tr id=entity-pi><td> <code>pi;</code> <td> U+003C0 <td> <span class=glyph>π</span> <tr id=entity-pitchfork><td> <code>pitchfork;</code> <td> U+022D4 <td> <span class=glyph>⋔</span> <tr id=entity-piv><td> <code>piv;</code> <td> U+003D6 <td> <span class=glyph>ϖ</span> <tr id=entity-planck><td> <code>planck;</code> <td> U+0210F <td> <span class=glyph>ℏ</span> <tr id=entity-planckh><td> <code>planckh;</code> <td> U+0210E <td> <span class=glyph>ℎ</span> <tr id=entity-plankv><td> <code>plankv;</code> <td> U+0210F <td> <span class=glyph>ℏ</span> <tr id=entity-plus><td> <code>plus;</code> <td> U+0002B <td> <span class=glyph>+</span> <tr id=entity-plusacir><td> <code>plusacir;</code> <td> U+02A23 <td> <span class=glyph>⨣</span> <tr id=entity-plusb><td> <code>plusb;</code> <td> U+0229E <td> <span class=glyph>⊞</span> <tr id=entity-pluscir><td> <code>pluscir;</code> <td> U+02A22 <td> <span class=glyph>⨢</span> <tr id=entity-plusdo><td> <code>plusdo;</code> <td> U+02214 <td> <span class=glyph>∔</span> <tr id=entity-plusdu><td> <code>plusdu;</code> <td> U+02A25 <td> <span class=glyph>⨥</span> <tr id=entity-pluse><td> <code>pluse;</code> <td> U+02A72 <td> <span class=glyph>⩲</span> <tr id=entity-PlusMinus><td> <code>PlusMinus;</code> <td> U+000B1 <td> <span class=glyph>±</span> <tr id=entity-plusmn><td> <code>plusmn;</code> <td> U+000B1 <td> <span class=glyph>±</span> <tr id=entity-plusmn-legacy class=impl><td> <code>plusmn</code> <td> U+000B1 <td> <span>±</span> <tr id=entity-plussim><td> <code>plussim;</code> <td> U+02A26 <td> <span class=glyph>⨦</span> <tr id=entity-plustwo><td> <code>plustwo;</code> <td> U+02A27 <td> <span class=glyph>⨧</span> <tr id=entity-pm><td> <code>pm;</code> <td> U+000B1 <td> <span class=glyph>±</span> <tr id=entity-Poincareplane><td> <code>Poincareplane;</code> <td> U+0210C <td> <span class=glyph>ℌ</span> <tr id=entity-pointint><td> <code>pointint;</code> <td> U+02A15 <td> <span class=glyph>⨕</span> <tr id=entity-Popf><td> <code>Popf;</code> <td> U+02119 <td> <span class=glyph>ℙ</span> <tr id=entity-popf><td> <code>popf;</code> <td> U+1D561 <td> <span class=glyph>𝕡</span> <tr id=entity-pound><td> <code>pound;</code> <td> U+000A3 <td> <span class=glyph>£</span> <tr id=entity-pound-legacy class=impl><td> <code>pound</code> <td> U+000A3 <td> <span>£</span> <tr id=entity-Pr><td> <code>Pr;</code> <td> U+02ABB <td> <span class=glyph>⪻</span> <tr id=entity-pr><td> <code>pr;</code> <td> U+0227A <td> <span class=glyph>≺</span> <tr id=entity-prap><td> <code>prap;</code> <td> U+02AB7 <td> <span class=glyph>⪷</span> <tr id=entity-prcue><td> <code>prcue;</code> <td> U+0227C <td> <span class=glyph>≼</span> <tr id=entity-prE><td> <code>prE;</code> <td> U+02AB3 <td> <span class=glyph>⪳</span> <tr id=entity-pre><td> <code>pre;</code> <td> U+02AAF <td> <span class=glyph>⪯</span> <tr id=entity-prec><td> <code>prec;</code> <td> U+0227A <td> <span class=glyph>≺</span> <tr id=entity-precapprox><td> <code>precapprox;</code> <td> U+02AB7 <td> <span class=glyph>⪷</span> <tr id=entity-preccurlyeq><td> <code>preccurlyeq;</code> <td> U+0227C <td> <span class=glyph>≼</span> <tr id=entity-Precedes><td> <code>Precedes;</code> <td> U+0227A <td> <span class=glyph>≺</span> <tr id=entity-PrecedesEqual><td> <code>PrecedesEqual;</code> <td> U+02AAF <td> <span class=glyph>⪯</span> <tr id=entity-PrecedesSlantEqual><td> <code>PrecedesSlantEqual;</code> <td> U+0227C <td> <span class=glyph>≼</span> <tr id=entity-PrecedesTilde><td> <code>PrecedesTilde;</code> <td> U+0227E <td> <span class=glyph>≾</span> <tr id=entity-preceq><td> <code>preceq;</code> <td> U+02AAF <td> <span class=glyph>⪯</span> <tr id=entity-precnapprox><td> <code>precnapprox;</code> <td> U+02AB9 <td> <span class=glyph>⪹</span> <tr id=entity-precneqq><td> <code>precneqq;</code> <td> U+02AB5 <td> <span class=glyph>⪵</span> <tr id=entity-precnsim><td> <code>precnsim;</code> <td> U+022E8 <td> <span class=glyph>⋨</span> <tr id=entity-precsim><td> <code>precsim;</code> <td> U+0227E <td> <span class=glyph>≾</span> <tr id=entity-Prime><td> <code>Prime;</code> <td> U+02033 <td> <span class=glyph>″</span> <tr id=entity-prime><td> <code>prime;</code> <td> U+02032 <td> <span class=glyph>′</span> <tr id=entity-primes><td> <code>primes;</code> <td> U+02119 <td> <span class=glyph>ℙ</span> <tr id=entity-prnap><td> <code>prnap;</code> <td> U+02AB9 <td> <span class=glyph>⪹</span> <tr id=entity-prnE><td> <code>prnE;</code> <td> U+02AB5 <td> <span class=glyph>⪵</span> <tr id=entity-prnsim><td> <code>prnsim;</code> <td> U+022E8 <td> <span class=glyph>⋨</span> <tr id=entity-prod><td> <code>prod;</code> <td> U+0220F <td> <span class=glyph>∏</span> <tr id=entity-Product><td> <code>Product;</code> <td> U+0220F <td> <span class=glyph>∏</span> <tr id=entity-profalar><td> <code>profalar;</code> <td> U+0232E <td> <span class=glyph>⌮</span> <tr id=entity-profline><td> <code>profline;</code> <td> U+02312 <td> <span class=glyph>⌒</span> <tr id=entity-profsurf><td> <code>profsurf;</code> <td> U+02313 <td> <span class=glyph>⌓</span> <tr id=entity-prop><td> <code>prop;</code> <td> U+0221D <td> <span class=glyph>∝</span> <tr id=entity-Proportion><td> <code>Proportion;</code> <td> U+02237 <td> <span class=glyph>∷</span> <tr id=entity-Proportional><td> <code>Proportional;</code> <td> U+0221D <td> <span class=glyph>∝</span> <tr id=entity-propto><td> <code>propto;</code> <td> U+0221D <td> <span class=glyph>∝</span> <tr id=entity-prsim><td> <code>prsim;</code> <td> U+0227E <td> <span class=glyph>≾</span> <tr id=entity-prurel><td> <code>prurel;</code> <td> U+022B0 <td> <span class=glyph>⊰</span> <tr id=entity-Pscr><td> <code>Pscr;</code> <td> U+1D4AB <td> <span class=glyph>𝒫</span> <tr id=entity-pscr><td> <code>pscr;</code> <td> U+1D4C5 <td> <span class=glyph>𝓅</span> <tr id=entity-Psi><td> <code>Psi;</code> <td> U+003A8 <td> <span class=glyph>Ψ</span> <tr id=entity-psi><td> <code>psi;</code> <td> U+003C8 <td> <span class=glyph>ψ</span> <tr id=entity-puncsp><td> <code>puncsp;</code> <td> U+02008 <td> <span class=glyph> </span> <tr id=entity-Qfr><td> <code>Qfr;</code> <td> U+1D514 <td> <span class=glyph>𝔔</span> <tr id=entity-qfr><td> <code>qfr;</code> <td> U+1D52E <td> <span class=glyph>𝔮</span> <tr id=entity-qint><td> <code>qint;</code> <td> U+02A0C <td> <span class=glyph>⨌</span> <tr id=entity-Qopf><td> <code>Qopf;</code> <td> U+0211A <td> <span class=glyph>ℚ</span> <tr id=entity-qopf><td> <code>qopf;</code> <td> U+1D562 <td> <span class=glyph>𝕢</span> <tr id=entity-qprime><td> <code>qprime;</code> <td> U+02057 <td> <span class=glyph>⁗</span> <tr id=entity-Qscr><td> <code>Qscr;</code> <td> U+1D4AC <td> <span class=glyph>𝒬</span> <tr id=entity-qscr><td> <code>qscr;</code> <td> U+1D4C6 <td> <span class=glyph>𝓆</span> <tr id=entity-quaternions><td> <code>quaternions;</code> <td> U+0210D <td> <span class=glyph>ℍ</span> <tr id=entity-quatint><td> <code>quatint;</code> <td> U+02A16 <td> <span class=glyph>⨖</span> <tr id=entity-quest><td> <code>quest;</code> <td> U+0003F <td> <span class=glyph>?</span> <tr id=entity-questeq><td> <code>questeq;</code> <td> U+0225F <td> <span class=glyph>≟</span> <tr id=entity-QUOT><td> <code>QUOT;</code> <td> U+00022 <td> <span class=glyph>"</span> <tr id=entity-QUOT-legacy class=impl><td> <code>QUOT</code> <td> U+00022 <td> <span>"</span> <tr id=entity-quot><td> <code>quot;</code> <td> U+00022 <td> <span class=glyph>"</span> <tr id=entity-quot-legacy class=impl><td> <code>quot</code> <td> U+00022 <td> <span>"</span> <tr id=entity-rAarr><td> <code>rAarr;</code> <td> U+021DB <td> <span class=glyph>⇛</span> <tr id=entity-race><td> <code>race;</code> <td> U+0223D U+00331 <td> <span class="glyph compound">∽̱</span> <tr id=entity-Racute><td> <code>Racute;</code> <td> U+00154 <td> <span class=glyph>Ŕ</span> <tr id=entity-racute><td> <code>racute;</code> <td> U+00155 <td> <span class=glyph>ŕ</span> <tr id=entity-radic><td> <code>radic;</code> <td> U+0221A <td> <span class=glyph>√</span> <tr id=entity-raemptyv><td> <code>raemptyv;</code> <td> U+029B3 <td> <span class=glyph>⦳</span> <tr id=entity-Rang><td> <code>Rang;</code> <td> U+027EB <td> <span class=glyph>⟫</span> <tr id=entity-rang><td> <code>rang;</code> <td> U+027E9 <td> <span class=glyph>⟩</span> <tr id=entity-rangd><td> <code>rangd;</code> <td> U+02992 <td> <span class=glyph>⦒</span> <tr id=entity-range><td> <code>range;</code> <td> U+029A5 <td> <span class=glyph>⦥</span> <tr id=entity-rangle><td> <code>rangle;</code> <td> U+027E9 <td> <span class=glyph>⟩</span> <tr id=entity-raquo><td> <code>raquo;</code> <td> U+000BB <td> <span class=glyph>»</span> <tr id=entity-raquo-legacy class=impl><td> <code>raquo</code> <td> U+000BB <td> <span>»</span> <tr id=entity-Rarr><td> <code>Rarr;</code> <td> U+021A0 <td> <span class=glyph>↠</span> <tr id=entity-rArr><td> <code>rArr;</code> <td> U+021D2 <td> <span class=glyph>⇒</span> <tr id=entity-rarr><td> <code>rarr;</code> <td> U+02192 <td> <span class=glyph>→</span> <tr id=entity-rarrap><td> <code>rarrap;</code> <td> U+02975 <td> <span class=glyph>⥵</span> <tr id=entity-rarrb><td> <code>rarrb;</code> <td> U+021E5 <td> <span class=glyph>⇥</span> <tr id=entity-rarrbfs><td> <code>rarrbfs;</code> <td> U+02920 <td> <span class=glyph>⤠</span> <tr id=entity-rarrc><td> <code>rarrc;</code> <td> U+02933 <td> <span class=glyph>⤳</span> <tr id=entity-rarrfs><td> <code>rarrfs;</code> <td> U+0291E <td> <span class=glyph>⤞</span> <tr id=entity-rarrhk><td> <code>rarrhk;</code> <td> U+021AA <td> <span class=glyph>↪</span> <tr id=entity-rarrlp><td> <code>rarrlp;</code> <td> U+021AC <td> <span class=glyph>↬</span> <tr id=entity-rarrpl><td> <code>rarrpl;</code> <td> U+02945 <td> <span class=glyph>⥅</span> <tr id=entity-rarrsim><td> <code>rarrsim;</code> <td> U+02974 <td> <span class=glyph>⥴</span> <tr id=entity-Rarrtl><td> <code>Rarrtl;</code> <td> U+02916 <td> <span class=glyph>⤖</span> <tr id=entity-rarrtl><td> <code>rarrtl;</code> <td> U+021A3 <td> <span class=glyph>↣</span> <tr id=entity-rarrw><td> <code>rarrw;</code> <td> U+0219D <td> <span class=glyph>↝</span> <tr id=entity-rAtail><td> <code>rAtail;</code> <td> U+0291C <td> <span class=glyph>⤜</span> <tr id=entity-ratail><td> <code>ratail;</code> <td> U+0291A <td> <span class=glyph>⤚</span> <tr id=entity-ratio><td> <code>ratio;</code> <td> U+02236 <td> <span class=glyph>∶</span> <tr id=entity-rationals><td> <code>rationals;</code> <td> U+0211A <td> <span class=glyph>ℚ</span> <tr id=entity-RBarr><td> <code>RBarr;</code> <td> U+02910 <td> <span class=glyph>⤐</span> <tr id=entity-rBarr><td> <code>rBarr;</code> <td> U+0290F <td> <span class=glyph>⤏</span> <tr id=entity-rbarr><td> <code>rbarr;</code> <td> U+0290D <td> <span class=glyph>⤍</span> <tr id=entity-rbbrk><td> <code>rbbrk;</code> <td> U+02773 <td> <span class=glyph>❳</span> <tr id=entity-rbrace><td> <code>rbrace;</code> <td> U+0007D <td> <span class=glyph>}</span> <tr id=entity-rbrack><td> <code>rbrack;</code> <td> U+0005D <td> <span class=glyph>]</span> <tr id=entity-rbrke><td> <code>rbrke;</code> <td> U+0298C <td> <span class=glyph>⦌</span> <tr id=entity-rbrksld><td> <code>rbrksld;</code> <td> U+0298E <td> <span class=glyph>⦎</span> <tr id=entity-rbrkslu><td> <code>rbrkslu;</code> <td> U+02990 <td> <span class=glyph>⦐</span> <tr id=entity-Rcaron><td> <code>Rcaron;</code> <td> U+00158 <td> <span class=glyph>Ř</span> <tr id=entity-rcaron><td> <code>rcaron;</code> <td> U+00159 <td> <span class=glyph>ř</span> <tr id=entity-Rcedil><td> <code>Rcedil;</code> <td> U+00156 <td> <span class=glyph>Ŗ</span> <tr id=entity-rcedil><td> <code>rcedil;</code> <td> U+00157 <td> <span class=glyph>ŗ</span> <tr id=entity-rceil><td> <code>rceil;</code> <td> U+02309 <td> <span class=glyph>⌉</span> <tr id=entity-rcub><td> <code>rcub;</code> <td> U+0007D <td> <span class=glyph>}</span> <tr id=entity-Rcy><td> <code>Rcy;</code> <td> U+00420 <td> <span class=glyph>Р</span> <tr id=entity-rcy><td> <code>rcy;</code> <td> U+00440 <td> <span class=glyph>р</span> <tr id=entity-rdca><td> <code>rdca;</code> <td> U+02937 <td> <span class=glyph>⤷</span> <tr id=entity-rdldhar><td> <code>rdldhar;</code> <td> U+02969 <td> <span class=glyph>⥩</span> <tr id=entity-rdquo><td> <code>rdquo;</code> <td> U+0201D <td> <span class=glyph>”</span> <tr id=entity-rdquor><td> <code>rdquor;</code> <td> U+0201D <td> <span class=glyph>”</span> <tr id=entity-rdsh><td> <code>rdsh;</code> <td> U+021B3 <td> <span class=glyph>↳</span> <tr id=entity-Re><td> <code>Re;</code> <td> U+0211C <td> <span class=glyph>ℜ</span> <tr id=entity-real><td> <code>real;</code> <td> U+0211C <td> <span class=glyph>ℜ</span> <tr id=entity-realine><td> <code>realine;</code> <td> U+0211B <td> <span class=glyph>ℛ</span> <tr id=entity-realpart><td> <code>realpart;</code> <td> U+0211C <td> <span class=glyph>ℜ</span> <tr id=entity-reals><td> <code>reals;</code> <td> U+0211D <td> <span class=glyph>ℝ</span> <tr id=entity-rect><td> <code>rect;</code> <td> U+025AD <td> <span class=glyph>▭</span> <tr id=entity-REG><td> <code>REG;</code> <td> U+000AE <td> <span class=glyph>®</span> <tr id=entity-REG-legacy class=impl><td> <code>REG</code> <td> U+000AE <td> <span>®</span> <tr id=entity-reg><td> <code>reg;</code> <td> U+000AE <td> <span class=glyph>®</span> <tr id=entity-reg-legacy class=impl><td> <code>reg</code> <td> U+000AE <td> <span>®</span> <tr id=entity-ReverseElement><td> <code>ReverseElement;</code> <td> U+0220B <td> <span class=glyph>∋</span> <tr id=entity-ReverseEquilibrium><td> <code>ReverseEquilibrium;</code> <td> U+021CB <td> <span class=glyph>⇋</span> <tr id=entity-ReverseUpEquilibrium><td> <code>ReverseUpEquilibrium;</code> <td> U+0296F <td> <span class=glyph>⥯</span> <tr id=entity-rfisht><td> <code>rfisht;</code> <td> U+0297D <td> <span class=glyph>⥽</span> <tr id=entity-rfloor><td> <code>rfloor;</code> <td> U+0230B <td> <span class=glyph>⌋</span> <tr id=entity-Rfr><td> <code>Rfr;</code> <td> U+0211C <td> <span class=glyph>ℜ</span> <tr id=entity-rfr><td> <code>rfr;</code> <td> U+1D52F <td> <span class=glyph>𝔯</span> <tr id=entity-rHar><td> <code>rHar;</code> <td> U+02964 <td> <span class=glyph>⥤</span> <tr id=entity-rhard><td> <code>rhard;</code> <td> U+021C1 <td> <span class=glyph>⇁</span> <tr id=entity-rharu><td> <code>rharu;</code> <td> U+021C0 <td> <span class=glyph>⇀</span> <tr id=entity-rharul><td> <code>rharul;</code> <td> U+0296C <td> <span class=glyph>⥬</span> <tr id=entity-Rho><td> <code>Rho;</code> <td> U+003A1 <td> <span class=glyph>Ρ</span> <tr id=entity-rho><td> <code>rho;</code> <td> U+003C1 <td> <span class=glyph>ρ</span> <tr id=entity-rhov><td> <code>rhov;</code> <td> U+003F1 <td> <span class=glyph>ϱ</span> <tr id=entity-RightAngleBracket><td> <code>RightAngleBracket;</code> <td> U+027E9 <td> <span class=glyph>⟩</span> <tr id=entity-RightArrow><td> <code>RightArrow;</code> <td> U+02192 <td> <span class=glyph>→</span> <tr id=entity-Rightarrow><td> <code>Rightarrow;</code> <td> U+021D2 <td> <span class=glyph>⇒</span> <tr id=entity-rightarrow><td> <code>rightarrow;</code> <td> U+02192 <td> <span class=glyph>→</span> <tr id=entity-RightArrowBar><td> <code>RightArrowBar;</code> <td> U+021E5 <td> <span class=glyph>⇥</span> <tr id=entity-RightArrowLeftArrow><td> <code>RightArrowLeftArrow;</code> <td> U+021C4 <td> <span class=glyph>⇄</span> <tr id=entity-rightarrowtail><td> <code>rightarrowtail;</code> <td> U+021A3 <td> <span class=glyph>↣</span> <tr id=entity-RightCeiling><td> <code>RightCeiling;</code> <td> U+02309 <td> <span class=glyph>⌉</span> <tr id=entity-RightDoubleBracket><td> <code>RightDoubleBracket;</code> <td> U+027E7 <td> <span class=glyph>⟧</span> <tr id=entity-RightDownTeeVector><td> <code>RightDownTeeVector;</code> <td> U+0295D <td> <span class=glyph>⥝</span> <tr id=entity-RightDownVector><td> <code>RightDownVector;</code> <td> U+021C2 <td> <span class=glyph>⇂</span> <tr id=entity-RightDownVectorBar><td> <code>RightDownVectorBar;</code> <td> U+02955 <td> <span class=glyph>⥕</span> <tr id=entity-RightFloor><td> <code>RightFloor;</code> <td> U+0230B <td> <span class=glyph>⌋</span> <tr id=entity-rightharpoondown><td> <code>rightharpoondown;</code> <td> U+021C1 <td> <span class=glyph>⇁</span> <tr id=entity-rightharpoonup><td> <code>rightharpoonup;</code> <td> U+021C0 <td> <span class=glyph>⇀</span> <tr id=entity-rightleftarrows><td> <code>rightleftarrows;</code> <td> U+021C4 <td> <span class=glyph>⇄</span> <tr id=entity-rightleftharpoons><td> <code>rightleftharpoons;</code> <td> U+021CC <td> <span class=glyph>⇌</span> <tr id=entity-rightrightarrows><td> <code>rightrightarrows;</code> <td> U+021C9 <td> <span class=glyph>⇉</span> <tr id=entity-rightsquigarrow><td> <code>rightsquigarrow;</code> <td> U+0219D <td> <span class=glyph>↝</span> <tr id=entity-RightTee><td> <code>RightTee;</code> <td> U+022A2 <td> <span class=glyph>⊢</span> <tr id=entity-RightTeeArrow><td> <code>RightTeeArrow;</code> <td> U+021A6 <td> <span class=glyph>↦</span> <tr id=entity-RightTeeVector><td> <code>RightTeeVector;</code> <td> U+0295B <td> <span class=glyph>⥛</span> <tr id=entity-rightthreetimes><td> <code>rightthreetimes;</code> <td> U+022CC <td> <span class=glyph>⋌</span> <tr id=entity-RightTriangle><td> <code>RightTriangle;</code> <td> U+022B3 <td> <span class=glyph>⊳</span> <tr id=entity-RightTriangleBar><td> <code>RightTriangleBar;</code> <td> U+029D0 <td> <span class=glyph>⧐</span> <tr id=entity-RightTriangleEqual><td> <code>RightTriangleEqual;</code> <td> U+022B5 <td> <span class=glyph>⊵</span> <tr id=entity-RightUpDownVector><td> <code>RightUpDownVector;</code> <td> U+0294F <td> <span class=glyph>⥏</span> <tr id=entity-RightUpTeeVector><td> <code>RightUpTeeVector;</code> <td> U+0295C <td> <span class=glyph>⥜</span> <tr id=entity-RightUpVector><td> <code>RightUpVector;</code> <td> U+021BE <td> <span class=glyph>↾</span> <tr id=entity-RightUpVectorBar><td> <code>RightUpVectorBar;</code> <td> U+02954 <td> <span class=glyph>⥔</span> <tr id=entity-RightVector><td> <code>RightVector;</code> <td> U+021C0 <td> <span class=glyph>⇀</span> <tr id=entity-RightVectorBar><td> <code>RightVectorBar;</code> <td> U+02953 <td> <span class=glyph>⥓</span> <tr id=entity-ring><td> <code>ring;</code> <td> U+002DA <td> <span class=glyph>˚</span> <tr id=entity-risingdotseq><td> <code>risingdotseq;</code> <td> U+02253 <td> <span class=glyph>≓</span> <tr id=entity-rlarr><td> <code>rlarr;</code> <td> U+021C4 <td> <span class=glyph>⇄</span> <tr id=entity-rlhar><td> <code>rlhar;</code> <td> U+021CC <td> <span class=glyph>⇌</span> <tr id=entity-rlm><td> <code>rlm;</code> <td> U+0200F <td> <span class=glyph></span> <tr id=entity-rmoust><td> <code>rmoust;</code> <td> U+023B1 <td> <span class=glyph>⎱</span> <tr id=entity-rmoustache><td> <code>rmoustache;</code> <td> U+023B1 <td> <span class=glyph>⎱</span> <tr id=entity-rnmid><td> <code>rnmid;</code> <td> U+02AEE <td> <span class=glyph>⫮</span> <tr id=entity-roang><td> <code>roang;</code> <td> U+027ED <td> <span class=glyph>⟭</span> <tr id=entity-roarr><td> <code>roarr;</code> <td> U+021FE <td> <span class=glyph>⇾</span> <tr id=entity-robrk><td> <code>robrk;</code> <td> U+027E7 <td> <span class=glyph>⟧</span> <tr id=entity-ropar><td> <code>ropar;</code> <td> U+02986 <td> <span class=glyph>⦆</span> <tr id=entity-Ropf><td> <code>Ropf;</code> <td> U+0211D <td> <span class=glyph>ℝ</span> <tr id=entity-ropf><td> <code>ropf;</code> <td> U+1D563 <td> <span class=glyph>𝕣</span> <tr id=entity-roplus><td> <code>roplus;</code> <td> U+02A2E <td> <span class=glyph>⨮</span> <tr id=entity-rotimes><td> <code>rotimes;</code> <td> U+02A35 <td> <span class=glyph>⨵</span> <tr id=entity-RoundImplies><td> <code>RoundImplies;</code> <td> U+02970 <td> <span class=glyph>⥰</span> <tr id=entity-rpar><td> <code>rpar;</code> <td> U+00029 <td> <span class=glyph>)</span> <tr id=entity-rpargt><td> <code>rpargt;</code> <td> U+02994 <td> <span class=glyph>⦔</span> <tr id=entity-rppolint><td> <code>rppolint;</code> <td> U+02A12 <td> <span class=glyph>⨒</span> <tr id=entity-rrarr><td> <code>rrarr;</code> <td> U+021C9 <td> <span class=glyph>⇉</span> <tr id=entity-Rrightarrow><td> <code>Rrightarrow;</code> <td> U+021DB <td> <span class=glyph>⇛</span> <tr id=entity-rsaquo><td> <code>rsaquo;</code> <td> U+0203A <td> <span class=glyph>›</span> <tr id=entity-Rscr><td> <code>Rscr;</code> <td> U+0211B <td> <span class=glyph>ℛ</span> <tr id=entity-rscr><td> <code>rscr;</code> <td> U+1D4C7 <td> <span class=glyph>𝓇</span> <tr id=entity-Rsh><td> <code>Rsh;</code> <td> U+021B1 <td> <span class=glyph>↱</span> <tr id=entity-rsh><td> <code>rsh;</code> <td> U+021B1 <td> <span class=glyph>↱</span> <tr id=entity-rsqb><td> <code>rsqb;</code> <td> U+0005D <td> <span class=glyph>]</span> <tr id=entity-rsquo><td> <code>rsquo;</code> <td> U+02019 <td> <span class=glyph>’</span> <tr id=entity-rsquor><td> <code>rsquor;</code> <td> U+02019 <td> <span class=glyph>’</span> <tr id=entity-rthree><td> <code>rthree;</code> <td> U+022CC <td> <span class=glyph>⋌</span> <tr id=entity-rtimes><td> <code>rtimes;</code> <td> U+022CA <td> <span class=glyph>⋊</span> <tr id=entity-rtri><td> <code>rtri;</code> <td> U+025B9 <td> <span class=glyph>▹</span> <tr id=entity-rtrie><td> <code>rtrie;</code> <td> U+022B5 <td> <span class=glyph>⊵</span> <tr id=entity-rtrif><td> <code>rtrif;</code> <td> U+025B8 <td> <span class=glyph>▸</span> <tr id=entity-rtriltri><td> <code>rtriltri;</code> <td> U+029CE <td> <span class=glyph>⧎</span> <tr id=entity-RuleDelayed><td> <code>RuleDelayed;</code> <td> U+029F4 <td> <span class=glyph>⧴</span> <tr id=entity-ruluhar><td> <code>ruluhar;</code> <td> U+02968 <td> <span class=glyph>⥨</span> <tr id=entity-rx><td> <code>rx;</code> <td> U+0211E <td> <span class=glyph>℞</span> <tr id=entity-Sacute><td> <code>Sacute;</code> <td> U+0015A <td> <span class=glyph>Ś</span> <tr id=entity-sacute><td> <code>sacute;</code> <td> U+0015B <td> <span class=glyph>ś</span> <tr id=entity-sbquo><td> <code>sbquo;</code> <td> U+0201A <td> <span class=glyph>‚</span> <tr id=entity-Sc><td> <code>Sc;</code> <td> U+02ABC <td> <span class=glyph>⪼</span> <tr id=entity-sc><td> <code>sc;</code> <td> U+0227B <td> <span class=glyph>≻</span> <tr id=entity-scap><td> <code>scap;</code> <td> U+02AB8 <td> <span class=glyph>⪸</span> <tr id=entity-Scaron><td> <code>Scaron;</code> <td> U+00160 <td> <span class=glyph>Š</span> <tr id=entity-scaron><td> <code>scaron;</code> <td> U+00161 <td> <span class=glyph>š</span> <tr id=entity-sccue><td> <code>sccue;</code> <td> U+0227D <td> <span class=glyph>≽</span> <tr id=entity-scE><td> <code>scE;</code> <td> U+02AB4 <td> <span class=glyph>⪴</span> <tr id=entity-sce><td> <code>sce;</code> <td> U+02AB0 <td> <span class=glyph>⪰</span> <tr id=entity-Scedil><td> <code>Scedil;</code> <td> U+0015E <td> <span class=glyph>Ş</span> <tr id=entity-scedil><td> <code>scedil;</code> <td> U+0015F <td> <span class=glyph>ş</span> <tr id=entity-Scirc><td> <code>Scirc;</code> <td> U+0015C <td> <span class=glyph>Ŝ</span> <tr id=entity-scirc><td> <code>scirc;</code> <td> U+0015D <td> <span class=glyph>ŝ</span> <tr id=entity-scnap><td> <code>scnap;</code> <td> U+02ABA <td> <span class=glyph>⪺</span> <tr id=entity-scnE><td> <code>scnE;</code> <td> U+02AB6 <td> <span class=glyph>⪶</span> <tr id=entity-scnsim><td> <code>scnsim;</code> <td> U+022E9 <td> <span class=glyph>⋩</span> <tr id=entity-scpolint><td> <code>scpolint;</code> <td> U+02A13 <td> <span class=glyph>⨓</span> <tr id=entity-scsim><td> <code>scsim;</code> <td> U+0227F <td> <span class=glyph>≿</span> <tr id=entity-Scy><td> <code>Scy;</code> <td> U+00421 <td> <span class=glyph>С</span> <tr id=entity-scy><td> <code>scy;</code> <td> U+00441 <td> <span class=glyph>с</span> <tr id=entity-sdot><td> <code>sdot;</code> <td> U+022C5 <td> <span class=glyph>⋅</span> <tr id=entity-sdotb><td> <code>sdotb;</code> <td> U+022A1 <td> <span class=glyph>⊡</span> <tr id=entity-sdote><td> <code>sdote;</code> <td> U+02A66 <td> <span class=glyph>⩦</span> <tr id=entity-searhk><td> <code>searhk;</code> <td> U+02925 <td> <span class=glyph>⤥</span> <tr id=entity-seArr><td> <code>seArr;</code> <td> U+021D8 <td> <span class=glyph>⇘</span> <tr id=entity-searr><td> <code>searr;</code> <td> U+02198 <td> <span class=glyph>↘</span> <tr id=entity-searrow><td> <code>searrow;</code> <td> U+02198 <td> <span class=glyph>↘</span> <tr id=entity-sect><td> <code>sect;</code> <td> U+000A7 <td> <span class=glyph>§</span> <tr id=entity-sect-legacy class=impl><td> <code>sect</code> <td> U+000A7 <td> <span>§</span> <tr id=entity-semi><td> <code>semi;</code> <td> U+0003B <td> <span class=glyph>;</span> <tr id=entity-seswar><td> <code>seswar;</code> <td> U+02929 <td> <span class=glyph>⤩</span> <tr id=entity-setminus><td> <code>setminus;</code> <td> U+02216 <td> <span class=glyph>∖</span> <tr id=entity-setmn><td> <code>setmn;</code> <td> U+02216 <td> <span class=glyph>∖</span> <tr id=entity-sext><td> <code>sext;</code> <td> U+02736 <td> <span class=glyph>✶</span> <tr id=entity-Sfr><td> <code>Sfr;</code> <td> U+1D516 <td> <span class=glyph>𝔖</span> <tr id=entity-sfr><td> <code>sfr;</code> <td> U+1D530 <td> <span class=glyph>𝔰</span> <tr id=entity-sfrown><td> <code>sfrown;</code> <td> U+02322 <td> <span class=glyph>⌢</span> <tr id=entity-sharp><td> <code>sharp;</code> <td> U+0266F <td> <span class=glyph>♯</span> <tr id=entity-SHCHcy><td> <code>SHCHcy;</code> <td> U+00429 <td> <span class=glyph>Щ</span> <tr id=entity-shchcy><td> <code>shchcy;</code> <td> U+00449 <td> <span class=glyph>щ</span> <tr id=entity-SHcy><td> <code>SHcy;</code> <td> U+00428 <td> <span class=glyph>Ш</span> <tr id=entity-shcy><td> <code>shcy;</code> <td> U+00448 <td> <span class=glyph>ш</span> <tr id=entity-ShortDownArrow><td> <code>ShortDownArrow;</code> <td> U+02193 <td> <span class=glyph>↓</span> <tr id=entity-ShortLeftArrow><td> <code>ShortLeftArrow;</code> <td> U+02190 <td> <span class=glyph>←</span> <tr id=entity-shortmid><td> <code>shortmid;</code> <td> U+02223 <td> <span class=glyph>∣</span> <tr id=entity-shortparallel><td> <code>shortparallel;</code> <td> U+02225 <td> <span class=glyph>∥</span> <tr id=entity-ShortRightArrow><td> <code>ShortRightArrow;</code> <td> U+02192 <td> <span class=glyph>→</span> <tr id=entity-ShortUpArrow><td> <code>ShortUpArrow;</code> <td> U+02191 <td> <span class=glyph>↑</span> <tr id=entity-shy><td> <code>shy;</code> <td> U+000AD <td> <span class=glyph></span> <tr id=entity-shy-legacy class=impl><td> <code>shy</code> <td> U+000AD <td> <span></span> <tr id=entity-Sigma><td> <code>Sigma;</code> <td> U+003A3 <td> <span class=glyph>Σ</span> <tr id=entity-sigma><td> <code>sigma;</code> <td> U+003C3 <td> <span class=glyph>σ</span> <tr id=entity-sigmaf><td> <code>sigmaf;</code> <td> U+003C2 <td> <span class=glyph>ς</span> <tr id=entity-sigmav><td> <code>sigmav;</code> <td> U+003C2 <td> <span class=glyph>ς</span> <tr id=entity-sim><td> <code>sim;</code> <td> U+0223C <td> <span class=glyph>∼</span> <tr id=entity-simdot><td> <code>simdot;</code> <td> U+02A6A <td> <span class=glyph>⩪</span> <tr id=entity-sime><td> <code>sime;</code> <td> U+02243 <td> <span class=glyph>≃</span> <tr id=entity-simeq><td> <code>simeq;</code> <td> U+02243 <td> <span class=glyph>≃</span> <tr id=entity-simg><td> <code>simg;</code> <td> U+02A9E <td> <span class=glyph>⪞</span> <tr id=entity-simgE><td> <code>simgE;</code> <td> U+02AA0 <td> <span class=glyph>⪠</span> <tr id=entity-siml><td> <code>siml;</code> <td> U+02A9D <td> <span class=glyph>⪝</span> <tr id=entity-simlE><td> <code>simlE;</code> <td> U+02A9F <td> <span class=glyph>⪟</span> <tr id=entity-simne><td> <code>simne;</code> <td> U+02246 <td> <span class=glyph>≆</span> <tr id=entity-simplus><td> <code>simplus;</code> <td> U+02A24 <td> <span class=glyph>⨤</span> <tr id=entity-simrarr><td> <code>simrarr;</code> <td> U+02972 <td> <span class=glyph>⥲</span> <tr id=entity-slarr><td> <code>slarr;</code> <td> U+02190 <td> <span class=glyph>←</span> <tr id=entity-SmallCircle><td> <code>SmallCircle;</code> <td> U+02218 <td> <span class=glyph>∘</span> <tr id=entity-smallsetminus><td> <code>smallsetminus;</code> <td> U+02216 <td> <span class=glyph>∖</span> <tr id=entity-smashp><td> <code>smashp;</code> <td> U+02A33 <td> <span class=glyph>⨳</span> <tr id=entity-smeparsl><td> <code>smeparsl;</code> <td> U+029E4 <td> <span class=glyph>⧤</span> <tr id=entity-smid><td> <code>smid;</code> <td> U+02223 <td> <span class=glyph>∣</span> <tr id=entity-smile><td> <code>smile;</code> <td> U+02323 <td> <span class=glyph>⌣</span> <tr id=entity-smt><td> <code>smt;</code> <td> U+02AAA <td> <span class=glyph>⪪</span> <tr id=entity-smte><td> <code>smte;</code> <td> U+02AAC <td> <span class=glyph>⪬</span> <tr id=entity-smtes><td> <code>smtes;</code> <td> U+02AAC U+0FE00 <td> <span class="glyph compound">⪬︀</span> <tr id=entity-SOFTcy><td> <code>SOFTcy;</code> <td> U+0042C <td> <span class=glyph>Ь</span> <tr id=entity-softcy><td> <code>softcy;</code> <td> U+0044C <td> <span class=glyph>ь</span> <tr id=entity-sol><td> <code>sol;</code> <td> U+0002F <td> <span class=glyph>/</span> <tr id=entity-solb><td> <code>solb;</code> <td> U+029C4 <td> <span class=glyph>⧄</span> <tr id=entity-solbar><td> <code>solbar;</code> <td> U+0233F <td> <span class=glyph>⌿</span> <tr id=entity-Sopf><td> <code>Sopf;</code> <td> U+1D54A <td> <span class=glyph>𝕊</span> <tr id=entity-sopf><td> <code>sopf;</code> <td> U+1D564 <td> <span class=glyph>𝕤</span> <tr id=entity-spades><td> <code>spades;</code> <td> U+02660 <td> <span class=glyph>♠</span> <tr id=entity-spadesuit><td> <code>spadesuit;</code> <td> U+02660 <td> <span class=glyph>♠</span> <tr id=entity-spar><td> <code>spar;</code> <td> U+02225 <td> <span class=glyph>∥</span> <tr id=entity-sqcap><td> <code>sqcap;</code> <td> U+02293 <td> <span class=glyph>⊓</span> <tr id=entity-sqcaps><td> <code>sqcaps;</code> <td> U+02293 U+0FE00 <td> <span class="glyph compound">⊓︀</span> <tr id=entity-sqcup><td> <code>sqcup;</code> <td> U+02294 <td> <span class=glyph>⊔</span> <tr id=entity-sqcups><td> <code>sqcups;</code> <td> U+02294 U+0FE00 <td> <span class="glyph compound">⊔︀</span> <tr id=entity-Sqrt><td> <code>Sqrt;</code> <td> U+0221A <td> <span class=glyph>√</span> <tr id=entity-sqsub><td> <code>sqsub;</code> <td> U+0228F <td> <span class=glyph>⊏</span> <tr id=entity-sqsube><td> <code>sqsube;</code> <td> U+02291 <td> <span class=glyph>⊑</span> <tr id=entity-sqsubset><td> <code>sqsubset;</code> <td> U+0228F <td> <span class=glyph>⊏</span> <tr id=entity-sqsubseteq><td> <code>sqsubseteq;</code> <td> U+02291 <td> <span class=glyph>⊑</span> <tr id=entity-sqsup><td> <code>sqsup;</code> <td> U+02290 <td> <span class=glyph>⊐</span> <tr id=entity-sqsupe><td> <code>sqsupe;</code> <td> U+02292 <td> <span class=glyph>⊒</span> <tr id=entity-sqsupset><td> <code>sqsupset;</code> <td> U+02290 <td> <span class=glyph>⊐</span> <tr id=entity-sqsupseteq><td> <code>sqsupseteq;</code> <td> U+02292 <td> <span class=glyph>⊒</span> <tr id=entity-squ><td> <code>squ;</code> <td> U+025A1 <td> <span class=glyph>□</span> <tr id=entity-Square><td> <code>Square;</code> <td> U+025A1 <td> <span class=glyph>□</span> <tr id=entity-square><td> <code>square;</code> <td> U+025A1 <td> <span class=glyph>□</span> <tr id=entity-SquareIntersection><td> <code>SquareIntersection;</code> <td> U+02293 <td> <span class=glyph>⊓</span> <tr id=entity-SquareSubset><td> <code>SquareSubset;</code> <td> U+0228F <td> <span class=glyph>⊏</span> <tr id=entity-SquareSubsetEqual><td> <code>SquareSubsetEqual;</code> <td> U+02291 <td> <span class=glyph>⊑</span> <tr id=entity-SquareSuperset><td> <code>SquareSuperset;</code> <td> U+02290 <td> <span class=glyph>⊐</span> <tr id=entity-SquareSupersetEqual><td> <code>SquareSupersetEqual;</code> <td> U+02292 <td> <span class=glyph>⊒</span> <tr id=entity-SquareUnion><td> <code>SquareUnion;</code> <td> U+02294 <td> <span class=glyph>⊔</span> <tr id=entity-squarf><td> <code>squarf;</code> <td> U+025AA <td> <span class=glyph>▪</span> <tr id=entity-squf><td> <code>squf;</code> <td> U+025AA <td> <span class=glyph>▪</span> <tr id=entity-srarr><td> <code>srarr;</code> <td> U+02192 <td> <span class=glyph>→</span> <tr id=entity-Sscr><td> <code>Sscr;</code> <td> U+1D4AE <td> <span class=glyph>𝒮</span> <tr id=entity-sscr><td> <code>sscr;</code> <td> U+1D4C8 <td> <span class=glyph>𝓈</span> <tr id=entity-ssetmn><td> <code>ssetmn;</code> <td> U+02216 <td> <span class=glyph>∖</span> <tr id=entity-ssmile><td> <code>ssmile;</code> <td> U+02323 <td> <span class=glyph>⌣</span> <tr id=entity-sstarf><td> <code>sstarf;</code> <td> U+022C6 <td> <span class=glyph>⋆</span> <tr id=entity-Star><td> <code>Star;</code> <td> U+022C6 <td> <span class=glyph>⋆</span> <tr id=entity-star><td> <code>star;</code> <td> U+02606 <td> <span class=glyph>☆</span> <tr id=entity-starf><td> <code>starf;</code> <td> U+02605 <td> <span class=glyph>★</span> <tr id=entity-straightepsilon><td> <code>straightepsilon;</code> <td> U+003F5 <td> <span class=glyph>ϵ</span> <tr id=entity-straightphi><td> <code>straightphi;</code> <td> U+003D5 <td> <span class=glyph>ϕ</span> <tr id=entity-strns><td> <code>strns;</code> <td> U+000AF <td> <span class=glyph>¯</span> <tr id=entity-Sub><td> <code>Sub;</code> <td> U+022D0 <td> <span class=glyph>⋐</span> <tr id=entity-sub><td> <code>sub;</code> <td> U+02282 <td> <span class=glyph>⊂</span> <tr id=entity-subdot><td> <code>subdot;</code> <td> U+02ABD <td> <span class=glyph>⪽</span> <tr id=entity-subE><td> <code>subE;</code> <td> U+02AC5 <td> <span class=glyph>⫅</span> <tr id=entity-sube><td> <code>sube;</code> <td> U+02286 <td> <span class=glyph>⊆</span> <tr id=entity-subedot><td> <code>subedot;</code> <td> U+02AC3 <td> <span class=glyph>⫃</span> <tr id=entity-submult><td> <code>submult;</code> <td> U+02AC1 <td> <span class=glyph>⫁</span> <tr id=entity-subnE><td> <code>subnE;</code> <td> U+02ACB <td> <span class=glyph>⫋</span> <tr id=entity-subne><td> <code>subne;</code> <td> U+0228A <td> <span class=glyph>⊊</span> <tr id=entity-subplus><td> <code>subplus;</code> <td> U+02ABF <td> <span class=glyph>⪿</span> <tr id=entity-subrarr><td> <code>subrarr;</code> <td> U+02979 <td> <span class=glyph>⥹</span> <tr id=entity-Subset><td> <code>Subset;</code> <td> U+022D0 <td> <span class=glyph>⋐</span> <tr id=entity-subset><td> <code>subset;</code> <td> U+02282 <td> <span class=glyph>⊂</span> <tr id=entity-subseteq><td> <code>subseteq;</code> <td> U+02286 <td> <span class=glyph>⊆</span> <tr id=entity-subseteqq><td> <code>subseteqq;</code> <td> U+02AC5 <td> <span class=glyph>⫅</span> <tr id=entity-SubsetEqual><td> <code>SubsetEqual;</code> <td> U+02286 <td> <span class=glyph>⊆</span> <tr id=entity-subsetneq><td> <code>subsetneq;</code> <td> U+0228A <td> <span class=glyph>⊊</span> <tr id=entity-subsetneqq><td> <code>subsetneqq;</code> <td> U+02ACB <td> <span class=glyph>⫋</span> <tr id=entity-subsim><td> <code>subsim;</code> <td> U+02AC7 <td> <span class=glyph>⫇</span> <tr id=entity-subsub><td> <code>subsub;</code> <td> U+02AD5 <td> <span class=glyph>⫕</span> <tr id=entity-subsup><td> <code>subsup;</code> <td> U+02AD3 <td> <span class=glyph>⫓</span> <tr id=entity-succ><td> <code>succ;</code> <td> U+0227B <td> <span class=glyph>≻</span> <tr id=entity-succapprox><td> <code>succapprox;</code> <td> U+02AB8 <td> <span class=glyph>⪸</span> <tr id=entity-succcurlyeq><td> <code>succcurlyeq;</code> <td> U+0227D <td> <span class=glyph>≽</span> <tr id=entity-Succeeds><td> <code>Succeeds;</code> <td> U+0227B <td> <span class=glyph>≻</span> <tr id=entity-SucceedsEqual><td> <code>SucceedsEqual;</code> <td> U+02AB0 <td> <span class=glyph>⪰</span> <tr id=entity-SucceedsSlantEqual><td> <code>SucceedsSlantEqual;</code> <td> U+0227D <td> <span class=glyph>≽</span> <tr id=entity-SucceedsTilde><td> <code>SucceedsTilde;</code> <td> U+0227F <td> <span class=glyph>≿</span> <tr id=entity-succeq><td> <code>succeq;</code> <td> U+02AB0 <td> <span class=glyph>⪰</span> <tr id=entity-succnapprox><td> <code>succnapprox;</code> <td> U+02ABA <td> <span class=glyph>⪺</span> <tr id=entity-succneqq><td> <code>succneqq;</code> <td> U+02AB6 <td> <span class=glyph>⪶</span> <tr id=entity-succnsim><td> <code>succnsim;</code> <td> U+022E9 <td> <span class=glyph>⋩</span> <tr id=entity-succsim><td> <code>succsim;</code> <td> U+0227F <td> <span class=glyph>≿</span> <tr id=entity-SuchThat><td> <code>SuchThat;</code> <td> U+0220B <td> <span class=glyph>∋</span> <tr id=entity-Sum><td> <code>Sum;</code> <td> U+02211 <td> <span class=glyph>∑</span> <tr id=entity-sum><td> <code>sum;</code> <td> U+02211 <td> <span class=glyph>∑</span> <tr id=entity-sung><td> <code>sung;</code> <td> U+0266A <td> <span class=glyph>♪</span> <tr id=entity-Sup><td> <code>Sup;</code> <td> U+022D1 <td> <span class=glyph>⋑</span> <tr id=entity-sup><td> <code>sup;</code> <td> U+02283 <td> <span class=glyph>⊃</span> <tr id=entity-sup1><td> <code>sup1;</code> <td> U+000B9 <td> <span class=glyph>¹</span> <tr id=entity-sup1-legacy class=impl><td> <code>sup1</code> <td> U+000B9 <td> <span>¹</span> <tr id=entity-sup2><td> <code>sup2;</code> <td> U+000B2 <td> <span class=glyph>²</span> <tr id=entity-sup2-legacy class=impl><td> <code>sup2</code> <td> U+000B2 <td> <span>²</span> <tr id=entity-sup3><td> <code>sup3;</code> <td> U+000B3 <td> <span class=glyph>³</span> <tr id=entity-sup3-legacy class=impl><td> <code>sup3</code> <td> U+000B3 <td> <span>³</span> <tr id=entity-supdot><td> <code>supdot;</code> <td> U+02ABE <td> <span class=glyph>⪾</span> <tr id=entity-supdsub><td> <code>supdsub;</code> <td> U+02AD8 <td> <span class=glyph>⫘</span> <tr id=entity-supE><td> <code>supE;</code> <td> U+02AC6 <td> <span class=glyph>⫆</span> <tr id=entity-supe><td> <code>supe;</code> <td> U+02287 <td> <span class=glyph>⊇</span> <tr id=entity-supedot><td> <code>supedot;</code> <td> U+02AC4 <td> <span class=glyph>⫄</span> <tr id=entity-Superset><td> <code>Superset;</code> <td> U+02283 <td> <span class=glyph>⊃</span> <tr id=entity-SupersetEqual><td> <code>SupersetEqual;</code> <td> U+02287 <td> <span class=glyph>⊇</span> <tr id=entity-suphsol><td> <code>suphsol;</code> <td> U+027C9 <td> <span class=glyph>⟉</span> <tr id=entity-suphsub><td> <code>suphsub;</code> <td> U+02AD7 <td> <span class=glyph>⫗</span> <tr id=entity-suplarr><td> <code>suplarr;</code> <td> U+0297B <td> <span class=glyph>⥻</span> <tr id=entity-supmult><td> <code>supmult;</code> <td> U+02AC2 <td> <span class=glyph>⫂</span> <tr id=entity-supnE><td> <code>supnE;</code> <td> U+02ACC <td> <span class=glyph>⫌</span> <tr id=entity-supne><td> <code>supne;</code> <td> U+0228B <td> <span class=glyph>⊋</span> <tr id=entity-supplus><td> <code>supplus;</code> <td> U+02AC0 <td> <span class=glyph>⫀</span> <tr id=entity-Supset><td> <code>Supset;</code> <td> U+022D1 <td> <span class=glyph>⋑</span> <tr id=entity-supset><td> <code>supset;</code> <td> U+02283 <td> <span class=glyph>⊃</span> <tr id=entity-supseteq><td> <code>supseteq;</code> <td> U+02287 <td> <span class=glyph>⊇</span> <tr id=entity-supseteqq><td> <code>supseteqq;</code> <td> U+02AC6 <td> <span class=glyph>⫆</span> <tr id=entity-supsetneq><td> <code>supsetneq;</code> <td> U+0228B <td> <span class=glyph>⊋</span> <tr id=entity-supsetneqq><td> <code>supsetneqq;</code> <td> U+02ACC <td> <span class=glyph>⫌</span> <tr id=entity-supsim><td> <code>supsim;</code> <td> U+02AC8 <td> <span class=glyph>⫈</span> <tr id=entity-supsub><td> <code>supsub;</code> <td> U+02AD4 <td> <span class=glyph>⫔</span> <tr id=entity-supsup><td> <code>supsup;</code> <td> U+02AD6 <td> <span class=glyph>⫖</span> <tr id=entity-swarhk><td> <code>swarhk;</code> <td> U+02926 <td> <span class=glyph>⤦</span> <tr id=entity-swArr><td> <code>swArr;</code> <td> U+021D9 <td> <span class=glyph>⇙</span> <tr id=entity-swarr><td> <code>swarr;</code> <td> U+02199 <td> <span class=glyph>↙</span> <tr id=entity-swarrow><td> <code>swarrow;</code> <td> U+02199 <td> <span class=glyph>↙</span> <tr id=entity-swnwar><td> <code>swnwar;</code> <td> U+0292A <td> <span class=glyph>⤪</span> <tr id=entity-szlig><td> <code>szlig;</code> <td> U+000DF <td> <span class=glyph>ß</span> <tr id=entity-szlig-legacy class=impl><td> <code>szlig</code> <td> U+000DF <td> <span>ß</span> <tr id=entity-Tab><td> <code>Tab;</code> <td> U+00009 <td> <span class="glyph control">␉</span> <tr id=entity-target><td> <code>target;</code> <td> U+02316 <td> <span class=glyph>⌖</span> <tr id=entity-Tau><td> <code>Tau;</code> <td> U+003A4 <td> <span class=glyph>Τ</span> <tr id=entity-tau><td> <code>tau;</code> <td> U+003C4 <td> <span class=glyph>τ</span> <tr id=entity-tbrk><td> <code>tbrk;</code> <td> U+023B4 <td> <span class=glyph>⎴</span> <tr id=entity-Tcaron><td> <code>Tcaron;</code> <td> U+00164 <td> <span class=glyph>Ť</span> <tr id=entity-tcaron><td> <code>tcaron;</code> <td> U+00165 <td> <span class=glyph>ť</span> <tr id=entity-Tcedil><td> <code>Tcedil;</code> <td> U+00162 <td> <span class=glyph>Ţ</span> <tr id=entity-tcedil><td> <code>tcedil;</code> <td> U+00163 <td> <span class=glyph>ţ</span> <tr id=entity-Tcy><td> <code>Tcy;</code> <td> U+00422 <td> <span class=glyph>Т</span> <tr id=entity-tcy><td> <code>tcy;</code> <td> U+00442 <td> <span class=glyph>т</span> <tr id=entity-tdot><td> <code>tdot;</code> <td> U+020DB <td> <span class="glyph composition">◌⃛</span> <tr id=entity-telrec><td> <code>telrec;</code> <td> U+02315 <td> <span class=glyph>⌕</span> <tr id=entity-Tfr><td> <code>Tfr;</code> <td> U+1D517 <td> <span class=glyph>𝔗</span> <tr id=entity-tfr><td> <code>tfr;</code> <td> U+1D531 <td> <span class=glyph>𝔱</span> <tr id=entity-there4><td> <code>there4;</code> <td> U+02234 <td> <span class=glyph>∴</span> <tr id=entity-Therefore><td> <code>Therefore;</code> <td> U+02234 <td> <span class=glyph>∴</span> <tr id=entity-therefore><td> <code>therefore;</code> <td> U+02234 <td> <span class=glyph>∴</span> <tr id=entity-Theta><td> <code>Theta;</code> <td> U+00398 <td> <span class=glyph>Θ</span> <tr id=entity-theta><td> <code>theta;</code> <td> U+003B8 <td> <span class=glyph>θ</span> <tr id=entity-thetasym><td> <code>thetasym;</code> <td> U+003D1 <td> <span class=glyph>ϑ</span> <tr id=entity-thetav><td> <code>thetav;</code> <td> U+003D1 <td> <span class=glyph>ϑ</span> <tr id=entity-thickapprox><td> <code>thickapprox;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-thicksim><td> <code>thicksim;</code> <td> U+0223C <td> <span class=glyph>∼</span> <tr id=entity-ThickSpace><td> <code>ThickSpace;</code> <td> U+0205F U+0200A <td> <span class="glyph compound"> </span> <tr id=entity-thinsp><td> <code>thinsp;</code> <td> U+02009 <td> <span class=glyph> </span> <tr id=entity-ThinSpace><td> <code>ThinSpace;</code> <td> U+02009 <td> <span class=glyph> </span> <tr id=entity-thkap><td> <code>thkap;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-thksim><td> <code>thksim;</code> <td> U+0223C <td> <span class=glyph>∼</span> <tr id=entity-THORN><td> <code>THORN;</code> <td> U+000DE <td> <span class=glyph>Þ</span> <tr id=entity-THORN-legacy class=impl><td> <code>THORN</code> <td> U+000DE <td> <span>Þ</span> <tr id=entity-thorn><td> <code>thorn;</code> <td> U+000FE <td> <span class=glyph>þ</span> <tr id=entity-thorn-legacy class=impl><td> <code>thorn</code> <td> U+000FE <td> <span>þ</span> <tr id=entity-Tilde><td> <code>Tilde;</code> <td> U+0223C <td> <span class=glyph>∼</span> <tr id=entity-tilde><td> <code>tilde;</code> <td> U+002DC <td> <span class=glyph>˜</span> <tr id=entity-TildeEqual><td> <code>TildeEqual;</code> <td> U+02243 <td> <span class=glyph>≃</span> <tr id=entity-TildeFullEqual><td> <code>TildeFullEqual;</code> <td> U+02245 <td> <span class=glyph>≅</span> <tr id=entity-TildeTilde><td> <code>TildeTilde;</code> <td> U+02248 <td> <span class=glyph>≈</span> <tr id=entity-times><td> <code>times;</code> <td> U+000D7 <td> <span class=glyph>×</span> <tr id=entity-times-legacy class=impl><td> <code>times</code> <td> U+000D7 <td> <span>×</span> <tr id=entity-timesb><td> <code>timesb;</code> <td> U+022A0 <td> <span class=glyph>⊠</span> <tr id=entity-timesbar><td> <code>timesbar;</code> <td> U+02A31 <td> <span class=glyph>⨱</span> <tr id=entity-timesd><td> <code>timesd;</code> <td> U+02A30 <td> <span class=glyph>⨰</span> <tr id=entity-tint><td> <code>tint;</code> <td> U+0222D <td> <span class=glyph>∭</span> <tr id=entity-toea><td> <code>toea;</code> <td> U+02928 <td> <span class=glyph>⤨</span> <tr id=entity-top><td> <code>top;</code> <td> U+022A4 <td> <span class=glyph>⊤</span> <tr id=entity-topbot><td> <code>topbot;</code> <td> U+02336 <td> <span class=glyph>⌶</span> <tr id=entity-topcir><td> <code>topcir;</code> <td> U+02AF1 <td> <span class=glyph>⫱</span> <tr id=entity-Topf><td> <code>Topf;</code> <td> U+1D54B <td> <span class=glyph>𝕋</span> <tr id=entity-topf><td> <code>topf;</code> <td> U+1D565 <td> <span class=glyph>𝕥</span> <tr id=entity-topfork><td> <code>topfork;</code> <td> U+02ADA <td> <span class=glyph>⫚</span> <tr id=entity-tosa><td> <code>tosa;</code> <td> U+02929 <td> <span class=glyph>⤩</span> <tr id=entity-tprime><td> <code>tprime;</code> <td> U+02034 <td> <span class=glyph>‴</span> <tr id=entity-TRADE><td> <code>TRADE;</code> <td> U+02122 <td> <span class=glyph>™</span> <tr id=entity-trade><td> <code>trade;</code> <td> U+02122 <td> <span class=glyph>™</span> <tr id=entity-triangle><td> <code>triangle;</code> <td> U+025B5 <td> <span class=glyph>▵</span> <tr id=entity-triangledown><td> <code>triangledown;</code> <td> U+025BF <td> <span class=glyph>▿</span> <tr id=entity-triangleleft><td> <code>triangleleft;</code> <td> U+025C3 <td> <span class=glyph>◃</span> <tr id=entity-trianglelefteq><td> <code>trianglelefteq;</code> <td> U+022B4 <td> <span class=glyph>⊴</span> <tr id=entity-triangleq><td> <code>triangleq;</code> <td> U+0225C <td> <span class=glyph>≜</span> <tr id=entity-triangleright><td> <code>triangleright;</code> <td> U+025B9 <td> <span class=glyph>▹</span> <tr id=entity-trianglerighteq><td> <code>trianglerighteq;</code> <td> U+022B5 <td> <span class=glyph>⊵</span> <tr id=entity-tridot><td> <code>tridot;</code> <td> U+025EC <td> <span class=glyph>◬</span> <tr id=entity-trie><td> <code>trie;</code> <td> U+0225C <td> <span class=glyph>≜</span> <tr id=entity-triminus><td> <code>triminus;</code> <td> U+02A3A <td> <span class=glyph>⨺</span> <tr id=entity-TripleDot><td> <code>TripleDot;</code> <td> U+020DB <td> <span class="glyph composition">◌⃛</span> <tr id=entity-triplus><td> <code>triplus;</code> <td> U+02A39 <td> <span class=glyph>⨹</span> <tr id=entity-trisb><td> <code>trisb;</code> <td> U+029CD <td> <span class=glyph>⧍</span> <tr id=entity-tritime><td> <code>tritime;</code> <td> U+02A3B <td> <span class=glyph>⨻</span> <tr id=entity-trpezium><td> <code>trpezium;</code> <td> U+023E2 <td> <span class=glyph>⏢</span> <tr id=entity-Tscr><td> <code>Tscr;</code> <td> U+1D4AF <td> <span class=glyph>𝒯</span> <tr id=entity-tscr><td> <code>tscr;</code> <td> U+1D4C9 <td> <span class=glyph>𝓉</span> <tr id=entity-TScy><td> <code>TScy;</code> <td> U+00426 <td> <span class=glyph>Ц</span> <tr id=entity-tscy><td> <code>tscy;</code> <td> U+00446 <td> <span class=glyph>ц</span> <tr id=entity-TSHcy><td> <code>TSHcy;</code> <td> U+0040B <td> <span class=glyph>Ћ</span> <tr id=entity-tshcy><td> <code>tshcy;</code> <td> U+0045B <td> <span class=glyph>ћ</span> <tr id=entity-Tstrok><td> <code>Tstrok;</code> <td> U+00166 <td> <span class=glyph>Ŧ</span> <tr id=entity-tstrok><td> <code>tstrok;</code> <td> U+00167 <td> <span class=glyph>ŧ</span> <tr id=entity-twixt><td> <code>twixt;</code> <td> U+0226C <td> <span class=glyph>≬</span> <tr id=entity-twoheadleftarrow><td> <code>twoheadleftarrow;</code> <td> U+0219E <td> <span class=glyph>↞</span> <tr id=entity-twoheadrightarrow><td> <code>twoheadrightarrow;</code> <td> U+021A0 <td> <span class=glyph>↠</span> <tr id=entity-Uacute><td> <code>Uacute;</code> <td> U+000DA <td> <span class=glyph>Ú</span> <tr id=entity-Uacute-legacy class=impl><td> <code>Uacute</code> <td> U+000DA <td> <span>Ú</span> <tr id=entity-uacute><td> <code>uacute;</code> <td> U+000FA <td> <span class=glyph>ú</span> <tr id=entity-uacute-legacy class=impl><td> <code>uacute</code> <td> U+000FA <td> <span>ú</span> <tr id=entity-Uarr><td> <code>Uarr;</code> <td> U+0219F <td> <span class=glyph>↟</span> <tr id=entity-uArr><td> <code>uArr;</code> <td> U+021D1 <td> <span class=glyph>⇑</span> <tr id=entity-uarr><td> <code>uarr;</code> <td> U+02191 <td> <span class=glyph>↑</span> <tr id=entity-Uarrocir><td> <code>Uarrocir;</code> <td> U+02949 <td> <span class=glyph>⥉</span> <tr id=entity-Ubrcy><td> <code>Ubrcy;</code> <td> U+0040E <td> <span class=glyph>Ў</span> <tr id=entity-ubrcy><td> <code>ubrcy;</code> <td> U+0045E <td> <span class=glyph>ў</span> <tr id=entity-Ubreve><td> <code>Ubreve;</code> <td> U+0016C <td> <span class=glyph>Ŭ</span> <tr id=entity-ubreve><td> <code>ubreve;</code> <td> U+0016D <td> <span class=glyph>ŭ</span> <tr id=entity-Ucirc><td> <code>Ucirc;</code> <td> U+000DB <td> <span class=glyph>Û</span> <tr id=entity-Ucirc-legacy class=impl><td> <code>Ucirc</code> <td> U+000DB <td> <span>Û</span> <tr id=entity-ucirc><td> <code>ucirc;</code> <td> U+000FB <td> <span class=glyph>û</span> <tr id=entity-ucirc-legacy class=impl><td> <code>ucirc</code> <td> U+000FB <td> <span>û</span> <tr id=entity-Ucy><td> <code>Ucy;</code> <td> U+00423 <td> <span class=glyph>У</span> <tr id=entity-ucy><td> <code>ucy;</code> <td> U+00443 <td> <span class=glyph>у</span> <tr id=entity-udarr><td> <code>udarr;</code> <td> U+021C5 <td> <span class=glyph>⇅</span> <tr id=entity-Udblac><td> <code>Udblac;</code> <td> U+00170 <td> <span class=glyph>Ű</span> <tr id=entity-udblac><td> <code>udblac;</code> <td> U+00171 <td> <span class=glyph>ű</span> <tr id=entity-udhar><td> <code>udhar;</code> <td> U+0296E <td> <span class=glyph>⥮</span> <tr id=entity-ufisht><td> <code>ufisht;</code> <td> U+0297E <td> <span class=glyph>⥾</span> <tr id=entity-Ufr><td> <code>Ufr;</code> <td> U+1D518 <td> <span class=glyph>𝔘</span> <tr id=entity-ufr><td> <code>ufr;</code> <td> U+1D532 <td> <span class=glyph>𝔲</span> <tr id=entity-Ugrave><td> <code>Ugrave;</code> <td> U+000D9 <td> <span class=glyph>Ù</span> <tr id=entity-Ugrave-legacy class=impl><td> <code>Ugrave</code> <td> U+000D9 <td> <span>Ù</span> <tr id=entity-ugrave><td> <code>ugrave;</code> <td> U+000F9 <td> <span class=glyph>ù</span> <tr id=entity-ugrave-legacy class=impl><td> <code>ugrave</code> <td> U+000F9 <td> <span>ù</span> <tr id=entity-uHar><td> <code>uHar;</code> <td> U+02963 <td> <span class=glyph>⥣</span> <tr id=entity-uharl><td> <code>uharl;</code> <td> U+021BF <td> <span class=glyph>↿</span> <tr id=entity-uharr><td> <code>uharr;</code> <td> U+021BE <td> <span class=glyph>↾</span> <tr id=entity-uhblk><td> <code>uhblk;</code> <td> U+02580 <td> <span class=glyph>▀</span> <tr id=entity-ulcorn><td> <code>ulcorn;</code> <td> U+0231C <td> <span class=glyph>⌜</span> <tr id=entity-ulcorner><td> <code>ulcorner;</code> <td> U+0231C <td> <span class=glyph>⌜</span> <tr id=entity-ulcrop><td> <code>ulcrop;</code> <td> U+0230F <td> <span class=glyph>⌏</span> <tr id=entity-ultri><td> <code>ultri;</code> <td> U+025F8 <td> <span class=glyph>◸</span> <tr id=entity-Umacr><td> <code>Umacr;</code> <td> U+0016A <td> <span class=glyph>Ū</span> <tr id=entity-umacr><td> <code>umacr;</code> <td> U+0016B <td> <span class=glyph>ū</span> <tr id=entity-uml><td> <code>uml;</code> <td> U+000A8 <td> <span class=glyph>¨</span> <tr id=entity-uml-legacy class=impl><td> <code>uml</code> <td> U+000A8 <td> <span>¨</span> <tr id=entity-UnderBar><td> <code>UnderBar;</code> <td> U+0005F <td> <span class=glyph>_</span> <tr id=entity-UnderBrace><td> <code>UnderBrace;</code> <td> U+023DF <td> <span class=glyph>⏟</span> <tr id=entity-UnderBracket><td> <code>UnderBracket;</code> <td> U+023B5 <td> <span class=glyph>⎵</span> <tr id=entity-UnderParenthesis><td> <code>UnderParenthesis;</code> <td> U+023DD <td> <span class=glyph>⏝</span> <tr id=entity-Union><td> <code>Union;</code> <td> U+022C3 <td> <span class=glyph>⋃</span> <tr id=entity-UnionPlus><td> <code>UnionPlus;</code> <td> U+0228E <td> <span class=glyph>⊎</span> <tr id=entity-Uogon><td> <code>Uogon;</code> <td> U+00172 <td> <span class=glyph>Ų</span> <tr id=entity-uogon><td> <code>uogon;</code> <td> U+00173 <td> <span class=glyph>ų</span> <tr id=entity-Uopf><td> <code>Uopf;</code> <td> U+1D54C <td> <span class=glyph>𝕌</span> <tr id=entity-uopf><td> <code>uopf;</code> <td> U+1D566 <td> <span class=glyph>𝕦</span> <tr id=entity-UpArrow><td> <code>UpArrow;</code> <td> U+02191 <td> <span class=glyph>↑</span> <tr id=entity-Uparrow><td> <code>Uparrow;</code> <td> U+021D1 <td> <span class=glyph>⇑</span> <tr id=entity-uparrow><td> <code>uparrow;</code> <td> U+02191 <td> <span class=glyph>↑</span> <tr id=entity-UpArrowBar><td> <code>UpArrowBar;</code> <td> U+02912 <td> <span class=glyph>⤒</span> <tr id=entity-UpArrowDownArrow><td> <code>UpArrowDownArrow;</code> <td> U+021C5 <td> <span class=glyph>⇅</span> <tr id=entity-UpDownArrow><td> <code>UpDownArrow;</code> <td> U+02195 <td> <span class=glyph>↕</span> <tr id=entity-Updownarrow><td> <code>Updownarrow;</code> <td> U+021D5 <td> <span class=glyph>⇕</span> <tr id=entity-updownarrow><td> <code>updownarrow;</code> <td> U+02195 <td> <span class=glyph>↕</span> <tr id=entity-UpEquilibrium><td> <code>UpEquilibrium;</code> <td> U+0296E <td> <span class=glyph>⥮</span> <tr id=entity-upharpoonleft><td> <code>upharpoonleft;</code> <td> U+021BF <td> <span class=glyph>↿</span> <tr id=entity-upharpoonright><td> <code>upharpoonright;</code> <td> U+021BE <td> <span class=glyph>↾</span> <tr id=entity-uplus><td> <code>uplus;</code> <td> U+0228E <td> <span class=glyph>⊎</span> <tr id=entity-UpperLeftArrow><td> <code>UpperLeftArrow;</code> <td> U+02196 <td> <span class=glyph>↖</span> <tr id=entity-UpperRightArrow><td> <code>UpperRightArrow;</code> <td> U+02197 <td> <span class=glyph>↗</span> <tr id=entity-Upsi><td> <code>Upsi;</code> <td> U+003D2 <td> <span class=glyph>ϒ</span> <tr id=entity-upsi><td> <code>upsi;</code> <td> U+003C5 <td> <span class=glyph>υ</span> <tr id=entity-upsih><td> <code>upsih;</code> <td> U+003D2 <td> <span class=glyph>ϒ</span> <tr id=entity-Upsilon><td> <code>Upsilon;</code> <td> U+003A5 <td> <span class=glyph>Υ</span> <tr id=entity-upsilon><td> <code>upsilon;</code> <td> U+003C5 <td> <span class=glyph>υ</span> <tr id=entity-UpTee><td> <code>UpTee;</code> <td> U+022A5 <td> <span class=glyph>⊥</span> <tr id=entity-UpTeeArrow><td> <code>UpTeeArrow;</code> <td> U+021A5 <td> <span class=glyph>↥</span> <tr id=entity-upuparrows><td> <code>upuparrows;</code> <td> U+021C8 <td> <span class=glyph>⇈</span> <tr id=entity-urcorn><td> <code>urcorn;</code> <td> U+0231D <td> <span class=glyph>⌝</span> <tr id=entity-urcorner><td> <code>urcorner;</code> <td> U+0231D <td> <span class=glyph>⌝</span> <tr id=entity-urcrop><td> <code>urcrop;</code> <td> U+0230E <td> <span class=glyph>⌎</span> <tr id=entity-Uring><td> <code>Uring;</code> <td> U+0016E <td> <span class=glyph>Ů</span> <tr id=entity-uring><td> <code>uring;</code> <td> U+0016F <td> <span class=glyph>ů</span> <tr id=entity-urtri><td> <code>urtri;</code> <td> U+025F9 <td> <span class=glyph>◹</span> <tr id=entity-Uscr><td> <code>Uscr;</code> <td> U+1D4B0 <td> <span class=glyph>𝒰</span> <tr id=entity-uscr><td> <code>uscr;</code> <td> U+1D4CA <td> <span class=glyph>𝓊</span> <tr id=entity-utdot><td> <code>utdot;</code> <td> U+022F0 <td> <span class=glyph>⋰</span> <tr id=entity-Utilde><td> <code>Utilde;</code> <td> U+00168 <td> <span class=glyph>Ũ</span> <tr id=entity-utilde><td> <code>utilde;</code> <td> U+00169 <td> <span class=glyph>ũ</span> <tr id=entity-utri><td> <code>utri;</code> <td> U+025B5 <td> <span class=glyph>▵</span> <tr id=entity-utrif><td> <code>utrif;</code> <td> U+025B4 <td> <span class=glyph>▴</span> <tr id=entity-uuarr><td> <code>uuarr;</code> <td> U+021C8 <td> <span class=glyph>⇈</span> <tr id=entity-Uuml><td> <code>Uuml;</code> <td> U+000DC <td> <span class=glyph>Ü</span> <tr id=entity-Uuml-legacy class=impl><td> <code>Uuml</code> <td> U+000DC <td> <span>Ü</span> <tr id=entity-uuml><td> <code>uuml;</code> <td> U+000FC <td> <span class=glyph>ü</span> <tr id=entity-uuml-legacy class=impl><td> <code>uuml</code> <td> U+000FC <td> <span>ü</span> <tr id=entity-uwangle><td> <code>uwangle;</code> <td> U+029A7 <td> <span class=glyph>⦧</span> <tr id=entity-vangrt><td> <code>vangrt;</code> <td> U+0299C <td> <span class=glyph>⦜</span> <tr id=entity-varepsilon><td> <code>varepsilon;</code> <td> U+003F5 <td> <span class=glyph>ϵ</span> <tr id=entity-varkappa><td> <code>varkappa;</code> <td> U+003F0 <td> <span class=glyph>ϰ</span> <tr id=entity-varnothing><td> <code>varnothing;</code> <td> U+02205 <td> <span class=glyph>∅</span> <tr id=entity-varphi><td> <code>varphi;</code> <td> U+003D5 <td> <span class=glyph>ϕ</span> <tr id=entity-varpi><td> <code>varpi;</code> <td> U+003D6 <td> <span class=glyph>ϖ</span> <tr id=entity-varpropto><td> <code>varpropto;</code> <td> U+0221D <td> <span class=glyph>∝</span> <tr id=entity-vArr><td> <code>vArr;</code> <td> U+021D5 <td> <span class=glyph>⇕</span> <tr id=entity-varr><td> <code>varr;</code> <td> U+02195 <td> <span class=glyph>↕</span> <tr id=entity-varrho><td> <code>varrho;</code> <td> U+003F1 <td> <span class=glyph>ϱ</span> <tr id=entity-varsigma><td> <code>varsigma;</code> <td> U+003C2 <td> <span class=glyph>ς</span> <tr id=entity-varsubsetneq><td> <code>varsubsetneq;</code> <td> U+0228A U+0FE00 <td> <span class="glyph compound">⊊︀</span> <tr id=entity-varsubsetneqq><td> <code>varsubsetneqq;</code> <td> U+02ACB U+0FE00 <td> <span class="glyph compound">⫋︀</span> <tr id=entity-varsupsetneq><td> <code>varsupsetneq;</code> <td> U+0228B U+0FE00 <td> <span class="glyph compound">⊋︀</span> <tr id=entity-varsupsetneqq><td> <code>varsupsetneqq;</code> <td> U+02ACC U+0FE00 <td> <span class="glyph compound">⫌︀</span> <tr id=entity-vartheta><td> <code>vartheta;</code> <td> U+003D1 <td> <span class=glyph>ϑ</span> <tr id=entity-vartriangleleft><td> <code>vartriangleleft;</code> <td> U+022B2 <td> <span class=glyph>⊲</span> <tr id=entity-vartriangleright><td> <code>vartriangleright;</code> <td> U+022B3 <td> <span class=glyph>⊳</span> <tr id=entity-Vbar><td> <code>Vbar;</code> <td> U+02AEB <td> <span class=glyph>⫫</span> <tr id=entity-vBar><td> <code>vBar;</code> <td> U+02AE8 <td> <span class=glyph>⫨</span> <tr id=entity-vBarv><td> <code>vBarv;</code> <td> U+02AE9 <td> <span class=glyph>⫩</span> <tr id=entity-Vcy><td> <code>Vcy;</code> <td> U+00412 <td> <span class=glyph>В</span> <tr id=entity-vcy><td> <code>vcy;</code> <td> U+00432 <td> <span class=glyph>в</span> <tr id=entity-VDash><td> <code>VDash;</code> <td> U+022AB <td> <span class=glyph>⊫</span> <tr id=entity-Vdash><td> <code>Vdash;</code> <td> U+022A9 <td> <span class=glyph>⊩</span> <tr id=entity-vDash><td> <code>vDash;</code> <td> U+022A8 <td> <span class=glyph>⊨</span> <tr id=entity-vdash><td> <code>vdash;</code> <td> U+022A2 <td> <span class=glyph>⊢</span> <tr id=entity-Vdashl><td> <code>Vdashl;</code> <td> U+02AE6 <td> <span class=glyph>⫦</span> <tr id=entity-Vee><td> <code>Vee;</code> <td> U+022C1 <td> <span class=glyph>⋁</span> <tr id=entity-vee><td> <code>vee;</code> <td> U+02228 <td> <span class=glyph>∨</span> <tr id=entity-veebar><td> <code>veebar;</code> <td> U+022BB <td> <span class=glyph>⊻</span> <tr id=entity-veeeq><td> <code>veeeq;</code> <td> U+0225A <td> <span class=glyph>≚</span> <tr id=entity-vellip><td> <code>vellip;</code> <td> U+022EE <td> <span class=glyph>⋮</span> <tr id=entity-Verbar><td> <code>Verbar;</code> <td> U+02016 <td> <span class=glyph>‖</span> <tr id=entity-verbar><td> <code>verbar;</code> <td> U+0007C <td> <span class=glyph>|</span> <tr id=entity-Vert><td> <code>Vert;</code> <td> U+02016 <td> <span class=glyph>‖</span> <tr id=entity-vert><td> <code>vert;</code> <td> U+0007C <td> <span class=glyph>|</span> <tr id=entity-VerticalBar><td> <code>VerticalBar;</code> <td> U+02223 <td> <span class=glyph>∣</span> <tr id=entity-VerticalLine><td> <code>VerticalLine;</code> <td> U+0007C <td> <span class=glyph>|</span> <tr id=entity-VerticalSeparator><td> <code>VerticalSeparator;</code> <td> U+02758 <td> <span class=glyph>❘</span> <tr id=entity-VerticalTilde><td> <code>VerticalTilde;</code> <td> U+02240 <td> <span class=glyph>≀</span> <tr id=entity-VeryThinSpace><td> <code>VeryThinSpace;</code> <td> U+0200A <td> <span class=glyph> </span> <tr id=entity-Vfr><td> <code>Vfr;</code> <td> U+1D519 <td> <span class=glyph>𝔙</span> <tr id=entity-vfr><td> <code>vfr;</code> <td> U+1D533 <td> <span class=glyph>𝔳</span> <tr id=entity-vltri><td> <code>vltri;</code> <td> U+022B2 <td> <span class=glyph>⊲</span> <tr id=entity-vnsub><td> <code>vnsub;</code> <td> U+02282 U+020D2 <td> <span class="glyph compound">⊂⃒</span> <tr id=entity-vnsup><td> <code>vnsup;</code> <td> U+02283 U+020D2 <td> <span class="glyph compound">⊃⃒</span> <tr id=entity-Vopf><td> <code>Vopf;</code> <td> U+1D54D <td> <span class=glyph>𝕍</span> <tr id=entity-vopf><td> <code>vopf;</code> <td> U+1D567 <td> <span class=glyph>𝕧</span> <tr id=entity-vprop><td> <code>vprop;</code> <td> U+0221D <td> <span class=glyph>∝</span> <tr id=entity-vrtri><td> <code>vrtri;</code> <td> U+022B3 <td> <span class=glyph>⊳</span> <tr id=entity-Vscr><td> <code>Vscr;</code> <td> U+1D4B1 <td> <span class=glyph>𝒱</span> <tr id=entity-vscr><td> <code>vscr;</code> <td> U+1D4CB <td> <span class=glyph>𝓋</span> <tr id=entity-vsubnE><td> <code>vsubnE;</code> <td> U+02ACB U+0FE00 <td> <span class="glyph compound">⫋︀</span> <tr id=entity-vsubne><td> <code>vsubne;</code> <td> U+0228A U+0FE00 <td> <span class="glyph compound">⊊︀</span> <tr id=entity-vsupnE><td> <code>vsupnE;</code> <td> U+02ACC U+0FE00 <td> <span class="glyph compound">⫌︀</span> <tr id=entity-vsupne><td> <code>vsupne;</code> <td> U+0228B U+0FE00 <td> <span class="glyph compound">⊋︀</span> <tr id=entity-Vvdash><td> <code>Vvdash;</code> <td> U+022AA <td> <span class=glyph>⊪</span> <tr id=entity-vzigzag><td> <code>vzigzag;</code> <td> U+0299A <td> <span class=glyph>⦚</span> <tr id=entity-Wcirc><td> <code>Wcirc;</code> <td> U+00174 <td> <span class=glyph>Ŵ</span> <tr id=entity-wcirc><td> <code>wcirc;</code> <td> U+00175 <td> <span class=glyph>ŵ</span> <tr id=entity-wedbar><td> <code>wedbar;</code> <td> U+02A5F <td> <span class=glyph>⩟</span> <tr id=entity-Wedge><td> <code>Wedge;</code> <td> U+022C0 <td> <span class=glyph>⋀</span> <tr id=entity-wedge><td> <code>wedge;</code> <td> U+02227 <td> <span class=glyph>∧</span> <tr id=entity-wedgeq><td> <code>wedgeq;</code> <td> U+02259 <td> <span class=glyph>≙</span> <tr id=entity-weierp><td> <code>weierp;</code> <td> U+02118 <td> <span class=glyph>℘</span> <tr id=entity-Wfr><td> <code>Wfr;</code> <td> U+1D51A <td> <span class=glyph>𝔚</span> <tr id=entity-wfr><td> <code>wfr;</code> <td> U+1D534 <td> <span class=glyph>𝔴</span> <tr id=entity-Wopf><td> <code>Wopf;</code> <td> U+1D54E <td> <span class=glyph>𝕎</span> <tr id=entity-wopf><td> <code>wopf;</code> <td> U+1D568 <td> <span class=glyph>𝕨</span> <tr id=entity-wp><td> <code>wp;</code> <td> U+02118 <td> <span class=glyph>℘</span> <tr id=entity-wr><td> <code>wr;</code> <td> U+02240 <td> <span class=glyph>≀</span> <tr id=entity-wreath><td> <code>wreath;</code> <td> U+02240 <td> <span class=glyph>≀</span> <tr id=entity-Wscr><td> <code>Wscr;</code> <td> U+1D4B2 <td> <span class=glyph>𝒲</span> <tr id=entity-wscr><td> <code>wscr;</code> <td> U+1D4CC <td> <span class=glyph>𝓌</span> <tr id=entity-xcap><td> <code>xcap;</code> <td> U+022C2 <td> <span class=glyph>⋂</span> <tr id=entity-xcirc><td> <code>xcirc;</code> <td> U+025EF <td> <span class=glyph>◯</span> <tr id=entity-xcup><td> <code>xcup;</code> <td> U+022C3 <td> <span class=glyph>⋃</span> <tr id=entity-xdtri><td> <code>xdtri;</code> <td> U+025BD <td> <span class=glyph>▽</span> <tr id=entity-Xfr><td> <code>Xfr;</code> <td> U+1D51B <td> <span class=glyph>𝔛</span> <tr id=entity-xfr><td> <code>xfr;</code> <td> U+1D535 <td> <span class=glyph>𝔵</span> <tr id=entity-xhArr><td> <code>xhArr;</code> <td> U+027FA <td> <span class=glyph>⟺</span> <tr id=entity-xharr><td> <code>xharr;</code> <td> U+027F7 <td> <span class=glyph>⟷</span> <tr id=entity-Xi><td> <code>Xi;</code> <td> U+0039E <td> <span class=glyph>Ξ</span> <tr id=entity-xi><td> <code>xi;</code> <td> U+003BE <td> <span class=glyph>ξ</span> <tr id=entity-xlArr><td> <code>xlArr;</code> <td> U+027F8 <td> <span class=glyph>⟸</span> <tr id=entity-xlarr><td> <code>xlarr;</code> <td> U+027F5 <td> <span class=glyph>⟵</span> <tr id=entity-xmap><td> <code>xmap;</code> <td> U+027FC <td> <span class=glyph>⟼</span> <tr id=entity-xnis><td> <code>xnis;</code> <td> U+022FB <td> <span class=glyph>⋻</span> <tr id=entity-xodot><td> <code>xodot;</code> <td> U+02A00 <td> <span class=glyph>⨀</span> <tr id=entity-Xopf><td> <code>Xopf;</code> <td> U+1D54F <td> <span class=glyph>𝕏</span> <tr id=entity-xopf><td> <code>xopf;</code> <td> U+1D569 <td> <span class=glyph>𝕩</span> <tr id=entity-xoplus><td> <code>xoplus;</code> <td> U+02A01 <td> <span class=glyph>⨁</span> <tr id=entity-xotime><td> <code>xotime;</code> <td> U+02A02 <td> <span class=glyph>⨂</span> <tr id=entity-xrArr><td> <code>xrArr;</code> <td> U+027F9 <td> <span class=glyph>⟹</span> <tr id=entity-xrarr><td> <code>xrarr;</code> <td> U+027F6 <td> <span class=glyph>⟶</span> <tr id=entity-Xscr><td> <code>Xscr;</code> <td> U+1D4B3 <td> <span class=glyph>𝒳</span> <tr id=entity-xscr><td> <code>xscr;</code> <td> U+1D4CD <td> <span class=glyph>𝓍</span> <tr id=entity-xsqcup><td> <code>xsqcup;</code> <td> U+02A06 <td> <span class=glyph>⨆</span> <tr id=entity-xuplus><td> <code>xuplus;</code> <td> U+02A04 <td> <span class=glyph>⨄</span> <tr id=entity-xutri><td> <code>xutri;</code> <td> U+025B3 <td> <span class=glyph>△</span> <tr id=entity-xvee><td> <code>xvee;</code> <td> U+022C1 <td> <span class=glyph>⋁</span> <tr id=entity-xwedge><td> <code>xwedge;</code> <td> U+022C0 <td> <span class=glyph>⋀</span> <tr id=entity-Yacute><td> <code>Yacute;</code> <td> U+000DD <td> <span class=glyph>Ý</span> <tr id=entity-Yacute-legacy class=impl><td> <code>Yacute</code> <td> U+000DD <td> <span>Ý</span> <tr id=entity-yacute><td> <code>yacute;</code> <td> U+000FD <td> <span class=glyph>ý</span> <tr id=entity-yacute-legacy class=impl><td> <code>yacute</code> <td> U+000FD <td> <span>ý</span> <tr id=entity-YAcy><td> <code>YAcy;</code> <td> U+0042F <td> <span class=glyph>Я</span> <tr id=entity-yacy><td> <code>yacy;</code> <td> U+0044F <td> <span class=glyph>я</span> <tr id=entity-Ycirc><td> <code>Ycirc;</code> <td> U+00176 <td> <span class=glyph>Ŷ</span> <tr id=entity-ycirc><td> <code>ycirc;</code> <td> U+00177 <td> <span class=glyph>ŷ</span> <tr id=entity-Ycy><td> <code>Ycy;</code> <td> U+0042B <td> <span class=glyph>Ы</span> <tr id=entity-ycy><td> <code>ycy;</code> <td> U+0044B <td> <span class=glyph>ы</span> <tr id=entity-yen><td> <code>yen;</code> <td> U+000A5 <td> <span class=glyph>¥</span> <tr id=entity-yen-legacy class=impl><td> <code>yen</code> <td> U+000A5 <td> <span>¥</span> <tr id=entity-Yfr><td> <code>Yfr;</code> <td> U+1D51C <td> <span class=glyph>𝔜</span> <tr id=entity-yfr><td> <code>yfr;</code> <td> U+1D536 <td> <span class=glyph>𝔶</span> <tr id=entity-YIcy><td> <code>YIcy;</code> <td> U+00407 <td> <span class=glyph>Ї</span> <tr id=entity-yicy><td> <code>yicy;</code> <td> U+00457 <td> <span class=glyph>ї</span> <tr id=entity-Yopf><td> <code>Yopf;</code> <td> U+1D550 <td> <span class=glyph>𝕐</span> <tr id=entity-yopf><td> <code>yopf;</code> <td> U+1D56A <td> <span class=glyph>𝕪</span> <tr id=entity-Yscr><td> <code>Yscr;</code> <td> U+1D4B4 <td> <span class=glyph>𝒴</span> <tr id=entity-yscr><td> <code>yscr;</code> <td> U+1D4CE <td> <span class=glyph>𝓎</span> <tr id=entity-YUcy><td> <code>YUcy;</code> <td> U+0042E <td> <span class=glyph>Ю</span> <tr id=entity-yucy><td> <code>yucy;</code> <td> U+0044E <td> <span class=glyph>ю</span> <tr id=entity-Yuml><td> <code>Yuml;</code> <td> U+00178 <td> <span class=glyph>Ÿ</span> <tr id=entity-yuml><td> <code>yuml;</code> <td> U+000FF <td> <span class=glyph>ÿ</span> <tr id=entity-yuml-legacy class=impl><td> <code>yuml</code> <td> U+000FF <td> <span>ÿ</span> <tr id=entity-Zacute><td> <code>Zacute;</code> <td> U+00179 <td> <span class=glyph>Ź</span> <tr id=entity-zacute><td> <code>zacute;</code> <td> U+0017A <td> <span class=glyph>ź</span> <tr id=entity-Zcaron><td> <code>Zcaron;</code> <td> U+0017D <td> <span class=glyph>Ž</span> <tr id=entity-zcaron><td> <code>zcaron;</code> <td> U+0017E <td> <span class=glyph>ž</span> <tr id=entity-Zcy><td> <code>Zcy;</code> <td> U+00417 <td> <span class=glyph>З</span> <tr id=entity-zcy><td> <code>zcy;</code> <td> U+00437 <td> <span class=glyph>з</span> <tr id=entity-Zdot><td> <code>Zdot;</code> <td> U+0017B <td> <span class=glyph>Ż</span> <tr id=entity-zdot><td> <code>zdot;</code> <td> U+0017C <td> <span class=glyph>ż</span> <tr id=entity-zeetrf><td> <code>zeetrf;</code> <td> U+02128 <td> <span class=glyph>ℨ</span> <tr id=entity-ZeroWidthSpace><td> <code>ZeroWidthSpace;</code> <td> U+0200B <td> <span class=glyph></span> <tr id=entity-Zeta><td> <code>Zeta;</code> <td> U+00396 <td> <span class=glyph>Ζ</span> <tr id=entity-zeta><td> <code>zeta;</code> <td> U+003B6 <td> <span class=glyph>ζ</span> <tr id=entity-Zfr><td> <code>Zfr;</code> <td> U+02128 <td> <span class=glyph>ℨ</span> <tr id=entity-zfr><td> <code>zfr;</code> <td> U+1D537 <td> <span class=glyph>𝔷</span> <tr id=entity-ZHcy><td> <code>ZHcy;</code> <td> U+00416 <td> <span class=glyph>Ж</span> <tr id=entity-zhcy><td> <code>zhcy;</code> <td> U+00436 <td> <span class=glyph>ж</span> <tr id=entity-zigrarr><td> <code>zigrarr;</code> <td> U+021DD <td> <span class=glyph>⇝</span> <tr id=entity-Zopf><td> <code>Zopf;</code> <td> U+02124 <td> <span class=glyph>ℤ</span> <tr id=entity-zopf><td> <code>zopf;</code> <td> U+1D56B <td> <span class=glyph>𝕫</span> <tr id=entity-Zscr><td> <code>Zscr;</code> <td> U+1D4B5 <td> <span class=glyph>𝒵</span> <tr id=entity-zscr><td> <code>zscr;</code> <td> U+1D4CF <td> <span class=glyph>𝓏</span> <tr id=entity-zwj><td> <code>zwj;</code> <td> U+0200D <td> <span class=glyph></span> <tr id=entity-zwnj><td> <code>zwnj;</code> <td> U+0200C <td> <span class=glyph></span> </table>
-
- </div>
- <p>This data is also available <a href=entities.json>as a JSON file</a>.</p>
- <p><i>The glyphs displayed above are non-normative. Refer to the Unicode specifications for formal
- definitions of the characters listed above.</i></p>
- <h2 id=the-xhtml-syntax>13 <dfn id=xhtml>The XHTML syntax</dfn></h2>
- <p class=note>This section only describes the rules for XML resources. Rules for
- <code id=the-xhtml-syntax:text/html><a href=#text/html>text/html</a></code> resources are discussed in the section above entitled "<a href=#syntax id=the-xhtml-syntax:syntax>The HTML
- syntax</a>".</p>
-
- <h3 id=writing-xhtml-documents>13.1 Writing XHTML documents</h3>
-
- <p>The syntax for using HTML with XML, whether in XHTML documents or embedded in other XML
- documents, is defined in the XML and Namespaces in XML specifications. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a></p>
- <p>This specification does not define any syntax-level requirements beyond those defined for XML
- proper.</p>
- <p>XML documents may contain a <code>DOCTYPE</code> if desired, but this is not required
- to conform to this specification. This specification does not define a public or system
- identifier, nor provide a formal DTD.</p>
- <p class=note>According to the XML specification, XML processors are not guaranteed to process
- the external DTD subset referenced in the DOCTYPE. This means, for example, that using <a href=http://www.w3.org/TR/xml/#dt-entref>entity references</a> for characters in XHTML documents
- is unsafe if they are defined in an external file (except for <code>&lt;</code>,
- <code>&gt;</code>, <code>&amp;</code>, <code>&quot;</code>
- and <code>&apos;</code>).</p>
-
- <h3 id=parsing-xhtml-documents>13.2 Parsing XHTML documents</h3>
- <p>This section describes the relationship between XML and the DOM, with a particular emphasis on
- how this interacts with HTML.</p>
- <p>An <dfn id=xml-parser>XML parser</dfn>, for the purposes of this specification, is a construct that follows
- the rules given in the XML specification to map a string of bytes or characters into a
- <code id=parsing-xhtml-documents:document><a href=#document>Document</a></code> object.</p>
- <p class=note>At the time of writing, no such rules actually exist.</p>
- <p>An <a href=#xml-parser id=parsing-xhtml-documents:xml-parser>XML parser</a> is either associated with a <code id=parsing-xhtml-documents:document-2><a href=#document>Document</a></code> object when it is
- created, or creates one implicitly.</p>
- <p>This <code id=parsing-xhtml-documents:document-3><a href=#document>Document</a></code> must then be populated with DOM nodes that represent the tree
- structure of the input passed to the parser, as defined by the XML specification, the Namespaces
- in XML specification, and the DOM specification. DOM mutation events must not fire for the
- operations that the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-2>XML parser</a> performs on the <code id=parsing-xhtml-documents:document-4><a href=#document>Document</a></code>'s tree, but the
- user agent must act as if elements and attributes were individually appended and set respectively
- so as to trigger rules in this specification regarding what happens when an element is inserted
- into a document or has its attributes set, and the DOM specification's requirements regarding
- mutation observers mean that mutation observers <em>are</em> fired (unlike mutation events). <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a> <a href=#refsDOM>[DOM]</a> <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>Between the time an element's start tag is parsed and the time either the element's end tag is
- parsed or the parser detects a well-formedness error, the user agent must act as if the element
- was in a <a href=#stack-of-open-elements id=parsing-xhtml-documents:stack-of-open-elements>stack of open elements</a>.</p>
- <p class=note>This is used, e.g. by the <code id=parsing-xhtml-documents:the-object-element><a href=#the-object-element>object</a></code> element to avoid instantiating plugins
- before the <code id=parsing-xhtml-documents:the-param-element><a href=#the-param-element>param</a></code> element children have been parsed.</p>
- <p>This specification provides the following additional information that user agents should use
- when retrieving an external entity: the public identifiers given in the following list all
- correspond to <a href=data:application/xml-dtd;base64,PCFFTlRJVFkgVGFiICImI3g5OyI%2BPCFFTlRJVFkgTmV3TGluZSAiJiN4QTsiPjwhRU5USVRZIGV4Y2wgIiYjeDIxOyI%2BPCFFTlRJVFkgcXVvdCAiJiN4MjI7Ij48IUVOVElUWSBRVU9UICImI3gyMjsiPjwhRU5USVRZIG51bSAiJiN4MjM7Ij48IUVOVElUWSBkb2xsYXIgIiYjeDI0OyI%2BPCFFTlRJVFkgcGVyY250ICImI3gyNTsiPjwhRU5USVRZIGFtcCAiJiN4MjY7Ij48IUVOVElUWSBBTVAgIiYjeDI2OyI%2BPCFFTlRJVFkgYXBvcyAiJiN4Mjc7Ij48IUVOVElUWSBscGFyICImI3gyODsiPjwhRU5USVRZIHJwYXIgIiYjeDI5OyI%2BPCFFTlRJVFkgYXN0ICImI3gyQTsiPjwhRU5USVRZIG1pZGFzdCAiJiN4MkE7Ij48IUVOVElUWSBwbHVzICImI3gyQjsiPjwhRU5USVRZIGNvbW1hICImI3gyQzsiPjwhRU5USVRZIHBlcmlvZCAiJiN4MkU7Ij48IUVOVElUWSBzb2wgIiYjeDJGOyI%2BPCFFTlRJVFkgY29sb24gIiYjeDNBOyI%2BPCFFTlRJVFkgc2VtaSAiJiN4M0I7Ij48IUVOVElUWSBsdCAiJiN4M0M7Ij48IUVOVElUWSBMVCAiJiN4M0M7Ij48IUVOVElUWSBudmx0ICImI3gzQzsmI3gyMEQyOyI%2BPCFFTlRJVFkgZXF1YWxzICImI3gzRDsiPjwhRU5USVRZIGJuZSAiJiN4M0Q7JiN4MjBFNTsiPjwhRU5USVRZIGd0ICImI3gzRTsiPjwhRU5USVRZIEdUICImI3gzRTsiPjwhRU5USVRZIG52Z3QgIiYjeDNFOyYjeDIwRDI7Ij48IUVOVElUWSBxdWVzdCAiJiN4M0Y7Ij48IUVOVElUWSBjb21tYXQgIiYjeDQwOyI%2BPCFFTlRJVFkgbHNxYiAiJiN4NUI7Ij48IUVOVElUWSBsYnJhY2sgIiYjeDVCOyI%2BPCFFTlRJVFkgYnNvbCAiJiN4NUM7Ij48IUVOVElUWSByc3FiICImI3g1RDsiPjwhRU5USVRZIHJicmFjayAiJiN4NUQ7Ij48IUVOVElUWSBIYXQgIiYjeDVFOyI%2BPCFFTlRJVFkgbG93YmFyICImI3g1RjsiPjwhRU5USVRZIFVuZGVyQmFyICImI3g1RjsiPjwhRU5USVRZIGdyYXZlICImI3g2MDsiPjwhRU5USVRZIERpYWNyaXRpY2FsR3JhdmUgIiYjeDYwOyI%2BPCFFTlRJVFkgZmpsaWcgIiYjeDY2OyYjeDZBOyI%2BPCFFTlRJVFkgbGN1YiAiJiN4N0I7Ij48IUVOVElUWSBsYnJhY2UgIiYjeDdCOyI%2BPCFFTlRJVFkgdmVyYmFyICImI3g3QzsiPjwhRU5USVRZIHZlcnQgIiYjeDdDOyI%2BPCFFTlRJVFkgVmVydGljYWxMaW5lICImI3g3QzsiPjwhRU5USVRZIHJjdWIgIiYjeDdEOyI%2BPCFFTlRJVFkgcmJyYWNlICImI3g3RDsiPjwhRU5USVRZIG5ic3AgIiYjeEEwOyI%2BPCFFTlRJVFkgTm9uQnJlYWtpbmdTcGFjZSAiJiN4QTA7Ij48IUVOVElUWSBpZXhjbCAiJiN4QTE7Ij48IUVOVElUWSBjZW50ICImI3hBMjsiPjwhRU5USVRZIHBvdW5kICImI3hBMzsiPjwhRU5USVRZIGN1cnJlbiAiJiN4QTQ7Ij48IUVOVElUWSB5ZW4gIiYjeEE1OyI%2BPCFFTlRJVFkgYnJ2YmFyICImI3hBNjsiPjwhRU5USVRZIHNlY3QgIiYjeEE3OyI%2BPCFFTlRJVFkgRG90ICImI3hBODsiPjwhRU5USVRZIGRpZSAiJiN4QTg7Ij48IUVOVElUWSBEb3VibGVEb3QgIiYjeEE4OyI%2BPCFFTlRJVFkgdW1sICImI3hBODsiPjwhRU5USVRZIGNvcHkgIiYjeEE5OyI%2BPCFFTlRJVFkgQ09QWSAiJiN4QTk7Ij48IUVOVElUWSBvcmRmICImI3hBQTsiPjwhRU5USVRZIGxhcXVvICImI3hBQjsiPjwhRU5USVRZIG5vdCAiJiN4QUM7Ij48IUVOVElUWSBzaHkgIiYjeEFEOyI%2BPCFFTlRJVFkgcmVnICImI3hBRTsiPjwhRU5USVRZIGNpcmNsZWRSICImI3hBRTsiPjwhRU5USVRZIFJFRyAiJiN4QUU7Ij48IUVOVElUWSBtYWNyICImI3hBRjsiPjwhRU5USVRZIHN0cm5zICImI3hBRjsiPjwhRU5USVRZIGRlZyAiJiN4QjA7Ij48IUVOVElUWSBwbHVzbW4gIiYjeEIxOyI%2BPCFFTlRJVFkgcG0gIiYjeEIxOyI%2BPCFFTlRJVFkgUGx1c01pbnVzICImI3hCMTsiPjwhRU5USVRZIHN1cDIgIiYjeEIyOyI%2BPCFFTlRJVFkgc3VwMyAiJiN4QjM7Ij48IUVOVElUWSBhY3V0ZSAiJiN4QjQ7Ij48IUVOVElUWSBEaWFjcml0aWNhbEFjdXRlICImI3hCNDsiPjwhRU5USVRZIG1pY3JvICImI3hCNTsiPjwhRU5USVRZIHBhcmEgIiYjeEI2OyI%2BPCFFTlRJVFkgbWlkZG90ICImI3hCNzsiPjwhRU5USVRZIGNlbnRlcmRvdCAiJiN4Qjc7Ij48IUVOVElUWSBDZW50ZXJEb3QgIiYjeEI3OyI%2BPCFFTlRJVFkgY2VkaWwgIiYjeEI4OyI%2BPCFFTlRJVFkgQ2VkaWxsYSAiJiN4Qjg7Ij48IUVOVElUWSBzdXAxICImI3hCOTsiPjwhRU5USVRZIG9yZG0gIiYjeEJBOyI%2BPCFFTlRJVFkgcmFxdW8gIiYjeEJCOyI%2BPCFFTlRJVFkgZnJhYzE0ICImI3hCQzsiPjwhRU5USVRZIGZyYWMxMiAiJiN4QkQ7Ij48IUVOVElUWSBoYWxmICImI3hCRDsiPjwhRU5USVRZIGZyYWMzNCAiJiN4QkU7Ij48IUVOVElUWSBpcXVlc3QgIiYjeEJGOyI%2BPCFFTlRJVFkgQWdyYXZlICImI3hDMDsiPjwhRU5USVRZIEFhY3V0ZSAiJiN4QzE7Ij48IUVOVElUWSBBY2lyYyAiJiN4QzI7Ij48IUVOVElUWSBBdGlsZGUgIiYjeEMzOyI%2BPCFFTlRJVFkgQXVtbCAiJiN4QzQ7Ij48IUVOVElUWSBBcmluZyAiJiN4QzU7Ij48IUVOVElUWSBhbmdzdCAiJiN4QzU7Ij48IUVOVElUWSBBRWxpZyAiJiN4QzY7Ij48IUVOVElUWSBDY2VkaWwgIiYjeEM3OyI%2BPCFFTlRJVFkgRWdyYXZlICImI3hDODsiPjwhRU5USVRZIEVhY3V0ZSAiJiN4Qzk7Ij48IUVOVElUWSBFY2lyYyAiJiN4Q0E7Ij48IUVOVElUWSBFdW1sICImI3hDQjsiPjwhRU5USVRZIElncmF2ZSAiJiN4Q0M7Ij48IUVOVElUWSBJYWN1dGUgIiYjeENEOyI%2BPCFFTlRJVFkgSWNpcmMgIiYjeENFOyI%2BPCFFTlRJVFkgSXVtbCAiJiN4Q0Y7Ij48IUVOVElUWSBFVEggIiYjeEQwOyI%2BPCFFTlRJVFkgTnRpbGRlICImI3hEMTsiPjwhRU5USVRZIE9ncmF2ZSAiJiN4RDI7Ij48IUVOVElUWSBPYWN1dGUgIiYjeEQzOyI%2BPCFFTlRJVFkgT2NpcmMgIiYjeEQ0OyI%2BPCFFTlRJVFkgT3RpbGRlICImI3hENTsiPjwhRU5USVRZIE91bWwgIiYjeEQ2OyI%2BPCFFTlRJVFkgdGltZXMgIiYjeEQ3OyI%2BPCFFTlRJVFkgT3NsYXNoICImI3hEODsiPjwhRU5USVRZIFVncmF2ZSAiJiN4RDk7Ij48IUVOVElUWSBVYWN1dGUgIiYjeERBOyI%2BPCFFTlRJVFkgVWNpcmMgIiYjeERCOyI%2BPCFFTlRJVFkgVXVtbCAiJiN4REM7Ij48IUVOVElUWSBZYWN1dGUgIiYjeEREOyI%2BPCFFTlRJVFkgVEhPUk4gIiYjeERFOyI%2BPCFFTlRJVFkgc3psaWcgIiYjeERGOyI%2BPCFFTlRJVFkgYWdyYXZlICImI3hFMDsiPjwhRU5USVRZIGFhY3V0ZSAiJiN4RTE7Ij48IUVOVElUWSBhY2lyYyAiJiN4RTI7Ij48IUVOVElUWSBhdGlsZGUgIiYjeEUzOyI%2BPCFFTlRJVFkgYXVtbCAiJiN4RTQ7Ij48IUVOVElUWSBhcmluZyAiJiN4RTU7Ij48IUVOVElUWSBhZWxpZyAiJiN4RTY7Ij48IUVOVElUWSBjY2VkaWwgIiYjeEU3OyI%2BPCFFTlRJVFkgZWdyYXZlICImI3hFODsiPjwhRU5USVRZIGVhY3V0ZSAiJiN4RTk7Ij48IUVOVElUWSBlY2lyYyAiJiN4RUE7Ij48IUVOVElUWSBldW1sICImI3hFQjsiPjwhRU5USVRZIGlncmF2ZSAiJiN4RUM7Ij48IUVOVElUWSBpYWN1dGUgIiYjeEVEOyI%2BPCFFTlRJVFkgaWNpcmMgIiYjeEVFOyI%2BPCFFTlRJVFkgaXVtbCAiJiN4RUY7Ij48IUVOVElUWSBldGggIiYjeEYwOyI%2BPCFFTlRJVFkgbnRpbGRlICImI3hGMTsiPjwhRU5USVRZIG9ncmF2ZSAiJiN4RjI7Ij48IUVOVElUWSBvYWN1dGUgIiYjeEYzOyI%2BPCFFTlRJVFkgb2NpcmMgIiYjeEY0OyI%2BPCFFTlRJVFkgb3RpbGRlICImI3hGNTsiPjwhRU5USVRZIG91bWwgIiYjeEY2OyI%2BPCFFTlRJVFkgZGl2aWRlICImI3hGNzsiPjwhRU5USVRZIGRpdiAiJiN4Rjc7Ij48IUVOVElUWSBvc2xhc2ggIiYjeEY4OyI%2BPCFFTlRJVFkgdWdyYXZlICImI3hGOTsiPjwhRU5USVRZIHVhY3V0ZSAiJiN4RkE7Ij48IUVOVElUWSB1Y2lyYyAiJiN4RkI7Ij48IUVOVElUWSB1dW1sICImI3hGQzsiPjwhRU5USVRZIHlhY3V0ZSAiJiN4RkQ7Ij48IUVOVElUWSB0aG9ybiAiJiN4RkU7Ij48IUVOVElUWSB5dW1sICImI3hGRjsiPjwhRU5USVRZIEFtYWNyICImI3gxMDA7Ij48IUVOVElUWSBhbWFjciAiJiN4MTAxOyI%2BPCFFTlRJVFkgQWJyZXZlICImI3gxMDI7Ij48IUVOVElUWSBhYnJldmUgIiYjeDEwMzsiPjwhRU5USVRZIEFvZ29uICImI3gxMDQ7Ij48IUVOVElUWSBhb2dvbiAiJiN4MTA1OyI%2BPCFFTlRJVFkgQ2FjdXRlICImI3gxMDY7Ij48IUVOVElUWSBjYWN1dGUgIiYjeDEwNzsiPjwhRU5USVRZIENjaXJjICImI3gxMDg7Ij48IUVOVElUWSBjY2lyYyAiJiN4MTA5OyI%2BPCFFTlRJVFkgQ2RvdCAiJiN4MTBBOyI%2BPCFFTlRJVFkgY2RvdCAiJiN4MTBCOyI%2BPCFFTlRJVFkgQ2Nhcm9uICImI3gxMEM7Ij48IUVOVElUWSBjY2Fyb24gIiYjeDEwRDsiPjwhRU5USVRZIERjYXJvbiAiJiN4MTBFOyI%2BPCFFTlRJVFkgZGNhcm9uICImI3gxMEY7Ij48IUVOVElUWSBEc3Ryb2sgIiYjeDExMDsiPjwhRU5USVRZIGRzdHJvayAiJiN4MTExOyI%2BPCFFTlRJVFkgRW1hY3IgIiYjeDExMjsiPjwhRU5USVRZIGVtYWNyICImI3gxMTM7Ij48IUVOVElUWSBFZG90ICImI3gxMTY7Ij48IUVOVElUWSBlZG90ICImI3gxMTc7Ij48IUVOVElUWSBFb2dvbiAiJiN4MTE4OyI%2BPCFFTlRJVFkgZW9nb24gIiYjeDExOTsiPjwhRU5USVRZIEVjYXJvbiAiJiN4MTFBOyI%2BPCFFTlRJVFkgZWNhcm9uICImI3gxMUI7Ij48IUVOVElUWSBHY2lyYyAiJiN4MTFDOyI%2BPCFFTlRJVFkgZ2NpcmMgIiYjeDExRDsiPjwhRU5USVRZIEdicmV2ZSAiJiN4MTFFOyI%2BPCFFTlRJVFkgZ2JyZXZlICImI3gxMUY7Ij48IUVOVElUWSBHZG90ICImI3gxMjA7Ij48IUVOVElUWSBnZG90ICImI3gxMjE7Ij48IUVOVElUWSBHY2VkaWwgIiYjeDEyMjsiPjwhRU5USVRZIEhjaXJjICImI3gxMjQ7Ij48IUVOVElUWSBoY2lyYyAiJiN4MTI1OyI%2BPCFFTlRJVFkgSHN0cm9rICImI3gxMjY7Ij48IUVOVElUWSBoc3Ryb2sgIiYjeDEyNzsiPjwhRU5USVRZIEl0aWxkZSAiJiN4MTI4OyI%2BPCFFTlRJVFkgaXRpbGRlICImI3gxMjk7Ij48IUVOVElUWSBJbWFjciAiJiN4MTJBOyI%2BPCFFTlRJVFkgaW1hY3IgIiYjeDEyQjsiPjwhRU5USVRZIElvZ29uICImI3gxMkU7Ij48IUVOVElUWSBpb2dvbiAiJiN4MTJGOyI%2BPCFFTlRJVFkgSWRvdCAiJiN4MTMwOyI%2BPCFFTlRJVFkgaW1hdGggIiYjeDEzMTsiPjwhRU5USVRZIGlub2RvdCAiJiN4MTMxOyI%2BPCFFTlRJVFkgSUpsaWcgIiYjeDEzMjsiPjwhRU5USVRZIGlqbGlnICImI3gxMzM7Ij48IUVOVElUWSBKY2lyYyAiJiN4MTM0OyI%2BPCFFTlRJVFkgamNpcmMgIiYjeDEzNTsiPjwhRU5USVRZIEtjZWRpbCAiJiN4MTM2OyI%2BPCFFTlRJVFkga2NlZGlsICImI3gxMzc7Ij48IUVOVElUWSBrZ3JlZW4gIiYjeDEzODsiPjwhRU5USVRZIExhY3V0ZSAiJiN4MTM5OyI%2BPCFFTlRJVFkgbGFjdXRlICImI3gxM0E7Ij48IUVOVElUWSBMY2VkaWwgIiYjeDEzQjsiPjwhRU5USVRZIGxjZWRpbCAiJiN4MTNDOyI%2BPCFFTlRJVFkgTGNhcm9uICImI3gxM0Q7Ij48IUVOVElUWSBsY2Fyb24gIiYjeDEzRTsiPjwhRU5USVRZIExtaWRvdCAiJiN4MTNGOyI%2BPCFFTlRJVFkgbG1pZG90ICImI3gxNDA7Ij48IUVOVElUWSBMc3Ryb2sgIiYjeDE0MTsiPjwhRU5USVRZIGxzdHJvayAiJiN4MTQyOyI%2BPCFFTlRJVFkgTmFjdXRlICImI3gxNDM7Ij48IUVOVElUWSBuYWN1dGUgIiYjeDE0NDsiPjwhRU5USVRZIE5jZWRpbCAiJiN4MTQ1OyI%2BPCFFTlRJVFkgbmNlZGlsICImI3gxNDY7Ij48IUVOVElUWSBOY2Fyb24gIiYjeDE0NzsiPjwhRU5USVRZIG5jYXJvbiAiJiN4MTQ4OyI%2BPCFFTlRJVFkgbmFwb3MgIiYjeDE0OTsiPjwhRU5USVRZIEVORyAiJiN4MTRBOyI%2BPCFFTlRJVFkgZW5nICImI3gxNEI7Ij48IUVOVElUWSBPbWFjciAiJiN4MTRDOyI%2BPCFFTlRJVFkgb21hY3IgIiYjeDE0RDsiPjwhRU5USVRZIE9kYmxhYyAiJiN4MTUwOyI%2BPCFFTlRJVFkgb2RibGFjICImI3gxNTE7Ij48IUVOVElUWSBPRWxpZyAiJiN4MTUyOyI%2BPCFFTlRJVFkgb2VsaWcgIiYjeDE1MzsiPjwhRU5USVRZIFJhY3V0ZSAiJiN4MTU0OyI%2BPCFFTlRJVFkgcmFjdXRlICImI3gxNTU7Ij48IUVOVElUWSBSY2VkaWwgIiYjeDE1NjsiPjwhRU5USVRZIHJjZWRpbCAiJiN4MTU3OyI%2BPCFFTlRJVFkgUmNhcm9uICImI3gxNTg7Ij48IUVOVElUWSByY2Fyb24gIiYjeDE1OTsiPjwhRU5USVRZIFNhY3V0ZSAiJiN4MTVBOyI%2BPCFFTlRJVFkgc2FjdXRlICImI3gxNUI7Ij48IUVOVElUWSBTY2lyYyAiJiN4MTVDOyI%2BPCFFTlRJVFkgc2NpcmMgIiYjeDE1RDsiPjwhRU5USVRZIFNjZWRpbCAiJiN4MTVFOyI%2BPCFFTlRJVFkgc2NlZGlsICImI3gxNUY7Ij48IUVOVElUWSBTY2Fyb24gIiYjeDE2MDsiPjwhRU5USVRZIHNjYXJvbiAiJiN4MTYxOyI%2BPCFFTlRJVFkgVGNlZGlsICImI3gxNjI7Ij48IUVOVElUWSB0Y2VkaWwgIiYjeDE2MzsiPjwhRU5USVRZIFRjYXJvbiAiJiN4MTY0OyI%2BPCFFTlRJVFkgdGNhcm9uICImI3gxNjU7Ij48IUVOVElUWSBUc3Ryb2sgIiYjeDE2NjsiPjwhRU5USVRZIHRzdHJvayAiJiN4MTY3OyI%2BPCFFTlRJVFkgVXRpbGRlICImI3gxNjg7Ij48IUVOVElUWSB1dGlsZGUgIiYjeDE2OTsiPjwhRU5USVRZIFVtYWNyICImI3gxNkE7Ij48IUVOVElUWSB1bWFjciAiJiN4MTZCOyI%2BPCFFTlRJVFkgVWJyZXZlICImI3gxNkM7Ij48IUVOVElUWSB1YnJldmUgIiYjeDE2RDsiPjwhRU5USVRZIFVyaW5nICImI3gxNkU7Ij48IUVOVElUWSB1cmluZyAiJiN4MTZGOyI%2BPCFFTlRJVFkgVWRibGFjICImI3gxNzA7Ij48IUVOVElUWSB1ZGJsYWMgIiYjeDE3MTsiPjwhRU5USVRZIFVvZ29uICImI3gxNzI7Ij48IUVOVElUWSB1b2dvbiAiJiN4MTczOyI%2BPCFFTlRJVFkgV2NpcmMgIiYjeDE3NDsiPjwhRU5USVRZIHdjaXJjICImI3gxNzU7Ij48IUVOVElUWSBZY2lyYyAiJiN4MTc2OyI%2BPCFFTlRJVFkgeWNpcmMgIiYjeDE3NzsiPjwhRU5USVRZIFl1bWwgIiYjeDE3ODsiPjwhRU5USVRZIFphY3V0ZSAiJiN4MTc5OyI%2BPCFFTlRJVFkgemFjdXRlICImI3gxN0E7Ij48IUVOVElUWSBaZG90ICImI3gxN0I7Ij48IUVOVElUWSB6ZG90ICImI3gxN0M7Ij48IUVOVElUWSBaY2Fyb24gIiYjeDE3RDsiPjwhRU5USVRZIHpjYXJvbiAiJiN4MTdFOyI%2BPCFFTlRJVFkgZm5vZiAiJiN4MTkyOyI%2BPCFFTlRJVFkgaW1wZWQgIiYjeDFCNTsiPjwhRU5USVRZIGdhY3V0ZSAiJiN4MUY1OyI%2BPCFFTlRJVFkgam1hdGggIiYjeDIzNzsiPjwhRU5USVRZIGNpcmMgIiYjeDJDNjsiPjwhRU5USVRZIGNhcm9uICImI3gyQzc7Ij48IUVOVElUWSBIYWNlayAiJiN4MkM3OyI%2BPCFFTlRJVFkgYnJldmUgIiYjeDJEODsiPjwhRU5USVRZIEJyZXZlICImI3gyRDg7Ij48IUVOVElUWSBkb3QgIiYjeDJEOTsiPjwhRU5USVRZIERpYWNyaXRpY2FsRG90ICImI3gyRDk7Ij48IUVOVElUWSByaW5nICImI3gyREE7Ij48IUVOVElUWSBvZ29uICImI3gyREI7Ij48IUVOVElUWSB0aWxkZSAiJiN4MkRDOyI%2BPCFFTlRJVFkgRGlhY3JpdGljYWxUaWxkZSAiJiN4MkRDOyI%2BPCFFTlRJVFkgZGJsYWMgIiYjeDJERDsiPjwhRU5USVRZIERpYWNyaXRpY2FsRG91YmxlQWN1dGUgIiYjeDJERDsiPjwhRU5USVRZIERvd25CcmV2ZSAiJiN4MzExOyI%2BPCFFTlRJVFkgQWxwaGEgIiYjeDM5MTsiPjwhRU5USVRZIEJldGEgIiYjeDM5MjsiPjwhRU5USVRZIEdhbW1hICImI3gzOTM7Ij48IUVOVElUWSBEZWx0YSAiJiN4Mzk0OyI%2BPCFFTlRJVFkgRXBzaWxvbiAiJiN4Mzk1OyI%2BPCFFTlRJVFkgWmV0YSAiJiN4Mzk2OyI%2BPCFFTlRJVFkgRXRhICImI3gzOTc7Ij48IUVOVElUWSBUaGV0YSAiJiN4Mzk4OyI%2BPCFFTlRJVFkgSW90YSAiJiN4Mzk5OyI%2BPCFFTlRJVFkgS2FwcGEgIiYjeDM5QTsiPjwhRU5USVRZIExhbWJkYSAiJiN4MzlCOyI%2BPCFFTlRJVFkgTXUgIiYjeDM5QzsiPjwhRU5USVRZIE51ICImI3gzOUQ7Ij48IUVOVElUWSBYaSAiJiN4MzlFOyI%2BPCFFTlRJVFkgT21pY3JvbiAiJiN4MzlGOyI%2BPCFFTlRJVFkgUGkgIiYjeDNBMDsiPjwhRU5USVRZIFJobyAiJiN4M0ExOyI%2BPCFFTlRJVFkgU2lnbWEgIiYjeDNBMzsiPjwhRU5USVRZIFRhdSAiJiN4M0E0OyI%2BPCFFTlRJVFkgVXBzaWxvbiAiJiN4M0E1OyI%2BPCFFTlRJVFkgUGhpICImI3gzQTY7Ij48IUVOVElUWSBDaGkgIiYjeDNBNzsiPjwhRU5USVRZIFBzaSAiJiN4M0E4OyI%2BPCFFTlRJVFkgT21lZ2EgIiYjeDNBOTsiPjwhRU5USVRZIG9obSAiJiN4M0E5OyI%2BPCFFTlRJVFkgYWxwaGEgIiYjeDNCMTsiPjwhRU5USVRZIGJldGEgIiYjeDNCMjsiPjwhRU5USVRZIGdhbW1hICImI3gzQjM7Ij48IUVOVElUWSBkZWx0YSAiJiN4M0I0OyI%2BPCFFTlRJVFkgZXBzaSAiJiN4M0I1OyI%2BPCFFTlRJVFkgZXBzaWxvbiAiJiN4M0I1OyI%2BPCFFTlRJVFkgemV0YSAiJiN4M0I2OyI%2BPCFFTlRJVFkgZXRhICImI3gzQjc7Ij48IUVOVElUWSB0aGV0YSAiJiN4M0I4OyI%2BPCFFTlRJVFkgaW90YSAiJiN4M0I5OyI%2BPCFFTlRJVFkga2FwcGEgIiYjeDNCQTsiPjwhRU5USVRZIGxhbWJkYSAiJiN4M0JCOyI%2BPCFFTlRJVFkgbXUgIiYjeDNCQzsiPjwhRU5USVRZIG51ICImI3gzQkQ7Ij48IUVOVElUWSB4aSAiJiN4M0JFOyI%2BPCFFTlRJVFkgb21pY3JvbiAiJiN4M0JGOyI%2BPCFFTlRJVFkgcGkgIiYjeDNDMDsiPjwhRU5USVRZIHJobyAiJiN4M0MxOyI%2BPCFFTlRJVFkgc2lnbWF2ICImI3gzQzI7Ij48IUVOVElUWSB2YXJzaWdtYSAiJiN4M0MyOyI%2BPCFFTlRJVFkgc2lnbWFmICImI3gzQzI7Ij48IUVOVElUWSBzaWdtYSAiJiN4M0MzOyI%2BPCFFTlRJVFkgdGF1ICImI3gzQzQ7Ij48IUVOVElUWSB1cHNpICImI3gzQzU7Ij48IUVOVElUWSB1cHNpbG9uICImI3gzQzU7Ij48IUVOVElUWSBwaGkgIiYjeDNDNjsiPjwhRU5USVRZIGNoaSAiJiN4M0M3OyI%2BPCFFTlRJVFkgcHNpICImI3gzQzg7Ij48IUVOVElUWSBvbWVnYSAiJiN4M0M5OyI%2BPCFFTlRJVFkgdGhldGF2ICImI3gzRDE7Ij48IUVOVElUWSB2YXJ0aGV0YSAiJiN4M0QxOyI%2BPCFFTlRJVFkgdGhldGFzeW0gIiYjeDNEMTsiPjwhRU5USVRZIFVwc2kgIiYjeDNEMjsiPjwhRU5USVRZIHVwc2loICImI3gzRDI7Ij48IUVOVElUWSBzdHJhaWdodHBoaSAiJiN4M0Q1OyI%2BPCFFTlRJVFkgcGhpdiAiJiN4M0Q1OyI%2BPCFFTlRJVFkgdmFycGhpICImI3gzRDU7Ij48IUVOVElUWSBwaXYgIiYjeDNENjsiPjwhRU5USVRZIHZhcnBpICImI3gzRDY7Ij48IUVOVElUWSBHYW1tYWQgIiYjeDNEQzsiPjwhRU5USVRZIGdhbW1hZCAiJiN4M0REOyI%2BPCFFTlRJVFkgZGlnYW1tYSAiJiN4M0REOyI%2BPCFFTlRJVFkga2FwcGF2ICImI3gzRjA7Ij48IUVOVElUWSB2YXJrYXBwYSAiJiN4M0YwOyI%2BPCFFTlRJVFkgcmhvdiAiJiN4M0YxOyI%2BPCFFTlRJVFkgdmFycmhvICImI3gzRjE7Ij48IUVOVElUWSBlcHNpdiAiJiN4M0Y1OyI%2BPCFFTlRJVFkgc3RyYWlnaHRlcHNpbG9uICImI3gzRjU7Ij48IUVOVElUWSB2YXJlcHNpbG9uICImI3gzRjU7Ij48IUVOVElUWSBiZXBzaSAiJiN4M0Y2OyI%2BPCFFTlRJVFkgYmFja2Vwc2lsb24gIiYjeDNGNjsiPjwhRU5USVRZIElPY3kgIiYjeDQwMTsiPjwhRU5USVRZIERKY3kgIiYjeDQwMjsiPjwhRU5USVRZIEdKY3kgIiYjeDQwMzsiPjwhRU5USVRZIEp1a2N5ICImI3g0MDQ7Ij48IUVOVElUWSBEU2N5ICImI3g0MDU7Ij48IUVOVElUWSBJdWtjeSAiJiN4NDA2OyI%2BPCFFTlRJVFkgWUljeSAiJiN4NDA3OyI%2BPCFFTlRJVFkgSnNlcmN5ICImI3g0MDg7Ij48IUVOVElUWSBMSmN5ICImI3g0MDk7Ij48IUVOVElUWSBOSmN5ICImI3g0MEE7Ij48IUVOVElUWSBUU0hjeSAiJiN4NDBCOyI%2BPCFFTlRJVFkgS0pjeSAiJiN4NDBDOyI%2BPCFFTlRJVFkgVWJyY3kgIiYjeDQwRTsiPjwhRU5USVRZIERaY3kgIiYjeDQwRjsiPjwhRU5USVRZIEFjeSAiJiN4NDEwOyI%2BPCFFTlRJVFkgQmN5ICImI3g0MTE7Ij48IUVOVElUWSBWY3kgIiYjeDQxMjsiPjwhRU5USVRZIEdjeSAiJiN4NDEzOyI%2BPCFFTlRJVFkgRGN5ICImI3g0MTQ7Ij48IUVOVElUWSBJRWN5ICImI3g0MTU7Ij48IUVOVElUWSBaSGN5ICImI3g0MTY7Ij48IUVOVElUWSBaY3kgIiYjeDQxNzsiPjwhRU5USVRZIEljeSAiJiN4NDE4OyI%2BPCFFTlRJVFkgSmN5ICImI3g0MTk7Ij48IUVOVElUWSBLY3kgIiYjeDQxQTsiPjwhRU5USVRZIExjeSAiJiN4NDFCOyI%2BPCFFTlRJVFkgTWN5ICImI3g0MUM7Ij48IUVOVElUWSBOY3kgIiYjeDQxRDsiPjwhRU5USVRZIE9jeSAiJiN4NDFFOyI%2BPCFFTlRJVFkgUGN5ICImI3g0MUY7Ij48IUVOVElUWSBSY3kgIiYjeDQyMDsiPjwhRU5USVRZIFNjeSAiJiN4NDIxOyI%2BPCFFTlRJVFkgVGN5ICImI3g0MjI7Ij48IUVOVElUWSBVY3kgIiYjeDQyMzsiPjwhRU5USVRZIEZjeSAiJiN4NDI0OyI%2BPCFFTlRJVFkgS0hjeSAiJiN4NDI1OyI%2BPCFFTlRJVFkgVFNjeSAiJiN4NDI2OyI%2BPCFFTlRJVFkgQ0hjeSAiJiN4NDI3OyI%2BPCFFTlRJVFkgU0hjeSAiJiN4NDI4OyI%2BPCFFTlRJVFkgU0hDSGN5ICImI3g0Mjk7Ij48IUVOVElUWSBIQVJEY3kgIiYjeDQyQTsiPjwhRU5USVRZIFljeSAiJiN4NDJCOyI%2BPCFFTlRJVFkgU09GVGN5ICImI3g0MkM7Ij48IUVOVElUWSBFY3kgIiYjeDQyRDsiPjwhRU5USVRZIFlVY3kgIiYjeDQyRTsiPjwhRU5USVRZIFlBY3kgIiYjeDQyRjsiPjwhRU5USVRZIGFjeSAiJiN4NDMwOyI%2BPCFFTlRJVFkgYmN5ICImI3g0MzE7Ij48IUVOVElUWSB2Y3kgIiYjeDQzMjsiPjwhRU5USVRZIGdjeSAiJiN4NDMzOyI%2BPCFFTlRJVFkgZGN5ICImI3g0MzQ7Ij48IUVOVElUWSBpZWN5ICImI3g0MzU7Ij48IUVOVElUWSB6aGN5ICImI3g0MzY7Ij48IUVOVElUWSB6Y3kgIiYjeDQzNzsiPjwhRU5USVRZIGljeSAiJiN4NDM4OyI%2BPCFFTlRJVFkgamN5ICImI3g0Mzk7Ij48IUVOVElUWSBrY3kgIiYjeDQzQTsiPjwhRU5USVRZIGxjeSAiJiN4NDNCOyI%2BPCFFTlRJVFkgbWN5ICImI3g0M0M7Ij48IUVOVElUWSBuY3kgIiYjeDQzRDsiPjwhRU5USVRZIG9jeSAiJiN4NDNFOyI%2BPCFFTlRJVFkgcGN5ICImI3g0M0Y7Ij48IUVOVElUWSByY3kgIiYjeDQ0MDsiPjwhRU5USVRZIHNjeSAiJiN4NDQxOyI%2BPCFFTlRJVFkgdGN5ICImI3g0NDI7Ij48IUVOVElUWSB1Y3kgIiYjeDQ0MzsiPjwhRU5USVRZIGZjeSAiJiN4NDQ0OyI%2BPCFFTlRJVFkga2hjeSAiJiN4NDQ1OyI%2BPCFFTlRJVFkgdHNjeSAiJiN4NDQ2OyI%2BPCFFTlRJVFkgY2hjeSAiJiN4NDQ3OyI%2BPCFFTlRJVFkgc2hjeSAiJiN4NDQ4OyI%2BPCFFTlRJVFkgc2hjaGN5ICImI3g0NDk7Ij48IUVOVElUWSBoYXJkY3kgIiYjeDQ0QTsiPjwhRU5USVRZIHljeSAiJiN4NDRCOyI%2BPCFFTlRJVFkgc29mdGN5ICImI3g0NEM7Ij48IUVOVElUWSBlY3kgIiYjeDQ0RDsiPjwhRU5USVRZIHl1Y3kgIiYjeDQ0RTsiPjwhRU5USVRZIHlhY3kgIiYjeDQ0RjsiPjwhRU5USVRZIGlvY3kgIiYjeDQ1MTsiPjwhRU5USVRZIGRqY3kgIiYjeDQ1MjsiPjwhRU5USVRZIGdqY3kgIiYjeDQ1MzsiPjwhRU5USVRZIGp1a2N5ICImI3g0NTQ7Ij48IUVOVElUWSBkc2N5ICImI3g0NTU7Ij48IUVOVElUWSBpdWtjeSAiJiN4NDU2OyI%2BPCFFTlRJVFkgeWljeSAiJiN4NDU3OyI%2BPCFFTlRJVFkganNlcmN5ICImI3g0NTg7Ij48IUVOVElUWSBsamN5ICImI3g0NTk7Ij48IUVOVElUWSBuamN5ICImI3g0NUE7Ij48IUVOVElUWSB0c2hjeSAiJiN4NDVCOyI%2BPCFFTlRJVFkga2pjeSAiJiN4NDVDOyI%2BPCFFTlRJVFkgdWJyY3kgIiYjeDQ1RTsiPjwhRU5USVRZIGR6Y3kgIiYjeDQ1RjsiPjwhRU5USVRZIGVuc3AgIiYjeDIwMDI7Ij48IUVOVElUWSBlbXNwICImI3gyMDAzOyI%2BPCFFTlRJVFkgZW1zcDEzICImI3gyMDA0OyI%2BPCFFTlRJVFkgZW1zcDE0ICImI3gyMDA1OyI%2BPCFFTlRJVFkgbnVtc3AgIiYjeDIwMDc7Ij48IUVOVElUWSBwdW5jc3AgIiYjeDIwMDg7Ij48IUVOVElUWSB0aGluc3AgIiYjeDIwMDk7Ij48IUVOVElUWSBUaGluU3BhY2UgIiYjeDIwMDk7Ij48IUVOVElUWSBoYWlyc3AgIiYjeDIwMEE7Ij48IUVOVElUWSBWZXJ5VGhpblNwYWNlICImI3gyMDBBOyI%2BPCFFTlRJVFkgWmVyb1dpZHRoU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVZlcnlUaGluU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVRoaW5TcGFjZSAiJiN4MjAwQjsiPjwhRU5USVRZIE5lZ2F0aXZlTWVkaXVtU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSBOZWdhdGl2ZVRoaWNrU3BhY2UgIiYjeDIwMEI7Ij48IUVOVElUWSB6d25qICImI3gyMDBDOyI%2BPCFFTlRJVFkgendqICImI3gyMDBEOyI%2BPCFFTlRJVFkgbHJtICImI3gyMDBFOyI%2BPCFFTlRJVFkgcmxtICImI3gyMDBGOyI%2BPCFFTlRJVFkgaHlwaGVuICImI3gyMDEwOyI%2BPCFFTlRJVFkgZGFzaCAiJiN4MjAxMDsiPjwhRU5USVRZIG5kYXNoICImI3gyMDEzOyI%2BPCFFTlRJVFkgbWRhc2ggIiYjeDIwMTQ7Ij48IUVOVElUWSBob3JiYXIgIiYjeDIwMTU7Ij48IUVOVElUWSBWZXJiYXIgIiYjeDIwMTY7Ij48IUVOVElUWSBWZXJ0ICImI3gyMDE2OyI%2BPCFFTlRJVFkgbHNxdW8gIiYjeDIwMTg7Ij48IUVOVElUWSBPcGVuQ3VybHlRdW90ZSAiJiN4MjAxODsiPjwhRU5USVRZIHJzcXVvICImI3gyMDE5OyI%2BPCFFTlRJVFkgcnNxdW9yICImI3gyMDE5OyI%2BPCFFTlRJVFkgQ2xvc2VDdXJseVF1b3RlICImI3gyMDE5OyI%2BPCFFTlRJVFkgbHNxdW9yICImI3gyMDFBOyI%2BPCFFTlRJVFkgc2JxdW8gIiYjeDIwMUE7Ij48IUVOVElUWSBsZHF1byAiJiN4MjAxQzsiPjwhRU5USVRZIE9wZW5DdXJseURvdWJsZVF1b3RlICImI3gyMDFDOyI%2BPCFFTlRJVFkgcmRxdW8gIiYjeDIwMUQ7Ij48IUVOVElUWSByZHF1b3IgIiYjeDIwMUQ7Ij48IUVOVElUWSBDbG9zZUN1cmx5RG91YmxlUXVvdGUgIiYjeDIwMUQ7Ij48IUVOVElUWSBsZHF1b3IgIiYjeDIwMUU7Ij48IUVOVElUWSBiZHF1byAiJiN4MjAxRTsiPjwhRU5USVRZIGRhZ2dlciAiJiN4MjAyMDsiPjwhRU5USVRZIERhZ2dlciAiJiN4MjAyMTsiPjwhRU5USVRZIGRkYWdnZXIgIiYjeDIwMjE7Ij48IUVOVElUWSBidWxsICImI3gyMDIyOyI%2BPCFFTlRJVFkgYnVsbGV0ICImI3gyMDIyOyI%2BPCFFTlRJVFkgbmxkciAiJiN4MjAyNTsiPjwhRU5USVRZIGhlbGxpcCAiJiN4MjAyNjsiPjwhRU5USVRZIG1sZHIgIiYjeDIwMjY7Ij48IUVOVElUWSBwZXJtaWwgIiYjeDIwMzA7Ij48IUVOVElUWSBwZXJ0ZW5rICImI3gyMDMxOyI%2BPCFFTlRJVFkgcHJpbWUgIiYjeDIwMzI7Ij48IUVOVElUWSBQcmltZSAiJiN4MjAzMzsiPjwhRU5USVRZIHRwcmltZSAiJiN4MjAzNDsiPjwhRU5USVRZIGJwcmltZSAiJiN4MjAzNTsiPjwhRU5USVRZIGJhY2twcmltZSAiJiN4MjAzNTsiPjwhRU5USVRZIGxzYXF1byAiJiN4MjAzOTsiPjwhRU5USVRZIHJzYXF1byAiJiN4MjAzQTsiPjwhRU5USVRZIG9saW5lICImI3gyMDNFOyI%2BPCFFTlRJVFkgT3ZlckJhciAiJiN4MjAzRTsiPjwhRU5USVRZIGNhcmV0ICImI3gyMDQxOyI%2BPCFFTlRJVFkgaHlidWxsICImI3gyMDQzOyI%2BPCFFTlRJVFkgZnJhc2wgIiYjeDIwNDQ7Ij48IUVOVElUWSBic2VtaSAiJiN4MjA0RjsiPjwhRU5USVRZIHFwcmltZSAiJiN4MjA1NzsiPjwhRU5USVRZIE1lZGl1bVNwYWNlICImI3gyMDVGOyI%2BPCFFTlRJVFkgVGhpY2tTcGFjZSAiJiN4MjA1RjsmI3gyMDBBOyI%2BPCFFTlRJVFkgTm9CcmVhayAiJiN4MjA2MDsiPjwhRU5USVRZIEFwcGx5RnVuY3Rpb24gIiYjeDIwNjE7Ij48IUVOVElUWSBhZiAiJiN4MjA2MTsiPjwhRU5USVRZIEludmlzaWJsZVRpbWVzICImI3gyMDYyOyI%2BPCFFTlRJVFkgaXQgIiYjeDIwNjI7Ij48IUVOVElUWSBJbnZpc2libGVDb21tYSAiJiN4MjA2MzsiPjwhRU5USVRZIGljICImI3gyMDYzOyI%2BPCFFTlRJVFkgZXVybyAiJiN4MjBBQzsiPjwhRU5USVRZIHRkb3QgIiYjeDIwREI7Ij48IUVOVElUWSBUcmlwbGVEb3QgIiYjeDIwREI7Ij48IUVOVElUWSBEb3REb3QgIiYjeDIwREM7Ij48IUVOVElUWSBDb3BmICImI3gyMTAyOyI%2BPCFFTlRJVFkgY29tcGxleGVzICImI3gyMTAyOyI%2BPCFFTlRJVFkgaW5jYXJlICImI3gyMTA1OyI%2BPCFFTlRJVFkgZ3NjciAiJiN4MjEwQTsiPjwhRU5USVRZIGhhbWlsdCAiJiN4MjEwQjsiPjwhRU5USVRZIEhpbGJlcnRTcGFjZSAiJiN4MjEwQjsiPjwhRU5USVRZIEhzY3IgIiYjeDIxMEI7Ij48IUVOVElUWSBIZnIgIiYjeDIxMEM7Ij48IUVOVElUWSBQb2luY2FyZXBsYW5lICImI3gyMTBDOyI%2BPCFFTlRJVFkgcXVhdGVybmlvbnMgIiYjeDIxMEQ7Ij48IUVOVElUWSBIb3BmICImI3gyMTBEOyI%2BPCFFTlRJVFkgcGxhbmNraCAiJiN4MjEwRTsiPjwhRU5USVRZIHBsYW5jayAiJiN4MjEwRjsiPjwhRU5USVRZIGhiYXIgIiYjeDIxMEY7Ij48IUVOVElUWSBwbGFua3YgIiYjeDIxMEY7Ij48IUVOVElUWSBoc2xhc2ggIiYjeDIxMEY7Ij48IUVOVElUWSBJc2NyICImI3gyMTEwOyI%2BPCFFTlRJVFkgaW1hZ2xpbmUgIiYjeDIxMTA7Ij48IUVOVElUWSBpbWFnZSAiJiN4MjExMTsiPjwhRU5USVRZIEltICImI3gyMTExOyI%2BPCFFTlRJVFkgaW1hZ3BhcnQgIiYjeDIxMTE7Ij48IUVOVElUWSBJZnIgIiYjeDIxMTE7Ij48IUVOVElUWSBMc2NyICImI3gyMTEyOyI%2BPCFFTlRJVFkgbGFncmFuICImI3gyMTEyOyI%2BPCFFTlRJVFkgTGFwbGFjZXRyZiAiJiN4MjExMjsiPjwhRU5USVRZIGVsbCAiJiN4MjExMzsiPjwhRU5USVRZIE5vcGYgIiYjeDIxMTU7Ij48IUVOVElUWSBuYXR1cmFscyAiJiN4MjExNTsiPjwhRU5USVRZIG51bWVybyAiJiN4MjExNjsiPjwhRU5USVRZIGNvcHlzciAiJiN4MjExNzsiPjwhRU5USVRZIHdlaWVycCAiJiN4MjExODsiPjwhRU5USVRZIHdwICImI3gyMTE4OyI%2BPCFFTlRJVFkgUG9wZiAiJiN4MjExOTsiPjwhRU5USVRZIHByaW1lcyAiJiN4MjExOTsiPjwhRU5USVRZIHJhdGlvbmFscyAiJiN4MjExQTsiPjwhRU5USVRZIFFvcGYgIiYjeDIxMUE7Ij48IUVOVElUWSBSc2NyICImI3gyMTFCOyI%2BPCFFTlRJVFkgcmVhbGluZSAiJiN4MjExQjsiPjwhRU5USVRZIHJlYWwgIiYjeDIxMUM7Ij48IUVOVElUWSBSZSAiJiN4MjExQzsiPjwhRU5USVRZIHJlYWxwYXJ0ICImI3gyMTFDOyI%2BPCFFTlRJVFkgUmZyICImI3gyMTFDOyI%2BPCFFTlRJVFkgcmVhbHMgIiYjeDIxMUQ7Ij48IUVOVElUWSBSb3BmICImI3gyMTFEOyI%2BPCFFTlRJVFkgcnggIiYjeDIxMUU7Ij48IUVOVElUWSB0cmFkZSAiJiN4MjEyMjsiPjwhRU5USVRZIFRSQURFICImI3gyMTIyOyI%2BPCFFTlRJVFkgaW50ZWdlcnMgIiYjeDIxMjQ7Ij48IUVOVElUWSBab3BmICImI3gyMTI0OyI%2BPCFFTlRJVFkgbWhvICImI3gyMTI3OyI%2BPCFFTlRJVFkgWmZyICImI3gyMTI4OyI%2BPCFFTlRJVFkgemVldHJmICImI3gyMTI4OyI%2BPCFFTlRJVFkgaWlvdGEgIiYjeDIxMjk7Ij48IUVOVElUWSBiZXJub3UgIiYjeDIxMkM7Ij48IUVOVElUWSBCZXJub3VsbGlzICImI3gyMTJDOyI%2BPCFFTlRJVFkgQnNjciAiJiN4MjEyQzsiPjwhRU5USVRZIENmciAiJiN4MjEyRDsiPjwhRU5USVRZIENheWxleXMgIiYjeDIxMkQ7Ij48IUVOVElUWSBlc2NyICImI3gyMTJGOyI%2BPCFFTlRJVFkgRXNjciAiJiN4MjEzMDsiPjwhRU5USVRZIGV4cGVjdGF0aW9uICImI3gyMTMwOyI%2BPCFFTlRJVFkgRnNjciAiJiN4MjEzMTsiPjwhRU5USVRZIEZvdXJpZXJ0cmYgIiYjeDIxMzE7Ij48IUVOVElUWSBwaG1tYXQgIiYjeDIxMzM7Ij48IUVOVElUWSBNZWxsaW50cmYgIiYjeDIxMzM7Ij48IUVOVElUWSBNc2NyICImI3gyMTMzOyI%2BPCFFTlRJVFkgb3JkZXIgIiYjeDIxMzQ7Ij48IUVOVElUWSBvcmRlcm9mICImI3gyMTM0OyI%2BPCFFTlRJVFkgb3NjciAiJiN4MjEzNDsiPjwhRU5USVRZIGFsZWZzeW0gIiYjeDIxMzU7Ij48IUVOVElUWSBhbGVwaCAiJiN4MjEzNTsiPjwhRU5USVRZIGJldGggIiYjeDIxMzY7Ij48IUVOVElUWSBnaW1lbCAiJiN4MjEzNzsiPjwhRU5USVRZIGRhbGV0aCAiJiN4MjEzODsiPjwhRU5USVRZIENhcGl0YWxEaWZmZXJlbnRpYWxEICImI3gyMTQ1OyI%2BPCFFTlRJVFkgREQgIiYjeDIxNDU7Ij48IUVOVElUWSBEaWZmZXJlbnRpYWxEICImI3gyMTQ2OyI%2BPCFFTlRJVFkgZGQgIiYjeDIxNDY7Ij48IUVOVElUWSBFeHBvbmVudGlhbEUgIiYjeDIxNDc7Ij48IUVOVElUWSBleHBvbmVudGlhbGUgIiYjeDIxNDc7Ij48IUVOVElUWSBlZSAiJiN4MjE0NzsiPjwhRU5USVRZIEltYWdpbmFyeUkgIiYjeDIxNDg7Ij48IUVOVElUWSBpaSAiJiN4MjE0ODsiPjwhRU5USVRZIGZyYWMxMyAiJiN4MjE1MzsiPjwhRU5USVRZIGZyYWMyMyAiJiN4MjE1NDsiPjwhRU5USVRZIGZyYWMxNSAiJiN4MjE1NTsiPjwhRU5USVRZIGZyYWMyNSAiJiN4MjE1NjsiPjwhRU5USVRZIGZyYWMzNSAiJiN4MjE1NzsiPjwhRU5USVRZIGZyYWM0NSAiJiN4MjE1ODsiPjwhRU5USVRZIGZyYWMxNiAiJiN4MjE1OTsiPjwhRU5USVRZIGZyYWM1NiAiJiN4MjE1QTsiPjwhRU5USVRZIGZyYWMxOCAiJiN4MjE1QjsiPjwhRU5USVRZIGZyYWMzOCAiJiN4MjE1QzsiPjwhRU5USVRZIGZyYWM1OCAiJiN4MjE1RDsiPjwhRU5USVRZIGZyYWM3OCAiJiN4MjE1RTsiPjwhRU5USVRZIGxhcnIgIiYjeDIxOTA7Ij48IUVOVElUWSBsZWZ0YXJyb3cgIiYjeDIxOTA7Ij48IUVOVElUWSBMZWZ0QXJyb3cgIiYjeDIxOTA7Ij48IUVOVElUWSBzbGFyciAiJiN4MjE5MDsiPjwhRU5USVRZIFNob3J0TGVmdEFycm93ICImI3gyMTkwOyI%2BPCFFTlRJVFkgdWFyciAiJiN4MjE5MTsiPjwhRU5USVRZIHVwYXJyb3cgIiYjeDIxOTE7Ij48IUVOVElUWSBVcEFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgU2hvcnRVcEFycm93ICImI3gyMTkxOyI%2BPCFFTlRJVFkgcmFyciAiJiN4MjE5MjsiPjwhRU5USVRZIHJpZ2h0YXJyb3cgIiYjeDIxOTI7Ij48IUVOVElUWSBSaWdodEFycm93ICImI3gyMTkyOyI%2BPCFFTlRJVFkgc3JhcnIgIiYjeDIxOTI7Ij48IUVOVElUWSBTaG9ydFJpZ2h0QXJyb3cgIiYjeDIxOTI7Ij48IUVOVElUWSBkYXJyICImI3gyMTkzOyI%2BPCFFTlRJVFkgZG93bmFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgRG93bkFycm93ICImI3gyMTkzOyI%2BPCFFTlRJVFkgU2hvcnREb3duQXJyb3cgIiYjeDIxOTM7Ij48IUVOVElUWSBoYXJyICImI3gyMTk0OyI%2BPCFFTlRJVFkgbGVmdHJpZ2h0YXJyb3cgIiYjeDIxOTQ7Ij48IUVOVElUWSBMZWZ0UmlnaHRBcnJvdyAiJiN4MjE5NDsiPjwhRU5USVRZIHZhcnIgIiYjeDIxOTU7Ij48IUVOVElUWSB1cGRvd25hcnJvdyAiJiN4MjE5NTsiPjwhRU5USVRZIFVwRG93bkFycm93ICImI3gyMTk1OyI%2BPCFFTlRJVFkgbndhcnIgIiYjeDIxOTY7Ij48IUVOVElUWSBVcHBlckxlZnRBcnJvdyAiJiN4MjE5NjsiPjwhRU5USVRZIG53YXJyb3cgIiYjeDIxOTY7Ij48IUVOVElUWSBuZWFyciAiJiN4MjE5NzsiPjwhRU5USVRZIFVwcGVyUmlnaHRBcnJvdyAiJiN4MjE5NzsiPjwhRU5USVRZIG5lYXJyb3cgIiYjeDIxOTc7Ij48IUVOVElUWSBzZWFyciAiJiN4MjE5ODsiPjwhRU5USVRZIHNlYXJyb3cgIiYjeDIxOTg7Ij48IUVOVElUWSBMb3dlclJpZ2h0QXJyb3cgIiYjeDIxOTg7Ij48IUVOVElUWSBzd2FyciAiJiN4MjE5OTsiPjwhRU5USVRZIHN3YXJyb3cgIiYjeDIxOTk7Ij48IUVOVElUWSBMb3dlckxlZnRBcnJvdyAiJiN4MjE5OTsiPjwhRU5USVRZIG5sYXJyICImI3gyMTlBOyI%2BPCFFTlRJVFkgbmxlZnRhcnJvdyAiJiN4MjE5QTsiPjwhRU5USVRZIG5yYXJyICImI3gyMTlCOyI%2BPCFFTlRJVFkgbnJpZ2h0YXJyb3cgIiYjeDIxOUI7Ij48IUVOVElUWSByYXJydyAiJiN4MjE5RDsiPjwhRU5USVRZIHJpZ2h0c3F1aWdhcnJvdyAiJiN4MjE5RDsiPjwhRU5USVRZIG5yYXJydyAiJiN4MjE5RDsmI3gzMzg7Ij48IUVOVElUWSBMYXJyICImI3gyMTlFOyI%2BPCFFTlRJVFkgdHdvaGVhZGxlZnRhcnJvdyAiJiN4MjE5RTsiPjwhRU5USVRZIFVhcnIgIiYjeDIxOUY7Ij48IUVOVElUWSBSYXJyICImI3gyMUEwOyI%2BPCFFTlRJVFkgdHdvaGVhZHJpZ2h0YXJyb3cgIiYjeDIxQTA7Ij48IUVOVElUWSBEYXJyICImI3gyMUExOyI%2BPCFFTlRJVFkgbGFycnRsICImI3gyMUEyOyI%2BPCFFTlRJVFkgbGVmdGFycm93dGFpbCAiJiN4MjFBMjsiPjwhRU5USVRZIHJhcnJ0bCAiJiN4MjFBMzsiPjwhRU5USVRZIHJpZ2h0YXJyb3d0YWlsICImI3gyMUEzOyI%2BPCFFTlRJVFkgTGVmdFRlZUFycm93ICImI3gyMUE0OyI%2BPCFFTlRJVFkgbWFwc3RvbGVmdCAiJiN4MjFBNDsiPjwhRU5USVRZIFVwVGVlQXJyb3cgIiYjeDIxQTU7Ij48IUVOVElUWSBtYXBzdG91cCAiJiN4MjFBNTsiPjwhRU5USVRZIG1hcCAiJiN4MjFBNjsiPjwhRU5USVRZIFJpZ2h0VGVlQXJyb3cgIiYjeDIxQTY7Ij48IUVOVElUWSBtYXBzdG8gIiYjeDIxQTY7Ij48IUVOVElUWSBEb3duVGVlQXJyb3cgIiYjeDIxQTc7Ij48IUVOVElUWSBtYXBzdG9kb3duICImI3gyMUE3OyI%2BPCFFTlRJVFkgbGFycmhrICImI3gyMUE5OyI%2BPCFFTlRJVFkgaG9va2xlZnRhcnJvdyAiJiN4MjFBOTsiPjwhRU5USVRZIHJhcnJoayAiJiN4MjFBQTsiPjwhRU5USVRZIGhvb2tyaWdodGFycm93ICImI3gyMUFBOyI%2BPCFFTlRJVFkgbGFycmxwICImI3gyMUFCOyI%2BPCFFTlRJVFkgbG9vcGFycm93bGVmdCAiJiN4MjFBQjsiPjwhRU5USVRZIHJhcnJscCAiJiN4MjFBQzsiPjwhRU5USVRZIGxvb3BhcnJvd3JpZ2h0ICImI3gyMUFDOyI%2BPCFFTlRJVFkgaGFycncgIiYjeDIxQUQ7Ij48IUVOVElUWSBsZWZ0cmlnaHRzcXVpZ2Fycm93ICImI3gyMUFEOyI%2BPCFFTlRJVFkgbmhhcnIgIiYjeDIxQUU7Ij48IUVOVElUWSBubGVmdHJpZ2h0YXJyb3cgIiYjeDIxQUU7Ij48IUVOVElUWSBsc2ggIiYjeDIxQjA7Ij48IUVOVElUWSBMc2ggIiYjeDIxQjA7Ij48IUVOVElUWSByc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBSc2ggIiYjeDIxQjE7Ij48IUVOVElUWSBsZHNoICImI3gyMUIyOyI%2BPCFFTlRJVFkgcmRzaCAiJiN4MjFCMzsiPjwhRU5USVRZIGNyYXJyICImI3gyMUI1OyI%2BPCFFTlRJVFkgY3VsYXJyICImI3gyMUI2OyI%2BPCFFTlRJVFkgY3VydmVhcnJvd2xlZnQgIiYjeDIxQjY7Ij48IUVOVElUWSBjdXJhcnIgIiYjeDIxQjc7Ij48IUVOVElUWSBjdXJ2ZWFycm93cmlnaHQgIiYjeDIxQjc7Ij48IUVOVElUWSBvbGFyciAiJiN4MjFCQTsiPjwhRU5USVRZIGNpcmNsZWFycm93bGVmdCAiJiN4MjFCQTsiPjwhRU5USVRZIG9yYXJyICImI3gyMUJCOyI%2BPCFFTlRJVFkgY2lyY2xlYXJyb3dyaWdodCAiJiN4MjFCQjsiPjwhRU5USVRZIGxoYXJ1ICImI3gyMUJDOyI%2BPCFFTlRJVFkgTGVmdFZlY3RvciAiJiN4MjFCQzsiPjwhRU5USVRZIGxlZnRoYXJwb29udXAgIiYjeDIxQkM7Ij48IUVOVElUWSBsaGFyZCAiJiN4MjFCRDsiPjwhRU5USVRZIGxlZnRoYXJwb29uZG93biAiJiN4MjFCRDsiPjwhRU5USVRZIERvd25MZWZ0VmVjdG9yICImI3gyMUJEOyI%2BPCFFTlRJVFkgdWhhcnIgIiYjeDIxQkU7Ij48IUVOVElUWSB1cGhhcnBvb25yaWdodCAiJiN4MjFCRTsiPjwhRU5USVRZIFJpZ2h0VXBWZWN0b3IgIiYjeDIxQkU7Ij48IUVOVElUWSB1aGFybCAiJiN4MjFCRjsiPjwhRU5USVRZIHVwaGFycG9vbmxlZnQgIiYjeDIxQkY7Ij48IUVOVElUWSBMZWZ0VXBWZWN0b3IgIiYjeDIxQkY7Ij48IUVOVElUWSByaGFydSAiJiN4MjFDMDsiPjwhRU5USVRZIFJpZ2h0VmVjdG9yICImI3gyMUMwOyI%2BPCFFTlRJVFkgcmlnaHRoYXJwb29udXAgIiYjeDIxQzA7Ij48IUVOVElUWSByaGFyZCAiJiN4MjFDMTsiPjwhRU5USVRZIHJpZ2h0aGFycG9vbmRvd24gIiYjeDIxQzE7Ij48IUVOVElUWSBEb3duUmlnaHRWZWN0b3IgIiYjeDIxQzE7Ij48IUVOVElUWSBkaGFyciAiJiN4MjFDMjsiPjwhRU5USVRZIFJpZ2h0RG93blZlY3RvciAiJiN4MjFDMjsiPjwhRU5USVRZIGRvd25oYXJwb29ucmlnaHQgIiYjeDIxQzI7Ij48IUVOVElUWSBkaGFybCAiJiN4MjFDMzsiPjwhRU5USVRZIExlZnREb3duVmVjdG9yICImI3gyMUMzOyI%2BPCFFTlRJVFkgZG93bmhhcnBvb25sZWZ0ICImI3gyMUMzOyI%2BPCFFTlRJVFkgcmxhcnIgIiYjeDIxQzQ7Ij48IUVOVElUWSByaWdodGxlZnRhcnJvd3MgIiYjeDIxQzQ7Ij48IUVOVElUWSBSaWdodEFycm93TGVmdEFycm93ICImI3gyMUM0OyI%2BPCFFTlRJVFkgdWRhcnIgIiYjeDIxQzU7Ij48IUVOVElUWSBVcEFycm93RG93bkFycm93ICImI3gyMUM1OyI%2BPCFFTlRJVFkgbHJhcnIgIiYjeDIxQzY7Ij48IUVOVElUWSBsZWZ0cmlnaHRhcnJvd3MgIiYjeDIxQzY7Ij48IUVOVElUWSBMZWZ0QXJyb3dSaWdodEFycm93ICImI3gyMUM2OyI%2BPCFFTlRJVFkgbGxhcnIgIiYjeDIxQzc7Ij48IUVOVElUWSBsZWZ0bGVmdGFycm93cyAiJiN4MjFDNzsiPjwhRU5USVRZIHV1YXJyICImI3gyMUM4OyI%2BPCFFTlRJVFkgdXB1cGFycm93cyAiJiN4MjFDODsiPjwhRU5USVRZIHJyYXJyICImI3gyMUM5OyI%2BPCFFTlRJVFkgcmlnaHRyaWdodGFycm93cyAiJiN4MjFDOTsiPjwhRU5USVRZIGRkYXJyICImI3gyMUNBOyI%2BPCFFTlRJVFkgZG93bmRvd25hcnJvd3MgIiYjeDIxQ0E7Ij48IUVOVElUWSBscmhhciAiJiN4MjFDQjsiPjwhRU5USVRZIFJldmVyc2VFcXVpbGlicml1bSAiJiN4MjFDQjsiPjwhRU5USVRZIGxlZnRyaWdodGhhcnBvb25zICImI3gyMUNCOyI%2BPCFFTlRJVFkgcmxoYXIgIiYjeDIxQ0M7Ij48IUVOVElUWSByaWdodGxlZnRoYXJwb29ucyAiJiN4MjFDQzsiPjwhRU5USVRZIEVxdWlsaWJyaXVtICImI3gyMUNDOyI%2BPCFFTlRJVFkgbmxBcnIgIiYjeDIxQ0Q7Ij48IUVOVElUWSBuTGVmdGFycm93ICImI3gyMUNEOyI%2BPCFFTlRJVFkgbmhBcnIgIiYjeDIxQ0U7Ij48IUVOVElUWSBuTGVmdHJpZ2h0YXJyb3cgIiYjeDIxQ0U7Ij48IUVOVElUWSBuckFyciAiJiN4MjFDRjsiPjwhRU5USVRZIG5SaWdodGFycm93ICImI3gyMUNGOyI%2BPCFFTlRJVFkgbEFyciAiJiN4MjFEMDsiPjwhRU5USVRZIExlZnRhcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIERvdWJsZUxlZnRBcnJvdyAiJiN4MjFEMDsiPjwhRU5USVRZIHVBcnIgIiYjeDIxRDE7Ij48IUVOVElUWSBVcGFycm93ICImI3gyMUQxOyI%2BPCFFTlRJVFkgRG91YmxlVXBBcnJvdyAiJiN4MjFEMTsiPjwhRU5USVRZIHJBcnIgIiYjeDIxRDI7Ij48IUVOVElUWSBSaWdodGFycm93ICImI3gyMUQyOyI%2BPCFFTlRJVFkgSW1wbGllcyAiJiN4MjFEMjsiPjwhRU5USVRZIERvdWJsZVJpZ2h0QXJyb3cgIiYjeDIxRDI7Ij48IUVOVElUWSBkQXJyICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG93bmFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgRG91YmxlRG93bkFycm93ICImI3gyMUQzOyI%2BPCFFTlRJVFkgaEFyciAiJiN4MjFENDsiPjwhRU5USVRZIExlZnRyaWdodGFycm93ICImI3gyMUQ0OyI%2BPCFFTlRJVFkgRG91YmxlTGVmdFJpZ2h0QXJyb3cgIiYjeDIxRDQ7Ij48IUVOVElUWSBpZmYgIiYjeDIxRDQ7Ij48IUVOVElUWSB2QXJyICImI3gyMUQ1OyI%2BPCFFTlRJVFkgVXBkb3duYXJyb3cgIiYjeDIxRDU7Ij48IUVOVElUWSBEb3VibGVVcERvd25BcnJvdyAiJiN4MjFENTsiPjwhRU5USVRZIG53QXJyICImI3gyMUQ2OyI%2BPCFFTlRJVFkgbmVBcnIgIiYjeDIxRDc7Ij48IUVOVElUWSBzZUFyciAiJiN4MjFEODsiPjwhRU5USVRZIHN3QXJyICImI3gyMUQ5OyI%2BPCFFTlRJVFkgbEFhcnIgIiYjeDIxREE7Ij48IUVOVElUWSBMbGVmdGFycm93ICImI3gyMURBOyI%2BPCFFTlRJVFkgckFhcnIgIiYjeDIxREI7Ij48IUVOVElUWSBScmlnaHRhcnJvdyAiJiN4MjFEQjsiPjwhRU5USVRZIHppZ3JhcnIgIiYjeDIxREQ7Ij48IUVOVElUWSBsYXJyYiAiJiN4MjFFNDsiPjwhRU5USVRZIExlZnRBcnJvd0JhciAiJiN4MjFFNDsiPjwhRU5USVRZIHJhcnJiICImI3gyMUU1OyI%2BPCFFTlRJVFkgUmlnaHRBcnJvd0JhciAiJiN4MjFFNTsiPjwhRU5USVRZIGR1YXJyICImI3gyMUY1OyI%2BPCFFTlRJVFkgRG93bkFycm93VXBBcnJvdyAiJiN4MjFGNTsiPjwhRU5USVRZIGxvYXJyICImI3gyMUZEOyI%2BPCFFTlRJVFkgcm9hcnIgIiYjeDIxRkU7Ij48IUVOVElUWSBob2FyciAiJiN4MjFGRjsiPjwhRU5USVRZIGZvcmFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIEZvckFsbCAiJiN4MjIwMDsiPjwhRU5USVRZIGNvbXAgIiYjeDIyMDE7Ij48IUVOVElUWSBjb21wbGVtZW50ICImI3gyMjAxOyI%2BPCFFTlRJVFkgcGFydCAiJiN4MjIwMjsiPjwhRU5USVRZIFBhcnRpYWxEICImI3gyMjAyOyI%2BPCFFTlRJVFkgbnBhcnQgIiYjeDIyMDI7JiN4MzM4OyI%2BPCFFTlRJVFkgZXhpc3QgIiYjeDIyMDM7Ij48IUVOVElUWSBFeGlzdHMgIiYjeDIyMDM7Ij48IUVOVElUWSBuZXhpc3QgIiYjeDIyMDQ7Ij48IUVOVElUWSBOb3RFeGlzdHMgIiYjeDIyMDQ7Ij48IUVOVElUWSBuZXhpc3RzICImI3gyMjA0OyI%2BPCFFTlRJVFkgZW1wdHkgIiYjeDIyMDU7Ij48IUVOVElUWSBlbXB0eXNldCAiJiN4MjIwNTsiPjwhRU5USVRZIGVtcHR5diAiJiN4MjIwNTsiPjwhRU5USVRZIHZhcm5vdGhpbmcgIiYjeDIyMDU7Ij48IUVOVElUWSBuYWJsYSAiJiN4MjIwNzsiPjwhRU5USVRZIERlbCAiJiN4MjIwNzsiPjwhRU5USVRZIGlzaW4gIiYjeDIyMDg7Ij48IUVOVElUWSBpc2ludiAiJiN4MjIwODsiPjwhRU5USVRZIEVsZW1lbnQgIiYjeDIyMDg7Ij48IUVOVElUWSBpbiAiJiN4MjIwODsiPjwhRU5USVRZIG5vdGluICImI3gyMjA5OyI%2BPCFFTlRJVFkgTm90RWxlbWVudCAiJiN4MjIwOTsiPjwhRU5USVRZIG5vdGludmEgIiYjeDIyMDk7Ij48IUVOVElUWSBuaXYgIiYjeDIyMEI7Ij48IUVOVElUWSBSZXZlcnNlRWxlbWVudCAiJiN4MjIwQjsiPjwhRU5USVRZIG5pICImI3gyMjBCOyI%2BPCFFTlRJVFkgU3VjaFRoYXQgIiYjeDIyMEI7Ij48IUVOVElUWSBub3RuaSAiJiN4MjIwQzsiPjwhRU5USVRZIG5vdG5pdmEgIiYjeDIyMEM7Ij48IUVOVElUWSBOb3RSZXZlcnNlRWxlbWVudCAiJiN4MjIwQzsiPjwhRU5USVRZIHByb2QgIiYjeDIyMEY7Ij48IUVOVElUWSBQcm9kdWN0ICImI3gyMjBGOyI%2BPCFFTlRJVFkgY29wcm9kICImI3gyMjEwOyI%2BPCFFTlRJVFkgQ29wcm9kdWN0ICImI3gyMjEwOyI%2BPCFFTlRJVFkgc3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgU3VtICImI3gyMjExOyI%2BPCFFTlRJVFkgbWludXMgIiYjeDIyMTI7Ij48IUVOVElUWSBtbnBsdXMgIiYjeDIyMTM7Ij48IUVOVElUWSBtcCAiJiN4MjIxMzsiPjwhRU5USVRZIE1pbnVzUGx1cyAiJiN4MjIxMzsiPjwhRU5USVRZIHBsdXNkbyAiJiN4MjIxNDsiPjwhRU5USVRZIGRvdHBsdXMgIiYjeDIyMTQ7Ij48IUVOVElUWSBzZXRtbiAiJiN4MjIxNjsiPjwhRU5USVRZIHNldG1pbnVzICImI3gyMjE2OyI%2BPCFFTlRJVFkgQmFja3NsYXNoICImI3gyMjE2OyI%2BPCFFTlRJVFkgc3NldG1uICImI3gyMjE2OyI%2BPCFFTlRJVFkgc21hbGxzZXRtaW51cyAiJiN4MjIxNjsiPjwhRU5USVRZIGxvd2FzdCAiJiN4MjIxNzsiPjwhRU5USVRZIGNvbXBmbiAiJiN4MjIxODsiPjwhRU5USVRZIFNtYWxsQ2lyY2xlICImI3gyMjE4OyI%2BPCFFTlRJVFkgcmFkaWMgIiYjeDIyMUE7Ij48IUVOVElUWSBTcXJ0ICImI3gyMjFBOyI%2BPCFFTlRJVFkgcHJvcCAiJiN4MjIxRDsiPjwhRU5USVRZIHByb3B0byAiJiN4MjIxRDsiPjwhRU5USVRZIFByb3BvcnRpb25hbCAiJiN4MjIxRDsiPjwhRU5USVRZIHZwcm9wICImI3gyMjFEOyI%2BPCFFTlRJVFkgdmFycHJvcHRvICImI3gyMjFEOyI%2BPCFFTlRJVFkgaW5maW4gIiYjeDIyMUU7Ij48IUVOVElUWSBhbmdydCAiJiN4MjIxRjsiPjwhRU5USVRZIGFuZyAiJiN4MjIyMDsiPjwhRU5USVRZIGFuZ2xlICImI3gyMjIwOyI%2BPCFFTlRJVFkgbmFuZyAiJiN4MjIyMDsmI3gyMEQyOyI%2BPCFFTlRJVFkgYW5nbXNkICImI3gyMjIxOyI%2BPCFFTlRJVFkgbWVhc3VyZWRhbmdsZSAiJiN4MjIyMTsiPjwhRU5USVRZIGFuZ3NwaCAiJiN4MjIyMjsiPjwhRU5USVRZIG1pZCAiJiN4MjIyMzsiPjwhRU5USVRZIFZlcnRpY2FsQmFyICImI3gyMjIzOyI%2BPCFFTlRJVFkgc21pZCAiJiN4MjIyMzsiPjwhRU5USVRZIHNob3J0bWlkICImI3gyMjIzOyI%2BPCFFTlRJVFkgbm1pZCAiJiN4MjIyNDsiPjwhRU5USVRZIE5vdFZlcnRpY2FsQmFyICImI3gyMjI0OyI%2BPCFFTlRJVFkgbnNtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBuc2hvcnRtaWQgIiYjeDIyMjQ7Ij48IUVOVElUWSBwYXIgIiYjeDIyMjU7Ij48IUVOVElUWSBwYXJhbGxlbCAiJiN4MjIyNTsiPjwhRU5USVRZIERvdWJsZVZlcnRpY2FsQmFyICImI3gyMjI1OyI%2BPCFFTlRJVFkgc3BhciAiJiN4MjIyNTsiPjwhRU5USVRZIHNob3J0cGFyYWxsZWwgIiYjeDIyMjU7Ij48IUVOVElUWSBucGFyICImI3gyMjI2OyI%2BPCFFTlRJVFkgbnBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgTm90RG91YmxlVmVydGljYWxCYXIgIiYjeDIyMjY7Ij48IUVOVElUWSBuc3BhciAiJiN4MjIyNjsiPjwhRU5USVRZIG5zaG9ydHBhcmFsbGVsICImI3gyMjI2OyI%2BPCFFTlRJVFkgYW5kICImI3gyMjI3OyI%2BPCFFTlRJVFkgd2VkZ2UgIiYjeDIyMjc7Ij48IUVOVElUWSBvciAiJiN4MjIyODsiPjwhRU5USVRZIHZlZSAiJiN4MjIyODsiPjwhRU5USVRZIGNhcCAiJiN4MjIyOTsiPjwhRU5USVRZIGNhcHMgIiYjeDIyMjk7JiN4RkUwMDsiPjwhRU5USVRZIGN1cCAiJiN4MjIyQTsiPjwhRU5USVRZIGN1cHMgIiYjeDIyMkE7JiN4RkUwMDsiPjwhRU5USVRZIGludCAiJiN4MjIyQjsiPjwhRU5USVRZIEludGVncmFsICImI3gyMjJCOyI%2BPCFFTlRJVFkgSW50ICImI3gyMjJDOyI%2BPCFFTlRJVFkgdGludCAiJiN4MjIyRDsiPjwhRU5USVRZIGlpaW50ICImI3gyMjJEOyI%2BPCFFTlRJVFkgY29uaW50ICImI3gyMjJFOyI%2BPCFFTlRJVFkgb2ludCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRTsiPjwhRU5USVRZIENvbmludCAiJiN4MjIyRjsiPjwhRU5USVRZIERvdWJsZUNvbnRvdXJJbnRlZ3JhbCAiJiN4MjIyRjsiPjwhRU5USVRZIENjb25pbnQgIiYjeDIyMzA7Ij48IUVOVElUWSBjd2ludCAiJiN4MjIzMTsiPjwhRU5USVRZIGN3Y29uaW50ICImI3gyMjMyOyI%2BPCFFTlRJVFkgQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMyOyI%2BPCFFTlRJVFkgYXdjb25pbnQgIiYjeDIyMzM7Ij48IUVOVElUWSBDb3VudGVyQ2xvY2t3aXNlQ29udG91ckludGVncmFsICImI3gyMjMzOyI%2BPCFFTlRJVFkgdGhlcmU0ICImI3gyMjM0OyI%2BPCFFTlRJVFkgdGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgVGhlcmVmb3JlICImI3gyMjM0OyI%2BPCFFTlRJVFkgYmVjYXVzICImI3gyMjM1OyI%2BPCFFTlRJVFkgYmVjYXVzZSAiJiN4MjIzNTsiPjwhRU5USVRZIEJlY2F1c2UgIiYjeDIyMzU7Ij48IUVOVElUWSByYXRpbyAiJiN4MjIzNjsiPjwhRU5USVRZIENvbG9uICImI3gyMjM3OyI%2BPCFFTlRJVFkgUHJvcG9ydGlvbiAiJiN4MjIzNzsiPjwhRU5USVRZIG1pbnVzZCAiJiN4MjIzODsiPjwhRU5USVRZIGRvdG1pbnVzICImI3gyMjM4OyI%2BPCFFTlRJVFkgbUREb3QgIiYjeDIyM0E7Ij48IUVOVElUWSBob210aHQgIiYjeDIyM0I7Ij48IUVOVElUWSBzaW0gIiYjeDIyM0M7Ij48IUVOVElUWSBUaWxkZSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoa3NpbSAiJiN4MjIzQzsiPjwhRU5USVRZIHRoaWNrc2ltICImI3gyMjNDOyI%2BPCFFTlRJVFkgbnZzaW0gIiYjeDIyM0M7JiN4MjBEMjsiPjwhRU5USVRZIGJzaW0gIiYjeDIyM0Q7Ij48IUVOVElUWSBiYWNrc2ltICImI3gyMjNEOyI%2BPCFFTlRJVFkgcmFjZSAiJiN4MjIzRDsmI3gzMzE7Ij48IUVOVElUWSBhYyAiJiN4MjIzRTsiPjwhRU5USVRZIG1zdHBvcyAiJiN4MjIzRTsiPjwhRU5USVRZIGFjRSAiJiN4MjIzRTsmI3gzMzM7Ij48IUVOVElUWSBhY2QgIiYjeDIyM0Y7Ij48IUVOVElUWSB3cmVhdGggIiYjeDIyNDA7Ij48IUVOVElUWSBWZXJ0aWNhbFRpbGRlICImI3gyMjQwOyI%2BPCFFTlRJVFkgd3IgIiYjeDIyNDA7Ij48IUVOVElUWSBuc2ltICImI3gyMjQxOyI%2BPCFFTlRJVFkgTm90VGlsZGUgIiYjeDIyNDE7Ij48IUVOVElUWSBlc2ltICImI3gyMjQyOyI%2BPCFFTlRJVFkgRXF1YWxUaWxkZSAiJiN4MjI0MjsiPjwhRU5USVRZIGVxc2ltICImI3gyMjQyOyI%2BPCFFTlRJVFkgTm90RXF1YWxUaWxkZSAiJiN4MjI0MjsmI3gzMzg7Ij48IUVOVElUWSBuZXNpbSAiJiN4MjI0MjsmI3gzMzg7Ij48IUVOVElUWSBzaW1lICImI3gyMjQzOyI%2BPCFFTlRJVFkgVGlsZGVFcXVhbCAiJiN4MjI0MzsiPjwhRU5USVRZIHNpbWVxICImI3gyMjQzOyI%2BPCFFTlRJVFkgbnNpbWUgIiYjeDIyNDQ7Ij48IUVOVElUWSBuc2ltZXEgIiYjeDIyNDQ7Ij48IUVOVElUWSBOb3RUaWxkZUVxdWFsICImI3gyMjQ0OyI%2BPCFFTlRJVFkgY29uZyAiJiN4MjI0NTsiPjwhRU5USVRZIFRpbGRlRnVsbEVxdWFsICImI3gyMjQ1OyI%2BPCFFTlRJVFkgc2ltbmUgIiYjeDIyNDY7Ij48IUVOVElUWSBuY29uZyAiJiN4MjI0NzsiPjwhRU5USVRZIE5vdFRpbGRlRnVsbEVxdWFsICImI3gyMjQ3OyI%2BPCFFTlRJVFkgYXN5bXAgIiYjeDIyNDg7Ij48IUVOVElUWSBhcCAiJiN4MjI0ODsiPjwhRU5USVRZIFRpbGRlVGlsZGUgIiYjeDIyNDg7Ij48IUVOVElUWSBhcHByb3ggIiYjeDIyNDg7Ij48IUVOVElUWSB0aGthcCAiJiN4MjI0ODsiPjwhRU5USVRZIHRoaWNrYXBwcm94ICImI3gyMjQ4OyI%2BPCFFTlRJVFkgbmFwICImI3gyMjQ5OyI%2BPCFFTlRJVFkgTm90VGlsZGVUaWxkZSAiJiN4MjI0OTsiPjwhRU5USVRZIG5hcHByb3ggIiYjeDIyNDk7Ij48IUVOVElUWSBhcGUgIiYjeDIyNEE7Ij48IUVOVElUWSBhcHByb3hlcSAiJiN4MjI0QTsiPjwhRU5USVRZIGFwaWQgIiYjeDIyNEI7Ij48IUVOVElUWSBuYXBpZCAiJiN4MjI0QjsmI3gzMzg7Ij48IUVOVElUWSBiY29uZyAiJiN4MjI0QzsiPjwhRU5USVRZIGJhY2tjb25nICImI3gyMjRDOyI%2BPCFFTlRJVFkgYXN5bXBlcSAiJiN4MjI0RDsiPjwhRU5USVRZIEN1cENhcCAiJiN4MjI0RDsiPjwhRU5USVRZIG52YXAgIiYjeDIyNEQ7JiN4MjBEMjsiPjwhRU5USVRZIGJ1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBIdW1wRG93bkh1bXAgIiYjeDIyNEU7Ij48IUVOVElUWSBCdW1wZXEgIiYjeDIyNEU7Ij48IUVOVElUWSBOb3RIdW1wRG93bkh1bXAgIiYjeDIyNEU7JiN4MzM4OyI%2BPCFFTlRJVFkgbmJ1bXAgIiYjeDIyNEU7JiN4MzM4OyI%2BPCFFTlRJVFkgYnVtcGUgIiYjeDIyNEY7Ij48IUVOVElUWSBIdW1wRXF1YWwgIiYjeDIyNEY7Ij48IUVOVElUWSBidW1wZXEgIiYjeDIyNEY7Ij48IUVOVElUWSBuYnVtcGUgIiYjeDIyNEY7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90SHVtcEVxdWFsICImI3gyMjRGOyYjeDMzODsiPjwhRU5USVRZIGVzZG90ICImI3gyMjUwOyI%2BPCFFTlRJVFkgRG90RXF1YWwgIiYjeDIyNTA7Ij48IUVOVElUWSBkb3RlcSAiJiN4MjI1MDsiPjwhRU5USVRZIG5lZG90ICImI3gyMjUwOyYjeDMzODsiPjwhRU5USVRZIGVEb3QgIiYjeDIyNTE7Ij48IUVOVElUWSBkb3RlcWRvdCAiJiN4MjI1MTsiPjwhRU5USVRZIGVmRG90ICImI3gyMjUyOyI%2BPCFFTlRJVFkgZmFsbGluZ2RvdHNlcSAiJiN4MjI1MjsiPjwhRU5USVRZIGVyRG90ICImI3gyMjUzOyI%2BPCFFTlRJVFkgcmlzaW5nZG90c2VxICImI3gyMjUzOyI%2BPCFFTlRJVFkgY29sb25lICImI3gyMjU0OyI%2BPCFFTlRJVFkgY29sb25lcSAiJiN4MjI1NDsiPjwhRU5USVRZIEFzc2lnbiAiJiN4MjI1NDsiPjwhRU5USVRZIGVjb2xvbiAiJiN4MjI1NTsiPjwhRU5USVRZIGVxY29sb24gIiYjeDIyNTU7Ij48IUVOVElUWSBlY2lyICImI3gyMjU2OyI%2BPCFFTlRJVFkgZXFjaXJjICImI3gyMjU2OyI%2BPCFFTlRJVFkgY2lyZSAiJiN4MjI1NzsiPjwhRU5USVRZIGNpcmNlcSAiJiN4MjI1NzsiPjwhRU5USVRZIHdlZGdlcSAiJiN4MjI1OTsiPjwhRU5USVRZIHZlZWVxICImI3gyMjVBOyI%2BPCFFTlRJVFkgdHJpZSAiJiN4MjI1QzsiPjwhRU5USVRZIHRyaWFuZ2xlcSAiJiN4MjI1QzsiPjwhRU5USVRZIGVxdWVzdCAiJiN4MjI1RjsiPjwhRU5USVRZIHF1ZXN0ZXEgIiYjeDIyNUY7Ij48IUVOVElUWSBuZSAiJiN4MjI2MDsiPjwhRU5USVRZIE5vdEVxdWFsICImI3gyMjYwOyI%2BPCFFTlRJVFkgZXF1aXYgIiYjeDIyNjE7Ij48IUVOVElUWSBDb25ncnVlbnQgIiYjeDIyNjE7Ij48IUVOVElUWSBibmVxdWl2ICImI3gyMjYxOyYjeDIwRTU7Ij48IUVOVElUWSBuZXF1aXYgIiYjeDIyNjI7Ij48IUVOVElUWSBOb3RDb25ncnVlbnQgIiYjeDIyNjI7Ij48IUVOVElUWSBsZSAiJiN4MjI2NDsiPjwhRU5USVRZIGxlcSAiJiN4MjI2NDsiPjwhRU5USVRZIG52bGUgIiYjeDIyNjQ7JiN4MjBEMjsiPjwhRU5USVRZIGdlICImI3gyMjY1OyI%2BPCFFTlRJVFkgR3JlYXRlckVxdWFsICImI3gyMjY1OyI%2BPCFFTlRJVFkgZ2VxICImI3gyMjY1OyI%2BPCFFTlRJVFkgbnZnZSAiJiN4MjI2NTsmI3gyMEQyOyI%2BPCFFTlRJVFkgbEUgIiYjeDIyNjY7Ij48IUVOVElUWSBMZXNzRnVsbEVxdWFsICImI3gyMjY2OyI%2BPCFFTlRJVFkgbGVxcSAiJiN4MjI2NjsiPjwhRU5USVRZIG5sRSAiJiN4MjI2NjsmI3gzMzg7Ij48IUVOVElUWSBubGVxcSAiJiN4MjI2NjsmI3gzMzg7Ij48IUVOVElUWSBnRSAiJiN4MjI2NzsiPjwhRU5USVRZIEdyZWF0ZXJGdWxsRXF1YWwgIiYjeDIyNjc7Ij48IUVOVElUWSBnZXFxICImI3gyMjY3OyI%2BPCFFTlRJVFkgbmdFICImI3gyMjY3OyYjeDMzODsiPjwhRU5USVRZIG5nZXFxICImI3gyMjY3OyYjeDMzODsiPjwhRU5USVRZIE5vdEdyZWF0ZXJGdWxsRXF1YWwgIiYjeDIyNjc7JiN4MzM4OyI%2BPCFFTlRJVFkgbG5FICImI3gyMjY4OyI%2BPCFFTlRJVFkgbG5lcXEgIiYjeDIyNjg7Ij48IUVOVElUWSBsdm5FICImI3gyMjY4OyYjeEZFMDA7Ij48IUVOVElUWSBsdmVydG5lcXEgIiYjeDIyNjg7JiN4RkUwMDsiPjwhRU5USVRZIGduRSAiJiN4MjI2OTsiPjwhRU5USVRZIGduZXFxICImI3gyMjY5OyI%2BPCFFTlRJVFkgZ3ZuRSAiJiN4MjI2OTsmI3hGRTAwOyI%2BPCFFTlRJVFkgZ3ZlcnRuZXFxICImI3gyMjY5OyYjeEZFMDA7Ij48IUVOVElUWSBMdCAiJiN4MjI2QTsiPjwhRU5USVRZIE5lc3RlZExlc3NMZXNzICImI3gyMjZBOyI%2BPCFFTlRJVFkgbGwgIiYjeDIyNkE7Ij48IUVOVElUWSBuTHR2ICImI3gyMjZBOyYjeDMzODsiPjwhRU5USVRZIE5vdExlc3NMZXNzICImI3gyMjZBOyYjeDMzODsiPjwhRU5USVRZIG5MdCAiJiN4MjI2QTsmI3gyMEQyOyI%2BPCFFTlRJVFkgR3QgIiYjeDIyNkI7Ij48IUVOVElUWSBOZXN0ZWRHcmVhdGVyR3JlYXRlciAiJiN4MjI2QjsiPjwhRU5USVRZIGdnICImI3gyMjZCOyI%2BPCFFTlRJVFkgbkd0diAiJiN4MjI2QjsmI3gzMzg7Ij48IUVOVElUWSBOb3RHcmVhdGVyR3JlYXRlciAiJiN4MjI2QjsmI3gzMzg7Ij48IUVOVElUWSBuR3QgIiYjeDIyNkI7JiN4MjBEMjsiPjwhRU5USVRZIHR3aXh0ICImI3gyMjZDOyI%2BPCFFTlRJVFkgYmV0d2VlbiAiJiN4MjI2QzsiPjwhRU5USVRZIE5vdEN1cENhcCAiJiN4MjI2RDsiPjwhRU5USVRZIG5sdCAiJiN4MjI2RTsiPjwhRU5USVRZIE5vdExlc3MgIiYjeDIyNkU7Ij48IUVOVElUWSBubGVzcyAiJiN4MjI2RTsiPjwhRU5USVRZIG5ndCAiJiN4MjI2RjsiPjwhRU5USVRZIE5vdEdyZWF0ZXIgIiYjeDIyNkY7Ij48IUVOVElUWSBuZ3RyICImI3gyMjZGOyI%2BPCFFTlRJVFkgbmxlICImI3gyMjcwOyI%2BPCFFTlRJVFkgTm90TGVzc0VxdWFsICImI3gyMjcwOyI%2BPCFFTlRJVFkgbmxlcSAiJiN4MjI3MDsiPjwhRU5USVRZIG5nZSAiJiN4MjI3MTsiPjwhRU5USVRZIE5vdEdyZWF0ZXJFcXVhbCAiJiN4MjI3MTsiPjwhRU5USVRZIG5nZXEgIiYjeDIyNzE7Ij48IUVOVElUWSBsc2ltICImI3gyMjcyOyI%2BPCFFTlRJVFkgTGVzc1RpbGRlICImI3gyMjcyOyI%2BPCFFTlRJVFkgbGVzc3NpbSAiJiN4MjI3MjsiPjwhRU5USVRZIGdzaW0gIiYjeDIyNzM7Ij48IUVOVElUWSBndHJzaW0gIiYjeDIyNzM7Ij48IUVOVElUWSBHcmVhdGVyVGlsZGUgIiYjeDIyNzM7Ij48IUVOVElUWSBubHNpbSAiJiN4MjI3NDsiPjwhRU5USVRZIE5vdExlc3NUaWxkZSAiJiN4MjI3NDsiPjwhRU5USVRZIG5nc2ltICImI3gyMjc1OyI%2BPCFFTlRJVFkgTm90R3JlYXRlclRpbGRlICImI3gyMjc1OyI%2BPCFFTlRJVFkgbGcgIiYjeDIyNzY7Ij48IUVOVElUWSBsZXNzZ3RyICImI3gyMjc2OyI%2BPCFFTlRJVFkgTGVzc0dyZWF0ZXIgIiYjeDIyNzY7Ij48IUVOVElUWSBnbCAiJiN4MjI3NzsiPjwhRU5USVRZIGd0cmxlc3MgIiYjeDIyNzc7Ij48IUVOVElUWSBHcmVhdGVyTGVzcyAiJiN4MjI3NzsiPjwhRU5USVRZIG50bGcgIiYjeDIyNzg7Ij48IUVOVElUWSBOb3RMZXNzR3JlYXRlciAiJiN4MjI3ODsiPjwhRU5USVRZIG50Z2wgIiYjeDIyNzk7Ij48IUVOVElUWSBOb3RHcmVhdGVyTGVzcyAiJiN4MjI3OTsiPjwhRU5USVRZIHByICImI3gyMjdBOyI%2BPCFFTlRJVFkgUHJlY2VkZXMgIiYjeDIyN0E7Ij48IUVOVElUWSBwcmVjICImI3gyMjdBOyI%2BPCFFTlRJVFkgc2MgIiYjeDIyN0I7Ij48IUVOVElUWSBTdWNjZWVkcyAiJiN4MjI3QjsiPjwhRU5USVRZIHN1Y2MgIiYjeDIyN0I7Ij48IUVOVElUWSBwcmN1ZSAiJiN4MjI3QzsiPjwhRU5USVRZIFByZWNlZGVzU2xhbnRFcXVhbCAiJiN4MjI3QzsiPjwhRU5USVRZIHByZWNjdXJseWVxICImI3gyMjdDOyI%2BPCFFTlRJVFkgc2NjdWUgIiYjeDIyN0Q7Ij48IUVOVElUWSBTdWNjZWVkc1NsYW50RXF1YWwgIiYjeDIyN0Q7Ij48IUVOVElUWSBzdWNjY3VybHllcSAiJiN4MjI3RDsiPjwhRU5USVRZIHByc2ltICImI3gyMjdFOyI%2BPCFFTlRJVFkgcHJlY3NpbSAiJiN4MjI3RTsiPjwhRU5USVRZIFByZWNlZGVzVGlsZGUgIiYjeDIyN0U7Ij48IUVOVElUWSBzY3NpbSAiJiN4MjI3RjsiPjwhRU5USVRZIHN1Y2NzaW0gIiYjeDIyN0Y7Ij48IUVOVElUWSBTdWNjZWVkc1RpbGRlICImI3gyMjdGOyI%2BPCFFTlRJVFkgTm90U3VjY2VlZHNUaWxkZSAiJiN4MjI3RjsmI3gzMzg7Ij48IUVOVElUWSBucHIgIiYjeDIyODA7Ij48IUVOVElUWSBucHJlYyAiJiN4MjI4MDsiPjwhRU5USVRZIE5vdFByZWNlZGVzICImI3gyMjgwOyI%2BPCFFTlRJVFkgbnNjICImI3gyMjgxOyI%2BPCFFTlRJVFkgbnN1Y2MgIiYjeDIyODE7Ij48IUVOVElUWSBOb3RTdWNjZWVkcyAiJiN4MjI4MTsiPjwhRU5USVRZIHN1YiAiJiN4MjI4MjsiPjwhRU5USVRZIHN1YnNldCAiJiN4MjI4MjsiPjwhRU5USVRZIHZuc3ViICImI3gyMjgyOyYjeDIwRDI7Ij48IUVOVElUWSBuc3Vic2V0ICImI3gyMjgyOyYjeDIwRDI7Ij48IUVOVElUWSBOb3RTdWJzZXQgIiYjeDIyODI7JiN4MjBEMjsiPjwhRU5USVRZIHN1cCAiJiN4MjI4MzsiPjwhRU5USVRZIHN1cHNldCAiJiN4MjI4MzsiPjwhRU5USVRZIFN1cGVyc2V0ICImI3gyMjgzOyI%2BPCFFTlRJVFkgdm5zdXAgIiYjeDIyODM7JiN4MjBEMjsiPjwhRU5USVRZIG5zdXBzZXQgIiYjeDIyODM7JiN4MjBEMjsiPjwhRU5USVRZIE5vdFN1cGVyc2V0ICImI3gyMjgzOyYjeDIwRDI7Ij48IUVOVElUWSBuc3ViICImI3gyMjg0OyI%2BPCFFTlRJVFkgbnN1cCAiJiN4MjI4NTsiPjwhRU5USVRZIHN1YmUgIiYjeDIyODY7Ij48IUVOVElUWSBTdWJzZXRFcXVhbCAiJiN4MjI4NjsiPjwhRU5USVRZIHN1YnNldGVxICImI3gyMjg2OyI%2BPCFFTlRJVFkgc3VwZSAiJiN4MjI4NzsiPjwhRU5USVRZIHN1cHNldGVxICImI3gyMjg3OyI%2BPCFFTlRJVFkgU3VwZXJzZXRFcXVhbCAiJiN4MjI4NzsiPjwhRU5USVRZIG5zdWJlICImI3gyMjg4OyI%2BPCFFTlRJVFkgbnN1YnNldGVxICImI3gyMjg4OyI%2BPCFFTlRJVFkgTm90U3Vic2V0RXF1YWwgIiYjeDIyODg7Ij48IUVOVElUWSBuc3VwZSAiJiN4MjI4OTsiPjwhRU5USVRZIG5zdXBzZXRlcSAiJiN4MjI4OTsiPjwhRU5USVRZIE5vdFN1cGVyc2V0RXF1YWwgIiYjeDIyODk7Ij48IUVOVElUWSBzdWJuZSAiJiN4MjI4QTsiPjwhRU5USVRZIHN1YnNldG5lcSAiJiN4MjI4QTsiPjwhRU5USVRZIHZzdWJuZSAiJiN4MjI4QTsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vic2V0bmVxICImI3gyMjhBOyYjeEZFMDA7Ij48IUVOVElUWSBzdXBuZSAiJiN4MjI4QjsiPjwhRU5USVRZIHN1cHNldG5lcSAiJiN4MjI4QjsiPjwhRU5USVRZIHZzdXBuZSAiJiN4MjI4QjsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vwc2V0bmVxICImI3gyMjhCOyYjeEZFMDA7Ij48IUVOVElUWSBjdXBkb3QgIiYjeDIyOEQ7Ij48IUVOVElUWSB1cGx1cyAiJiN4MjI4RTsiPjwhRU5USVRZIFVuaW9uUGx1cyAiJiN4MjI4RTsiPjwhRU5USVRZIHNxc3ViICImI3gyMjhGOyI%2BPCFFTlRJVFkgU3F1YXJlU3Vic2V0ICImI3gyMjhGOyI%2BPCFFTlRJVFkgc3FzdWJzZXQgIiYjeDIyOEY7Ij48IUVOVElUWSBOb3RTcXVhcmVTdWJzZXQgIiYjeDIyOEY7JiN4MzM4OyI%2BPCFFTlRJVFkgc3FzdXAgIiYjeDIyOTA7Ij48IUVOVElUWSBTcXVhcmVTdXBlcnNldCAiJiN4MjI5MDsiPjwhRU5USVRZIHNxc3Vwc2V0ICImI3gyMjkwOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3VwZXJzZXQgIiYjeDIyOTA7JiN4MzM4OyI%2BPCFFTlRJVFkgc3FzdWJlICImI3gyMjkxOyI%2BPCFFTlRJVFkgU3F1YXJlU3Vic2V0RXF1YWwgIiYjeDIyOTE7Ij48IUVOVElUWSBzcXN1YnNldGVxICImI3gyMjkxOyI%2BPCFFTlRJVFkgc3FzdXBlICImI3gyMjkyOyI%2BPCFFTlRJVFkgU3F1YXJlU3VwZXJzZXRFcXVhbCAiJiN4MjI5MjsiPjwhRU5USVRZIHNxc3Vwc2V0ZXEgIiYjeDIyOTI7Ij48IUVOVElUWSBzcWNhcCAiJiN4MjI5MzsiPjwhRU5USVRZIFNxdWFyZUludGVyc2VjdGlvbiAiJiN4MjI5MzsiPjwhRU5USVRZIHNxY2FwcyAiJiN4MjI5MzsmI3hGRTAwOyI%2BPCFFTlRJVFkgc3FjdXAgIiYjeDIyOTQ7Ij48IUVOVElUWSBTcXVhcmVVbmlvbiAiJiN4MjI5NDsiPjwhRU5USVRZIHNxY3VwcyAiJiN4MjI5NDsmI3hGRTAwOyI%2BPCFFTlRJVFkgb3BsdXMgIiYjeDIyOTU7Ij48IUVOVElUWSBDaXJjbGVQbHVzICImI3gyMjk1OyI%2BPCFFTlRJVFkgb21pbnVzICImI3gyMjk2OyI%2BPCFFTlRJVFkgQ2lyY2xlTWludXMgIiYjeDIyOTY7Ij48IUVOVElUWSBvdGltZXMgIiYjeDIyOTc7Ij48IUVOVElUWSBDaXJjbGVUaW1lcyAiJiN4MjI5NzsiPjwhRU5USVRZIG9zb2wgIiYjeDIyOTg7Ij48IUVOVElUWSBvZG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgQ2lyY2xlRG90ICImI3gyMjk5OyI%2BPCFFTlRJVFkgb2NpciAiJiN4MjI5QTsiPjwhRU5USVRZIGNpcmNsZWRjaXJjICImI3gyMjlBOyI%2BPCFFTlRJVFkgb2FzdCAiJiN4MjI5QjsiPjwhRU5USVRZIGNpcmNsZWRhc3QgIiYjeDIyOUI7Ij48IUVOVElUWSBvZGFzaCAiJiN4MjI5RDsiPjwhRU5USVRZIGNpcmNsZWRkYXNoICImI3gyMjlEOyI%2BPCFFTlRJVFkgcGx1c2IgIiYjeDIyOUU7Ij48IUVOVElUWSBib3hwbHVzICImI3gyMjlFOyI%2BPCFFTlRJVFkgbWludXNiICImI3gyMjlGOyI%2BPCFFTlRJVFkgYm94bWludXMgIiYjeDIyOUY7Ij48IUVOVElUWSB0aW1lc2IgIiYjeDIyQTA7Ij48IUVOVElUWSBib3h0aW1lcyAiJiN4MjJBMDsiPjwhRU5USVRZIHNkb3RiICImI3gyMkExOyI%2BPCFFTlRJVFkgZG90c3F1YXJlICImI3gyMkExOyI%2BPCFFTlRJVFkgdmRhc2ggIiYjeDIyQTI7Ij48IUVOVElUWSBSaWdodFRlZSAiJiN4MjJBMjsiPjwhRU5USVRZIGRhc2h2ICImI3gyMkEzOyI%2BPCFFTlRJVFkgTGVmdFRlZSAiJiN4MjJBMzsiPjwhRU5USVRZIHRvcCAiJiN4MjJBNDsiPjwhRU5USVRZIERvd25UZWUgIiYjeDIyQTQ7Ij48IUVOVElUWSBib3R0b20gIiYjeDIyQTU7Ij48IUVOVElUWSBib3QgIiYjeDIyQTU7Ij48IUVOVElUWSBwZXJwICImI3gyMkE1OyI%2BPCFFTlRJVFkgVXBUZWUgIiYjeDIyQTU7Ij48IUVOVElUWSBtb2RlbHMgIiYjeDIyQTc7Ij48IUVOVElUWSB2RGFzaCAiJiN4MjJBODsiPjwhRU5USVRZIERvdWJsZVJpZ2h0VGVlICImI3gyMkE4OyI%2BPCFFTlRJVFkgVmRhc2ggIiYjeDIyQTk7Ij48IUVOVElUWSBWdmRhc2ggIiYjeDIyQUE7Ij48IUVOVElUWSBWRGFzaCAiJiN4MjJBQjsiPjwhRU5USVRZIG52ZGFzaCAiJiN4MjJBQzsiPjwhRU5USVRZIG52RGFzaCAiJiN4MjJBRDsiPjwhRU5USVRZIG5WZGFzaCAiJiN4MjJBRTsiPjwhRU5USVRZIG5WRGFzaCAiJiN4MjJBRjsiPjwhRU5USVRZIHBydXJlbCAiJiN4MjJCMDsiPjwhRU5USVRZIHZsdHJpICImI3gyMkIyOyI%2BPCFFTlRJVFkgdmFydHJpYW5nbGVsZWZ0ICImI3gyMkIyOyI%2BPCFFTlRJVFkgTGVmdFRyaWFuZ2xlICImI3gyMkIyOyI%2BPCFFTlRJVFkgdnJ0cmkgIiYjeDIyQjM7Ij48IUVOVElUWSB2YXJ0cmlhbmdsZXJpZ2h0ICImI3gyMkIzOyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZSAiJiN4MjJCMzsiPjwhRU5USVRZIGx0cmllICImI3gyMkI0OyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ZXEgIiYjeDIyQjQ7Ij48IUVOVElUWSBMZWZ0VHJpYW5nbGVFcXVhbCAiJiN4MjJCNDsiPjwhRU5USVRZIG52bHRyaWUgIiYjeDIyQjQ7JiN4MjBEMjsiPjwhRU5USVRZIHJ0cmllICImI3gyMkI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGVyaWdodGVxICImI3gyMkI1OyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZUVxdWFsICImI3gyMkI1OyI%2BPCFFTlRJVFkgbnZydHJpZSAiJiN4MjJCNTsmI3gyMEQyOyI%2BPCFFTlRJVFkgb3JpZ29mICImI3gyMkI2OyI%2BPCFFTlRJVFkgaW1vZiAiJiN4MjJCNzsiPjwhRU5USVRZIG11bWFwICImI3gyMkI4OyI%2BPCFFTlRJVFkgbXVsdGltYXAgIiYjeDIyQjg7Ij48IUVOVElUWSBoZXJjb24gIiYjeDIyQjk7Ij48IUVOVElUWSBpbnRjYWwgIiYjeDIyQkE7Ij48IUVOVElUWSBpbnRlcmNhbCAiJiN4MjJCQTsiPjwhRU5USVRZIHZlZWJhciAiJiN4MjJCQjsiPjwhRU5USVRZIGJhcnZlZSAiJiN4MjJCRDsiPjwhRU5USVRZIGFuZ3J0dmIgIiYjeDIyQkU7Ij48IUVOVElUWSBscnRyaSAiJiN4MjJCRjsiPjwhRU5USVRZIHh3ZWRnZSAiJiN4MjJDMDsiPjwhRU5USVRZIFdlZGdlICImI3gyMkMwOyI%2BPCFFTlRJVFkgYmlnd2VkZ2UgIiYjeDIyQzA7Ij48IUVOVElUWSB4dmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgVmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgYmlndmVlICImI3gyMkMxOyI%2BPCFFTlRJVFkgeGNhcCAiJiN4MjJDMjsiPjwhRU5USVRZIEludGVyc2VjdGlvbiAiJiN4MjJDMjsiPjwhRU5USVRZIGJpZ2NhcCAiJiN4MjJDMjsiPjwhRU5USVRZIHhjdXAgIiYjeDIyQzM7Ij48IUVOVElUWSBVbmlvbiAiJiN4MjJDMzsiPjwhRU5USVRZIGJpZ2N1cCAiJiN4MjJDMzsiPjwhRU5USVRZIGRpYW0gIiYjeDIyQzQ7Ij48IUVOVElUWSBkaWFtb25kICImI3gyMkM0OyI%2BPCFFTlRJVFkgRGlhbW9uZCAiJiN4MjJDNDsiPjwhRU5USVRZIHNkb3QgIiYjeDIyQzU7Ij48IUVOVElUWSBzc3RhcmYgIiYjeDIyQzY7Ij48IUVOVElUWSBTdGFyICImI3gyMkM2OyI%2BPCFFTlRJVFkgZGl2b254ICImI3gyMkM3OyI%2BPCFFTlRJVFkgZGl2aWRlb250aW1lcyAiJiN4MjJDNzsiPjwhRU5USVRZIGJvd3RpZSAiJiN4MjJDODsiPjwhRU5USVRZIGx0aW1lcyAiJiN4MjJDOTsiPjwhRU5USVRZIHJ0aW1lcyAiJiN4MjJDQTsiPjwhRU5USVRZIGx0aHJlZSAiJiN4MjJDQjsiPjwhRU5USVRZIGxlZnR0aHJlZXRpbWVzICImI3gyMkNCOyI%2BPCFFTlRJVFkgcnRocmVlICImI3gyMkNDOyI%2BPCFFTlRJVFkgcmlnaHR0aHJlZXRpbWVzICImI3gyMkNDOyI%2BPCFFTlRJVFkgYnNpbWUgIiYjeDIyQ0Q7Ij48IUVOVElUWSBiYWNrc2ltZXEgIiYjeDIyQ0Q7Ij48IUVOVElUWSBjdXZlZSAiJiN4MjJDRTsiPjwhRU5USVRZIGN1cmx5dmVlICImI3gyMkNFOyI%2BPCFFTlRJVFkgY3V3ZWQgIiYjeDIyQ0Y7Ij48IUVOVElUWSBjdXJseXdlZGdlICImI3gyMkNGOyI%2BPCFFTlRJVFkgU3ViICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3Vic2V0ICImI3gyMkQwOyI%2BPCFFTlRJVFkgU3VwICImI3gyMkQxOyI%2BPCFFTlRJVFkgU3Vwc2V0ICImI3gyMkQxOyI%2BPCFFTlRJVFkgQ2FwICImI3gyMkQyOyI%2BPCFFTlRJVFkgQ3VwICImI3gyMkQzOyI%2BPCFFTlRJVFkgZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIHBpdGNoZm9yayAiJiN4MjJENDsiPjwhRU5USVRZIGVwYXIgIiYjeDIyRDU7Ij48IUVOVElUWSBsdGRvdCAiJiN4MjJENjsiPjwhRU5USVRZIGxlc3Nkb3QgIiYjeDIyRDY7Ij48IUVOVElUWSBndGRvdCAiJiN4MjJENzsiPjwhRU5USVRZIGd0cmRvdCAiJiN4MjJENzsiPjwhRU5USVRZIExsICImI3gyMkQ4OyI%2BPCFFTlRJVFkgbkxsICImI3gyMkQ4OyYjeDMzODsiPjwhRU5USVRZIEdnICImI3gyMkQ5OyI%2BPCFFTlRJVFkgZ2dnICImI3gyMkQ5OyI%2BPCFFTlRJVFkgbkdnICImI3gyMkQ5OyYjeDMzODsiPjwhRU5USVRZIGxlZyAiJiN4MjJEQTsiPjwhRU5USVRZIExlc3NFcXVhbEdyZWF0ZXIgIiYjeDIyREE7Ij48IUVOVElUWSBsZXNzZXFndHIgIiYjeDIyREE7Ij48IUVOVElUWSBsZXNnICImI3gyMkRBOyYjeEZFMDA7Ij48IUVOVElUWSBnZWwgIiYjeDIyREI7Ij48IUVOVElUWSBndHJlcWxlc3MgIiYjeDIyREI7Ij48IUVOVElUWSBHcmVhdGVyRXF1YWxMZXNzICImI3gyMkRCOyI%2BPCFFTlRJVFkgZ2VzbCAiJiN4MjJEQjsmI3hGRTAwOyI%2BPCFFTlRJVFkgY3VlcHIgIiYjeDIyREU7Ij48IUVOVElUWSBjdXJseWVxcHJlYyAiJiN4MjJERTsiPjwhRU5USVRZIGN1ZXNjICImI3gyMkRGOyI%2BPCFFTlRJVFkgY3VybHllcXN1Y2MgIiYjeDIyREY7Ij48IUVOVElUWSBucHJjdWUgIiYjeDIyRTA7Ij48IUVOVElUWSBOb3RQcmVjZWRlc1NsYW50RXF1YWwgIiYjeDIyRTA7Ij48IUVOVElUWSBuc2NjdWUgIiYjeDIyRTE7Ij48IUVOVElUWSBOb3RTdWNjZWVkc1NsYW50RXF1YWwgIiYjeDIyRTE7Ij48IUVOVElUWSBuc3FzdWJlICImI3gyMkUyOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3Vic2V0RXF1YWwgIiYjeDIyRTI7Ij48IUVOVElUWSBuc3FzdXBlICImI3gyMkUzOyI%2BPCFFTlRJVFkgTm90U3F1YXJlU3VwZXJzZXRFcXVhbCAiJiN4MjJFMzsiPjwhRU5USVRZIGxuc2ltICImI3gyMkU2OyI%2BPCFFTlRJVFkgZ25zaW0gIiYjeDIyRTc7Ij48IUVOVElUWSBwcm5zaW0gIiYjeDIyRTg7Ij48IUVOVElUWSBwcmVjbnNpbSAiJiN4MjJFODsiPjwhRU5USVRZIHNjbnNpbSAiJiN4MjJFOTsiPjwhRU5USVRZIHN1Y2Nuc2ltICImI3gyMkU5OyI%2BPCFFTlRJVFkgbmx0cmkgIiYjeDIyRUE7Ij48IUVOVElUWSBudHJpYW5nbGVsZWZ0ICImI3gyMkVBOyI%2BPCFFTlRJVFkgTm90TGVmdFRyaWFuZ2xlICImI3gyMkVBOyI%2BPCFFTlRJVFkgbnJ0cmkgIiYjeDIyRUI7Ij48IUVOVElUWSBudHJpYW5nbGVyaWdodCAiJiN4MjJFQjsiPjwhRU5USVRZIE5vdFJpZ2h0VHJpYW5nbGUgIiYjeDIyRUI7Ij48IUVOVElUWSBubHRyaWUgIiYjeDIyRUM7Ij48IUVOVElUWSBudHJpYW5nbGVsZWZ0ZXEgIiYjeDIyRUM7Ij48IUVOVElUWSBOb3RMZWZ0VHJpYW5nbGVFcXVhbCAiJiN4MjJFQzsiPjwhRU5USVRZIG5ydHJpZSAiJiN4MjJFRDsiPjwhRU5USVRZIG50cmlhbmdsZXJpZ2h0ZXEgIiYjeDIyRUQ7Ij48IUVOVElUWSBOb3RSaWdodFRyaWFuZ2xlRXF1YWwgIiYjeDIyRUQ7Ij48IUVOVElUWSB2ZWxsaXAgIiYjeDIyRUU7Ij48IUVOVElUWSBjdGRvdCAiJiN4MjJFRjsiPjwhRU5USVRZIHV0ZG90ICImI3gyMkYwOyI%2BPCFFTlRJVFkgZHRkb3QgIiYjeDIyRjE7Ij48IUVOVElUWSBkaXNpbiAiJiN4MjJGMjsiPjwhRU5USVRZIGlzaW5zdiAiJiN4MjJGMzsiPjwhRU5USVRZIGlzaW5zICImI3gyMkY0OyI%2BPCFFTlRJVFkgaXNpbmRvdCAiJiN4MjJGNTsiPjwhRU5USVRZIG5vdGluZG90ICImI3gyMkY1OyYjeDMzODsiPjwhRU5USVRZIG5vdGludmMgIiYjeDIyRjY7Ij48IUVOVElUWSBub3RpbnZiICImI3gyMkY3OyI%2BPCFFTlRJVFkgaXNpbkUgIiYjeDIyRjk7Ij48IUVOVElUWSBub3RpbkUgIiYjeDIyRjk7JiN4MzM4OyI%2BPCFFTlRJVFkgbmlzZCAiJiN4MjJGQTsiPjwhRU5USVRZIHhuaXMgIiYjeDIyRkI7Ij48IUVOVElUWSBuaXMgIiYjeDIyRkM7Ij48IUVOVElUWSBub3RuaXZjICImI3gyMkZEOyI%2BPCFFTlRJVFkgbm90bml2YiAiJiN4MjJGRTsiPjwhRU5USVRZIGJhcndlZCAiJiN4MjMwNTsiPjwhRU5USVRZIGJhcndlZGdlICImI3gyMzA1OyI%2BPCFFTlRJVFkgQmFyd2VkICImI3gyMzA2OyI%2BPCFFTlRJVFkgZG91YmxlYmFyd2VkZ2UgIiYjeDIzMDY7Ij48IUVOVElUWSBsY2VpbCAiJiN4MjMwODsiPjwhRU5USVRZIExlZnRDZWlsaW5nICImI3gyMzA4OyI%2BPCFFTlRJVFkgcmNlaWwgIiYjeDIzMDk7Ij48IUVOVElUWSBSaWdodENlaWxpbmcgIiYjeDIzMDk7Ij48IUVOVElUWSBsZmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSBMZWZ0Rmxvb3IgIiYjeDIzMEE7Ij48IUVOVElUWSByZmxvb3IgIiYjeDIzMEI7Ij48IUVOVElUWSBSaWdodEZsb29yICImI3gyMzBCOyI%2BPCFFTlRJVFkgZHJjcm9wICImI3gyMzBDOyI%2BPCFFTlRJVFkgZGxjcm9wICImI3gyMzBEOyI%2BPCFFTlRJVFkgdXJjcm9wICImI3gyMzBFOyI%2BPCFFTlRJVFkgdWxjcm9wICImI3gyMzBGOyI%2BPCFFTlRJVFkgYm5vdCAiJiN4MjMxMDsiPjwhRU5USVRZIHByb2ZsaW5lICImI3gyMzEyOyI%2BPCFFTlRJVFkgcHJvZnN1cmYgIiYjeDIzMTM7Ij48IUVOVElUWSB0ZWxyZWMgIiYjeDIzMTU7Ij48IUVOVElUWSB0YXJnZXQgIiYjeDIzMTY7Ij48IUVOVElUWSB1bGNvcm4gIiYjeDIzMUM7Ij48IUVOVElUWSB1bGNvcm5lciAiJiN4MjMxQzsiPjwhRU5USVRZIHVyY29ybiAiJiN4MjMxRDsiPjwhRU5USVRZIHVyY29ybmVyICImI3gyMzFEOyI%2BPCFFTlRJVFkgZGxjb3JuICImI3gyMzFFOyI%2BPCFFTlRJVFkgbGxjb3JuZXIgIiYjeDIzMUU7Ij48IUVOVElUWSBkcmNvcm4gIiYjeDIzMUY7Ij48IUVOVElUWSBscmNvcm5lciAiJiN4MjMxRjsiPjwhRU5USVRZIGZyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc2Zyb3duICImI3gyMzIyOyI%2BPCFFTlRJVFkgc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBzc21pbGUgIiYjeDIzMjM7Ij48IUVOVElUWSBjeWxjdHkgIiYjeDIzMkQ7Ij48IUVOVElUWSBwcm9mYWxhciAiJiN4MjMyRTsiPjwhRU5USVRZIHRvcGJvdCAiJiN4MjMzNjsiPjwhRU5USVRZIG92YmFyICImI3gyMzNEOyI%2BPCFFTlRJVFkgc29sYmFyICImI3gyMzNGOyI%2BPCFFTlRJVFkgYW5nemFyciAiJiN4MjM3QzsiPjwhRU5USVRZIGxtb3VzdCAiJiN4MjNCMDsiPjwhRU5USVRZIGxtb3VzdGFjaGUgIiYjeDIzQjA7Ij48IUVOVElUWSBybW91c3QgIiYjeDIzQjE7Ij48IUVOVElUWSBybW91c3RhY2hlICImI3gyM0IxOyI%2BPCFFTlRJVFkgdGJyayAiJiN4MjNCNDsiPjwhRU5USVRZIE92ZXJCcmFja2V0ICImI3gyM0I0OyI%2BPCFFTlRJVFkgYmJyayAiJiN4MjNCNTsiPjwhRU5USVRZIFVuZGVyQnJhY2tldCAiJiN4MjNCNTsiPjwhRU5USVRZIGJicmt0YnJrICImI3gyM0I2OyI%2BPCFFTlRJVFkgT3ZlclBhcmVudGhlc2lzICImI3gyM0RDOyI%2BPCFFTlRJVFkgVW5kZXJQYXJlbnRoZXNpcyAiJiN4MjNERDsiPjwhRU5USVRZIE92ZXJCcmFjZSAiJiN4MjNERTsiPjwhRU5USVRZIFVuZGVyQnJhY2UgIiYjeDIzREY7Ij48IUVOVElUWSB0cnBleml1bSAiJiN4MjNFMjsiPjwhRU5USVRZIGVsaW50ZXJzICImI3gyM0U3OyI%2BPCFFTlRJVFkgYmxhbmsgIiYjeDI0MjM7Ij48IUVOVElUWSBvUyAiJiN4MjRDODsiPjwhRU5USVRZIGNpcmNsZWRTICImI3gyNEM4OyI%2BPCFFTlRJVFkgYm94aCAiJiN4MjUwMDsiPjwhRU5USVRZIEhvcml6b250YWxMaW5lICImI3gyNTAwOyI%2BPCFFTlRJVFkgYm94diAiJiN4MjUwMjsiPjwhRU5USVRZIGJveGRyICImI3gyNTBDOyI%2BPCFFTlRJVFkgYm94ZGwgIiYjeDI1MTA7Ij48IUVOVElUWSBib3h1ciAiJiN4MjUxNDsiPjwhRU5USVRZIGJveHVsICImI3gyNTE4OyI%2BPCFFTlRJVFkgYm94dnIgIiYjeDI1MUM7Ij48IUVOVElUWSBib3h2bCAiJiN4MjUyNDsiPjwhRU5USVRZIGJveGhkICImI3gyNTJDOyI%2BPCFFTlRJVFkgYm94aHUgIiYjeDI1MzQ7Ij48IUVOVElUWSBib3h2aCAiJiN4MjUzQzsiPjwhRU5USVRZIGJveEggIiYjeDI1NTA7Ij48IUVOVElUWSBib3hWICImI3gyNTUxOyI%2BPCFFTlRJVFkgYm94ZFIgIiYjeDI1NTI7Ij48IUVOVElUWSBib3hEciAiJiN4MjU1MzsiPjwhRU5USVRZIGJveERSICImI3gyNTU0OyI%2BPCFFTlRJVFkgYm94ZEwgIiYjeDI1NTU7Ij48IUVOVElUWSBib3hEbCAiJiN4MjU1NjsiPjwhRU5USVRZIGJveERMICImI3gyNTU3OyI%2BPCFFTlRJVFkgYm94dVIgIiYjeDI1NTg7Ij48IUVOVElUWSBib3hVciAiJiN4MjU1OTsiPjwhRU5USVRZIGJveFVSICImI3gyNTVBOyI%2BPCFFTlRJVFkgYm94dUwgIiYjeDI1NUI7Ij48IUVOVElUWSBib3hVbCAiJiN4MjU1QzsiPjwhRU5USVRZIGJveFVMICImI3gyNTVEOyI%2BPCFFTlRJVFkgYm94dlIgIiYjeDI1NUU7Ij48IUVOVElUWSBib3hWciAiJiN4MjU1RjsiPjwhRU5USVRZIGJveFZSICImI3gyNTYwOyI%2BPCFFTlRJVFkgYm94dkwgIiYjeDI1NjE7Ij48IUVOVElUWSBib3hWbCAiJiN4MjU2MjsiPjwhRU5USVRZIGJveFZMICImI3gyNTYzOyI%2BPCFFTlRJVFkgYm94SGQgIiYjeDI1NjQ7Ij48IUVOVElUWSBib3hoRCAiJiN4MjU2NTsiPjwhRU5USVRZIGJveEhEICImI3gyNTY2OyI%2BPCFFTlRJVFkgYm94SHUgIiYjeDI1Njc7Ij48IUVOVElUWSBib3hoVSAiJiN4MjU2ODsiPjwhRU5USVRZIGJveEhVICImI3gyNTY5OyI%2BPCFFTlRJVFkgYm94dkggIiYjeDI1NkE7Ij48IUVOVElUWSBib3hWaCAiJiN4MjU2QjsiPjwhRU5USVRZIGJveFZIICImI3gyNTZDOyI%2BPCFFTlRJVFkgdWhibGsgIiYjeDI1ODA7Ij48IUVOVElUWSBsaGJsayAiJiN4MjU4NDsiPjwhRU5USVRZIGJsb2NrICImI3gyNTg4OyI%2BPCFFTlRJVFkgYmxrMTQgIiYjeDI1OTE7Ij48IUVOVElUWSBibGsxMiAiJiN4MjU5MjsiPjwhRU5USVRZIGJsazM0ICImI3gyNTkzOyI%2BPCFFTlRJVFkgc3F1ICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgU3F1YXJlICImI3gyNUExOyI%2BPCFFTlRJVFkgc3F1ZiAiJiN4MjVBQTsiPjwhRU5USVRZIHNxdWFyZiAiJiN4MjVBQTsiPjwhRU5USVRZIGJsYWNrc3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRmlsbGVkVmVyeVNtYWxsU3F1YXJlICImI3gyNUFBOyI%2BPCFFTlRJVFkgRW1wdHlWZXJ5U21hbGxTcXVhcmUgIiYjeDI1QUI7Ij48IUVOVElUWSByZWN0ICImI3gyNUFEOyI%2BPCFFTlRJVFkgbWFya2VyICImI3gyNUFFOyI%2BPCFFTlRJVFkgZmx0bnMgIiYjeDI1QjE7Ij48IUVOVElUWSB4dXRyaSAiJiN4MjVCMzsiPjwhRU5USVRZIGJpZ3RyaWFuZ2xldXAgIiYjeDI1QjM7Ij48IUVOVElUWSB1dHJpZiAiJiN4MjVCNDsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGUgIiYjeDI1QjQ7Ij48IUVOVElUWSB1dHJpICImI3gyNUI1OyI%2BPCFFTlRJVFkgdHJpYW5nbGUgIiYjeDI1QjU7Ij48IUVOVElUWSBydHJpZiAiJiN4MjVCODsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVyaWdodCAiJiN4MjVCODsiPjwhRU5USVRZIHJ0cmkgIiYjeDI1Qjk7Ij48IUVOVElUWSB0cmlhbmdsZXJpZ2h0ICImI3gyNUI5OyI%2BPCFFTlRJVFkgeGR0cmkgIiYjeDI1QkQ7Ij48IUVOVElUWSBiaWd0cmlhbmdsZWRvd24gIiYjeDI1QkQ7Ij48IUVOVElUWSBkdHJpZiAiJiN4MjVCRTsiPjwhRU5USVRZIGJsYWNrdHJpYW5nbGVkb3duICImI3gyNUJFOyI%2BPCFFTlRJVFkgZHRyaSAiJiN4MjVCRjsiPjwhRU5USVRZIHRyaWFuZ2xlZG93biAiJiN4MjVCRjsiPjwhRU5USVRZIGx0cmlmICImI3gyNUMyOyI%2BPCFFTlRJVFkgYmxhY2t0cmlhbmdsZWxlZnQgIiYjeDI1QzI7Ij48IUVOVElUWSBsdHJpICImI3gyNUMzOyI%2BPCFFTlRJVFkgdHJpYW5nbGVsZWZ0ICImI3gyNUMzOyI%2BPCFFTlRJVFkgbG96ICImI3gyNUNBOyI%2BPCFFTlRJVFkgbG96ZW5nZSAiJiN4MjVDQTsiPjwhRU5USVRZIGNpciAiJiN4MjVDQjsiPjwhRU5USVRZIHRyaWRvdCAiJiN4MjVFQzsiPjwhRU5USVRZIHhjaXJjICImI3gyNUVGOyI%2BPCFFTlRJVFkgYmlnY2lyYyAiJiN4MjVFRjsiPjwhRU5USVRZIHVsdHJpICImI3gyNUY4OyI%2BPCFFTlRJVFkgdXJ0cmkgIiYjeDI1Rjk7Ij48IUVOVElUWSBsbHRyaSAiJiN4MjVGQTsiPjwhRU5USVRZIEVtcHR5U21hbGxTcXVhcmUgIiYjeDI1RkI7Ij48IUVOVElUWSBGaWxsZWRTbWFsbFNxdWFyZSAiJiN4MjVGQzsiPjwhRU5USVRZIHN0YXJmICImI3gyNjA1OyI%2BPCFFTlRJVFkgYmlnc3RhciAiJiN4MjYwNTsiPjwhRU5USVRZIHN0YXIgIiYjeDI2MDY7Ij48IUVOVElUWSBwaG9uZSAiJiN4MjYwRTsiPjwhRU5USVRZIGZlbWFsZSAiJiN4MjY0MDsiPjwhRU5USVRZIG1hbGUgIiYjeDI2NDI7Ij48IUVOVElUWSBzcGFkZXMgIiYjeDI2NjA7Ij48IUVOVElUWSBzcGFkZXN1aXQgIiYjeDI2NjA7Ij48IUVOVElUWSBjbHVicyAiJiN4MjY2MzsiPjwhRU5USVRZIGNsdWJzdWl0ICImI3gyNjYzOyI%2BPCFFTlRJVFkgaGVhcnRzICImI3gyNjY1OyI%2BPCFFTlRJVFkgaGVhcnRzdWl0ICImI3gyNjY1OyI%2BPCFFTlRJVFkgZGlhbXMgIiYjeDI2NjY7Ij48IUVOVElUWSBkaWFtb25kc3VpdCAiJiN4MjY2NjsiPjwhRU5USVRZIHN1bmcgIiYjeDI2NkE7Ij48IUVOVElUWSBmbGF0ICImI3gyNjZEOyI%2BPCFFTlRJVFkgbmF0dXIgIiYjeDI2NkU7Ij48IUVOVElUWSBuYXR1cmFsICImI3gyNjZFOyI%2BPCFFTlRJVFkgc2hhcnAgIiYjeDI2NkY7Ij48IUVOVElUWSBjaGVjayAiJiN4MjcxMzsiPjwhRU5USVRZIGNoZWNrbWFyayAiJiN4MjcxMzsiPjwhRU5USVRZIGNyb3NzICImI3gyNzE3OyI%2BPCFFTlRJVFkgbWFsdCAiJiN4MjcyMDsiPjwhRU5USVRZIG1hbHRlc2UgIiYjeDI3MjA7Ij48IUVOVElUWSBzZXh0ICImI3gyNzM2OyI%2BPCFFTlRJVFkgVmVydGljYWxTZXBhcmF0b3IgIiYjeDI3NTg7Ij48IUVOVElUWSBsYmJyayAiJiN4Mjc3MjsiPjwhRU5USVRZIHJiYnJrICImI3gyNzczOyI%2BPCFFTlRJVFkgYnNvbGhzdWIgIiYjeDI3Qzg7Ij48IUVOVElUWSBzdXBoc29sICImI3gyN0M5OyI%2BPCFFTlRJVFkgbG9icmsgIiYjeDI3RTY7Ij48IUVOVElUWSBMZWZ0RG91YmxlQnJhY2tldCAiJiN4MjdFNjsiPjwhRU5USVRZIHJvYnJrICImI3gyN0U3OyI%2BPCFFTlRJVFkgUmlnaHREb3VibGVCcmFja2V0ICImI3gyN0U3OyI%2BPCFFTlRJVFkgbGFuZyAiJiN4MjdFODsiPjwhRU5USVRZIExlZnRBbmdsZUJyYWNrZXQgIiYjeDI3RTg7Ij48IUVOVElUWSBsYW5nbGUgIiYjeDI3RTg7Ij48IUVOVElUWSByYW5nICImI3gyN0U5OyI%2BPCFFTlRJVFkgUmlnaHRBbmdsZUJyYWNrZXQgIiYjeDI3RTk7Ij48IUVOVElUWSByYW5nbGUgIiYjeDI3RTk7Ij48IUVOVElUWSBMYW5nICImI3gyN0VBOyI%2BPCFFTlRJVFkgUmFuZyAiJiN4MjdFQjsiPjwhRU5USVRZIGxvYW5nICImI3gyN0VDOyI%2BPCFFTlRJVFkgcm9hbmcgIiYjeDI3RUQ7Ij48IUVOVElUWSB4bGFyciAiJiN4MjdGNTsiPjwhRU5USVRZIGxvbmdsZWZ0YXJyb3cgIiYjeDI3RjU7Ij48IUVOVElUWSBMb25nTGVmdEFycm93ICImI3gyN0Y1OyI%2BPCFFTlRJVFkgeHJhcnIgIiYjeDI3RjY7Ij48IUVOVElUWSBsb25ncmlnaHRhcnJvdyAiJiN4MjdGNjsiPjwhRU5USVRZIExvbmdSaWdodEFycm93ICImI3gyN0Y2OyI%2BPCFFTlRJVFkgeGhhcnIgIiYjeDI3Rjc7Ij48IUVOVElUWSBsb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSBMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3Rjc7Ij48IUVOVElUWSB4bEFyciAiJiN4MjdGODsiPjwhRU5USVRZIExvbmdsZWZ0YXJyb3cgIiYjeDI3Rjg7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdEFycm93ICImI3gyN0Y4OyI%2BPCFFTlRJVFkgeHJBcnIgIiYjeDI3Rjk7Ij48IUVOVElUWSBMb25ncmlnaHRhcnJvdyAiJiN4MjdGOTsiPjwhRU5USVRZIERvdWJsZUxvbmdSaWdodEFycm93ICImI3gyN0Y5OyI%2BPCFFTlRJVFkgeGhBcnIgIiYjeDI3RkE7Ij48IUVOVElUWSBMb25nbGVmdHJpZ2h0YXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSBEb3VibGVMb25nTGVmdFJpZ2h0QXJyb3cgIiYjeDI3RkE7Ij48IUVOVElUWSB4bWFwICImI3gyN0ZDOyI%2BPCFFTlRJVFkgbG9uZ21hcHN0byAiJiN4MjdGQzsiPjwhRU5USVRZIGR6aWdyYXJyICImI3gyN0ZGOyI%2BPCFFTlRJVFkgbnZsQXJyICImI3gyOTAyOyI%2BPCFFTlRJVFkgbnZyQXJyICImI3gyOTAzOyI%2BPCFFTlRJVFkgbnZIYXJyICImI3gyOTA0OyI%2BPCFFTlRJVFkgTWFwICImI3gyOTA1OyI%2BPCFFTlRJVFkgbGJhcnIgIiYjeDI5MEM7Ij48IUVOVElUWSByYmFyciAiJiN4MjkwRDsiPjwhRU5USVRZIGJrYXJvdyAiJiN4MjkwRDsiPjwhRU5USVRZIGxCYXJyICImI3gyOTBFOyI%2BPCFFTlRJVFkgckJhcnIgIiYjeDI5MEY7Ij48IUVOVElUWSBkYmthcm93ICImI3gyOTBGOyI%2BPCFFTlRJVFkgUkJhcnIgIiYjeDI5MTA7Ij48IUVOVElUWSBkcmJrYXJvdyAiJiN4MjkxMDsiPjwhRU5USVRZIEREb3RyYWhkICImI3gyOTExOyI%2BPCFFTlRJVFkgVXBBcnJvd0JhciAiJiN4MjkxMjsiPjwhRU5USVRZIERvd25BcnJvd0JhciAiJiN4MjkxMzsiPjwhRU5USVRZIFJhcnJ0bCAiJiN4MjkxNjsiPjwhRU5USVRZIGxhdGFpbCAiJiN4MjkxOTsiPjwhRU5USVRZIHJhdGFpbCAiJiN4MjkxQTsiPjwhRU5USVRZIGxBdGFpbCAiJiN4MjkxQjsiPjwhRU5USVRZIHJBdGFpbCAiJiN4MjkxQzsiPjwhRU5USVRZIGxhcnJmcyAiJiN4MjkxRDsiPjwhRU5USVRZIHJhcnJmcyAiJiN4MjkxRTsiPjwhRU5USVRZIGxhcnJiZnMgIiYjeDI5MUY7Ij48IUVOVElUWSByYXJyYmZzICImI3gyOTIwOyI%2BPCFFTlRJVFkgbndhcmhrICImI3gyOTIzOyI%2BPCFFTlRJVFkgbmVhcmhrICImI3gyOTI0OyI%2BPCFFTlRJVFkgc2VhcmhrICImI3gyOTI1OyI%2BPCFFTlRJVFkgaGtzZWFyb3cgIiYjeDI5MjU7Ij48IUVOVElUWSBzd2FyaGsgIiYjeDI5MjY7Ij48IUVOVElUWSBoa3N3YXJvdyAiJiN4MjkyNjsiPjwhRU5USVRZIG53bmVhciAiJiN4MjkyNzsiPjwhRU5USVRZIG5lc2VhciAiJiN4MjkyODsiPjwhRU5USVRZIHRvZWEgIiYjeDI5Mjg7Ij48IUVOVElUWSBzZXN3YXIgIiYjeDI5Mjk7Ij48IUVOVElUWSB0b3NhICImI3gyOTI5OyI%2BPCFFTlRJVFkgc3dud2FyICImI3gyOTJBOyI%2BPCFFTlRJVFkgcmFycmMgIiYjeDI5MzM7Ij48IUVOVElUWSBucmFycmMgIiYjeDI5MzM7JiN4MzM4OyI%2BPCFFTlRJVFkgY3VkYXJyciAiJiN4MjkzNTsiPjwhRU5USVRZIGxkY2EgIiYjeDI5MzY7Ij48IUVOVElUWSByZGNhICImI3gyOTM3OyI%2BPCFFTlRJVFkgY3VkYXJybCAiJiN4MjkzODsiPjwhRU5USVRZIGxhcnJwbCAiJiN4MjkzOTsiPjwhRU5USVRZIGN1cmFycm0gIiYjeDI5M0M7Ij48IUVOVElUWSBjdWxhcnJwICImI3gyOTNEOyI%2BPCFFTlRJVFkgcmFycnBsICImI3gyOTQ1OyI%2BPCFFTlRJVFkgaGFycmNpciAiJiN4Mjk0ODsiPjwhRU5USVRZIFVhcnJvY2lyICImI3gyOTQ5OyI%2BPCFFTlRJVFkgbHVyZHNoYXIgIiYjeDI5NEE7Ij48IUVOVElUWSBsZHJ1c2hhciAiJiN4Mjk0QjsiPjwhRU5USVRZIExlZnRSaWdodFZlY3RvciAiJiN4Mjk0RTsiPjwhRU5USVRZIFJpZ2h0VXBEb3duVmVjdG9yICImI3gyOTRGOyI%2BPCFFTlRJVFkgRG93bkxlZnRSaWdodFZlY3RvciAiJiN4Mjk1MDsiPjwhRU5USVRZIExlZnRVcERvd25WZWN0b3IgIiYjeDI5NTE7Ij48IUVOVElUWSBMZWZ0VmVjdG9yQmFyICImI3gyOTUyOyI%2BPCFFTlRJVFkgUmlnaHRWZWN0b3JCYXIgIiYjeDI5NTM7Ij48IUVOVElUWSBSaWdodFVwVmVjdG9yQmFyICImI3gyOTU0OyI%2BPCFFTlRJVFkgUmlnaHREb3duVmVjdG9yQmFyICImI3gyOTU1OyI%2BPCFFTlRJVFkgRG93bkxlZnRWZWN0b3JCYXIgIiYjeDI5NTY7Ij48IUVOVElUWSBEb3duUmlnaHRWZWN0b3JCYXIgIiYjeDI5NTc7Ij48IUVOVElUWSBMZWZ0VXBWZWN0b3JCYXIgIiYjeDI5NTg7Ij48IUVOVElUWSBMZWZ0RG93blZlY3RvckJhciAiJiN4Mjk1OTsiPjwhRU5USVRZIExlZnRUZWVWZWN0b3IgIiYjeDI5NUE7Ij48IUVOVElUWSBSaWdodFRlZVZlY3RvciAiJiN4Mjk1QjsiPjwhRU5USVRZIFJpZ2h0VXBUZWVWZWN0b3IgIiYjeDI5NUM7Ij48IUVOVElUWSBSaWdodERvd25UZWVWZWN0b3IgIiYjeDI5NUQ7Ij48IUVOVElUWSBEb3duTGVmdFRlZVZlY3RvciAiJiN4Mjk1RTsiPjwhRU5USVRZIERvd25SaWdodFRlZVZlY3RvciAiJiN4Mjk1RjsiPjwhRU5USVRZIExlZnRVcFRlZVZlY3RvciAiJiN4Mjk2MDsiPjwhRU5USVRZIExlZnREb3duVGVlVmVjdG9yICImI3gyOTYxOyI%2BPCFFTlRJVFkgbEhhciAiJiN4Mjk2MjsiPjwhRU5USVRZIHVIYXIgIiYjeDI5NjM7Ij48IUVOVElUWSBySGFyICImI3gyOTY0OyI%2BPCFFTlRJVFkgZEhhciAiJiN4Mjk2NTsiPjwhRU5USVRZIGx1cnVoYXIgIiYjeDI5NjY7Ij48IUVOVElUWSBsZHJkaGFyICImI3gyOTY3OyI%2BPCFFTlRJVFkgcnVsdWhhciAiJiN4Mjk2ODsiPjwhRU5USVRZIHJkbGRoYXIgIiYjeDI5Njk7Ij48IUVOVElUWSBsaGFydWwgIiYjeDI5NkE7Ij48IUVOVElUWSBsbGhhcmQgIiYjeDI5NkI7Ij48IUVOVElUWSByaGFydWwgIiYjeDI5NkM7Ij48IUVOVElUWSBscmhhcmQgIiYjeDI5NkQ7Ij48IUVOVElUWSB1ZGhhciAiJiN4Mjk2RTsiPjwhRU5USVRZIFVwRXF1aWxpYnJpdW0gIiYjeDI5NkU7Ij48IUVOVElUWSBkdWhhciAiJiN4Mjk2RjsiPjwhRU5USVRZIFJldmVyc2VVcEVxdWlsaWJyaXVtICImI3gyOTZGOyI%2BPCFFTlRJVFkgUm91bmRJbXBsaWVzICImI3gyOTcwOyI%2BPCFFTlRJVFkgZXJhcnIgIiYjeDI5NzE7Ij48IUVOVElUWSBzaW1yYXJyICImI3gyOTcyOyI%2BPCFFTlRJVFkgbGFycnNpbSAiJiN4Mjk3MzsiPjwhRU5USVRZIHJhcnJzaW0gIiYjeDI5NzQ7Ij48IUVOVElUWSByYXJyYXAgIiYjeDI5NzU7Ij48IUVOVElUWSBsdGxhcnIgIiYjeDI5NzY7Ij48IUVOVElUWSBndHJhcnIgIiYjeDI5Nzg7Ij48IUVOVElUWSBzdWJyYXJyICImI3gyOTc5OyI%2BPCFFTlRJVFkgc3VwbGFyciAiJiN4Mjk3QjsiPjwhRU5USVRZIGxmaXNodCAiJiN4Mjk3QzsiPjwhRU5USVRZIHJmaXNodCAiJiN4Mjk3RDsiPjwhRU5USVRZIHVmaXNodCAiJiN4Mjk3RTsiPjwhRU5USVRZIGRmaXNodCAiJiN4Mjk3RjsiPjwhRU5USVRZIGxvcGFyICImI3gyOTg1OyI%2BPCFFTlRJVFkgcm9wYXIgIiYjeDI5ODY7Ij48IUVOVElUWSBsYnJrZSAiJiN4Mjk4QjsiPjwhRU5USVRZIHJicmtlICImI3gyOThDOyI%2BPCFFTlRJVFkgbGJya3NsdSAiJiN4Mjk4RDsiPjwhRU5USVRZIHJicmtzbGQgIiYjeDI5OEU7Ij48IUVOVElUWSBsYnJrc2xkICImI3gyOThGOyI%2BPCFFTlRJVFkgcmJya3NsdSAiJiN4Mjk5MDsiPjwhRU5USVRZIGxhbmdkICImI3gyOTkxOyI%2BPCFFTlRJVFkgcmFuZ2QgIiYjeDI5OTI7Ij48IUVOVElUWSBscGFybHQgIiYjeDI5OTM7Ij48IUVOVElUWSBycGFyZ3QgIiYjeDI5OTQ7Ij48IUVOVElUWSBndGxQYXIgIiYjeDI5OTU7Ij48IUVOVElUWSBsdHJQYXIgIiYjeDI5OTY7Ij48IUVOVElUWSB2emlnemFnICImI3gyOTlBOyI%2BPCFFTlRJVFkgdmFuZ3J0ICImI3gyOTlDOyI%2BPCFFTlRJVFkgYW5ncnR2YmQgIiYjeDI5OUQ7Ij48IUVOVElUWSBhbmdlICImI3gyOUE0OyI%2BPCFFTlRJVFkgcmFuZ2UgIiYjeDI5QTU7Ij48IUVOVElUWSBkd2FuZ2xlICImI3gyOUE2OyI%2BPCFFTlRJVFkgdXdhbmdsZSAiJiN4MjlBNzsiPjwhRU5USVRZIGFuZ21zZGFhICImI3gyOUE4OyI%2BPCFFTlRJVFkgYW5nbXNkYWIgIiYjeDI5QTk7Ij48IUVOVElUWSBhbmdtc2RhYyAiJiN4MjlBQTsiPjwhRU5USVRZIGFuZ21zZGFkICImI3gyOUFCOyI%2BPCFFTlRJVFkgYW5nbXNkYWUgIiYjeDI5QUM7Ij48IUVOVElUWSBhbmdtc2RhZiAiJiN4MjlBRDsiPjwhRU5USVRZIGFuZ21zZGFnICImI3gyOUFFOyI%2BPCFFTlRJVFkgYW5nbXNkYWggIiYjeDI5QUY7Ij48IUVOVElUWSBiZW1wdHl2ICImI3gyOUIwOyI%2BPCFFTlRJVFkgZGVtcHR5diAiJiN4MjlCMTsiPjwhRU5USVRZIGNlbXB0eXYgIiYjeDI5QjI7Ij48IUVOVElUWSByYWVtcHR5diAiJiN4MjlCMzsiPjwhRU5USVRZIGxhZW1wdHl2ICImI3gyOUI0OyI%2BPCFFTlRJVFkgb2hiYXIgIiYjeDI5QjU7Ij48IUVOVElUWSBvbWlkICImI3gyOUI2OyI%2BPCFFTlRJVFkgb3BhciAiJiN4MjlCNzsiPjwhRU5USVRZIG9wZXJwICImI3gyOUI5OyI%2BPCFFTlRJVFkgb2xjcm9zcyAiJiN4MjlCQjsiPjwhRU5USVRZIG9kc29sZCAiJiN4MjlCQzsiPjwhRU5USVRZIG9sY2lyICImI3gyOUJFOyI%2BPCFFTlRJVFkgb2ZjaXIgIiYjeDI5QkY7Ij48IUVOVElUWSBvbHQgIiYjeDI5QzA7Ij48IUVOVElUWSBvZ3QgIiYjeDI5QzE7Ij48IUVOVElUWSBjaXJzY2lyICImI3gyOUMyOyI%2BPCFFTlRJVFkgY2lyRSAiJiN4MjlDMzsiPjwhRU5USVRZIHNvbGIgIiYjeDI5QzQ7Ij48IUVOVElUWSBic29sYiAiJiN4MjlDNTsiPjwhRU5USVRZIGJveGJveCAiJiN4MjlDOTsiPjwhRU5USVRZIHRyaXNiICImI3gyOUNEOyI%2BPCFFTlRJVFkgcnRyaWx0cmkgIiYjeDI5Q0U7Ij48IUVOVElUWSBMZWZ0VHJpYW5nbGVCYXIgIiYjeDI5Q0Y7Ij48IUVOVElUWSBOb3RMZWZ0VHJpYW5nbGVCYXIgIiYjeDI5Q0Y7JiN4MzM4OyI%2BPCFFTlRJVFkgUmlnaHRUcmlhbmdsZUJhciAiJiN4MjlEMDsiPjwhRU5USVRZIE5vdFJpZ2h0VHJpYW5nbGVCYXIgIiYjeDI5RDA7JiN4MzM4OyI%2BPCFFTlRJVFkgaWluZmluICImI3gyOURDOyI%2BPCFFTlRJVFkgaW5maW50aWUgIiYjeDI5REQ7Ij48IUVOVElUWSBudmluZmluICImI3gyOURFOyI%2BPCFFTlRJVFkgZXBhcnNsICImI3gyOUUzOyI%2BPCFFTlRJVFkgc21lcGFyc2wgIiYjeDI5RTQ7Ij48IUVOVElUWSBlcXZwYXJzbCAiJiN4MjlFNTsiPjwhRU5USVRZIGxvemYgIiYjeDI5RUI7Ij48IUVOVElUWSBibGFja2xvemVuZ2UgIiYjeDI5RUI7Ij48IUVOVElUWSBSdWxlRGVsYXllZCAiJiN4MjlGNDsiPjwhRU5USVRZIGRzb2wgIiYjeDI5RjY7Ij48IUVOVElUWSB4b2RvdCAiJiN4MkEwMDsiPjwhRU5USVRZIGJpZ29kb3QgIiYjeDJBMDA7Ij48IUVOVElUWSB4b3BsdXMgIiYjeDJBMDE7Ij48IUVOVElUWSBiaWdvcGx1cyAiJiN4MkEwMTsiPjwhRU5USVRZIHhvdGltZSAiJiN4MkEwMjsiPjwhRU5USVRZIGJpZ290aW1lcyAiJiN4MkEwMjsiPjwhRU5USVRZIHh1cGx1cyAiJiN4MkEwNDsiPjwhRU5USVRZIGJpZ3VwbHVzICImI3gyQTA0OyI%2BPCFFTlRJVFkgeHNxY3VwICImI3gyQTA2OyI%2BPCFFTlRJVFkgYmlnc3FjdXAgIiYjeDJBMDY7Ij48IUVOVElUWSBxaW50ICImI3gyQTBDOyI%2BPCFFTlRJVFkgaWlpaW50ICImI3gyQTBDOyI%2BPCFFTlRJVFkgZnBhcnRpbnQgIiYjeDJBMEQ7Ij48IUVOVElUWSBjaXJmbmludCAiJiN4MkExMDsiPjwhRU5USVRZIGF3aW50ICImI3gyQTExOyI%2BPCFFTlRJVFkgcnBwb2xpbnQgIiYjeDJBMTI7Ij48IUVOVElUWSBzY3BvbGludCAiJiN4MkExMzsiPjwhRU5USVRZIG5wb2xpbnQgIiYjeDJBMTQ7Ij48IUVOVElUWSBwb2ludGludCAiJiN4MkExNTsiPjwhRU5USVRZIHF1YXRpbnQgIiYjeDJBMTY7Ij48IUVOVElUWSBpbnRsYXJoayAiJiN4MkExNzsiPjwhRU5USVRZIHBsdXNjaXIgIiYjeDJBMjI7Ij48IUVOVElUWSBwbHVzYWNpciAiJiN4MkEyMzsiPjwhRU5USVRZIHNpbXBsdXMgIiYjeDJBMjQ7Ij48IUVOVElUWSBwbHVzZHUgIiYjeDJBMjU7Ij48IUVOVElUWSBwbHVzc2ltICImI3gyQTI2OyI%2BPCFFTlRJVFkgcGx1c3R3byAiJiN4MkEyNzsiPjwhRU5USVRZIG1jb21tYSAiJiN4MkEyOTsiPjwhRU5USVRZIG1pbnVzZHUgIiYjeDJBMkE7Ij48IUVOVElUWSBsb3BsdXMgIiYjeDJBMkQ7Ij48IUVOVElUWSByb3BsdXMgIiYjeDJBMkU7Ij48IUVOVElUWSBDcm9zcyAiJiN4MkEyRjsiPjwhRU5USVRZIHRpbWVzZCAiJiN4MkEzMDsiPjwhRU5USVRZIHRpbWVzYmFyICImI3gyQTMxOyI%2BPCFFTlRJVFkgc21hc2hwICImI3gyQTMzOyI%2BPCFFTlRJVFkgbG90aW1lcyAiJiN4MkEzNDsiPjwhRU5USVRZIHJvdGltZXMgIiYjeDJBMzU7Ij48IUVOVElUWSBvdGltZXNhcyAiJiN4MkEzNjsiPjwhRU5USVRZIE90aW1lcyAiJiN4MkEzNzsiPjwhRU5USVRZIG9kaXYgIiYjeDJBMzg7Ij48IUVOVElUWSB0cmlwbHVzICImI3gyQTM5OyI%2BPCFFTlRJVFkgdHJpbWludXMgIiYjeDJBM0E7Ij48IUVOVElUWSB0cml0aW1lICImI3gyQTNCOyI%2BPCFFTlRJVFkgaXByb2QgIiYjeDJBM0M7Ij48IUVOVElUWSBpbnRwcm9kICImI3gyQTNDOyI%2BPCFFTlRJVFkgYW1hbGcgIiYjeDJBM0Y7Ij48IUVOVElUWSBjYXBkb3QgIiYjeDJBNDA7Ij48IUVOVElUWSBuY3VwICImI3gyQTQyOyI%2BPCFFTlRJVFkgbmNhcCAiJiN4MkE0MzsiPjwhRU5USVRZIGNhcGFuZCAiJiN4MkE0NDsiPjwhRU5USVRZIGN1cG9yICImI3gyQTQ1OyI%2BPCFFTlRJVFkgY3VwY2FwICImI3gyQTQ2OyI%2BPCFFTlRJVFkgY2FwY3VwICImI3gyQTQ3OyI%2BPCFFTlRJVFkgY3VwYnJjYXAgIiYjeDJBNDg7Ij48IUVOVElUWSBjYXBicmN1cCAiJiN4MkE0OTsiPjwhRU5USVRZIGN1cGN1cCAiJiN4MkE0QTsiPjwhRU5USVRZIGNhcGNhcCAiJiN4MkE0QjsiPjwhRU5USVRZIGNjdXBzICImI3gyQTRDOyI%2BPCFFTlRJVFkgY2NhcHMgIiYjeDJBNEQ7Ij48IUVOVElUWSBjY3Vwc3NtICImI3gyQTUwOyI%2BPCFFTlRJVFkgQW5kICImI3gyQTUzOyI%2BPCFFTlRJVFkgT3IgIiYjeDJBNTQ7Ij48IUVOVElUWSBhbmRhbmQgIiYjeDJBNTU7Ij48IUVOVElUWSBvcm9yICImI3gyQTU2OyI%2BPCFFTlRJVFkgb3JzbG9wZSAiJiN4MkE1NzsiPjwhRU5USVRZIGFuZHNsb3BlICImI3gyQTU4OyI%2BPCFFTlRJVFkgYW5kdiAiJiN4MkE1QTsiPjwhRU5USVRZIG9ydiAiJiN4MkE1QjsiPjwhRU5USVRZIGFuZGQgIiYjeDJBNUM7Ij48IUVOVElUWSBvcmQgIiYjeDJBNUQ7Ij48IUVOVElUWSB3ZWRiYXIgIiYjeDJBNUY7Ij48IUVOVElUWSBzZG90ZSAiJiN4MkE2NjsiPjwhRU5USVRZIHNpbWRvdCAiJiN4MkE2QTsiPjwhRU5USVRZIGNvbmdkb3QgIiYjeDJBNkQ7Ij48IUVOVElUWSBuY29uZ2RvdCAiJiN4MkE2RDsmI3gzMzg7Ij48IUVOVElUWSBlYXN0ZXIgIiYjeDJBNkU7Ij48IUVOVElUWSBhcGFjaXIgIiYjeDJBNkY7Ij48IUVOVElUWSBhcEUgIiYjeDJBNzA7Ij48IUVOVElUWSBuYXBFICImI3gyQTcwOyYjeDMzODsiPjwhRU5USVRZIGVwbHVzICImI3gyQTcxOyI%2BPCFFTlRJVFkgcGx1c2UgIiYjeDJBNzI7Ij48IUVOVElUWSBFc2ltICImI3gyQTczOyI%2BPCFFTlRJVFkgQ29sb25lICImI3gyQTc0OyI%2BPCFFTlRJVFkgRXF1YWwgIiYjeDJBNzU7Ij48IUVOVElUWSBlRERvdCAiJiN4MkE3NzsiPjwhRU5USVRZIGRkb3RzZXEgIiYjeDJBNzc7Ij48IUVOVElUWSBlcXVpdkREICImI3gyQTc4OyI%2BPCFFTlRJVFkgbHRjaXIgIiYjeDJBNzk7Ij48IUVOVElUWSBndGNpciAiJiN4MkE3QTsiPjwhRU5USVRZIGx0cXVlc3QgIiYjeDJBN0I7Ij48IUVOVElUWSBndHF1ZXN0ICImI3gyQTdDOyI%2BPCFFTlRJVFkgbGVzICImI3gyQTdEOyI%2BPCFFTlRJVFkgTGVzc1NsYW50RXF1YWwgIiYjeDJBN0Q7Ij48IUVOVElUWSBsZXFzbGFudCAiJiN4MkE3RDsiPjwhRU5USVRZIG5sZXMgIiYjeDJBN0Q7JiN4MzM4OyI%2BPCFFTlRJVFkgTm90TGVzc1NsYW50RXF1YWwgIiYjeDJBN0Q7JiN4MzM4OyI%2BPCFFTlRJVFkgbmxlcXNsYW50ICImI3gyQTdEOyYjeDMzODsiPjwhRU5USVRZIGdlcyAiJiN4MkE3RTsiPjwhRU5USVRZIEdyZWF0ZXJTbGFudEVxdWFsICImI3gyQTdFOyI%2BPCFFTlRJVFkgZ2Vxc2xhbnQgIiYjeDJBN0U7Ij48IUVOVElUWSBuZ2VzICImI3gyQTdFOyYjeDMzODsiPjwhRU5USVRZIE5vdEdyZWF0ZXJTbGFudEVxdWFsICImI3gyQTdFOyYjeDMzODsiPjwhRU5USVRZIG5nZXFzbGFudCAiJiN4MkE3RTsmI3gzMzg7Ij48IUVOVElUWSBsZXNkb3QgIiYjeDJBN0Y7Ij48IUVOVElUWSBnZXNkb3QgIiYjeDJBODA7Ij48IUVOVElUWSBsZXNkb3RvICImI3gyQTgxOyI%2BPCFFTlRJVFkgZ2VzZG90byAiJiN4MkE4MjsiPjwhRU5USVRZIGxlc2RvdG9yICImI3gyQTgzOyI%2BPCFFTlRJVFkgZ2VzZG90b2wgIiYjeDJBODQ7Ij48IUVOVElUWSBsYXAgIiYjeDJBODU7Ij48IUVOVElUWSBsZXNzYXBwcm94ICImI3gyQTg1OyI%2BPCFFTlRJVFkgZ2FwICImI3gyQTg2OyI%2BPCFFTlRJVFkgZ3RyYXBwcm94ICImI3gyQTg2OyI%2BPCFFTlRJVFkgbG5lICImI3gyQTg3OyI%2BPCFFTlRJVFkgbG5lcSAiJiN4MkE4NzsiPjwhRU5USVRZIGduZSAiJiN4MkE4ODsiPjwhRU5USVRZIGduZXEgIiYjeDJBODg7Ij48IUVOVElUWSBsbmFwICImI3gyQTg5OyI%2BPCFFTlRJVFkgbG5hcHByb3ggIiYjeDJBODk7Ij48IUVOVElUWSBnbmFwICImI3gyQThBOyI%2BPCFFTlRJVFkgZ25hcHByb3ggIiYjeDJBOEE7Ij48IUVOVElUWSBsRWcgIiYjeDJBOEI7Ij48IUVOVElUWSBsZXNzZXFxZ3RyICImI3gyQThCOyI%2BPCFFTlRJVFkgZ0VsICImI3gyQThDOyI%2BPCFFTlRJVFkgZ3RyZXFxbGVzcyAiJiN4MkE4QzsiPjwhRU5USVRZIGxzaW1lICImI3gyQThEOyI%2BPCFFTlRJVFkgZ3NpbWUgIiYjeDJBOEU7Ij48IUVOVElUWSBsc2ltZyAiJiN4MkE4RjsiPjwhRU5USVRZIGdzaW1sICImI3gyQTkwOyI%2BPCFFTlRJVFkgbGdFICImI3gyQTkxOyI%2BPCFFTlRJVFkgZ2xFICImI3gyQTkyOyI%2BPCFFTlRJVFkgbGVzZ2VzICImI3gyQTkzOyI%2BPCFFTlRJVFkgZ2VzbGVzICImI3gyQTk0OyI%2BPCFFTlRJVFkgZWxzICImI3gyQTk1OyI%2BPCFFTlRJVFkgZXFzbGFudGxlc3MgIiYjeDJBOTU7Ij48IUVOVElUWSBlZ3MgIiYjeDJBOTY7Ij48IUVOVElUWSBlcXNsYW50Z3RyICImI3gyQTk2OyI%2BPCFFTlRJVFkgZWxzZG90ICImI3gyQTk3OyI%2BPCFFTlRJVFkgZWdzZG90ICImI3gyQTk4OyI%2BPCFFTlRJVFkgZWwgIiYjeDJBOTk7Ij48IUVOVElUWSBlZyAiJiN4MkE5QTsiPjwhRU5USVRZIHNpbWwgIiYjeDJBOUQ7Ij48IUVOVElUWSBzaW1nICImI3gyQTlFOyI%2BPCFFTlRJVFkgc2ltbEUgIiYjeDJBOUY7Ij48IUVOVElUWSBzaW1nRSAiJiN4MkFBMDsiPjwhRU5USVRZIExlc3NMZXNzICImI3gyQUExOyI%2BPCFFTlRJVFkgTm90TmVzdGVkTGVzc0xlc3MgIiYjeDJBQTE7JiN4MzM4OyI%2BPCFFTlRJVFkgR3JlYXRlckdyZWF0ZXIgIiYjeDJBQTI7Ij48IUVOVElUWSBOb3ROZXN0ZWRHcmVhdGVyR3JlYXRlciAiJiN4MkFBMjsmI3gzMzg7Ij48IUVOVElUWSBnbGogIiYjeDJBQTQ7Ij48IUVOVElUWSBnbGEgIiYjeDJBQTU7Ij48IUVOVElUWSBsdGNjICImI3gyQUE2OyI%2BPCFFTlRJVFkgZ3RjYyAiJiN4MkFBNzsiPjwhRU5USVRZIGxlc2NjICImI3gyQUE4OyI%2BPCFFTlRJVFkgZ2VzY2MgIiYjeDJBQTk7Ij48IUVOVElUWSBzbXQgIiYjeDJBQUE7Ij48IUVOVElUWSBsYXQgIiYjeDJBQUI7Ij48IUVOVElUWSBzbXRlICImI3gyQUFDOyI%2BPCFFTlRJVFkgc210ZXMgIiYjeDJBQUM7JiN4RkUwMDsiPjwhRU5USVRZIGxhdGUgIiYjeDJBQUQ7Ij48IUVOVElUWSBsYXRlcyAiJiN4MkFBRDsmI3hGRTAwOyI%2BPCFFTlRJVFkgYnVtcEUgIiYjeDJBQUU7Ij48IUVOVElUWSBwcmUgIiYjeDJBQUY7Ij48IUVOVElUWSBwcmVjZXEgIiYjeDJBQUY7Ij48IUVOVElUWSBQcmVjZWRlc0VxdWFsICImI3gyQUFGOyI%2BPCFFTlRJVFkgbnByZSAiJiN4MkFBRjsmI3gzMzg7Ij48IUVOVElUWSBucHJlY2VxICImI3gyQUFGOyYjeDMzODsiPjwhRU5USVRZIE5vdFByZWNlZGVzRXF1YWwgIiYjeDJBQUY7JiN4MzM4OyI%2BPCFFTlRJVFkgc2NlICImI3gyQUIwOyI%2BPCFFTlRJVFkgc3VjY2VxICImI3gyQUIwOyI%2BPCFFTlRJVFkgU3VjY2VlZHNFcXVhbCAiJiN4MkFCMDsiPjwhRU5USVRZIG5zY2UgIiYjeDJBQjA7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1Y2NlcSAiJiN4MkFCMDsmI3gzMzg7Ij48IUVOVElUWSBOb3RTdWNjZWVkc0VxdWFsICImI3gyQUIwOyYjeDMzODsiPjwhRU5USVRZIHByRSAiJiN4MkFCMzsiPjwhRU5USVRZIHNjRSAiJiN4MkFCNDsiPjwhRU5USVRZIHBybkUgIiYjeDJBQjU7Ij48IUVOVElUWSBwcmVjbmVxcSAiJiN4MkFCNTsiPjwhRU5USVRZIHNjbkUgIiYjeDJBQjY7Ij48IUVOVElUWSBzdWNjbmVxcSAiJiN4MkFCNjsiPjwhRU5USVRZIHByYXAgIiYjeDJBQjc7Ij48IUVOVElUWSBwcmVjYXBwcm94ICImI3gyQUI3OyI%2BPCFFTlRJVFkgc2NhcCAiJiN4MkFCODsiPjwhRU5USVRZIHN1Y2NhcHByb3ggIiYjeDJBQjg7Ij48IUVOVElUWSBwcm5hcCAiJiN4MkFCOTsiPjwhRU5USVRZIHByZWNuYXBwcm94ICImI3gyQUI5OyI%2BPCFFTlRJVFkgc2NuYXAgIiYjeDJBQkE7Ij48IUVOVElUWSBzdWNjbmFwcHJveCAiJiN4MkFCQTsiPjwhRU5USVRZIFByICImI3gyQUJCOyI%2BPCFFTlRJVFkgU2MgIiYjeDJBQkM7Ij48IUVOVElUWSBzdWJkb3QgIiYjeDJBQkQ7Ij48IUVOVElUWSBzdXBkb3QgIiYjeDJBQkU7Ij48IUVOVElUWSBzdWJwbHVzICImI3gyQUJGOyI%2BPCFFTlRJVFkgc3VwcGx1cyAiJiN4MkFDMDsiPjwhRU5USVRZIHN1Ym11bHQgIiYjeDJBQzE7Ij48IUVOVElUWSBzdXBtdWx0ICImI3gyQUMyOyI%2BPCFFTlRJVFkgc3ViZWRvdCAiJiN4MkFDMzsiPjwhRU5USVRZIHN1cGVkb3QgIiYjeDJBQzQ7Ij48IUVOVElUWSBzdWJFICImI3gyQUM1OyI%2BPCFFTlRJVFkgc3Vic2V0ZXFxICImI3gyQUM1OyI%2BPCFFTlRJVFkgbnN1YkUgIiYjeDJBQzU7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1YnNldGVxcSAiJiN4MkFDNTsmI3gzMzg7Ij48IUVOVElUWSBzdXBFICImI3gyQUM2OyI%2BPCFFTlRJVFkgc3Vwc2V0ZXFxICImI3gyQUM2OyI%2BPCFFTlRJVFkgbnN1cEUgIiYjeDJBQzY7JiN4MzM4OyI%2BPCFFTlRJVFkgbnN1cHNldGVxcSAiJiN4MkFDNjsmI3gzMzg7Ij48IUVOVElUWSBzdWJzaW0gIiYjeDJBQzc7Ij48IUVOVElUWSBzdXBzaW0gIiYjeDJBQzg7Ij48IUVOVElUWSBzdWJuRSAiJiN4MkFDQjsiPjwhRU5USVRZIHN1YnNldG5lcXEgIiYjeDJBQ0I7Ij48IUVOVElUWSB2c3VibkUgIiYjeDJBQ0I7JiN4RkUwMDsiPjwhRU5USVRZIHZhcnN1YnNldG5lcXEgIiYjeDJBQ0I7JiN4RkUwMDsiPjwhRU5USVRZIHN1cG5FICImI3gyQUNDOyI%2BPCFFTlRJVFkgc3Vwc2V0bmVxcSAiJiN4MkFDQzsiPjwhRU5USVRZIHZzdXBuRSAiJiN4MkFDQzsmI3hGRTAwOyI%2BPCFFTlRJVFkgdmFyc3Vwc2V0bmVxcSAiJiN4MkFDQzsmI3hGRTAwOyI%2BPCFFTlRJVFkgY3N1YiAiJiN4MkFDRjsiPjwhRU5USVRZIGNzdXAgIiYjeDJBRDA7Ij48IUVOVElUWSBjc3ViZSAiJiN4MkFEMTsiPjwhRU5USVRZIGNzdXBlICImI3gyQUQyOyI%2BPCFFTlRJVFkgc3Vic3VwICImI3gyQUQzOyI%2BPCFFTlRJVFkgc3Vwc3ViICImI3gyQUQ0OyI%2BPCFFTlRJVFkgc3Vic3ViICImI3gyQUQ1OyI%2BPCFFTlRJVFkgc3Vwc3VwICImI3gyQUQ2OyI%2BPCFFTlRJVFkgc3VwaHN1YiAiJiN4MkFENzsiPjwhRU5USVRZIHN1cGRzdWIgIiYjeDJBRDg7Ij48IUVOVElUWSBmb3JrdiAiJiN4MkFEOTsiPjwhRU5USVRZIHRvcGZvcmsgIiYjeDJBREE7Ij48IUVOVElUWSBtbGNwICImI3gyQURCOyI%2BPCFFTlRJVFkgRGFzaHYgIiYjeDJBRTQ7Ij48IUVOVElUWSBEb3VibGVMZWZ0VGVlICImI3gyQUU0OyI%2BPCFFTlRJVFkgVmRhc2hsICImI3gyQUU2OyI%2BPCFFTlRJVFkgQmFydiAiJiN4MkFFNzsiPjwhRU5USVRZIHZCYXIgIiYjeDJBRTg7Ij48IUVOVElUWSB2QmFydiAiJiN4MkFFOTsiPjwhRU5USVRZIFZiYXIgIiYjeDJBRUI7Ij48IUVOVElUWSBOb3QgIiYjeDJBRUM7Ij48IUVOVElUWSBiTm90ICImI3gyQUVEOyI%2BPCFFTlRJVFkgcm5taWQgIiYjeDJBRUU7Ij48IUVOVElUWSBjaXJtaWQgIiYjeDJBRUY7Ij48IUVOVElUWSBtaWRjaXIgIiYjeDJBRjA7Ij48IUVOVElUWSB0b3BjaXIgIiYjeDJBRjE7Ij48IUVOVElUWSBuaHBhciAiJiN4MkFGMjsiPjwhRU5USVRZIHBhcnNpbSAiJiN4MkFGMzsiPjwhRU5USVRZIHBhcnNsICImI3gyQUZEOyI%2BPCFFTlRJVFkgbnBhcnNsICImI3gyQUZEOyYjeDIwRTU7Ij48IUVOVElUWSBmZmxpZyAiJiN4RkIwMDsiPjwhRU5USVRZIGZpbGlnICImI3hGQjAxOyI%2BPCFFTlRJVFkgZmxsaWcgIiYjeEZCMDI7Ij48IUVOVElUWSBmZmlsaWcgIiYjeEZCMDM7Ij48IUVOVElUWSBmZmxsaWcgIiYjeEZCMDQ7Ij48IUVOVElUWSBBc2NyICImI3gxRDQ5QzsiPjwhRU5USVRZIENzY3IgIiYjeDFENDlFOyI%2BPCFFTlRJVFkgRHNjciAiJiN4MUQ0OUY7Ij48IUVOVElUWSBHc2NyICImI3gxRDRBMjsiPjwhRU5USVRZIEpzY3IgIiYjeDFENEE1OyI%2BPCFFTlRJVFkgS3NjciAiJiN4MUQ0QTY7Ij48IUVOVElUWSBOc2NyICImI3gxRDRBOTsiPjwhRU5USVRZIE9zY3IgIiYjeDFENEFBOyI%2BPCFFTlRJVFkgUHNjciAiJiN4MUQ0QUI7Ij48IUVOVElUWSBRc2NyICImI3gxRDRBQzsiPjwhRU5USVRZIFNzY3IgIiYjeDFENEFFOyI%2BPCFFTlRJVFkgVHNjciAiJiN4MUQ0QUY7Ij48IUVOVElUWSBVc2NyICImI3gxRDRCMDsiPjwhRU5USVRZIFZzY3IgIiYjeDFENEIxOyI%2BPCFFTlRJVFkgV3NjciAiJiN4MUQ0QjI7Ij48IUVOVElUWSBYc2NyICImI3gxRDRCMzsiPjwhRU5USVRZIFlzY3IgIiYjeDFENEI0OyI%2BPCFFTlRJVFkgWnNjciAiJiN4MUQ0QjU7Ij48IUVOVElUWSBhc2NyICImI3gxRDRCNjsiPjwhRU5USVRZIGJzY3IgIiYjeDFENEI3OyI%2BPCFFTlRJVFkgY3NjciAiJiN4MUQ0Qjg7Ij48IUVOVElUWSBkc2NyICImI3gxRDRCOTsiPjwhRU5USVRZIGZzY3IgIiYjeDFENEJCOyI%2BPCFFTlRJVFkgaHNjciAiJiN4MUQ0QkQ7Ij48IUVOVElUWSBpc2NyICImI3gxRDRCRTsiPjwhRU5USVRZIGpzY3IgIiYjeDFENEJGOyI%2BPCFFTlRJVFkga3NjciAiJiN4MUQ0QzA7Ij48IUVOVElUWSBsc2NyICImI3gxRDRDMTsiPjwhRU5USVRZIG1zY3IgIiYjeDFENEMyOyI%2BPCFFTlRJVFkgbnNjciAiJiN4MUQ0QzM7Ij48IUVOVElUWSBwc2NyICImI3gxRDRDNTsiPjwhRU5USVRZIHFzY3IgIiYjeDFENEM2OyI%2BPCFFTlRJVFkgcnNjciAiJiN4MUQ0Qzc7Ij48IUVOVElUWSBzc2NyICImI3gxRDRDODsiPjwhRU5USVRZIHRzY3IgIiYjeDFENEM5OyI%2BPCFFTlRJVFkgdXNjciAiJiN4MUQ0Q0E7Ij48IUVOVElUWSB2c2NyICImI3gxRDRDQjsiPjwhRU5USVRZIHdzY3IgIiYjeDFENENDOyI%2BPCFFTlRJVFkgeHNjciAiJiN4MUQ0Q0Q7Ij48IUVOVElUWSB5c2NyICImI3gxRDRDRTsiPjwhRU5USVRZIHpzY3IgIiYjeDFENENGOyI%2BPCFFTlRJVFkgQWZyICImI3gxRDUwNDsiPjwhRU5USVRZIEJmciAiJiN4MUQ1MDU7Ij48IUVOVElUWSBEZnIgIiYjeDFENTA3OyI%2BPCFFTlRJVFkgRWZyICImI3gxRDUwODsiPjwhRU5USVRZIEZmciAiJiN4MUQ1MDk7Ij48IUVOVElUWSBHZnIgIiYjeDFENTBBOyI%2BPCFFTlRJVFkgSmZyICImI3gxRDUwRDsiPjwhRU5USVRZIEtmciAiJiN4MUQ1MEU7Ij48IUVOVElUWSBMZnIgIiYjeDFENTBGOyI%2BPCFFTlRJVFkgTWZyICImI3gxRDUxMDsiPjwhRU5USVRZIE5mciAiJiN4MUQ1MTE7Ij48IUVOVElUWSBPZnIgIiYjeDFENTEyOyI%2BPCFFTlRJVFkgUGZyICImI3gxRDUxMzsiPjwhRU5USVRZIFFmciAiJiN4MUQ1MTQ7Ij48IUVOVElUWSBTZnIgIiYjeDFENTE2OyI%2BPCFFTlRJVFkgVGZyICImI3gxRDUxNzsiPjwhRU5USVRZIFVmciAiJiN4MUQ1MTg7Ij48IUVOVElUWSBWZnIgIiYjeDFENTE5OyI%2BPCFFTlRJVFkgV2ZyICImI3gxRDUxQTsiPjwhRU5USVRZIFhmciAiJiN4MUQ1MUI7Ij48IUVOVElUWSBZZnIgIiYjeDFENTFDOyI%2BPCFFTlRJVFkgYWZyICImI3gxRDUxRTsiPjwhRU5USVRZIGJmciAiJiN4MUQ1MUY7Ij48IUVOVElUWSBjZnIgIiYjeDFENTIwOyI%2BPCFFTlRJVFkgZGZyICImI3gxRDUyMTsiPjwhRU5USVRZIGVmciAiJiN4MUQ1MjI7Ij48IUVOVElUWSBmZnIgIiYjeDFENTIzOyI%2BPCFFTlRJVFkgZ2ZyICImI3gxRDUyNDsiPjwhRU5USVRZIGhmciAiJiN4MUQ1MjU7Ij48IUVOVElUWSBpZnIgIiYjeDFENTI2OyI%2BPCFFTlRJVFkgamZyICImI3gxRDUyNzsiPjwhRU5USVRZIGtmciAiJiN4MUQ1Mjg7Ij48IUVOVElUWSBsZnIgIiYjeDFENTI5OyI%2BPCFFTlRJVFkgbWZyICImI3gxRDUyQTsiPjwhRU5USVRZIG5mciAiJiN4MUQ1MkI7Ij48IUVOVElUWSBvZnIgIiYjeDFENTJDOyI%2BPCFFTlRJVFkgcGZyICImI3gxRDUyRDsiPjwhRU5USVRZIHFmciAiJiN4MUQ1MkU7Ij48IUVOVElUWSByZnIgIiYjeDFENTJGOyI%2BPCFFTlRJVFkgc2ZyICImI3gxRDUzMDsiPjwhRU5USVRZIHRmciAiJiN4MUQ1MzE7Ij48IUVOVElUWSB1ZnIgIiYjeDFENTMyOyI%2BPCFFTlRJVFkgdmZyICImI3gxRDUzMzsiPjwhRU5USVRZIHdmciAiJiN4MUQ1MzQ7Ij48IUVOVElUWSB4ZnIgIiYjeDFENTM1OyI%2BPCFFTlRJVFkgeWZyICImI3gxRDUzNjsiPjwhRU5USVRZIHpmciAiJiN4MUQ1Mzc7Ij48IUVOVElUWSBBb3BmICImI3gxRDUzODsiPjwhRU5USVRZIEJvcGYgIiYjeDFENTM5OyI%2BPCFFTlRJVFkgRG9wZiAiJiN4MUQ1M0I7Ij48IUVOVElUWSBFb3BmICImI3gxRDUzQzsiPjwhRU5USVRZIEZvcGYgIiYjeDFENTNEOyI%2BPCFFTlRJVFkgR29wZiAiJiN4MUQ1M0U7Ij48IUVOVElUWSBJb3BmICImI3gxRDU0MDsiPjwhRU5USVRZIEpvcGYgIiYjeDFENTQxOyI%2BPCFFTlRJVFkgS29wZiAiJiN4MUQ1NDI7Ij48IUVOVElUWSBMb3BmICImI3gxRDU0MzsiPjwhRU5USVRZIE1vcGYgIiYjeDFENTQ0OyI%2BPCFFTlRJVFkgT29wZiAiJiN4MUQ1NDY7Ij48IUVOVElUWSBTb3BmICImI3gxRDU0QTsiPjwhRU5USVRZIFRvcGYgIiYjeDFENTRCOyI%2BPCFFTlRJVFkgVW9wZiAiJiN4MUQ1NEM7Ij48IUVOVElUWSBWb3BmICImI3gxRDU0RDsiPjwhRU5USVRZIFdvcGYgIiYjeDFENTRFOyI%2BPCFFTlRJVFkgWG9wZiAiJiN4MUQ1NEY7Ij48IUVOVElUWSBZb3BmICImI3gxRDU1MDsiPjwhRU5USVRZIGFvcGYgIiYjeDFENTUyOyI%2BPCFFTlRJVFkgYm9wZiAiJiN4MUQ1NTM7Ij48IUVOVElUWSBjb3BmICImI3gxRDU1NDsiPjwhRU5USVRZIGRvcGYgIiYjeDFENTU1OyI%2BPCFFTlRJVFkgZW9wZiAiJiN4MUQ1NTY7Ij48IUVOVElUWSBmb3BmICImI3gxRDU1NzsiPjwhRU5USVRZIGdvcGYgIiYjeDFENTU4OyI%2BPCFFTlRJVFkgaG9wZiAiJiN4MUQ1NTk7Ij48IUVOVElUWSBpb3BmICImI3gxRDU1QTsiPjwhRU5USVRZIGpvcGYgIiYjeDFENTVCOyI%2BPCFFTlRJVFkga29wZiAiJiN4MUQ1NUM7Ij48IUVOVElUWSBsb3BmICImI3gxRDU1RDsiPjwhRU5USVRZIG1vcGYgIiYjeDFENTVFOyI%2BPCFFTlRJVFkgbm9wZiAiJiN4MUQ1NUY7Ij48IUVOVElUWSBvb3BmICImI3gxRDU2MDsiPjwhRU5USVRZIHBvcGYgIiYjeDFENTYxOyI%2BPCFFTlRJVFkgcW9wZiAiJiN4MUQ1NjI7Ij48IUVOVElUWSByb3BmICImI3gxRDU2MzsiPjwhRU5USVRZIHNvcGYgIiYjeDFENTY0OyI%2BPCFFTlRJVFkgdG9wZiAiJiN4MUQ1NjU7Ij48IUVOVElUWSB1b3BmICImI3gxRDU2NjsiPjwhRU5USVRZIHZvcGYgIiYjeDFENTY3OyI%2BPCFFTlRJVFkgd29wZiAiJiN4MUQ1Njg7Ij48IUVOVElUWSB4b3BmICImI3gxRDU2OTsiPjwhRU5USVRZIHlvcGYgIiYjeDFENTZBOyI%2BPCFFTlRJVFkgem9wZiAiJiN4MUQ1NkI7Ij4%3D>the URL given by this link</a>. (This
- URL is a DTD containing the <a href=http://www.w3.org/TR/xml/#sec-entity-decl>entity
- declarations</a> for the names listed in the <a href=#named-character-references id=parsing-xhtml-documents:named-character-references>named character references</a> section.) <a href=#refsXML>[XML]</a></p>
- <ul class=brief><li><code>-//W3C//DTD XHTML 1.0 Transitional//EN</code><li><code>-//W3C//DTD XHTML 1.1//EN</code><li><code>-//W3C//DTD XHTML 1.0 Strict//EN</code><li><code>-//W3C//DTD XHTML 1.0 Frameset//EN</code><li><code>-//W3C//DTD XHTML Basic 1.0//EN</code><li><code>-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN</code><li><code>-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN</code><li><code>-//W3C//DTD MathML 2.0//EN</code><li><code>-//WAPFORUM//DTD XHTML Mobile 1.0//EN</code></ul>
- <p>Furthermore, user agents should attempt to retrieve the above external entity's content when
- one of the above public identifiers is used, and should not attempt to retrieve any other external
- entity's content.</p>
- <p class=note>This is not strictly a <a href=#willful-violation id=parsing-xhtml-documents:willful-violation>violation</a> of the XML
- specification, but it does contradict the spirit of the XML specification's requirements. This is
- motivated by a desire for user agents to all handle entities in an interoperable fashion without
- requiring any network access for handling external subsets. <a href=#refsXML>[XML]</a></p>
- <p>XML parsers can be invoked with <dfn id=xml-scripting-support-enabled>XML scripting support enabled</dfn> or <dfn id=xml-scripting-support-disabled>disabled</dfn>. Except where otherwise specified, XML parsers are
- invoked with <a href=#xml-scripting-support-enabled id=parsing-xhtml-documents:xml-scripting-support-enabled>XML scripting support enabled</a>.</p>
- <p id=scriptTagXML>When an <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-3>XML parser</a> with <a href=#xml-scripting-support-enabled id=parsing-xhtml-documents:xml-scripting-support-enabled-2>XML scripting support enabled</a>
- creates a <code id=parsing-xhtml-documents:the-script-element><a href=#the-script-element>script</a></code> element, it
- must be marked as being <a href=#parser-inserted id=parsing-xhtml-documents:parser-inserted>"parser-inserted"</a> and its <a href=#force-async id=parsing-xhtml-documents:force-async>"force-async"</a> flag
- must be unset. If the parser was originally created for the <a href=#xml-fragment-parsing-algorithm id=parsing-xhtml-documents:xml-fragment-parsing-algorithm>XML fragment parsing
- algorithm</a>, then the element must be marked as <a href=#already-started id=parsing-xhtml-documents:already-started>"already started"</a> also. When the
- element's end tag is subsequently parsed, the user agent must <a href=#perform-a-microtask-checkpoint id=parsing-xhtml-documents:perform-a-microtask-checkpoint>perform a microtask checkpoint</a>, and
- then <a href=#prepare-a-script id=parsing-xhtml-documents:prepare-a-script>prepare</a> the <code id=parsing-xhtml-documents:the-script-element-2><a href=#the-script-element>script</a></code> element. If this
- causes there to be a <a href=#pending-parsing-blocking-script id=parsing-xhtml-documents:pending-parsing-blocking-script>pending parsing-blocking script</a>, then the user agent must run
- the following steps:</p>
- <ol><li><p>Block this instance of the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-4>XML parser</a>, such that the <a href=#event-loop id=parsing-xhtml-documents:event-loop>event loop</a>
- will not run <a href=#concept-task id=parsing-xhtml-documents:concept-task>tasks</a> that invoke it.<li><p><a href=#spin-the-event-loop id=parsing-xhtml-documents:spin-the-event-loop>Spin the event loop</a> until the parser's <code id=parsing-xhtml-documents:document-5><a href=#document>Document</a></code> <a href=#has-no-style-sheet-that-is-blocking-scripts id=parsing-xhtml-documents:has-no-style-sheet-that-is-blocking-scripts>has no
- style sheet that is blocking scripts</a> and the <a href=#pending-parsing-blocking-script id=parsing-xhtml-documents:pending-parsing-blocking-script-2>pending parsing-blocking
- script</a>'s <a href=#ready-to-be-parser-executed id=parsing-xhtml-documents:ready-to-be-parser-executed>"ready to be parser-executed"</a> flag is set.<li><p>Unblock this instance of the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-5>XML parser</a>, such that <a href=#concept-task id=parsing-xhtml-documents:concept-task-2>tasks</a> that invoke it can again be run.<li><p><a href=#execute-the-script-block id=parsing-xhtml-documents:execute-the-script-block>Execute</a> the <a href=#pending-parsing-blocking-script id=parsing-xhtml-documents:pending-parsing-blocking-script-3>pending parsing-blocking
- script</a>.<li><p>There is no longer a <a href=#pending-parsing-blocking-script id=parsing-xhtml-documents:pending-parsing-blocking-script-4>pending parsing-blocking script</a>.</ol>
- <p class=note>Since the <code id=parsing-xhtml-documents:dom-document-write><a href=#dom-document-write>document.write()</a></code> API is not
- available for <a href=#xml-documents id=parsing-xhtml-documents:xml-documents>XML documents</a>, much of the complexity in the <a href=#html-parser id=parsing-xhtml-documents:html-parser>HTML parser</a>
- is not needed in the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-6>XML parser</a>.</p>
- <p class=note>When the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-7>XML parser</a> has <a href=#xml-scripting-support-disabled id=parsing-xhtml-documents:xml-scripting-support-disabled>XML scripting support disabled</a>,
- none of this happens.</p>
- <p id=templateTagXML>When an <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-8>XML parser</a> would append a node to a
- <code id=parsing-xhtml-documents:the-template-element><a href=#the-template-element>template</a></code> element, it must instead append it to the <code id=parsing-xhtml-documents:the-template-element-2><a href=#the-template-element>template</a></code> element's
- <a href=#template-contents id=parsing-xhtml-documents:template-contents>template contents</a> (a <code id=parsing-xhtml-documents:documentfragment><a href=#documentfragment>DocumentFragment</a></code> node).</p>
- <p class=note>This is a <a href=#willful-violation id=parsing-xhtml-documents:willful-violation-2>willful violation</a> of the XML specification; unfortunately,
- XML is not formally extensible in the manner that is needed for <code id=parsing-xhtml-documents:the-template-element-3><a href=#the-template-element>template</a></code> processing.
- <a href=#refsXML>[XML]</a></p>
- <p>When an <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-9>XML parser</a> creates a <code id=parsing-xhtml-documents:node><a href=#node>Node</a></code> object, its <a id=parsing-xhtml-documents:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>
- must be set to the <a id=parsing-xhtml-documents:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> of
- the node into which the newly created node is to be inserted.</p>
- <p>Certain algorithms in this specification <dfn id=feed-the-parser>spoon-feed the
- parser</dfn> characters one string at a time. In such cases, the <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-10>XML parser</a> must act
- as it would have if faced with a single string consisting of the concatenation of all those
- characters.</p>
- <p>When an <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-11>XML parser</a> reaches the end of its input, it must <a href=#stop-parsing id=parsing-xhtml-documents:stop-parsing>stop
- parsing</a>, following the same rules as the <a href=#html-parser id=parsing-xhtml-documents:html-parser-2>HTML parser</a>. An <a href=#xml-parser id=parsing-xhtml-documents:xml-parser-12>XML
- parser</a> can also be <a href=#abort-a-parser id=parsing-xhtml-documents:abort-a-parser>aborted</a>, which must again by done in
- the same way as for an <a href=#html-parser id=parsing-xhtml-documents:html-parser-3>HTML parser</a>.</p>
- <p>For the purposes of conformance checkers, if a resource is determined to be in <a href=#the-xhtml-syntax id=parsing-xhtml-documents:the-xhtml-syntax>the XHTML
- syntax</a>, then it is an <a href=#xml-documents id=parsing-xhtml-documents:xml-documents-2>XML document</a>.</p>
- <h3 id=serialising-xhtml-fragments>13.3 Serialising XHTML fragments</h3>
- <p>The <dfn id=xml-fragment-serialisation-algorithm>XML fragment serialisation algorithm</dfn> for a <code id=serialising-xhtml-fragments:document><a href=#document>Document</a></code> or
- <code id=serialising-xhtml-fragments:element><a href=#element>Element</a></code> node either returns a fragment of XML that represents that node or throws an
- exception.</p>
- <p>For <code id=serialising-xhtml-fragments:document-2><a href=#document>Document</a></code>s, the algorithm must return a string in the form of a <a href=http://www.w3.org/TR/xml/#sec-well-formed>document entity</a>, if none of the error cases
- below apply.</p>
- <p>For <code id=serialising-xhtml-fragments:element-2><a href=#element>Element</a></code>s, the algorithm must return a string in the form of an <a href=http://www.w3.org/TR/xml/#wf-entities>internal general parsed entity</a>, if none of the
- error cases below apply.</p>
- <p>In both cases, the string returned must be XML namespace-well-formed and must be an isomorphic
- serialisation of all of that node's <a href=#relevant-child-nodes id=serialising-xhtml-fragments:relevant-child-nodes>relevant child nodes</a>, in <a href=#tree-order id=serialising-xhtml-fragments:tree-order>tree order</a>.
- User agents may adjust prefixes and namespace declarations in the serialisation (and indeed might
- be forced to do so in some cases to obtain namespace-well-formed XML). User agents may use a
- combination of regular text and character references to represent <code id=serialising-xhtml-fragments:text><a href=#text>Text</a></code> nodes in the
- DOM.</p>
- <p>A node's <dfn id=relevant-child-nodes>relevant child nodes</dfn> are those that apply given the following rules:</p>
- <dl><dt>For <code id=serialising-xhtml-fragments:the-template-element><a href=#the-template-element>template</a></code> elements<dd>The <a href=#relevant-child-nodes id=serialising-xhtml-fragments:relevant-child-nodes-2>relevant child nodes</a> are the child nodes of the <code id=serialising-xhtml-fragments:the-template-element-2><a href=#the-template-element>template</a></code>
- element's <a href=#template-contents id=serialising-xhtml-fragments:template-contents>template contents</a>, if any.<dt>For all other nodes<dd>The <a href=#relevant-child-nodes id=serialising-xhtml-fragments:relevant-child-nodes-3>relevant child nodes</a> are the child nodes of node itself, if any.</dl>
- <p>For <code id=serialising-xhtml-fragments:element-3><a href=#element>Element</a></code>s, if any of the elements in the serialisation are in no namespace, the
- default namespace in scope for those elements must be explicitly declared as the empty string. (This doesn't apply in the <code id=serialising-xhtml-fragments:document-3><a href=#document>Document</a></code> case.) <a href=#refsXML>[XML]</a>
- <a href=#refsXMLNS>[XMLNS]</a></p>
- <p>For the purposes of this section, an internal general parsed entity is considered XML
- namespace-well-formed if a document consisting of an element with no namespace declarations whose
- contents are the internal general parsed entity would itself be XML namespace-well-formed.</p>
- <p>If any of the following error cases are found in the DOM subtree being serialised, then the
- algorithm must throw an <code id=serialising-xhtml-fragments:invalidstateerror><a href=#invalidstateerror>InvalidStateError</a></code> exception instead of returning a
- string:</p>
- <ul><li>A <code id=serialising-xhtml-fragments:document-4><a href=#document>Document</a></code> node with no child element nodes.<li>A <code id=serialising-xhtml-fragments:documenttype><a href=#documenttype>DocumentType</a></code> node that has an external subset public identifier that contains
- characters that are not matched by the XML <code>PubidChar</code> production. <a href=#refsXML>[XML]</a><li>A <code id=serialising-xhtml-fragments:documenttype-2><a href=#documenttype>DocumentType</a></code> node that has an external subset system identifier that contains
- both a U+0022 QUOTATION MARK (") and a U+0027 APOSTROPHE (') or that contains characters that are
- not matched by the XML <code>Char</code> production. <a href=#refsXML>[XML]</a><li>A node with a local name containing a U+003A COLON (:).<li>A node with a local name that does not match the XML <code>Name</code> production. <a href=#refsXML>[XML]</a><li>An <code id=serialising-xhtml-fragments:attr><a href=#attr>Attr</a></code> node with no namespace whose local name is the lowercase string "<code>xmlns</code>". <a href=#refsXMLNS>[XMLNS]</a><li>An <code id=serialising-xhtml-fragments:element-4><a href=#element>Element</a></code> node with two or more attributes with the same local name and
- namespace.<li>An <code id=serialising-xhtml-fragments:attr-2><a href=#attr>Attr</a></code> node, <code id=serialising-xhtml-fragments:text-2><a href=#text>Text</a></code> node, <code id=serialising-xhtml-fragments:comment-2><a href=#comment-2>Comment</a></code> node, or
- <code id=serialising-xhtml-fragments:processinginstruction><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains characters that are not matched by
- the XML <code>Char</code> production. <a href=#refsXML>[XML]</a><li>A <code id=serialising-xhtml-fragments:comment-2-2><a href=#comment-2>Comment</a></code> node whose data contains two adjacent U+002D HYPHEN-MINUS characters
- (-) or ends with such a character.<li>A <code id=serialising-xhtml-fragments:processinginstruction-2><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name is an <a href=#ascii-case-insensitive id=serialising-xhtml-fragments:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the string "<code>xml</code>".<li>A <code id=serialising-xhtml-fragments:processinginstruction-3><a href=#processinginstruction>ProcessingInstruction</a></code> node whose target name contains a U+003A COLON (:).<li>A <code id=serialising-xhtml-fragments:processinginstruction-4><a href=#processinginstruction>ProcessingInstruction</a></code> node whose data contains the string "<code>?></code>".</ul>
- <p class=note>These are the only ways to make a DOM unserialisable. The DOM enforces all the
- other XML constraints; for example, trying to append two elements to a <code id=serialising-xhtml-fragments:document-5><a href=#document>Document</a></code> node
- will throw a <code id=serialising-xhtml-fragments:hierarchyrequesterror><a href=#hierarchyrequesterror>HierarchyRequestError</a></code> exception.</p>
- <h3 id=parsing-xhtml-fragments>13.4 Parsing XHTML fragments</h3>
- <p>The <dfn id=xml-fragment-parsing-algorithm>XML fragment parsing algorithm</dfn> either returns a <code id=parsing-xhtml-fragments:document><a href=#document>Document</a></code> or throws
- a <code id=parsing-xhtml-fragments:syntaxerror><a href=#syntaxerror>SyntaxError</a></code> exception. Given a string <var>input</var> and an optional
- context element <var id=parsing-xhtml-fragments:concept-frag-parse-context><a href=#concept-frag-parse-context>context</a></var>, the algorithm is as
- follows:</p>
- <ol><li>
- <p>Create a new <a href=#xml-parser id=parsing-xhtml-fragments:xml-parser>XML parser</a>.</p>
- <li>
- <p>If there is a <var id=parsing-xhtml-fragments:concept-frag-parse-context-2><a href=#concept-frag-parse-context>context</a></var> element, <a href=#feed-the-parser id=parsing-xhtml-fragments:feed-the-parser>feed the
- parser</a> just created the string corresponding to the start tag of that element, declaring
- all the namespace prefixes that are in scope on that element in the DOM, as well as declaring
- the default namespace (if any) that is in scope on that element in the DOM.</p>
- <p>A namespace prefix is in scope if the DOM <code>lookupNamespaceURI()</code> method
- on the element would return a non-null value for that prefix.</p>
- <p>The default namespace is the namespace for which the DOM <code>isDefaultNamespace()</code> method on the element would return true.</p>
- <p class=note>If there is a <var id=parsing-xhtml-fragments:concept-frag-parse-context-3><a href=#concept-frag-parse-context>context</a></var> element, no
- <code>DOCTYPE</code> is passed to the parser, and therefore no external subset is
- referenced, and therefore no entities will be recognized.</p>
- <li>
- <p><a href=#feed-the-parser id=parsing-xhtml-fragments:feed-the-parser-2>Feed the parser</a> just created the string <var>input</var>.</p>
- <li>
- <p>If there is a <var id=parsing-xhtml-fragments:concept-frag-parse-context-4><a href=#concept-frag-parse-context>context</a></var> element, <a href=#feed-the-parser id=parsing-xhtml-fragments:feed-the-parser-3>feed the
- parser</a> just created the string corresponding to the end tag of that element.</p>
- <li>
- <p>If there is an XML well-formedness or XML namespace well-formedness error, then throw a
- <code id=parsing-xhtml-fragments:syntaxerror-2><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
- <li>
- <p>If there is a <var id=parsing-xhtml-fragments:concept-frag-parse-context-5><a href=#concept-frag-parse-context>context</a></var> element, and the root
- element of the resulting <code id=parsing-xhtml-fragments:document-2><a href=#document>Document</a></code> has any sibling nodes, then throw a
- <code id=parsing-xhtml-fragments:syntaxerror-3><a href=#syntaxerror>SyntaxError</a></code> exception and abort these steps.</p>
-
- <li>
- <p>If there is a <var id=parsing-xhtml-fragments:concept-frag-parse-context-6><a href=#concept-frag-parse-context>context</a></var> element, then return the
- child nodes of the root element of the resulting <code id=parsing-xhtml-fragments:document-3><a href=#document>Document</a></code>, in <a href=#tree-order id=parsing-xhtml-fragments:tree-order>tree
- order</a>.</p>
- <p>Otherwise, return the children of the <code id=parsing-xhtml-fragments:document-4><a href=#document>Document</a></code> object, in <a href=#tree-order id=parsing-xhtml-fragments:tree-order-2>tree
- order</a>.</p>
- </ol>
-
-
- <h2 id=rendering>14 Rendering</h2>
- <p><i>User agents are not required to present HTML documents in any particular way. However, this
- section provides a set of suggestions for rendering HTML documents that, if followed, are likely
- to lead to a user experience that closely resembles the experience intended by the documents'
- authors. So as to avoid confusion regarding the normativity of this section, RFC2119 terms have
- not been used. Instead, the term "expected" is used to indicate behavior that will lead to this
- experience. For the purposes of conformance for user agents designated as <a href=#renderingUA>supporting the suggested default rendering</a>, the term "expected" in this
- section has the same conformance implications as the RFC2119-defined term "must".</i></p>
- <h3 id=introduction-17>14.1 Introduction</h3>
- <p>In general, user agents are expected to support CSS, and many of the suggestions in this
- section are expressed in CSS terms. User agents that use other presentation mechanisms can derive
- their expected behavior by translating from the CSS rules given in this section.</p>
- <p>In the absence of style-layer rules to the contrary (e.g. author style sheets), user agents are
- expected to render an element so that it conveys to the user the meaning that the element
- <a href=#represents id=introduction-17:represents>represents</a>, as described by this specification.</p>
- <p>The suggestions in this section generally assume a visual output medium with a resolution of
- 96dpi or greater, but HTML is intended to apply to multiple media (it is a
- <i>media-independent</i> language). User agent implementors are encouraged to adapt the
- suggestions in this section to their target media.</p>
- <hr>
- <p>An element is <dfn id=being-rendered>being rendered</dfn> if it has any associated CSS layout boxes, SVG layout
- boxes, or some equivalent in other styling languages.</p>
- <p class=note>Just being off-screen does not mean the element is not <a href=#being-rendered id=introduction-17:being-rendered>being
- rendered</a>. The presence of the <code id=introduction-17:the-hidden-attribute><a href=#the-hidden-attribute>hidden</a></code> attribute normally
- means the element is not <a href=#being-rendered id=introduction-17:being-rendered-2>being rendered</a>, though this might be overridden by the style
- sheets.</p>
- <hr>
- <p>User agents that do not honor author-level CSS style sheets are nonetheless expected to act as
- if they applied the CSS rules given in these sections in a manner consistent with this
- specification and the relevant CSS and Unicode specifications. <a href=#refsCSS>[CSS]</a> <a href=#refsUNICODE>[UNICODE]</a> <a href=#refsBIDI>[BIDI]</a></p>
- <p class=note>This is especially important for issues relating to the 'display', 'unicode-bidi',
- and 'direction' properties.</p>
- <h3 id=the-css-user-agent-style-sheet-and-presentational-hints>14.2 The CSS user agent style sheet and presentational hints</h3>
- <p>The CSS rules given in these subsections are, except where otherwise specified, expected to be
- used as part of the user-agent level style sheet defaults for all documents that contain
- <a href=#html-elements id=the-css-user-agent-style-sheet-and-presentational-hints:html-elements>HTML elements</a>.</p>
- <p>Some rules are intended for the author-level zero-specificity presentational hints part of the
- CSS cascade; these are explicitly called out as <dfn id=presentational-hints>presentational hints</dfn>.</p>
- <p>Some of the rules regarding left and right margins are given here as appropriate for elements
- whose 'direction' property is 'ltr', and are expected to be flipped around on elements whose
- 'direction' property is 'rtl'. These are marked "<dfn id=ltr-specific>LTR-specific</dfn>".</p>
- <p class=note>These markings only affect the handling of attribute <em>values</em>, not
- attribute names or element names.</p>
- <hr>
- <p>When the text below says that an attribute <var>attribute</var> on an element
- <var>element</var> <dfn id=maps-to-the-pixel-length-property>maps to the pixel length property</dfn> (or properties)
- <var>properties</var>, it means that if <var>element</var> has an attribute <var>attribute</var>
- set, and parsing that attribute's value using the <a href=#rules-for-parsing-non-negative-integers id=the-css-user-agent-style-sheet-and-presentational-hints:rules-for-parsing-non-negative-integers>rules for parsing non-negative
- integers</a> doesn't generate an error, then the user agent is expected to use the parsed value
- as a pixel length for a <a href=#presentational-hints id=the-css-user-agent-style-sheet-and-presentational-hints:presentational-hints>presentational hint</a> for
- <var>properties</var>.</p>
- <p>When the text below says that an attribute <var>attribute</var> on an element
- <var>element</var> <dfn id=maps-to-the-dimension-property>maps to the dimension property</dfn> (or properties)
- <var>properties</var>, it means that if <var>element</var> has an attribute <var>attribute</var>
- set, and parsing that attribute's value using the <a href=#rules-for-parsing-dimension-values id=the-css-user-agent-style-sheet-and-presentational-hints:rules-for-parsing-dimension-values>rules for parsing dimension values</a>
- doesn't generate an error, then the user agent is expected to use the parsed dimension as the
- value for a <a href=#presentational-hints id=the-css-user-agent-style-sheet-and-presentational-hints:presentational-hints-2>presentational hint</a> for
- <var>properties</var>, with the value given as a pixel length if the dimension was an integer, and
- with the value given as a percentage if the dimension was a percentage.</p>
- <p>When a user agent is to <dfn id=align-descendants>align descendants</dfn> of a node, the user agent is expected to
- align only those descendants that have both their 'margin-left' and 'margin-right' properties
- computing to a value other than 'auto', that are over-constrained and that have one of those two
- margins with a used value forced to a greater value, and that do not themselves have an applicable
- <code>align</code> attribute. When multiple elements are to <a href=#align-descendants id=the-css-user-agent-style-sheet-and-presentational-hints:align-descendants>align</a> a particular descendant, the most deeply nested such
- element is expected to override the others. Aligned elements are expected to be aligned by having
- the used values of their left and right margins be set accordingly.</p>
- <h3 id=non-replaced-elements>14.3 Non-replaced elements</h3>
- <h4 id=hidden-elements>14.3.1 Hidden elements</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- <span id=hiddenCSS>[hidden]</span>, area, base, basefont, datalist, head, link, menu[type=popup i], meta,
- noembed, noframes, param, rp, script, source, style, template, track, title {
- display: none;
- }
- embed[hidden] { display: inline; height: 0; width: 0; }</pre>
- <p>The user agent is expected to force the 'display' property of <code id=hidden-elements:the-noscript-element><a href=#the-noscript-element>noscript</a></code> elements
- for whom <a href=#concept-n-script id=hidden-elements:concept-n-script>scripting is enabled</a> to compute to 'none',
- irrespective of CSS rules.</p>
- <p>The user agent is expected to force the 'display' property of <code id=hidden-elements:the-input-element><a href=#the-input-element>input</a></code> elements whose
- <code id=hidden-elements:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#hidden-state-(type=hidden)" id="hidden-elements:hidden-state-(type=hidden)">Hidden</a> state to compute to 'none', irrespective of CSS
- rules.</p>
- <h4 id=the-page>14.3.2 The page</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- html, body { display: block; }</pre>
-
- <p>For each property in the table below, given a <code id=the-page:the-body-element><a href=#the-body-element>body</a></code> element, the first attribute
- that exists <a href=#maps-to-the-pixel-length-property id=the-page:maps-to-the-pixel-length-property>maps to the pixel length property</a> on the <code id=the-page:the-body-element-2><a href=#the-body-element>body</a></code> element. If
- none of the attributes for a property are found, or if the value of the attribute that was found
- cannot be parsed successfully, then, if the <code id=the-page:the-body-element-3><a href=#the-body-element>body</a></code> element's <a id=the-page:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s
- <a href=#browsing-context id=the-page:browsing-context>browsing context</a> does not have its <a href=#seamless-browsing-context-flag id=the-page:seamless-browsing-context-flag>seamless browsing context flag</a> set, a
- default value of 8px is expected to be used for that property instead.</p>
- <table><thead><tr><th>Property
- <th>Source
- <tbody><tr><td rowspan=3>'margin-top'
- <td><code id=the-page:the-body-element-4><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-marginheight><a href=#attr-body-marginheight>marginheight</a></code> attribute
- <tr><td>The <code id=the-page:the-body-element-5><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element id=the-page:container-frame-element>container frame element</a>'s <code id=the-page:attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
- <tr><td><code id=the-page:the-body-element-6><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-topmargin><a href=#attr-body-topmargin>topmargin</a></code> attribute
- <tbody><tr><td rowspan=3>'margin-right'
- <td><code id=the-page:the-body-element-7><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-marginwidth><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
- <tr><td>The <code id=the-page:the-body-element-8><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element id=the-page:container-frame-element-2>container frame element</a>'s <code id=the-page:attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
- <tr><td><code id=the-page:the-body-element-9><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-rightmargin><a href=#attr-body-rightmargin>rightmargin</a></code> attribute
- <tbody><tr><td rowspan=3>'margin-bottom'
- <td><code id=the-page:the-body-element-10><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-marginheight-2><a href=#attr-body-marginheight>marginheight</a></code> attribute
- <tr><td>The <code id=the-page:the-body-element-11><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element id=the-page:container-frame-element-3>container frame element</a>'s <code id=the-page:attr-iframe-marginheight-2><a href=#attr-iframe-marginheight>marginheight</a></code> attribute
- <tr><td><code id=the-page:the-body-element-12><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-bottommargin><a href=#attr-body-bottommargin>bottommargin</a></code> attribute
- <tbody><tr><td rowspan=3>'margin-left'
- <td><code id=the-page:the-body-element-13><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-marginwidth-2><a href=#attr-body-marginwidth>marginwidth</a></code> attribute
- <tr><td>The <code id=the-page:the-body-element-14><a href=#the-body-element>body</a></code> element's <a href=#container-frame-element id=the-page:container-frame-element-4>container frame element</a>'s <code id=the-page:attr-iframe-marginwidth-2><a href=#attr-iframe-marginwidth>marginwidth</a></code> attribute
- <tr><td><code id=the-page:the-body-element-15><a href=#the-body-element>body</a></code> element's <code id=the-page:attr-body-leftmargin><a href=#attr-body-leftmargin>leftmargin</a></code> attribute
- </table>
- <p>If the <code id=the-page:the-body-element-16><a href=#the-body-element>body</a></code> element's <a id=the-page:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#browsing-context id=the-page:browsing-context-2>browsing context</a> is a
- <a href=#nested-browsing-context id=the-page:nested-browsing-context>nested browsing context</a>, and the <a href=#browsing-context-container id=the-page:browsing-context-container>browsing context container</a> of that
- <a href=#nested-browsing-context id=the-page:nested-browsing-context-2>nested browsing context</a> is a <code id=the-page:frame><a href=#frame>frame</a></code> or <code id=the-page:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element, then
- the <dfn id=container-frame-element>container frame element</dfn> of the <code id=the-page:the-body-element-17><a href=#the-body-element>body</a></code> element is that <code id=the-page:frame-2><a href=#frame>frame</a></code>
- or <code id=the-page:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> element. Otherwise, there is no <a href=#container-frame-element id=the-page:container-frame-element-5>container frame element</a>.</p>
- <p class=warning>The above requirements imply that a page can change the margins of another page
- (including one from another <a href=#origin-2 id=the-page:origin-2>origin</a>) using, for example, an <code id=the-page:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>. This
- is potentially a security risk, as it might in some cases allow an attack to contrive a situation
- in which a page is rendered not as the author intended, possibly for the purposes of phishing or
- otherwise misleading the user.</p>
- <hr>
- <p>If a <code id=the-page:document><a href=#document>Document</a></code> is in a <a href=#nested-browsing-context id=the-page:nested-browsing-context-3>nested browsing context</a>, it is expected to be
- positioned and sized to fit inside the content box of its <a href=#browsing-context-container id=the-page:browsing-context-container-2>browsing context container</a>.
- If a <a href=#browsing-context id=the-page:browsing-context-3>browsing context</a> is not <a href=#being-rendered id=the-page:being-rendered>being rendered</a>, it is expected to have a
- viewport with zero width and zero height.</p>
- <p>If the <code id=the-page:document-2><a href=#document>Document</a></code> is in a <a href=#nested-browsing-context id=the-page:nested-browsing-context-4>nested browsing context</a>, and the
- <a href=#browsing-context-container id=the-page:browsing-context-container-3>browsing context container</a> of that <a href=#nested-browsing-context id=the-page:nested-browsing-context-5>nested browsing context</a> is a
- <code id=the-page:frame-3><a href=#frame>frame</a></code> or <code id=the-page:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code> element, and that element has a <code>scrolling</code> attribute, and that attribute's value is an <a href=#ascii-case-insensitive id=the-page:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the string "<code>off</code>", "<code>noscroll</code>", or "<code>no</code>", then the user agent is expected to
- prevent any scroll bars from being shown for the viewport of the <a href=#nested-browsing-context id=the-page:nested-browsing-context-6>nested browsing
- context</a>, regardless of the 'overflow' property that applies to that viewport.</p>
- <hr>
- <p>When a <code id=the-page:the-body-element-18><a href=#the-body-element>body</a></code> element has a <code id=the-page:attr-background><a href=#attr-background>background</a></code>
- attribute set to a non-empty value, the new value is expected to be <a href=#resolve-a-url id=the-page:resolve-a-url>resolved</a> relative to the element, and if this is successful, the user agent is
- expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints>presentational hint</a>
- setting the element's 'background-image' property to the resulting <a href=#absolute-url id=the-page:absolute-url>absolute URL</a>.</p>
- <p>When a <code id=the-page:the-body-element-19><a href=#the-body-element>body</a></code> element has a <code id=the-page:attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code> attribute
- set, the new value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-page:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy colour
- value</a>, and if that does not return an error, the user agent is expected to treat the
- attribute as a <a href=#presentational-hints id=the-page:presentational-hints-2>presentational hint</a> setting the element's
- 'background-color' property to the resulting colour.</p>
- <p>When a <code id=the-page:the-body-element-20><a href=#the-body-element>body</a></code> element has a <code id=the-page:attr-body-text><a href=#attr-body-text>text</a></code> attribute, its
- value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-page:rules-for-parsing-a-legacy-colour-value-2>rules for parsing a legacy colour value</a>, and
- if that does not return an error, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints-3>presentational hint</a> setting the element's 'color' property to
- the resulting colour.</p>
- <p>When a <code id=the-page:the-body-element-21><a href=#the-body-element>body</a></code> element has a <code id=the-page:attr-body-link><a href=#attr-body-link>link</a></code> attribute, its
- value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-page:rules-for-parsing-a-legacy-colour-value-3>rules for parsing a legacy colour value</a>, and
- if that does not return an error, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints-4>presentational hint</a> setting the 'color' property of any
- element in the <code id=the-page:document-3><a href=#document>Document</a></code> matching the ':link' pseudo-class to the resulting colour.</p>
- <p>When a <code id=the-page:the-body-element-22><a href=#the-body-element>body</a></code> element has a <code id=the-page:attr-body-vlink><a href=#attr-body-vlink>vlink</a></code> attribute,
- its value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-page:rules-for-parsing-a-legacy-colour-value-4>rules for parsing a legacy colour value</a>,
- and if that does not return an error, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints-5>presentational hint</a> setting the 'color' property of any
- element in the <code id=the-page:document-4><a href=#document>Document</a></code> matching the ':visited' pseudo-class to the resulting
- colour.</p>
- <p>When a <code id=the-page:the-body-element-23><a href=#the-body-element>body</a></code> element has an <code id=the-page:attr-body-alink><a href=#attr-body-alink>alink</a></code> attribute,
- its value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-page:rules-for-parsing-a-legacy-colour-value-5>rules for parsing a legacy colour value</a>,
- and if that does not return an error, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-page:presentational-hints-6>presentational hint</a> setting the 'color' property of any
- element in the <code id=the-page:document-5><a href=#document>Document</a></code> matching the ':active' pseudo-class and either the ':link'
- pseudo-class or the ':visited' pseudo-class to the resulting colour.</p>
- <h4 id=flow-content-3>14.3.3 Flow content</h4>
-
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
- legend, listing, main, p, plaintext, pre, summary, xmp {
- display: block;
- }
- blockquote, figure, listing, p, plaintext, pre, xmp {
- margin-top: 1em; margin-bottom: 1em;
- }
- blockquote, figure { margin-left: 40px; margin-right: 40px; }
- address { font-style: italic; }
- listing, plaintext, pre, xmp {
- font-family: monospace; white-space: pre;
- }
- dialog:not([open]) { display: none; }
- dialog {
- position: absolute;
- left: 0; right: 0;
- width: fit-content;
- height: fit-content;
- margin: auto;
- border: solid;
- padding: 1em;
- background: white;
- color: black;
- }
- dialog::backdrop {
- position: fixed;
- top: 0; right: 0; bottom: 0; left: 0;
- background: rgba(0,0,0,0.1);
- }
- /* for small devices, modal dialogs go full-screen */
- @media screen and (max-width: 540px) {
- dialog:modal {
- top: 0;
- width: auto;
- margin: 1em;
- }
- }
- </pre>
- <p>The following rules are also expected to apply, as <a href=#presentational-hints id=flow-content-3:presentational-hints>presentational hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- pre[wrap] { white-space: pre-wrap; }</pre>
- <p>In <a href=#quirks-mode id=flow-content-3:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- form { margin-bottom: 1em; }</pre>
- <hr>
- <p>The <code id=flow-content-3:center><a href=#center>center</a></code> element, and the <code id=flow-content-3:the-div-element><a href=#the-div-element>div</a></code> element when it has an <code id=flow-content-3:attr-div-align><a href=#attr-div-align>align</a></code> attribute whose value is an <a href=#ascii-case-insensitive id=flow-content-3:ascii-case-insensitive>ASCII
- case-insensitive</a> match for either the string "<code>center</code>" or the string
- "<code>middle</code>", are expected to center text within themselves, as if they had
- their 'text-align' property set to 'center' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-2>presentational hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants>align descendants</a> to the center.</p>
- <p>The <code id=flow-content-3:the-div-element-2><a href=#the-div-element>div</a></code> element, when it has an <code id=flow-content-3:attr-div-align-2><a href=#attr-div-align>align</a></code>
- attribute whose value is an <a href=#ascii-case-insensitive id=flow-content-3:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code>left</code>", is expected to left-align text within itself, as if it had its
- 'text-align' property set to 'left' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-3>presentational
- hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-2>align descendants</a> to the left.</p>
- <p>The <code id=flow-content-3:the-div-element-3><a href=#the-div-element>div</a></code> element, when it has an <code id=flow-content-3:attr-div-align-3><a href=#attr-div-align>align</a></code>
- attribute whose value is an <a href=#ascii-case-insensitive id=flow-content-3:ascii-case-insensitive-3>ASCII case-insensitive</a> match for the string "<code>right</code>", is expected to right-align text within itself, as if it had its
- 'text-align' property set to 'right' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-4>presentational
- hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-3>align descendants</a> to the right.</p>
- <p>The <code id=flow-content-3:the-div-element-4><a href=#the-div-element>div</a></code> element, when it has an <code id=flow-content-3:attr-div-align-4><a href=#attr-div-align>align</a></code>
- attribute whose value is an <a href=#ascii-case-insensitive id=flow-content-3:ascii-case-insensitive-4>ASCII case-insensitive</a> match for the string "<code>justify</code>", is expected to full-justify text within itself, as if it had its
- 'text-align' property set to 'justify' in a <a href=#presentational-hints id=flow-content-3:presentational-hints-5>presentational
- hint</a>, and to <a href=#align-descendants id=flow-content-3:align-descendants-4>align descendants</a> to the left.</p>
- <h4 id=phrasing-content-3>14.3.4 Phrasing content</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- cite, dfn, em, i, var { font-style: italic; }
- b, strong { font-weight: bolder; }
- code, kbd, samp, tt { font-family: monospace; }
- big { font-size: larger; }
- small { font-size: smaller; }
- sub { vertical-align: sub; }
- sup { vertical-align: super; }
- sub, sup { line-height: normal; font-size: smaller; }
- ruby { display: ruby; }
- rt { display: ruby-text; }
- :link { color: #0000EE; }
- :visited { color: #551A8B; }
- :link, :visited { text-decoration: underline; }
- a:link[rel~=help], a:visited[rel~=help],
- area:link[rel~=help], area:visited[rel~=help] { cursor: help; }
- :focus { outline: auto; }
- mark { background: yellow; color: black; } /* this colour is just a suggestion and can be changed based on implementation feedback */
- abbr[title], acronym[title] { text-decoration: dotted underline; }
- ins, u { text-decoration: underline; }
- del, s, strike { text-decoration: line-through; }
- blink { text-decoration: blink; }
- q::before { content: open-quote; }
- q::after { content: close-quote; }
- <span id=br-wbr-content>br { display-outside: newline; } /* <a href=#bidi-rendering>this also has bidi implications</a> */
- nobr { white-space: nowrap; }
- wbr { content: '\200B'; } /* <a href=#bidi-rendering>this also has bidi implications</a> */
- nobr wbr { white-space: normal; }</span></pre>
- <p>The following rules are also expected to apply, as
- <a href=#presentational-hints id=phrasing-content-3:presentational-hints>presentational hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- br[clear=left i] { clear: left; }
- br[clear=right i] { clear: right; }
- br[clear=all i], br[clear=both i] { clear: both; }</pre>
- <p>For the purposes of the CSS ruby model, runs of children of <code id=phrasing-content-3:the-ruby-element><a href=#the-ruby-element>ruby</a></code> elements that are
- not <code id=phrasing-content-3:the-rt-element><a href=#the-rt-element>rt</a></code> or <code id=phrasing-content-3:the-rp-element><a href=#the-rp-element>rp</a></code> elements are expected to be wrapped in anonymous boxes
- whose 'display' property has the value 'ruby-base'. <a href=#refsCSSRUBY>[CSSRUBY]</a></p>
- <p>When a particular part of a ruby has more than one annotation, the annotations should be
- distributed on both sides of the base text so as to minimise the stacking of ruby annotations on
- one side.</p>
- <p class=note>When it becomes possible to do so, the preceding requirement will be updated to be
- expressed in terms of CSS ruby. (Currently, CSS ruby does not handle nested <code id=phrasing-content-3:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code>
- elements or multiple sequential <code id=phrasing-content-3:the-rt-element-2><a href=#the-rt-element>rt</a></code> elements, which is how this semantic is
- expressed.)</p>
- <p>User agents that do not support correct ruby rendering are expected to render parentheses
- around the text of <code id=phrasing-content-3:the-rt-element-3><a href=#the-rt-element>rt</a></code> elements in the absence of <code id=phrasing-content-3:the-rp-element-2><a href=#the-rp-element>rp</a></code> elements.</p>
- <hr>
- <p>User agents are expected to support the 'clear' property on inline elements (in order to render
- <code id=phrasing-content-3:the-br-element><a href=#the-br-element>br</a></code> elements with <code id=phrasing-content-3:attr-br-clear><a href=#attr-br-clear>clear</a></code> attributes) in the manner
- described in the non-normative note to this effect in CSS2.1.</p>
- <p>The initial value for the 'color' property is expected to be black. The initial value for the
- 'background-color' property is expected to be 'transparent'. The canvas' background is expected to
- be white.</p>
- <hr>
- <p>When a <code id=phrasing-content-3:font><a href=#font>font</a></code> element has a <code>color</code>
- attribute, its value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=phrasing-content-3:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy colour
- value</a>, and if that does not return an error, the user agent is expected to treat the
- attribute as a <a href=#presentational-hints id=phrasing-content-3:presentational-hints-2>presentational hint</a> setting the
- element's 'color' property to the resulting colour.</p>
- <p>When a <code id=phrasing-content-3:font-2><a href=#font>font</a></code> element has a <code>face</code>
- attribute, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=phrasing-content-3:presentational-hints-3>presentational hint</a> setting the element's 'font-family' property to the attribute's
- value.</p>
-
- <p>When a <code id=phrasing-content-3:font-3><a href=#font>font</a></code> element has a <code>size</code>
- attribute, the user agent is expected to use the following steps, known as the <dfn id=rules-for-parsing-a-legacy-font-size>rules for
- parsing a legacy font size</dfn>, to treat the attribute as a <a href=#presentational-hints id=phrasing-content-3:presentational-hints-4>presentational hint</a> setting the element's 'font-size' property:</p>
- <ol><li><p>Let <var>input</var> be the attribute's value.<li><p>Let <var>position</var> be a pointer into <var>input</var>, initially pointing at the
- start of the string.<li><p><a href=#skip-whitespace id=phrasing-content-3:skip-whitespace>Skip whitespace</a>.<li><p>If <var>position</var> is past the end of <var>input</var>, there is no <a href=#presentational-hints id=phrasing-content-3:presentational-hints-5>presentational hint</a>. Abort these steps.<li><p>If the character at <var>position</var> is a U+002B PLUS SIGN character (+), then let
- <var>mode</var> be <i>relative-plus</i>, and advance <var>position</var> to the next character.
- Otherwise, if the character at <var>position</var> is a U+002D HYPHEN-MINUS character (-), then
- let <var>mode</var> be <i>relative-minus</i>, and advance <var>position</var> to the next
- character. Otherwise, let <var>mode</var> be <i>absolute</i>.<li><p><a href=#collect-a-sequence-of-characters id=phrasing-content-3:collect-a-sequence-of-characters>Collect a sequence of characters</a> that are <a href=#ascii-digits id=phrasing-content-3:ascii-digits>ASCII digits</a>, and let
- the resulting sequence be <var>digits</var>.<li><p>If <var>digits</var> is the empty string, there is no <a href=#presentational-hints id=phrasing-content-3:presentational-hints-6>presentational hint</a>. Abort these steps.<li><p>Interpret <var>digits</var> as a base-ten integer. Let <var>value</var> be the resulting
- number.<li>
-
- <p>If <var>mode</var> is <i>relative-plus</i>, then increment <var>value</var> by 3. If
- <var>mode</var> is <i>relative-minus</i>, then let <var>value</var> be the result of subtracting
- <var>value</var> from 3.</p>
- <li><p>If <var>value</var> is greater than 7, let it be 7.<li><p>If <var>value</var> is less than 1, let it be 1.<li>
- <p>Set 'font-size' to the keyword corresponding to the value of <var>value</var> according to
- the following table:</p>
- <table><thead><tr><th><var>value</var>
- <th>'font-size' keyword
- <th>Notes
- <tbody><tr><td>1
- <td>x-small
- <td>
- <tr><td>2
- <td>small
- <td>
- <tr><td>3
- <td>medium
- <td>
- <tr><td>4
- <td>large
- <td>
- <tr><td>5
- <td>x-large
- <td>
- <tr><td>6
- <td>xx-large
- <td>
- <tr><td>7
- <td>xxx-large
- <td><i>see below</i>
- </table>
- <p class=tablenote><small>The 'xxx-large' value is a non-CSS value used here to
- indicate a font size 50% larger than 'xx-large'.</small></p>
- </ol>
- <h4 id=bidi-rendering>14.3.5 Bidirectional text</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- [dir]:dir(ltr), bdi:dir(ltr), input[type=tel]:dir(ltr) { direction: ltr; }
- [dir]:dir(rtl), bdi:dir(rtl) { direction: rtl; }
- address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
- legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
- h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
- tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, bdi, output,
- [dir=ltr i], [dir=rtl i], [dir=auto i] {
- unicode-bidi: isolate;
- }
- bdo, bdo[dir] { unicode-bidi: isolate-override; }
- textarea[dir=auto i], pre[dir=auto i] { unicode-bidi: plaintext; }
- /* the <a href=#br-wbr-content>rules setting the 'content' property</a> on <code id=bidi-rendering:the-br-element><a href=#the-br-element>br</a></code> and <code id=bidi-rendering:the-wbr-element><a href=#the-wbr-element>wbr</a></code> elements also has bidi implications */</pre>
- <p>Input fields (i.e. <code id=bidi-rendering:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements, and <code id=bidi-rendering:the-input-element><a href=#the-input-element>input</a></code> elements when their
- <code id=bidi-rendering:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="bidi-rendering:text-(type=text)-state-and-search-state-(type=search)">Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" id="bidi-rendering:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>,
- <a href="#telephone-state-(type=tel)" id="bidi-rendering:telephone-state-(type=tel)">Telephone</a>, <a href="#url-state-(type=url)" id="bidi-rendering:url-state-(type=url)">URL</a>,
- or <a href="#e-mail-state-(type=email)" id="bidi-rendering:e-mail-state-(type=email)">E-mail</a> state) are expected to present an editing
- user interface with a directionality that matches the element's 'direction' property.</p>
- <p>When the document's character encoding is ISO-8859-8, the following rules are additionally
- expected to apply, following those above: <a href=#refsENCODING>[ENCODING]</a></p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- address, blockquote, center, div, figure, figcaption, footer, form, header, hr,
- legend, listing, main, p, plaintext, pre, summary, xmp, article, aside, h1, h2,
- h3, h4, h5, h6, hgroup, nav, section, table, caption, colgroup, col, thead,
- tbody, tfoot, tr, td, th, dir, dd, dl, dt, menu, ol, ul, li, [dir=ltr i],
- [dir=rtl i], [dir=auto i], *|* {
- unicode-bidi: bidi-override;
- }
- input:not([type=submit i]):not([type=reset i]):not([type=button i]),
- textarea, keygen {
- unicode-bidi: normal;
- }</pre>
- <h4 id=quotes>14.3.6 Quotes</h4>
- <p>This block is automatically generated from the Unicode Common Locale Data Repository. <a href=#refsCLDR>[CLDR]</a></p>
- <p>User agents are expected to use either the block below (which will be regularly updated) or to
- automatically generate their own copy directly from the source material. The language codes are
- derived from the CLDR file names. The quotes are derived from the <code>delimiter</code>
- blocks, with fallback handled as specified in the CLDR documentation.</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- :root { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(af), :not(:lang(af)) > :lang(af) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(agq), :not(:lang(agq)) > :lang(agq) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
- :root:lang(ak), :not(:lang(ak)) > :lang(ak) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(am), :not(:lang(am)) > :lang(am) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(ar), :not(:lang(ar)) > :lang(ar) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
- :root:lang(asa), :not(:lang(asa)) > :lang(asa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ast), :not(:lang(ast)) > :lang(ast) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(az), :not(:lang(az)) > :lang(az) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(az-Cyrl), :not(:lang(az-Cyrl)) > :lang(az-Cyrl) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(bas), :not(:lang(bas)) > :lang(bas) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
- :root:lang(bem), :not(:lang(bem)) > :lang(bem) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(bez), :not(:lang(bez)) > :lang(bez) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(bg), :not(:lang(bg)) > :lang(bg) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
- :root:lang(bm), :not(:lang(bm)) > :lang(bm) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(bn), :not(:lang(bn)) > :lang(bn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(br), :not(:lang(br)) > :lang(br) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(brx), :not(:lang(brx)) > :lang(brx) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(bs), :not(:lang(bs)) > :lang(bs) { quotes: '\201e' '\201c' '\2018' '\2019' } /* „ “ ‘ ’ */
- :root:lang(bs-Cyrl), :not(:lang(bs-Cyrl)) > :lang(bs-Cyrl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(ca), :not(:lang(ca)) > :lang(ca) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(cgg), :not(:lang(cgg)) > :lang(cgg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(chr), :not(:lang(chr)) > :lang(chr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(cs), :not(:lang(cs)) > :lang(cs) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(cy), :not(:lang(cy)) > :lang(cy) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
- :root:lang(da), :not(:lang(da)) > :lang(da) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(dav), :not(:lang(dav)) > :lang(dav) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(de), :not(:lang(de)) > :lang(de) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(de-CH), :not(:lang(de-CH)) > :lang(de-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(dje), :not(:lang(dje)) > :lang(dje) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(dsb), :not(:lang(dsb)) > :lang(dsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(dua), :not(:lang(dua)) > :lang(dua) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
- :root:lang(dyo), :not(:lang(dyo)) > :lang(dyo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(dz), :not(:lang(dz)) > :lang(dz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ebu), :not(:lang(ebu)) > :lang(ebu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ee), :not(:lang(ee)) > :lang(ee) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(el), :not(:lang(el)) > :lang(el) { quotes: '\00ab' '\00bb' '\0022' '\0022' } /* « » " " */
- :root:lang(en), :not(:lang(en)) > :lang(en) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(es), :not(:lang(es)) > :lang(es) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(et), :not(:lang(et)) > :lang(et) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(eu), :not(:lang(eu)) > :lang(eu) { quotes: '\0022' '\0022' '\0022' '\0022' } /* " " " " */
- :root:lang(ewo), :not(:lang(ewo)) > :lang(ewo) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(fa), :not(:lang(fa)) > :lang(fa) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(ff), :not(:lang(ff)) > :lang(ff) { quotes: '\201e' '\201d' '\201a' '\2019' } /* „ ” ‚ ’ */
- :root:lang(fi), :not(:lang(fi)) > :lang(fi) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
- :root:lang(fil), :not(:lang(fil)) > :lang(fil) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(fr), :not(:lang(fr)) > :lang(fr) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
- :root:lang(fr-CA), :not(:lang(fr-CA)) > :lang(fr-CA) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(fr-CH), :not(:lang(fr-CH)) > :lang(fr-CH) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(ga), :not(:lang(ga)) > :lang(ga) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(gd), :not(:lang(gd)) > :lang(gd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(gl), :not(:lang(gl)) > :lang(gl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(gsw), :not(:lang(gsw)) > :lang(gsw) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(gu), :not(:lang(gu)) > :lang(gu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(guz), :not(:lang(guz)) > :lang(guz) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ha), :not(:lang(ha)) > :lang(ha) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(he), :not(:lang(he)) > :lang(he) { quotes: '\05f4' '\05f4' '\05f3' '\05f3' } /* ״ ״ ׳ ׳ */
- :root:lang(hi), :not(:lang(hi)) > :lang(hi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(hr), :not(:lang(hr)) > :lang(hr) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(hsb), :not(:lang(hsb)) > :lang(hsb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(hu), :not(:lang(hu)) > :lang(hu) { quotes: '\201e' '\201d' '\00bb' '\00ab' } /* „ ” » « */
- :root:lang(hy), :not(:lang(hy)) > :lang(hy) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
- :root:lang(id), :not(:lang(id)) > :lang(id) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ig), :not(:lang(ig)) > :lang(ig) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(is), :not(:lang(is)) > :lang(is) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(it), :not(:lang(it)) > :lang(it) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(ja), :not(:lang(ja)) > :lang(ja) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
- :root:lang(jgo), :not(:lang(jgo)) > :lang(jgo) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(jmc), :not(:lang(jmc)) > :lang(jmc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ka), :not(:lang(ka)) > :lang(ka) { quotes: '\201e' '\201c' '\00ab' '\00bb' } /* „ “ « » */
- :root:lang(kab), :not(:lang(kab)) > :lang(kab) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(kam), :not(:lang(kam)) > :lang(kam) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(kde), :not(:lang(kde)) > :lang(kde) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(kea), :not(:lang(kea)) > :lang(kea) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(khq), :not(:lang(khq)) > :lang(khq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ki), :not(:lang(ki)) > :lang(ki) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(kk), :not(:lang(kk)) > :lang(kk) { quotes: '\201c' '\0022' '\2018' '\2019' } /* “ " ‘ ’ */
- :root:lang(kkj), :not(:lang(kkj)) > :lang(kkj) { quotes: '\00ab' '\00bb' '\2039' '\203a' } /* « » ‹ › */
- :root:lang(kln), :not(:lang(kln)) > :lang(kln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(km), :not(:lang(km)) > :lang(km) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(kn), :not(:lang(kn)) > :lang(kn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ko), :not(:lang(ko)) > :lang(ko) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ksb), :not(:lang(ksb)) > :lang(ksb) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ksf), :not(:lang(ksf)) > :lang(ksf) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
- :root:lang(ky), :not(:lang(ky)) > :lang(ky) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
- :root:lang(lag), :not(:lang(lag)) > :lang(lag) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
- :root:lang(lb), :not(:lang(lb)) > :lang(lb) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(lg), :not(:lang(lg)) > :lang(lg) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ln), :not(:lang(ln)) > :lang(ln) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(lo), :not(:lang(lo)) > :lang(lo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(lt), :not(:lang(lt)) > :lang(lt) { quotes: '\201e' '\201c' '\201e' '\201c' } /* „ “ „ “ */
- :root:lang(lu), :not(:lang(lu)) > :lang(lu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(luo), :not(:lang(luo)) > :lang(luo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(luy), :not(:lang(luy)) > :lang(luy) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(lv), :not(:lang(lv)) > :lang(lv) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mas), :not(:lang(mas)) > :lang(mas) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mer), :not(:lang(mer)) > :lang(mer) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mfe), :not(:lang(mfe)) > :lang(mfe) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mg), :not(:lang(mg)) > :lang(mg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(mgo), :not(:lang(mgo)) > :lang(mgo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mk), :not(:lang(mk)) > :lang(mk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(ml), :not(:lang(ml)) > :lang(ml) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mn), :not(:lang(mn)) > :lang(mn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mr), :not(:lang(mr)) > :lang(mr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ms), :not(:lang(ms)) > :lang(ms) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mt), :not(:lang(mt)) > :lang(mt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(mua), :not(:lang(mua)) > :lang(mua) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(my), :not(:lang(my)) > :lang(my) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(naq), :not(:lang(naq)) > :lang(naq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(nb), :not(:lang(nb)) > :lang(nb) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
- :root:lang(nd), :not(:lang(nd)) > :lang(nd) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ne), :not(:lang(ne)) > :lang(ne) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(nl), :not(:lang(nl)) > :lang(nl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(nmg), :not(:lang(nmg)) > :lang(nmg) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
- :root:lang(nn), :not(:lang(nn)) > :lang(nn) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
- :root:lang(nnh), :not(:lang(nnh)) > :lang(nnh) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(nus), :not(:lang(nus)) > :lang(nus) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(nyn), :not(:lang(nyn)) > :lang(nyn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(pa), :not(:lang(pa)) > :lang(pa) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(pl), :not(:lang(pl)) > :lang(pl) { quotes: '\201e' '\201d' '\00ab' '\00bb' } /* „ ” « » */
- :root:lang(pt), :not(:lang(pt)) > :lang(pt) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(pt-PT), :not(:lang(pt-PT)) > :lang(pt-PT) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(rn), :not(:lang(rn)) > :lang(rn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
- :root:lang(ro), :not(:lang(ro)) > :lang(ro) { quotes: '\201c' '\201d' '\00ab' '\00bb' } /* “ ” « » */
- :root:lang(rof), :not(:lang(rof)) > :lang(rof) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ru), :not(:lang(ru)) > :lang(ru) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
- :root:lang(rw), :not(:lang(rw)) > :lang(rw) { quotes: '\00ab' '\00bb' '\2018' '\2019' } /* « » ‘ ’ */
- :root:lang(rwk), :not(:lang(rwk)) > :lang(rwk) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(saq), :not(:lang(saq)) > :lang(saq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(sbp), :not(:lang(sbp)) > :lang(sbp) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(seh), :not(:lang(seh)) > :lang(seh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ses), :not(:lang(ses)) > :lang(ses) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(sg), :not(:lang(sg)) > :lang(sg) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(shi), :not(:lang(shi)) > :lang(shi) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
- :root:lang(shi-Latn), :not(:lang(shi-Latn)) > :lang(shi-Latn) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
- :root:lang(si), :not(:lang(si)) > :lang(si) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(sk), :not(:lang(sk)) > :lang(sk) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(sl), :not(:lang(sl)) > :lang(sl) { quotes: '\201e' '\201c' '\201a' '\2018' } /* „ “ ‚ ‘ */
- :root:lang(sn), :not(:lang(sn)) > :lang(sn) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
- :root:lang(so), :not(:lang(so)) > :lang(so) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(sq), :not(:lang(sq)) > :lang(sq) { quotes: '\00ab' '\00bb' '\201c' '\201d' } /* « » “ ” */
- :root:lang(sr), :not(:lang(sr)) > :lang(sr) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
- :root:lang(sr-Latn), :not(:lang(sr-Latn)) > :lang(sr-Latn) { quotes: '\201e' '\201c' '\2018' '\2018' } /* „ “ ‘ ‘ */
- :root:lang(sv), :not(:lang(sv)) > :lang(sv) { quotes: '\201d' '\201d' '\2019' '\2019' } /* ” ” ’ ’ */
- :root:lang(sw), :not(:lang(sw)) > :lang(sw) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(swc), :not(:lang(swc)) > :lang(swc) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ta), :not(:lang(ta)) > :lang(ta) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(te), :not(:lang(te)) > :lang(te) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(teo), :not(:lang(teo)) > :lang(teo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(th), :not(:lang(th)) > :lang(th) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(ti-ER), :not(:lang(ti-ER)) > :lang(ti-ER) { quotes: '\2018' '\2019' '\201c' '\201d' } /* ‘ ’ “ ” */
- :root:lang(to), :not(:lang(to)) > :lang(to) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(tr), :not(:lang(tr)) > :lang(tr) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(twq), :not(:lang(twq)) > :lang(twq) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(tzm), :not(:lang(tzm)) > :lang(tzm) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(uk), :not(:lang(uk)) > :lang(uk) { quotes: '\00ab' '\00bb' '\201e' '\201c' } /* « » „ “ */
- :root:lang(ur), :not(:lang(ur)) > :lang(ur) { quotes: '\201d' '\201c' '\2019' '\2018' } /* ” “ ’ ‘ */
- :root:lang(ur-IN), :not(:lang(ur-IN)) > :lang(ur-IN) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
- :root:lang(uz), :not(:lang(uz)) > :lang(uz) { quotes: '\0022' '\0022' '\0027' '\0027' } /* " " ' ' */
- :root:lang(uz-Cyrl), :not(:lang(uz-Cyrl)) > :lang(uz-Cyrl) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(vai), :not(:lang(vai)) > :lang(vai) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(vai-Latn), :not(:lang(vai-Latn)) > :lang(vai-Latn) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(vi), :not(:lang(vi)) > :lang(vi) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(vun), :not(:lang(vun)) > :lang(vun) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(xog), :not(:lang(xog)) > :lang(xog) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(yav), :not(:lang(yav)) > :lang(yav) { quotes: '\00ab' '\00bb' '\00ab' '\00bb' } /* « » « » */
- :root:lang(yo), :not(:lang(yo)) > :lang(yo) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(zgh), :not(:lang(zgh)) > :lang(zgh) { quotes: '\00ab' '\00bb' '\201e' '\201d' } /* « » „ ” */
- :root:lang(zh), :not(:lang(zh)) > :lang(zh) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- :root:lang(zh-Hant), :not(:lang(zh-Hant)) > :lang(zh-Hant) { quotes: '\300c' '\300d' '\300e' '\300f' } /* 「 」 『 』 */
- :root:lang(zu), :not(:lang(zu)) > :lang(zu) { quotes: '\201c' '\201d' '\2018' '\2019' } /* “ ” ‘ ’ */
- </pre>
- <h4 id=sections-and-headings>14.3.7 Sections and headings</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- article, aside, h1, h2, h3, h4, h5, h6, hgroup, nav, section {
- display: block;
- }
- h1 { margin-top: 0.67em; margin-bottom: 0.67em; font-size: 2.00em; font-weight: bold; }
- h2 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; font-weight: bold; }
- h3 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; font-weight: bold; }
- h4 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; font-weight: bold; }
- h5 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; font-weight: bold; }
- h6 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; font-weight: bold; }</pre>
- <p>The <code id=sections-and-headings:the-article-element><a href=#the-article-element>article</a></code>, <code id=sections-and-headings:the-aside-element><a href=#the-aside-element>aside</a></code>, <code id=sections-and-headings:the-nav-element><a href=#the-nav-element>nav</a></code>, and <code id=sections-and-headings:the-section-element><a href=#the-section-element>section</a></code>
- elements are expected to affect the margins and font size of <code id=sections-and-headings:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements, as well as
- <code id=sections-and-headings:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>–<code id=sections-and-headings:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code> elements that follow <code id=sections-and-headings:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> elements in
- <code id=sections-and-headings:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code> elements, based on the nesting depth. If <var>x</var> is a selector
- that matches elements that are either <code id=sections-and-headings:the-article-element-2><a href=#the-article-element>article</a></code>, <code id=sections-and-headings:the-aside-element-2><a href=#the-aside-element>aside</a></code>, <code id=sections-and-headings:the-nav-element-2><a href=#the-nav-element>nav</a></code>,
- or <code id=sections-and-headings:the-section-element-2><a href=#the-section-element>section</a></code> elements, then the following rules capture what is expected:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- <var>x</var> h1 { margin-top: 0.83em; margin-bottom: 0.83em; font-size: 1.50em; }
- <var>x</var> <var>x</var> h1 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
- <var>x</var> <var>x</var> <var>x</var> h1 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
- <var>x</var> <var>x</var> <var>x</var> <var>x</var> h1 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
- <var>x</var> <var>x</var> <var>x</var> <var>x</var> <var>x</var> h1 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
- <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.00em; margin-bottom: 1.00em; font-size: 1.17em; }
- <var>x</var> <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
- <var>x</var> <var>x</var> <var>x</var> hgroup > h1 ~ h2 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
- <var>x</var> <var>x</var> <var>x</var> <var>x</var> hgroup > h1 ~ h2 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
- <var>x</var> hgroup > h1 ~ h3 { margin-top: 1.33em; margin-bottom: 1.33em; font-size: 1.00em; }
- <var>x</var> <var>x</var> hgroup > h1 ~ h3 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
- <var>x</var> <var>x</var> <var>x</var> hgroup > h1 ~ h3 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
- <var>x</var> hgroup > h1 ~ h4 { margin-top: 1.67em; margin-bottom: 1.67em; font-size: 0.83em; }
- <var>x</var> <var>x</var> hgroup > h1 ~ h4 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }
- <var>x</var> hgroup > h1 ~ h5 { margin-top: 2.33em; margin-bottom: 2.33em; font-size: 0.67em; }</pre>
- <h4 id=lists>14.3.8 Lists</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- dir, dd, dl, dt, menu, ol, ul { display: block; }
- li { display: list-item; }
- dir, dl, menu, ol, ul { margin-top: 1em; margin-bottom: 1em; }
- dir dir, dir dl, dir menu, dir ol, dir ul,
- dl dir, dl dl, dl menu, dl ol, dl ul,
- menu dir, menu dl, menu menu, menu ol, menu ul,
- ol dir, ol dl, ol menu, ol ol, ol ul,
- ul dir, ul dl, ul menu, ul ol, ul ul {
- margin-top: 0; margin-bottom: 0;
- }
- dd { margin-left: 40px; } /* <a href=#ltr-specific id=lists:ltr-specific>LTR-specific</a>: use 'margin-right' for rtl elements */
- dir, menu, ol, ul { padding-left: 40px; } /* <a href=#ltr-specific id=lists:ltr-specific-2>LTR-specific</a>: use 'padding-right' for rtl elements */
- ol { list-style-type: decimal; }
- dir, menu, ul { list-style-type: disc; }
- dir dir, dir menu, dir ul,
- menu dir, menu menu, menu ul,
- ol dir, ol menu, ol ul,
- ul dir, ul menu, ul ul {
- list-style-type: circle;
- }
- dir dir dir, dir dir menu, dir dir ul,
- dir menu dir, dir menu menu, dir menu ul,
- dir ol dir, dir ol menu, dir ol ul,
- dir ul dir, dir ul menu, dir ul ul,
- menu dir dir, menu dir menu, menu dir ul,
- menu menu dir, menu menu menu, menu menu ul,
- menu ol dir, menu ol menu, menu ol ul,
- menu ul dir, menu ul menu, menu ul ul,
- ol dir dir, ol dir menu, ol dir ul,
- ol menu dir, ol menu menu, ol menu ul,
- ol ol dir, ol ol menu, ol ol ul,
- ol ul dir, ol ul menu, ol ul ul,
- ul dir dir, ul dir menu, ul dir ul,
- ul menu dir, ul menu menu, ul menu ul,
- ul ol dir, ul ol menu, ul ol ul,
- ul ul dir, ul ul menu, ul ul ul {
- list-style-type: square;
- }</pre>
- <p id=decohints>The following rules are also expected to apply, as <a href=#presentational-hints id=lists:presentational-hints>presentational
- hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- ol[type=1], li[type=1] { list-style-type: decimal; }
- ol[type=a], li[type=a] { list-style-type: lower-alpha; }
- ol[type=A], li[type=A] { list-style-type: upper-alpha; }
- ol[type=i], li[type=i] { list-style-type: lower-roman; }
- ol[type=I], li[type=I] { list-style-type: upper-roman; }
- ul[type=none i], li[type=none i] { list-style-type: none; }
- ul[type=disc i], li[type=disc i] { list-style-type: disc; }
- ul[type=circle i], li[type=circle i] { list-style-type: circle; }
- ul[type=square i], li[type=square i] { list-style-type: square; }</pre>
- <p>When rendering <code id=lists:the-li-element><a href=#the-li-element>li</a></code> elements, non-CSS user agents are expected to use the
- <a href=#ordinal-value id=lists:ordinal-value>ordinal value</a> of the <code id=lists:the-li-element-2><a href=#the-li-element>li</a></code> element to render the counter in the list item
- marker.</p>
- <p id=css-list-rendering class=critical>This specification does not yet define the
- CSS-specific rules for rendering <code id=lists:the-li-element-3><a href=#the-li-element>li</a></code> elements, because CSS doesn't yet provide
- sufficient hooks for this purpose.</p>
- <h4 id=tables-2>14.3.9 Tables</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- table { display: table; }
- caption { display: table-caption; }
- colgroup, colgroup[hidden] { display: table-column-group; }
- col, col[hidden] { display: table-column; }
- thead, thead[hidden] { display: table-header-group; }
- tbody, tbody[hidden] { display: table-row-group; }
- tfoot, tfoot[hidden] { display: table-footer-group; }
- tr, tr[hidden] { display: table-row; }
- td, th, td[hidden], th[hidden] { display: table-cell; }
- colgroup[hidden], col[hidden], thead[hidden], tbody[hidden],
- tfoot[hidden], tr[hidden], td[hidden], th[hidden] {
- visibility: collapse;
- }
- table {
- box-sizing: border-box;
- border-spacing: 2px;
- border-collapse: separate;
- text-indent: initial;
- }
- td, th { padding: 1px; }
- th { font-weight: bold; }
- thead, tbody, tfoot, table > tr { vertical-align: middle; }
- tr, td, th { vertical-align: inherit; }
- table, td, th { border-color: gray; }
- thead, tbody, tfoot, tr { border-color: inherit; }
- table[rules=none i], table[rules=groups i], table[rules=rows i],
- table[rules=cols i], table[rules=all i], table[frame=void i],
- table[frame=above i], table[frame=below i], table[frame=hsides i],
- table[frame=lhs i], table[frame=rhs i], table[frame=vsides i],
- table[frame=box i], table[frame=border i],
- table[rules=none i] > tr > td, table[rules=none i] > tr > th,
- table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
- table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
- table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
- table[rules=all i] > tr > td, table[rules=all i] > tr > th,
- table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
- table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
- table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
- table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
- table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
- table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
- table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
- table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
- table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
- table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
- table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
- table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
- table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th,
- table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th,
- table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
- border-color: black;
- }</pre>
- <p>The following rules are also expected to apply, as <a href=#presentational-hints id=tables-2:presentational-hints>presentational hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- table[align=left i] { float: left; }
- table[align=right i] { float: right; }
- table[align=center i] { margin-left: auto; margin-right: auto; }
- thead[align=absmiddle i], tbody[align=absmiddle i], tfoot[align=absmiddle i],
- tr[align=absmiddle i], td[align=absmiddle i], th[align=absmiddle i] {
- text-align: center;
- }
- caption[align=bottom i] { caption-side: bottom; }
- p[align=left i], h1[align=left i], h2[align=left i], h3[align=left i],
- h4[align=left i], h5[align=left i], h6[align=left i] {
- text-align: left;
- }
- p[align=right i], h1[align=right i], h2[align=right i], h3[align=right i],
- h4[align=right i], h5[align=right i], h6[align=right i] {
- text-align: right;
- }
- p[align=center i], h1[align=center i], h2[align=center i], h3[align=center i],
- h4[align=center i], h5[align=center i], h6[align=center i] {
- text-align: center;
- }
- p[align=justify i], h1[align=justify i], h2[align=justify i], h3[align=justify i],
- h4[align=justify i], h5[align=justify i], h6[align=justify i] {
- text-align: justify;
- }
- thead[valign=top i], tbody[valign=top i], tfoot[valign=top i],
- tr[valign=top i], td[valign=top i], th[valign=top i] {
- vertical-align: top;
- }
- thead[valign=middle i], tbody[valign=middle i], tfoot[valign=middle i],
- tr[valign=middle i], td[valign=middle i], th[valign=middle i] {
- vertical-align: middle;
- }
- thead[valign=bottom i], tbody[valign=bottom i], tfoot[valign=bottom i],
- tr[valign=bottom i], td[valign=bottom i], th[valign=bottom i] {
- vertical-align: bottom;
- }
- thead[valign=baseline i], tbody[valign=baseline i], tfoot[valign=baseline i],
- tr[valign=baseline i], td[valign=baseline i], th[valign=baseline i] {
- vertical-align: baseline;
- }
- td[nowrap], th[nowrap] { white-space: nowrap; }
- table[rules=none i], table[rules=groups i], table[rules=rows i],
- table[rules=cols i], table[rules=all i] {
- border-style: hidden;
- border-collapse: collapse;
- }
- table[border] { border-style: outset; } /* <a href=#magic-border-selector id=tables-2:magic-border-selector>only if border is not equivalent to zero</a> */
- table[frame=void i] { border-style: hidden; }
- table[frame=above i] { border-style: outset hidden hidden hidden; }
- table[frame=below i] { border-style: hidden hidden outset hidden; }
- table[frame=hsides i] { border-style: outset hidden outset hidden; }
- table[frame=lhs i] { border-style: hidden hidden hidden outset; }
- table[frame=rhs i] { border-style: hidden outset hidden hidden; }
- table[frame=vsides i] { border-style: hidden outset; }
- table[frame=box i], table[frame=border i] { border-style: outset; }
- table[border] > tr > td, table[border] > tr > th,
- table[border] > thead > tr > td, table[border] > thead > tr > th,
- table[border] > tbody > tr > td, table[border] > tbody > tr > th,
- table[border] > tfoot > tr > td, table[border] > tfoot > tr > th {
- /* <a href=#magic-border-selector id=tables-2:magic-border-selector-2>only if border is not equivalent to zero</a> */
- border-width: 1px;
- border-style: inset;
- }
- table[rules=none i] > tr > td, table[rules=none i] > tr > th,
- table[rules=none i] > thead > tr > td, table[rules=none i] > thead > tr > th,
- table[rules=none i] > tbody > tr > td, table[rules=none i] > tbody > tr > th,
- table[rules=none i] > tfoot > tr > td, table[rules=none i] > tfoot > tr > th,
- table[rules=groups i] > tr > td, table[rules=groups i] > tr > th,
- table[rules=groups i] > thead > tr > td, table[rules=groups i] > thead > tr > th,
- table[rules=groups i] > tbody > tr > td, table[rules=groups i] > tbody > tr > th,
- table[rules=groups i] > tfoot > tr > td, table[rules=groups i] > tfoot > tr > th,
- table[rules=rows i] > tr > td, table[rules=rows i] > tr > th,
- table[rules=rows i] > thead > tr > td, table[rules=rows i] > thead > tr > th,
- table[rules=rows i] > tbody > tr > td, table[rules=rows i] > tbody > tr > th,
- table[rules=rows i] > tfoot > tr > td, table[rules=rows i] > tfoot > tr > th {
- border-width: 1px;
- border-style: none;
- }
- table[rules=cols i] > tr > td, table[rules=cols i] > tr > th,
- table[rules=cols i] > thead > tr > td, table[rules=cols i] > thead > tr > th,
- table[rules=cols i] > tbody > tr > td, table[rules=cols i] > tbody > tr > th,
- table[rules=cols i] > tfoot > tr > td, table[rules=cols i] > tfoot > tr > th {
- border-width: 1px;
- border-style: none solid;
- }
- table[rules=all i] > tr > td, table[rules=all i] > tr > th,
- table[rules=all i] > thead > tr > td, table[rules=all i] > thead > tr > th,
- table[rules=all i] > tbody > tr > td, table[rules=all i] > tbody > tr > th,
- table[rules=all i] > tfoot > tr > td, table[rules=all i] > tfoot > tr > th {
- border-width: 1px;
- border-style: solid;
- }
- table[rules=groups i] > colgroup {
- border-left-width: 1px;
- border-left-style: solid;
- border-right-width: 1px;
- border-right-style: solid;
- }
- table[rules=groups i] > thead,
- table[rules=groups i] > tbody,
- table[rules=groups i] > tfoot {
- border-top-width: 1px;
- border-top-style: solid;
- border-bottom-width: 1px;
- border-bottom-style: solid;
- }
- table[rules=rows i] > tr, table[rules=rows i] > thead > tr,
- table[rules=rows i] > tbody > tr, table[rules=rows i] > tfoot > tr {
- border-top-width: 1px;
- border-top-style: solid;
- border-bottom-width: 1px;
- border-bottom-style: solid;
- }</pre>
- <p>In <a href=#quirks-mode id=tables-2:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- table {
- font-weight: initial;
- font-style: initial;
- font-variant: initial;
- font-size: initial;
- line-height: initial;
- white-space: initial;
- text-align: initial;
- }</pre>
- <hr>
- <p>For the purposes of the CSS table model, the <code id=tables-2:the-col-element><a href=#the-col-element>col</a></code> element is expected to be treated
- as if it was present as many times as its <code id=tables-2:attr-col-span><a href=#attr-col-span>span</a></code> attribute <a href=#rules-for-parsing-non-negative-integers id=tables-2:rules-for-parsing-non-negative-integers>specifies</a>.</p>
- <p>For the purposes of the CSS table model, the <code id=tables-2:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code> element, if it contains no
- <code id=tables-2:the-col-element-2><a href=#the-col-element>col</a></code> element, is expected to be treated as if it had as many such children as its
- <code id=tables-2:attr-colgroup-span><a href=#attr-colgroup-span>span</a></code> attribute <a href=#rules-for-parsing-non-negative-integers id=tables-2:rules-for-parsing-non-negative-integers-2>specifies</a>.</p>
- <p>For the purposes of the CSS table model, the <code id=tables-2:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code> and
- <code id=tables-2:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code> attributes on <code id=tables-2:the-td-element><a href=#the-td-element>td</a></code> and <code id=tables-2:the-th-element><a href=#the-th-element>th</a></code>
- elements are expected to <a href=#rules-for-parsing-non-negative-integers id=tables-2:rules-for-parsing-non-negative-integers-3>provide</a> the
- <i>special knowledge</i> regarding cells spanning rows and columns.</p>
- <p>In <a href=#html-documents id=tables-2:html-documents>HTML documents</a>, the user agent is expected to force the 'display' property of
- <code id=tables-2:the-form-element><a href=#the-form-element>form</a></code> elements that are children of <code id=tables-2:the-table-element><a href=#the-table-element>table</a></code>, <code id=tables-2:the-thead-element><a href=#the-thead-element>thead</a></code>,
- <code id=tables-2:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>, or <code id=tables-2:the-tr-element><a href=#the-tr-element>tr</a></code> elements to compute to 'none',
- irrespective of CSS rules.</p>
- <hr>
- <p>The <code id=tables-2:the-table-element-2><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code>
- attribute <a href=#maps-to-the-pixel-length-property id=tables-2:maps-to-the-pixel-length-property>maps to the pixel length property</a> 'border-spacing' on the element.</p>
- <p>The <code id=tables-2:the-table-element-3><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code>
- attribute <a href=#maps-to-the-pixel-length-property id=tables-2:maps-to-the-pixel-length-property-2>maps to the pixel length
- properties</a> 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left' of any
- <code id=tables-2:the-td-element-2><a href=#the-td-element>td</a></code> and <code id=tables-2:the-th-element-2><a href=#the-th-element>th</a></code> elements that have corresponding <a href=#concept-cell id=tables-2:concept-cell>cells</a> in the <a href=#concept-table id=tables-2:concept-table>table</a> corresponding to
- the <code id=tables-2:the-table-element-4><a href=#the-table-element>table</a></code> element.</p>
- <p>The <code id=tables-2:the-table-element-5><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-hspace><a href=#attr-table-hspace>hspace</a></code> attribute <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property>maps to the dimension properties</a> 'margin-left' and
- 'margin-right' on the <code id=tables-2:the-table-element-6><a href=#the-table-element>table</a></code> element.</p>
- <p>The <code id=tables-2:the-table-element-7><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-vspace><a href=#attr-table-vspace>vspace</a></code> attribute <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-2>maps to the dimension properties</a> 'margin-top' and
- 'margin-bottom' on the <code id=tables-2:the-table-element-8><a href=#the-table-element>table</a></code> element.</p>
- <p>The <code id=tables-2:the-table-element-9><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-height><a href=#attr-table-height>height</a></code> attribute
- <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-3>maps to the dimension property</a> 'height' on the <code id=tables-2:the-table-element-10><a href=#the-table-element>table</a></code> element.</p>
- <p>The <code id=tables-2:the-table-element-11><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-width><a href=#attr-table-width>width</a></code> attribute
- <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-4>maps to the dimension property</a> 'width' on the <code id=tables-2:the-table-element-12><a href=#the-table-element>table</a></code> element.</p>
- <p>The <code id=tables-2:the-col-element-3><a href=#the-col-element>col</a></code> element's <code id=tables-2:attr-col-width><a href=#attr-col-width>width</a></code> attribute <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-5>maps
- to the dimension property</a> 'width' on the <code id=tables-2:the-col-element-4><a href=#the-col-element>col</a></code> element.</p>
- <p>The <code id=tables-2:the-tr-element-2><a href=#the-tr-element>tr</a></code> element's <code id=tables-2:attr-tr-height><a href=#attr-tr-height>height</a></code> attribute <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-6>maps
- to the dimension property</a> 'height' on the <code id=tables-2:the-tr-element-3><a href=#the-tr-element>tr</a></code> element.</p>
- <p>The <code id=tables-2:the-td-element-3><a href=#the-td-element>td</a></code> and <code id=tables-2:the-th-element-3><a href=#the-th-element>th</a></code> elements' <code id=tables-2:attr-tdth-height><a href=#attr-tdth-height>height</a></code>
- attributes <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-7>map to the dimension property</a>
- 'height' on the element.</p>
- <p>The <code id=tables-2:the-td-element-4><a href=#the-td-element>td</a></code> and <code id=tables-2:the-th-element-4><a href=#the-th-element>th</a></code> elements' <code id=tables-2:attr-tdth-width><a href=#attr-tdth-width>width</a></code>
- attributes <a href=#maps-to-the-dimension-property id=tables-2:maps-to-the-dimension-property-8>map to the dimension property</a>
- 'width' on the element.</p>
- <hr>
- <p>The <code id=tables-2:the-caption-element><a href=#the-caption-element>caption</a></code> element unless specified otherwise below, and the <code id=tables-2:the-thead-element-2><a href=#the-thead-element>thead</a></code>,
- <code id=tables-2:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code>, <code id=tables-2:the-tr-element-4><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-5><a href=#the-td-element>td</a></code>, and <code id=tables-2:the-th-element-5><a href=#the-th-element>th</a></code>
- elements when they have an <code>align</code> attribute whose value is an <a href=#ascii-case-insensitive id=tables-2:ascii-case-insensitive>ASCII
- case-insensitive</a> match for either the string "<code>center</code>" or the string
- "<code>middle</code>", are expected to center text within themselves, as if they had
- their 'text-align' property set to 'center' in a <a href=#presentational-hints id=tables-2:presentational-hints-2>presentational hint</a>, and to <a href=#align-descendants id=tables-2:align-descendants>align descendants</a> to the center.</p>
- <p>The <code id=tables-2:the-caption-element-2><a href=#the-caption-element>caption</a></code>, <code id=tables-2:the-thead-element-3><a href=#the-thead-element>thead</a></code>, <code id=tables-2:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=tables-2:the-tr-element-5><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-6><a href=#the-td-element>td</a></code>, and <code id=tables-2:the-th-element-6><a href=#the-th-element>th</a></code> elements, when they have an <code>align</code> attribute whose value is an <a href=#ascii-case-insensitive id=tables-2:ascii-case-insensitive-2>ASCII case-insensitive</a> match for
- the string "<code>left</code>", are expected to left-align text within themselves, as if
- they had their 'text-align' property set to 'left' in a <a href=#presentational-hints id=tables-2:presentational-hints-3>presentational hint</a>, and to <a href=#align-descendants id=tables-2:align-descendants-2>align descendants</a> to the left.</p>
- <p>The <code id=tables-2:the-caption-element-3><a href=#the-caption-element>caption</a></code>, <code id=tables-2:the-thead-element-4><a href=#the-thead-element>thead</a></code>, <code id=tables-2:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=tables-2:the-tr-element-6><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-7><a href=#the-td-element>td</a></code>, and <code id=tables-2:the-th-element-7><a href=#the-th-element>th</a></code> elements, when they have an <code>align</code> attribute whose value is an <a href=#ascii-case-insensitive id=tables-2:ascii-case-insensitive-3>ASCII case-insensitive</a> match for
- the string "<code>right</code>", are expected to right-align text within themselves, as
- if they had their 'text-align' property set to 'right' in a <a href=#presentational-hints id=tables-2:presentational-hints-4>presentational hint</a>, and to <a href=#align-descendants id=tables-2:align-descendants-3>align descendants</a> to the right.</p>
- <p>The <code id=tables-2:the-caption-element-4><a href=#the-caption-element>caption</a></code>, <code id=tables-2:the-thead-element-5><a href=#the-thead-element>thead</a></code>, <code id=tables-2:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=tables-2:the-tr-element-7><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-8><a href=#the-td-element>td</a></code>, and <code id=tables-2:the-th-element-8><a href=#the-th-element>th</a></code> elements, when they have an <code>align</code> attribute whose value is an <a href=#ascii-case-insensitive id=tables-2:ascii-case-insensitive-4>ASCII case-insensitive</a> match for
- the string "<code>justify</code>", are expected to full-justify text within themselves,
- as if they had their 'text-align' property set to 'justify' in a <a href=#presentational-hints id=tables-2:presentational-hints-5>presentational hint</a>, and to <a href=#align-descendants id=tables-2:align-descendants-4>align descendants</a> to the left.</p>
- <p>User agents are expected to have a rule in their user agent stylesheet that matches
- <code id=tables-2:the-th-element-9><a href=#the-th-element>th</a></code> elements that have a parent node whose computed value for the 'text-align'
- property is its initial value, whose declaration block consists of just a single declaration that
- sets the 'text-align' property to the value 'center'.</p>
- <hr>
- <p>When a <code id=tables-2:the-table-element-13><a href=#the-table-element>table</a></code>, <code id=tables-2:the-thead-element-6><a href=#the-thead-element>thead</a></code>, <code id=tables-2:the-tbody-element-6><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-6><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=tables-2:the-tr-element-8><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-9><a href=#the-td-element>td</a></code>, or <code id=tables-2:the-th-element-10><a href=#the-th-element>th</a></code> element has a <code id=tables-2:attr-background><a href=#attr-background>background</a></code> attribute set to a non-empty value, the new value is
- expected to be <a href=#resolve-a-url id=tables-2:resolve-a-url>resolved</a> relative to the element, and if this is
- successful, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=tables-2:presentational-hints-6>presentational hint</a> setting the element's 'background-image' property to the
- resulting <a href=#absolute-url id=tables-2:absolute-url>absolute URL</a>.</p>
- <p>When a <code id=tables-2:the-table-element-14><a href=#the-table-element>table</a></code>, <code id=tables-2:the-thead-element-7><a href=#the-thead-element>thead</a></code>, <code id=tables-2:the-tbody-element-7><a href=#the-tbody-element>tbody</a></code>, <code id=tables-2:the-tfoot-element-7><a href=#the-tfoot-element>tfoot</a></code>,
- <code id=tables-2:the-tr-element-9><a href=#the-tr-element>tr</a></code>, <code id=tables-2:the-td-element-10><a href=#the-td-element>td</a></code>, or <code id=tables-2:the-th-element-11><a href=#the-th-element>th</a></code> element has a <code>bgcolor</code>
- attribute set, the new value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=tables-2:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy
- colour value</a>, and if that does not return an error, the user agent is expected to treat the
- attribute as a <a href=#presentational-hints id=tables-2:presentational-hints-7>presentational hint</a> setting the element's
- 'background-color' property to the resulting colour.</p>
- <p>When a <code id=tables-2:the-table-element-15><a href=#the-table-element>table</a></code> element has a <code id=tables-2:attr-table-bordercolor><a href=#attr-table-bordercolor>bordercolor</a></code>
- attribute, its value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=tables-2:rules-for-parsing-a-legacy-colour-value-2>rules for parsing a legacy colour
- value</a>, and if that does not return an error, the user agent is expected to treat the
- attribute as a <a href=#presentational-hints id=tables-2:presentational-hints-8>presentational hint</a> setting the element's
- 'border-top-color', 'border-right-color', 'border-bottom-color', and 'border-right-color'
- properties to the resulting colour.</p>
- <hr>
- <p>The <code id=tables-2:the-table-element-16><a href=#the-table-element>table</a></code> element's <code id=tables-2:attr-table-border><a href=#attr-table-border>border</a></code> attribute <a href=#maps-to-the-pixel-length-property id=tables-2:maps-to-the-pixel-length-property-3>maps to the pixel length properties</a>
- 'border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width' on the
- element. If the attribute is present but parsing the attribute's value using the <a href=#rules-for-parsing-non-negative-integers id=tables-2:rules-for-parsing-non-negative-integers-4>rules for
- parsing non-negative integers</a> generates an error, a default value of 1px is expected to be
- used for that property instead.</p>
- <p>Rules marked "<dfn id=magic-border-selector>only if border is not equivalent to zero</dfn>"
- in the CSS block above is expected to only be applied if the <code id=tables-2:attr-table-border-2><a href=#attr-table-border>border</a></code> attribute mentioned in the selectors for the rule is not
- only present but, when parsed using the <a href=#rules-for-parsing-non-negative-integers id=tables-2:rules-for-parsing-non-negative-integers-5>rules for parsing non-negative integers</a>, is
- also found to have a value other than zero or to generate an error.</p>
- <hr>
- <p>In <a href=#quirks-mode id=tables-2:quirks-mode-2>quirks mode</a>, a <code id=tables-2:the-td-element-11><a href=#the-td-element>td</a></code> element or a <code id=tables-2:the-th-element-12><a href=#the-th-element>th</a></code> element that has a
- <code id=tables-2:attr-tdth-nowrap><a href=#attr-tdth-nowrap>nowrap</a></code> attribute but also has a <code id=tables-2:attr-tdth-width-2><a href=#attr-tdth-width>width</a></code> attribute whose value, when parsed using the <a href=#rules-for-parsing-dimension-values id=tables-2:rules-for-parsing-dimension-values>rules for
- parsing dimension values</a>, is found to be a length (not an error or a number classified as a
- percentage), is expected to have a <a href=#presentational-hints id=tables-2:presentational-hints-9>presentational hint</a>
- setting the element's 'white-space' property to 'normal', overriding the rule in the CSS block
- above that sets it to 'nowrap'.</p>
- <hr>
- <p id=sortable-ui>User agents are expected to render <a href=#sorting-interface-th-element id=tables-2:sorting-interface-th-element>sorting interface <code>th</code> elements</a> in such a manner as to indicate that
- activating the elements will cause the table to be sorted.</p>
- <h4 id=margin-collapsing-quirks>14.3.10 Margin collapsing quirks</h4>
- <p>A node is <dfn id=concept-rendering-substantial>substantial</dfn> if it is a text node
- that is not <a href=#inter-element-whitespace id=margin-collapsing-quirks:inter-element-whitespace>inter-element whitespace</a>, or if it is an element node.</p>
- <p>A node is <dfn id=concept-rendering-blank>blank</dfn> if it is an element that contains no
- <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial>substantial</a> nodes.</p>
- <p>The <dfn id=concept-rendering-elements-with-margins>elements with default margins</dfn>
- are the following elements: <code id=margin-collapsing-quirks:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>, <code id=margin-collapsing-quirks:dir><a href=#dir>dir</a></code>, <code id=margin-collapsing-quirks:the-dl-element><a href=#the-dl-element>dl</a></code>,
- <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>,
- <code id=margin-collapsing-quirks:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, <code id=margin-collapsing-quirks:listing><a href=#listing>listing</a></code>, <code id=margin-collapsing-quirks:the-menu-element><a href=#the-menu-element>menu</a></code>, <code id=margin-collapsing-quirks:multicol><a href=#multicol>multicol</a></code>, <code id=margin-collapsing-quirks:the-ol-element><a href=#the-ol-element>ol</a></code>,
- <code id=margin-collapsing-quirks:the-p-element><a href=#the-p-element>p</a></code>, <code id=margin-collapsing-quirks:plaintext><a href=#plaintext>plaintext</a></code>, <code id=margin-collapsing-quirks:the-pre-element><a href=#the-pre-element>pre</a></code>, <code id=margin-collapsing-quirks:the-ul-element><a href=#the-ul-element>ul</a></code>, <code id=margin-collapsing-quirks:xmp><a href=#xmp>xmp</a></code></p>
- <p>In <a href=#quirks-mode id=margin-collapsing-quirks:quirks-mode>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins id=margin-collapsing-quirks:concept-rendering-elements-with-margins>element
- with default margins</a> that is the child of a <code id=margin-collapsing-quirks:the-body-element><a href=#the-body-element>body</a></code>, <code id=margin-collapsing-quirks:the-td-element><a href=#the-td-element>td</a></code>, or
- <code id=margin-collapsing-quirks:the-th-element><a href=#the-th-element>th</a></code> element and has no <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial-2>substantial</a>
- previous siblings is expected to have a user-agent level style sheet rule that sets its
- 'margin-top' property to zero.</p>
- <p>In <a href=#quirks-mode id=margin-collapsing-quirks:quirks-mode-2>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins id=margin-collapsing-quirks:concept-rendering-elements-with-margins-2>element
- with default margins</a> that is the child of a <code id=margin-collapsing-quirks:the-body-element-2><a href=#the-body-element>body</a></code>, <code id=margin-collapsing-quirks:the-td-element-2><a href=#the-td-element>td</a></code>, or
- <code id=margin-collapsing-quirks:the-th-element-2><a href=#the-th-element>th</a></code> element, has no <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial-3>substantial</a>
- previous siblings, and is <a href=#concept-rendering-blank id=margin-collapsing-quirks:concept-rendering-blank>blank</a>, is expected to have
- a user-agent level style sheet rule that sets its 'margin-bottom' property to zero also.</p>
- <p>In <a href=#quirks-mode id=margin-collapsing-quirks:quirks-mode-3>quirks mode</a>, any <a href=#concept-rendering-elements-with-margins id=margin-collapsing-quirks:concept-rendering-elements-with-margins-3>element
- with default margins</a> that is the child of a <code id=margin-collapsing-quirks:the-td-element-3><a href=#the-td-element>td</a></code> or <code id=margin-collapsing-quirks:the-th-element-3><a href=#the-th-element>th</a></code> element, has
- no <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial-4>substantial</a> following siblings, and is <a href=#concept-rendering-blank id=margin-collapsing-quirks:concept-rendering-blank-2>blank</a>, is expected to have a user-agent level style sheet
- rule that sets its 'margin-top' property to zero.</p>
- <p>In <a href=#quirks-mode id=margin-collapsing-quirks:quirks-mode-4>quirks mode</a>, any <code id=margin-collapsing-quirks:the-p-element-2><a href=#the-p-element>p</a></code> element that is the child of a <code id=margin-collapsing-quirks:the-td-element-4><a href=#the-td-element>td</a></code>
- or <code id=margin-collapsing-quirks:the-th-element-4><a href=#the-th-element>th</a></code> element and has no <a href=#concept-rendering-substantial id=margin-collapsing-quirks:concept-rendering-substantial-5>substantial</a> following siblings, is expected to have a
- user-agent level style sheet rule that sets its 'margin-bottom' property to zero.</p>
- <h4 id=form-controls>14.3.11 Form controls</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input, select, option, optgroup, button, textarea, keygen {
- text-indent: initial;
- }
- textarea { white-space: pre-wrap; }
- input[type="radio"], input[type="checkbox"], input[type="reset"], input[type="button"],
- input[type="submit"], select, button {
- box-sizing: border-box;
- }</pre>
- <p>In <a href=#quirks-mode id=form-controls:quirks-mode>quirks mode</a>, the following rules are also expected to apply:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input:not([type=image]), textarea { box-sizing: border-box; }</pre>
- <p>Each kind of form control is also given a specific default binding, as described in subsequent
- sections, which implements the look and feel of the control.</p>
- <h4 id=the-hr-element-2>14.3.12 The <code id=the-hr-element-2:the-hr-element><a href=#the-hr-element>hr</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- hr { color: gray; border-style: inset; border-width: 1px; margin: 0.5em auto; }</pre>
- <p>The following rules are also expected to apply, as <a href=#presentational-hints id=the-hr-element-2:presentational-hints>presentational hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- hr[align=left] { margin-left: 0; margin-right: auto; }
- hr[align=right] { margin-left: auto; margin-right: 0; }
- hr[align=center] { margin-left: auto; margin-right: auto; }
- hr[color], hr[noshade] { border-style: solid; }</pre>
- <p>If an <code id=the-hr-element-2:the-hr-element-2><a href=#the-hr-element>hr</a></code> element has either a <code id=the-hr-element-2:attr-hr-color><a href=#attr-hr-color>color</a></code> attribute
- or a <code id=the-hr-element-2:attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code> attribute, and furthermore also has a <code id=the-hr-element-2:attr-hr-size><a href=#attr-hr-size>size</a></code> attribute, and parsing that attribute's value using the
- <a href=#rules-for-parsing-non-negative-integers id=the-hr-element-2:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> doesn't generate an error, then the user
- agent is expected to use the parsed value divided by two as a pixel length for
- <a href=#presentational-hints id=the-hr-element-2:presentational-hints-2>presentational hints</a> for the properties 'border-top-width', 'border-right-width',
- 'border-bottom-width', and 'border-left-width' on the element.</p>
- <p>Otherwise, if an <code id=the-hr-element-2:the-hr-element-3><a href=#the-hr-element>hr</a></code> element has neither a <code id=the-hr-element-2:attr-hr-color-2><a href=#attr-hr-color>color</a></code>
- attribute nor a <code id=the-hr-element-2:attr-hr-noshade-2><a href=#attr-hr-noshade>noshade</a></code> attribute, but does have a <code id=the-hr-element-2:attr-hr-size-2><a href=#attr-hr-size>size</a></code> attribute, and parsing that attribute's value using the
- <a href=#rules-for-parsing-non-negative-integers id=the-hr-element-2:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> doesn't generate an error, then: if the
- parsed value is one, then the user agent is expected to use the attribute as a <a href=#presentational-hints id=the-hr-element-2:presentational-hints-3>presentational hint</a> setting the element's
- 'border-bottom-width' to 0; otherwise, if the parsed value is greater than one, then the user
- agent is expected to use the parsed value minus two as a pixel length for <a href=#presentational-hints id=the-hr-element-2:presentational-hints-4>presentational
- hints</a> for the 'height' property on the element.</p>
- <p>The <code id=the-hr-element-2:attr-hr-width><a href=#attr-hr-width>width</a></code> attribute on an <code id=the-hr-element-2:the-hr-element-4><a href=#the-hr-element>hr</a></code> element <a href=#maps-to-the-dimension-property id=the-hr-element-2:maps-to-the-dimension-property>maps
- to the dimension property</a> 'width' on the element.</p>
- <p>When an <code id=the-hr-element-2:the-hr-element-5><a href=#the-hr-element>hr</a></code> element has a <code id=the-hr-element-2:attr-hr-color-3><a href=#attr-hr-color>color</a></code> attribute, its
- value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-hr-element-2:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy colour value</a>, and
- if that does not return an error, the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-hr-element-2:presentational-hints-5>presentational hint</a> setting the element's 'color' property to
- the resulting colour.</p>
- <h4 id=the-fieldset-and-legend-elements>14.3.13 The <code id=the-fieldset-and-legend-elements:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code> and <code id=the-fieldset-and-legend-elements:the-legend-element><a href=#the-legend-element>legend</a></code> elements</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- fieldset {
- margin-left: 2px; margin-right: 2px;
- border: groove 2px ThreeDFace;
- padding: 0.35em 0.625em 0.75em;
- min-width: min-content;
- }
- legend {
- padding-left: 2px; padding-right: 2px;
- }</pre>
- <p>The <code id=the-fieldset-and-legend-elements:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code> element is expected to establish a new block formatting context.</p>
- <p>If the <code id=the-fieldset-and-legend-elements:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code> element has a child that matches the conditions in the list below,
- then the first such child is the <code id=the-fieldset-and-legend-elements:the-fieldset-element-4><a href=#the-fieldset-element>fieldset</a></code> element's <dfn id=rendered-legend>rendered legend</dfn>:</p>
- <ul class=brief><li>The child is a <code id=the-fieldset-and-legend-elements:the-legend-element-2><a href=#the-legend-element>legend</a></code> element.<li>The child is not out-of-flow (e.g. not absolutely positioned or floated).<li>The child is generating a box (e.g. it is not 'display:none').</ul>
- <p>A <code id=the-fieldset-and-legend-elements:the-fieldset-element-5><a href=#the-fieldset-element>fieldset</a></code> element's <a href=#rendered-legend id=the-fieldset-and-legend-elements:rendered-legend>rendered legend</a>, if any, is expected to be
- rendered over the top border edge of the <code id=the-fieldset-and-legend-elements:the-fieldset-element-6><a href=#the-fieldset-element>fieldset</a></code> element as a 'block' box
- (overriding any explicit 'display' value). In the absence of an explicit width, the box should
- shrink-wrap. If the <code id=the-fieldset-and-legend-elements:the-legend-element-3><a href=#the-legend-element>legend</a></code> element in question has an <code id=the-fieldset-and-legend-elements:attr-legend-align><a href=#attr-legend-align>align</a></code> attribute, and its value is an <a href=#ascii-case-insensitive id=the-fieldset-and-legend-elements:ascii-case-insensitive>ASCII
- case-insensitive</a> match for one of the strings in the first column of the following table,
- then the <code id=the-fieldset-and-legend-elements:the-legend-element-4><a href=#the-legend-element>legend</a></code> is expected to be rendered horizontally aligned over the border edge
- in the position given in the corresponding cell on the same row in the second column. If the
- attribute is absent or has a value that doesn't match any of the cases in the table, then the
- position is expected to be on the right if the 'direction' property on this element has a computed
- value of 'rtl', and on the left otherwise.</p>
- <table><thead><tr><th>Attribute value
- <th>Alignment position
- <tbody><tr><td><code>left</code>
- <td>On the left
- <tr><td><code>right</code>
- <td>On the right
- <tr><td><code>center</code>
- <td>In the middle
- </table>
- <h3 id=replaced-elements>14.4 Replaced elements</h3>
- <h4 id=embedded-content-rendering-rules>14.4.1 Embedded content</h4>
- <p>The <code id=embedded-content-rendering-rules:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=embedded-content-rendering-rules:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, and <code id=embedded-content-rendering-rules:the-video-element><a href=#the-video-element>video</a></code> elements are expected to be
- treated as replaced elements.</p>
- <p>A <code id=embedded-content-rendering-rules:the-canvas-element><a href=#the-canvas-element>canvas</a></code> element that <a href=#represents id=embedded-content-rendering-rules:represents>represents</a> <a href=#embedded-content-category id=embedded-content-rendering-rules:embedded-content-category>embedded content</a> is
- expected to be treated as a replaced element; the contents of such elements are the element's
- bitmap, if any, or else a transparent black bitmap with the same intrinsic dimensions as the
- element. Other <code id=embedded-content-rendering-rules:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code> elements are expected to be treated as ordinary elements in the
- rendering model.</p>
- <p>An <code id=embedded-content-rendering-rules:the-object-element><a href=#the-object-element>object</a></code> element that <a href=#represents id=embedded-content-rendering-rules:represents-2>represents</a> an image, plugin, or <a href=#nested-browsing-context id=embedded-content-rendering-rules:nested-browsing-context>nested
- browsing context</a> is expected to be treated as a replaced element. Other <code id=embedded-content-rendering-rules:the-object-element-2><a href=#the-object-element>object</a></code>
- elements are expected to be treated as ordinary elements in the rendering model.</p>
- <p>An <code id=embedded-content-rendering-rules:the-applet-element><a href=#the-applet-element>applet</a></code> element that <a href=#represents id=embedded-content-rendering-rules:represents-3>represents</a> a <a href=#plugin id=embedded-content-rendering-rules:plugin>plugin</a> is expected
- to be treated as a replaced element. Other <code id=embedded-content-rendering-rules:the-applet-element-2><a href=#the-applet-element>applet</a></code> elements are expected to be treated
- as ordinary elements in the rendering model.</p>
- <p>The <code id=embedded-content-rendering-rules:the-audio-element><a href=#the-audio-element>audio</a></code> element, when it is <a href=#expose-a-user-interface-to-the-user id=embedded-content-rendering-rules:expose-a-user-interface-to-the-user>exposing a user interface</a>, is expected to be treated as a replaced element about one
- line high, as wide as is necessary to expose the user agent's user interface features. When an
- <code id=embedded-content-rendering-rules:the-audio-element-2><a href=#the-audio-element>audio</a></code> element is not <a href=#expose-a-user-interface-to-the-user id=embedded-content-rendering-rules:expose-a-user-interface-to-the-user-2>exposing a
- user interface</a>, the user agent is expected to force its 'display' property to compute to
- 'none', irrespective of CSS rules.</p>
- <p>Whether a <code id=embedded-content-rendering-rules:the-video-element-2><a href=#the-video-element>video</a></code> element is <a href=#expose-a-user-interface-to-the-user id=embedded-content-rendering-rules:expose-a-user-interface-to-the-user-3>exposing a user interface</a> is not expected to affect the size of the rendering;
- controls are expected to be overlaid above the page content without causing any layout changes,
- and are expected to disappear when the user does not need them.</p>
- <p>When a <code id=embedded-content-rendering-rules:the-video-element-3><a href=#the-video-element>video</a></code> element represents a poster frame or frame of video, the poster frame
- or frame of video is expected to be rendered at the largest size that maintains the aspect ratio
- of that poster frame or frame of video without being taller or wider than the <code id=embedded-content-rendering-rules:the-video-element-4><a href=#the-video-element>video</a></code>
- element itself, and is expected to be centered in the <code id=embedded-content-rendering-rules:the-video-element-5><a href=#the-video-element>video</a></code> element.</p>
- <p>Any subtitles or captions are expected to be overlayed directly on top of their
- <code id=embedded-content-rendering-rules:the-video-element-6><a href=#the-video-element>video</a></code> element, as defined by the relevant rendering rules; for WebVTT, those are the
- <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=embedded-content-rendering-rules:rules-for-updating-the-display-of-webvtt-text-tracks>rules for updating the display of WebVTT text tracks</a>. <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p>When the user agent starts <a href=#expose-a-user-interface-to-the-user id=embedded-content-rendering-rules:expose-a-user-interface-to-the-user-4>exposing a user
- interface</a> for a <code id=embedded-content-rendering-rules:the-video-element-7><a href=#the-video-element>video</a></code> element, the user agent should run the <a href=#rules-for-updating-the-text-track-rendering id=embedded-content-rendering-rules:rules-for-updating-the-text-track-rendering>rules for
- updating the text track rendering</a> of each of the <a href=#text-track id=embedded-content-rendering-rules:text-track>text
- tracks</a> in the <code id=embedded-content-rendering-rules:the-video-element-8><a href=#the-video-element>video</a></code> element's <a href=#list-of-text-tracks id=embedded-content-rendering-rules:list-of-text-tracks>list of text tracks</a> that are <a href=#text-track-showing id=embedded-content-rendering-rules:text-track-showing>showing</a> and whose <a href=#text-track-kind id=embedded-content-rendering-rules:text-track-kind>text track kind</a> is one of <code id=embedded-content-rendering-rules:dom-texttrack-kind-subtitles><a href=#dom-texttrack-kind-subtitles>subtitles</a></code> or <code id=embedded-content-rendering-rules:dom-texttrack-kind-captions><a href=#dom-texttrack-kind-captions>captions</a></code> (e.g., for <a href=#text-track id=embedded-content-rendering-rules:text-track-2>text
- tracks</a> based on WebVTT, the <a href=#rules-for-updating-the-display-of-webvtt-text-tracks id=embedded-content-rendering-rules:rules-for-updating-the-display-of-webvtt-text-tracks-2>rules for updating the display of WebVTT text
- tracks</a>). <a href=#refsWEBVTT>[WEBVTT]</a></p>
- <p class=note>Resizing <code id=embedded-content-rendering-rules:the-video-element-9><a href=#the-video-element>video</a></code> and <code id=embedded-content-rendering-rules:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code> elements does not interrupt
- video playback or clear the canvas.</p>
- <hr>
- <p>The following CSS rules are expected to apply:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- iframe:not([seamless]) { border: 2px inset; }
- iframe[seamless] { display: block; }
- <span id=video-object-fit>video { object-fit: contain; }</span></pre>
- <h4 id=images-2>14.4.2 Images</h4>
- <p>User agents are expected to render <code id=images-2:the-img-element><a href=#the-img-element>img</a></code> elements and <code id=images-2:the-input-element><a href=#the-input-element>input</a></code> elements
- whose <code id=images-2:attr-input-type><a href=#attr-input-type>type</a></code> attributes are in the <a href="#image-button-state-(type=image)" id="images-2:image-button-state-(type=image)">Image Button</a> state, according to the first applicable rules
- from the following list:</p>
- <dl class=switch><dt>If the element <a href=#represents id=images-2:represents>represents</a> an image<dd>The user agent is expected to treat the element as a replaced element and render the image
- according to the rules for doing so defined in CSS.<dt>
- If the element does not <a href=#represents id=images-2:represents-2>represent</a> an image, but the element
- already has intrinsic dimensions (e.g. from the <a href=#dimension-attributes id=images-2:dimension-attributes>dimension attributes</a> or CSS rules),
- and either:
- <ul><li>the user agent has reason to believe that the image will become <i id=images-2:img-available><a href=#img-available>available</a></i> and be rendered in due
- course, or
- <li>the element has no <code>alt</code> attribute, or
- <li>the <code id=images-2:document><a href=#document>Document</a></code> is in <a href=#quirks-mode id=images-2:quirks-mode>quirks mode</a>
- </ul>
- <dd>The user agent is expected to treat the element as a replaced element whose content is the
- text that the element represents, if any, optionally alongside an icon indicating that the image
- is being obtained (if applicable). For <code id=images-2:the-input-element-2><a href=#the-input-element>input</a></code> elements, the element is expected to
- appear button-like to indicate that the element is a <a href=#concept-button id=images-2:concept-button>button</a>.<dt>If the element is an <code id=images-2:the-img-element-2><a href=#the-img-element>img</a></code> element that <a href=#represents id=images-2:represents-3>represents</a> some text and the
- user agent does not expect this to change<dd>The user agent is expected to treat the element as a non-replaced phrasing element whose
- content is the text, optionally with an icon indicating that an image is missing, so that the
- user can request the image be displayed or investigate why it is not rendering. In non-graphical
- contexts, such an icon should be omitted.<dt>If the element is an <code id=images-2:the-img-element-3><a href=#the-img-element>img</a></code> element that <a href=#represents id=images-2:represents-4>represents</a> nothing and the
- user agent does not expect this to change<dd>The user agent is expected to treat the element as an empty inline element. (In the absence
- of further styles, this will cause the element to essentially not be rendered.)<dt>If the element is an <code id=images-2:the-input-element-3><a href=#the-input-element>input</a></code> element that does not <a href=#represents id=images-2:represents-5>represent</a> an image and the user agent does not expect this to change<dd>The user agent is expected to treat the element as a replaced element consisting of a button
- whose content is the element's alternative text. The intrinsic dimensions of the button are
- expected to be about one line in height and whatever width is necessary to render the text on one
- line.</dl>
- <p>The icons mentioned above are expected to be relatively small so as not to disrupt most text
- but be easily clickable. In a visual environment, for instance, icons could be 16 pixels by 16
- pixels square, or 1em by 1em if the images are scalable. In an audio environment, the icon could
- be a short bleep. The icons are intended to indicate to the user that they can be used to get to
- whatever options the UA provides for images, and, where appropriate, are expected to provide
- access to the context menu that would have come up if the user interacted with the actual
- image.</p>
- <hr>
- <p>All animated images with the same <a href=#absolute-url id=images-2:absolute-url>absolute URL</a> and the same image data are
- expected to be rendered synchronised to the same timeline as a group, with the timeline starting
- at the time of the least recent addition to the group.</p>
- <p class=note>In other words, when a second image with the same <a href=#absolute-url id=images-2:absolute-url-2>absolute URL</a> and
- animated image data is inserted into a document, it jumps to the point in the animation cycle that
- is currently being displayed by the first image.</p>
- <p>When a user agent is to <dfn id=restart-the-animation>restart the animation</dfn> for an <code id=images-2:the-img-element-4><a href=#the-img-element>img</a></code> element
- showing an animated image, all animated images with the same <a href=#absolute-url id=images-2:absolute-url-3>absolute URL</a> and the
- same image data in that <code id=images-2:the-img-element-5><a href=#the-img-element>img</a></code> element's <a id=images-2:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> are expected to restart
- their animation from the beginning.</p>
- <hr>
- <p>The following CSS rules are expected to apply when the <code id=images-2:document-2><a href=#document>Document</a></code> is in <a href=#quirks-mode id=images-2:quirks-mode-2>quirks
- mode</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- img[align=left i] { margin-right: 3px; }
- img[align=right i] { margin-left: 3px; }</pre>
-
-
- <h4 id=attributes-for-embedded-content-and-images>14.4.3 Attributes for embedded content and images</h4>
- <p>The following CSS rules are expected to apply as <a href=#presentational-hints id=attributes-for-embedded-content-and-images:presentational-hints>presentational hints</a>:</p>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- iframe[frameborder=0], iframe[frameborder=no i] { border: none; }
- applet[align=left i], embed[align=left i], iframe[align=left i],
- img[align=left i], input[type=image i][align=left i], object[align=left i] {
- float: left;
- }
- applet[align=right i], embed[align=right i], iframe[align=right i],
- img[align=right i], input[type=image i][align=right i], object[align=right i] {
- float: right;
- }
- applet[align=top i], embed[align=top i], iframe[align=top i],
- img[align=top i], input[type=image i][align=top i], object[align=top i] {
- vertical-align: top;
- }
- applet[align=baseline i], embed[align=baseline i], iframe[align=baseline i],
- img[align=baseline i], input[type=image i][align=baseline i], object[align=baseline i] {
- vertical-align: baseline;
- }
- applet[align=texttop i], embed[align=texttop i], iframe[align=texttop i],
- img[align=texttop i], input[type=image i][align=texttop i], object[align=texttop i] {
- vertical-align: text-top;
- }
- applet[align=absmiddle i], embed[align=absmiddle i], iframe[align=absmiddle i],
- img[align=absmiddle i], input[type=image i][align=absmiddle i], object[align=absmiddle i],
- applet[align=abscenter i], embed[align=abscenter i], iframe[align=abscenter i],
- img[align=abscenter i], input[type=image i][align=abscenter i], object[align=abscenter i] {
- vertical-align: middle;
- }
- applet[align=bottom i], embed[align=bottom i], iframe[align=bottom i],
- img[align=bottom i], input[type=image i][align=bottom i],
- object[align=bottom i] {
- vertical-align: bottom;
- }</pre>
- <p>When an <code id=attributes-for-embedded-content-and-images:the-applet-element><a href=#the-applet-element>applet</a></code>, <code id=attributes-for-embedded-content-and-images:the-embed-element><a href=#the-embed-element>embed</a></code>, <code id=attributes-for-embedded-content-and-images:the-iframe-element><a href=#the-iframe-element>iframe</a></code>, <code id=attributes-for-embedded-content-and-images:the-img-element><a href=#the-img-element>img</a></code>, or
- <code id=attributes-for-embedded-content-and-images:the-object-element><a href=#the-object-element>object</a></code> element, or an <code id=attributes-for-embedded-content-and-images:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=attributes-for-embedded-content-and-images:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#image-button-state-(type=image)" id="attributes-for-embedded-content-and-images:image-button-state-(type=image)">Image Button</a> state, has an <code>align</code>
- attribute whose value is an <a href=#ascii-case-insensitive id=attributes-for-embedded-content-and-images:ascii-case-insensitive>ASCII case-insensitive</a> match for the string "<code>center</code>" or the string "<code>middle</code>", the user agent is expected
- to act as if the element's 'vertical-align' property was set to a value that aligns the vertical
- middle of the element with the parent element's baseline.</p>
- <p>The <code>hspace</code> attribute of <code id=attributes-for-embedded-content-and-images:the-applet-element-2><a href=#the-applet-element>applet</a></code>, <code id=attributes-for-embedded-content-and-images:the-embed-element-2><a href=#the-embed-element>embed</a></code>,
- <code id=attributes-for-embedded-content-and-images:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>, <code id=attributes-for-embedded-content-and-images:the-img-element-2><a href=#the-img-element>img</a></code>, or <code id=attributes-for-embedded-content-and-images:the-object-element-2><a href=#the-object-element>object</a></code> elements, and <code id=attributes-for-embedded-content-and-images:the-input-element-2><a href=#the-input-element>input</a></code>
- elements with a <code id=attributes-for-embedded-content-and-images:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" id="attributes-for-embedded-content-and-images:image-button-state-(type=image)-2">Image Button</a> state, <a href=#maps-to-the-dimension-property id=attributes-for-embedded-content-and-images:maps-to-the-dimension-property>maps to the dimension properties</a> 'margin-left' and 'margin-right' on the
- element.</p>
- <p>The <code>vspace</code> attribute of <code id=attributes-for-embedded-content-and-images:the-applet-element-3><a href=#the-applet-element>applet</a></code>, <code id=attributes-for-embedded-content-and-images:the-embed-element-3><a href=#the-embed-element>embed</a></code>,
- <code id=attributes-for-embedded-content-and-images:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>, <code id=attributes-for-embedded-content-and-images:the-img-element-3><a href=#the-img-element>img</a></code>, or <code id=attributes-for-embedded-content-and-images:the-object-element-3><a href=#the-object-element>object</a></code> elements, and <code id=attributes-for-embedded-content-and-images:the-input-element-3><a href=#the-input-element>input</a></code>
- elements with a <code id=attributes-for-embedded-content-and-images:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" id="attributes-for-embedded-content-and-images:image-button-state-(type=image)-3">Image Button</a> state, <a href=#maps-to-the-dimension-property id=attributes-for-embedded-content-and-images:maps-to-the-dimension-property-2>maps to the dimension properties</a> 'margin-top' and 'margin-bottom' on the
- element.</p>
- <p>When an <code id=attributes-for-embedded-content-and-images:the-img-element-4><a href=#the-img-element>img</a></code> element, <code id=attributes-for-embedded-content-and-images:the-object-element-4><a href=#the-object-element>object</a></code> element, or <code id=attributes-for-embedded-content-and-images:the-input-element-4><a href=#the-input-element>input</a></code> element
- with a <code id=attributes-for-embedded-content-and-images:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" id="attributes-for-embedded-content-and-images:image-button-state-(type=image)-4">Image Button</a> state has a <code>border</code> attribute whose value, when parsed using the <a href=#rules-for-parsing-non-negative-integers id=attributes-for-embedded-content-and-images:rules-for-parsing-non-negative-integers>rules for
- parsing non-negative integers</a>, is found to be a number greater than zero, the user agent is
- expected to use the parsed value for eight <a href=#presentational-hints id=attributes-for-embedded-content-and-images:presentational-hints-2>presentational hints</a>: four setting the
- parsed value as a pixel length for the element's 'border-top-width', 'border-right-width',
- 'border-bottom-width', and 'border-left-width' properties, and four setting the element's
- 'border-top-style', 'border-right-style', 'border-bottom-style', and 'border-left-style'
- properties to the value 'solid'.</p>
- <p id=dimRendering>The <code id=attributes-for-embedded-content-and-images:attr-dim-width><a href=#attr-dim-width>width</a></code> and <code id=attributes-for-embedded-content-and-images:attr-dim-height><a href=#attr-dim-height>height</a></code> attributes on <code id=attributes-for-embedded-content-and-images:the-applet-element-4><a href=#the-applet-element>applet</a></code>, <code id=attributes-for-embedded-content-and-images:the-embed-element-4><a href=#the-embed-element>embed</a></code>,
- <code id=attributes-for-embedded-content-and-images:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>, <code id=attributes-for-embedded-content-and-images:the-img-element-5><a href=#the-img-element>img</a></code>, <code id=attributes-for-embedded-content-and-images:the-object-element-5><a href=#the-object-element>object</a></code> or <code id=attributes-for-embedded-content-and-images:the-video-element><a href=#the-video-element>video</a></code> elements, and
- <code id=attributes-for-embedded-content-and-images:the-input-element-5><a href=#the-input-element>input</a></code> elements with a <code id=attributes-for-embedded-content-and-images:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute in the
- <a href="#image-button-state-(type=image)" id="attributes-for-embedded-content-and-images:image-button-state-(type=image)-5">Image Button</a> state and that either represents an image
- or that the user expects will eventually represent an image, <a href=#maps-to-the-dimension-property id=attributes-for-embedded-content-and-images:maps-to-the-dimension-property-3>map to the dimension properties</a> 'width' and 'height' on the element
- respectively.</p>
-
-
- <h4 id=image-maps-2>14.4.4 Image maps</h4>
- <p>Shapes on an <a href=#image-map id=image-maps-2:image-map>image map</a> are expected to act, for the purpose of the CSS cascade, as
- elements independent of the original <code id=image-maps-2:the-area-element><a href=#the-area-element>area</a></code> element that happen to match the same style
- rules but inherit from the <code id=image-maps-2:the-img-element><a href=#the-img-element>img</a></code> or <code id=image-maps-2:the-object-element><a href=#the-object-element>object</a></code> element.</p>
- <p>For the purposes of the rendering, only the 'cursor' property is expected to have any effect on
- the shape.</p>
- <p class=example>Thus, for example, if an <code id=image-maps-2:the-area-element-2><a href=#the-area-element>area</a></code> element has a <code id=image-maps-2:the-style-attribute><a href=#the-style-attribute>style</a></code> attribute that sets the 'cursor' property to 'help', then when the
- user designates that shape, the cursor would change to a Help cursor.</p>
- <p class=example>Similarly, if an <code id=image-maps-2:the-area-element-3><a href=#the-area-element>area</a></code> element had a CSS rule that set its 'cursor'
- property to 'inherit' (or if no rule setting the 'cursor' property matched the element at all),
- the shape's cursor would be inherited from the <code id=image-maps-2:the-img-element-2><a href=#the-img-element>img</a></code> or <code id=image-maps-2:the-object-element-2><a href=#the-object-element>object</a></code> element of
- the <a href=#image-map id=image-maps-2:image-map-2>image map</a>, not from the parent of the <code id=image-maps-2:the-area-element-4><a href=#the-area-element>area</a></code> element.</p>
-
-
- <h3 id=bindings>14.5 Bindings</h3>
- <h4 id=introduction-18>14.5.1 Introduction</h4>
- <p>A number of elements have their rendering defined in terms of the 'binding' property. <a href=#refsBECSS>[BECSS]</a></p>
- <p>The CSS snippets below set the 'binding' property to a user-agent-defined value, represented
- below by keywords like <code><i>button</i></code>. The rules then described for
- these bindings are only expected to apply if the element's 'binding' property has not been
- overridden (e.g. by the author) to have another value.</p>
- <p>Exactly how the bindings are implemented is not specified by this specification. User agents
- are encouraged to make their bindings set the 'appearance' CSS property appropriately to achieve
- platform-native appearances for widgets, and are expected to implement any relevant animations,
- etc, that are appropriate for the platform. <a href=#refsCSSUI>[CSSUI]</a></p>
-
-
- <h4 id=the-button-element-2>14.5.2 The <code id=the-button-element-2:the-button-element><a href=#the-button-element>button</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- button { binding: <i>button</i>; }</pre>
- <p>When the <i>button</i> binding applies to a <code id=the-button-element-2:the-button-element-2><a href=#the-button-element>button</a></code> element, the element
- is expected to render as an 'inline-block' box rendered as a button whose contents are the
- contents of the element.</p>
- <p>When the <code id=the-button-element-2:the-button-element-3><a href=#the-button-element>button</a></code> element's <code id=the-button-element-2:attr-button-type><a href=#attr-button-type>type</a></code> attribute is
- in the <a href=#attr-button-type-menu-state id=the-button-element-2:attr-button-type-menu-state>Menu</a> state, the user agent is expected to
- indicate that activating the element will display a menu, e.g. by displaying a down-pointing
- triangle after the button's label.</p>
-
-
- <h4 id=the-details-element-2>14.5.3 The <code id=the-details-element-2:the-details-element><a href=#the-details-element>details</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- details { binding: <i>details</i>; }</pre>
- <p>When the <i>details</i> binding applies to a <code id=the-details-element-2:the-details-element-2><a href=#the-details-element>details</a></code> element, the element
- is expected to render as a 'block' box with its 'padding-left' property set to '40px' for
- left-to-right elements (<a href=#ltr-specific id=the-details-element-2:ltr-specific>LTR-specific</a>) and with its 'padding-right' property set to
- '40px' for right-to-left elements. The element's shadow tree is expected to take the element's
- first child <code id=the-details-element-2:the-summary-element><a href=#the-summary-element>summary</a></code> element, if any, and place it in a first 'block' box container,
- and then take the element's remaining descendants, if any, and place them in a second 'block' box
- container.</p>
- <p>The first container is expected to contain at least one line box, and that line box is expected
- to contain a disclosure widget (typically a triangle), horizontally positioned within the left
- padding of the <code id=the-details-element-2:the-details-element-3><a href=#the-details-element>details</a></code> element. That widget is expected to allow the user to request
- that the details be shown or hidden.</p>
- <p>The second container is expected to have its 'overflow' property set to 'hidden'. When the
- <code id=the-details-element-2:the-details-element-4><a href=#the-details-element>details</a></code> element does not have an <code id=the-details-element-2:attr-details-open><a href=#attr-details-open>open</a></code>
- attribute, this second container is expected to be removed from the rendering.</p>
-
-
-
- <h4 id=the-input-element-as-a-text-entry-widget>14.5.4 The <code id=the-input-element-as-a-text-entry-widget:the-input-element><a href=#the-input-element>input</a></code> element as a text entry widget</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input { binding: <i>input-textfield</i>; }
- input[type=password i] { binding: <i>input-password</i>; }
- /* later rules override this for other values of type="" */</pre>
- <p>When the <i>input-textfield</i> binding applies to an <code id=the-input-element-as-a-text-entry-widget:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-text-entry-widget:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element-as-a-text-entry-widget:text-(type=text)-state-and-search-state-(type=search)">Text</a>, <a href="#text-(type=text)-state-and-search-state-(type=search)" id="the-input-element-as-a-text-entry-widget:text-(type=text)-state-and-search-state-(type=search)-2">Search</a>,
- <a href="#telephone-state-(type=tel)" id="the-input-element-as-a-text-entry-widget:telephone-state-(type=tel)">Telephone</a>, <a href="#url-state-(type=url)" id="the-input-element-as-a-text-entry-widget:url-state-(type=url)">URL</a>,
- or <a href="#e-mail-state-(type=email)" id="the-input-element-as-a-text-entry-widget:e-mail-state-(type=email)">E-mail</a> state, the element is expected to render as
- an 'inline-block' box rendered as a text field.</p>
- <p>When the <i>input-password</i> binding applies to an <code id=the-input-element-as-a-text-entry-widget:the-input-element-3><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-text-entry-widget:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#password-state-(type=password)" id="the-input-element-as-a-text-entry-widget:password-state-(type=password)">Password</a> state, the element is expected to render as an
- 'inline-block' box rendered as a text field whose contents are obscured.</p>
- <p>If these text fields provide a text selection, then, when the user changes the currect
- selection in such a binding, the user agent is expected to <a href=#queue-a-task id=the-input-element-as-a-text-entry-widget:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=the-input-element-as-a-text-entry-widget:fire-a-simple-event>fire
- a simple event</a> that bubbles named <code id=the-input-element-as-a-text-entry-widget:event-select><a href=#event-select>select</a></code> at the element,
- using the <a href=#user-interaction-task-source id=the-input-element-as-a-text-entry-widget:user-interaction-task-source>user interaction task source</a> as the task source.</p>
- <p>If an <code id=the-input-element-as-a-text-entry-widget:the-input-element-4><a href=#the-input-element>input</a></code> element whose <code id=the-input-element-as-a-text-entry-widget:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is
- in one of the above states has a <code id=the-input-element-as-a-text-entry-widget:attr-input-size><a href=#attr-input-size>size</a></code> attribute, and parsing
- that attribute's value using the <a href=#rules-for-parsing-non-negative-integers id=the-input-element-as-a-text-entry-widget:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> doesn't
- generate an error, then the user agent is expected to use the attribute as a <a href=#presentational-hints id=the-input-element-as-a-text-entry-widget:presentational-hints>presentational hint</a> for the 'width' property on the element,
- with the value obtained from applying the <a href=#converting-a-character-width-to-pixels id=the-input-element-as-a-text-entry-widget:converting-a-character-width-to-pixels>converting a character width to pixels</a>
- algorithm to the value of the attribute.</p>
- <p>If an <code id=the-input-element-as-a-text-entry-widget:the-input-element-5><a href=#the-input-element>input</a></code> element whose <code id=the-input-element-as-a-text-entry-widget:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is
- in one of the above states does <em>not</em> have a <code id=the-input-element-as-a-text-entry-widget:attr-input-size-2><a href=#attr-input-size>size</a></code>
- attribute, then the user agent is expected to act as if it had a user-agent-level style sheet rule
- setting the 'width' property on the element to the value obtained from applying the
- <a href=#converting-a-character-width-to-pixels id=the-input-element-as-a-text-entry-widget:converting-a-character-width-to-pixels-2>converting a character width to pixels</a> algorithm to the number 20.</p>
- <p>The <dfn id=converting-a-character-width-to-pixels>converting a character width to pixels</dfn> algorithm returns <span>(<var>size</var>-1)×<var>avg</var> + <var>max</var></span>,
- where <var>size</var> is the character width to convert, <var>avg</var> is the
- average character width of the primary font for the element for which the algorithm is being run,
- in pixels, and <var>max</var> is the maximum character width of that same font, also in
- pixels. (The element's 'letter-spacing' property does not affect the result.)</p>
- <p>When the <i>input-textfield</i> binding applies to an element, the 'line-height'
- property, if it has a computed value equivalent to a value that is less than 1.0, must have a used
- value of 1.0.</p>
-
-
- <h4 id=the-input-element-as-domain-specific-widgets>14.5.5 The <code id=the-input-element-as-domain-specific-widgets:the-input-element><a href=#the-input-element>input</a></code> element as domain-specific widgets</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=datetime i] { binding: <i>input-datetime</i>; }
- input[type=date i] { binding: <i>input-date</i>; }
- input[type=month i] { binding: <i>input-month</i>; }
- input[type=week i] { binding: <i>input-week</i>; }
- input[type=time i] { binding: <i>input-time</i>; }
- input[type=datetime-local i] { binding: <i>input-datetime-local</i>; }
- input[type=number i] { binding: <i>input-number</i>; }</pre>
- <p>When the <i>input-datetime</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#date-and-time-state-(type=datetime)" id="the-input-element-as-domain-specific-widgets:date-and-time-state-(type=datetime)">Date and Time</a> state, the element is expected to render as
- an 'inline-block' box depicting a Date and Time control.</p>
- <p>When the <i>input-date</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-3><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#date-state-(type=date)" id="the-input-element-as-domain-specific-widgets:date-state-(type=date)">Date</a> state, the element is expected to render as an
- 'inline-block' box depicting a Date control.</p>
- <p>When the <i>input-month</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-4><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type-3><a href=#attr-input-type>type</a></code> attribute is in the <a href="#month-state-(type=month)" id="the-input-element-as-domain-specific-widgets:month-state-(type=month)">Month</a> state, the element is expected to render as an
- 'inline-block' box depicting a Month control.</p>
- <p>When the <i>input-week</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-5><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type-4><a href=#attr-input-type>type</a></code> attribute is in the <a href="#week-state-(type=week)" id="the-input-element-as-domain-specific-widgets:week-state-(type=week)">Week</a> state, the element is expected to render as an
- 'inline-block' box depicting a Week control.</p>
- <p>When the <i>input-time</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-6><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type-5><a href=#attr-input-type>type</a></code> attribute is in the <a href="#time-state-(type=time)" id="the-input-element-as-domain-specific-widgets:time-state-(type=time)">Time</a> state, the element is expected to render as an
- 'inline-block' box depicting a Time control.</p>
- <p>When the <i>input-datetime-local</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-7><a href=#the-input-element>input</a></code> element
- whose <code id=the-input-element-as-domain-specific-widgets:attr-input-type-6><a href=#attr-input-type>type</a></code> attribute is in the <a href="#local-date-and-time-state-(type=datetime-local)" id="the-input-element-as-domain-specific-widgets:local-date-and-time-state-(type=datetime-local)">Local Date and Time</a> state, the element is expected
- to render as an 'inline-block' box depicting a Local Date and Time control.</p>
- <p>When the <i>input-number</i> binding applies to an <code id=the-input-element-as-domain-specific-widgets:the-input-element-8><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-domain-specific-widgets:attr-input-type-7><a href=#attr-input-type>type</a></code> attribute is in the <a href="#number-state-(type=number)" id="the-input-element-as-domain-specific-widgets:number-state-(type=number)">Number</a> state, the element is expected to render as an
- 'inline-block' box depicting a Number control.</p>
- <p>These controls are all expected to be about one line high, and about as wide as necessary to
- show the widest possible value.</p>
-
-
- <h4 id=the-input-element-as-a-range-control>14.5.6 The <code id=the-input-element-as-a-range-control:the-input-element><a href=#the-input-element>input</a></code> element as a range control</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=range i] { binding: <i>input-range</i>; }</pre>
- <p>When the <i>input-range</i> binding applies to an <code id=the-input-element-as-a-range-control:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-range-control:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#range-state-(type=range)" id="the-input-element-as-a-range-control:range-state-(type=range)">Range</a> state, the element is expected to render as an
- 'inline-block' box depicting a slider control.</p>
- <p>When the control is wider than it is tall (or square), the control is expected to be a
- horizontal slider, with the lowest value on the right if the 'direction' property on this element
- has a computed value of 'rtl', and on the left otherwise. When the control is taller than it is
- wide, it is expected to be a vertical slider, with the lowest value on the bottom.</p>
- <p>Predefined suggested values (provided by the <code id=the-input-element-as-a-range-control:attr-input-list><a href=#attr-input-list>list</a></code>
- attribute) are expected to be shown as tick marks on the slider, which the slider can snap to.</p>
- <p>User agents are expected to use the used value of the 'direction' property on the element to
- determine the direction in which the slider operates. Typically, a left-to-right ('ltr')
- horizontal control would have the lowest value on the left and the highest value on the right, and
- vice versa.</p>
-
-
- <h4 id=the-input-element-as-a-colour-well>14.5.7 The <code id=the-input-element-as-a-colour-well:the-input-element><a href=#the-input-element>input</a></code> element as a colour well</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=color i] { binding: <i>input-color</i>; }</pre>
- <p>When the <i>input-color</i> binding applies to an <code id=the-input-element-as-a-colour-well:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-colour-well:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#colour-state-(type=color)" id="the-input-element-as-a-colour-well:colour-state-(type=color)">Colour</a> state, the element is expected to render as an
- 'inline-block' box depicting a colour well, which, when activated, provides the user with a colour
- picker (e.g. a colour wheel or colour palette) from which the colour can be changed.</p>
- <p>Predefined suggested values (provided by the <code id=the-input-element-as-a-colour-well:attr-input-list><a href=#attr-input-list>list</a></code>
- attribute) are expected to be shown in the colour picker interface, not on the colour well
- itself.</p>
-
-
- <h4 id=the-input-element-as-a-checkbox-and-radio-button-widgets>14.5.8 The <code id=the-input-element-as-a-checkbox-and-radio-button-widgets:the-input-element><a href=#the-input-element>input</a></code> element as a checkbox and radio button widgets</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=checkbox i] { binding: <i>input-checkbox</i>; }
- input[type=radio i] { binding: <i>input-radio</i>; }</pre>
- <p>When the <i>input-checkbox</i> binding applies to an <code id=the-input-element-as-a-checkbox-and-radio-button-widgets:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-checkbox-and-radio-button-widgets:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#checkbox-state-(type=checkbox)" id="the-input-element-as-a-checkbox-and-radio-button-widgets:checkbox-state-(type=checkbox)">Checkbox</a> state, the element is expected to render as an
- 'inline-block' box containing a single checkbox control, with no label.</p>
- <p>When the <i>input-radio</i> binding applies to an <code id=the-input-element-as-a-checkbox-and-radio-button-widgets:the-input-element-3><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-checkbox-and-radio-button-widgets:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the <a href="#radio-button-state-(type=radio)" id="the-input-element-as-a-checkbox-and-radio-button-widgets:radio-button-state-(type=radio)">Radio Button</a> state, the element is expected to render as an
- 'inline-block' box containing a single radio button control, with no label.</p>
-
-
- <h4 id=the-input-element-as-a-file-upload-control>14.5.9 The <code id=the-input-element-as-a-file-upload-control:the-input-element><a href=#the-input-element>input</a></code> element as a file upload control</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=file i] { binding: <i>input-file</i>; }</pre>
- <p>When the <i>input-file</i> binding applies to an <code id=the-input-element-as-a-file-upload-control:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-file-upload-control:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#file-upload-state-(type=file)" id="the-input-element-as-a-file-upload-control:file-upload-state-(type=file)">File Upload</a> state, the element is expected to render as an
- 'inline-block' box containing a span of text giving the file name(s) of the <a href=#concept-input-type-file-selected id=the-input-element-as-a-file-upload-control:concept-input-type-file-selected>selected files</a>, if any, followed by a button that,
- when activated, provides the user with a file picker from which the selection can be changed.</p>
-
-
- <h4 id=the-input-element-as-a-button>14.5.10 The <code id=the-input-element-as-a-button:the-input-element><a href=#the-input-element>input</a></code> element as a button</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- input[type=submit i], input[type=reset i], input[type=button i] {
- binding: <i>input-button</i>;
- }</pre>
- <p>When the <i>input-button</i> binding applies to an <code id=the-input-element-as-a-button:the-input-element-2><a href=#the-input-element>input</a></code> element whose
- <code id=the-input-element-as-a-button:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href="#submit-button-state-(type=submit)" id="the-input-element-as-a-button:submit-button-state-(type=submit)">Submit Button</a>, <a href="#reset-button-state-(type=reset)" id="the-input-element-as-a-button:reset-button-state-(type=reset)">Reset
- Button</a>, or <a href="#button-state-(type=button)" id="the-input-element-as-a-button:button-state-(type=button)">Button</a> state, the element is
- expected to render as an 'inline-block' box rendered as a button, about one line high, containing
- the contents of the element's <code id=the-input-element-as-a-button:attr-input-value><a href=#attr-input-value>value</a></code> attribute, if any, or
- text derived from the element's <code id=the-input-element-as-a-button:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute in a
- user-agent-defined (and probably locale-specific) fashion, if not.</p>
-
-
- <h4 id=the-marquee-element>14.5.11 The <code id=the-marquee-element:the-marquee-element-2><a href=#the-marquee-element-2>marquee</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- marquee { binding: <i>marquee</i>; }</pre>
- <p>When the <i>marquee</i> binding applies to a <code id=the-marquee-element:the-marquee-element-2-2><a href=#the-marquee-element-2>marquee</a></code> element, while the
- element is <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on>turned on</a>, the element is expected to render in
- an animated fashion according to its attributes as follows:</p>
- <dl><dt>If the element's <code id=the-marquee-element:attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
- <a href=#attr-marquee-behavior-scroll id=the-marquee-element:attr-marquee-behavior-scroll>scroll</a> state<dd>
- <p>Slide the contents of the element in the direction described by the <code id=the-marquee-element:attr-marquee-direction><a href=#attr-marquee-direction>direction</a></code> attribute as defined below, such that it begins
- off the start side of the <code id=the-marquee-element:the-marquee-element-2-3><a href=#the-marquee-element-2>marquee</a></code>, and ends flush with the inner end side.</p>
- <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-2><a href=#attr-marquee-direction>direction</a></code>
- attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left>left</a> (the default), then the
- contents would start such that their left edge are off the side of the right edge of the
- <code id=the-marquee-element:the-marquee-element-2-4><a href=#the-marquee-element-2>marquee</a></code>'s content area, and the contents would then slide up to the point where the
- left edge of the contents are flush with the left inner edge of the <code id=the-marquee-element:the-marquee-element-2-5><a href=#the-marquee-element-2>marquee</a></code>'s
- content area.</p>
- <p>Once the animation has ended, the user agent is expected to <a href=#increment-the-marquee-current-loop-index id=the-marquee-element:increment-the-marquee-current-loop-index>increment the marquee
- current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-2>turned
- on</a> after this, then the user agent is expected to restart the animation.</p>
- <dt>If the element's <code id=the-marquee-element:attr-marquee-behavior-2><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
- <a href=#attr-marquee-behavior-slide id=the-marquee-element:attr-marquee-behavior-slide>slide</a> state<dd>
- <p>Slide the contents of the element in the direction described by the <code id=the-marquee-element:attr-marquee-direction-3><a href=#attr-marquee-direction>direction</a></code> attribute as defined below, such that it begins
- off the start side of the <code id=the-marquee-element:the-marquee-element-2-6><a href=#the-marquee-element-2>marquee</a></code>, and ends off the end side of the
- <code id=the-marquee-element:the-marquee-element-2-7><a href=#the-marquee-element-2>marquee</a></code>.</p>
- <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-4><a href=#attr-marquee-direction>direction</a></code>
- attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-2>left</a> (the default), then the
- contents would start such that their left edge are off the side of the right edge of the
- <code id=the-marquee-element:the-marquee-element-2-8><a href=#the-marquee-element-2>marquee</a></code>'s content area, and the contents would then slide up to the point where the
- <em>right</em> edge of the contents are flush with the left inner edge of the
- <code id=the-marquee-element:the-marquee-element-2-9><a href=#the-marquee-element-2>marquee</a></code>'s content area.</p>
- <p>Once the animation has ended, the user agent is expected to <a href=#increment-the-marquee-current-loop-index id=the-marquee-element:increment-the-marquee-current-loop-index-2>increment the marquee
- current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-3>turned
- on</a> after this, then the user agent is expected to restart the animation.</p>
- <dt>If the element's <code id=the-marquee-element:attr-marquee-behavior-3><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
- <a href=#attr-marquee-behavior-alternate id=the-marquee-element:attr-marquee-behavior-alternate>alternate</a> state<dd>
- <p>When the <a href=#marquee-current-loop-index id=the-marquee-element:marquee-current-loop-index>marquee current loop index</a> is even (or zero), slide the contents of the
- element in the direction described by the <code id=the-marquee-element:attr-marquee-direction-5><a href=#attr-marquee-direction>direction</a></code>
- attribute as defined below, such that it begins flush with the start side of the
- <code id=the-marquee-element:the-marquee-element-2-10><a href=#the-marquee-element-2>marquee</a></code>, and ends flush with the end side of the <code id=the-marquee-element:the-marquee-element-2-11><a href=#the-marquee-element-2>marquee</a></code>.</p>
- <p>When the <a href=#marquee-current-loop-index id=the-marquee-element:marquee-current-loop-index-2>marquee current loop index</a> is odd, slide the contents of the element in
- the opposite direction than that described by the <code id=the-marquee-element:attr-marquee-direction-6><a href=#attr-marquee-direction>direction</a></code> attribute as defined below, such that it begins
- flush with the end side of the <code id=the-marquee-element:the-marquee-element-2-12><a href=#the-marquee-element-2>marquee</a></code>, and ends flush with the start side of the
- <code id=the-marquee-element:the-marquee-element-2-13><a href=#the-marquee-element-2>marquee</a></code>.</p>
- <p class=example>For example, if the <code id=the-marquee-element:attr-marquee-direction-7><a href=#attr-marquee-direction>direction</a></code>
- attribute is <a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-3>left</a> (the default), then the
- contents would with their right edge flush with the right inner edge of the
- <code id=the-marquee-element:the-marquee-element-2-14><a href=#the-marquee-element-2>marquee</a></code>'s content area, and the contents would then slide up to the point where the
- <em>left</em> edge of the contents are flush with the left inner edge of the
- <code id=the-marquee-element:the-marquee-element-2-15><a href=#the-marquee-element-2>marquee</a></code>'s content area.</p>
- <p>Once the animation has ended, the user agent is expected to <a href=#increment-the-marquee-current-loop-index id=the-marquee-element:increment-the-marquee-current-loop-index-3>increment the marquee
- current loop index</a>. If the element is still <a href=#concept-marquee-on id=the-marquee-element:concept-marquee-on-4>turned
- on</a> after this, then the user agent is expected to continue the animation.</p>
- </dl>
- <p>The <code id=the-marquee-element:attr-marquee-direction-8><a href=#attr-marquee-direction>direction</a></code> attribute has the meanings described
- in the following table:</p>
- <table><thead><tr><th><code id=the-marquee-element:attr-marquee-direction-9><a href=#attr-marquee-direction>direction</a></code> attribute state
- <th>Direction of animation
- <th>Start edge
- <th>End edge
- <th>Opposite direction
- <tbody><tr><td><a href=#attr-marquee-direction-left id=the-marquee-element:attr-marquee-direction-left-4>left</a>
- <td>← Right to left
- <td>Right
- <td>Left
- <td>→ Left to Right
- <tr><td><a href=#attr-marquee-direction-right id=the-marquee-element:attr-marquee-direction-right>right</a>
- <td>→ Left to Right
- <td>Left
- <td>Right
- <td>← Right to left
- <tr><td><a href=#attr-marquee-direction-up id=the-marquee-element:attr-marquee-direction-up>up</a>
- <td>↑ Up (Bottom to Top)
- <td>Bottom
- <td>Top
- <td>↓ Down (Top to Bottom)
- <tr><td><a href=#attr-marquee-direction-down id=the-marquee-element:attr-marquee-direction-down>down</a>
- <td>↓ Down (Top to Bottom)
- <td>Top
- <td>Bottom
- <td>↑ Up (Bottom to Top)
- </table>
- <p>In any case, the animation should proceed such that there is a delay given by the <a href=#marquee-scroll-interval id=the-marquee-element:marquee-scroll-interval>marquee
- scroll interval</a> between each frame, and such that the content moves at most the distance
- given by the <a href=#marquee-scroll-distance id=the-marquee-element:marquee-scroll-distance>marquee scroll distance</a> with each frame.</p>
- <p>When a <code id=the-marquee-element:the-marquee-element-2-16><a href=#the-marquee-element-2>marquee</a></code> element has a <code>bgcolor</code>
- attribute set, the value is expected to be parsed using the <a href=#rules-for-parsing-a-legacy-colour-value id=the-marquee-element:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy colour
- value</a>, and if that does not return an error, the user agent is expected to treat the
- attribute as a <a href=#presentational-hints id=the-marquee-element:presentational-hints>presentational hint</a> setting the element's
- 'background-color' property to the resulting colour.</p>
- <p>The <code>width</code> and <code>height</code> attributes on a <code id=the-marquee-element:the-marquee-element-2-17><a href=#the-marquee-element-2>marquee</a></code> element <a href=#maps-to-the-dimension-property id=the-marquee-element:maps-to-the-dimension-property>map to the dimension properties</a> 'width' and 'height'
- on the element respectively.</p>
- <p>The intrinsic height of a <code id=the-marquee-element:the-marquee-element-2-18><a href=#the-marquee-element-2>marquee</a></code> element with its <code id=the-marquee-element:attr-marquee-direction-10><a href=#attr-marquee-direction>direction</a></code> attribute in the <a href=#attr-marquee-direction-up id=the-marquee-element:attr-marquee-direction-up-2>up</a> or <a href=#attr-marquee-direction-down id=the-marquee-element:attr-marquee-direction-down-2>down</a> states is 200 CSS pixels.</p>
- <p>The <code>vspace</code> attribute of a <code id=the-marquee-element:the-marquee-element-2-19><a href=#the-marquee-element-2>marquee</a></code> element
- <a href=#maps-to-the-dimension-property id=the-marquee-element:maps-to-the-dimension-property-2>maps to the dimension properties</a> 'margin-top'
- and 'margin-bottom' on the element. The <code>hspace</code> attribute
- of a <code id=the-marquee-element:the-marquee-element-2-20><a href=#the-marquee-element-2>marquee</a></code> element <a href=#maps-to-the-dimension-property id=the-marquee-element:maps-to-the-dimension-property-3>maps to the
- dimension properties</a> 'margin-left' and 'margin-right' on the element.</p>
- <p>The 'overflow' property on the <code id=the-marquee-element:the-marquee-element-2-21><a href=#the-marquee-element-2>marquee</a></code> element is expected to be ignored; overflow
- is expected to always be hidden.</p>
-
-
- <h4 id=the-meter-element-2>14.5.12 The <code id=the-meter-element-2:the-meter-element><a href=#the-meter-element>meter</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- meter { binding: <i>meter</i>; }</pre>
- <p>When the <i>meter</i> binding applies to a <code id=the-meter-element-2:the-meter-element-2><a href=#the-meter-element>meter</a></code> element, the element is
- expected to render as an 'inline-block' box with a 'height' of '1em' and a 'width' of '5em', a
- 'vertical-align' of '-0.2em', and with its contents depicting a gauge.</p>
- <p>When the element is wider than it is tall (or square), the depiction is expected to be of a
- horizontal gauge, with the minimum value on the right if the 'direction' property on this element
- has a computed value of 'rtl', and on the left otherwise. When the element is taller than it is
- wide, it is expected to depict a vertical gauge, with the minimum value on the bottom.</p>
- <p>User agents are expected to use a presentation consistent with platform conventions for gauges,
- if any.</p>
- <p class=note>Requirements for what must be depicted in the gauge are included in the definition
- of the <code id=the-meter-element-2:the-meter-element-3><a href=#the-meter-element>meter</a></code> element.</p>
-
-
- <h4 id=the-progress-element-2>14.5.13 The <code id=the-progress-element-2:the-progress-element><a href=#the-progress-element>progress</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- progress { binding: <i>progress</i>; }</pre>
- <p>When the <i>progress</i> binding applies to a <code id=the-progress-element-2:the-progress-element-2><a href=#the-progress-element>progress</a></code> element, the
- element is expected to render as an 'inline-block' box with a 'height' of '1em' and a 'width' of
- '10em', and a 'vertical-align' of '-0.2em'.</p>
-
- <p> <img class=extra width=157 src=http://images.whatwg.org/sample-progress.png height=103 alt=""> When the
- element is wider than it is tall, the element is expected to be depicted as a horizontal progress
- bar, with the start on the right and the end on the left if the 'direction' property on this
- element has a computed value of 'rtl', and with the start on the left and the end on the right
- otherwise. When the element is taller than it is wide, it is expected to depicted as a vertical
- progress bar, with the lowest value on the bottom. When the element is square, it is expected to
- be depicted as a direction-independent progress widget (e.g. a circular progress ring).</p>
- <p>User agents are expected to use a presentation consistent with platform conventions for
- progress bars. In particular, user agents are expected to use different presentations for
- determinate and indeterminate progress bars. User agents are also expected to vary the
- presentation based on the dimensions of the element.</p>
- <p class=example>For example, on some platforms for showing indeterminate progress there is an
- asynchronous progress indicator with square dimensions, which could be used when the element is
- square, and an indeterminate progress bar, which could be used when the element is wide.</p>
- <p class=note>Requirements for how to determine if the progress bar is determinate or
- indeterminate, and what progress a determinate progress bar is to show, are included in the
- definition of the <code id=the-progress-element-2:the-progress-element-3><a href=#the-progress-element>progress</a></code> element.</p>
-
-
- <h4 id=the-select-element-2>14.5.14 The <code id=the-select-element-2:the-select-element><a href=#the-select-element>select</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- select { binding: <i>select</i>; }</pre>
- <p>When the <i>select</i> binding applies to a <code id=the-select-element-2:the-select-element-2><a href=#the-select-element>select</a></code> element whose <code id=the-select-element-2:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code> attribute is present, the element is expected to
- render as a multi-select list box.</p>
- <p>When the <i>select</i> binding applies to a <code id=the-select-element-2:the-select-element-3><a href=#the-select-element>select</a></code> element whose <code id=the-select-element-2:attr-select-multiple-2><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the element's <a href=#concept-select-size id=the-select-element-2:concept-select-size>display size</a> is greater than 1, the element is expected to
- render as a single-select list box.</p>
- <p>When the element renders as a list box, it is expected to render as an 'inline-block' box whose
- 'height' is the height necessary to contain as many rows for items as given by the element's <a href=#concept-select-size id=the-select-element-2:concept-select-size-2>display size</a>, or four rows if the attribute is absent, and
- whose 'width' is the <a href="#width-of-the-select's-labels" id="the-select-element-2:width-of-the-select's-labels">width of the <code>select</code>'s labels</a> plus the width of a
- scrollbar.</p>
- <p>When the <i>select</i> binding applies to a <code id=the-select-element-2:the-select-element-4><a href=#the-select-element>select</a></code> element whose <code id=the-select-element-2:attr-select-multiple-3><a href=#attr-select-multiple>multiple</a></code> attribute is absent, and the element's <a href=#concept-select-size id=the-select-element-2:concept-select-size-3>display size</a> is 1, the element is expected to render as a
- one-line drop down box whose width is the <a href="#width-of-the-select's-labels" id="the-select-element-2:width-of-the-select's-labels-2">width of the <code>select</code>'s
- labels</a>.</p>
- <p>In either case (list box or drop-down box), the element's items are expected to be the
- element's <a href=#concept-select-option-list id=the-select-element-2:concept-select-option-list>list of options</a>, with the element's
- <code id=the-select-element-2:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code> element children providing headers for groups of options where
- applicable.</p>
- <p>An <code id=the-select-element-2:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code> element is expected to be rendered by displaying the element's <code id=the-select-element-2:attr-optgroup-label><a href=#attr-optgroup-label>label</a></code> attribute.</p>
- <p>An <code id=the-select-element-2:the-option-element><a href=#the-option-element>option</a></code> element is expected to be rendered by displaying the element's <a href=#concept-option-label id=the-select-element-2:concept-option-label>label</a>, indented under its <code id=the-select-element-2:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code> element if it
- has one.</p>
- <p>The <dfn id="width-of-the-select's-labels">width of the <code>select</code>'s labels</dfn> is the wider of the width necessary to
- render the widest <code id=the-select-element-2:the-optgroup-element-4><a href=#the-optgroup-element>optgroup</a></code>, and the width necessary to render the widest
- <code id=the-select-element-2:the-option-element-2><a href=#the-option-element>option</a></code> element in the element's <a href=#concept-select-option-list id=the-select-element-2:concept-select-option-list-2>list of
- options</a> (including its indent, if any).</p>
- <p>If a <code id=the-select-element-2:the-select-element-5><a href=#the-select-element>select</a></code> element contains a <a href=#placeholder-label-option id=the-select-element-2:placeholder-label-option>placeholder label option</a>, the user
- agent is expected to render that <code id=the-select-element-2:the-option-element-3><a href=#the-option-element>option</a></code> in a manner that conveys that it is a label,
- rather than a valid option of the control. This can include preventing the <a href=#placeholder-label-option id=the-select-element-2:placeholder-label-option-2>placeholder label
- option</a> from being explicitly selected by the user. When the <a href=#placeholder-label-option id=the-select-element-2:placeholder-label-option-3>placeholder label
- option</a>'s <a href=#concept-option-selectedness id=the-select-element-2:concept-option-selectedness>selectedness</a> is true, the control
- is expected to be displayed in a fashion that indicates that no valid option is currently
- selected.</p>
- <p>User agents are expected to render the labels in a <code id=the-select-element-2:the-select-element-6><a href=#the-select-element>select</a></code> in such a manner that
- any alignment remains consistent whether the label is being displayed as part of the page or in a
- menu control.</p>
-
-
- <h4 id=the-textarea-element-2>14.5.15 The <code id=the-textarea-element-2:the-textarea-element><a href=#the-textarea-element>textarea</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- textarea { binding: <i>textarea</i>; white-space: pre-wrap; }</pre>
- <p>When the <i>textarea</i> binding applies to a <code id=the-textarea-element-2:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> element, the
- element is expected to render as an 'inline-block' box rendered as a multiline text field. If this
- text field provides a selection, then, when the user changes the currect selection in such a
- binding, the user agent is expected to <a href=#queue-a-task id=the-textarea-element-2:queue-a-task>queue a task</a> to <a href=#fire-a-simple-event id=the-textarea-element-2:fire-a-simple-event>fire a simple
- event</a> that bubbles named <code id=the-textarea-element-2:event-select><a href=#event-select>select</a></code> at the element, using
- the <a href=#user-interaction-task-source id=the-textarea-element-2:user-interaction-task-source>user interaction task source</a> as the task source.</p>
- <p>If the element has a <code id=the-textarea-element-2:attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code> attribute, and parsing that
- attribute's value using the <a href=#rules-for-parsing-non-negative-integers id=the-textarea-element-2:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> doesn't generate
- an error, then the user agent is expected to use the attribute as a <a href=#presentational-hints id=the-textarea-element-2:presentational-hints>presentational hint</a> for the 'width' property on the element, with the value being
- the <a href=#textarea-effective-width id=the-textarea-element-2:textarea-effective-width>textarea effective width</a> (as defined below). Otherwise, the user agent is
- expected to act as if it had a user-agent-level style sheet rule setting the 'width' property on
- the element to the <a href=#textarea-effective-width id=the-textarea-element-2:textarea-effective-width-2>textarea effective width</a>.</p>
- <p>The <dfn id=textarea-effective-width>textarea effective width</dfn> of a <code id=the-textarea-element-2:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code> element is <span><var>size</var>×<var>avg</var> + <var>sbw</var></span>, where <var>size</var> is the element's <a href=#attr-textarea-cols-value id=the-textarea-element-2:attr-textarea-cols-value>character width</a>, <var>avg</var> is the average
- character width of the primary font of the element, in CSS pixels, and <var>sbw</var> is
- the width of a scroll bar, in CSS pixels. (The element's 'letter-spacing' property does not affect
- the result.)</p>
- <p>If the element has a <code id=the-textarea-element-2:attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code> attribute, and parsing that
- attribute's value using the <a href=#rules-for-parsing-non-negative-integers id=the-textarea-element-2:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> doesn't generate
- an error, then the user agent is expected to use the attribute as a <a href=#presentational-hints id=the-textarea-element-2:presentational-hints-2>presentational hint</a> for the 'height' property on the element, with the value being
- the <a href=#textarea-effective-height id=the-textarea-element-2:textarea-effective-height>textarea effective height</a> (as defined below). Otherwise, the user agent is
- expected to act as if it had a user-agent-level style sheet rule setting the 'height' property on
- the element to the <a href=#textarea-effective-height id=the-textarea-element-2:textarea-effective-height-2>textarea effective height</a>.</p>
- <p>The <dfn id=textarea-effective-height>textarea effective height</dfn> of a <code id=the-textarea-element-2:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code> element is the height in
- CSS pixels of the number of lines specified the element's <a href=#attr-textarea-rows-value id=the-textarea-element-2:attr-textarea-rows-value>character height</a>, plus the height of a scrollbar in CSS
- pixels.</p>
- <p>User agents are expected to apply the 'white-space' CSS property to <code id=the-textarea-element-2:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code>
- elements. For historical reasons, if the element has a <code id=the-textarea-element-2:attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code> attribute whose value is an <a href=#ascii-case-insensitive id=the-textarea-element-2:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the string "<code>off</code>", then the user agent is expected to treat the attribute as a <a href=#presentational-hints id=the-textarea-element-2:presentational-hints-3>presentational hint</a> setting the element's 'white-space'
- property to 'pre'.</p>
-
-
- <h4 id=the-keygen-element-2>14.5.16 The <code id=the-keygen-element-2:the-keygen-element><a href=#the-keygen-element>keygen</a></code> element</h4>
- <pre class=css>@namespace url(http://www.w3.org/1999/xhtml);
- keygen { binding: <i>keygen</i>; }</pre>
- <p>When the <i>keygen</i> binding applies to a <code id=the-keygen-element-2:the-keygen-element-2><a href=#the-keygen-element>keygen</a></code> element, the element
- is expected to render as an 'inline-block' box containing a user interface to configure the key
- pair to be generated.</p>
-
-
- <h3 id=frames-and-framesets>14.6 Frames and framesets</h3>
- <p>User agent are expected to render <code id=frames-and-framesets:frameset><a href=#frameset>frameset</a></code> elements as a box with the height and
- width of the viewport, with a surface rendered according to the following layout algorithm:</p>
- <ol><li>
- <p>The <var>cols</var> and <var>rows</var> variables are lists of zero or more pairs consisting
- of a number and a unit, the unit being one of <i>percentage</i>, <i>relative</i>, and
- <i>absolute</i>.</p>
- <p>Use the <a href=#rules-for-parsing-a-list-of-dimensions id=frames-and-framesets:rules-for-parsing-a-list-of-dimensions>rules for parsing a list of dimensions</a> to parse the value of the
- element's <code>cols</code> attribute, if there is one.
- Let <var>cols</var> be the result, or an empty list if there is no such attribute.</p>
- <p>Use the <a href=#rules-for-parsing-a-list-of-dimensions id=frames-and-framesets:rules-for-parsing-a-list-of-dimensions-2>rules for parsing a list of dimensions</a> to parse the value of the
- element's <code>rows</code> attribute, if there is one.
- Let <var>rows</var> be the result, or an empty list if there is no such attribute.</p>
- <li>
- <p>For any of the entries in <var>cols</var> or <var>rows</var> that have the number zero and
- the unit <i>relative</i>, change the entry's number to one.</p>
- <li>
- <p>If <var>cols</var> has no entries, then add a single entry consisting of the value 1 and the
- unit <i>relative</i> to <var>cols</var>.</p>
- <p>If <var>rows</var> has no entries, then add a single entry consisting of the value 1 and the
- unit <i>relative</i> to <var>rows</var>.</p>
- <li>
- <p>Invoke the algorithm defined below to <a href=#convert-a-list-of-dimensions-to-a-list-of-pixel-values id=frames-and-framesets:convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of pixel
- values</a> using <var>cols</var> as the input list, and the width of the surface that the
- <code id=frames-and-framesets:frameset-2><a href=#frameset>frameset</a></code> is being rendered into, in CSS pixels, as the input dimension. Let
- <var>sized cols</var> be the resulting list.</p>
- <p>Invoke the algorithm defined below to <a href=#convert-a-list-of-dimensions-to-a-list-of-pixel-values id=frames-and-framesets:convert-a-list-of-dimensions-to-a-list-of-pixel-values-2>convert a list of dimensions to a list of pixel
- values</a> using <var>rows</var> as the input list, and the height of the surface that the
- <code id=frames-and-framesets:frameset-3><a href=#frameset>frameset</a></code> is being rendered into, in CSS pixels, as the input dimension. Let
- <var>sized rows</var> be the resulting list.</p>
- <li>
- <p>Split the surface into a grid of <span><var>w</var>×<var>h</var></span>
- rectangles, where <var>w</var> is the number of entries in <var>sized cols</var> and
- <var>h</var> is the number of entries in <var>sized rows</var>.</p>
- <p>Size the columns so that each column in the grid is as many CSS pixels wide as the
- corresponding entry in the <var>sized cols</var> list.</p>
- <p>Size the rows so that each row in the grid is as many CSS pixels high as the corresponding
- entry in the <var>sized rows</var> list.</p>
- <li>
- <p>Let <var>children</var> be the list of <code id=frames-and-framesets:frame><a href=#frame>frame</a></code> and <code id=frames-and-framesets:frameset-4><a href=#frameset>frameset</a></code> elements
- that are children of the <code id=frames-and-framesets:frameset-5><a href=#frameset>frameset</a></code> element for which the algorithm was invoked.</p>
- <li>
- <p>For each row of the grid of rectangles created in the previous step, from top to bottom, run
- these substeps:</p>
- <ol><li>
- <p>For each rectangle in the row, from left to right, run these substeps:</p>
- <ol><li>
- <p>If there are any elements left in <var>children</var>, take the first element in the
- list, and assign it to the rectangle.</p>
- <p>If this is a <code id=frames-and-framesets:frameset-6><a href=#frameset>frameset</a></code> element, then recurse the entire <code id=frames-and-framesets:frameset-7><a href=#frameset>frameset</a></code>
- layout algorithm for that <code id=frames-and-framesets:frameset-8><a href=#frameset>frameset</a></code> element, with the rectangle as the
- surface.</p>
- <p>Otherwise, it is a <code id=frames-and-framesets:frame-2><a href=#frame>frame</a></code> element; render its <a href=#nested-browsing-context id=frames-and-framesets:nested-browsing-context>nested browsing
- context</a>, positoned and sized to fit the rectangle.</p>
- <li>
- <p>If there are any elements left in <var>children</var>, remove the first element from
- <var>children</var>.</p>
- </ol>
- </ol>
- <li>
- <p>If the <code id=frames-and-framesets:frameset-9><a href=#frameset>frameset</a></code> element <a href=#has-a-border id=frames-and-framesets:has-a-border>has a border</a>, draw an outer set of borders
- around the rectangles, using the element's <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour>frame border colour</a>.</p>
- <p>For each rectangle, if there is an element assigned to that rectangle, and that element
- <a href=#has-a-border id=frames-and-framesets:has-a-border-2>has a border</a>, draw an inner set of borders around that rectangle, using the
- element's <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour-2>frame border colour</a>.</p>
- <p>For each (visible) border that does not abut a rectangle that is assigned a
- <code id=frames-and-framesets:frame-3><a href=#frame>frame</a></code> element with a <code>noresize</code>
- attribute (including rectangles in further nested <code id=frames-and-framesets:frameset-10><a href=#frameset>frameset</a></code> elements), the user
- agent is expected to allow the user to move the border, resizing the rectangles within, keeping
- the proportions of any nested <code id=frames-and-framesets:frameset-11><a href=#frameset>frameset</a></code> grids.</p>
- <p>A <code id=frames-and-framesets:frameset-12><a href=#frameset>frameset</a></code> or <code id=frames-and-framesets:frame-4><a href=#frame>frame</a></code> element <dfn id=has-a-border>has a border</dfn> if the
- following algorithm returns true:</p>
- <ol><li><p>If the element has a <code>frameborder</code> attribute whose value is not the
- empty string and whose first character is either a U+0031 DIGIT ONE (1) character, a U+0079
- LATIN SMALL LETTER Y character (y), or a U+0059 LATIN CAPITAL LETTER Y character (Y), then
- return true.<li><p>Otherwise, if the element has a <code>frameborder</code> attribute, return
- false.<li><p>Otherwise, if the element has a parent element that is a <code id=frames-and-framesets:frameset-13><a href=#frameset>frameset</a></code> element,
- then return true if <em>that</em> element <a href=#has-a-border id=frames-and-framesets:has-a-border-3>has a border</a>, and false if it does
- not.<li><p>Otherwise, return true.</ol>
- <p>The <dfn id=frame-border-colour>frame border colour</dfn> of a <code id=frames-and-framesets:frameset-14><a href=#frameset>frameset</a></code> or <code id=frames-and-framesets:frame-5><a href=#frame>frame</a></code> element
- is the colour obtained from the following algorithm:</p>
- <ol><li><p>If the element has a <code>bordercolor</code> attribute, and applying the
- <a href=#rules-for-parsing-a-legacy-colour-value id=frames-and-framesets:rules-for-parsing-a-legacy-colour-value>rules for parsing a legacy colour value</a> to that attribute's value does not result
- in an error, then return the colour so obtained.<li><p>Otherwise, if the element has a parent element that is a <code id=frames-and-framesets:frameset-15><a href=#frameset>frameset</a></code> element,
- then return the <a href=#frame-border-colour id=frames-and-framesets:frame-border-colour-3>frame border colour</a> of that element.</p>
- <li><p>Otherwise, return gray.</ol>
- </ol>
- <p>The algorithm to <dfn id=convert-a-list-of-dimensions-to-a-list-of-pixel-values>convert a list of dimensions to a list of pixel values</dfn> consists of
- the following steps:</p>
- <ol><li>
- <p>Let <var>input list</var> be the list of numbers and units passed to the algorithm.</p>
- <p>Let <var>output list</var> be a list of numbers the same length as <var>input list</var>, all
- zero.</p>
- <p>Entries in <var>output list</var> correspond to the entries in <var>input list</var> that
- have the same position.</p>
- <li><p>Let <var>input dimension</var> be the size passed to the algorithm.</p>
- <li>
- <p>Let <var>count percentage</var> be the number of entries in <var>input list</var> whose unit
- is <i>percentage</i>.</p>
- <p>Let <var>total percentage</var> be the sum of all the numbers in <var>input list</var> whose
- unit is <i>percentage</i>.</p>
- <p>Let <var>count relative</var> be the number of entries in <var>input list</var> whose unit is
- <i>relative</i>.</p>
- <p>Let <var>total relative</var> be the sum of all the numbers in <var>input list</var> whose
- unit is <i>relative</i>.</p>
- <p>Let <var>count absolute</var> be the number of entries in <var>input list</var> whose unit is
- <i>absolute</i>.</p>
- <p>Let <var>total absolute</var> be the sum of all the numbers in <var>input list</var> whose
- unit is <i>absolute</i>.</p>
- <p>Let <var>remaining space</var> be the value of <var>input dimension</var>.</p>
- <li>
- <p>If <var>total absolute</var> is greater than <var>remaining space</var>, then for each entry
- in <var>input list</var> whose unit is <i>absolute</i>, set the corresponding value in
- <var>output list</var> to the number of the entry in <var>input list</var> multiplied by
- <var>remaining space</var> and divided by <var>total absolute</var>. Then, set <var>remaining
- space</var> to zero.</p>
- <p>Otherwise, for each entry in <var>input list</var> whose unit is <i>absolute</i>, set the
- corresponding value in <var>output list</var> to the number of the entry in <var>input
- list</var>. Then, decrement <var>remaining space</var> by <var>total absolute</var>.</p>
- <li>
- <p>If <var>total percentage</var> multiplied by the <var>input dimension</var> and divided by
- 100 is greater than <var>remaining space</var>, then for each entry in <var>input list</var>
- whose unit is <i>percentage</i>, set the corresponding value in <var>output list</var> to the
- number of the entry in <var>input list</var> multiplied by <var>remaining space</var> and
- divided by <var>total percentage</var>. Then, set <var>remaining space</var> to zero.</p>
- <p>Otherwise, for each entry in <var>input list</var> whose unit is <i>percentage</i>, set the
- corresponding value in <var>output list</var> to the number of the entry in <var>input
- list</var> multiplied by the <var>input dimension</var> and divided by 100. Then, decrement
- <var>remaining space</var> by <var>total percentage</var> multiplied by the <var>input
- dimension</var> and divided by 100.</p>
- <li>
- <p>For each entry in <var>input list</var> whose unit is <i>relative</i>, set the corresponding
- value in <var>output list</var> to the number of the entry in <var>input list</var> multiplied
- by <var>remaining space</var> and divided by <var>total relative</var>.</p>
- <li><p>Return <var>output list</var>.</ol>
- <p>User agents working with integer values for frame widths (as opposed to user agents that can
- lay frames out with subpixel accuracy) are expected to distribute the remainder first to the last
- entry whose unit is <i>relative</i>, then equally (not proportionally) to each entry whose unit is
- <i>percentage</i>, then equally (not proportionally) to each entry whose unit is <i>absolute</i>,
- and finally, failing all else, to the last entry.</p>
- <hr>
- <p>The contents of a <code id=frames-and-framesets:frame-6><a href=#frame>frame</a></code> element that does not have a <code id=frames-and-framesets:frameset-16><a href=#frameset>frameset</a></code> parent
- are expected to be rendered as transparent black; the user agent is expected to not render the
- <a href=#nested-browsing-context id=frames-and-framesets:nested-browsing-context-2>nested browsing context</a> in this case, and that <a href=#nested-browsing-context id=frames-and-framesets:nested-browsing-context-3>nested browsing context</a>
- is expected to have a viewport with zero width and zero height.</p>
-
-
- <h3 id=interactive-media>14.7 Interactive media</h3>
- <h4 id=links,-forms,-and-navigation>14.7.1 Links, forms, and navigation</h4>
- <p>User agents are expected to allow the user to control aspects of <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink>hyperlink</a>
- activation and <a href=#form-submission-2 id=links,-forms,-and-navigation:form-submission-2>form submission</a>, such as which <a href=#browsing-context id=links,-forms,-and-navigation:browsing-context>browsing context</a> is to be
- used for the subsequent <a href=#navigate id=links,-forms,-and-navigation:navigate>navigation</a>.</p>
- <p>User agents are expected to allow users to discover the destination of <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink-2>hyperlinks</a> and of <a href=#the-form-element id=links,-forms,-and-navigation:the-form-element>forms</a> before triggering their
- <a href=#navigate id=links,-forms,-and-navigation:navigate-2>navigation</a>.</p>
- <p>User agents are expected to inform the user of whether a <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink-3>hyperlink</a> includes
- <a href=#hyperlink-auditing id=links,-forms,-and-navigation:hyperlink-auditing>hyperlink auditing</a>, and to let them know at a minimum which domains will be contacted
- as part of such auditing.</p>
- <p>User agents may allow users to <a href=#navigate id=links,-forms,-and-navigation:navigate-3>navigate</a> <a href=#browsing-context id=links,-forms,-and-navigation:browsing-context-2>browsing contexts</a> to the resources <a href=#resolve-a-url id=links,-forms,-and-navigation:resolve-a-url>indicated</a> by
- the <code>cite</code> attributes on <code id=links,-forms,-and-navigation:the-q-element><a href=#the-q-element>q</a></code>, <code id=links,-forms,-and-navigation:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>,
- <code id=links,-forms,-and-navigation:the-ins-element><a href=#the-ins-element>ins</a></code>, and <code id=links,-forms,-and-navigation:the-del-element><a href=#the-del-element>del</a></code> elements.</p>
- <p>User agents may surface <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink-4>hyperlinks</a> created by <code id=links,-forms,-and-navigation:the-link-element><a href=#the-link-element>link</a></code>
- elements in their user interface.</p>
- <p class=note>While <code id=links,-forms,-and-navigation:the-link-element-2><a href=#the-link-element>link</a></code> elements that create <a href=#hyperlink id=links,-forms,-and-navigation:hyperlink-5>hyperlinks</a> will match the ':link' or ':visited' pseudo-classes, will
- react to clicks if visible, and so forth, this does not extend to any browser interface constructs
- that expose those same links. Activating a link through the browser's interface, rather than in
- the page itself, does not trigger <code id=links,-forms,-and-navigation:event-click><a href=#event-click>click</a></code> events and the like.</p>
- <h4 id=the-title-attribute-2>14.7.2 The <code id=the-title-attribute-2:attr-title><a href=#attr-title>title</a></code> attribute</h4>
- <p>User agents are expected to expose the <a href=#advisory-information id=the-title-attribute-2:advisory-information>advisory information</a> of elements upon user
- request, and to make the user aware of the presence of such information.</p>
- <p>On interactive graphical systems where the user can use a pointing device, this could take the
- form of a tooltip. When the user is unable to use a pointing device, then the user agent is
- expected to make the content available in some other fashion, e.g. by making the element a
- <i>focusable area</i> and always displaying the <a href=#advisory-information id=the-title-attribute-2:advisory-information-2>advisory information</a> of the currently
- <a href=#focused id=the-title-attribute-2:focused>focused</a> element, or by showing the <a href=#advisory-information id=the-title-attribute-2:advisory-information-3>advisory information</a> of the elements
- under the user's finger on a touch device as the user pans around the screen.</p>
- <p>U+000A LINE FEED (LF) characters are expected to cause line breaks in the tooltip; U+0009
- CHARACTER TABULATION (tab) characters are expected to render as a non-zero horizontal shift that
- lines up the next glyph with the next tab stop, with tab stops occurring at points that are
- multiples of 8 times the width of a U+0020 SPACE character.</p>
- <div class=example>
- <p>For example, a visual user agent could make elements with a <code id=the-title-attribute-2:attr-title-2><a href=#attr-title>title</a></code> attribute <a href=#focusable-area id=the-title-attribute-2:focusable-area>focusable</a>, and could make any <a href=#focused id=the-title-attribute-2:focused-2>focused</a> element with a
- <code id=the-title-attribute-2:attr-title-3><a href=#attr-title>title</a></code> attribute show its tooltip under the element while the
- element has focus. This would allow a user to tab around the document to find all the advisory
- text.</p>
- </div>
- <div class=example>
- <p>As another example, a screen reader could provide an audio cue when reading an element with a
- tooltip, with an associated key to read the last tooltip for which a cue was played.</p>
- </div>
- <h4 id=editing-hosts>14.7.3 Editing hosts</h4>
- <p>The current text editing caret (i.e. the <a href=#active-range id=editing-hosts:active-range>active range</a>, if it is empty and in an
- <a href=#editing-host id=editing-hosts:editing-host>editing host</a>), if any, is expected to act like an inline replaced element with the
- vertical dimensions of the caret and with zero width for the purposes of the CSS rendering
- model.</p>
- <p class=note>This means that even an empty block can have the caret inside it, and that when
- the caret is in such an element, it prevents margins from collapsing through the element.</p>
- <h4 id=text-rendered-in-native-user-interfaces>14.7.4 Text rendered in native user interfaces</h4>
- <p>User agents are expected to honor the Unicode semantics of text that is exposed in user
- interfaces, for example supporting the bidirectional algorithm in text shown in dialogs, title
- bars, pop-up menus, and tooltips. Text from the contents of elements is expected to be rendered in
- a manner that honors <a href=#the-directionality id=text-rendered-in-native-user-interfaces:the-directionality>the directionality</a> of the element from which the text was
- obtained. Text from attributes is expected to be rendered in a manner that honours the
- <a href=#directionality-of-the-attribute id=text-rendered-in-native-user-interfaces:directionality-of-the-attribute>directionality of the attribute</a>.</p>
- <div class=example>
- <p>Consider the following markup, which has Hebrew text asking for a programming language, the
- languages being text for which a left-to-right direction is important given the punctuation in
- some of their names:</p>
- <pre><p dir="rtl" lang="he">
- <label>
- <span dir=rtl lang=he>בחר שפת תכנות:</span>
- <select>
- <option dir="ltr">C++</option>
- <option dir="ltr">C#</option>
- <option dir="ltr">FreePascal</option>
- <option dir="ltr">F#</option>
- </select>
- </label>
- </p></pre>
- <p>If the <code id=text-rendered-in-native-user-interfaces:the-select-element><a href=#the-select-element>select</a></code> element was rendered as a drop down box, a correct rendering would
- ensure that the punctuation was the same both in the drop down, and in the box showing the
- current selection.</p>
- <p><img src=http://images.whatwg.org/bidiselect.png width=206 alt="" height=105></p>
- </div>
- <div class=example>
- <p>The directionality of attributes depends on the attribute and on the element's <code id=text-rendered-in-native-user-interfaces:the-dir-attribute><a href=#the-dir-attribute>dir</a></code> attribute, as the following example demonstrates. Consider this
- markup:</p>
- <pre><bdo dir=ltr><table>
- <tr>
- <th abbr="(א" dir=ltr>A
- <th abbr="(א" dir=rtl>A
- <th abbr="(א" dir=auto>A
- </table></bdo></pre>
- <p>If the <code id=text-rendered-in-native-user-interfaces:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> attributes are rendered, e.g. in a tooltip or
- other user interface, the first will have a left parenthesis (because the direction is 'ltr'),
- the second will have a right parenthesis (because the direction is 'rtl'), and the third will
- have a right parenthesis (because the direction is determined <em>from the attribute value</em>
- to be 'rtl').</p>
- <p>However, if instead the attribute was not a <a href=#directionality-capable-attribute id=text-rendered-in-native-user-interfaces:directionality-capable-attribute>directionality-capable attribute</a>, the
- results would be different:</p>
- <pre><bdo dir=ltr><table>
- <tr>
- <th data-abbr="(א" dir=ltr>A
- <th data-abbr="(א" dir=rtl>A
- <th data-abbr="(א" dir=auto>A
- </table></bdo></pre>
- <p>In this case, if the user agent were to expose the <code>data-abbr</code> attribute
- in the user interface (e.g. in a debugging environment), the last case would be rendered with a
- <em>left</em> parenthesis, because the direction would be determined from the element's
- contents.</p>
- </div>
- <p>A string provided by a script (e.g. the argument to <code id=text-rendered-in-native-user-interfaces:dom-alert><a href=#dom-alert>window.alert()</a></code>) is expected to be treated as an independent set of one or
- more bidirectional algorithm paragraphs when displayed, as defined by the bidirectional algorithm,
- including, for instance, supporting the paragraph-breaking behaviour of U+000A LINE FEED (LF)
- characters. For the purposes of determining the paragraph level of such text in the bidirectional
- algorithm, this specification does <em>not</em> provide a higher-level override of rules P2 and
- P3. <a href=#refsBIDI>[BIDI]</a></p>
- <p>When necessary, authors can enforce a particular direction for a given paragraph by starting it
- with the Unicode U+200E LEFT-TO-RIGHT MARK or U+200F RIGHT-TO-LEFT MARK characters.</p>
- <div class=example>
- <p>Thus, the following script:</p>
- <pre>alert('\u05DC\u05DE\u05D3 HTML \u05D4\u05D9\u05D5\u05DD!')</pre>
- <p>...would always result in a message reading
- "<bdo dir=rtl lang="">למד LMTH היום!</bdo>"
- (not "<bdo dir=ltr lang="">דמל HTML םויה!</bdo>"),
- regardless of the language of the user agent interface or the
- direction of the page or any of its elements.</p>
- </div>
- <div class=example>
- <p>For a more complex example, consider the following script:</p>
- <pre class=bad>/* Warning: this script does not handle right-to-left scripts correctly */
- var s;
- if (s = prompt('What is your name?')) {
- alert(s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
- }</pre>
- <p>When the user enters "<kbd>Kitty</kbd>", the user agent would alert "<samp>Kitty! Ok, Fred,
- Kitty, and Wilma will get the car.</samp>". However, if the user enters "<kbd dir=rtl lang=ar>لا أفهم</kbd>", then the bidirectional
- algorithm will determine that the direction of the paragraph is right-to-left, and so the output
- will be the following unintended mess: "<samp lang=""><bdo dir=rtl>لا أفهم! derF ,kO, لا أفهم, rac eht teg lliw amliW dna.</bdo></samp>"</p>
- <p>To force an alert that starts with user-provided text (or other text of unknown
- directionality) to render left-to-right, the string can be prefixed with a U+200E LEFT-TO-RIGHT
- MARK character:</p>
- <pre>var s;
- if (s = prompt('What is your name?')) {
- alert('<strong>\u200E</strong>' + s + '! Ok, Fred, ' + s + ', and Wilma will get the car.');
- }</pre>
- </div>
- <h3 id=print-media>14.8 Print media</h3>
- <p>User agents are expected to allow the user to request the opportunity to <dfn id=obtain-a-physical-form>obtain a physical
- form</dfn> (or a representation of a physical form) of a <code id=print-media:document><a href=#document>Document</a></code>. For example,
- selecting the option to print a page or convert it to PDF format. <a href=#refsPDF>[PDF]</a></p>
- <p>When the user actually <a href=#obtain-a-physical-form id=print-media:obtain-a-physical-form>obtains a physical form</a> (or
- a representation of a physical form) of a <code id=print-media:document-2><a href=#document>Document</a></code>, the user agent is expected to
- create a new rendering of the <code id=print-media:document-3><a href=#document>Document</a></code> for the print media.</p>
- <h3 id=unstyled-xml-documents>14.9 Unstyled XML documents</h3>
-
- <p>HTML user agents may, in certain circumstances, find themselves rendering non-HTML documents
- that use vocabularies for which they lack any built-in knowledge. This section provides for a way
- for user agents to handle such documents in a somewhat useful manner.</p>
- <p>While a <code id=unstyled-xml-documents:document><a href=#document>Document</a></code> is an <a href=#unstyled-document id=unstyled-xml-documents:unstyled-document>unstyled document</a>, the user agent is expected
- to render <a href=#an-unstyled-document-view id=unstyled-xml-documents:an-unstyled-document-view>an unstyled document view</a>.</p>
- <p>A <code id=unstyled-xml-documents:document-2><a href=#document>Document</a></code> is an <dfn id=unstyled-document>unstyled document</dfn> while it matches the following
- conditions:</p>
- <ul><li>The <code id=unstyled-xml-documents:document-3><a href=#document>Document</a></code> has no author style sheets (whether referenced by HTTP headers, processing instructions, elements like <code id=unstyled-xml-documents:the-link-element><a href=#the-link-element>link</a></code>, inline elements like <code id=unstyled-xml-documents:the-style-element><a href=#the-style-element>style</a></code>, or any other mechanism).
- <li>None of the elements in the <code id=unstyled-xml-documents:document-4><a href=#document>Document</a></code> have any <a href=#presentational-hints id=unstyled-xml-documents:presentational-hints>presentational hints</a>.
- <li>None of the elements in the <code id=unstyled-xml-documents:document-5><a href=#document>Document</a></code> have any <a href=#css-styling-attribute id=unstyled-xml-documents:css-styling-attribute>CSS styling attributes</a>.
- <li>None of the elements in the <code id=unstyled-xml-documents:document-6><a href=#document>Document</a></code> are in any of the following namespaces: <a href=#html-namespace-2 id=unstyled-xml-documents:html-namespace-2>HTML namespace</a>, <a href=#svg-namespace id=unstyled-xml-documents:svg-namespace>SVG namespace</a>, <a href=#mathml-namespace id=unstyled-xml-documents:mathml-namespace>MathML namespace</a>
- <li>The <code id=unstyled-xml-documents:document-7><a href=#document>Document</a></code> has no <i>focusable area</i> (e.g. from XLink) other than the viewport.
- <li>The <code id=unstyled-xml-documents:document-8><a href=#document>Document</a></code> has no <a href=#hyperlink id=unstyled-xml-documents:hyperlink>hyperlinks</a> (e.g. from XLink).
- <li>There exists no <a href=#concept-script id=unstyled-xml-documents:concept-script>script</a> whose <a href=#settings-object id=unstyled-xml-documents:settings-object>settings object</a> specifies this <code id=unstyled-xml-documents:document-9><a href=#document>Document</a></code> as the <a href=#responsible-document id=unstyled-xml-documents:responsible-document>responsible document</a>.
- <li>None of the elements in the <code id=unstyled-xml-documents:document-10><a href=#document>Document</a></code> have any registered event listeners.
- </ul>
- <p><dfn id=an-unstyled-document-view>An unstyled document view</dfn> is one where the DOM is not rendered according to CSS
- (which would, since there are no applicable styles in this context, just result in a wall of
- text), but is instead rendered in a manner that is useful for a developer. This could consist of
- just showing the <code id=unstyled-xml-documents:document-11><a href=#document>Document</a></code> object's source, maybe with syntax highlighting, or it
- could consist of displaying just the DOM tree, or simply a message saying that the page is not a
- styled document.</p>
- <p class=note>If a <code id=unstyled-xml-documents:document-12><a href=#document>Document</a></code> stops being an <a href=#unstyled-document id=unstyled-xml-documents:unstyled-document-2>unstyled document</a>, then the
- conditions above stop applying, and thus a user agent following these requirements will switch to
- using the regular CSS rendering.</p>
-
- <h2 id=obsolete>15 Obsolete features</h2>
- <h3 id=obsolete-but-conforming-features>15.1 Obsolete but conforming features</h3>
- <p>Features listed in this section will trigger warnings in conformance checkers.</p>
- <p>Authors should not specify a <code id=obsolete-but-conforming-features:attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
- <code id=obsolete-but-conforming-features:the-img-element><a href=#the-img-element>img</a></code> element. If the attribute is present, its value must be the string "<code>0</code>". CSS should be used instead.</p>
- <p>Authors should not specify a <code id=obsolete-but-conforming-features:attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
- <code id=obsolete-but-conforming-features:the-script-element><a href=#the-script-element>script</a></code> element. If the attribute is present, its value must be an <a href=#ascii-case-insensitive id=obsolete-but-conforming-features:ascii-case-insensitive>ASCII
- case-insensitive</a> match for the string "<code>JavaScript</code>" and either the
- <code id=obsolete-but-conforming-features:attr-script-type><a href=#attr-script-type>type</a></code> attribute must be omitted or its value must be an
- <a href=#ascii-case-insensitive id=obsolete-but-conforming-features:ascii-case-insensitive-2>ASCII case-insensitive</a> match for the string "<code>text/javascript</code>".
- The attribute should be entirely omitted instead (with the value "<code>JavaScript</code>", it has no effect), or replaced with use of the <code id=obsolete-but-conforming-features:attr-script-type-2><a href=#attr-script-type>type</a></code> attribute.</p>
- <p>Authors should not specify the <code id=obsolete-but-conforming-features:attr-a-name><a href=#attr-a-name>name</a></code> attribute on
- <code id=obsolete-but-conforming-features:the-a-element><a href=#the-a-element>a</a></code> elements. If the attribute is present, its value must not be the empty string and
- must neither be equal to the value of any of the <a href=#concept-id id=obsolete-but-conforming-features:concept-id>IDs</a> in the
- element's <a href=#home-subtree id=obsolete-but-conforming-features:home-subtree>home subtree</a> other than the element's own <a href=#concept-id id=obsolete-but-conforming-features:concept-id-2>ID</a>, if any, nor be equal to the value of any of the other <code id=obsolete-but-conforming-features:attr-a-name-2><a href=#attr-a-name>name</a></code> attributes on <code id=obsolete-but-conforming-features:the-a-element-2><a href=#the-a-element>a</a></code> elements in the element's <a href=#home-subtree id=obsolete-but-conforming-features:home-subtree-2>home
- subtree</a>. If this attribute is present and the element has an <a href=#concept-id id=obsolete-but-conforming-features:concept-id-3>ID</a>, then the attribute's value must be equal to the element's <a href=#concept-id id=obsolete-but-conforming-features:concept-id-4>ID</a>. In earlier versions of the language, this attribute was intended as
- a way to specify possible targets for fragment identifiers in <a href=#url id=obsolete-but-conforming-features:url>URLs</a>. The
- <code id=obsolete-but-conforming-features:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute should be used instead.</p>
-
- <p>Authors should not, but may despite requirements to the contrary elsewhere in this
- specification, specify the <code id=obsolete-but-conforming-features:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> and <code id=obsolete-but-conforming-features:attr-input-size><a href=#attr-input-size>size</a></code> attributes on <code id=obsolete-but-conforming-features:the-input-element><a href=#the-input-element>input</a></code> elements whose <code id=obsolete-but-conforming-features:attr-input-type><a href=#attr-input-type>type</a></code> attributes are in the <a href="#number-state-(type=number)" id="obsolete-but-conforming-features:number-state-(type=number)">Number</a> state. One valid reason for using these attributes
- regardless is to help legacy user agents that do not support <code id=obsolete-but-conforming-features:the-input-element-2><a href=#the-input-element>input</a></code> elements with
- <code>type="number"</code> to still render the text field with a useful width.</p>
- <p class=note>In <a href=#syntax id=obsolete-but-conforming-features:syntax>the HTML syntax</a>, specifying a <a href=#syntax-doctype id=obsolete-but-conforming-features:syntax-doctype>DOCTYPE</a> that is an <a href=#obsolete-permitted-doctype id=obsolete-but-conforming-features:obsolete-permitted-doctype>obsolete permitted DOCTYPE</a> will also
- trigger a warning.</p>
-
- <h4 id=warnings-for-obsolete-but-conforming-features>15.1.1 Warnings for obsolete but conforming features</h4>
- <p>To ease the transition from HTML4 Transitional documents to the language defined in
- <em>this</em> specification, and to discourage certain features that are only allowed in very few
- circumstances, conformance checkers must warn the user when the following features are used in a
- document. These are generally old obsolete features that have no effect, and are allowed only to
- distinguish between likely mistakes (regular conformance errors) and mere vestigial markup or
- unusual and discouraged practices (these warnings).</p>
- <p>The following features must be categorised as described
- above:</p>
- <ul><li><p>The presence of an <a href=#obsolete-permitted-doctype id=warnings-for-obsolete-but-conforming-features:obsolete-permitted-doctype>obsolete permitted DOCTYPE</a> in an <a href=#html-documents id=warnings-for-obsolete-but-conforming-features:html-documents>HTML document</a>.<li><p>The presence of a <code id=warnings-for-obsolete-but-conforming-features:attr-img-border><a href=#attr-img-border>border</a></code> attribute on an
- <code id=warnings-for-obsolete-but-conforming-features:the-img-element><a href=#the-img-element>img</a></code> element if its value is the string "<code>0</code>".<li><p>The presence of a <code id=warnings-for-obsolete-but-conforming-features:attr-script-language><a href=#attr-script-language>language</a></code> attribute on a
- <code id=warnings-for-obsolete-but-conforming-features:the-script-element><a href=#the-script-element>script</a></code> element if its value is an <a href=#ascii-case-insensitive id=warnings-for-obsolete-but-conforming-features:ascii-case-insensitive>ASCII case-insensitive</a> match for the
- string "<code>JavaScript</code>" and if there is no <code id=warnings-for-obsolete-but-conforming-features:attr-script-type><a href=#attr-script-type>type</a></code> attribute or there is and its value is an <a href=#ascii-case-insensitive id=warnings-for-obsolete-but-conforming-features:ascii-case-insensitive-2>ASCII
- case-insensitive</a> match for the string "<code>text/javascript</code>".<li><p>The presence of a <code id=warnings-for-obsolete-but-conforming-features:attr-a-name><a href=#attr-a-name>name</a></code> attribute on an <code id=warnings-for-obsolete-but-conforming-features:the-a-element><a href=#the-a-element>a</a></code>
- element, if its value is not the empty string.<li><p>The presence of a <code id=warnings-for-obsolete-but-conforming-features:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code> attribute on an
- <code id=warnings-for-obsolete-but-conforming-features:the-input-element><a href=#the-input-element>input</a></code> element whose <code id=warnings-for-obsolete-but-conforming-features:attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the
- <a href="#number-state-(type=number)" id="warnings-for-obsolete-but-conforming-features:number-state-(type=number)">Number</a> state.<li><p>The presence of a <code id=warnings-for-obsolete-but-conforming-features:attr-input-size><a href=#attr-input-size>size</a></code> attribute on an
- <code id=warnings-for-obsolete-but-conforming-features:the-input-element-2><a href=#the-input-element>input</a></code> element whose <code id=warnings-for-obsolete-but-conforming-features:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is in the
- <a href="#number-state-(type=number)" id="warnings-for-obsolete-but-conforming-features:number-state-(type=number)-2">Number</a> state.</ul>
- <p>Conformance checkers must distinguish between pages that have no conformance errors and have
- none of these obsolete features, and pages that have no conformance errors but do have some of
- these obsolete features.</p>
- <p class=example>For example, a validator could report some pages as "Valid HTML" and others as
- "Valid HTML with warnings".</p>
-
- <h3 id=non-conforming-features>15.2 Non-conforming features</h3>
- <p>Elements in the following list are entirely obsolete, and must not be used by authors:</p>
- <dl><dt><code id=non-conforming-features:the-applet-element><a href=#the-applet-element>applet</a></code><dd><p>Use <code id=non-conforming-features:the-embed-element><a href=#the-embed-element>embed</a></code> or <code id=non-conforming-features:the-object-element><a href=#the-object-element>object</a></code> instead.<dt><dfn id=acronym><code>acronym</code></dfn><dd><p>Use <code id=non-conforming-features:the-abbr-element><a href=#the-abbr-element>abbr</a></code> instead.<dt><dfn id=bgsound><code>bgsound</code></dfn><dd><p>Use <code id=non-conforming-features:the-audio-element><a href=#the-audio-element>audio</a></code> instead.<dt><dfn id=dir><code>dir</code></dfn><dd><p>Use <code id=non-conforming-features:the-ul-element><a href=#the-ul-element>ul</a></code> instead.<dt><code id=non-conforming-features:frame><a href=#frame>frame</a></code><dt><code id=non-conforming-features:frameset><a href=#frameset>frameset</a></code><dt><dfn id=noframes><code>noframes</code></dfn><dd><p>Either use <code id=non-conforming-features:the-iframe-element><a href=#the-iframe-element>iframe</a></code> and CSS instead, or use server-side includes to generate complete pages with the various invariant parts merged in.<dt><dfn id=isindex-2><code>isindex</code></dfn><dd><p>Use an explicit <code id=non-conforming-features:the-form-element><a href=#the-form-element>form</a></code> and <a href="#text-(type=text)-state-and-search-state-(type=search)" id="non-conforming-features:text-(type=text)-state-and-search-state-(type=search)">text field</a> combination instead.<dt><dfn id=listing><code>listing</code></dfn><dd><p>Use <code id=non-conforming-features:the-pre-element><a href=#the-pre-element>pre</a></code> and <code id=non-conforming-features:the-code-element><a href=#the-code-element>code</a></code> instead.<dt><dfn id=nextid><code>nextid</code></dfn><dd><p>Use GUIDs instead.<dt><dfn id=noembed><code>noembed</code></dfn><dd><p>Use <code id=non-conforming-features:the-object-element-2><a href=#the-object-element>object</a></code> instead of <code id=non-conforming-features:the-embed-element-2><a href=#the-embed-element>embed</a></code> when fallback is necessary.<dt><dfn id=plaintext><code>plaintext</code></dfn><dd><p>Use the "<code id=non-conforming-features:text/plain><a data-x-internal=text/plain href=http://tools.ietf.org/html/rfc2046#section-4.1.3>text/plain</a></code>" <a href=#mime-type id=non-conforming-features:mime-type>MIME type</a> instead.<dt><dfn id=rb><code>rb</code></dfn><dd><p>Providing the ruby base directly inside the <code id=non-conforming-features:the-ruby-element><a href=#the-ruby-element>ruby</a></code> element is sufficient; the <code id=non-conforming-features:rb><a href=#rb>rb</a></code> element is unnecessary. Omit it altogether.<dt><dfn id=strike><code>strike</code></dfn><dd><p>Use <code id=non-conforming-features:the-del-element><a href=#the-del-element>del</a></code> instead if the element is marking an edit, otherwise use <code id=non-conforming-features:the-s-element><a href=#the-s-element>s</a></code> instead.<dt><dfn id=xmp><code>xmp</code></dfn><dd><p>Use <code id=non-conforming-features:the-pre-element-2><a href=#the-pre-element>pre</a></code> and <code id=non-conforming-features:the-code-element-2><a href=#the-code-element>code</a></code> instead, and escape "<code><</code>" and "<code>&</code>" characters as "<code>&lt;</code>" and "<code>&amp;</code>" respectively.<dt><dfn id=basefont><code>basefont</code></dfn><dt><dfn id=big><code>big</code></dfn><dt><dfn id=blink><code>blink</code></dfn><dt><dfn id=center><code>center</code></dfn><dt><dfn id=font><code>font</code></dfn><dt><code id=non-conforming-features:the-marquee-element-2><a href=#the-marquee-element-2>marquee</a></code><dt><dfn id=multicol><code>multicol</code></dfn><dt><dfn id=nobr><code>nobr</code></dfn><dt><dfn id=spacer><code>spacer</code></dfn><dt><dfn id=tt><code>tt</code></dfn><dd>
- <p>Use appropriate elements or CSS instead.</p>
- <p>Where the <code id=non-conforming-features:tt><a href=#tt>tt</a></code> element would have been used for marking up keyboard input,
- consider the <code id=non-conforming-features:the-kbd-element><a href=#the-kbd-element>kbd</a></code> element; for variables, consider the <code id=non-conforming-features:the-var-element><a href=#the-var-element>var</a></code> element; for
- computer code, consider the <code id=non-conforming-features:the-code-element-3><a href=#the-code-element>code</a></code> element; and for computer output, consider the
- <code id=non-conforming-features:the-samp-element><a href=#the-samp-element>samp</a></code> element.</p>
- <p>Similarly, if the <code id=non-conforming-features:big><a href=#big>big</a></code> element is being used to denote a heading, consider using
- the <code id=non-conforming-features:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code> element; if it is being used for marking up important passages, consider the
- <code id=non-conforming-features:the-strong-element><a href=#the-strong-element>strong</a></code> element; and if it is being used for highlighting text for reference
- purposes, consider the <code id=non-conforming-features:the-mark-element><a href=#the-mark-element>mark</a></code> element.</p>
- <p>See also the <a href=#usage-summary>text-level semantics usage summary</a> for more
- suggestions with examples.</p>
- </dl>
- <hr>
- <p>The following attributes are obsolete (though the elements are still part of the language), and
- must not be used by authors:</p>
- <dl><dt><dfn id=attr-a-charset><code>charset</code></dfn> on <code id=non-conforming-features:the-a-element><a href=#the-a-element>a</a></code> elements<dt><dfn id=attr-link-charset><code>charset</code></dfn> on <code id=non-conforming-features:the-link-element><a href=#the-link-element>link</a></code> elements<dd><p>Use an HTTP Content-Type header on the linked resource instead.<dt><dfn id=attr-a-coords><code>coords</code></dfn> on <code id=non-conforming-features:the-a-element-2><a href=#the-a-element>a</a></code> elements<dt><dfn id=attr-a-shape><code>shape</code></dfn> on <code id=non-conforming-features:the-a-element-3><a href=#the-a-element>a</a></code> elements<dd><p>Use <code id=non-conforming-features:the-area-element><a href=#the-area-element>area</a></code> instead of <code id=non-conforming-features:the-a-element-4><a href=#the-a-element>a</a></code> for image maps.<dt><dfn id=attr-a-methods><code>methods</code></dfn> on <code id=non-conforming-features:the-a-element-5><a href=#the-a-element>a</a></code> elements<dt><dfn id=attr-link-methods><code>methods</code></dfn> on <code id=non-conforming-features:the-link-element-2><a href=#the-link-element>link</a></code> elements<dd><p>Use the HTTP OPTIONS feature instead.<dt><dfn id=attr-a-name><code>name</code></dfn> on <code id=non-conforming-features:the-a-element-6><a href=#the-a-element>a</a></code> elements (except as noted in the previous section)<dt><dfn id=attr-embed-name><code>name</code></dfn> on <code id=non-conforming-features:the-embed-element-3><a href=#the-embed-element>embed</a></code> elements<dt><dfn id=attr-img-name><code>name</code></dfn> on <code id=non-conforming-features:the-img-element><a href=#the-img-element>img</a></code> elements<dt><dfn id=attr-option-name><code>name</code></dfn> on <code id=non-conforming-features:the-option-element><a href=#the-option-element>option</a></code> elements<dd><p>Use the <code id=non-conforming-features:the-id-attribute><a href=#the-id-attribute>id</a></code> attribute instead.<dt><dfn id=attr-a-rev><code>rev</code></dfn> on <code id=non-conforming-features:the-a-element-7><a href=#the-a-element>a</a></code> elements<dt><dfn id=attr-link-rev><code>rev</code></dfn> on <code id=non-conforming-features:the-link-element-3><a href=#the-link-element>link</a></code> elements<dd><p>Use the <code id=non-conforming-features:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>
- attribute instead, with an opposite term. (For example, instead of
- <code>rev="made"</code>, use <code>rel="author"</code>.)<dt><dfn id=attr-a-urn><code>urn</code></dfn> on <code id=non-conforming-features:the-a-element-8><a href=#the-a-element>a</a></code> elements<dt><dfn id=attr-link-urn><code>urn</code></dfn> on <code id=non-conforming-features:the-link-element-4><a href=#the-link-element>link</a></code> elements<dd><p>Specify the preferred persistent identifier using the <code id=non-conforming-features:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code> attribute instead.<dt><dfn id=attr-form-accept><code>accept</code></dfn> on <code id=non-conforming-features:the-form-element-2><a href=#the-form-element>form</a></code> elements<dd><p>Use the <code id=non-conforming-features:attr-input-accept><a href=#attr-input-accept>accept</a></code> attribute directly on the <code id=non-conforming-features:the-input-element><a href=#the-input-element>input</a></code> elements instead.<dt><dfn id=attr-area-nohref><code>nohref</code></dfn> on <code id=non-conforming-features:the-area-element-2><a href=#the-area-element>area</a></code> elements<dd><p>Omitting the <code id=non-conforming-features:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code>
- attribute is sufficient; the <code id=non-conforming-features:attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> attribute is
- unnecessary. Omit it altogether.<dt><dfn id=attr-head-profile><code>profile</code></dfn> on <code id=non-conforming-features:the-head-element><a href=#the-head-element>head</a></code> elements<dd><p>When used for declaring which <code id=non-conforming-features:the-meta-element><a href=#the-meta-element>meta</a></code> terms are
- used in the document, unnecessary; omit it altogether, and <a href=#concept-meta-extensions id=non-conforming-features:concept-meta-extensions>register the names</a>.<dd><p>When used for triggering specific user agent behaviors: use
- a <code id=non-conforming-features:the-link-element-5><a href=#the-link-element>link</a></code> element instead.<dt><dfn id=attr-html-version><code>version</code></dfn> on <code id=non-conforming-features:the-html-element><a href=#the-html-element>html</a></code> elements<dd><p>Unnecessary. Omit it altogether.<dt><dfn id=attr-input-ismap><code>ismap</code></dfn> on <code id=non-conforming-features:the-input-element-2><a href=#the-input-element>input</a></code> elements<dd><p>Unnecessary. Omit it altogether. All <code id=non-conforming-features:the-input-element-3><a href=#the-input-element>input</a></code> elements with a <code id=non-conforming-features:attr-input-type><a href=#attr-input-type>type</a></code> attribute in the <a href="#image-button-state-(type=image)" id="non-conforming-features:image-button-state-(type=image)">Image
- Button</a> state are processed as server-side image maps.<dt><dfn id=attr-input-usemap><code>usemap</code></dfn> on <code id=non-conforming-features:the-input-element-4><a href=#the-input-element>input</a></code> elements<dd><p>Use <code id=non-conforming-features:the-img-element-2><a href=#the-img-element>img</a></code> instead of <code id=non-conforming-features:the-input-element-5><a href=#the-input-element>input</a></code> for image maps.<dt><dfn id=attr-iframe-longdesc><code>longdesc</code></dfn> on <code id=non-conforming-features:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-img-longdesc><code>longdesc</code></dfn> on <code id=non-conforming-features:the-img-element-3><a href=#the-img-element>img</a></code> elements<dd><p>Use a regular <code id=non-conforming-features:the-a-element-9><a href=#the-a-element>a</a></code> element to link to the
- description, or (in the case of images) use an <a href=#image-map id=non-conforming-features:image-map>image
- map</a> to provide a link from the image to the image's
- description.<dt><dfn id=attr-img-lowsrc><code>lowsrc</code></dfn> on <code id=non-conforming-features:the-img-element-4><a href=#the-img-element>img</a></code> elements<dd><p>Use a progressive JPEG image (given in the <code id=non-conforming-features:attr-img-src><a href=#attr-img-src>src</a></code> attribute),
- instead of using two separate images.<dt><dfn id=attr-link-target><code>target</code></dfn> on <code id=non-conforming-features:the-link-element-6><a href=#the-link-element>link</a></code> elements<dd><p>Unnecessary. Omit it altogether.<dt><dfn id=attr-meta-scheme><code>scheme</code></dfn> on <code id=non-conforming-features:the-meta-element-2><a href=#the-meta-element>meta</a></code> elements<dd><p>Use only one scheme per field, or make the scheme declaration part of the value.<dt><dfn id=attr-object-archive><code>archive</code></dfn> on <code id=non-conforming-features:the-object-element-3><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-classid><code>classid</code></dfn> on <code id=non-conforming-features:the-object-element-4><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-code><code>code</code></dfn> on <code id=non-conforming-features:the-object-element-5><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-codebase><code>codebase</code></dfn> on <code id=non-conforming-features:the-object-element-6><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-codetype><code>codetype</code></dfn> on <code id=non-conforming-features:the-object-element-7><a href=#the-object-element>object</a></code> elements<dd><p>Use the <code id=non-conforming-features:attr-object-data><a href=#attr-object-data>data</a></code> and <code id=non-conforming-features:attr-object-type><a href=#attr-object-type>type</a></code> attributes to invoke <a href=#plugin id=non-conforming-features:plugin>plugins</a>. To set parameters with these names
- in particular, the <code id=non-conforming-features:the-param-element><a href=#the-param-element>param</a></code> element can be used.<dt><dfn id=attr-object-declare><code>declare</code></dfn> on <code id=non-conforming-features:the-object-element-8><a href=#the-object-element>object</a></code> elements<dd><p>Repeat the <code id=non-conforming-features:the-object-element-9><a href=#the-object-element>object</a></code> element completely each time the resource is to be reused.<dt><dfn id=attr-object-standby><code>standby</code></dfn> on <code id=non-conforming-features:the-object-element-10><a href=#the-object-element>object</a></code> elements<dd><p>Optimise the linked resource so that it loads quickly or, at least, incrementally.<dt><dfn id=attr-param-type><code>type</code></dfn> on <code id=non-conforming-features:the-param-element-2><a href=#the-param-element>param</a></code> elements<dt><dfn id=attr-param-valuetype><code>valuetype</code></dfn> on <code id=non-conforming-features:the-param-element-3><a href=#the-param-element>param</a></code> elements<dd><p>Use the <code id=non-conforming-features:attr-param-name><a href=#attr-param-name>name</a></code> and <code id=non-conforming-features:attr-param-value><a href=#attr-param-value>value</a></code> attributes without declaring
- value types.<dt><dfn id=attr-script-language><code>language</code></dfn> on <code id=non-conforming-features:the-script-element><a href=#the-script-element>script</a></code> elements (except as noted in the previous section)<dd><p>Use the <code id=non-conforming-features:attr-script-type><a href=#attr-script-type>type</a></code> attribute
- instead.<dt><dfn id=attr-script-event><code>event</code></dfn> on <code id=non-conforming-features:the-script-element-2><a href=#the-script-element>script</a></code> elements<dt><dfn id=attr-script-for><code>for</code></dfn> on <code id=non-conforming-features:the-script-element-3><a href=#the-script-element>script</a></code> elements<dd><p>Use DOM Events mechanisms to register event listeners. <a href=#refsDOM>[DOM]</a><dt><dfn id=attr-source-media><code>media</code></dfn> on <code id=non-conforming-features:the-source-element><a href=#the-source-element>source</a></code> elements<dd><p>Use script to select the media resource(s) to use.<dt><dfn id=attr-table-datapagesize><code>datapagesize</code></dfn> on <code id=non-conforming-features:the-table-element><a href=#the-table-element>table</a></code> elements<dd><p>Unnecessary. Omit it altogether.<dt><dfn id=attr-table-summary><code>summary</code></dfn> on <code id=non-conforming-features:the-table-element-2><a href=#the-table-element>table</a></code> elements<dd><p>Use one of the <a href=#table-descriptions-techniques>techniques for describing
- tables</a> given in the <code id=non-conforming-features:the-table-element-3><a href=#the-table-element>table</a></code> section instead.<dt><dfn id=attr-td-abbr><code>abbr</code></dfn> on <code id=non-conforming-features:the-td-element><a href=#the-td-element>td</a></code> elements<dd><p>Use text that begins in an unambiguous and terse manner, and include any more elaborate text after that. The <code id=non-conforming-features:attr-title><a href=#attr-title>title</a></code> attribute can also be useful in including more detailed text, so that the cell's contents can be made terse. If it's a heading, use <code id=non-conforming-features:the-th-element><a href=#the-th-element>th</a></code> (which has an <code id=non-conforming-features:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code> attribute).</p>
- <dt><dfn id=attr-tdth-axis><code>axis</code></dfn> on <code id=non-conforming-features:the-td-element-2><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-2><a href=#the-th-element>th</a></code> elements<dd><p>Use the <code id=non-conforming-features:attr-th-scope><a href=#attr-th-scope>scope</a></code> attribute on the relevant <code id=non-conforming-features:the-th-element-3><a href=#the-th-element>th</a></code>.</p>
- <dt><dfn id=attr-td-scope><code>scope</code></dfn> on <code id=non-conforming-features:the-td-element-3><a href=#the-td-element>td</a></code> elements<dd><p>Use <code id=non-conforming-features:the-th-element-4><a href=#the-th-element>th</a></code> elements for heading cells.</p>
- <dt><dfn id=attr-datasrc><code>datasrc</code></dfn> on <code id=non-conforming-features:the-a-element-10><a href=#the-a-element>a</a></code>, <code id=non-conforming-features:the-applet-element-2><a href=#the-applet-element>applet</a></code>, <code id=non-conforming-features:the-button-element><a href=#the-button-element>button</a></code>, <code id=non-conforming-features:the-div-element><a href=#the-div-element>div</a></code>, <code id=non-conforming-features:frame-2><a href=#frame>frame</a></code>, <code id=non-conforming-features:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>, <code id=non-conforming-features:the-img-element-5><a href=#the-img-element>img</a></code>, <code id=non-conforming-features:the-input-element-6><a href=#the-input-element>input</a></code>, <code id=non-conforming-features:the-label-element><a href=#the-label-element>label</a></code>, <code id=non-conforming-features:the-legend-element><a href=#the-legend-element>legend</a></code>, <code id=non-conforming-features:the-marquee-element-2-2><a href=#the-marquee-element-2>marquee</a></code>, <code id=non-conforming-features:the-object-element-11><a href=#the-object-element>object</a></code>, <code id=non-conforming-features:the-option-element-2><a href=#the-option-element>option</a></code>, <code id=non-conforming-features:the-select-element><a href=#the-select-element>select</a></code>, <code id=non-conforming-features:the-span-element><a href=#the-span-element>span</a></code>, <code id=non-conforming-features:the-table-element-4><a href=#the-table-element>table</a></code>, and <code id=non-conforming-features:the-textarea-element><a href=#the-textarea-element>textarea</a></code> elements<dt><dfn id=attr-datafld><code>datafld</code></dfn> on <code id=non-conforming-features:the-a-element-11><a href=#the-a-element>a</a></code>, <code id=non-conforming-features:the-applet-element-3><a href=#the-applet-element>applet</a></code>, <code id=non-conforming-features:the-button-element-2><a href=#the-button-element>button</a></code>, <code id=non-conforming-features:the-div-element-2><a href=#the-div-element>div</a></code>, <code id=non-conforming-features:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>, <code id=non-conforming-features:frame-3><a href=#frame>frame</a></code>, <code id=non-conforming-features:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>, <code id=non-conforming-features:the-img-element-6><a href=#the-img-element>img</a></code>, <code id=non-conforming-features:the-input-element-7><a href=#the-input-element>input</a></code>, <code id=non-conforming-features:the-label-element-2><a href=#the-label-element>label</a></code>, <code id=non-conforming-features:the-legend-element-2><a href=#the-legend-element>legend</a></code>, <code id=non-conforming-features:the-marquee-element-2-3><a href=#the-marquee-element-2>marquee</a></code>, <code id=non-conforming-features:the-object-element-12><a href=#the-object-element>object</a></code>, <code id=non-conforming-features:the-param-element-4><a href=#the-param-element>param</a></code>, <code id=non-conforming-features:the-select-element-2><a href=#the-select-element>select</a></code>, <code id=non-conforming-features:the-span-element-2><a href=#the-span-element>span</a></code>, and <code id=non-conforming-features:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code> elements<dt><dfn id=attr-dataformatas><code>dataformatas</code></dfn> on <code id=non-conforming-features:the-button-element-3><a href=#the-button-element>button</a></code>, <code id=non-conforming-features:the-div-element-3><a href=#the-div-element>div</a></code>, <code id=non-conforming-features:the-input-element-8><a href=#the-input-element>input</a></code>, <code id=non-conforming-features:the-label-element-3><a href=#the-label-element>label</a></code>, <code id=non-conforming-features:the-legend-element-3><a href=#the-legend-element>legend</a></code>, <code id=non-conforming-features:the-marquee-element-2-4><a href=#the-marquee-element-2>marquee</a></code>, <code id=non-conforming-features:the-object-element-13><a href=#the-object-element>object</a></code>, <code id=non-conforming-features:the-option-element-3><a href=#the-option-element>option</a></code>, <code id=non-conforming-features:the-select-element-3><a href=#the-select-element>select</a></code>, <code id=non-conforming-features:the-span-element-3><a href=#the-span-element>span</a></code>, and <code id=non-conforming-features:the-table-element-5><a href=#the-table-element>table</a></code> elements<dd><p>Use script and a mechanism such as <code id=non-conforming-features:xmlhttprequest><a href=#xmlhttprequest>XMLHttpRequest</a></code> to populate the page dynamically. <a href=#refsXHR>[XHR]</a><dt><dfn id=attr-body-alink><code>alink</code></dfn> on <code id=non-conforming-features:the-body-element><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-bgcolor><code>bgcolor</code></dfn> on <code id=non-conforming-features:the-body-element-2><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-bottommargin><code>bottommargin</code></dfn> on <code id=non-conforming-features:the-body-element-3><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-leftmargin><code>leftmargin</code></dfn> on <code id=non-conforming-features:the-body-element-4><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-link><code>link</code></dfn> on <code id=non-conforming-features:the-body-element-5><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-marginheight><code>marginheight</code></dfn> on <code id=non-conforming-features:the-body-element-6><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-marginwidth><code>marginwidth</code></dfn> on <code id=non-conforming-features:the-body-element-7><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-rightmargin><code>rightmargin</code></dfn> on <code id=non-conforming-features:the-body-element-8><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-text><code>text</code></dfn> on <code id=non-conforming-features:the-body-element-9><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-topmargin><code>margintop</code></dfn> on <code id=non-conforming-features:the-body-element-10><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-body-vlink><code>vlink</code></dfn> on <code id=non-conforming-features:the-body-element-11><a href=#the-body-element>body</a></code> elements<dt><dfn id=attr-br-clear><code>clear</code></dfn> on <code id=non-conforming-features:the-br-element><a href=#the-br-element>br</a></code> elements<dt><dfn id=attr-caption-align><code>align</code></dfn> on <code id=non-conforming-features:the-caption-element><a href=#the-caption-element>caption</a></code> elements<dt><dfn id=attr-col-align><code>align</code></dfn> on <code id=non-conforming-features:the-col-element><a href=#the-col-element>col</a></code> elements<dt><dfn id=attr-col-char><code>char</code></dfn> on <code id=non-conforming-features:the-col-element-2><a href=#the-col-element>col</a></code> elements<dt><dfn id=attr-col-charoff><code>charoff</code></dfn> on <code id=non-conforming-features:the-col-element-3><a href=#the-col-element>col</a></code> elements<dt><dfn id=attr-col-valign><code>valign</code></dfn> on <code id=non-conforming-features:the-col-element-4><a href=#the-col-element>col</a></code> elements<dt><dfn id=attr-col-width><code>width</code></dfn> on <code id=non-conforming-features:the-col-element-5><a href=#the-col-element>col</a></code> elements<dt><dfn id=attr-div-align><code>align</code></dfn> on <code id=non-conforming-features:the-div-element-4><a href=#the-div-element>div</a></code> elements<dt><dfn id=attr-dl-compact><code>compact</code></dfn> on <code id=non-conforming-features:the-dl-element><a href=#the-dl-element>dl</a></code> elements<dt><dfn id=attr-embed-align><code>align</code></dfn> on <code id=non-conforming-features:the-embed-element-4><a href=#the-embed-element>embed</a></code> elements<dt><dfn id=attr-embed-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-embed-element-5><a href=#the-embed-element>embed</a></code> elements<dt><dfn id=attr-embed-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-embed-element-6><a href=#the-embed-element>embed</a></code> elements<dt><dfn id=attr-hr-align><code>align</code></dfn> on <code id=non-conforming-features:the-hr-element><a href=#the-hr-element>hr</a></code> elements<dt><dfn id=attr-hr-color><code>color</code></dfn> on <code id=non-conforming-features:the-hr-element-2><a href=#the-hr-element>hr</a></code> elements<dt><dfn id=attr-hr-noshade><code>noshade</code></dfn> on <code id=non-conforming-features:the-hr-element-3><a href=#the-hr-element>hr</a></code> elements<dt><dfn id=attr-hr-size><code>size</code></dfn> on <code id=non-conforming-features:the-hr-element-4><a href=#the-hr-element>hr</a></code> elements<dt><dfn id=attr-hr-width><code>width</code></dfn> on <code id=non-conforming-features:the-hr-element-5><a href=#the-hr-element>hr</a></code> elements<dt><dfn id=attr-hx-align><code>align</code></dfn> on <code id=non-conforming-features:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>—<code id=non-conforming-features:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements<dt><dfn id=attr-iframe-align><code>align</code></dfn> on <code id=non-conforming-features:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-allowtransparency><code>allowtransparency</code></dfn> on <code id=non-conforming-features:the-iframe-element-6><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-frameborder><code>frameborder</code></dfn> on <code id=non-conforming-features:the-iframe-element-7><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-iframe-element-8><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-marginheight><code>marginheight</code></dfn> on <code id=non-conforming-features:the-iframe-element-9><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-marginwidth><code>marginwidth</code></dfn> on <code id=non-conforming-features:the-iframe-element-10><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-scrolling><code>scrolling</code></dfn> on <code id=non-conforming-features:the-iframe-element-11><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-iframe-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-iframe-element-12><a href=#the-iframe-element>iframe</a></code> elements<dt><dfn id=attr-input-align><code>align</code></dfn> on <code id=non-conforming-features:the-input-element-9><a href=#the-input-element>input</a></code> elements<dt><dfn id=attr-input-border><code>border</code></dfn> on <code id=non-conforming-features:the-input-element-10><a href=#the-input-element>input</a></code> elements<dt><dfn id=attr-input-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-input-element-11><a href=#the-input-element>input</a></code> elements<dt><dfn id=attr-input-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-input-element-12><a href=#the-input-element>input</a></code> elements<dt><dfn id=attr-img-align><code>align</code></dfn> on <code id=non-conforming-features:the-img-element-7><a href=#the-img-element>img</a></code> elements<dt><dfn id=attr-img-border><code>border</code></dfn> on <code id=non-conforming-features:the-img-element-8><a href=#the-img-element>img</a></code> elements (except as noted in the previous section)<dt><dfn id=attr-img-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-img-element-9><a href=#the-img-element>img</a></code> elements<dt><dfn id=attr-img-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-img-element-10><a href=#the-img-element>img</a></code> elements<dt><dfn id=attr-legend-align><code>align</code></dfn> on <code id=non-conforming-features:the-legend-element-4><a href=#the-legend-element>legend</a></code> elements<dt><dfn id=attr-li-type><code>type</code></dfn> on <code id=non-conforming-features:the-li-element><a href=#the-li-element>li</a></code> elements<dt><dfn id=attr-menu-compact><code>compact</code></dfn> on <code id=non-conforming-features:the-menu-element><a href=#the-menu-element>menu</a></code> elements<dt><dfn id=attr-object-align><code>align</code></dfn> on <code id=non-conforming-features:the-object-element-14><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-border><code>border</code></dfn> on <code id=non-conforming-features:the-object-element-15><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-object-element-16><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-object-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-object-element-17><a href=#the-object-element>object</a></code> elements<dt><dfn id=attr-ol-compact><code>compact</code></dfn> on <code id=non-conforming-features:the-ol-element><a href=#the-ol-element>ol</a></code> elements<dt><dfn id=attr-p-align><code>align</code></dfn> on <code id=non-conforming-features:the-p-element><a href=#the-p-element>p</a></code> elements<dt><dfn id=attr-pre-width><code>width</code></dfn> on <code id=non-conforming-features:the-pre-element-3><a href=#the-pre-element>pre</a></code> elements<dt><dfn id=attr-table-align><code>align</code></dfn> on <code id=non-conforming-features:the-table-element-6><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-bgcolor><code>bgcolor</code></dfn> on <code id=non-conforming-features:the-table-element-7><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-border><code>border</code></dfn> on <code id=non-conforming-features:the-table-element-8><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-bordercolor><code>bordercolor</code></dfn> on <code id=non-conforming-features:the-table-element-9><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-cellpadding><code>cellpadding</code></dfn> on <code id=non-conforming-features:the-table-element-10><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-cellspacing><code>cellspacing</code></dfn> on <code id=non-conforming-features:the-table-element-11><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-frame><code>frame</code></dfn> on <code id=non-conforming-features:the-table-element-12><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-height><code>height</code></dfn> on <code id=non-conforming-features:the-table-element-13><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-hspace><code>hspace</code></dfn> on <code id=non-conforming-features:the-table-element-14><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-rules><code>rules</code></dfn> on <code id=non-conforming-features:the-table-element-15><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-vspace><code>vspace</code></dfn> on <code id=non-conforming-features:the-table-element-16><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-table-width><code>width</code></dfn> on <code id=non-conforming-features:the-table-element-17><a href=#the-table-element>table</a></code> elements<dt><dfn id=attr-tbody-align><code>align</code></dfn> on <code id=non-conforming-features:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=non-conforming-features:the-thead-element><a href=#the-thead-element>thead</a></code>, and <code id=non-conforming-features:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> elements<dt><dfn id=attr-tbody-char><code>char</code></dfn> on <code id=non-conforming-features:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code>, <code id=non-conforming-features:the-thead-element-2><a href=#the-thead-element>thead</a></code>, and <code id=non-conforming-features:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> elements<dt><dfn id=attr-tbody-charoff><code>charoff</code></dfn> on <code id=non-conforming-features:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>, <code id=non-conforming-features:the-thead-element-3><a href=#the-thead-element>thead</a></code>, and <code id=non-conforming-features:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> elements<dt><dfn id=attr-tbody-valign><code>valign</code></dfn> on <code id=non-conforming-features:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, <code id=non-conforming-features:the-thead-element-4><a href=#the-thead-element>thead</a></code>, and <code id=non-conforming-features:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> elements<dt><dfn id=attr-tdth-align><code>align</code></dfn> on <code id=non-conforming-features:the-td-element-4><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-5><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-bgcolor><code>bgcolor</code></dfn> on <code id=non-conforming-features:the-td-element-5><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-6><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-char><code>char</code></dfn> on <code id=non-conforming-features:the-td-element-6><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-7><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-charoff><code>charoff</code></dfn> on <code id=non-conforming-features:the-td-element-7><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-8><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-height><code>height</code></dfn> on <code id=non-conforming-features:the-td-element-8><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-9><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-nowrap><code>nowrap</code></dfn> on <code id=non-conforming-features:the-td-element-9><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-10><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-valign><code>valign</code></dfn> on <code id=non-conforming-features:the-td-element-10><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-11><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tdth-width><code>width</code></dfn> on <code id=non-conforming-features:the-td-element-11><a href=#the-td-element>td</a></code> and <code id=non-conforming-features:the-th-element-12><a href=#the-th-element>th</a></code> elements<dt><dfn id=attr-tr-align><code>align</code></dfn> on <code id=non-conforming-features:the-tr-element><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-tr-bgcolor><code>bgcolor</code></dfn> on <code id=non-conforming-features:the-tr-element-2><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-tr-char><code>char</code></dfn> on <code id=non-conforming-features:the-tr-element-3><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-tr-charoff><code>charoff</code></dfn> on <code id=non-conforming-features:the-tr-element-4><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-tr-height><code>height</code></dfn> on <code id=non-conforming-features:the-tr-element-5><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-tr-valign><code>valign</code></dfn> on <code id=non-conforming-features:the-tr-element-6><a href=#the-tr-element>tr</a></code> elements<dt><dfn id=attr-ul-compact><code>compact</code></dfn> on <code id=non-conforming-features:the-ul-element-2><a href=#the-ul-element>ul</a></code> elements<dt><dfn id=attr-ul-type><code>type</code></dfn> on <code id=non-conforming-features:the-ul-element-3><a href=#the-ul-element>ul</a></code> elements<dt><dfn id=attr-background><code>background</code></dfn> on <code id=non-conforming-features:the-body-element-12><a href=#the-body-element>body</a></code>, <code id=non-conforming-features:the-table-element-18><a href=#the-table-element>table</a></code>, <code id=non-conforming-features:the-thead-element-5><a href=#the-thead-element>thead</a></code>, <code id=non-conforming-features:the-tbody-element-5><a href=#the-tbody-element>tbody</a></code>, <code id=non-conforming-features:the-tfoot-element-5><a href=#the-tfoot-element>tfoot</a></code>, <code id=non-conforming-features:the-tr-element-7><a href=#the-tr-element>tr</a></code>, <code id=non-conforming-features:the-td-element-12><a href=#the-td-element>td</a></code>, and <code id=non-conforming-features:the-th-element-13><a href=#the-th-element>th</a></code> elements<dd><p>Use CSS instead.</dl>
-
- <h3 id=requirements-for-implementations>15.3 Requirements for implementations</h3>
- <h4 id=the-applet-element>15.3.1 The <dfn><code>applet</code></dfn> element</h4>
- <p>The <code id=the-applet-element:the-applet-element><a href=#the-applet-element>applet</a></code> element is a Java-specific variant of the <code id=the-applet-element:the-embed-element><a href=#the-embed-element>embed</a></code> element.
- The <code id=the-applet-element:the-applet-element-2><a href=#the-applet-element>applet</a></code> element is now obsoleted so that all extension frameworks (Java, .NET,
- Flash, etc) are handled in a consistent manner.</p>
- <p>When the element matches any of the following conditions, it <a href=#represents id=the-applet-element:represents>represents</a> its
- contents:</p>
- <ul class=brief><li>The element is still in the <a href=#stack-of-open-elements id=the-applet-element:stack-of-open-elements>stack of open elements</a> of an <a href=#html-parser id=the-applet-element:html-parser>HTML
- parser</a> or <a href=#xml-parser id=the-applet-element:xml-parser>XML parser</a>.<li>The element is not <a href=#in-a-document id=the-applet-element:in-a-document>in a <code>Document</code></a>.<li>The element's <a id=the-applet-element:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a> is not <a href=#fully-active id=the-applet-element:fully-active>fully active</a>.<li id=sandboxPluginApplet>The element's <a id=the-applet-element:node-document-2 href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s <a href=#active-sandboxing-flag-set id=the-applet-element:active-sandboxing-flag-set>active sandboxing flag
- set</a> has its <a href=#sandboxed-plugins-browsing-context-flag id=the-applet-element:sandboxed-plugins-browsing-context-flag>sandboxed plugins browsing context flag</a> set.<li>The element has an ancestor <a href=#media-element id=the-applet-element:media-element>media element</a>.<li>The element has an ancestor <code id=the-applet-element:the-object-element><a href=#the-object-element>object</a></code> element that is <em>not</em> showing its
- <a href=#fallback-content id=the-applet-element:fallback-content>fallback content</a>.<li>No Java Language runtime <a href=#plugin id=the-applet-element:plugin>plugin</a> is available.<li>A Java runtime <a href=#plugin id=the-applet-element:plugin-2>plugin</a> is available but it is disabled.</ul>
-
- <p>Otherwise, the user agent should instantiate a Java Language runtime <a href=#plugin id=the-applet-element:plugin-3>plugin</a>, and
- should pass the names and values of all the attributes on the element, in the order they were
- added to the element, with the attributes added by the parser being ordered in source order, and
- then a parameter named "PARAM" whose value is null, and then all the names and values of <a href=#concept-param-parameter id=the-applet-element:concept-param-parameter>parameters</a> given by <code id=the-applet-element:the-param-element><a href=#the-param-element>param</a></code> elements that are
- children of the <code id=the-applet-element:the-applet-element-3><a href=#the-applet-element>applet</a></code> element, in <a href=#tree-order id=the-applet-element:tree-order>tree order</a>, to the
- <a href=#plugin id=the-applet-element:plugin-4>plugin</a> used. If the <a href=#plugin id=the-applet-element:plugin-5>plugin</a> supports a scriptable interface, the
- <code id=the-applet-element:htmlappletelement><a href=#htmlappletelement>HTMLAppletElement</a></code> object representing the element should expose that interface. The
- <code id=the-applet-element:the-applet-element-4><a href=#the-applet-element>applet</a></code> element <a href=#represents id=the-applet-element:represents-2>represents</a> the <a href=#plugin id=the-applet-element:plugin-6>plugin</a>.</p>
-
- <p class=note>The <code id=the-applet-element:the-applet-element-5><a href=#the-applet-element>applet</a></code> element is unaffected by the CSS 'display' property. The
- Java Language runtime is instantiated even if the element is hidden with a 'display:none' CSS
- style.</p>
- <p>The <code id=the-applet-element:the-applet-element-6><a href=#the-applet-element>applet</a></code> element must implement the <code id=the-applet-element:htmlappletelement-2><a href=#htmlappletelement>HTMLAppletElement</a></code>
- interface.</p>
- <pre class=idl>interface <dfn id=htmlappletelement>HTMLAppletElement</dfn> : <a href=#htmlelement id=the-applet-element:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-applet-align id=the-applet-element:dom-applet-align>align</a>;
- attribute DOMString <a href=#dom-applet-alt id=the-applet-element:dom-applet-alt>alt</a>;
- attribute DOMString <a href=#dom-applet-archive id=the-applet-element:dom-applet-archive>archive</a>;
- attribute DOMString <a href=#dom-applet-code id=the-applet-element:dom-applet-code>code</a>;
- attribute DOMString <a href=#dom-applet-codebase id=the-applet-element:dom-applet-codebase>codeBase</a>;
- attribute DOMString <a href=#dom-applet-height id=the-applet-element:dom-applet-height>height</a>;
- attribute unsigned long <a href=#dom-applet-hspace id=the-applet-element:dom-applet-hspace>hspace</a>;
- attribute DOMString <a href=#dom-applet-name id=the-applet-element:dom-applet-name>name</a>;
- attribute DOMString _<a href=#dom-applet-object id=the-applet-element:dom-applet-object>object</a>; // the underscore is not part of the identifier
- attribute unsigned long <a href=#dom-applet-vspace id=the-applet-element:dom-applet-vspace>vspace</a>;
- attribute DOMString <a href=#dom-applet-width id=the-applet-element:dom-applet-width>width</a>;
- };</pre>
- <p>The <dfn id=dom-applet-align><code>align</code></dfn>, <dfn id=dom-applet-alt><code>alt</code></dfn>, <dfn id=dom-applet-archive><code>archive</code></dfn>, <dfn id=dom-applet-code><code>code</code></dfn>, <dfn id=dom-applet-height><code>height</code></dfn>, <dfn id=dom-applet-hspace><code>hspace</code></dfn>, <dfn id=dom-applet-name><code>name</code></dfn>, <dfn id=dom-applet-object><code>object</code></dfn>, <dfn id=dom-applet-vspace><code>vspace</code></dfn>, and <dfn id=dom-applet-width><code>width</code></dfn> IDL attributes must <a href=#reflect id=the-applet-element:reflect>reflect</a> the
- respective content attributes of the same name. For the purposes of reflection, the
- <code id=the-applet-element:the-applet-element-7><a href=#the-applet-element>applet</a></code> element's <code>object</code> content
- attribute is defined as containing a <a href=#url id=the-applet-element:url>URL</a>.</p>
- <p>The <dfn id=dom-applet-codebase><code>codeBase</code></dfn> IDL attribute must
- <a href=#reflect id=the-applet-element:reflect-2>reflect</a> the <code>codebase</code> content
- attribute, which for the purposes of reflection is defined as containing a <a href=#url id=the-applet-element:url-2>URL</a>.</p>
- <h4 id=the-marquee-element-2>15.3.2 The <dfn><code>marquee</code></dfn> element</h4>
- <p>The <code id=the-marquee-element-2:the-marquee-element-2><a href=#the-marquee-element-2>marquee</a></code> element is a presentational element that animates content. CSS
- transitions and animations are a more appropriate mechanism. <a href=#refsCSSANIMATIONS>[CSSANIMATIONS]</a> <a href=#refsCSSTRANSITIONS>[CSSTRANSITIONS]</a></p>
- <p>The <a href=#task-source id=the-marquee-element-2:task-source>task source</a> for tasks mentioned in this section is the <a href=#dom-manipulation-task-source id=the-marquee-element-2:dom-manipulation-task-source>DOM manipulation
- task source</a>.</p>
- <p>The <code id=the-marquee-element-2:the-marquee-element-2-2><a href=#the-marquee-element-2>marquee</a></code> element must implement the <code id=the-marquee-element-2:htmlmarqueeelement><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code>
- interface.</p>
- <pre class=idl>interface <dfn id=htmlmarqueeelement>HTMLMarqueeElement</dfn> : <a href=#htmlelement id=the-marquee-element-2:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-marquee-behavior id=the-marquee-element-2:dom-marquee-behavior>behavior</a>;
- attribute DOMString <a href=#dom-marquee-bgcolor id=the-marquee-element-2:dom-marquee-bgcolor>bgColor</a>;
- attribute DOMString <a href=#dom-marquee-direction id=the-marquee-element-2:dom-marquee-direction>direction</a>;
- attribute DOMString <a href=#dom-marquee-height id=the-marquee-element-2:dom-marquee-height>height</a>;
- attribute unsigned long <a href=#dom-marquee-hspace id=the-marquee-element-2:dom-marquee-hspace>hspace</a>;
- attribute long <a href=#dom-marquee-loop id=the-marquee-element-2:dom-marquee-loop>loop</a>;
- attribute unsigned long <a href=#dom-marquee-scrollamount id=the-marquee-element-2:dom-marquee-scrollamount>scrollAmount</a>;
- attribute unsigned long <a href=#dom-marquee-scrolldelay id=the-marquee-element-2:dom-marquee-scrolldelay>scrollDelay</a>;
- attribute boolean <a href=#dom-marquee-truespeed id=the-marquee-element-2:dom-marquee-truespeed>trueSpeed</a>;
- attribute unsigned long <a href=#dom-marquee-vspace id=the-marquee-element-2:dom-marquee-vspace>vspace</a>;
- attribute DOMString <a href=#dom-marquee-width id=the-marquee-element-2:dom-marquee-width>width</a>;
- attribute <a href=#eventhandler id=the-marquee-element-2:eventhandler>EventHandler</a> <a href=#handler-marquee-onbounce id=the-marquee-element-2:handler-marquee-onbounce>onbounce</a>;
- attribute <a href=#eventhandler id=the-marquee-element-2:eventhandler-2>EventHandler</a> <a href=#handler-marquee-onfinish id=the-marquee-element-2:handler-marquee-onfinish>onfinish</a>;
- attribute <a href=#eventhandler id=the-marquee-element-2:eventhandler-3>EventHandler</a> <a href=#handler-marquee-onstart id=the-marquee-element-2:handler-marquee-onstart>onstart</a>;
- void <a href=#dom-marquee-start id=the-marquee-element-2:dom-marquee-start>start</a>();
- void <a href=#dom-marquee-stop id=the-marquee-element-2:dom-marquee-stop>stop</a>();
- };</pre>
- <p>A <code id=the-marquee-element-2:the-marquee-element-2-3><a href=#the-marquee-element-2>marquee</a></code> element can be <dfn id=concept-marquee-on>turned on</dfn> or <dfn id=concept-marquee-off>turned off</dfn>. When it is created, it is <a href=#concept-marquee-on id=the-marquee-element-2:concept-marquee-on>turned on</a>.</p>
- <p>When the <dfn id=dom-marquee-start><code>start()</code></dfn> method is called, the
- <code id=the-marquee-element-2:the-marquee-element-2-4><a href=#the-marquee-element-2>marquee</a></code> element must be <a href=#concept-marquee-on id=the-marquee-element-2:concept-marquee-on-2>turned on</a>.</p>
- <p>When the <dfn id=dom-marquee-stop><code>stop()</code></dfn> method is called, the
- <code id=the-marquee-element-2:the-marquee-element-2-5><a href=#the-marquee-element-2>marquee</a></code> element must be <a href=#concept-marquee-off id=the-marquee-element-2:concept-marquee-off>turned off</a>.</p>
- <p>When a <code id=the-marquee-element-2:the-marquee-element-2-6><a href=#the-marquee-element-2>marquee</a></code> element is created, the user agent must <a href=#queue-a-task id=the-marquee-element-2:queue-a-task>queue a task</a>
- to <a href=#fire-a-simple-event id=the-marquee-element-2:fire-a-simple-event>fire a simple event</a> named <code>start</code> at the element.</p>
- <hr>
- <p>The <dfn id=attr-marquee-behavior><code>behavior</code></dfn> content attribute on
- <code id=the-marquee-element-2:the-marquee-element-2-7><a href=#the-marquee-element-2>marquee</a></code> elements is an <a href=#enumerated-attribute id=the-marquee-element-2:enumerated-attribute>enumerated attribute</a> with the following keywords
- (all non-conforming):</p>
- <table><thead><tr><th>Keyword
- <th>State
- <tbody><tr><td><code>scroll</code>
- <td><dfn id=attr-marquee-behavior-scroll>scroll</dfn>
- <tr><td><code>slide</code>
- <td><dfn id=attr-marquee-behavior-slide>slide</dfn>
- <tr><td><code>alternate</code>
- <td><dfn id=attr-marquee-behavior-alternate>alternate</dfn>
- </table>
- <p>The <i id=the-marquee-element-2:missing-value-default><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-marquee-behavior-scroll id=the-marquee-element-2:attr-marquee-behavior-scroll>scroll</a> state.</p>
- <hr>
- <p>The <dfn id=attr-marquee-direction><code>direction</code></dfn> content attribute on
- <code id=the-marquee-element-2:the-marquee-element-2-8><a href=#the-marquee-element-2>marquee</a></code> elements is an <a href=#enumerated-attribute id=the-marquee-element-2:enumerated-attribute-2>enumerated attribute</a> with the following keywords
- (all non-conforming):</p>
- <table><thead><tr><th>Keyword
- <th>State
- <tbody><tr><td><code>left</code>
- <td><dfn id=attr-marquee-direction-left>left</dfn>
- <tr><td><code>right</code>
- <td><dfn id=attr-marquee-direction-right>right</dfn>
- <tr><td><code>up</code>
- <td><dfn id=attr-marquee-direction-up>up</dfn>
- <tr><td><code>down</code>
- <td><dfn id=attr-marquee-direction-down>down</dfn>
- </table>
- <p>The <i id=the-marquee-element-2:missing-value-default-2><a href=#missing-value-default>missing value default</a></i> is the <a href=#attr-marquee-direction-left id=the-marquee-element-2:attr-marquee-direction-left>left</a>
- state.</p>
- <hr>
- <p>The <dfn id=attr-marquee-truespeed><code>truespeed</code></dfn> content attribute on
- <code id=the-marquee-element-2:the-marquee-element-2-9><a href=#the-marquee-element-2>marquee</a></code> elements is a <a href=#boolean-attribute id=the-marquee-element-2:boolean-attribute>boolean attribute</a>.</p>
- <hr>
- <p>A <code id=the-marquee-element-2:the-marquee-element-2-10><a href=#the-marquee-element-2>marquee</a></code> element has a <dfn id=marquee-scroll-interval>marquee scroll interval</dfn>, which is obtained as
- follows:</p>
- <ol><li><p>If the element has a <code>scrolldelay</code> attribute,
- and parsing its value using the <a href=#rules-for-parsing-non-negative-integers id=the-marquee-element-2:rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> does not
- return an error, then let <var>delay</var> be the parsed value. Otherwise, let <var>delay</var>
- be 85.<li><p>If the element does not have a <code id=the-marquee-element-2:attr-marquee-truespeed><a href=#attr-marquee-truespeed>truespeed</a></code>
- attribute, and the <var>delay</var> value is less than 60, then let <var>delay</var> be 60
- instead.<li><p>The <a href=#marquee-scroll-interval id=the-marquee-element-2:marquee-scroll-interval>marquee scroll interval</a> is <var>delay</var>, interpreted in
- milliseconds.</ol>
- <hr>
- <p>A <code id=the-marquee-element-2:the-marquee-element-2-11><a href=#the-marquee-element-2>marquee</a></code> element has a <dfn id=marquee-scroll-distance>marquee scroll distance</dfn>, which, if the element
- has a <code>scrollamount</code> attribute, and
- parsing its value using the <a href=#rules-for-parsing-non-negative-integers id=the-marquee-element-2:rules-for-parsing-non-negative-integers-2>rules for parsing non-negative integers</a> does not return
- an error, is the parsed value interpreted in CSS pixels, and otherwise is 6 CSS pixels.</p>
- <hr>
- <p>A <code id=the-marquee-element-2:the-marquee-element-2-12><a href=#the-marquee-element-2>marquee</a></code> element has a <dfn id=marquee-loop-count>marquee loop count</dfn>, which, if the element has a
- <dfn id=attr-marquee-loop><code>loop</code></dfn> attribute, and parsing its value using the <a href=#rules-for-parsing-integers id=the-marquee-element-2:rules-for-parsing-integers>rules
- for parsing integers</a> does not return an error or a number less than 1, is the parsed value,
- and otherwise is −1.</p>
- <p>The <dfn id=dom-marquee-loop><code>loop</code></dfn> IDL attribute, on getting, must
- return the element's <a href=#marquee-loop-count id=the-marquee-element-2:marquee-loop-count>marquee loop count</a>; and on setting, if the new value is
- different than the element's <a href=#marquee-loop-count id=the-marquee-element-2:marquee-loop-count-2>marquee loop count</a> and either greater than zero or equal
- to −1, must set the element's <code id=the-marquee-element-2:attr-marquee-loop><a href=#attr-marquee-loop>loop</a></code> content attribute
- (adding it if necessary) to the <a href=#valid-integer id=the-marquee-element-2:valid-integer>valid integer</a> that represents the new value. (Other
- values are ignored.)</p>
- <p>A <code id=the-marquee-element-2:the-marquee-element-2-13><a href=#the-marquee-element-2>marquee</a></code> element also has a <dfn id=marquee-current-loop-index>marquee current loop index</dfn>, which is zero
- when the element is created.</p>
- <p>The rendering layer will occasionally <dfn id=increment-the-marquee-current-loop-index>increment the marquee current loop index</dfn>,
- which must cause the following steps to be run:</p>
- <ol><li><p>If the <a href=#marquee-loop-count id=the-marquee-element-2:marquee-loop-count-3>marquee loop count</a> is −1, then abort these steps.</p>
- <li><p>Increment the <a href=#marquee-current-loop-index id=the-marquee-element-2:marquee-current-loop-index>marquee current loop index</a> by one.<li>
- <p>If the <a href=#marquee-current-loop-index id=the-marquee-element-2:marquee-current-loop-index-2>marquee current loop index</a> is now equal to or greater than the element's
- <a href=#marquee-loop-count id=the-marquee-element-2:marquee-loop-count-4>marquee loop count</a>, <a href=#concept-marquee-off id=the-marquee-element-2:concept-marquee-off-2>turn off</a> the
- <code id=the-marquee-element-2:the-marquee-element-2-14><a href=#the-marquee-element-2>marquee</a></code> element and <a href=#queue-a-task id=the-marquee-element-2:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=the-marquee-element-2:fire-a-simple-event-2>fire a simple event</a>
- named <code>finish</code> at the <code id=the-marquee-element-2:the-marquee-element-2-15><a href=#the-marquee-element-2>marquee</a></code> element.</p>
- <p>Otherwise, if the <code id=the-marquee-element-2:attr-marquee-behavior><a href=#attr-marquee-behavior>behavior</a></code> attribute is in the
- <a href=#attr-marquee-behavior-alternate id=the-marquee-element-2:attr-marquee-behavior-alternate>alternate</a> state, then <a href=#queue-a-task id=the-marquee-element-2:queue-a-task-3>queue a
- task</a> to <a href=#fire-a-simple-event id=the-marquee-element-2:fire-a-simple-event-3>fire a simple event</a> named <code>bounce</code>
- at the <code id=the-marquee-element-2:the-marquee-element-2-16><a href=#the-marquee-element-2>marquee</a></code> element.</p>
- <p>Otherwise, <a href=#queue-a-task id=the-marquee-element-2:queue-a-task-4>queue a task</a> to <a href=#fire-a-simple-event id=the-marquee-element-2:fire-a-simple-event-4>fire a simple event</a> named <code>start</code> at the <code id=the-marquee-element-2:the-marquee-element-2-17><a href=#the-marquee-element-2>marquee</a></code> element.</p>
- </ol>
- <hr>
- <p>The following are the <a href=#event-handlers id=the-marquee-element-2:event-handlers>event handlers</a> (and their corresponding <a href=#event-handler-event-type id=the-marquee-element-2:event-handler-event-type>event handler event types</a>) that must be supported, as <a href=#event-handler-content-attributes id=the-marquee-element-2:event-handler-content-attributes>event handler content attributes</a> and <a href=#event-handler-idl-attributes id=the-marquee-element-2:event-handler-idl-attributes>event handler IDL
- attributes</a>, by <code id=the-marquee-element-2:the-marquee-element-2-18><a href=#the-marquee-element-2>marquee</a></code> elements:</p>
- <table><thead><tr><th><a href=#event-handlers id=the-marquee-element-2:event-handlers-2>Event handler</a> <th><a href=#event-handler-event-type id=the-marquee-element-2:event-handler-event-type-2>Event handler event type</a>
- <tbody><tr><td><dfn id=handler-marquee-onbounce><code>onbounce</code></dfn> <td> <code>bounce</code>
- <tr><td><dfn id=handler-marquee-onfinish><code>onfinish</code></dfn> <td> <code>finish</code>
- <tr><td><dfn id=handler-marquee-onstart><code>onstart</code></dfn> <td> <code>start</code>
- </table>
- <hr>
- <p>The <dfn id=dom-marquee-behavior><code>behavior</code></dfn>, <dfn id=dom-marquee-direction><code>direction</code></dfn>, <dfn id=dom-marquee-height><code>height</code></dfn>, <dfn id=dom-marquee-hspace><code>hspace</code></dfn>, <dfn id=dom-marquee-vspace><code>vspace</code></dfn>, and <dfn id=dom-marquee-width><code>width</code></dfn> IDL attributes must <a href=#reflect id=the-marquee-element-2:reflect>reflect</a> the
- respective content attributes of the same name.</p>
- <p>The <dfn id=dom-marquee-bgcolor><code>bgColor</code></dfn> IDL attribute must
- <a href=#reflect id=the-marquee-element-2:reflect-2>reflect</a> the <code>bgcolor</code> content attribute.</p>
- <p>The <dfn id=dom-marquee-scrollamount><code>scrollAmount</code></dfn> IDL attribute must
- <a href=#reflect id=the-marquee-element-2:reflect-3>reflect</a> the <code>scrollamount</code> content
- attribute. The default value is 6.</p>
- <p>The <dfn id=dom-marquee-scrolldelay><code>scrollDelay</code></dfn> IDL attribute must
- <a href=#reflect id=the-marquee-element-2:reflect-4>reflect</a> the <code>scrolldelay</code> content
- attribute. The default value is 85.</p>
- <p>The <dfn id=dom-marquee-truespeed><code>trueSpeed</code></dfn> IDL attribute must
- <a href=#reflect id=the-marquee-element-2:reflect-5>reflect</a> the <code id=the-marquee-element-2:attr-marquee-truespeed-2><a href=#attr-marquee-truespeed>truespeed</a></code> content
- attribute.</p>
- <h4 id=frames>15.3.3 Frames</h4>
- <p>The <dfn id=frameset><code>frameset</code></dfn> element acts as <a href=#the-body-element-2 id=frames:the-body-element-2>the body element</a> in documents
- that use frames.</p>
- <p>The <code id=frames:frameset><a href=#frameset>frameset</a></code> element must implement the <code id=frames:htmlframesetelement><a href=#htmlframesetelement>HTMLFrameSetElement</a></code>
- interface.</p>
- <pre class=idl>interface <dfn id=htmlframesetelement>HTMLFrameSetElement</dfn> : <a href=#htmlelement id=frames:htmlelement>HTMLElement</a> {
- attribute DOMString <a href=#dom-frameset-cols id=frames:dom-frameset-cols>cols</a>;
- attribute DOMString <a href=#dom-frameset-rows id=frames:dom-frameset-rows>rows</a>;
- };
- <a href=#htmlframesetelement id=frames:htmlframesetelement-2>HTMLFrameSetElement</a> implements <a href=#windoweventhandlers id=frames:windoweventhandlers>WindowEventHandlers</a>;</pre>
- <p>The <dfn id=dom-frameset-cols><code>cols</code></dfn> and <dfn id=dom-frameset-rows><code>rows</code></dfn> IDL attributes of the <code id=frames:frameset-2><a href=#frameset>frameset</a></code>
- element must <a href=#reflect id=frames:reflect>reflect</a> the respective content attributes of the same name.</p>
- <p>The <code id=frames:frameset-3><a href=#frameset>frameset</a></code> element exposes as <a href=#event-handler-content-attributes id=frames:event-handler-content-attributes>event handler content attributes</a> a
- number of the <a href=#event-handlers id=frames:event-handlers>event handlers</a> of the <code id=frames:window><a href=#window>Window</a></code> object. It also mirrors their
- <a href=#event-handler-idl-attributes id=frames:event-handler-idl-attributes>event handler IDL attributes</a>.</p>
- <p>The <code id=frames:handler-onblur><a href=#handler-onblur>onblur</a></code>, <code id=frames:handler-onerror><a href=#handler-onerror>onerror</a></code>,
- <code id=frames:handler-onfocus><a href=#handler-onfocus>onfocus</a></code>, <code id=frames:handler-onload><a href=#handler-onload>onload</a></code>, <code id=frames:handler-onresize><a href=#handler-onresize>onresize</a></code>, and <code id=frames:handler-onscroll><a href=#handler-onscroll>onscroll</a></code>
- <a href=#event-handlers id=frames:event-handlers-2>event handlers</a> of the <code id=frames:window-2><a href=#window>Window</a></code> object, exposed on the
- <code id=frames:frameset-4><a href=#frameset>frameset</a></code> element, replace the generic <a href=#event-handlers id=frames:event-handlers-3>event handlers</a> with the same names
- normally supported by <a href=#html-elements id=frames:html-elements>HTML elements</a>.</p>
- <hr>
- <p>The <dfn id=frame><code>frame</code></dfn> element defines a <a href=#nested-browsing-context id=frames:nested-browsing-context>nested browsing context</a>
- similar to the <code id=frames:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element, but rendered within a <code id=frames:frameset-5><a href=#frameset>frameset</a></code>
- element.</p>
-
- <p>A <code id=frames:frame><a href=#frame>frame</a></code> element is said to be an <dfn id=active-frame-element>active <code>frame</code> element</dfn> when
- it is <a href=#in-a-document id=frames:in-a-document>in a <code>Document</code></a>.</p>
- <p>When a <code id=frames:frame-2><a href=#frame>frame</a></code> element is created as an <a href=#active-frame-element id=frames:active-frame-element>active <code>frame</code>
- element</a>, or becomes an <a href=#active-frame-element id=frames:active-frame-element-2>active <code>frame</code> element</a> after not having been
- one, the user agent must create a <a href=#nested-browsing-context id=frames:nested-browsing-context-2>nested browsing context</a>, and then <a href=#process-the-frame-attributes id=frames:process-the-frame-attributes>process the
- <code>frame</code> attributes</a> for the first time.</p>
- <p>When a <code id=frames:frame-3><a href=#frame>frame</a></code> element stops being an <a href=#active-frame-element id=frames:active-frame-element-3>active <code>frame</code>
- element</a>, the user agent must <a href=#a-browsing-context-is-discarded id=frames:a-browsing-context-is-discarded>discard</a>
- the <a href=#nested-browsing-context id=frames:nested-browsing-context-3>nested browsing context</a>.</p>
- <p>Whenever a <code id=frames:frame-4><a href=#frame>frame</a></code> element with a <a href=#nested-browsing-context id=frames:nested-browsing-context-4>nested browsing context</a> has its <code>src</code> attribute set, changed, or removed, the user agent must
- <a href=#process-the-frame-attributes id=frames:process-the-frame-attributes-2>process the <code>frame</code> attributes</a>.</p>
- <p>When the user agent is to <dfn id=process-the-frame-attributes>process the <code>frame</code> attributes</dfn>, it must run the
- first appropriate steps from the following list:</p>
- <dl class=switch><dt>If the element has no <code>src</code> attribute specified, and the
- user agent is processing the <code id=frames:frame-5><a href=#frame>frame</a></code>'s attributes for the first time<dd>
- <p><a href=#queue-a-task id=frames:queue-a-task>Queue a task</a> to <a href=#fire-a-simple-event id=frames:fire-a-simple-event>fire a simple event</a> named <code id=frames:event-load><a href=#event-load>load</a></code> at the <code id=frames:frame-6><a href=#frame>frame</a></code> element.</p>
- <dt>Otherwise<dd>
- <ol><li>
- <p>If the value of the <code>src</code> attribute is the empty string,
- let <var>url</var> be the string "<code id=frames:about:blank><a href=#about:blank>about:blank</a></code>".</p>
- <p>Otherwise, <a href=#resolve-a-url id=frames:resolve-a-url>resolve</a> the value of the <code>src</code> attribute, relative to the <code id=frames:frame-7><a href=#frame>frame</a></code> element.</p>
- <p>If that is not successful, then let <var>url</var> be the string
- "<code id=frames:about:blank-2><a href=#about:blank>about:blank</a></code>". Otherwise, let <var>url</var> be the resulting
- <a href=#absolute-url id=frames:absolute-url>absolute URL</a>.</p>
- <li>
- <p><a href=#navigate id=frames:navigate>Navigate</a> the element's <a href=#child-browsing-context id=frames:child-browsing-context>child browsing context</a>
- to <var>url</var>.</p>
- </ol>
- </dl>
- <p>Any <a href=#navigate id=frames:navigate-2>navigation</a> required of the user agent in the <a href=#process-the-frame-attributes id=frames:process-the-frame-attributes-3>process
- the <code>frame</code> attributes</a> algorithm must be completed as an <a href=#explicit-self-navigation-override id=frames:explicit-self-navigation-override>explicit
- self-navigation override</a> and with the <code id=frames:frame-8><a href=#frame>frame</a></code> element's <a id=frames:node-document href=http://dom.spec.whatwg.org/#concept-node-document data-x-internal=node-document>node document</a>'s
- <a href=#browsing-context id=frames:browsing-context>browsing context</a> as the <a href=#source-browsing-context id=frames:source-browsing-context>source browsing context</a>.</p>
- <p>Furthermore, if the <a href=#active-document id=frames:active-document>active document</a> of the element's <a href=#child-browsing-context id=frames:child-browsing-context-2>child browsing
- context</a> before such a <a href=#navigate id=frames:navigate-3>navigation</a> was not <a href=#completely-loaded id=frames:completely-loaded>completely
- loaded</a> at the time of the new <a href=#navigate id=frames:navigate-4>navigation</a>, then the <a href=#navigate id=frames:navigate-5>navigation</a> must be completed with <a href=#replacement-enabled id=frames:replacement-enabled>replacement enabled</a>.</p>
- <p>Similarly, if the <a href=#child-browsing-context id=frames:child-browsing-context-3>child browsing context</a>'s <a href=#session-history id=frames:session-history>session history</a> contained
- only one <code id=frames:document><a href=#document>Document</a></code> when the <a href=#process-the-frame-attributes id=frames:process-the-frame-attributes-4>process the <code>frame</code> attributes</a>
- algorithm was invoked, and that was the <code id=frames:about:blank-3><a href=#about:blank>about:blank</a></code> <code id=frames:document-2><a href=#document>Document</a></code> created
- when the <a href=#child-browsing-context id=frames:child-browsing-context-4>child browsing context</a> was created, then any <a href=#navigate id=frames:navigate-6>navigation</a> required of the user agent in that algorithm must be completed
- with <a href=#replacement-enabled id=frames:replacement-enabled-2>replacement enabled</a>.</p>
-
- <p>When a <code id=frames:document-3><a href=#document>Document</a></code> in a <code id=frames:frame-9><a href=#frame>frame</a></code> is marked as <a href=#completely-loaded id=frames:completely-loaded-2>completely
- loaded</a>, the user agent must <a href=#queue-a-task id=frames:queue-a-task-2>queue a task</a> to <a href=#fire-a-simple-event id=frames:fire-a-simple-event-2>fire a simple event</a>
- named <code id=frames:event-load-2><a href=#event-load>load</a></code> at the <code id=frames:frame-10><a href=#frame>frame</a></code> element.</p>
- <p>The <a href=#task-source id=frames:task-source>task source</a> for the <a href=#concept-task id=frames:concept-task>tasks</a> above is the
- <a href=#dom-manipulation-task-source id=frames:dom-manipulation-task-source>DOM manipulation task source</a>.</p>
- <p>When a <code id=frames:frame-11><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context id=frames:nested-browsing-context-5>nested browsing context</a>'s <a href=#active-document id=frames:active-document-2>active
- document</a> is not <a href=#ready-for-post-load-tasks id=frames:ready-for-post-load-tasks>ready for post-load tasks</a>, and when anything is <a href=#delay-the-load-event id=frames:delay-the-load-event>delaying the load event</a> of the <code id=frames:frame-12><a href=#frame>frame</a></code> element's
- <a href=#browsing-context id=frames:browsing-context-2>browsing context</a>'s <a href=#active-document id=frames:active-document-3>active document</a>, and when the <code id=frames:frame-13><a href=#frame>frame</a></code>
- element's <a href=#browsing-context id=frames:browsing-context-3>browsing context</a> is in the <a href=#delaying-load-events-mode id=frames:delaying-load-events-mode>delaying <code>load</code> events mode</a>, the <code id=frames:frame-14><a href=#frame>frame</a></code> must <a href=#delay-the-load-event id=frames:delay-the-load-event-2>delay the
- load event</a> of its document.</p>
-
- <p>When the browsing context is created, if a <code>name</code> attribute
- is present, the <a href=#browsing-context-name id=frames:browsing-context-name>browsing context name</a> must be set to the value of this attribute;
- otherwise, the <a href=#browsing-context-name id=frames:browsing-context-name-2>browsing context name</a> must be set to the empty string.</p>
- <p>Whenever the <code>name</code> attribute is set, the nested
- <a href=#browsing-context id=frames:browsing-context-4>browsing context</a>'s <a href=#browsing-context-name id=frames:browsing-context-name-3>name</a> must be changed to
- the new value. If the attribute is removed, the <a href=#browsing-context-name id=frames:browsing-context-name-4>browsing context name</a> must be set to
- the empty string.</p>
- <p>The <code id=frames:frame-15><a href=#frame>frame</a></code> element must implement the <code id=frames:htmlframeelement><a href=#htmlframeelement>HTMLFrameElement</a></code> interface.</p>
- <pre class=idl>interface <dfn id=htmlframeelement>HTMLFrameElement</dfn> : <a href=#htmlelement id=frames:htmlelement-2>HTMLElement</a> {
- attribute DOMString <a href=#dom-frame-name id=frames:dom-frame-name>name</a>;
- attribute DOMString <a href=#dom-frame-scrolling id=frames:dom-frame-scrolling>scrolling</a>;
- attribute DOMString <a href=#dom-frame-src id=frames:dom-frame-src>src</a>;
- attribute DOMString <a href=#dom-frame-frameborder id=frames:dom-frame-frameborder>frameBorder</a>;
- attribute DOMString <a href=#dom-frame-longdesc id=frames:dom-frame-longdesc>longDesc</a>;
- attribute boolean <a href=#dom-frame-noresize id=frames:dom-frame-noresize>noResize</a>;
- readonly attribute <a href=#document id=frames:document-4>Document</a>? <a href=#dom-frame-contentdocument id=frames:dom-frame-contentdocument>contentDocument</a>;
- readonly attribute <a href=#windowproxy id=frames:windowproxy>WindowProxy</a>? <a href=#dom-frame-contentwindow id=frames:dom-frame-contentwindow>contentWindow</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginheight id=frames:dom-frame-marginheight>marginHeight</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-frame-marginwidth id=frames:dom-frame-marginwidth>marginWidth</a>;
- };</pre>
- <p>The <dfn id=dom-frame-name><code>name</code></dfn>, <dfn id=dom-frame-scrolling><code>scrolling</code></dfn>, and <dfn id=dom-frame-src><code>src</code></dfn> IDL attributes of the <code id=frames:frame-16><a href=#frame>frame</a></code> element must
- <a href=#reflect id=frames:reflect-2>reflect</a> the respective content attributes of the same name. For the purposes of
- reflection, the <code id=frames:frame-17><a href=#frame>frame</a></code> element's <code>src</code> content
- attribute is defined as containing a <a href=#url id=frames:url>URL</a>.</p>
- <p>The <dfn id=dom-frame-frameborder><code>frameBorder</code></dfn> IDL attribute of the
- <code id=frames:frame-18><a href=#frame>frame</a></code> element must <a href=#reflect id=frames:reflect-3>reflect</a> the element's <code>frameborder</code> content attribute.</p>
- <p>The <dfn id=dom-frame-longdesc><code>longDesc</code></dfn> IDL attribute of the
- <code id=frames:frame-19><a href=#frame>frame</a></code> element must <a href=#reflect id=frames:reflect-4>reflect</a> the element's <code>longdesc</code> content attribute, which for the purposes
- of reflection is defined as containing a <a href=#url id=frames:url-2>URL</a>.</p>
- <p>The <dfn id=dom-frame-noresize><code>noResize</code></dfn> IDL attribute of the
- <code id=frames:frame-20><a href=#frame>frame</a></code> element must <a href=#reflect id=frames:reflect-5>reflect</a> the element's <code>noresize</code> content attribute.</p>
- <p>The <dfn id=dom-frame-contentdocument><code>contentDocument</code></dfn> IDL attribute of
- the <code id=frames:frame-21><a href=#frame>frame</a></code> element must return the <code id=frames:document-5><a href=#document>Document</a></code> object of the <a href=#active-document id=frames:active-document-4>active
- document</a> of the <code id=frames:frame-22><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context id=frames:nested-browsing-context-6>nested browsing context</a>, if any
- and if its <a href=#effective-script-origin id=frames:effective-script-origin>effective script origin</a> is the <a href=#same-origin id=frames:same-origin>same origin</a> as the
- <a href=#effective-script-origin id=frames:effective-script-origin-2>effective script origin</a> specified by the <a href=#incumbent-settings-object id=frames:incumbent-settings-object>incumbent settings object</a>, or
- null otherwise.</p>
- <p>The <dfn id=dom-frame-contentwindow><code>contentWindow</code></dfn> IDL attribute must
- return the <code id=frames:windowproxy-2><a href=#windowproxy>WindowProxy</a></code> object of the <code id=frames:frame-23><a href=#frame>frame</a></code> element's <a href=#nested-browsing-context id=frames:nested-browsing-context-7>nested
- browsing context</a>.</p>
- <p>The <dfn id=dom-frame-marginheight><code>marginHeight</code></dfn> IDL attribute of the
- <code id=frames:frame-24><a href=#frame>frame</a></code> element must <a href=#reflect id=frames:reflect-6>reflect</a> the element's <code>marginheight</code> content attribute.</p>
- <p>The <dfn id=dom-frame-marginwidth><code>marginWidth</code></dfn> IDL attribute of the
- <code id=frames:frame-25><a href=#frame>frame</a></code> element must <a href=#reflect id=frames:reflect-7>reflect</a> the element's <code>marginwidth</code> content attribute.</p>
- <h4 id=other-elements,-attributes-and-apis>15.3.4 Other elements, attributes and APIs</h4>
- <p>User agents must treat <code id=other-elements,-attributes-and-apis:acronym><a href=#acronym>acronym</a></code> elements in a manner
- equivalent to <code id=other-elements,-attributes-and-apis:the-abbr-element><a href=#the-abbr-element>abbr</a></code> elements in terms of semantics and
- for purposes of rendering.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlanchorelement id=HTMLAnchorElement-partial>HTMLAnchorElement</a> {
- attribute DOMString <a href=#dom-a-coords id=other-elements,-attributes-and-apis:dom-a-coords>coords</a>;
- attribute DOMString <a href=#dom-a-charset id=other-elements,-attributes-and-apis:dom-a-charset>charset</a>;
- attribute DOMString <a href=#dom-a-name id=other-elements,-attributes-and-apis:dom-a-name>name</a>;
- attribute DOMString <a href=#dom-a-rev id=other-elements,-attributes-and-apis:dom-a-rev>rev</a>;
- attribute DOMString <a href=#dom-a-shape id=other-elements,-attributes-and-apis:dom-a-shape>shape</a>;
- };</pre>
- <p>The <dfn id=dom-a-coords><code>coords</code></dfn>, <dfn id=dom-a-charset><code>charset</code></dfn>, <dfn id=dom-a-name><code>name</code></dfn>, <dfn id=dom-a-rev><code>rev</code></dfn>, and <dfn id=dom-a-shape><code>shape</code></dfn> IDL attributes of the
- <code id=other-elements,-attributes-and-apis:the-a-element><a href=#the-a-element>a</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect>reflect</a> the respective
- content attributes of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlareaelement id=HTMLAreaElement-partial>HTMLAreaElement</a> {
- attribute boolean <a href=#dom-area-nohref id=other-elements,-attributes-and-apis:dom-area-nohref>noHref</a>;
- };</pre>
- <p>The <dfn id=dom-area-nohref><code>noHref</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-area-element><a href=#the-area-element>area</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-2>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-area-nohref><a href=#attr-area-nohref>nohref</a></code> content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlbodyelement id=HTMLBodyElement-partial>HTMLBodyElement</a> {
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-text id=other-elements,-attributes-and-apis:dom-body-text>text</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-link id=other-elements,-attributes-and-apis:dom-body-link>link</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-vlink id=other-elements,-attributes-and-apis:dom-body-vlink>vLink</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-alink id=other-elements,-attributes-and-apis:dom-body-alink>aLink</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-body-bgcolor id=other-elements,-attributes-and-apis:dom-body-bgcolor>bgColor</a>;
- attribute DOMString <a href=#dom-body-background id=other-elements,-attributes-and-apis:dom-body-background>background</a>;
- };</pre>
- <p>The <dfn id=dom-body-text><code>text</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-body-element><a href=#the-body-element>body</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-3>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-body-text><a href=#attr-body-text>text</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-body-link><code>link</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-body-element-2><a href=#the-body-element>body</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-4>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-body-link><a href=#attr-body-link>link</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-body-alink><code>aLink</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-body-element-3><a href=#the-body-element>body</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-5>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-body-alink><a href=#attr-body-alink>alink</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-body-vlink><code>vLink</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-body-element-4><a href=#the-body-element>body</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-6>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-body-vlink><a href=#attr-body-vlink>vlink</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-body-bgcolor><code>bgColor</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-body-element-5><a href=#the-body-element>body</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-7>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-body-bgcolor><a href=#attr-body-bgcolor>bgcolor</a></code> content attribute.</p>
- <p>The <dfn id=dom-body-background><code>background</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-body-element-6><a href=#the-body-element>body</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-8>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-background><a href=#attr-background>background</a></code> content attribute. (The <code id=other-elements,-attributes-and-apis:attr-background-2><a href=#attr-background>background</a></code> content is <em>not</em> defined to contain a
- <a href=#url id=other-elements,-attributes-and-apis:url>URL</a>, despite rules regarding its handling in the rendering section above.)</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlbrelement id=HTMLBRElement-partial>HTMLBRElement</a> {
- attribute DOMString <a href=#dom-br-clear id=other-elements,-attributes-and-apis:dom-br-clear>clear</a>;
- };</pre>
- <p>The <dfn id=dom-br-clear><code>clear</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-br-element><a href=#the-br-element>br</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-9>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltablecaptionelement id=HTMLTableCaptionElement-partial>HTMLTableCaptionElement</a> {
- attribute DOMString <a href=#dom-caption-align id=other-elements,-attributes-and-apis:dom-caption-align>align</a>;
- };</pre>
- <p>The <dfn id=dom-caption-align><code>align</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-caption-element><a href=#the-caption-element>caption</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-10>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltablecolelement id=HTMLTableColElement-partial>HTMLTableColElement</a> {
- attribute DOMString <a href=#dom-col-align id=other-elements,-attributes-and-apis:dom-col-align>align</a>;
- attribute DOMString <a href=#dom-col-ch id=other-elements,-attributes-and-apis:dom-col-ch>ch</a>;
- attribute DOMString <a href=#dom-col-choff id=other-elements,-attributes-and-apis:dom-col-choff>chOff</a>;
- attribute DOMString <a href=#dom-col-valign id=other-elements,-attributes-and-apis:dom-col-valign>vAlign</a>;
- attribute DOMString <a href=#dom-col-width id=other-elements,-attributes-and-apis:dom-col-width>width</a>;
- };</pre>
- <p>The <dfn id=dom-col-align><code>align</code></dfn> and <dfn id=dom-col-width><code>width</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-col-element><a href=#the-col-element>col</a></code> element must
- <a href=#reflect id=other-elements,-attributes-and-apis:reflect-11>reflect</a> the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-col-ch><code>ch</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-col-element-2><a href=#the-col-element>col</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-12>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-col-char><a href=#attr-col-char>char</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-col-choff><code>chOff</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-col-element-3><a href=#the-col-element>col</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-13>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-col-charoff><a href=#attr-col-charoff>charoff</a></code>
- content attribute.</p>
- <p>The <dfn id=dom-col-valign><code>vAlign</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-col-element-4><a href=#the-col-element>col</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-14>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-col-valign><a href=#attr-col-valign>valign</a></code>
- content attribute.</p>
- <hr>
- <p>User agents must treat <code id=other-elements,-attributes-and-apis:dir><a href=#dir>dir</a></code> elements in a manner equivalent to <code id=other-elements,-attributes-and-apis:the-ul-element><a href=#the-ul-element>ul</a></code>
- elements in terms of semantics and for purposes of rendering.</p>
- <p>The <code id=other-elements,-attributes-and-apis:dir-2><a href=#dir>dir</a></code> element must implement the <code id=other-elements,-attributes-and-apis:htmldirectoryelement><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code>
- interface.</p>
- <pre class=idl>interface <dfn id=htmldirectoryelement>HTMLDirectoryElement</dfn> : <a href=#htmlelement id=other-elements,-attributes-and-apis:htmlelement>HTMLElement</a> {
- attribute boolean <a href=#dom-dir-compact id=other-elements,-attributes-and-apis:dom-dir-compact>compact</a>;
- };</pre>
- <p>The <dfn id=dom-dir-compact><code>compact</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:dir-3><a href=#dir>dir</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-15>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmldivelement id=HTMLDivElement-partial>HTMLDivElement</a> {
- attribute DOMString <a href=#dom-div-align id=other-elements,-attributes-and-apis:dom-div-align>align</a>;
- };</pre>
- <p>The <dfn id=dom-div-align><code>align</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-div-element><a href=#the-div-element>div</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-16>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmldlistelement id=HTMLDListElement-partial>HTMLDListElement</a> {
- attribute boolean <a href=#dom-dl-compact id=other-elements,-attributes-and-apis:dom-dl-compact>compact</a>;
- };</pre>
- <p>The <dfn id=dom-dl-compact><code>compact</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-dl-element><a href=#the-dl-element>dl</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-17>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlembedelement id=HTMLEmbedElement-partial>HTMLEmbedElement</a> {
- attribute DOMString <a href=#dom-embed-align id=other-elements,-attributes-and-apis:dom-embed-align>align</a>;
- attribute DOMString <a href=#dom-embed-name id=other-elements,-attributes-and-apis:dom-embed-name>name</a>;
- };</pre>
- <p>The <dfn id=dom-embed-name><code>name</code></dfn> and <dfn id=dom-embed-align><code>align</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-embed-element><a href=#the-embed-element>embed</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-18>reflect</a> the respective content attributes of the same name.</p>
- <hr>
- <p>The <code id=other-elements,-attributes-and-apis:font><a href=#font>font</a></code> element must implement the <code id=other-elements,-attributes-and-apis:htmlfontelement><a href=#htmlfontelement>HTMLFontElement</a></code> interface.</p>
- <pre class=idl>interface <dfn id=htmlfontelement>HTMLFontElement</dfn> : <a href=#htmlelement id=other-elements,-attributes-and-apis:htmlelement-2>HTMLElement</a> {
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-font-color id=other-elements,-attributes-and-apis:dom-font-color>color</a>;
- attribute DOMString <a href=#dom-font-face id=other-elements,-attributes-and-apis:dom-font-face>face</a>;
- attribute DOMString <a href=#dom-font-size id=other-elements,-attributes-and-apis:dom-font-size>size</a>;
- };</pre>
- <p>The <dfn id=dom-font-color><code>color</code></dfn>, <dfn id=dom-font-face><code>face</code></dfn>, and <dfn id=dom-font-size><code>size</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:font-2><a href=#font>font</a></code> element must
- <a href=#reflect id=other-elements,-attributes-and-apis:reflect-19>reflect</a> the respective content attributes of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlheadingelement id=HTMLHeadingElement-partial>HTMLHeadingElement</a> {
- attribute DOMString <a href=#dom-hx-align id=other-elements,-attributes-and-apis:dom-hx-align>align</a>;
- };</pre>
- <p>The <dfn id=dom-hx-align><code>align</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>–<code id=other-elements,-attributes-and-apis:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-20>reflect</a> the content attribute of
- the same name.</p>
- <hr>
- <p class=note>The <dfn id=dom-head-profile><code>profile</code></dfn> IDL attribute on
- <code id=other-elements,-attributes-and-apis:the-head-element><a href=#the-head-element>head</a></code> elements (with the <code id=other-elements,-attributes-and-apis:htmlheadelement><a href=#htmlheadelement>HTMLHeadElement</a></code> interface) is intentionally
- omitted. Unless so required by <a href=#other-applicable-specifications id=other-elements,-attributes-and-apis:other-applicable-specifications>another applicable
- specification</a>, implementations would therefore not support this attribute. (It is mentioned
- here as it was defined in a previous version of the DOM specifications.)</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlhrelement id=HTMLHRElement-partial>HTMLHRElement</a> {
- attribute DOMString <a href=#dom-hr-align id=other-elements,-attributes-and-apis:dom-hr-align>align</a>;
- attribute DOMString <a href=#dom-hr-color id=other-elements,-attributes-and-apis:dom-hr-color>color</a>;
- attribute boolean <a href=#dom-hr-noshade id=other-elements,-attributes-and-apis:dom-hr-noshade>noShade</a>;
- attribute DOMString <a href=#dom-hr-size id=other-elements,-attributes-and-apis:dom-hr-size>size</a>;
- attribute DOMString <a href=#dom-hr-width id=other-elements,-attributes-and-apis:dom-hr-width>width</a>;
- };</pre>
- <p>The <dfn id=dom-hr-align><code>align</code></dfn>, <dfn id=dom-hr-color><code>color</code></dfn>, <dfn id=dom-hr-size><code>size</code></dfn>,
- and <dfn id=dom-hr-width><code>width</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-hr-element><a href=#the-hr-element>hr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-21>reflect</a> the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-hr-noshade><code>noShade</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-hr-element-2><a href=#the-hr-element>hr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-22>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-hr-noshade><a href=#attr-hr-noshade>noshade</a></code>
- content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlhtmlelement id=HTMLHtmlElement-partial>HTMLHtmlElement</a> {
- attribute DOMString <a href=#dom-html-version id=other-elements,-attributes-and-apis:dom-html-version>version</a>;
- };</pre>
- <p>The <dfn id=dom-html-version><code>version</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-html-element><a href=#the-html-element>html</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-23>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmliframeelement id=HTMLIFrameElement-partial>HTMLIFrameElement</a> {
- attribute DOMString <a href=#dom-iframe-align id=other-elements,-attributes-and-apis:dom-iframe-align>align</a>;
- attribute DOMString <a href=#dom-iframe-scrolling id=other-elements,-attributes-and-apis:dom-iframe-scrolling>scrolling</a>;
- attribute DOMString <a href=#dom-iframe-frameborder id=other-elements,-attributes-and-apis:dom-iframe-frameborder>frameBorder</a>;
- attribute DOMString <a href=#dom-iframe-longdesc id=other-elements,-attributes-and-apis:dom-iframe-longdesc>longDesc</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginheight id=other-elements,-attributes-and-apis:dom-iframe-marginheight>marginHeight</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-iframe-marginwidth id=other-elements,-attributes-and-apis:dom-iframe-marginwidth>marginWidth</a>;
- };</pre>
- <p>The <dfn id=dom-iframe-align><code>align</code></dfn> and <dfn id=dom-iframe-scrolling><code>scrolling</code></dfn> IDL attributes of the
- <code id=other-elements,-attributes-and-apis:the-iframe-element><a href=#the-iframe-element>iframe</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-24>reflect</a> the respective content attributes of the
- same name.</p>
- <p>The <dfn id=dom-iframe-frameborder><code>frameBorder</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-25>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-iframe-frameborder><a href=#attr-iframe-frameborder>frameborder</a></code> content attribute.</p>
- <p>The <dfn id=dom-iframe-longdesc><code>longDesc</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-26>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-iframe-longdesc><a href=#attr-iframe-longdesc>longdesc</a></code> content attribute, which for the purposes of
- reflection is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-2>URL</a>.</p>
- <p>The <dfn id=dom-iframe-marginheight><code>marginHeight</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-27>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-iframe-marginheight><a href=#attr-iframe-marginheight>marginheight</a></code> content attribute.</p>
- <p>The <dfn id=dom-iframe-marginwidth><code>marginWidth</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-28>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-iframe-marginwidth><a href=#attr-iframe-marginwidth>marginwidth</a></code> content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlimageelement id=HTMLImageElement-partial>HTMLImageElement</a> {
- attribute DOMString <a href=#dom-img-name id=other-elements,-attributes-and-apis:dom-img-name>name</a>;
- attribute DOMString <a href=#dom-img-lowsrc id=other-elements,-attributes-and-apis:dom-img-lowsrc>lowsrc</a>;
- attribute DOMString <a href=#dom-img-align id=other-elements,-attributes-and-apis:dom-img-align>align</a>;
- attribute unsigned long <a href=#dom-img-hspace id=other-elements,-attributes-and-apis:dom-img-hspace>hspace</a>;
- attribute unsigned long <a href=#dom-img-vspace id=other-elements,-attributes-and-apis:dom-img-vspace>vspace</a>;
- attribute DOMString <a href=#dom-img-longdesc id=other-elements,-attributes-and-apis:dom-img-longdesc>longDesc</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-img-border id=other-elements,-attributes-and-apis:dom-img-border>border</a>;
- };</pre>
- <p>The <dfn id=dom-img-name><code>name</code></dfn>, <dfn id=dom-img-align><code>align</code></dfn>, <dfn id=dom-img-border><code>border</code></dfn>, <dfn id=dom-img-hspace><code>hspace</code></dfn>, and <dfn id=dom-img-vspace><code>vspace</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-img-element><a href=#the-img-element>img</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-29>reflect</a> the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-img-longdesc><code>longDesc</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-img-element-2><a href=#the-img-element>img</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-30>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-img-longdesc><a href=#attr-img-longdesc>longdesc</a></code> content attribute, which for the purposes of reflection
- is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-3>URL</a>.</p>
- <p>The <dfn id=dom-img-lowsrc><code>lowsrc</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-img-element-3><a href=#the-img-element>img</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-31>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-img-lowsrc><a href=#attr-img-lowsrc>lowsrc</a></code>
- content attribute, which for the purposes of reflection is defined as containing a
- <a href=#url id=other-elements,-attributes-and-apis:url-4>URL</a>.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlinputelement id=HTMLInputElement-partial>HTMLInputElement</a> {
- attribute DOMString <a href=#dom-input-align id=other-elements,-attributes-and-apis:dom-input-align>align</a>;
- attribute DOMString <a href=#dom-input-usemap id=other-elements,-attributes-and-apis:dom-input-usemap>useMap</a>;
- };</pre>
- <p>The <dfn id=dom-input-align><code>align</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-input-element><a href=#the-input-element>input</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-32>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-input-usemap><code>useMap</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-input-element-2><a href=#the-input-element>input</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-33>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-input-usemap><a href=#attr-input-usemap>usemap</a></code> content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmllegendelement id=HTMLLegendElement-partial>HTMLLegendElement</a> {
- attribute DOMString <a href=#dom-legend-align id=other-elements,-attributes-and-apis:dom-legend-align>align</a>;
- };</pre>
- <p>The <dfn id=dom-legend-align><code>align</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-legend-element><a href=#the-legend-element>legend</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-34>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmllielement id=HTMLLIElement-partial>HTMLLIElement</a> {
- attribute DOMString <a href=#dom-li-type id=other-elements,-attributes-and-apis:dom-li-type>type</a>;
- };</pre>
- <p>The <dfn id=dom-li-type><code>type</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-li-element><a href=#the-li-element>li</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-35>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmllinkelement id=HTMLLinkElement-partial>HTMLLinkElement</a> {
- attribute DOMString <a href=#dom-link-charset id=other-elements,-attributes-and-apis:dom-link-charset>charset</a>;
- attribute DOMString <a href=#dom-link-rev id=other-elements,-attributes-and-apis:dom-link-rev>rev</a>;
- attribute DOMString <a href=#dom-link-target id=other-elements,-attributes-and-apis:dom-link-target>target</a>;
- };</pre>
- <p>The <dfn id=dom-link-charset><code>charset</code></dfn>, <dfn id=dom-link-rev><code>rev</code></dfn>, and <dfn id=dom-link-target><code>target</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-link-element><a href=#the-link-element>link</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-36>reflect</a> the respective content attributes of the same name.</p>
- <hr>
- <p>User agents must treat <code id=other-elements,-attributes-and-apis:listing><a href=#listing>listing</a></code> elements in a manner equivalent to <code id=other-elements,-attributes-and-apis:the-pre-element><a href=#the-pre-element>pre</a></code>
- elements in terms of semantics and for purposes of rendering.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlmenuelement id=HTMLMenuElement-partial>HTMLMenuElement</a> {
- attribute boolean <a href=#dom-menu-compact id=other-elements,-attributes-and-apis:dom-menu-compact>compact</a>;
- };</pre>
- <p>The <dfn id=dom-menu-compact><code>compact</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-menu-element><a href=#the-menu-element>menu</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-37>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlmetaelement id=HTMLMetaElement-partial>HTMLMetaElement</a> {
- attribute DOMString <a href=#dom-meta-scheme id=other-elements,-attributes-and-apis:dom-meta-scheme>scheme</a>;
- };</pre>
- <p>User agents may treat the <code id=other-elements,-attributes-and-apis:attr-meta-scheme><a href=#attr-meta-scheme>scheme</a></code> content attribute on the
- <code id=other-elements,-attributes-and-apis:the-meta-element><a href=#the-meta-element>meta</a></code> element as an extension of the element's <code id=other-elements,-attributes-and-apis:attr-meta-name><a href=#attr-meta-name>name</a></code> content attribute when processing a <code id=other-elements,-attributes-and-apis:the-meta-element-2><a href=#the-meta-element>meta</a></code> element
- with a <code id=other-elements,-attributes-and-apis:attr-meta-name-2><a href=#attr-meta-name>name</a></code> attribute whose value is one that the user agent
- recognizes as supporting the <code id=other-elements,-attributes-and-apis:attr-meta-scheme-2><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>
- <p>User agents are encouraged to ignore the <code id=other-elements,-attributes-and-apis:attr-meta-scheme-3><a href=#attr-meta-scheme>scheme</a></code> attribute
- and instead process the value given to the metadata name as if it had been specified for each
- expected value of the <code id=other-elements,-attributes-and-apis:attr-meta-scheme-4><a href=#attr-meta-scheme>scheme</a></code> attribute.</p>
- <div class=example>
- <p>For example, if the user agent acts on <code id=other-elements,-attributes-and-apis:the-meta-element-3><a href=#the-meta-element>meta</a></code> elements with <code id=other-elements,-attributes-and-apis:attr-meta-name-3><a href=#attr-meta-name>name</a></code> attributes having the value "eGMS.subject.keyword", and knows
- that the <code id=other-elements,-attributes-and-apis:attr-meta-scheme-5><a href=#attr-meta-scheme>scheme</a></code> attribute is used with this metadata name,
- then it could take the <code id=other-elements,-attributes-and-apis:attr-meta-scheme-6><a href=#attr-meta-scheme>scheme</a></code> attribute into account,
- acting as if it was an extension of the <code id=other-elements,-attributes-and-apis:attr-meta-name-4><a href=#attr-meta-name>name</a></code> attribute. Thus
- the following two <code id=other-elements,-attributes-and-apis:the-meta-element-4><a href=#the-meta-element>meta</a></code> elements could be treated as two elements giving values for
- two different metadata names, one consisting of a combination of "eGMS.subject.keyword" and
- "LGCL", and the other consisting of a combination of "eGMS.subject.keyword" and "ORLY":</p>
- <pre class=bad><!-- this markup is invalid -->
- <meta name="eGMS.subject.keyword" scheme="LGCL" content="Abandoned vehicles">
- <meta name="eGMS.subject.keyword" scheme="ORLY" content="Mah car: kthxbye"></pre>
- <p>The suggested processing of this markup, however, would be equivalent to the following:</p>
- <pre><meta name="eGMS.subject.keyword" content="Abandoned vehicles">
- <meta name="eGMS.subject.keyword" content="Mah car: kthxbye"></pre>
- </div>
- <p>The <dfn id=dom-meta-scheme><code>scheme</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-meta-element-5><a href=#the-meta-element>meta</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-38>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlobjectelement id=HTMLObjectElement-partial>HTMLObjectElement</a> {
- attribute DOMString <a href=#dom-object-align id=other-elements,-attributes-and-apis:dom-object-align>align</a>;
- attribute DOMString <a href=#dom-object-archive id=other-elements,-attributes-and-apis:dom-object-archive>archive</a>;
- attribute DOMString <a href=#dom-object-code id=other-elements,-attributes-and-apis:dom-object-code>code</a>;
- attribute boolean <a href=#dom-object-declare id=other-elements,-attributes-and-apis:dom-object-declare>declare</a>;
- attribute unsigned long <a href=#dom-object-hspace id=other-elements,-attributes-and-apis:dom-object-hspace>hspace</a>;
- attribute DOMString <a href=#dom-object-standby id=other-elements,-attributes-and-apis:dom-object-standby>standby</a>;
- attribute unsigned long <a href=#dom-object-vspace id=other-elements,-attributes-and-apis:dom-object-vspace>vspace</a>;
- attribute DOMString <a href=#dom-object-codebase id=other-elements,-attributes-and-apis:dom-object-codebase>codeBase</a>;
- attribute DOMString <a href=#dom-object-codetype id=other-elements,-attributes-and-apis:dom-object-codetype>codeType</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-object-border id=other-elements,-attributes-and-apis:dom-object-border>border</a>;
- };</pre>
- <p>The <dfn id=dom-object-align><code>align</code></dfn>, <dfn id=dom-object-archive><code>archive</code></dfn>, <dfn id=dom-object-border><code>border</code></dfn>, <dfn id=dom-object-code><code>code</code></dfn>, <dfn id=dom-object-declare><code>declare</code></dfn>, <dfn id=dom-object-hspace><code>hspace</code></dfn>, <dfn id=dom-object-standby><code>standby</code></dfn>, and <dfn id=dom-object-vspace><code>vspace</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-object-element><a href=#the-object-element>object</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-39>reflect</a> the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-object-codebase><code>codeBase</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-object-element-2><a href=#the-object-element>object</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-40>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-object-codebase><a href=#attr-object-codebase>codebase</a></code> content attribute, which for the purposes of
- reflection is defined as containing a <a href=#url id=other-elements,-attributes-and-apis:url-5>URL</a>.</p>
- <p>The <dfn id=dom-object-codetype><code>codeType</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-object-element-3><a href=#the-object-element>object</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-41>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-object-codetype><a href=#attr-object-codetype>codetype</a></code> content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlolistelement id=HTMLOListElement-partial>HTMLOListElement</a> {
- attribute boolean <a href=#dom-ol-compact id=other-elements,-attributes-and-apis:dom-ol-compact>compact</a>;
- };</pre>
- <p>The <dfn id=dom-ol-compact><code>compact</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-ol-element><a href=#the-ol-element>ol</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-42>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlparagraphelement id=HTMLParagraphElement-partial>HTMLParagraphElement</a> {
- attribute DOMString <a href=#dom-p-align id=other-elements,-attributes-and-apis:dom-p-align>align</a>;
- };</pre>
- <p>The <dfn id=dom-p-align><code>align</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-p-element><a href=#the-p-element>p</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-43>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlparamelement id=HTMLParamElement-partial>HTMLParamElement</a> {
- attribute DOMString <a href=#dom-param-type id=other-elements,-attributes-and-apis:dom-param-type>type</a>;
- attribute DOMString <a href=#dom-param-valuetype id=other-elements,-attributes-and-apis:dom-param-valuetype>valueType</a>;
- };</pre>
- <p>The <dfn id=dom-param-type><code>type</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-param-element><a href=#the-param-element>param</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-44>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-param-valuetype><code>valueType</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-param-element-2><a href=#the-param-element>param</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-45>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-param-valuetype><a href=#attr-param-valuetype>valuetype</a></code> content attribute.</p>
- <hr>
- <p>User agents must treat <code id=other-elements,-attributes-and-apis:plaintext><a href=#plaintext>plaintext</a></code> elements in a manner equivalent to
- <code id=other-elements,-attributes-and-apis:the-pre-element-2><a href=#the-pre-element>pre</a></code> elements in terms of semantics and for purposes of rendering. (The parser has
- special behavior for this element, though.)</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlpreelement id=HTMLPreElement-partial>HTMLPreElement</a> {
- attribute long <a href=#dom-pre-width id=other-elements,-attributes-and-apis:dom-pre-width>width</a>;
- };</pre>
- <p>The <dfn id=dom-pre-width><code>width</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-pre-element-3><a href=#the-pre-element>pre</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-46>reflect</a> the content attribute of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlscriptelement id=HTMLScriptElement-partial>HTMLScriptElement</a> {
- attribute DOMString <a href=#dom-script-event id=other-elements,-attributes-and-apis:dom-script-event>event</a>;
- attribute DOMString <a href=#dom-script-htmlfor id=other-elements,-attributes-and-apis:dom-script-htmlfor>htmlFor</a>;
- };</pre>
- <p>The <dfn id=dom-script-event><code>event</code></dfn> and <dfn id=dom-script-htmlfor><code>htmlFor</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-script-element><a href=#the-script-element>script</a></code>
- element must return the empty string on getting, and do nothing on setting.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltableelement id=HTMLTableElement-partial>HTMLTableElement</a> {
- attribute DOMString <a href=#dom-table-align id=other-elements,-attributes-and-apis:dom-table-align>align</a>;
- attribute DOMString <a href=#dom-table-border id=other-elements,-attributes-and-apis:dom-table-border>border</a>;
- attribute DOMString <a href=#dom-table-frame id=other-elements,-attributes-and-apis:dom-table-frame>frame</a>;
- attribute DOMString <a href=#dom-table-rules id=other-elements,-attributes-and-apis:dom-table-rules>rules</a>;
- attribute DOMString <a href=#dom-table-summary id=other-elements,-attributes-and-apis:dom-table-summary>summary</a>;
- attribute DOMString <a href=#dom-table-width id=other-elements,-attributes-and-apis:dom-table-width>width</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-bgcolor id=other-elements,-attributes-and-apis:dom-table-bgcolor>bgColor</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellpadding id=other-elements,-attributes-and-apis:dom-table-cellpadding>cellPadding</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-table-cellspacing id=other-elements,-attributes-and-apis:dom-table-cellspacing>cellSpacing</a>;
- };</pre>
- <p>The <dfn id=dom-table-align><code>align</code></dfn>, <dfn id=dom-table-border><code>border</code></dfn>, <dfn id=dom-table-frame><code>frame</code></dfn>, <dfn id=dom-table-summary><code>summary</code></dfn>, <dfn id=dom-table-rules><code>rules</code></dfn>, and <dfn id=dom-table-width><code>width</code></dfn>, IDL attributes of the <code id=other-elements,-attributes-and-apis:the-table-element><a href=#the-table-element>table</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-47>reflect</a> the respective content attributes of the same name.</p>
- <p>The <dfn id=dom-table-bgcolor><code>bgColor</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-table-element-2><a href=#the-table-element>table</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-48>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-table-bgcolor><a href=#attr-table-bgcolor>bgcolor</a></code> content attribute.</p>
- <p>The <dfn id=dom-table-cellpadding><code>cellPadding</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-table-element-3><a href=#the-table-element>table</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-49>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-table-cellpadding><a href=#attr-table-cellpadding>cellpadding</a></code> content attribute.</p>
- <p>The <dfn id=dom-table-cellspacing><code>cellSpacing</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-table-element-4><a href=#the-table-element>table</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-50>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-table-cellspacing><a href=#attr-table-cellspacing>cellspacing</a></code> content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltablesectionelement id=HTMLTableSectionElement-partial>HTMLTableSectionElement</a> {
- attribute DOMString <a href=#dom-tbody-align id=other-elements,-attributes-and-apis:dom-tbody-align>align</a>;
- attribute DOMString <a href=#dom-tbody-ch id=other-elements,-attributes-and-apis:dom-tbody-ch>ch</a>;
- attribute DOMString <a href=#dom-tbody-choff id=other-elements,-attributes-and-apis:dom-tbody-choff>chOff</a>;
- attribute DOMString <a href=#dom-tbody-valign id=other-elements,-attributes-and-apis:dom-tbody-valign>vAlign</a>;
- };</pre>
- <p>The <dfn id=dom-tbody-align><code>align</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-tbody-element><a href=#the-tbody-element>tbody</a></code>, <code id=other-elements,-attributes-and-apis:the-thead-element><a href=#the-thead-element>thead</a></code>, and <code id=other-elements,-attributes-and-apis:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-51>reflect</a>
- the content attribute of the same name.</p>
- <p>The <dfn id=dom-tbody-ch><code>ch</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code>,
- <code id=other-elements,-attributes-and-apis:the-thead-element-2><a href=#the-thead-element>thead</a></code>, and <code id=other-elements,-attributes-and-apis:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-52>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tbody-char><a href=#attr-tbody-char>char</a></code> content attributes.</p>
- <p>The <dfn id=dom-tbody-choff><code>chOff</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>, <code id=other-elements,-attributes-and-apis:the-thead-element-3><a href=#the-thead-element>thead</a></code>, and <code id=other-elements,-attributes-and-apis:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-53>reflect</a>
- the elements' <code id=other-elements,-attributes-and-apis:attr-tbody-charoff><a href=#attr-tbody-charoff>charoff</a></code> content attributes.</p>
- <p>The <dfn id=dom-tbody-valign><code>vAlign</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-tbody-element-4><a href=#the-tbody-element>tbody</a></code>, <code id=other-elements,-attributes-and-apis:the-thead-element-4><a href=#the-thead-element>thead</a></code>, and <code id=other-elements,-attributes-and-apis:the-tfoot-element-4><a href=#the-tfoot-element>tfoot</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-54>reflect</a>
- the elements' <code id=other-elements,-attributes-and-apis:attr-tbody-valign><a href=#attr-tbody-valign>valign</a></code> content attributes.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltablecellelement id=HTMLTableCellElement-partial>HTMLTableCellElement</a> {
- attribute DOMString <a href=#dom-tdth-align id=other-elements,-attributes-and-apis:dom-tdth-align>align</a>;
- attribute DOMString <a href=#dom-tdth-axis id=other-elements,-attributes-and-apis:dom-tdth-axis>axis</a>;
- attribute DOMString <a href=#dom-tdth-height id=other-elements,-attributes-and-apis:dom-tdth-height>height</a>;
- attribute DOMString <a href=#dom-tdth-width id=other-elements,-attributes-and-apis:dom-tdth-width>width</a>;
- attribute DOMString <a href=#dom-tdth-ch id=other-elements,-attributes-and-apis:dom-tdth-ch>ch</a>;
- attribute DOMString <a href=#dom-tdth-choff id=other-elements,-attributes-and-apis:dom-tdth-choff>chOff</a>;
- attribute boolean <a href=#dom-tdth-nowrap id=other-elements,-attributes-and-apis:dom-tdth-nowrap>noWrap</a>;
- attribute DOMString <a href=#dom-tdth-valign id=other-elements,-attributes-and-apis:dom-tdth-valign>vAlign</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tdth-bgcolor id=other-elements,-attributes-and-apis:dom-tdth-bgcolor>bgColor</a>;
- };</pre>
- <p>The <dfn id=dom-tdth-align><code>align</code></dfn>, <dfn id=dom-tdth-axis><code>axis</code></dfn>, <dfn id=dom-tdth-height><code>height</code></dfn>, and <dfn id=dom-tdth-width><code>width</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-td-element><a href=#the-td-element>td</a></code> and
- <code id=other-elements,-attributes-and-apis:the-th-element><a href=#the-th-element>th</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-55>reflect</a> the respective content attributes of the same
- name.</p>
- <p>The <dfn id=dom-tdth-ch><code>ch</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-td-element-2><a href=#the-td-element>td</a></code> and
- <code id=other-elements,-attributes-and-apis:the-th-element-2><a href=#the-th-element>th</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-56>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tdth-char><a href=#attr-tdth-char>char</a></code> content attributes.</p>
- <p>The <dfn id=dom-tdth-choff><code>chOff</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-td-element-3><a href=#the-td-element>td</a></code>
- and <code id=other-elements,-attributes-and-apis:the-th-element-3><a href=#the-th-element>th</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-57>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tdth-charoff><a href=#attr-tdth-charoff>charoff</a></code> content attributes.</p>
- <p>The <dfn id=dom-tdth-nowrap><code>noWrap</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-td-element-4><a href=#the-td-element>td</a></code>
- and <code id=other-elements,-attributes-and-apis:the-th-element-4><a href=#the-th-element>th</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-58>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tdth-nowrap><a href=#attr-tdth-nowrap>nowrap</a></code> content attributes.</p>
- <p>The <dfn id=dom-tdth-valign><code>vAlign</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-td-element-5><a href=#the-td-element>td</a></code>
- and <code id=other-elements,-attributes-and-apis:the-th-element-5><a href=#the-th-element>th</a></code> element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-59>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tdth-valign><a href=#attr-tdth-valign>valign</a></code> content attributes.</p>
- <p>The <dfn id=dom-tdth-bgcolor><code>bgColor</code></dfn> IDL attribute of the
- <code id=other-elements,-attributes-and-apis:the-td-element-6><a href=#the-td-element>td</a></code> and <code id=other-elements,-attributes-and-apis:the-th-element-6><a href=#the-th-element>th</a></code> elements must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-60>reflect</a> the elements' <code id=other-elements,-attributes-and-apis:attr-tdth-bgcolor><a href=#attr-tdth-bgcolor>bgcolor</a></code> content attributes.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltabledatacellelement id=HTMLTableDataCellElement-partial>HTMLTableDataCellElement</a> {
- attribute DOMString <a href=#dom-td-abbr id=other-elements,-attributes-and-apis:dom-td-abbr>abbr</a>;
- };</pre>
- <p>The <dfn id=dom-td-abbr><code>abbr</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-td-element-7><a href=#the-td-element>td</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-61>reflect</a> the respective content attributes of the same name.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmltablerowelement id=HTMLTableRowElement-partial>HTMLTableRowElement</a> {
- attribute DOMString <a href=#dom-tr-align id=other-elements,-attributes-and-apis:dom-tr-align>align</a>;
- attribute DOMString <a href=#dom-tr-ch id=other-elements,-attributes-and-apis:dom-tr-ch>ch</a>;
- attribute DOMString <a href=#dom-tr-choff id=other-elements,-attributes-and-apis:dom-tr-choff>chOff</a>;
- attribute DOMString <a href=#dom-tr-valign id=other-elements,-attributes-and-apis:dom-tr-valign>vAlign</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-tr-bgcolor id=other-elements,-attributes-and-apis:dom-tr-bgcolor>bgColor</a>;
- };</pre>
- <p>The <dfn id=dom-tr-align><code>align</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tr-element><a href=#the-tr-element>tr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-62>reflect</a> the content attribute of the same name.</p>
- <p>The <dfn id=dom-tr-ch><code>ch</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tr-element-2><a href=#the-tr-element>tr</a></code> element
- must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-63>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-tr-char><a href=#attr-tr-char>char</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-tr-choff><code>chOff</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tr-element-3><a href=#the-tr-element>tr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-64>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-tr-charoff><a href=#attr-tr-charoff>charoff</a></code>
- content attribute.</p>
- <p>The <dfn id=dom-tr-valign><code>vAlign</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tr-element-4><a href=#the-tr-element>tr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-65>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-tr-valign><a href=#attr-tr-valign>valign</a></code> content
- attribute.</p>
- <p>The <dfn id=dom-tr-bgcolor><code>bgColor</code></dfn> IDL attribute of the <code id=other-elements,-attributes-and-apis:the-tr-element-5><a href=#the-tr-element>tr</a></code>
- element must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-66>reflect</a> the element's <code id=other-elements,-attributes-and-apis:attr-tr-bgcolor><a href=#attr-tr-bgcolor>bgcolor</a></code>
- content attribute.</p>
- <hr>
- <pre class=idl>partial interface <a href=#htmlulistelement id=HTMLUListElement-partial>HTMLUListElement</a> {
- attribute boolean <a href=#dom-ul-compact id=other-elements,-attributes-and-apis:dom-ul-compact>compact</a>;
- attribute DOMString <a href=#dom-ul-type id=other-elements,-attributes-and-apis:dom-ul-type>type</a>;
- };</pre>
- <p>The <dfn id=dom-ul-compact><code>compact</code></dfn> and <dfn id=dom-ul-type><code>type</code></dfn> IDL attributes of the <code id=other-elements,-attributes-and-apis:the-ul-element-2><a href=#the-ul-element>ul</a></code> element must
- <a href=#reflect id=other-elements,-attributes-and-apis:reflect-67>reflect</a> the respective content attributes of the same name.</p>
- <hr>
- <p>User agents must treat <code id=other-elements,-attributes-and-apis:xmp><a href=#xmp>xmp</a></code> elements in a manner equivalent to <code id=other-elements,-attributes-and-apis:the-pre-element-4><a href=#the-pre-element>pre</a></code>
- elements in terms of semantics and for purposes of rendering. (The parser has special behavior for
- this element though.)</p>
- <hr>
- <p>The <code id=other-elements,-attributes-and-apis:blink><a href=#blink>blink</a></code>, <code id=other-elements,-attributes-and-apis:bgsound><a href=#bgsound>bgsound</a></code>, <code id=other-elements,-attributes-and-apis:isindex-2><a href=#isindex-2>isindex</a></code>, <code id=other-elements,-attributes-and-apis:multicol><a href=#multicol>multicol</a></code>,
- <code id=other-elements,-attributes-and-apis:nextid><a href=#nextid>nextid</a></code>, <code id=other-elements,-attributes-and-apis:rb><a href=#rb>rb</a></code>, and <code id=other-elements,-attributes-and-apis:spacer><a href=#spacer>spacer</a></code> elements must use the
- <code id=other-elements,-attributes-and-apis:htmlunknownelement><a href=#htmlunknownelement>HTMLUnknownElement</a></code> interface.</p>
- <hr>
- <pre class=idl>partial interface <a href=#document id=Document-partial>Document</a> {
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-fgcolor id=other-elements,-attributes-and-apis:dom-document-fgcolor>fgColor</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-linkcolor id=other-elements,-attributes-and-apis:dom-document-linkcolor>linkColor</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-vlinkcolor id=other-elements,-attributes-and-apis:dom-document-vlinkcolor>vlinkColor</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-alinkcolor id=other-elements,-attributes-and-apis:dom-document-alinkcolor>alinkColor</a>;
- [TreatNullAs=EmptyString] attribute DOMString <a href=#dom-document-bgcolor id=other-elements,-attributes-and-apis:dom-document-bgcolor>bgColor</a>;
- readonly attribute <a href=#htmlcollection id=other-elements,-attributes-and-apis:htmlcollection>HTMLCollection</a> <a href=#dom-document-anchors id=other-elements,-attributes-and-apis:dom-document-anchors>anchors</a>;
- readonly attribute <a href=#htmlcollection id=other-elements,-attributes-and-apis:htmlcollection-2>HTMLCollection</a> <a href=#dom-document-applets id=other-elements,-attributes-and-apis:dom-document-applets>applets</a>;
- void <a href=#dom-document-clear id=other-elements,-attributes-and-apis:dom-document-clear>clear</a>();
- void <a href=#dom-document-captureevents id=other-elements,-attributes-and-apis:dom-document-captureevents>captureEvents</a>();
- void <a href=#dom-document-releaseevents id=other-elements,-attributes-and-apis:dom-document-releaseevents>releaseEvents</a>();
- readonly attribute <a href=#htmlallcollection-2 id=other-elements,-attributes-and-apis:htmlallcollection-2>HTMLAllCollection</a> <a href=#dom-document-all id=other-elements,-attributes-and-apis:dom-document-all>all</a>;
- };</pre>
- <p>The attributes of the <code id=other-elements,-attributes-and-apis:document><a href=#document>Document</a></code> object listed in the first column of the following
- table must <a href=#reflect id=other-elements,-attributes-and-apis:reflect-68>reflect</a> the content attribute on <a href=#the-body-element-2 id=other-elements,-attributes-and-apis:the-body-element-2-2>the body element</a> with the
- name given in the corresponding cell in the second column on the same row, if <a href=#the-body-element-2 id=other-elements,-attributes-and-apis:the-body-element-2-3>the body
- element</a> is a <code id=other-elements,-attributes-and-apis:the-body-element-7><a href=#the-body-element>body</a></code> element (as opposed to a <code id=other-elements,-attributes-and-apis:frameset><a href=#frameset>frameset</a></code> element).
- When there is no <a href=#the-body-element-2 id=other-elements,-attributes-and-apis:the-body-element-2-4>body element</a> or if it is a
- <code id=other-elements,-attributes-and-apis:frameset-2><a href=#frameset>frameset</a></code> element, the attributes must instead return the empty string on getting and
- do nothing on setting.</p>
- <table><thead><tr><th> IDL attribute
- <th> Content attribute
- <tbody><tr><td><dfn id=dom-document-fgcolor><code>fgColor</code></dfn>
- <td><code id=other-elements,-attributes-and-apis:attr-body-text-2><a href=#attr-body-text>text</a></code>
- <tr><td><dfn id=dom-document-linkcolor><code>linkColor</code></dfn>
- <td><code id=other-elements,-attributes-and-apis:attr-body-link-2><a href=#attr-body-link>link</a></code>
- <tr><td><dfn id=dom-document-vlinkcolor><code>vlinkColor</code></dfn>
- <td><code id=other-elements,-attributes-and-apis:attr-body-vlink-2><a href=#attr-body-vlink>vlink</a></code>
- <tr><td><dfn id=dom-document-alinkcolor><code>alinkColor</code></dfn>
- <td><code id=other-elements,-attributes-and-apis:attr-body-alink-2><a href=#attr-body-alink>alink</a></code>
- <tr><td><dfn id=dom-document-bgcolor><code>bgColor</code></dfn>
- <td><code id=other-elements,-attributes-and-apis:attr-body-bgcolor-2><a href=#attr-body-bgcolor>bgcolor</a></code>
- </table>
- <hr>
- <p>The <dfn id=dom-document-anchors><code>anchors</code></dfn> attribute must return an
- <code id=other-elements,-attributes-and-apis:htmlcollection-3><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=other-elements,-attributes-and-apis:document-2><a href=#document>Document</a></code> node, whose filter matches only
- <code id=other-elements,-attributes-and-apis:the-a-element-2><a href=#the-a-element>a</a></code> elements with <code id=other-elements,-attributes-and-apis:attr-a-name><a href=#attr-a-name>name</a></code> attributes.</p>
- <p>The <dfn id=dom-document-applets><code>applets</code></dfn> attribute must return an
- <code id=other-elements,-attributes-and-apis:htmlcollection-4><a href=#htmlcollection>HTMLCollection</a></code> rooted at the <code id=other-elements,-attributes-and-apis:document-3><a href=#document>Document</a></code> node, whose filter matches only
- <code id=other-elements,-attributes-and-apis:the-applet-element><a href=#the-applet-element>applet</a></code> elements.</p>
- <p>The <dfn id=dom-document-clear><code>clear()</code></dfn>, <dfn id=dom-document-captureevents><code>captureEvents()</code></dfn>, and <dfn id=dom-document-releaseevents><code>releaseEvents()</code></dfn> methods must do nothing.</p>
- <hr>
- <p>The <dfn id=dom-document-all><code>all</code></dfn> attribute must return an
- <code id=other-elements,-attributes-and-apis:htmlallcollection-2-2><a href=#htmlallcollection-2>HTMLAllCollection</a></code> rooted at the <code id=other-elements,-attributes-and-apis:document-4><a href=#document>Document</a></code> node, whose filter matches all
- elements.</p>
- <p>The object returned for <code id=other-elements,-attributes-and-apis:dom-document-all-2><a href=#dom-document-all>all</a></code> has several unusual
- behaviors:</p>
- <ul><li><p>The user agent must act as if the ToBoolean() operator in JavaScript converts the object
- returned for <code id=other-elements,-attributes-and-apis:dom-document-all-3><a href=#dom-document-all>all</a></code> to the false value.<li><p>The user agent must act as if, for the purposes of the <code>==</code> and <code>!=</code> operators in JavaScript, the object returned for <code id=other-elements,-attributes-and-apis:dom-document-all-4><a href=#dom-document-all>all</a></code> compares as equal to the <code>undefined</code> and
- <code>null</code> values. (Comparisons using the <code>===</code> operator, and
- comparisons to other values such as strings or objects, are unaffected.)<li><p>The user agent must act such that the <code>typeof</code> operator in JavaScript
- returns the string <code>undefined</code> when applied to the object returned for <code id=other-elements,-attributes-and-apis:dom-document-all-5><a href=#dom-document-all>all</a></code>.</ul>
- <p class=note>These requirements are a <a href=#willful-violation id=other-elements,-attributes-and-apis:willful-violation>willful violation</a> of the JavaScript
- specification current at the time of writing (ECMAScript edition 5). The JavaScript specification
- requires that the ToBoolean() operator convert all objects to the true value, and does not have
- provisions for objects acting as if they were <code>undefined</code> for the purposes of
- certain operators. This violation is motivated by a desire for compatibility with two classes of
- legacy content: one that uses the presence of <code id=other-elements,-attributes-and-apis:dom-document-all-6><a href=#dom-document-all>document.all</a></code>
- as a way to detect legacy user agents, and one that only supports those legacy user agents and
- uses the <code id=other-elements,-attributes-and-apis:dom-document-all-7><a href=#dom-document-all>document.all</a></code> object without testing for its
- presence first. <a href=#refsECMA262>[ECMA262]</a></p>
- <hr>
- <pre class=idl>partial interface <a href=#window id=Window-partial>Window</a> {
- void <a href=#dom-window-captureevents id=other-elements,-attributes-and-apis:dom-window-captureevents>captureEvents</a>();
- void <a href=#dom-window-releaseevents id=other-elements,-attributes-and-apis:dom-window-releaseevents>releaseEvents</a>();
- };</pre>
- <p>The <dfn id=dom-window-captureevents><code>captureEvents()</code></dfn> and <dfn id=dom-window-releaseevents><code>releaseEvents()</code></dfn> methods must do nothing.</p>
-
- <h2 id=iana>16 IANA considerations</h2>
-
- <h3 id=text/html>16.1 <dfn><code>text/html</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
-
- <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>html<dt>Required parameters:<dd>No required parameters<dt>Optional parameters:<dd>
- <dl><dt><code>charset</code><dd>
- <p>The <code>charset</code> parameter may be provided to specify the
- <a href="#document's-character-encoding" id="text/html:document's-character-encoding">document's character encoding</a>, overriding any <a href=#character-encoding-declaration id=text/html:character-encoding-declaration>character encoding declarations</a> in the document other than a Byte Order Mark (BOM). The parameter's value
- must be one of the <a href=#encoding-label id=text/html:encoding-label>labels</a> of the <a href=#encoding id=text/html:encoding>character encoding</a> used to serialise the file. <a href=#refsENCODING>[ENCODING]</a></p>
- </dl>
- <dt>Encoding considerations:<dd>
- 8bit (see the section on <a href=#character-encoding-declaration id=text/html:character-encoding-declaration-2>character encoding
- declarations</a>)
- <dt>Security considerations:<dd>
- <p>Entire novels have been written about the security considerations that apply to HTML
- documents. Many are listed in this document, to which the reader is referred for more details.
- Some general concerns bear mentioning here, however:</p>
- <p>HTML is scripted language, and has a large number of APIs (some of which are described in
- this document). Script can expose the user to potential risks of information leakage, credential
- leakage, cross-site scripting attacks, cross-site request forgeries, and a host of other
- problems. While the designs in this specification are intended to be safe if implemented
- correctly, a full implementation is a massive undertaking and, as with any software, user agents
- are likely to have security bugs.</p>
- <p>Even without scripting, there are specific features in HTML which, for historical reasons,
- are required for broad compatibility with legacy content but that expose the user to unfortunate
- security problems. In particular, the <code id=text/html:the-img-element><a href=#the-img-element>img</a></code> element can be used in conjunction with
- some other features as a way to effect a port scan from the user's location on the Internet.
- This can expose local network topologies that the attacker would otherwise not be able to
- determine.</p>
- <p>HTML relies on a compartmentalization scheme sometimes known as the <i>same-origin
- policy</i>. An <a href=#origin-2 id=text/html:origin-2>origin</a> in most cases consists of all the pages served from the same
- host, on the same port, using the same protocol.</p>
- <p>It is critical, therefore, to ensure that any untrusted content that forms part of a site be
- hosted on a different <a href=#origin-2 id=text/html:origin-2-2>origin</a> than any sensitive content on that site. Untrusted
- content can easily spoof any other page on the same origin, read data from that origin, cause
- scripts in that origin to execute, submit forms to and from that origin even if they are
- protected from cross-site request forgery attacks by unique tokens, and make use of any
- third-party resources exposed to or rights granted to that origin.</p>
- <dt>Interoperability considerations:<dd>
- Rules for processing both conforming and non-conforming content
- are defined in this specification.
- <dt>Published specification:<dd id=authors-using-html>
- This document is the relevant specification. Labeling a resource
- with the <code id=text/html:text/html><a href=#text/html>text/html</a></code> type asserts that the resource is
- an <a href=#html-documents id=text/html:html-documents>HTML document</a> using
- <a href=#syntax id=text/html:syntax>the HTML syntax</a>.
- <dt>Applications that use this media type:<dd>
- Web browsers, tools for processing Web content, HTML authoring
- tools, search engines, validators.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>No sequence of bytes can uniquely identify an HTML
- document. More information on detecting HTML documents is
- available in the MIME Sniffing specification. <a href=#refsMIMESNIFF>[MIMESNIFF]</a><dt>File extension(s):<dd>"<code>html</code>" and "<code>htm</code>"
- are commonly, but certainly not exclusively, used as the
- extension for HTML documents.<dt>Macintosh file type code(s):<dd><code>TEXT</code></dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers used with <code id=text/html:text/html-2><a href=#text/html>text/html</a></code> resources either refer to <a href=#the-indicated-part-of-the-document id=text/html:the-indicated-part-of-the-document>the
- indicated part of the document</a> or provide state information for in-page scripts.</p>
- <h3 id=multipart/x-mixed-replace>16.2 <dfn><code>multipart/x-mixed-replace</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>multipart<dt>Subtype name:<dd>x-mixed-replace<dt>Required parameters:<dd>
- <ul class=brief><li><code>boundary</code> (defined in RFC2046) <a href=#refsRFC2046>[RFC2046]</a>
- </ul>
- <dt>Optional parameters:<dd>No optional parameters.<dt>Encoding considerations:<dd>binary<dt>Security considerations:<dd>
- Subresources of a <code id=multipart/x-mixed-replace:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code>
- resource can be of any type, including types with non-trivial
- security implications such as <code id=multipart/x-mixed-replace:text/html><a href=#text/html>text/html</a></code>.
- <dt>Interoperability considerations:<dd>
- None.
- <dt>Published specification:<dd>
- This specification describes processing rules for Web browsers.
- Conformance requirements for generating resources with this type are the same as for <code id=multipart/x-mixed-replace:multipart/mixed><a href=#multipart/mixed>multipart/mixed</a></code>. <a href=#refsRFC2046>[RFC2046]</a>
- <dt>Applications that use this media type:<dd>
- This type is intended to be used in resources generated by Web servers, for consumption by Web browsers.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>No sequence of bytes can uniquely identify a <code id=multipart/x-mixed-replace:multipart/x-mixed-replace-2><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> resource.<dt>File extension(s):<dd>No specific file extensions are recommended for this type.<dt>Macintosh file type code(s):<dd>No specific Macintosh file type codes are recommended for this type.</dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers used with <code id=multipart/x-mixed-replace:multipart/x-mixed-replace-3><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code> resources apply to each
- body part as defined by the type used by that body part.</p>
- <h3 id=application/xhtml+xml>16.3 <dfn><code>application/xhtml+xml</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
-
- <dl><dt>Type name:<dd>application<dt>Subtype name:<dd>xhtml+xml<dt>Required parameters:<dd>Same as for <code id=application/xhtml+xml:application/xml><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>Optional parameters:<dd>Same as for <code id=application/xhtml+xml:application/xml-2><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>Encoding considerations:<dd>Same as for <code id=application/xhtml+xml:application/xml-3><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>Security considerations:<dd>Same as for <code id=application/xhtml+xml:application/xml-4><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>Interoperability considerations:<dd>Same as for <code id=application/xhtml+xml:application/xml-5><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt id=authors-using-xhtml>Published specification:<dd>
- Labeling a resource with the <code id=application/xhtml+xml:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code>
- type asserts that the resource is an XML document that likely has
- a root element from the <a href=#html-namespace-2 id=application/xhtml+xml:html-namespace-2>HTML namespace</a>. Thus, the
- relevant specifications are the XML specification, the Namespaces
- in XML specification, and this specification. <a href=#refsXML>[XML]</a> <a href=#refsXMLNS>[XMLNS]</a>
- <dt>Applications that use this media type:<dd>Same as for <code id=application/xhtml+xml:application/xml-6><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>Same as for <code id=application/xhtml+xml:application/xml-7><a href=#application/xml>application/xml</a></code> <a href=#refsRFC3023>[RFC3023]</a><dt>File extension(s):<dd>"<code>xhtml</code>" and "<code>xht</code>"
- are sometimes used as extensions for XML resources that have a
- root element from the <a href=#html-namespace-2 id=application/xhtml+xml:html-namespace-2-2>HTML namespace</a>.<dt>Macintosh file type code(s):<dd><code>TEXT</code></dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers used with <code id=application/xhtml+xml:application/xhtml+xml-2><a href=#application/xhtml+xml>application/xhtml+xml</a></code> resources have the same
- semantics as with any <a href=#xml-mime-type id=application/xhtml+xml:xml-mime-type>XML MIME type</a>. <a href=#refsRFC3023>[RFC3023]</a></p>
- <h3 id=application/x-www-form-urlencoded>16.4 <dfn><code>application/x-www-form-urlencoded</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>application<dt>Subtype name:<dd>x-www-form-urlencoded<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>No parameters<dt>Encoding considerations:<dd>7bit (US-ASCII encoding of octets that themselves can be encoding text using any <a href=#ascii-compatible-character-encoding id=application/x-www-form-urlencoded:ascii-compatible-character-encoding>ASCII-compatible character encoding</a>)<dt>Security considerations:<dd>
- <p>In isolation, an <code id=application/x-www-form-urlencoded:application/x-www-form-urlencoded><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code>
- payload poses no security risks. However, as this type is usually
- used as part of a form submission, all the risks that apply to
- HTML forms need to be considered in the context of this type.</p>
- <dt>Interoperability considerations:<dd>
- Rules for generating and processing
- <code id=application/x-www-form-urlencoded:application/x-www-form-urlencoded-2><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> payloads are
- defined in this specification.
- <dt>Published specification:<dd>
- This document is the relevant specification.
- Algorithms for <a href=#application/x-www-form-urlencoded-encoding-algorithm id=application/x-www-form-urlencoded:application/x-www-form-urlencoded-encoding-algorithm>encoding</a>
- and <a href=#application/x-www-form-urlencoded-decoding-algorithm id=application/x-www-form-urlencoded:application/x-www-form-urlencoded-decoding-algorithm>decoding</a> are defined.
- <dt>Applications that use this media type:<dd>
- Web browsers and servers.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>There is no reliable mechanism for recognising <code id=application/x-www-form-urlencoded:application/x-www-form-urlencoded-3><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code> payloads.<dt>File extension(s):<dd>Not applicable.<dt>Macintosh file type code(s):<dd>Not applicable.</dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>This type is only intended to be used to describe HTML form
- submission payloads.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers have no meaning with the <code id=application/x-www-form-urlencoded:application/x-www-form-urlencoded-4><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code>
- type.</p>
- <h3 id=text/cache-manifest>16.5 <dfn><code>text/cache-manifest</code></dfn></h3>
- <p>This registration is for community review and will be submitted
- to the IESG for review, approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>cache-manifest<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
- <dl><dt><code>charset</code><dd>
- <p>The <code>charset</code> parameter may be provided. The parameter's value must be
- "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
- compatibility with legacy servers.</p>
- </dl>
- <dt>Encoding considerations:<dd>8bit (always UTF-8)<dt>Security considerations:<dd>
- <p>Cache manifests themselves pose no immediate risk unless
- sensitive information is included within the
- manifest. Implementations, however, are required to follow
- specific rules when populating a cache based on a cache manifest,
- to ensure that certain origin-based restrictions are
- honored. Failure to correctly implement these rules can result in
- information leakage, cross-site scripting attacks, and the
- like.</p>
- <dt>Interoperability considerations:<dd>
- Rules for processing both conforming and non-conforming content
- are defined in this specification.
- <dt>Published specification:<dd>
- This document is the relevant specification.
- <dt>Applications that use this media type:<dd>
- Web browsers.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>Cache manifests begin with the string "<code>CACHE
- MANIFEST</code>", followed by either a U+0020 SPACE character, a
- U+0009 CHARACTER TABULATION (tab) character, a U+000A LINE FEED
- (LF) character, or a U+000D CARRIAGE RETURN (CR) character.<dt>File extension(s):<dd>"<code>appcache</code>"<dt>Macintosh file type code(s):<dd>No specific Macintosh file type codes are recommended for this type.</dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers have no meaning with <code id=text/cache-manifest:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code> resources.</p>
- <h3 id=text/ping>16.6 <dfn><code>text/ping</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>text<dt>Subtype name:<dd>ping<dt>Required parameters:<dd>No parameters<dt>Optional parameters:<dd>
- <dl><dt><code>charset</code><dd>
- <p>The <code>charset</code> parameter may be provided. The parameter's value must be
- "<code>utf-8</code>". This parameter serves no purpose; it is only allowed for
- compatibility with legacy servers.</p>
- </dl>
- <dt>Encoding considerations:<dd>Not applicable.<dt>Security considerations:<dd>
- <p>If used exclusively in the fashion described in the context of
- <a href=#hyperlink-auditing id=text/ping:hyperlink-auditing>hyperlink auditing</a>, this type introduces no new
- security concerns.</p>
- <dt>Interoperability considerations:<dd>
- Rules applicable to this type are defined in this specification.
- <dt>Published specification:<dd>
- This document is the relevant specification.
- <dt>Applications that use this media type:<dd>
- Web browsers.
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd><code id=text/ping:text/ping><a href=#text/ping>text/ping</a></code> resources always consist of the four
- bytes 0x50 0x49 0x4E 0x47 (ASCII 'PING').<dt>File extension(s):<dd>No specific file extension is recommended for this type.<dt>Macintosh file type code(s):<dd>No specific Macintosh file type codes are recommended for this type.</dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>Only intended for use with HTTP POST requests generated as part
- of a Web browser's processing of the <code id=text/ping:ping><a href=#ping>ping</a></code> attribute.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers have no meaning with <code id=text/ping:text/ping-2><a href=#text/ping>text/ping</a></code> resources.</p>
- <h3 id=application/microdata+json>16.7 <dfn><code>application/microdata+json</code></dfn></h3>
- <p>This registration is for community review and will be submitted to the IESG for review,
- approval, and registration with IANA.</p>
-
- <dl><dt>Type name:<dd>application<dt>Subtype name:<dd>microdata+json<dt>Required parameters:<dd>Same as for <code id=application/microdata+json:application/json><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>Optional parameters:<dd>Same as for <code id=application/microdata+json:application/json-2><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>Encoding considerations:<dd>8bit (always UTF-8)<dt>Security considerations:<dd>Same as for <code id=application/microdata+json:application/json-3><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>Interoperability considerations:<dd>Same as for <code id=application/microdata+json:application/json-4><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>Published specification:<dd>
- Labeling a resource with the <code id=application/microdata+json:application/microdata+json><a href=#application/microdata+json>application/microdata+json</a></code> type asserts that the
- resource is a JSON text that consists of an object with a single entry called "<code>items</code>" consisting of an array of entries, each of which consists of an object
- with an entry called "<code>id</code>" whose value is a string, an entry called "<code>type</code>" whose value is another string, and an entry called "<code>properties</code>" whose value is an object whose entries each have a value consisting
- of an array of either objects or strings, the objects being of the same form as the objects in
- the aforementioned "<code>items</code>" entry. Thus, the relevant specifications are
- the JSON specification and this specification. <a href=#refsJSON>[JSON]</a>
- <dt>Applications that use this media type:<dd>
- <p>Applications that transfer data intended for use with HTML's microdata feature, especially in
- the context of drag-and-drop, are the primary application class for this type.</p>
- <dt>Additional information:<dd>
- <dl><dt>Magic number(s):<dd>Same as for <code id=application/microdata+json:application/json-5><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>File extension(s):<dd>Same as for <code id=application/microdata+json:application/json-6><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a><dt>Macintosh file type code(s):<dd>Same as for <code id=application/microdata+json:application/json-7><a href=#application/json>application/json</a></code> <a href=#refsJSON>[JSON]</a></dl>
- <dt>Person & email address to contact for further information:<dd>Ian Hickson <ian@hixie.ch><dt>Intended usage:<dd>Common<dt>Restrictions on usage:<dd>No restrictions apply.<dt>Author:<dd>Ian Hickson <ian@hixie.ch><dt>Change controller:<dd>W3C</dl>
- <p>Fragment identifiers used with <code id=application/microdata+json:application/microdata+json-2><a href=#application/microdata+json>application/microdata+json</a></code> resources have the same
- semantics as when used with <code id=application/microdata+json:application/json-8><a href=#application/json>application/json</a></code> (namely, at the time of writing, no
- semantics at all). <a href=#refsJSON>[JSON]</a></p>
- <h3 id=ping-from>16.8 <dfn><code>Ping-From</code></dfn></h3>
- <p>This section describes a header for registration in the Permanent Message Header Field
- Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
- <dl><dt>Header field name:<dd>Ping-From<dt>Applicable protocol:<dd>http<dt>Status:<dd>standard<dt>Author/Change controller:<dd>W3C<dt>Specification document(s):<dd>
- This document is the relevant specification.
- <dt>Related information:<dd>None.</dl>
- <h3 id=ping-to>16.9 <dfn><code>Ping-To</code></dfn></h3>
- <p>This section describes a header for registration in the Permanent Message Header Field
- Registry. <a href=#refsRFC3864>[RFC3864]</a></p>
- <dl><dt>Header field name:<dd>Ping-To<dt>Applicable protocol:<dd>http<dt>Status:<dd>standard<dt>Author/Change controller:<dd>W3C<dt>Specification document(s):<dd>
- This document is the relevant specification.
- <dt>Related information:<dd>None.</dl>
- <h3 id=web+-scheme-prefix>16.10 <dfn><code>web+</code> scheme prefix</dfn></h3>
- <p>This section describes a convention for use with the IANA URI scheme registry. It does not
- itself register a specific scheme. <a href=#refsRFC4395>[RFC4395]</a></p>
- <dl><dt>URI scheme name:<dd>
- Schemes starting with the four characters "<code>web+</code>" followed by one or more letters in the range
- <code>a</code>-<code>z</code>.
- <dt>Status:<dd>permanent<dt>URI scheme syntax:<dd>Scheme-specific.<dt>URI scheme semantics:<dd>Scheme-specific.<dt>Encoding considerations:<dd>All "<code>web+</code>" schemes should use UTF-8 encodings where relevant.<dt>Applications/protocols that use this URI scheme name:<dd>Scheme-specific.<dt>Interoperability considerations:<dd>The scheme is expected to be used in the context of Web applications.<dt>Security considerations:<dd>
- Any Web page is able to register a handler for all "<code>web+</code>" schemes. As
- such, these schemes must not be used for features intended to be core platform features (e.g.
- network transfer protocols like HTTP or FTP). Similarly, such schemes must not store
- confidential information in their URLs, such as usernames, passwords, personal information, or
- confidential project names.
- <dt>Contact:<dd>Ian Hickson <ian@hixie.ch><dt>Author/Change controller:<dd>Ian Hickson <ian@hixie.ch><dt>References:<dd>
- <cite>Custom scheme and content handlers</cite>, HTML Living Standard:
- <a href=#custom-handlers>http://www.whatwg.org/specs/web-apps/current-work/#custom-handlers</a>
- </dl>
- <h2 id=index class=no-num>Index</h2>
-
- <p>The following sections only cover conforming elements and features.</p>
-
- <h3 id=elements-3 class=no-num>Elements</h3>
- <p><i>This section is non-normative.</i></p>
-
- <table><caption>List of elements</caption><thead><tr><th> Element
- <th> Description
- <th> Categories
- <th> Parents†
- <th> Children
- <th> Attributes
- <th> Interface
- <tbody><tr><th><code id=elements-3:the-a-element><a href=#the-a-element>a</a></code><td>Hyperlink<td><a href=#flow-content-2 id=elements-3:flow-content-2>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2>phrasing</a>*;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2>interactive</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-2>phrasing</a><td><a href=#transparent id=elements-3:transparent>transparent</a>*<td><a href=#global-attributes id=elements-3:global-attributes>globals</a>;
- <code id=elements-3:attr-hyperlink-href><a href=#attr-hyperlink-href>href</a></code>;
- <code id=elements-3:attr-hyperlink-target><a href=#attr-hyperlink-target>target</a></code>;
- <code id=elements-3:attr-hyperlink-download><a href=#attr-hyperlink-download>download</a></code>;
- <code id=elements-3:ping><a href=#ping>ping</a></code>;
- <code id=elements-3:attr-hyperlink-rel><a href=#attr-hyperlink-rel>rel</a></code>;
- <code id=elements-3:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
- <code id=elements-3:attr-hyperlink-type><a href=#attr-hyperlink-type>type</a></code><td><code id=elements-3:htmlanchorelement><a href=#htmlanchorelement>HTMLAnchorElement</a></code><tr><th><code id=elements-3:the-abbr-element><a href=#the-abbr-element>abbr</a></code><td>Abbreviation<td><a href=#flow-content-2 id=elements-3:flow-content-2-2>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-3>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-4>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-5>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-2>globals</a><td><code id=elements-3:htmlelement><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-address-element><a href=#the-address-element>address</a></code><td>Contact information for a page or <code id=elements-3:the-article-element><a href=#the-article-element>article</a></code> element<td><a href=#flow-content-2 id=elements-3:flow-content-2-3>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-4>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-5>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-3>globals</a><td><code id=elements-3:htmlelement-2><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-area-element><a href=#the-area-element>area</a></code><td>Hyperlink or dead area on an image map<td><a href=#flow-content-2 id=elements-3:flow-content-2-6>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-6>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-7>phrasing</a>*<td>empty<td><a href=#global-attributes id=elements-3:global-attributes-4>globals</a>;
- <code id=elements-3:attr-area-alt><a href=#attr-area-alt>alt</a></code>;
- <code id=elements-3:attr-area-coords><a href=#attr-area-coords>coords</a></code>;
- <code id=elements-3:attr-area-shape><a href=#attr-area-shape>shape</a></code>;
- <code id=elements-3:attr-hyperlink-href-2><a href=#attr-hyperlink-href>href</a></code>;
- <code id=elements-3:attr-hyperlink-target-2><a href=#attr-hyperlink-target>target</a></code>;
- <code id=elements-3:attr-hyperlink-download-2><a href=#attr-hyperlink-download>download</a></code>;
- <code id=elements-3:ping-2><a href=#ping>ping</a></code>;
- <code id=elements-3:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>rel</a></code>;
- <code id=elements-3:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>hreflang</a></code>;
- <code id=elements-3:attr-hyperlink-type-2><a href=#attr-hyperlink-type>type</a></code><td><code id=elements-3:htmlareaelement><a href=#htmlareaelement>HTMLAreaElement</a></code><tr><th><code id=elements-3:the-article-element-2><a href=#the-article-element>article</a></code><td>Self-contained syndicatable or reusable composition<td><a href=#flow-content-2 id=elements-3:flow-content-2-7>flow</a>;
- <a href=#sectioning-content-2 id=elements-3:sectioning-content-2>sectioning</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-8>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-9>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-5>globals</a><td><code id=elements-3:htmlelement-3><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-aside-element><a href=#the-aside-element>aside</a></code><td>Sidebar for tangentially related content<td><a href=#flow-content-2 id=elements-3:flow-content-2-10>flow</a>;
- <a href=#sectioning-content-2 id=elements-3:sectioning-content-2-2>sectioning</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-11>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-12>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-6>globals</a><td><code id=elements-3:htmlelement-4><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-audio-element><a href=#the-audio-element>audio</a></code><td>Audio player<td><a href=#flow-content-2 id=elements-3:flow-content-2-13>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-8>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-2>interactive</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-9>phrasing</a><td><code id=elements-3:the-source-element><a href=#the-source-element>source</a></code>*;
- <a href=#transparent id=elements-3:transparent-2>transparent</a>*<td><a href=#global-attributes id=elements-3:global-attributes-7>globals</a>;
- <code id=elements-3:attr-media-src><a href=#attr-media-src>src</a></code>;
- <code id=elements-3:attr-media-crossorigin><a href=#attr-media-crossorigin>crossorigin</a></code>;
- <code id=elements-3:attr-media-preload><a href=#attr-media-preload>preload</a></code>;
- <code id=elements-3:attr-media-autoplay><a href=#attr-media-autoplay>autoplay</a></code>;
- <code id=elements-3:attr-media-mediagroup><a href=#attr-media-mediagroup>mediagroup</a></code>;
- <code id=elements-3:attr-media-loop><a href=#attr-media-loop>loop</a></code>;
- <code id=elements-3:attr-media-muted><a href=#attr-media-muted>muted</a></code>;
- <code id=elements-3:attr-media-controls><a href=#attr-media-controls>controls</a></code><td><code id=elements-3:htmlaudioelement><a href=#htmlaudioelement>HTMLAudioElement</a></code><tr><th><code id=elements-3:the-b-element><a href=#the-b-element>b</a></code><td>Keywords<td><a href=#flow-content-2 id=elements-3:flow-content-2-14>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-10>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-11>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-12>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-8>globals</a><td><code id=elements-3:htmlelement-5><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-base-element><a href=#the-base-element>base</a></code><td>Base URL and default target <a href=#browsing-context id=elements-3:browsing-context>browsing context</a> for <a href=#attr-hyperlink-target id=elements-3:attr-hyperlink-target-3>hyperlinks</a> and <a href=#attr-fs-target id=elements-3:attr-fs-target>forms</a><td><a href=#metadata-content-2 id=elements-3:metadata-content-2>metadata</a><td><code id=elements-3:the-head-element><a href=#the-head-element>head</a></code>;
- <code id=elements-3:the-template-element><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-9>globals</a>;
- <code id=elements-3:attr-base-href><a href=#attr-base-href>href</a></code>;
- <code id=elements-3:attr-base-target><a href=#attr-base-target>target</a></code><td><code id=elements-3:htmlbaseelement><a href=#htmlbaseelement>HTMLBaseElement</a></code><tr><th><code id=elements-3:the-bdi-element><a href=#the-bdi-element>bdi</a></code><td>Text directionality isolation<td><a href=#flow-content-2 id=elements-3:flow-content-2-15>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-13>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-14>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-15>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-10>globals</a><td><code id=elements-3:htmlelement-6><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-bdo-element><a href=#the-bdo-element>bdo</a></code><td>Text directionality formatting<td><a href=#flow-content-2 id=elements-3:flow-content-2-16>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-16>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-17>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-18>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-11>globals</a><td><code id=elements-3:htmlelement-7><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code><td>A section quoted from another source<td><a href=#flow-content-2 id=elements-3:flow-content-2-17>flow</a>;
- <a href=#sectioning-root id=elements-3:sectioning-root>sectioning root</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-18>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-19>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-12>globals</a>;
- <code id=elements-3:attr-blockquote-cite><a href=#attr-blockquote-cite>cite</a></code><td><code id=elements-3:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code><tr><th><code id=elements-3:the-body-element><a href=#the-body-element>body</a></code><td>Document body<td><a href=#sectioning-root id=elements-3:sectioning-root-2>sectioning root</a><td><code id=elements-3:the-html-element><a href=#the-html-element>html</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-20>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-13>globals</a>;
- <code id=elements-3:handler-window-onafterprint><a href=#handler-window-onafterprint>onafterprint</a></code>;
- <code id=elements-3:handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>onbeforeprint</a></code>;
- <code id=elements-3:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>onbeforeunload</a></code>;
- <code id=elements-3:handler-window-onhashchange><a href=#handler-window-onhashchange>onhashchange</a></code>;
- <code id=elements-3:handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>onlanguagechange</a></code>;
- <code id=elements-3:handler-window-onmessage><a href=#handler-window-onmessage>onmessage</a></code>;
- <code id=elements-3:handler-window-onoffline><a href=#handler-window-onoffline>onoffline</a></code>;
- <code id=elements-3:handler-window-ononline><a href=#handler-window-ononline>ononline</a></code>;
- <code id=elements-3:handler-window-onpagehide><a href=#handler-window-onpagehide>onpagehide</a></code>;
- <code id=elements-3:handler-window-onpageshow><a href=#handler-window-onpageshow>onpageshow</a></code>;
- <code id=elements-3:handler-window-onpopstate><a href=#handler-window-onpopstate>onpopstate</a></code>;
- <code id=elements-3:handler-window-onstorage><a href=#handler-window-onstorage>onstorage</a></code>;
- <code id=elements-3:handler-window-onunload><a href=#handler-window-onunload>onunload</a></code><td><code id=elements-3:htmlbodyelement><a href=#htmlbodyelement>HTMLBodyElement</a></code><tr><th><code id=elements-3:the-br-element><a href=#the-br-element>br</a></code><td>Line break, e.g. in poem or postal address<td><a href=#flow-content-2 id=elements-3:flow-content-2-21>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-19>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-20>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-14>globals</a><td><code id=elements-3:htmlbrelement><a href=#htmlbrelement>HTMLBRElement</a></code><tr><th><code id=elements-3:the-button-element><a href=#the-button-element>button</a></code><td>Button control<td><a href=#flow-content-2 id=elements-3:flow-content-2-22>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-21>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-3>interactive</a>;
- <a href=#category-listed id=elements-3:category-listed>listed</a>;
- <a href=#category-label id=elements-3:category-label>labelable</a>;
- <a href=#category-submit id=elements-3:category-submit>submittable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-22>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-23>phrasing</a>*<td><a href=#global-attributes id=elements-3:global-attributes-15>globals</a>;
- <code id=elements-3:attr-fe-autofocus><a href=#attr-fe-autofocus>autofocus</a></code>;
- <code id=elements-3:attr-fe-disabled><a href=#attr-fe-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-fs-formaction><a href=#attr-fs-formaction>formaction</a></code>;
- <code id=elements-3:attr-fs-formenctype><a href=#attr-fs-formenctype>formenctype</a></code>;
- <code id=elements-3:attr-fs-formmethod><a href=#attr-fs-formmethod>formmethod</a></code>;
- <code id=elements-3:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
- <code id=elements-3:attr-fs-formtarget><a href=#attr-fs-formtarget>formtarget</a></code>;
- <code id=elements-3:attr-button-menu><a href=#attr-button-menu>menu</a></code>;
- <code id=elements-3:attr-fe-name><a href=#attr-fe-name>name</a></code>;
- <code id=elements-3:attr-button-type><a href=#attr-button-type>type</a></code>;
- <code id=elements-3:attr-button-value><a href=#attr-button-value>value</a></code><td><code id=elements-3:htmlbuttonelement><a href=#htmlbuttonelement>HTMLButtonElement</a></code><tr><th><code id=elements-3:the-canvas-element><a href=#the-canvas-element>canvas</a></code><td>Scriptable bitmap canvas<td><a href=#flow-content-2 id=elements-3:flow-content-2-23>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-24>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-2>embedded</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-25>phrasing</a><td><a href=#transparent id=elements-3:transparent-3>transparent</a><td><a href=#global-attributes id=elements-3:global-attributes-16>globals</a>;
- <code id=elements-3:attr-canvas-width><a href=#attr-canvas-width>width</a></code>;
- <code id=elements-3:attr-canvas-height><a href=#attr-canvas-height>height</a></code><td><code id=elements-3:htmlcanvaselement><a href=#htmlcanvaselement>HTMLCanvasElement</a></code><tr><th><code id=elements-3:the-caption-element><a href=#the-caption-element>caption</a></code><td>Table caption<td>none<td><code id=elements-3:the-table-element><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-template-element-2><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-24>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-17>globals</a><td><code id=elements-3:htmltablecaptionelement><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code><tr><th><code id=elements-3:the-cite-element><a href=#the-cite-element>cite</a></code><td>Title of a work<td><a href=#flow-content-2 id=elements-3:flow-content-2-25>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-26>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-27>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-28>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-18>globals</a><td><code id=elements-3:htmlelement-8><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-code-element><a href=#the-code-element>code</a></code><td>Computer code<td><a href=#flow-content-2 id=elements-3:flow-content-2-26>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-29>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-30>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-31>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-19>globals</a><td><code id=elements-3:htmlelement-9><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-col-element><a href=#the-col-element>col</a></code><td>Table column<td>none<td><code id=elements-3:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>;
- <code id=elements-3:the-template-element-3><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-20>globals</a>;
- <code id=elements-3:attr-col-span><a href=#attr-col-span>span</a></code><td><code id=elements-3:htmltablecolelement><a href=#htmltablecolelement>HTMLTableColElement</a></code><tr><th><code id=elements-3:the-colgroup-element-2><a href=#the-colgroup-element>colgroup</a></code><td>Group of columns in a table<td>none<td><code id=elements-3:the-table-element-2><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-template-element-4><a href=#the-template-element>template</a></code><td><code id=elements-3:the-col-element-2><a href=#the-col-element>col</a></code>*;
- <code id=elements-3:the-template-element-5><a href=#the-template-element>template</a></code>*<td><a href=#global-attributes id=elements-3:global-attributes-21>globals</a>;
- <code id=elements-3:attr-colgroup-span><a href=#attr-colgroup-span>span</a></code><td><code id=elements-3:htmltablecolelement-2><a href=#htmltablecolelement>HTMLTableColElement</a></code><tr><th><code id=elements-3:the-data-element><a href=#the-data-element>data</a></code><td>Machine-readable equivalent<td><a href=#flow-content-2 id=elements-3:flow-content-2-27>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-32>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-33>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-34>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-22>globals</a>;
- <code id=elements-3:attr-data-value><a href=#attr-data-value>value</a></code><td><code id=elements-3:htmldataelement><a href=#htmldataelement>HTMLDataElement</a></code><tr><th><code id=elements-3:the-datalist-element><a href=#the-datalist-element>datalist</a></code><td>Container for options for <a href=#attr-input-list id=elements-3:attr-input-list>combo box control</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-28>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-35>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-36>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-37>phrasing</a>*;
- <code id=elements-3:the-option-element><a href=#the-option-element>option</a></code>*;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2>script-supporting elements</a>*<td><a href=#global-attributes id=elements-3:global-attributes-23>globals</a><td><code id=elements-3:htmldatalistelement><a href=#htmldatalistelement>HTMLDataListElement</a></code><tr><th><code id=elements-3:the-dd-element><a href=#the-dd-element>dd</a></code><td>Content for corresponding <code id=elements-3:the-dt-element><a href=#the-dt-element>dt</a></code> element(s)<td>none<td><code id=elements-3:the-dl-element><a href=#the-dl-element>dl</a></code>;
- <code id=elements-3:the-template-element-6><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-29>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-24>globals</a><td><code id=elements-3:htmlelement-10><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-del-element><a href=#the-del-element>del</a></code><td>A removal from the document<td><a href=#flow-content-2 id=elements-3:flow-content-2-30>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-38>phrasing</a>*<td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-39>phrasing</a><td><a href=#transparent id=elements-3:transparent-4>transparent</a><td><a href=#global-attributes id=elements-3:global-attributes-25>globals</a>;
- <code id=elements-3:attr-mod-cite><a href=#attr-mod-cite>cite</a></code>;
- <code id=elements-3:attr-mod-datetime><a href=#attr-mod-datetime>datetime</a></code><td><code id=elements-3:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code><tr><th><code id=elements-3:the-details-element><a href=#the-details-element>details</a></code><td>Disclosure control for hiding details<td><a href=#flow-content-2 id=elements-3:flow-content-2-31>flow</a>;
- <a href=#sectioning-root id=elements-3:sectioning-root-3>sectioning root</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-4>interactive</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-32>flow</a><td><code id=elements-3:the-summary-element><a href=#the-summary-element>summary</a></code>*;
- <a href=#flow-content-2 id=elements-3:flow-content-2-33>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-26>globals</a>;
- <code id=elements-3:attr-details-open><a href=#attr-details-open>open</a></code><td><code id=elements-3:htmldetailselement><a href=#htmldetailselement>HTMLDetailsElement</a></code><tr><th><code id=elements-3:the-dfn-element><a href=#the-dfn-element>dfn</a></code><td>Defining instance<td><a href=#flow-content-2 id=elements-3:flow-content-2-34>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-40>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-41>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-42>phrasing</a>*<td><a href=#global-attributes id=elements-3:global-attributes-27>globals</a><td><code id=elements-3:htmlelement-11><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-dialog-element><a href=#the-dialog-element>dialog</a></code><td>Dialog box or window<td><a href=#flow-content-2 id=elements-3:flow-content-2-35>flow</a>;
- <a href=#sectioning-root id=elements-3:sectioning-root-4>sectioning root</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-36>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-37>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-28>globals</a>;
- <code id=elements-3:attr-dialog-open><a href=#attr-dialog-open>open</a></code><td><code id=elements-3:htmldialogelement><a href=#htmldialogelement>HTMLDialogElement</a></code><tr><th><code id=elements-3:the-div-element><a href=#the-div-element>div</a></code><td>Generic flow container<td><a href=#flow-content-2 id=elements-3:flow-content-2-38>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-39>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-40>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-29>globals</a><td><code id=elements-3:htmldivelement><a href=#htmldivelement>HTMLDivElement</a></code><tr><th><code id=elements-3:the-dl-element-2><a href=#the-dl-element>dl</a></code><td>Association list consisting of zero or more name-value groups<td><a href=#flow-content-2 id=elements-3:flow-content-2-41>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-42>flow</a><td><code id=elements-3:the-dt-element-2><a href=#the-dt-element>dt</a></code>*;
- <code id=elements-3:the-dd-element-2><a href=#the-dd-element>dd</a></code>*;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-2>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-30>globals</a><td><code id=elements-3:htmldlistelement><a href=#htmldlistelement>HTMLDListElement</a></code><tr><th><code id=elements-3:the-dt-element-3><a href=#the-dt-element>dt</a></code><td>Legend for corresponding <code id=elements-3:the-dd-element-3><a href=#the-dd-element>dd</a></code> element(s)<td>none<td><code id=elements-3:the-dl-element-3><a href=#the-dl-element>dl</a></code>;
- <code id=elements-3:the-template-element-7><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-43>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-31>globals</a><td><code id=elements-3:htmlelement-12><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-em-element><a href=#the-em-element>em</a></code><td>Stress emphasis<td><a href=#flow-content-2 id=elements-3:flow-content-2-44>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-43>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-44>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-45>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-32>globals</a><td><code id=elements-3:htmlelement-13><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-embed-element><a href=#the-embed-element>embed</a></code><td><a href=#plugin id=elements-3:plugin>Plugin</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-45>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-46>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-3>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-5>interactive</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-47>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-33>globals</a>;
- <code id=elements-3:attr-embed-src><a href=#attr-embed-src>src</a></code>;
- <code id=elements-3:attr-embed-type><a href=#attr-embed-type>type</a></code>;
- <code id=elements-3:attr-dim-width><a href=#attr-dim-width>width</a></code>;
- <code id=elements-3:attr-dim-height><a href=#attr-dim-height>height</a></code>;
- any*<td><code id=elements-3:htmlembedelement><a href=#htmlembedelement>HTMLEmbedElement</a></code><tr><th><code id=elements-3:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code><td>Group of form controls<td><a href=#flow-content-2 id=elements-3:flow-content-2-46>flow</a>;
- <a href=#sectioning-root id=elements-3:sectioning-root-5>sectioning root</a>;
- <a href=#category-listed id=elements-3:category-listed-2>listed</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-2>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-2>form-associated</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-47>flow</a><td><code id=elements-3:the-legend-element><a href=#the-legend-element>legend</a></code>*;
- <a href=#flow-content-2 id=elements-3:flow-content-2-48>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-34>globals</a>;
- <code id=elements-3:attr-fieldset-disabled><a href=#attr-fieldset-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form-2><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-fe-name-2><a href=#attr-fe-name>name</a></code><td><code id=elements-3:htmlfieldsetelement><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code><tr><th><code id=elements-3:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code><td>Caption for <code id=elements-3:the-figure-element><a href=#the-figure-element>figure</a></code><td>none<td><code id=elements-3:the-figure-element-2><a href=#the-figure-element>figure</a></code>;
- <code id=elements-3:the-template-element-8><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-49>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-35>globals</a><td><code id=elements-3:htmlelement-14><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-figure-element-3><a href=#the-figure-element>figure</a></code><td>Figure with optional caption<td><a href=#flow-content-2 id=elements-3:flow-content-2-50>flow</a>;
- <a href=#sectioning-root id=elements-3:sectioning-root-6>sectioning root</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-51>flow</a><td><code id=elements-3:the-figcaption-element-2><a href=#the-figcaption-element>figcaption</a></code>*;
- <a href=#flow-content-2 id=elements-3:flow-content-2-52>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-36>globals</a><td><code id=elements-3:htmlelement-15><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-footer-element><a href=#the-footer-element>footer</a></code><td>Footer for a page or section<td><a href=#flow-content-2 id=elements-3:flow-content-2-53>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-54>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-55>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-37>globals</a><td><code id=elements-3:htmlelement-16><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-form-element><a href=#the-form-element>form</a></code><td>User-submittable form<td><a href=#flow-content-2 id=elements-3:flow-content-2-56>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-57>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-58>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-38>globals</a>;
- <code id=elements-3:attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>;
- <code id=elements-3:attr-fs-action><a href=#attr-fs-action>action</a></code>;
- <code id=elements-3:attr-form-autocomplete><a href=#attr-form-autocomplete>autocomplete</a></code>;
- <code id=elements-3:attr-fs-enctype><a href=#attr-fs-enctype>enctype</a></code>;
- <code id=elements-3:attr-fs-method><a href=#attr-fs-method>method</a></code>;
- <code id=elements-3:attr-form-name><a href=#attr-form-name>name</a></code>;
- <code id=elements-3:attr-fs-novalidate><a href=#attr-fs-novalidate>novalidate</a></code>;
- <code id=elements-3:attr-fs-target-2><a href=#attr-fs-target>target</a></code><td><code id=elements-3:htmlformelement><a href=#htmlformelement>HTMLFormElement</a></code><tr><th><code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code><td>Section heading<td><a href=#flow-content-2 id=elements-3:flow-content-2-59>flow</a>;
- <a href=#heading-content-2 id=elements-3:heading-content-2>heading</a><td><code id=elements-3:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-60>flow</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-48>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-39>globals</a><td><code id=elements-3:htmlheadingelement><a href=#htmlheadingelement>HTMLHeadingElement</a></code><tr><th><code id=elements-3:the-head-element-2><a href=#the-head-element>head</a></code><td>Container for document metadata<td>none<td><code id=elements-3:the-html-element-2><a href=#the-html-element>html</a></code><td><a href=#metadata-content-2 id=elements-3:metadata-content-2-2>metadata content</a>*<td><a href=#global-attributes id=elements-3:global-attributes-40>globals</a><td><code id=elements-3:htmlheadelement><a href=#htmlheadelement>HTMLHeadElement</a></code><tr><th><code id=elements-3:the-header-element><a href=#the-header-element>header</a></code><td>Introductory or navigational aids for a page or section<td><a href=#flow-content-2 id=elements-3:flow-content-2-61>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-62>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-63>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-41>globals</a><td><code id=elements-3:htmlelement-17><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code><td>heading group<td><a href=#flow-content-2 id=elements-3:flow-content-2-64>flow</a>;
- <a href=#heading-content-2 id=elements-3:heading-content-2-2>heading</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-65>flow</a><td>One or more <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-7><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-9><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-10><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-11><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>, <code id=elements-3:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-12><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>, and <code id=elements-3:the-template-element-9><a href=#the-template-element>template</a></code><td><a href=#global-attributes id=elements-3:global-attributes-42>globals</a><td><code id=elements-3:htmlelement-18><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-hr-element><a href=#the-hr-element>hr</a></code><td>Thematic break<td><a href=#flow-content-2 id=elements-3:flow-content-2-66>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-67>flow</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-43>globals</a><td><code id=elements-3:htmlhrelement><a href=#htmlhrelement>HTMLHRElement</a></code><tr><th><code id=elements-3:the-html-element-3><a href=#the-html-element>html</a></code><td>Root element<td>none<td>none*<td><code id=elements-3:the-head-element-3><a href=#the-head-element>head</a></code>*;
- <code id=elements-3:the-body-element-2><a href=#the-body-element>body</a></code>*<td><a href=#global-attributes id=elements-3:global-attributes-44>globals</a>;
- <code id=elements-3:attr-html-manifest><a href=#attr-html-manifest>manifest</a></code><td><code id=elements-3:htmlhtmlelement><a href=#htmlhtmlelement>HTMLHtmlElement</a></code><tr><th><code id=elements-3:the-i-element><a href=#the-i-element>i</a></code><td>Alternate voice<td><a href=#flow-content-2 id=elements-3:flow-content-2-68>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-49>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-50>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-51>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-45>globals</a><td><code id=elements-3:htmlelement-19><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-iframe-element><a href=#the-iframe-element>iframe</a></code><td><a href=#nested-browsing-context id=elements-3:nested-browsing-context>Nested browsing context</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-69>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-52>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-4>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-6>interactive</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-53>phrasing</a><td>text*<td><a href=#global-attributes id=elements-3:global-attributes-46>globals</a>;
- <code id=elements-3:attr-iframe-src><a href=#attr-iframe-src>src</a></code>;
- <code id=elements-3:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>srcdoc</a></code>;
- <code id=elements-3:attr-iframe-name><a href=#attr-iframe-name>name</a></code>;
- <code id=elements-3:attr-iframe-sandbox><a href=#attr-iframe-sandbox>sandbox</a></code>;
- <code id=elements-3:attr-iframe-seamless><a href=#attr-iframe-seamless>seamless</a></code>;
- <code id=elements-3:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>allowfullscreen</a></code>;
- <code id=elements-3:attr-dim-width-2><a href=#attr-dim-width>width</a></code>;
- <code id=elements-3:attr-dim-height-2><a href=#attr-dim-height>height</a></code><td><code id=elements-3:htmliframeelement><a href=#htmliframeelement>HTMLIFrameElement</a></code><tr><th><code id=elements-3:the-img-element><a href=#the-img-element>img</a></code><td>Image<td><a href=#flow-content-2 id=elements-3:flow-content-2-70>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-54>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-5>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-7>interactive</a>*;
- <a href=#form-associated-element id=elements-3:form-associated-element-3>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-55>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-47>globals</a>;
- <code id=elements-3:attr-img-alt><a href=#attr-img-alt>alt</a></code>;
- <code id=elements-3:attr-img-src><a href=#attr-img-src>src</a></code>;
- <code id=elements-3:attr-img-srcset><a href=#attr-img-srcset>srcset</a></code>;
- <code id=elements-3:attr-img-crossorigin><a href=#attr-img-crossorigin>crossorigin</a></code>;
- <code id=elements-3:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code>;
- <code id=elements-3:attr-img-ismap><a href=#attr-img-ismap>ismap</a></code>;
- <code id=elements-3:attr-dim-width-3><a href=#attr-dim-width>width</a></code>;
- <code id=elements-3:attr-dim-height-3><a href=#attr-dim-height>height</a></code><td><code id=elements-3:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code><tr><th><code id=elements-3:the-input-element><a href=#the-input-element>input</a></code><td>Form control<td><a href=#flow-content-2 id=elements-3:flow-content-2-71>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-56>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-8>interactive</a>*;
- <a href=#category-listed id=elements-3:category-listed-3>listed</a>;
- <a href=#category-label id=elements-3:category-label-2>labelable</a>;
- <a href=#category-submit id=elements-3:category-submit-2>submittable</a>;
- <a href=#category-reset id=elements-3:category-reset>resettable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-3>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-4>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-57>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-48>globals</a>;
- <code id=elements-3:attr-input-accept><a href=#attr-input-accept>accept</a></code>;
- <code id=elements-3:attr-input-alt><a href=#attr-input-alt>alt</a></code>;
- <code id=elements-3:attr-fe-autocomplete><a href=#attr-fe-autocomplete>autocomplete</a></code>;
- <code id=elements-3:attr-fe-autofocus-2><a href=#attr-fe-autofocus>autofocus</a></code>;
- <code id=elements-3:attr-input-checked><a href=#attr-input-checked>checked</a></code>;
- <code id=elements-3:attr-fe-dirname><a href=#attr-fe-dirname>dirname</a></code>;
- <code id=elements-3:attr-fe-disabled-2><a href=#attr-fe-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form-3><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-fs-formaction-2><a href=#attr-fs-formaction>formaction</a></code>;
- <code id=elements-3:attr-fs-formenctype-2><a href=#attr-fs-formenctype>formenctype</a></code>;
- <code id=elements-3:attr-fs-formmethod-2><a href=#attr-fs-formmethod>formmethod</a></code>;
- <code id=elements-3:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>formnovalidate</a></code>;
- <code id=elements-3:attr-fs-formtarget-2><a href=#attr-fs-formtarget>formtarget</a></code>;
- <code id=elements-3:attr-dim-height-4><a href=#attr-dim-height>height</a></code>;
- <code id=elements-3:attr-fe-inputmode><a href=#attr-fe-inputmode>inputmode</a></code>;
- <code id=elements-3:attr-input-list-2><a href=#attr-input-list>list</a></code>;
- <code id=elements-3:attr-input-max><a href=#attr-input-max>max</a></code>;
- <code id=elements-3:attr-input-maxlength><a href=#attr-input-maxlength>maxlength</a></code>;
- <code id=elements-3:attr-input-min><a href=#attr-input-min>min</a></code>;
- <code id=elements-3:attr-input-minlength><a href=#attr-input-minlength>minlength</a></code>;
- <code id=elements-3:attr-input-multiple><a href=#attr-input-multiple>multiple</a></code>;
- <code id=elements-3:attr-fe-name-3><a href=#attr-fe-name>name</a></code>;
- <code id=elements-3:attr-input-pattern><a href=#attr-input-pattern>pattern</a></code>;
- <code id=elements-3:attr-input-placeholder><a href=#attr-input-placeholder>placeholder</a></code>;
- <code id=elements-3:attr-input-readonly><a href=#attr-input-readonly>readonly</a></code>;
- <code id=elements-3:attr-input-required><a href=#attr-input-required>required</a></code>;
- <code id=elements-3:attr-input-size><a href=#attr-input-size>size</a></code>;
- <code id=elements-3:attr-input-src><a href=#attr-input-src>src</a></code>;
- <code id=elements-3:attr-input-step><a href=#attr-input-step>step</a></code>;
- <code id=elements-3:attr-input-type><a href=#attr-input-type>type</a></code>;
- <code id=elements-3:attr-input-value><a href=#attr-input-value>value</a></code>;
- <code id=elements-3:attr-dim-width-4><a href=#attr-dim-width>width</a></code><td><code id=elements-3:htmlinputelement><a href=#htmlinputelement>HTMLInputElement</a></code><tr><th><code id=elements-3:the-ins-element><a href=#the-ins-element>ins</a></code><td>An addition to the document<td><a href=#flow-content-2 id=elements-3:flow-content-2-72>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-58>phrasing</a>*<td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-59>phrasing</a><td><a href=#transparent id=elements-3:transparent-5>transparent</a><td><a href=#global-attributes id=elements-3:global-attributes-49>globals</a>;
- <code id=elements-3:attr-mod-cite-2><a href=#attr-mod-cite>cite</a></code>;
- <code id=elements-3:attr-mod-datetime-2><a href=#attr-mod-datetime>datetime</a></code><td><code id=elements-3:htmlmodelement-2><a href=#htmlmodelement>HTMLModElement</a></code><tr><th><code id=elements-3:the-kbd-element><a href=#the-kbd-element>kbd</a></code><td>User input<td><a href=#flow-content-2 id=elements-3:flow-content-2-73>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-60>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-61>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-62>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-50>globals</a><td><code id=elements-3:htmlelement-20><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-keygen-element><a href=#the-keygen-element>keygen</a></code><td>Cryptographic key-pair generator form control<td><a href=#flow-content-2 id=elements-3:flow-content-2-74>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-63>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-9>interactive</a>;
- <a href=#category-listed id=elements-3:category-listed-4>listed</a>;
- <a href=#category-label id=elements-3:category-label-3>labelable</a>;
- <a href=#category-submit id=elements-3:category-submit-3>submittable</a>;
- <a href=#category-reset id=elements-3:category-reset-2>resettable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-4>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-5>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-64>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-51>globals</a>;
- <code id=elements-3:attr-fe-autofocus-3><a href=#attr-fe-autofocus>autofocus</a></code>;
- <code id=elements-3:attr-keygen-challenge><a href=#attr-keygen-challenge>challenge</a></code>;
- <code id=elements-3:attr-fe-disabled-3><a href=#attr-fe-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form-4><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-keygen-keytype><a href=#attr-keygen-keytype>keytype</a></code>;
- <code id=elements-3:attr-fe-name-4><a href=#attr-fe-name>name</a></code><td><code id=elements-3:htmlkeygenelement><a href=#htmlkeygenelement>HTMLKeygenElement</a></code><tr><th><code id=elements-3:the-label-element><a href=#the-label-element>label</a></code><td>Caption for a form control<td><a href=#flow-content-2 id=elements-3:flow-content-2-75>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-65>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-10>interactive</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-5>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-6>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-66>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-67>phrasing</a>*<td><a href=#global-attributes id=elements-3:global-attributes-52>globals</a>;
- <code id=elements-3:attr-fae-form-5><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-label-for><a href=#attr-label-for>for</a></code><td><code id=elements-3:htmllabelelement><a href=#htmllabelelement>HTMLLabelElement</a></code><tr><th><code id=elements-3:the-legend-element-2><a href=#the-legend-element>legend</a></code><td>Caption for <code id=elements-3:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code><td>none<td><code id=elements-3:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=elements-3:the-template-element-10><a href=#the-template-element>template</a></code><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-68>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-53>globals</a><td><code id=elements-3:htmllegendelement><a href=#htmllegendelement>HTMLLegendElement</a></code><tr><th><code id=elements-3:the-li-element><a href=#the-li-element>li</a></code><td>List item<td>none<td><code id=elements-3:the-ol-element><a href=#the-ol-element>ol</a></code>;
- <code id=elements-3:the-ul-element><a href=#the-ul-element>ul</a></code>;
- <code id=elements-3:the-menu-element><a href=#the-menu-element>menu</a></code>*;
- <code id=elements-3:the-template-element-11><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-76>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-54>globals</a>;
- <code id=elements-3:attr-li-value><a href=#attr-li-value>value</a></code>*<td><code id=elements-3:htmllielement><a href=#htmllielement>HTMLLIElement</a></code><tr><th><code id=elements-3:the-link-element><a href=#the-link-element>link</a></code><td>Link metadata<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-3>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-77>flow</a>*;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-69>phrasing</a>*<td><code id=elements-3:the-head-element-4><a href=#the-head-element>head</a></code>;
- <code id=elements-3:the-template-element-12><a href=#the-template-element>template</a></code>;
- <code id=elements-3:the-noscript-element><a href=#the-noscript-element>noscript</a></code>*;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-70>phrasing</a>*<td>empty<td><a href=#global-attributes id=elements-3:global-attributes-55>globals</a>;
- <code id=elements-3:attr-link-href><a href=#attr-link-href>href</a></code>;
- <code id=elements-3:attr-link-crossorigin><a href=#attr-link-crossorigin>crossorigin</a></code>;
- <code id=elements-3:attr-link-rel><a href=#attr-link-rel>rel</a></code>;
- <code id=elements-3:attr-link-media><a href=#attr-link-media>media</a></code>;
- <code id=elements-3:attr-link-hreflang><a href=#attr-link-hreflang>hreflang</a></code>;
- <code id=elements-3:attr-link-type><a href=#attr-link-type>type</a></code>;
- <code id=elements-3:attr-link-sizes><a href=#attr-link-sizes>sizes</a></code><td><code id=elements-3:htmllinkelement><a href=#htmllinkelement>HTMLLinkElement</a></code><tr><th><code id=elements-3:the-main-element><a href=#the-main-element>main</a></code><td>Container for the dominant contents of another element<td><a href=#flow-content-2 id=elements-3:flow-content-2-78>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-79>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-80>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-56>globals</a><td><code id=elements-3:htmlelement-21><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-map-element><a href=#the-map-element>map</a></code><td><a href=#image-map id=elements-3:image-map>Image map</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-81>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-71>phrasing</a>*<td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-72>phrasing</a><td><a href=#transparent id=elements-3:transparent-6>transparent</a>;
- <code id=elements-3:the-area-element-2><a href=#the-area-element>area</a></code>*<td><a href=#global-attributes id=elements-3:global-attributes-57>globals</a>;
- <code id=elements-3:attr-map-name><a href=#attr-map-name>name</a></code><td><code id=elements-3:htmlmapelement><a href=#htmlmapelement>HTMLMapElement</a></code><tr><th><code id=elements-3:the-mark-element><a href=#the-mark-element>mark</a></code><td>Highlight<td><a href=#flow-content-2 id=elements-3:flow-content-2-82>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-73>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-74>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-75>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-58>globals</a><td><code id=elements-3:htmlelement-22><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-menu-element-2><a href=#the-menu-element>menu</a></code><td>Menu of commands<td><a href=#flow-content-2 id=elements-3:flow-content-2-83>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-84>flow</a>;
- <code id=elements-3:the-menu-element-3><a href=#the-menu-element>menu</a></code>*<td><code id=elements-3:the-li-element-2><a href=#the-li-element>li</a></code>*;
- <a href=#flow-content-2 id=elements-3:flow-content-2-85>flow</a>*;
- <code id=elements-3:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>*;
- <code id=elements-3:the-hr-element-2><a href=#the-hr-element>hr</a></code>*;
- <code id=elements-3:the-menu-element-4><a href=#the-menu-element>menu</a></code>*;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-3>script-supporting elements</a>*<td><a href=#global-attributes id=elements-3:global-attributes-59>globals</a>;
- <code id=elements-3:attr-menu-type><a href=#attr-menu-type>type</a></code>;
- <code id=elements-3:attr-menu-label><a href=#attr-menu-label>label</a></code><td><code id=elements-3:htmlmenuelement><a href=#htmlmenuelement>HTMLMenuElement</a></code><tr><th><code id=elements-3:the-menuitem-element-2><a href=#the-menuitem-element>menuitem</a></code><td>Menu command<td>none<td><code id=elements-3:the-menu-element-5><a href=#the-menu-element>menu</a></code>;
- <code id=elements-3:the-template-element-13><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-60>globals</a>;
- <code id=elements-3:attr-menuitem-type><a href=#attr-menuitem-type>type</a></code>;
- <code id=elements-3:attr-menuitem-label><a href=#attr-menuitem-label>label</a></code>;
- <code id=elements-3:attr-menuitem-icon><a href=#attr-menuitem-icon>icon</a></code>;
- <code id=elements-3:attr-menuitem-disabled><a href=#attr-menuitem-disabled>disabled</a></code>;
- <code id=elements-3:attr-menuitem-checked><a href=#attr-menuitem-checked>checked</a></code>;
- <code id=elements-3:attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>radiogroup</a></code>;
- <code id=elements-3:attr-menuitem-default><a href=#attr-menuitem-default>default</a></code>;
- <code id=elements-3:attr-menuitem-command><a href=#attr-menuitem-command>command</a></code><td><code id=elements-3:htmlmenuitemelement><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code><tr><th><code id=elements-3:the-meta-element><a href=#the-meta-element>meta</a></code><td>Text metadata<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-4>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-86>flow</a>*;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-76>phrasing</a>*<td><code id=elements-3:the-head-element-5><a href=#the-head-element>head</a></code>;
- <code id=elements-3:the-template-element-14><a href=#the-template-element>template</a></code>;
- <code id=elements-3:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code>*;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-77>phrasing</a>*<td>empty<td><a href=#global-attributes id=elements-3:global-attributes-61>globals</a>;
- <code id=elements-3:attr-meta-name><a href=#attr-meta-name>name</a></code>;
- <code id=elements-3:attr-meta-http-equiv><a href=#attr-meta-http-equiv>http-equiv</a></code>;
- <code id=elements-3:attr-meta-content><a href=#attr-meta-content>content</a></code>;
- <code id=elements-3:attr-meta-charset><a href=#attr-meta-charset>charset</a></code><td><code id=elements-3:htmlmetaelement><a href=#htmlmetaelement>HTMLMetaElement</a></code><tr><th><code id=elements-3:the-meter-element><a href=#the-meter-element>meter</a></code><td>Gauge<td><a href=#flow-content-2 id=elements-3:flow-content-2-87>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-78>phrasing</a>;
- <a href=#category-label id=elements-3:category-label-4>labelable</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-79>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-80>phrasing</a>*<td><a href=#global-attributes id=elements-3:global-attributes-62>globals</a>;
- <code id=elements-3:attr-meter-value><a href=#attr-meter-value>value</a></code>;
- <code id=elements-3:attr-meter-min><a href=#attr-meter-min>min</a></code>;
- <code id=elements-3:attr-meter-max><a href=#attr-meter-max>max</a></code>;
- <code id=elements-3:attr-meter-low><a href=#attr-meter-low>low</a></code>;
- <code id=elements-3:attr-meter-high><a href=#attr-meter-high>high</a></code>;
- <code id=elements-3:attr-meter-optimum><a href=#attr-meter-optimum>optimum</a></code><td><code id=elements-3:htmlmeterelement><a href=#htmlmeterelement>HTMLMeterElement</a></code><tr><th><code id=elements-3:the-nav-element><a href=#the-nav-element>nav</a></code><td>Section with navigational links<td><a href=#flow-content-2 id=elements-3:flow-content-2-88>flow</a>;
- <a href=#sectioning-content-2 id=elements-3:sectioning-content-2-3>sectioning</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-89>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-90>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-63>globals</a><td><code id=elements-3:htmlelement-23><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-noscript-element-3><a href=#the-noscript-element>noscript</a></code><td>Fallback content for script<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-5>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-91>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-81>phrasing</a><td><code id=elements-3:the-head-element-6><a href=#the-head-element>head</a></code>*;
- <code id=elements-3:the-template-element-15><a href=#the-template-element>template</a></code>*;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-82>phrasing</a>*<td>varies*<td><a href=#global-attributes id=elements-3:global-attributes-64>globals</a><td><code id=elements-3:htmlelement-24><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-object-element><a href=#the-object-element>object</a></code><td>Image, <a href=#nested-browsing-context id=elements-3:nested-browsing-context-2>nested browsing context</a>, or <a href=#plugin id=elements-3:plugin-2>plugin</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-92>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-83>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-6>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-11>interactive</a>*;
- <a href=#category-listed id=elements-3:category-listed-5>listed</a>;
- <a href=#category-submit id=elements-3:category-submit-4>submittable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-6>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-7>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-84>phrasing</a><td><code id=elements-3:the-param-element><a href=#the-param-element>param</a></code>*;
- <a href=#transparent id=elements-3:transparent-7>transparent</a><td><a href=#global-attributes id=elements-3:global-attributes-65>globals</a>;
- <code id=elements-3:attr-object-data><a href=#attr-object-data>data</a></code>;
- <code id=elements-3:attr-object-type><a href=#attr-object-type>type</a></code>;
- <code id=elements-3:attr-object-typemustmatch><a href=#attr-object-typemustmatch>typemustmatch</a></code>;
- <code id=elements-3:attr-object-name><a href=#attr-object-name>name</a></code>;
- <code id=elements-3:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code>;
- <code id=elements-3:attr-fae-form-6><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-dim-width-5><a href=#attr-dim-width>width</a></code>;
- <code id=elements-3:attr-dim-height-5><a href=#attr-dim-height>height</a></code><td><code id=elements-3:htmlobjectelement><a href=#htmlobjectelement>HTMLObjectElement</a></code><tr><th><code id=elements-3:the-ol-element-2><a href=#the-ol-element>ol</a></code><td>Ordered list<td><a href=#flow-content-2 id=elements-3:flow-content-2-93>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-94>flow</a><td><code id=elements-3:the-li-element-3><a href=#the-li-element>li</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-4>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-66>globals</a>;
- <code id=elements-3:attr-ol-reversed><a href=#attr-ol-reversed>reversed</a></code>;
- <code id=elements-3:attr-ol-start><a href=#attr-ol-start>start</a></code>;
- <code id=elements-3:attr-ol-type><a href=#attr-ol-type>type</a></code><td><code id=elements-3:htmlolistelement><a href=#htmlolistelement>HTMLOListElement</a></code><tr><th><code id=elements-3:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code><td>Group of options in a list box<td>none<td><code id=elements-3:the-select-element><a href=#the-select-element>select</a></code>;
- <code id=elements-3:the-template-element-16><a href=#the-template-element>template</a></code><td><code id=elements-3:the-option-element-2><a href=#the-option-element>option</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-5>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-67>globals</a>;
- <code id=elements-3:attr-optgroup-disabled><a href=#attr-optgroup-disabled>disabled</a></code>;
- <code id=elements-3:attr-optgroup-label><a href=#attr-optgroup-label>label</a></code><td><code id=elements-3:htmloptgroupelement><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code><tr><th><code id=elements-3:the-option-element-3><a href=#the-option-element>option</a></code><td>Option in a list box or combo box control<td>none<td><code id=elements-3:the-select-element-2><a href=#the-select-element>select</a></code>;
- <code id=elements-3:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code>;
- <code id=elements-3:the-optgroup-element-2><a href=#the-optgroup-element>optgroup</a></code>;
- <code id=elements-3:the-template-element-17><a href=#the-template-element>template</a></code><td><a href=#text-content id=elements-3:text-content>text</a>*<td><a href=#global-attributes id=elements-3:global-attributes-68>globals</a>;
- <code id=elements-3:attr-option-disabled><a href=#attr-option-disabled>disabled</a></code>;
- <code id=elements-3:attr-option-label><a href=#attr-option-label>label</a></code>;
- <code id=elements-3:attr-option-selected><a href=#attr-option-selected>selected</a></code>;
- <code id=elements-3:attr-option-value><a href=#attr-option-value>value</a></code><td><code id=elements-3:htmloptionelement><a href=#htmloptionelement>HTMLOptionElement</a></code><tr><th><code id=elements-3:the-output-element><a href=#the-output-element>output</a></code><td>Calculated output value<td><a href=#flow-content-2 id=elements-3:flow-content-2-95>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-85>phrasing</a>;
- <a href=#category-listed id=elements-3:category-listed-6>listed</a>;
- <a href=#category-label id=elements-3:category-label-5>labelable</a>;
- <a href=#category-reset id=elements-3:category-reset-3>resettable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-7>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-8>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-86>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-87>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-69>globals</a>;
- <code id=elements-3:attr-output-for><a href=#attr-output-for>for</a></code>;
- <code id=elements-3:attr-fae-form-7><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-fe-name-5><a href=#attr-fe-name>name</a></code><td><code id=elements-3:htmloutputelement><a href=#htmloutputelement>HTMLOutputElement</a></code><tr><th><code id=elements-3:the-p-element><a href=#the-p-element>p</a></code><td>Paragraph<td><a href=#flow-content-2 id=elements-3:flow-content-2-96>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-97>flow</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-88>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-70>globals</a><td><code id=elements-3:htmlparagraphelement><a href=#htmlparagraphelement>HTMLParagraphElement</a></code><tr><th><code id=elements-3:the-param-element-2><a href=#the-param-element>param</a></code><td>Parameter for <code id=elements-3:the-object-element-2><a href=#the-object-element>object</a></code><td>none<td><code id=elements-3:the-object-element-3><a href=#the-object-element>object</a></code>;
- <code id=elements-3:the-template-element-18><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-71>globals</a>;
- <code id=elements-3:attr-param-name><a href=#attr-param-name>name</a></code>;
- <code id=elements-3:attr-param-value><a href=#attr-param-value>value</a></code><td><code id=elements-3:htmlparamelement><a href=#htmlparamelement>HTMLParamElement</a></code><tr><th><code id=elements-3:the-pre-element><a href=#the-pre-element>pre</a></code><td>Block of preformatted text<td><a href=#flow-content-2 id=elements-3:flow-content-2-98>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-99>flow</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-89>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-72>globals</a><td><code id=elements-3:htmlpreelement><a href=#htmlpreelement>HTMLPreElement</a></code><tr><th><code id=elements-3:the-progress-element><a href=#the-progress-element>progress</a></code><td>Progress bar<td><a href=#flow-content-2 id=elements-3:flow-content-2-100>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-90>phrasing</a>;
- <a href=#category-label id=elements-3:category-label-6>labelable</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-91>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-92>phrasing</a>*<td><a href=#global-attributes id=elements-3:global-attributes-73>globals</a>;
- <code id=elements-3:attr-progress-value><a href=#attr-progress-value>value</a></code>;
- <code id=elements-3:attr-progress-max><a href=#attr-progress-max>max</a></code><td><code id=elements-3:htmlprogresselement><a href=#htmlprogresselement>HTMLProgressElement</a></code><tr><th><code id=elements-3:the-q-element><a href=#the-q-element>q</a></code><td>Quotation<td><a href=#flow-content-2 id=elements-3:flow-content-2-101>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-93>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-94>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-95>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-74>globals</a>;
- <code id=elements-3:attr-q-cite><a href=#attr-q-cite>cite</a></code><td><code id=elements-3:htmlquoteelement-2><a href=#htmlquoteelement>HTMLQuoteElement</a></code><tr><th><code id=elements-3:the-rp-element><a href=#the-rp-element>rp</a></code><td>Parenthesis for ruby annotation text<td>none<td><code id=elements-3:the-ruby-element><a href=#the-ruby-element>ruby</a></code>;
- <code id=elements-3:the-template-element-19><a href=#the-template-element>template</a></code><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-96>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-75>globals</a><td><code id=elements-3:htmlelement-25><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-rt-element><a href=#the-rt-element>rt</a></code><td>Ruby annotation text<td>none<td><code id=elements-3:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code>;
- <code id=elements-3:the-template-element-20><a href=#the-template-element>template</a></code><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-97>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-76>globals</a><td><code id=elements-3:htmlelement-26><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code><td>Ruby annotation(s)<td><a href=#flow-content-2 id=elements-3:flow-content-2-102>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-98>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-99>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-100>phrasing</a>;
- <code id=elements-3:the-rt-element-2><a href=#the-rt-element>rt</a></code>;
- <code id=elements-3:the-rp-element-2><a href=#the-rp-element>rp</a></code>*<td><a href=#global-attributes id=elements-3:global-attributes-77>globals</a><td><code id=elements-3:htmlelement-27><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-s-element><a href=#the-s-element>s</a></code><td>Inaccurate text<td><a href=#flow-content-2 id=elements-3:flow-content-2-103>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-101>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-102>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-103>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-78>globals</a><td><code id=elements-3:htmlelement-28><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-samp-element><a href=#the-samp-element>samp</a></code><td>Computer output<td><a href=#flow-content-2 id=elements-3:flow-content-2-104>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-104>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-105>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-106>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-79>globals</a><td><code id=elements-3:htmlelement-29><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-script-element><a href=#the-script-element>script</a></code><td>Embedded script<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-6>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-105>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-107>phrasing</a>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-6>script-supporting</a><td><code id=elements-3:the-head-element-7><a href=#the-head-element>head</a></code>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-108>phrasing</a>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-7>script-supporting</a><td>script, data, or script documentation*<td><a href=#global-attributes id=elements-3:global-attributes-80>globals</a>;
- <code id=elements-3:attr-script-src><a href=#attr-script-src>src</a></code>;
- <code id=elements-3:attr-script-type><a href=#attr-script-type>type</a></code>;
- <code id=elements-3:attr-script-charset><a href=#attr-script-charset>charset</a></code>;
- <code id=elements-3:attr-script-async><a href=#attr-script-async>async</a></code>;
- <code id=elements-3:attr-script-defer><a href=#attr-script-defer>defer</a></code>;
- <code id=elements-3:attr-script-crossorigin><a href=#attr-script-crossorigin>crossorigin</a></code><td><code id=elements-3:htmlscriptelement><a href=#htmlscriptelement>HTMLScriptElement</a></code><tr><th><code id=elements-3:the-section-element><a href=#the-section-element>section</a></code><td>Generic document or application section<td><a href=#flow-content-2 id=elements-3:flow-content-2-106>flow</a>;
- <a href=#sectioning-content-2 id=elements-3:sectioning-content-2-4>sectioning</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-107>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-108>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-81>globals</a><td><code id=elements-3:htmlelement-30><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-select-element-3><a href=#the-select-element>select</a></code><td>List box control<td><a href=#flow-content-2 id=elements-3:flow-content-2-109>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-109>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-12>interactive</a>;
- <a href=#category-listed id=elements-3:category-listed-7>listed</a>;
- <a href=#category-label id=elements-3:category-label-7>labelable</a>;
- <a href=#category-submit id=elements-3:category-submit-5>submittable</a>;
- <a href=#category-reset id=elements-3:category-reset-4>resettable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-8>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-9>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-110>phrasing</a><td><code id=elements-3:the-option-element-4><a href=#the-option-element>option</a></code>;
- <code id=elements-3:the-optgroup-element-3><a href=#the-optgroup-element>optgroup</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-8>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-82>globals</a>;
- <code id=elements-3:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>autocomplete</a></code>;
- <code id=elements-3:attr-fe-autofocus-4><a href=#attr-fe-autofocus>autofocus</a></code>;
- <code id=elements-3:attr-fe-disabled-4><a href=#attr-fe-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form-8><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-select-multiple><a href=#attr-select-multiple>multiple</a></code>;
- <code id=elements-3:attr-fe-name-6><a href=#attr-fe-name>name</a></code>;
- <code id=elements-3:attr-select-required><a href=#attr-select-required>required</a></code>;
- <code id=elements-3:attr-select-size><a href=#attr-select-size>size</a></code><td><code id=elements-3:htmlselectelement><a href=#htmlselectelement>HTMLSelectElement</a></code><tr><th><code id=elements-3:the-small-element><a href=#the-small-element>small</a></code><td>Side comment<td><a href=#flow-content-2 id=elements-3:flow-content-2-110>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-111>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-112>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-113>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-83>globals</a><td><code id=elements-3:htmlelement-31><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-source-element-2><a href=#the-source-element>source</a></code><td>Media source for <code id=elements-3:the-video-element><a href=#the-video-element>video</a></code> or <code id=elements-3:the-audio-element-2><a href=#the-audio-element>audio</a></code><td>none<td><code id=elements-3:the-video-element-2><a href=#the-video-element>video</a></code>;
- <code id=elements-3:the-audio-element-3><a href=#the-audio-element>audio</a></code>;
- <code id=elements-3:the-template-element-21><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-84>globals</a>;
- <code id=elements-3:attr-source-src><a href=#attr-source-src>src</a></code>;
- <code id=elements-3:attr-source-type><a href=#attr-source-type>type</a></code><td><code id=elements-3:htmlsourceelement><a href=#htmlsourceelement>HTMLSourceElement</a></code><tr><th><code id=elements-3:the-span-element><a href=#the-span-element>span</a></code><td>Generic phrasing container<td><a href=#flow-content-2 id=elements-3:flow-content-2-111>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-114>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-115>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-116>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-85>globals</a><td><code id=elements-3:htmlspanelement><a href=#htmlspanelement>HTMLSpanElement</a></code><tr><th><code id=elements-3:the-strong-element><a href=#the-strong-element>strong</a></code><td>Importance<td><a href=#flow-content-2 id=elements-3:flow-content-2-112>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-117>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-118>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-119>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-86>globals</a><td><code id=elements-3:htmlelement-32><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-style-element><a href=#the-style-element>style</a></code><td>Embedded styling information<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-7>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-113>flow</a>*<td><code id=elements-3:the-head-element-8><a href=#the-head-element>head</a></code>;
- <code id=elements-3:the-noscript-element-4><a href=#the-noscript-element>noscript</a></code>*;
- <a href=#flow-content-2 id=elements-3:flow-content-2-114>flow</a>*<td>varies*<td><a href=#global-attributes id=elements-3:global-attributes-87>globals</a>;
- <code id=elements-3:attr-style-media><a href=#attr-style-media>media</a></code>;
- <code id=elements-3:attr-style-type><a href=#attr-style-type>type</a></code>;
- <code id=elements-3:attr-style-scoped><a href=#attr-style-scoped>scoped</a></code><td><code id=elements-3:htmlstyleelement><a href=#htmlstyleelement>HTMLStyleElement</a></code><tr><th><code id=elements-3:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code><td>Subscript<td><a href=#flow-content-2 id=elements-3:flow-content-2-115>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-120>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-121>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-122>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-88>globals</a><td><code id=elements-3:htmlelement-33><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-summary-element-2><a href=#the-summary-element>summary</a></code><td>Caption for <code id=elements-3:the-details-element-2><a href=#the-details-element>details</a></code><td>none<td><code id=elements-3:the-details-element-3><a href=#the-details-element>details</a></code><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-123>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-89>globals</a><td><code id=elements-3:htmlelement-34><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code><td>Superscript<td><a href=#flow-content-2 id=elements-3:flow-content-2-116>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-124>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-125>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-126>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-90>globals</a><td><code id=elements-3:htmlelement-35><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-table-element-3><a href=#the-table-element>table</a></code><td>Table<td><a href=#flow-content-2 id=elements-3:flow-content-2-117>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-118>flow</a><td><code id=elements-3:the-caption-element-2><a href=#the-caption-element>caption</a></code>*;
- <code id=elements-3:the-colgroup-element-3><a href=#the-colgroup-element>colgroup</a></code>*;
- <code id=elements-3:the-thead-element><a href=#the-thead-element>thead</a></code>*;
- <code id=elements-3:the-tbody-element><a href=#the-tbody-element>tbody</a></code>*;
- <code id=elements-3:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>*;
- <code id=elements-3:the-tr-element><a href=#the-tr-element>tr</a></code>*;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-9>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-91>globals</a>;
- <code id=elements-3:attr-table-sortable><a href=#attr-table-sortable>sortable</a></code><td><code id=elements-3:htmltableelement><a href=#htmltableelement>HTMLTableElement</a></code><tr><th><code id=elements-3:the-tbody-element-2><a href=#the-tbody-element>tbody</a></code><td>Group of rows in a table<td>none<td><code id=elements-3:the-table-element-4><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-template-element-22><a href=#the-template-element>template</a></code><td><code id=elements-3:the-tr-element-2><a href=#the-tr-element>tr</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-10>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-92>globals</a><td><code id=elements-3:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code><tr><th><code id=elements-3:the-td-element><a href=#the-td-element>td</a></code><td>Table cell<td><a href=#sectioning-root id=elements-3:sectioning-root-7>sectioning root</a><td><code id=elements-3:the-tr-element-3><a href=#the-tr-element>tr</a></code>;
- <code id=elements-3:the-template-element-23><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-119>flow</a><td><a href=#global-attributes id=elements-3:global-attributes-93>globals</a>;
- <code id=elements-3:attr-tdth-colspan><a href=#attr-tdth-colspan>colspan</a></code>;
- <code id=elements-3:attr-tdth-rowspan><a href=#attr-tdth-rowspan>rowspan</a></code>;
- <code id=elements-3:attr-tdth-headers><a href=#attr-tdth-headers>headers</a></code><td><code id=elements-3:htmltabledatacellelement><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code><tr><th><code id=elements-3:the-template-element-24><a href=#the-template-element>template</a></code><td>Template<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-8>metadata</a>;
- <a href=#flow-content-2 id=elements-3:flow-content-2-120>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-127>phrasing</a>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-11>script-supporting</a><td><a href=#metadata-content-2 id=elements-3:metadata-content-2-9>metadata</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-128>phrasing</a>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-12>script-supporting</a>;
- <code id=elements-3:the-colgroup-element-4><a href=#the-colgroup-element>colgroup</a></code>*<td>it's complicated*<td><a href=#global-attributes id=elements-3:global-attributes-94>globals</a><td><code id=elements-3:htmltemplateelement><a href=#htmltemplateelement>HTMLTemplateElement</a></code><tr><th><code id=elements-3:the-textarea-element><a href=#the-textarea-element>textarea</a></code><td>Multiline text field<td><a href=#flow-content-2 id=elements-3:flow-content-2-121>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-129>phrasing</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-13>interactive</a>;
- <a href=#category-listed id=elements-3:category-listed-8>listed</a>;
- <a href=#category-label id=elements-3:category-label-8>labelable</a>;
- <a href=#category-submit id=elements-3:category-submit-6>submittable</a>;
- <a href=#category-reset id=elements-3:category-reset-5>resettable</a>;
- <a href=#category-form-attr id=elements-3:category-form-attr-9>reassociateable</a>;
- <a href=#form-associated-element id=elements-3:form-associated-element-10>form-associated</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-130>phrasing</a><td><a href=#text-content id=elements-3:text-content-2>text</a><td><a href=#global-attributes id=elements-3:global-attributes-95>globals</a>;
- <code id=elements-3:attr-fe-autofocus-5><a href=#attr-fe-autofocus>autofocus</a></code>;
- <code id=elements-3:attr-textarea-cols><a href=#attr-textarea-cols>cols</a></code>;
- <code id=elements-3:attr-fe-dirname-2><a href=#attr-fe-dirname>dirname</a></code>;
- <code id=elements-3:attr-fe-disabled-5><a href=#attr-fe-disabled>disabled</a></code>;
- <code id=elements-3:attr-fae-form-9><a href=#attr-fae-form>form</a></code>;
- <code id=elements-3:attr-fe-inputmode-2><a href=#attr-fe-inputmode>inputmode</a></code>;
- <code id=elements-3:attr-textarea-maxlength><a href=#attr-textarea-maxlength>maxlength</a></code>;
- <code id=elements-3:attr-textarea-minlength><a href=#attr-textarea-minlength>minlength</a></code>;
- <code id=elements-3:attr-fe-name-7><a href=#attr-fe-name>name</a></code>;
- <code id=elements-3:attr-textarea-placeholder><a href=#attr-textarea-placeholder>placeholder</a></code>;
- <code id=elements-3:attr-textarea-readonly><a href=#attr-textarea-readonly>readonly</a></code>;
- <code id=elements-3:attr-textarea-required><a href=#attr-textarea-required>required</a></code>;
- <code id=elements-3:attr-textarea-rows><a href=#attr-textarea-rows>rows</a></code>;
- <code id=elements-3:attr-textarea-wrap><a href=#attr-textarea-wrap>wrap</a></code><td><code id=elements-3:htmltextareaelement><a href=#htmltextareaelement>HTMLTextAreaElement</a></code><tr><th><code id=elements-3:the-tfoot-element-2><a href=#the-tfoot-element>tfoot</a></code><td>Group of footer rows in a table<td>none<td><code id=elements-3:the-table-element-5><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-template-element-25><a href=#the-template-element>template</a></code><td><code id=elements-3:the-tr-element-4><a href=#the-tr-element>tr</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-13>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-96>globals</a><td><code id=elements-3:htmltablesectionelement-2><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code><tr><th><code id=elements-3:the-th-element><a href=#the-th-element>th</a></code><td>Table header cell<td><a href=#interactive-content-2 id=elements-3:interactive-content-2-14>interactive</a>*<td><code id=elements-3:the-tr-element-5><a href=#the-tr-element>tr</a></code>;
- <code id=elements-3:the-template-element-26><a href=#the-template-element>template</a></code><td><a href=#flow-content-2 id=elements-3:flow-content-2-122>flow</a>*<td><a href=#global-attributes id=elements-3:global-attributes-97>globals</a>;
- <code id=elements-3:attr-tdth-colspan-2><a href=#attr-tdth-colspan>colspan</a></code>;
- <code id=elements-3:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>rowspan</a></code>;
- <code id=elements-3:attr-tdth-headers-2><a href=#attr-tdth-headers>headers</a></code>;
- <code id=elements-3:attr-th-scope><a href=#attr-th-scope>scope</a></code>;
- <code id=elements-3:attr-th-sorted><a href=#attr-th-sorted>sorted</a></code>;
- <code id=elements-3:attr-th-abbr><a href=#attr-th-abbr>abbr</a></code><td><code id=elements-3:htmltableheadercellelement><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code><tr><th><code id=elements-3:the-thead-element-2><a href=#the-thead-element>thead</a></code><td>Group of heading rows in a table<td>none<td><code id=elements-3:the-table-element-6><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-template-element-27><a href=#the-template-element>template</a></code><td><code id=elements-3:the-tr-element-6><a href=#the-tr-element>tr</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-14>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-98>globals</a><td><code id=elements-3:htmltablesectionelement-3><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code><tr><th><code id=elements-3:the-time-element><a href=#the-time-element>time</a></code><td>Machine-readable equivalent of date- or time-related data<td><a href=#flow-content-2 id=elements-3:flow-content-2-123>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-131>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-132>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-133>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-99>globals</a>;
- <code id=elements-3:attr-time-datetime><a href=#attr-time-datetime>datetime</a></code><td><code id=elements-3:htmltimeelement><a href=#htmltimeelement>HTMLTimeElement</a></code><tr><th><code id=elements-3:the-title-element><a href=#the-title-element>title</a></code><td>Document title<td><a href=#metadata-content-2 id=elements-3:metadata-content-2-10>metadata</a><td><code id=elements-3:the-head-element-9><a href=#the-head-element>head</a></code>;
- <code id=elements-3:the-template-element-28><a href=#the-template-element>template</a></code><td><a href=#text-content id=elements-3:text-content-3>text</a>*<td><a href=#global-attributes id=elements-3:global-attributes-100>globals</a><td><code id=elements-3:htmltitleelement><a href=#htmltitleelement>HTMLTitleElement</a></code><tr><th><code id=elements-3:the-tr-element-7><a href=#the-tr-element>tr</a></code><td>Table row<td>none<td><code id=elements-3:the-table-element-7><a href=#the-table-element>table</a></code>;
- <code id=elements-3:the-thead-element-3><a href=#the-thead-element>thead</a></code>;
- <code id=elements-3:the-tbody-element-3><a href=#the-tbody-element>tbody</a></code>;
- <code id=elements-3:the-tfoot-element-3><a href=#the-tfoot-element>tfoot</a></code>;
- <code id=elements-3:the-template-element-29><a href=#the-template-element>template</a></code><td><code id=elements-3:the-th-element-2><a href=#the-th-element>th</a></code>*;
- <code id=elements-3:the-td-element-2><a href=#the-td-element>td</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-15>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-101>globals</a><td><code id=elements-3:htmltablerowelement><a href=#htmltablerowelement>HTMLTableRowElement</a></code><tr><th><code id=elements-3:the-track-element><a href=#the-track-element>track</a></code><td>Timed text track<td>none<td><code id=elements-3:the-audio-element-4><a href=#the-audio-element>audio</a></code>;
- <code id=elements-3:the-video-element-3><a href=#the-video-element>video</a></code>;
- <code id=elements-3:the-template-element-30><a href=#the-template-element>template</a></code><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-102>globals</a>;
- <code id=elements-3:attr-track-default><a href=#attr-track-default>default</a></code>;
- <code id=elements-3:attr-track-kind><a href=#attr-track-kind>kind</a></code>;
- <code id=elements-3:attr-track-label><a href=#attr-track-label>label</a></code>;
- <code id=elements-3:attr-track-src><a href=#attr-track-src>src</a></code>;
- <code id=elements-3:attr-track-srclang><a href=#attr-track-srclang>srclang</a></code><td><code id=elements-3:htmltrackelement><a href=#htmltrackelement>HTMLTrackElement</a></code><tr><th><code id=elements-3:the-u-element><a href=#the-u-element>u</a></code><td>Keywords<td><a href=#flow-content-2 id=elements-3:flow-content-2-124>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-134>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-135>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-136>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-103>globals</a><td><code id=elements-3:htmlelement-36><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-ul-element-2><a href=#the-ul-element>ul</a></code><td>List<td><a href=#flow-content-2 id=elements-3:flow-content-2-125>flow</a><td><a href=#flow-content-2 id=elements-3:flow-content-2-126>flow</a><td><code id=elements-3:the-li-element-4><a href=#the-li-element>li</a></code>;
- <a href=#script-supporting-elements-2 id=elements-3:script-supporting-elements-2-16>script-supporting elements</a><td><a href=#global-attributes id=elements-3:global-attributes-104>globals</a><td><code id=elements-3:htmlulistelement><a href=#htmlulistelement>HTMLUListElement</a></code><tr><th><code id=elements-3:the-var-element><a href=#the-var-element>var</a></code><td>Variable<td><a href=#flow-content-2 id=elements-3:flow-content-2-127>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-137>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-138>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-139>phrasing</a><td><a href=#global-attributes id=elements-3:global-attributes-105>globals</a><td><code id=elements-3:htmlelement-37><a href=#htmlelement>HTMLElement</a></code><tr><th><code id=elements-3:the-video-element-4><a href=#the-video-element>video</a></code><td>Video player<td><a href=#flow-content-2 id=elements-3:flow-content-2-128>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-140>phrasing</a>;
- <a href=#embedded-content-category id=elements-3:embedded-content-category-7>embedded</a>;
- <a href=#interactive-content-2 id=elements-3:interactive-content-2-15>interactive</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-141>phrasing</a><td><code id=elements-3:the-source-element-3><a href=#the-source-element>source</a></code>*;
- <a href=#transparent id=elements-3:transparent-8>transparent</a>*<td><a href=#global-attributes id=elements-3:global-attributes-106>globals</a>;
- <code id=elements-3:attr-media-src-2><a href=#attr-media-src>src</a></code>;
- <code id=elements-3:attr-media-crossorigin-2><a href=#attr-media-crossorigin>crossorigin</a></code>;
- <code id=elements-3:attr-video-poster><a href=#attr-video-poster>poster</a></code>;
- <code id=elements-3:attr-media-preload-2><a href=#attr-media-preload>preload</a></code>;
- <code id=elements-3:attr-media-autoplay-2><a href=#attr-media-autoplay>autoplay</a></code>;
- <code id=elements-3:attr-media-mediagroup-2><a href=#attr-media-mediagroup>mediagroup</a></code>;
- <code id=elements-3:attr-media-loop-2><a href=#attr-media-loop>loop</a></code>;
- <code id=elements-3:attr-media-muted-2><a href=#attr-media-muted>muted</a></code>;
- <code id=elements-3:attr-media-controls-2><a href=#attr-media-controls>controls</a></code>;
- <code id=elements-3:attr-dim-width-6><a href=#attr-dim-width>width</a></code>;
- <code id=elements-3:attr-dim-height-6><a href=#attr-dim-height>height</a></code><td><code id=elements-3:htmlvideoelement><a href=#htmlvideoelement>HTMLVideoElement</a></code><tr><th><code id=elements-3:the-wbr-element><a href=#the-wbr-element>wbr</a></code><td>Line breaking opportunity<td><a href=#flow-content-2 id=elements-3:flow-content-2-129>flow</a>;
- <a href=#phrasing-content-2 id=elements-3:phrasing-content-2-142>phrasing</a><td><a href=#phrasing-content-2 id=elements-3:phrasing-content-2-143>phrasing</a><td>empty<td><a href=#global-attributes id=elements-3:global-attributes-107>globals</a><td><code id=elements-3:htmlelement-38><a href=#htmlelement>HTMLElement</a></code></table>
- <p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
- complicated than indicated in the table above.</small></p>
- <p class=tablenote><small>† Categories in the "Parents" column refer to parents that list
- the given categories in their content model, not to elements that themselves are in those
- categories. For example, the <code id=elements-3:the-a-element-2><a href=#the-a-element>a</a></code> element's "Parents" column says "phrasing", so any
- element whose content model contains the "phrasing" category could be a parent of an
- <code id=elements-3:the-a-element-3><a href=#the-a-element>a</a></code> element. Since the "flow" category includes all the "phrasing" elements, that means
- the <code id=elements-3:the-th-element-3><a href=#the-th-element>th</a></code> element could be a parent to an <code id=elements-3:the-a-element-4><a href=#the-a-element>a</a></code> element.</small></p>
- <h3 id=element-content-categories class=no-num>Element content categories</h3>
- <p><i>This section is non-normative.</i></p>
-
- <table><caption>List of element content categories</caption><thead><tr><th> Category
- <th> Elements
- <th> Elements with exceptions
- <tbody><tr><td> <a href=#metadata-content-2 id=element-content-categories:metadata-content-2>Metadata content</a>
- <td>
- <code id=element-content-categories:the-base-element><a href=#the-base-element>base</a></code>;
- <code id=element-content-categories:the-link-element><a href=#the-link-element>link</a></code>;
- <code id=element-content-categories:the-meta-element><a href=#the-meta-element>meta</a></code>;
- <code id=element-content-categories:the-noscript-element><a href=#the-noscript-element>noscript</a></code>;
- <code id=element-content-categories:the-script-element><a href=#the-script-element>script</a></code>;
- <code id=element-content-categories:the-style-element><a href=#the-style-element>style</a></code>;
- <code id=element-content-categories:the-template-element><a href=#the-template-element>template</a></code>;
- <code id=element-content-categories:the-title-element><a href=#the-title-element>title</a></code>
- <td>
- —
- <tr><td> <a href=#flow-content-2 id=element-content-categories:flow-content-2>Flow content</a>
- <td>
- <code id=element-content-categories:the-a-element><a href=#the-a-element>a</a></code>;
- <code id=element-content-categories:the-abbr-element><a href=#the-abbr-element>abbr</a></code>;
- <code id=element-content-categories:the-address-element><a href=#the-address-element>address</a></code>;
- <code id=element-content-categories:the-article-element><a href=#the-article-element>article</a></code>;
- <code id=element-content-categories:the-aside-element><a href=#the-aside-element>aside</a></code>;
- <code id=element-content-categories:the-audio-element><a href=#the-audio-element>audio</a></code>;
- <code id=element-content-categories:the-b-element><a href=#the-b-element>b</a></code>;
- <code id=element-content-categories:the-bdi-element><a href=#the-bdi-element>bdi</a></code>;
- <code id=element-content-categories:the-bdo-element><a href=#the-bdo-element>bdo</a></code>;
- <code id=element-content-categories:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>;
- <code id=element-content-categories:the-br-element><a href=#the-br-element>br</a></code>;
- <code id=element-content-categories:the-button-element><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-canvas-element><a href=#the-canvas-element>canvas</a></code>;
- <code id=element-content-categories:the-cite-element><a href=#the-cite-element>cite</a></code>;
- <code id=element-content-categories:the-code-element><a href=#the-code-element>code</a></code>;
- <code id=element-content-categories:the-data-element><a href=#the-data-element>data</a></code>;
- <code id=element-content-categories:the-datalist-element><a href=#the-datalist-element>datalist</a></code>;
- <code id=element-content-categories:the-del-element><a href=#the-del-element>del</a></code>;
- <code id=element-content-categories:the-details-element><a href=#the-details-element>details</a></code>;
- <code id=element-content-categories:the-dfn-element><a href=#the-dfn-element>dfn</a></code>;
- <code id=element-content-categories:the-dialog-element><a href=#the-dialog-element>dialog</a></code>;
- <code id=element-content-categories:the-div-element><a href=#the-div-element>div</a></code>;
- <code id=element-content-categories:the-dl-element><a href=#the-dl-element>dl</a></code>;
- <code id=element-content-categories:the-em-element><a href=#the-em-element>em</a></code>;
- <code id=element-content-categories:the-embed-element><a href=#the-embed-element>embed</a></code>;
- <code id=element-content-categories:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-figure-element><a href=#the-figure-element>figure</a></code>;
- <code id=element-content-categories:the-footer-element><a href=#the-footer-element>footer</a></code>;
- <code id=element-content-categories:the-form-element><a href=#the-form-element>form</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
- <code id=element-content-categories:the-header-element><a href=#the-header-element>header</a></code>;
- <code id=element-content-categories:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>;
- <code id=element-content-categories:the-hr-element><a href=#the-hr-element>hr</a></code>;
- <code id=element-content-categories:the-i-element><a href=#the-i-element>i</a></code>;
- <code id=element-content-categories:the-iframe-element><a href=#the-iframe-element>iframe</a></code>;
- <code id=element-content-categories:the-img-element><a href=#the-img-element>img</a></code>;
- <code id=element-content-categories:the-input-element><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-ins-element><a href=#the-ins-element>ins</a></code>;
- <code id=element-content-categories:the-kbd-element><a href=#the-kbd-element>kbd</a></code>;
- <code id=element-content-categories:the-keygen-element><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-main-element><a href=#the-main-element>main</a></code>;
- <code id=element-content-categories:the-map-element><a href=#the-map-element>map</a></code>;
- <code id=element-content-categories:the-mark-element><a href=#the-mark-element>mark</a></code>;
- <code id=element-content-categories:math><a href=#math>math</a></code>;
- <code id=element-content-categories:the-menu-element><a href=#the-menu-element>menu</a></code>;
- <code id=element-content-categories:the-meter-element><a href=#the-meter-element>meter</a></code>;
- <code id=element-content-categories:the-nav-element><a href=#the-nav-element>nav</a></code>;
- <code id=element-content-categories:the-noscript-element-2><a href=#the-noscript-element>noscript</a></code>;
- <code id=element-content-categories:the-object-element><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-ol-element><a href=#the-ol-element>ol</a></code>;
- <code id=element-content-categories:the-output-element><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-p-element><a href=#the-p-element>p</a></code>;
- <code id=element-content-categories:the-pre-element><a href=#the-pre-element>pre</a></code>;
- <code id=element-content-categories:the-progress-element><a href=#the-progress-element>progress</a></code>;
- <code id=element-content-categories:the-q-element><a href=#the-q-element>q</a></code>;
- <code id=element-content-categories:the-ruby-element><a href=#the-ruby-element>ruby</a></code>;
- <code id=element-content-categories:the-s-element><a href=#the-s-element>s</a></code>;
- <code id=element-content-categories:the-samp-element><a href=#the-samp-element>samp</a></code>;
- <code id=element-content-categories:the-script-element-2><a href=#the-script-element>script</a></code>;
- <code id=element-content-categories:the-section-element><a href=#the-section-element>section</a></code>;
- <code id=element-content-categories:the-select-element><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-small-element><a href=#the-small-element>small</a></code>;
- <code id=element-content-categories:the-span-element><a href=#the-span-element>span</a></code>;
- <code id=element-content-categories:the-strong-element><a href=#the-strong-element>strong</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>;
- <code id=element-content-categories:svg-2><a href=#svg-2>svg</a></code>;
- <code id=element-content-categories:the-table-element><a href=#the-table-element>table</a></code>;
- <code id=element-content-categories:the-template-element-2><a href=#the-template-element>template</a></code>;
- <code id=element-content-categories:the-textarea-element><a href=#the-textarea-element>textarea</a></code>;
- <code id=element-content-categories:the-time-element><a href=#the-time-element>time</a></code>;
- <code id=element-content-categories:the-u-element><a href=#the-u-element>u</a></code>;
- <code id=element-content-categories:the-ul-element><a href=#the-ul-element>ul</a></code>;
- <code id=element-content-categories:the-var-element><a href=#the-var-element>var</a></code>;
- <code id=element-content-categories:the-video-element><a href=#the-video-element>video</a></code>;
- <code id=element-content-categories:the-wbr-element><a href=#the-wbr-element>wbr</a></code>;
- <a href=#text-content id=element-content-categories:text-content>Text</a>
- <td>
- <code id=element-content-categories:the-area-element><a href=#the-area-element>area</a></code> (if it is a descendant of a <code id=element-content-categories:the-map-element-2><a href=#the-map-element>map</a></code> element);
- <code id=element-content-categories:the-link-element-2><a href=#the-link-element>link</a></code> (if the <code id=element-content-categories:names:-the-itemprop-attribute><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
- <code id=element-content-categories:the-meta-element-2><a href=#the-meta-element>meta</a></code> (if the <code id=element-content-categories:names:-the-itemprop-attribute-2><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
- <code id=element-content-categories:the-style-element-2><a href=#the-style-element>style</a></code> (if the <code id=element-content-categories:attr-style-scoped><a href=#attr-style-scoped>scoped</a></code> attribute is present)
- <tr><td> <a href=#sectioning-content-2 id=element-content-categories:sectioning-content-2>Sectioning content</a>
- <td>
- <code id=element-content-categories:the-article-element-2><a href=#the-article-element>article</a></code>;
- <code id=element-content-categories:the-aside-element-2><a href=#the-aside-element>aside</a></code>;
- <code id=element-content-categories:the-nav-element-2><a href=#the-nav-element>nav</a></code>;
- <code id=element-content-categories:the-section-element-2><a href=#the-section-element>section</a></code>
- <td>
- —
- <tr><td> <a href=#heading-content-2 id=element-content-categories:heading-content-2>Heading content</a>
- <td>
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-7><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-8><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-9><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-10><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-11><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-12><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
- <code id=element-content-categories:the-hgroup-element-2><a href=#the-hgroup-element>hgroup</a></code>
- <td>
- —
- <tr><td> <a href=#phrasing-content-2 id=element-content-categories:phrasing-content-2>Phrasing content</a>
- <td>
- <code id=element-content-categories:the-a-element-2><a href=#the-a-element>a</a></code>;
- <code id=element-content-categories:the-abbr-element-2><a href=#the-abbr-element>abbr</a></code>;
- <code id=element-content-categories:the-audio-element-2><a href=#the-audio-element>audio</a></code>;
- <code id=element-content-categories:the-b-element-2><a href=#the-b-element>b</a></code>;
- <code id=element-content-categories:the-bdi-element-2><a href=#the-bdi-element>bdi</a></code>;
- <code id=element-content-categories:the-bdo-element-2><a href=#the-bdo-element>bdo</a></code>;
- <code id=element-content-categories:the-br-element-2><a href=#the-br-element>br</a></code>;
- <code id=element-content-categories:the-button-element-2><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-canvas-element-2><a href=#the-canvas-element>canvas</a></code>;
- <code id=element-content-categories:the-cite-element-2><a href=#the-cite-element>cite</a></code>;
- <code id=element-content-categories:the-code-element-2><a href=#the-code-element>code</a></code>;
- <code id=element-content-categories:the-data-element-2><a href=#the-data-element>data</a></code>;
- <code id=element-content-categories:the-datalist-element-2><a href=#the-datalist-element>datalist</a></code>;
- <code id=element-content-categories:the-del-element-2><a href=#the-del-element>del</a></code>;
- <code id=element-content-categories:the-dfn-element-2><a href=#the-dfn-element>dfn</a></code>;
- <code id=element-content-categories:the-em-element-2><a href=#the-em-element>em</a></code>;
- <code id=element-content-categories:the-embed-element-2><a href=#the-embed-element>embed</a></code>;
- <code id=element-content-categories:the-i-element-2><a href=#the-i-element>i</a></code>;
- <code id=element-content-categories:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>;
- <code id=element-content-categories:the-img-element-2><a href=#the-img-element>img</a></code>;
- <code id=element-content-categories:the-input-element-2><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-ins-element-2><a href=#the-ins-element>ins</a></code>;
- <code id=element-content-categories:the-kbd-element-2><a href=#the-kbd-element>kbd</a></code>;
- <code id=element-content-categories:the-keygen-element-2><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element-2><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-map-element-3><a href=#the-map-element>map</a></code>;
- <code id=element-content-categories:the-mark-element-2><a href=#the-mark-element>mark</a></code>;
- <code id=element-content-categories:math-2><a href=#math>math</a></code>;
- <code id=element-content-categories:the-meter-element-2><a href=#the-meter-element>meter</a></code>;
- <code id=element-content-categories:the-noscript-element-3><a href=#the-noscript-element>noscript</a></code>;
- <code id=element-content-categories:the-object-element-2><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-output-element-2><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-progress-element-2><a href=#the-progress-element>progress</a></code>;
- <code id=element-content-categories:the-q-element-2><a href=#the-q-element>q</a></code>;
- <code id=element-content-categories:the-ruby-element-2><a href=#the-ruby-element>ruby</a></code>;
- <code id=element-content-categories:the-s-element-2><a href=#the-s-element>s</a></code>;
- <code id=element-content-categories:the-samp-element-2><a href=#the-samp-element>samp</a></code>;
- <code id=element-content-categories:the-script-element-3><a href=#the-script-element>script</a></code>;
- <code id=element-content-categories:the-select-element-2><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-small-element-2><a href=#the-small-element>small</a></code>;
- <code id=element-content-categories:the-span-element-2><a href=#the-span-element>span</a></code>;
- <code id=element-content-categories:the-strong-element-2><a href=#the-strong-element>strong</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements-3><a href=#the-sub-and-sup-elements>sub</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements-4><a href=#the-sub-and-sup-elements>sup</a></code>;
- <code id=element-content-categories:svg-2-2><a href=#svg-2>svg</a></code>;
- <code id=element-content-categories:the-template-element-3><a href=#the-template-element>template</a></code>;
- <code id=element-content-categories:the-textarea-element-2><a href=#the-textarea-element>textarea</a></code>;
- <code id=element-content-categories:the-time-element-2><a href=#the-time-element>time</a></code>;
- <code id=element-content-categories:the-u-element-2><a href=#the-u-element>u</a></code>;
- <code id=element-content-categories:the-var-element-2><a href=#the-var-element>var</a></code>;
- <code id=element-content-categories:the-video-element-2><a href=#the-video-element>video</a></code>;
- <code id=element-content-categories:the-wbr-element-2><a href=#the-wbr-element>wbr</a></code>;
- <a href=#text-content id=element-content-categories:text-content-2>Text</a>
- <td>
- <code id=element-content-categories:the-area-element-2><a href=#the-area-element>area</a></code> (if it is a descendant of a <code id=element-content-categories:the-map-element-4><a href=#the-map-element>map</a></code> element);
- <code id=element-content-categories:the-link-element-3><a href=#the-link-element>link</a></code> (if the <code id=element-content-categories:names:-the-itemprop-attribute-3><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present);
- <code id=element-content-categories:the-meta-element-3><a href=#the-meta-element>meta</a></code> (if the <code id=element-content-categories:names:-the-itemprop-attribute-4><a href=#names:-the-itemprop-attribute>itemprop</a></code> attribute is present)
- <tr><td> <a href=#embedded-content-category id=element-content-categories:embedded-content-category>Embedded content</a>
- <td>
- <code id=element-content-categories:the-audio-element-3><a href=#the-audio-element>audio</a></code>;
- <code id=element-content-categories:the-canvas-element-3><a href=#the-canvas-element>canvas</a></code>;
- <code id=element-content-categories:the-embed-element-3><a href=#the-embed-element>embed</a></code>;
- <code id=element-content-categories:the-iframe-element-3><a href=#the-iframe-element>iframe</a></code>;
- <code id=element-content-categories:the-img-element-3><a href=#the-img-element>img</a></code>;
- <code id=element-content-categories:math-3><a href=#math>math</a></code>;
- <code id=element-content-categories:the-object-element-3><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:svg-2-3><a href=#svg-2>svg</a></code>;
- <code id=element-content-categories:the-video-element-3><a href=#the-video-element>video</a></code>
- <td>
- —
- <tr><td> <a href=#interactive-content-2 id=element-content-categories:interactive-content-2>Interactive content</a>*
- <td>
- <code id=element-content-categories:the-a-element-3><a href=#the-a-element>a</a></code>;
- <code id=element-content-categories:the-button-element-3><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-details-element-2><a href=#the-details-element>details</a></code>;
- <code id=element-content-categories:the-embed-element-4><a href=#the-embed-element>embed</a></code>;
- <code id=element-content-categories:the-iframe-element-4><a href=#the-iframe-element>iframe</a></code>;
- <code id=element-content-categories:the-keygen-element-3><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element-3><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-select-element-3><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-3><a href=#the-textarea-element>textarea</a></code>
- <td>
- <code id=element-content-categories:the-audio-element-4><a href=#the-audio-element>audio</a></code> (if the <code id=element-content-categories:attr-media-controls><a href=#attr-media-controls>controls</a></code> attribute is present);
- <code id=element-content-categories:the-img-element-4><a href=#the-img-element>img</a></code> (if the <code id=element-content-categories:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present);
- <code id=element-content-categories:the-input-element-3><a href=#the-input-element>input</a></code> (if the <code id=element-content-categories:attr-input-type><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="element-content-categories:hidden-state-(type=hidden)">Hidden</a> state);
- <code id=element-content-categories:the-object-element-4><a href=#the-object-element>object</a></code> (if the <code id=element-content-categories:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>usemap</a></code> attribute is present);
- <code id=element-content-categories:the-th-element><a href=#the-th-element>th</a></code> (for <a href=#sorting-interface-th-element id=element-content-categories:sorting-interface-th-element>sorting interface <code>th</code> elements</a>)
- <code id=element-content-categories:the-video-element-4><a href=#the-video-element>video</a></code> (if the <code id=element-content-categories:attr-media-controls-2><a href=#attr-media-controls>controls</a></code> attribute is present)
- <tr><td> <a href=#sectioning-root id=element-content-categories:sectioning-root>Sectioning roots</a>
- <td>
- <code id=element-content-categories:the-blockquote-element-2><a href=#the-blockquote-element>blockquote</a></code>;
- <code id=element-content-categories:the-body-element><a href=#the-body-element>body</a></code>;
- <code id=element-content-categories:the-details-element-3><a href=#the-details-element>details</a></code>;
- <code id=element-content-categories:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code>;
- <code id=element-content-categories:the-fieldset-element-2><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-figure-element-2><a href=#the-figure-element>figure</a></code>;
- <code id=element-content-categories:the-td-element><a href=#the-td-element>td</a></code>
- <td>
- —
- <tr><td> <a href=#form-associated-element id=element-content-categories:form-associated-element>Form-associated elements</a>
- <td>
- <code id=element-content-categories:the-button-element-4><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-fieldset-element-3><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-input-element-4><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-4><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element-4><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-object-element-5><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-output-element-3><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-select-element-4><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-4><a href=#the-textarea-element>textarea</a></code>;
- <code id=element-content-categories:the-img-element-5><a href=#the-img-element>img</a></code>
- <td>
- —
- <tr><td> <a href=#category-listed id=element-content-categories:category-listed>Listed elements</a>
- <td>
- <code id=element-content-categories:the-button-element-5><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-fieldset-element-4><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-input-element-5><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-5><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-object-element-6><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-output-element-4><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-select-element-5><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-5><a href=#the-textarea-element>textarea</a></code>
- <td>
- —
- <tr><td> <a href=#category-submit id=element-content-categories:category-submit>Submittable elements</a>
- <td>
- <code id=element-content-categories:the-button-element-6><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-input-element-6><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-6><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-object-element-7><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-select-element-6><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-6><a href=#the-textarea-element>textarea</a></code>
- <td>
- —
- <tr><td> <a href=#category-reset id=element-content-categories:category-reset>Resettable elements</a>
- <td>
- <code id=element-content-categories:the-input-element-7><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-7><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-output-element-5><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-select-element-7><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-7><a href=#the-textarea-element>textarea</a></code>
- <td>
- —
- <tr><td> <a href=#category-label id=element-content-categories:category-label>Labelable elements</a>
- <td>
- <code id=element-content-categories:the-button-element-7><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-input-element-8><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-8><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-meter-element-3><a href=#the-meter-element>meter</a></code>;
- <code id=element-content-categories:the-output-element-6><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-progress-element-3><a href=#the-progress-element>progress</a></code>;
- <code id=element-content-categories:the-select-element-8><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-8><a href=#the-textarea-element>textarea</a></code>
- <td>
- —
- <tr><td> <a href=#category-form-attr id=element-content-categories:category-form-attr>Reassociateable elements</a>
- <td>
- <code id=element-content-categories:the-button-element-8><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-fieldset-element-5><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-input-element-9><a href=#the-input-element>input</a></code>;
- <code id=element-content-categories:the-keygen-element-9><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element-5><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-object-element-8><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-output-element-7><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-select-element-9><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-textarea-element-9><a href=#the-textarea-element>textarea</a></code>
- <td>
- —
- <tr><td> <a href=#palpable-content-2 id=element-content-categories:palpable-content-2>Palpable content</a>
- <td>
- <code id=element-content-categories:the-a-element-4><a href=#the-a-element>a</a></code>;
- <code id=element-content-categories:the-abbr-element-3><a href=#the-abbr-element>abbr</a></code>;
- <code id=element-content-categories:the-address-element-2><a href=#the-address-element>address</a></code>;
- <code id=element-content-categories:the-article-element-3><a href=#the-article-element>article</a></code>;
- <code id=element-content-categories:the-aside-element-3><a href=#the-aside-element>aside</a></code>;
- <code id=element-content-categories:the-b-element-3><a href=#the-b-element>b</a></code>;
- <code id=element-content-categories:the-bdi-element-3><a href=#the-bdi-element>bdi</a></code>;
- <code id=element-content-categories:the-bdo-element-3><a href=#the-bdo-element>bdo</a></code>;
- <code id=element-content-categories:the-blockquote-element-3><a href=#the-blockquote-element>blockquote</a></code>;
- <code id=element-content-categories:the-button-element-9><a href=#the-button-element>button</a></code>;
- <code id=element-content-categories:the-canvas-element-4><a href=#the-canvas-element>canvas</a></code>;
- <code id=element-content-categories:the-cite-element-3><a href=#the-cite-element>cite</a></code>;
- <code id=element-content-categories:the-code-element-3><a href=#the-code-element>code</a></code>;
- <code id=element-content-categories:the-data-element-3><a href=#the-data-element>data</a></code>;
- <code id=element-content-categories:the-details-element-4><a href=#the-details-element>details</a></code>;
- <code id=element-content-categories:the-dfn-element-3><a href=#the-dfn-element>dfn</a></code>;
- <code id=element-content-categories:the-div-element-2><a href=#the-div-element>div</a></code>;
- <code id=element-content-categories:the-em-element-3><a href=#the-em-element>em</a></code>;
- <code id=element-content-categories:the-embed-element-5><a href=#the-embed-element>embed</a></code>;
- <code id=element-content-categories:the-fieldset-element-6><a href=#the-fieldset-element>fieldset</a></code>;
- <code id=element-content-categories:the-figure-element-3><a href=#the-figure-element>figure</a></code>;
- <code id=element-content-categories:the-footer-element-2><a href=#the-footer-element>footer</a></code>;
- <code id=element-content-categories:the-form-element-2><a href=#the-form-element>form</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-13><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-14><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-15><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-16><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-17><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>;
- <code id=element-content-categories:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-18><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>;
- <code id=element-content-categories:the-header-element-2><a href=#the-header-element>header</a></code>;
- <code id=element-content-categories:the-hgroup-element-3><a href=#the-hgroup-element>hgroup</a></code>;
- <code id=element-content-categories:the-i-element-3><a href=#the-i-element>i</a></code>;
- <code id=element-content-categories:the-iframe-element-5><a href=#the-iframe-element>iframe</a></code>;
- <code id=element-content-categories:the-img-element-6><a href=#the-img-element>img</a></code>;
- <code id=element-content-categories:the-ins-element-3><a href=#the-ins-element>ins</a></code>;
- <code id=element-content-categories:the-kbd-element-3><a href=#the-kbd-element>kbd</a></code>;
- <code id=element-content-categories:the-keygen-element-10><a href=#the-keygen-element>keygen</a></code>;
- <code id=element-content-categories:the-label-element-6><a href=#the-label-element>label</a></code>;
- <code id=element-content-categories:the-main-element-2><a href=#the-main-element>main</a></code>;
- <code id=element-content-categories:the-map-element-5><a href=#the-map-element>map</a></code>;
- <code id=element-content-categories:the-mark-element-3><a href=#the-mark-element>mark</a></code>;
- <code id=element-content-categories:math-4><a href=#math>math</a></code>;
- <code id=element-content-categories:the-meter-element-4><a href=#the-meter-element>meter</a></code>;
- <code id=element-content-categories:the-nav-element-3><a href=#the-nav-element>nav</a></code>;
- <code id=element-content-categories:the-object-element-9><a href=#the-object-element>object</a></code>;
- <code id=element-content-categories:the-output-element-8><a href=#the-output-element>output</a></code>;
- <code id=element-content-categories:the-p-element-2><a href=#the-p-element>p</a></code>;
- <code id=element-content-categories:the-pre-element-2><a href=#the-pre-element>pre</a></code>;
- <code id=element-content-categories:the-progress-element-4><a href=#the-progress-element>progress</a></code>;
- <code id=element-content-categories:the-q-element-3><a href=#the-q-element>q</a></code>;
- <code id=element-content-categories:the-ruby-element-3><a href=#the-ruby-element>ruby</a></code>;
- <code id=element-content-categories:the-s-element-3><a href=#the-s-element>s</a></code>;
- <code id=element-content-categories:the-samp-element-3><a href=#the-samp-element>samp</a></code>;
- <code id=element-content-categories:the-section-element-3><a href=#the-section-element>section</a></code>;
- <code id=element-content-categories:the-select-element-10><a href=#the-select-element>select</a></code>;
- <code id=element-content-categories:the-small-element-3><a href=#the-small-element>small</a></code>;
- <code id=element-content-categories:the-span-element-3><a href=#the-span-element>span</a></code>;
- <code id=element-content-categories:the-strong-element-3><a href=#the-strong-element>strong</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements-5><a href=#the-sub-and-sup-elements>sub</a></code>;
- <code id=element-content-categories:the-sub-and-sup-elements-6><a href=#the-sub-and-sup-elements>sup</a></code>;
- <code id=element-content-categories:svg-2-4><a href=#svg-2>svg</a></code>;
- <code id=element-content-categories:the-table-element-2><a href=#the-table-element>table</a></code>;
- <code id=element-content-categories:the-textarea-element-10><a href=#the-textarea-element>textarea</a></code>;
- <code id=element-content-categories:the-time-element-3><a href=#the-time-element>time</a></code>;
- <code id=element-content-categories:the-u-element-3><a href=#the-u-element>u</a></code>;
- <code id=element-content-categories:the-var-element-3><a href=#the-var-element>var</a></code>;
- <code id=element-content-categories:the-video-element-5><a href=#the-video-element>video</a></code>
- <td>
- <code id=element-content-categories:the-audio-element-5><a href=#the-audio-element>audio</a></code> (if the <code id=element-content-categories:attr-media-controls-3><a href=#attr-media-controls>controls</a></code> attribute is present);
- <code id=element-content-categories:the-dl-element-2><a href=#the-dl-element>dl</a></code> (if the element's children include at least one name-value group);
- <code id=element-content-categories:the-input-element-10><a href=#the-input-element>input</a></code> (if the <code id=element-content-categories:attr-input-type-2><a href=#attr-input-type>type</a></code> attribute is <em>not</em> in the <a href="#hidden-state-(type=hidden)" id="element-content-categories:hidden-state-(type=hidden)-2">Hidden</a> state);
- <code id=element-content-categories:the-menu-element-2><a href=#the-menu-element>menu</a></code> (if the <code id=element-content-categories:attr-menu-type><a href=#attr-menu-type>type</a></code> attribute is in the <a href=#toolbar-state id=element-content-categories:toolbar-state>toolbar</a> state);
- <code id=element-content-categories:the-ol-element-2><a href=#the-ol-element>ol</a></code> (if the element's children include at least one <code id=element-content-categories:the-li-element><a href=#the-li-element>li</a></code> element);
- <code id=element-content-categories:the-ul-element-2><a href=#the-ul-element>ul</a></code> (if the element's children include at least one <code id=element-content-categories:the-li-element-2><a href=#the-li-element>li</a></code> element);
- <a href=#text-content id=element-content-categories:text-content-3>Text</a> that is not <a href=#inter-element-whitespace id=element-content-categories:inter-element-whitespace>inter-element whitespace</a>
- <tr><td> <a href=#script-supporting-elements-2 id=element-content-categories:script-supporting-elements-2>Script-supporting elements</a>
- <td>
- <code id=element-content-categories:the-script-element-4><a href=#the-script-element>script</a></code>;
- <code id=element-content-categories:the-template-element-4><a href=#the-template-element>template</a></code>
- <td>
- —
- </table>
- <p class=tablenote><small>* The <code id=element-content-categories:attr-tabindex><a href=#attr-tabindex>tabindex</a></code> attribute can also
- make any element into <a href=#interactive-content-2 id=element-content-categories:interactive-content-2-2>interactive content</a>.</small></p>
- <h3 id=attributes-3 class=no-num>Attributes</h3>
- <p><i>This section is non-normative.</i></p>
- <table><caption>List of attributes (excluding event handler content attributes)</caption><thead><tr><th> Attribute
- <th> Element(s)
- <th> Description
- <th> Value
- <tbody><tr><th> <code>abbr</code>
- <td> <code id=attributes-3:attr-th-abbr><a href=#attr-th-abbr>th</a></code>
- <td> Alternative label to use for the header cell when referencing the cell in other contexts
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>accept</code>
- <td> <code id=attributes-3:attr-input-accept><a href=#attr-input-accept>input</a></code>
- <td> Hint for expected file type in <a href="#file-upload-state-(type=file)" id="attributes-3:file-upload-state-(type=file)">file upload controls</a>
- <td> <a href=#set-of-comma-separated-tokens id=attributes-3:set-of-comma-separated-tokens>Set of comma-separated tokens</a>* consisting of <a href=#valid-mime-type id=attributes-3:valid-mime-type>valid MIME types with no parameters</a> or <code>audio/*</code>, <code>video/*</code>, or <code>image/*</code>
- <tr><th> <code>accept-charset</code>
- <td> <code id=attributes-3:attr-form-accept-charset><a href=#attr-form-accept-charset>form</a></code>
- <td> Character encodings to use for <a href=#form-submission-2 id=attributes-3:form-submission-2>form submission</a>
- <td> <a href=#ordered-set-of-unique-space-separated-tokens id=attributes-3:ordered-set-of-unique-space-separated-tokens>Ordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive id=attributes-3:ascii-case-insensitive>ASCII case-insensitive</a>, consisting of <a href=#encoding-label id=attributes-3:encoding-label>labels</a> of <a href=#ascii-compatible-character-encoding id=attributes-3:ascii-compatible-character-encoding>ASCII-compatible character encodings</a>*
- <tr><th> <code>accesskey</code>
- <td> <a href=#the-accesskey-attribute id=attributes-3:the-accesskey-attribute>HTML elements</a>
- <td> Keyboard shortcut to activate or focus element
- <td> <a href=#ordered-set-of-unique-space-separated-tokens id=attributes-3:ordered-set-of-unique-space-separated-tokens-2>Ordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive>case-sensitive</a>, consisting of one Unicode code point in length
- <tr><th> <code>action</code>
- <td> <code id=attributes-3:attr-fs-action><a href=#attr-fs-action>form</a></code>
- <td> <a href=#url id=attributes-3:url>URL</a> to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-2>form submission</a>
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>allowfullscreen</code>
- <td> <code id=attributes-3:attr-iframe-allowfullscreen><a href=#attr-iframe-allowfullscreen>iframe</a></code>
- <td> Whether to allow the <code id=attributes-3:the-iframe-element><a href=#the-iframe-element>iframe</a></code>'s contents to use <code id=attributes-3:dom-element-requestfullscreen><a href=#dom-element-requestfullscreen>requestFullscreen()</a></code>
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute>Boolean attribute</a>
- <tr><th> <code>alt</code>
- <td> <code id=attributes-3:attr-area-alt><a href=#attr-area-alt>area</a></code>;
- <code id=attributes-3:attr-img-alt><a href=#attr-img-alt>img</a></code>;
- <code id=attributes-3:attr-input-alt><a href=#attr-input-alt>input</a></code>
- <td> Replacement text for use when images are not available
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>async</code>
- <td> <code id=attributes-3:attr-script-async><a href=#attr-script-async>script</a></code>
- <td> Execute script asynchronously
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-2>Boolean attribute</a>
- <tr><th> <code>autocomplete</code>
- <td> <code id=attributes-3:attr-form-autocomplete><a href=#attr-form-autocomplete>form</a></code>
- <td> Default setting for autofill feature for controls in the form
- <td> "<code>on</code>"; "<code>off</code>"
- <tr><th> <code>autocomplete</code>
- <td> <code id=attributes-3:attr-fe-autocomplete><a href=#attr-fe-autocomplete>input</a></code>;
- <code id=attributes-3:attr-fe-autocomplete-2><a href=#attr-fe-autocomplete>select</a></code>;
- <code id=attributes-3:attr-fe-autocomplete-3><a href=#attr-fe-autocomplete>textarea</a></code>
- <td> Hint for form autofill feature
- <td> <a href=#autofill-field id=attributes-3:autofill-field>Autofill field</a> name and related tokens*
- <tr><th> <code>autofocus</code>
- <td> <code id=attributes-3:attr-fe-autofocus><a href=#attr-fe-autofocus>button</a></code>;
- <code id=attributes-3:attr-fe-autofocus-2><a href=#attr-fe-autofocus>input</a></code>;
- <code id=attributes-3:attr-fe-autofocus-3><a href=#attr-fe-autofocus>keygen</a></code>;
- <code id=attributes-3:attr-fe-autofocus-4><a href=#attr-fe-autofocus>select</a></code>;
- <code id=attributes-3:attr-fe-autofocus-5><a href=#attr-fe-autofocus>textarea</a></code>
- <td> Automatically focus the form control when the page is loaded
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-3>Boolean attribute</a>
- <tr><th> <code>autoplay</code>
- <td> <code id=attributes-3:attr-media-autoplay><a href=#attr-media-autoplay>audio</a></code>;
- <code id=attributes-3:attr-media-autoplay-2><a href=#attr-media-autoplay>video</a></code>
- <td> Hint that the <a href=#media-resource id=attributes-3:media-resource>media resource</a> can be started automatically when the page is loaded
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-4>Boolean attribute</a>
- <tr><th> <code>challenge</code>
- <td> <code id=attributes-3:attr-keygen-challenge><a href=#attr-keygen-challenge>keygen</a></code>
- <td> String to package with the generated and signed public key
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>charset</code>
- <td> <code id=attributes-3:attr-meta-charset><a href=#attr-meta-charset>meta</a></code>
- <td> <a href=#character-encoding-declaration id=attributes-3:character-encoding-declaration>Character encoding declaration</a>
- <td> <a href=#encoding-label id=attributes-3:encoding-label-2>Encoding label</a>*
- <tr><th> <code>charset</code>
- <td> <code id=attributes-3:attr-script-charset><a href=#attr-script-charset>script</a></code>
- <td> Character encoding of the external script resource
- <td> <a href=#encoding-label id=attributes-3:encoding-label-3>Encoding label</a>*
- <tr><th> <code>checked</code>
- <td> <code id=attributes-3:attr-menuitem-checked><a href=#attr-menuitem-checked>menuitem</a></code>;
- <code id=attributes-3:attr-input-checked><a href=#attr-input-checked>input</a></code>
- <td> Whether the command or control is checked
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-5>Boolean attribute</a>
- <tr><th> <code>cite</code>
- <td> <code id=attributes-3:attr-blockquote-cite><a href=#attr-blockquote-cite>blockquote</a></code>;
- <code id=attributes-3:attr-mod-cite><a href=#attr-mod-cite>del</a></code>;
- <code id=attributes-3:attr-mod-cite-2><a href=#attr-mod-cite>ins</a></code>;
- <code id=attributes-3:attr-q-cite><a href=#attr-q-cite>q</a></code>
- <td> Link to the source of the quotation or more information about the edit
- <td> <a href=#valid-url-potentially-surrounded-by-spaces id=attributes-3:valid-url-potentially-surrounded-by-spaces>Valid URL potentially surrounded by spaces</a>
- <tr><th> <code>class</code>
- <td> <a href=#classes id=attributes-3:classes>HTML elements</a>
- <td> Classes to which the element belongs
- <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens>Set of space-separated tokens</a>
- <tr><th> <code>cols</code>
- <td> <code id=attributes-3:attr-textarea-cols><a href=#attr-textarea-cols>textarea</a></code>
- <td> Maximum number of characters per line
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer>Valid non-negative integer</a> greater than zero
- <tr><th> <code>colspan</code>
- <td> <code id=attributes-3:attr-tdth-colspan><a href=#attr-tdth-colspan>td</a></code>;
- <code id=attributes-3:attr-tdth-colspan-2><a href=#attr-tdth-colspan>th</a></code>
- <td> Number of columns that the cell is to span
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-2>Valid non-negative integer</a> greater than zero
- <tr><th> <code>command</code>
- <td> <code id=attributes-3:attr-menuitem-command><a href=#attr-menuitem-command>menuitem</a></code>
- <td> Command definition
- <td> <a href=#concept-id id=attributes-3:concept-id>ID</a>*
- <tr><th> <code>content</code>
- <td> <code id=attributes-3:attr-meta-content><a href=#attr-meta-content>meta</a></code>
- <td> Value of the element
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>contenteditable</code>
- <td> <a href=#attr-contenteditable id=attributes-3:attr-contenteditable>HTML elements</a>
- <td> Whether the element is editable
- <td> "<code>true</code>"; "<code>false</code>"
- <tr><th> <code>contextmenu</code>
- <td> <a href=#attr-contextmenu id=attributes-3:attr-contextmenu>HTML elements</a>
- <td> The element's context menu
- <td> <a href=#concept-id id=attributes-3:concept-id-2>ID</a>*
- <tr><th> <code>controls</code>
- <td> <code id=attributes-3:attr-media-controls><a href=#attr-media-controls>audio</a></code>;
- <code id=attributes-3:attr-media-controls-2><a href=#attr-media-controls>video</a></code>
- <td> Show user agent controls
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-6>Boolean attribute</a>
- <tr><th> <code>coords</code>
- <td> <code id=attributes-3:attr-area-coords><a href=#attr-area-coords>area</a></code>
- <td> Coordinates for the shape to be created in an <a href=#image-map id=attributes-3:image-map>image map</a>
- <td> <a href=#valid-list-of-integers id=attributes-3:valid-list-of-integers>Valid list of integers</a>*
- <tr><th> <code>crossorigin</code>
- <td> <code id=attributes-3:attr-media-crossorigin><a href=#attr-media-crossorigin>audio</a></code>;
- <code id=attributes-3:attr-img-crossorigin><a href=#attr-img-crossorigin>img</a></code>;
- <code id=attributes-3:attr-link-crossorigin><a href=#attr-link-crossorigin>link</a></code>;
- <code id=attributes-3:attr-script-crossorigin><a href=#attr-script-crossorigin>script</a></code>;
- <code id=attributes-3:attr-media-crossorigin-2><a href=#attr-media-crossorigin>video</a></code>
- <td> How the element handles crossorigin requests
- <td> "<code id=attributes-3:attr-crossorigin-anonymous-keyword><a href=#attr-crossorigin-anonymous-keyword>anonymous</a></code>"; "<code id=attributes-3:attr-crossorigin-use-credentials-keyword><a href=#attr-crossorigin-use-credentials-keyword>use-credentials</a></code>"
- <tr><th> <code>data</code>
- <td> <code id=attributes-3:attr-object-data><a href=#attr-object-data>object</a></code>
- <td> Address of the resource
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-2>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>datetime</code>
- <td> <code id=attributes-3:attr-mod-datetime><a href=#attr-mod-datetime>del</a></code>;
- <code id=attributes-3:attr-mod-datetime-2><a href=#attr-mod-datetime>ins</a></code>
- <td> Date and (optionally) time of the change
- <td> <a href=#valid-date-string-with-optional-time id=attributes-3:valid-date-string-with-optional-time>Valid date string with optional time</a>
- <tr><th> <code>datetime</code>
- <td> <code id=attributes-3:attr-time-datetime><a href=#attr-time-datetime>time</a></code>
- <td> Machine-readable value
- <td> <a href=#valid-month-string id=attributes-3:valid-month-string>Valid month string</a>,
- <a href=#valid-date-string id=attributes-3:valid-date-string>valid date string</a>,
- <a href=#valid-yearless-date-string id=attributes-3:valid-yearless-date-string>valid yearless date string</a>,
- <a href=#valid-time-string id=attributes-3:valid-time-string>valid time string</a>,
- <a href=#valid-local-date-and-time-string id=attributes-3:valid-local-date-and-time-string>valid local date and time string</a>,
- <a href=#valid-time-zone-offset-string id=attributes-3:valid-time-zone-offset-string>valid time-zone offset string</a>,
- <a href=#valid-global-date-and-time-string id=attributes-3:valid-global-date-and-time-string>valid global date and time string</a>,
- <a href=#valid-week-string id=attributes-3:valid-week-string>valid week string</a>,
- <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-3>valid non-negative integer</a>, or
- <a href=#valid-duration-string id=attributes-3:valid-duration-string>valid duration string</a>
- <tr><th> <code>default</code>
- <td> <code id=attributes-3:attr-menuitem-default><a href=#attr-menuitem-default>menuitem</a></code>
- <td> Mark the command as being a default command
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-7>Boolean attribute</a>
- <tr><th> <code>default</code>
- <td> <code id=attributes-3:attr-track-default><a href=#attr-track-default>track</a></code>
- <td> Enable the track if no other <a href=#text-track id=attributes-3:text-track>text track</a> is more suitable
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-8>Boolean attribute</a>
- <tr><th> <code>defer</code>
- <td> <code id=attributes-3:attr-script-defer><a href=#attr-script-defer>script</a></code>
- <td> Defer script execution
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-9>Boolean attribute</a>
- <tr><th> <code>dir</code>
- <td> <a href=#the-dir-attribute id=attributes-3:the-dir-attribute>HTML elements</a>
- <td> <a href=#the-directionality id=attributes-3:the-directionality>The text directionality</a> of the element
- <td> "<code id=attributes-3:attr-dir-ltr><a href=#attr-dir-ltr>ltr</a></code>"; "<code id=attributes-3:attr-dir-rtl><a href=#attr-dir-rtl>rtl</a></code>"; "<code id=attributes-3:attr-dir-auto><a href=#attr-dir-auto>auto</a></code>"
- <tr><th> <code>dir</code>
- <td> <code id=attributes-3:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
- <td> <a href=#the-directionality id=attributes-3:the-directionality-2>The text directionality</a> of the element
- <td> "<code id=attributes-3:attr-dir-ltr-2><a href=#attr-dir-ltr>ltr</a></code>"; "<code id=attributes-3:attr-dir-rtl-2><a href=#attr-dir-rtl>rtl</a></code>"
- <tr><th> <code>dirname</code>
- <td> <code id=attributes-3:attr-fe-dirname><a href=#attr-fe-dirname>input</a></code>;
- <code id=attributes-3:attr-fe-dirname-2><a href=#attr-fe-dirname>textarea</a></code>
- <td> Name of form field to use for sending the element's <a href=#the-directionality id=attributes-3:the-directionality-3>directionality</a> in <a href=#form-submission-2 id=attributes-3:form-submission-2-3>form submission</a>
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>disabled</code>
- <td> <code id=attributes-3:attr-fe-disabled><a href=#attr-fe-disabled>button</a></code>;
- <code id=attributes-3:attr-menuitem-disabled><a href=#attr-menuitem-disabled>menuitem</a></code>;
- <code id=attributes-3:attr-fieldset-disabled><a href=#attr-fieldset-disabled>fieldset</a></code>;
- <code id=attributes-3:attr-fe-disabled-2><a href=#attr-fe-disabled>input</a></code>;
- <code id=attributes-3:attr-fe-disabled-3><a href=#attr-fe-disabled>keygen</a></code>;
- <code id=attributes-3:attr-optgroup-disabled><a href=#attr-optgroup-disabled>optgroup</a></code>;
- <code id=attributes-3:attr-option-disabled><a href=#attr-option-disabled>option</a></code>;
- <code id=attributes-3:attr-fe-disabled-4><a href=#attr-fe-disabled>select</a></code>;
- <code id=attributes-3:attr-fe-disabled-5><a href=#attr-fe-disabled>textarea</a></code>
- <td> Whether the form control is disabled
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-10>Boolean attribute</a>
- <tr><th> <code>download</code>
- <td> <code id=attributes-3:attr-hyperlink-download><a href=#attr-hyperlink-download>a</a></code>;
- <code id=attributes-3:attr-hyperlink-download-2><a href=#attr-hyperlink-download>area</a></code>
- <td> Whether to download the resource instead of navigating to it, and its file name if so
- <td> Text
- <tr><th> <code>draggable</code>
- <td> <a href=#the-draggable-attribute id=attributes-3:the-draggable-attribute>HTML elements</a>
- <td> Whether the element is draggable
- <td> "<code>true</code>"; "<code>false</code>"
- <tr><th> <code>dropzone</code>
- <td> <a href=#the-dropzone-attribute id=attributes-3:the-dropzone-attribute>HTML elements</a>
- <td> Accepted item types for drag-and-drop
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive id=attributes-3:ascii-case-insensitive-2>ASCII case-insensitive</a>, consisting of accepted types and drag feedback*
- <tr><th> <code>enctype</code>
- <td> <code id=attributes-3:attr-fs-enctype><a href=#attr-fs-enctype>form</a></code>
- <td> Form data set encoding type to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-4>form submission</a>
- <td> "<code id=attributes-3:attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code id=attributes-3:attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code id=attributes-3:attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code>"
- <tr><th> <code>for</code>
- <td> <code id=attributes-3:attr-label-for><a href=#attr-label-for>label</a></code>
- <td> Associate the label with form control
- <td> <a href=#concept-id id=attributes-3:concept-id-3>ID</a>*
- <tr><th> <code>for</code>
- <td> <code id=attributes-3:attr-output-for><a href=#attr-output-for>output</a></code>
- <td> Specifies controls from which the output was calculated
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-2>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive-2>case-sensitive</a>, consisting of IDs*
- <tr><th> <code>form</code>
- <td> <code id=attributes-3:attr-fae-form><a href=#attr-fae-form>button</a></code>;
- <code id=attributes-3:attr-fae-form-2><a href=#attr-fae-form>fieldset</a></code>;
- <code id=attributes-3:attr-fae-form-3><a href=#attr-fae-form>input</a></code>;
- <code id=attributes-3:attr-fae-form-4><a href=#attr-fae-form>keygen</a></code>;
- <code id=attributes-3:attr-fae-form-5><a href=#attr-fae-form>label</a></code>;
- <code id=attributes-3:attr-fae-form-6><a href=#attr-fae-form>object</a></code>;
- <code id=attributes-3:attr-fae-form-7><a href=#attr-fae-form>output</a></code>;
- <code id=attributes-3:attr-fae-form-8><a href=#attr-fae-form>select</a></code>;
- <code id=attributes-3:attr-fae-form-9><a href=#attr-fae-form>textarea</a></code>
- <td> Associates the control with a <code id=attributes-3:the-form-element><a href=#the-form-element>form</a></code> element
- <td> <a href=#concept-id id=attributes-3:concept-id-4>ID</a>*
- <tr><th> <code>formaction</code>
- <td> <code id=attributes-3:attr-fs-formaction><a href=#attr-fs-formaction>button</a></code>;
- <code id=attributes-3:attr-fs-formaction-2><a href=#attr-fs-formaction>input</a></code>
- <td> <a href=#url id=attributes-3:url-2>URL</a> to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-5>form submission</a>
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-3>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>formenctype</code>
- <td> <code id=attributes-3:attr-fs-formenctype><a href=#attr-fs-formenctype>button</a></code>;
- <code id=attributes-3:attr-fs-formenctype-2><a href=#attr-fs-formenctype>input</a></code>
- <td> Form data set encoding type to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-6>form submission</a>
- <td> "<code id=attributes-3:attr-fs-enctype-urlencoded-2><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code>"; "<code id=attributes-3:attr-fs-enctype-formdata-2><a href=#attr-fs-enctype-formdata>multipart/form-data</a></code>"; "<code id=attributes-3:attr-fs-enctype-text-2><a href=#attr-fs-enctype-text>text/plain</a></code>"
- <tr><th> <code>formmethod</code>
- <td> <code id=attributes-3:attr-fs-formmethod><a href=#attr-fs-formmethod>button</a></code>;
- <code id=attributes-3:attr-fs-formmethod-2><a href=#attr-fs-formmethod>input</a></code>
- <td> HTTP method to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-7>form submission</a>
- <td> "<code>GET</code>"; "<code>POST</code>"
- <tr><th> <code>formnovalidate</code>
- <td> <code id=attributes-3:attr-fs-formnovalidate><a href=#attr-fs-formnovalidate>button</a></code>;
- <code id=attributes-3:attr-fs-formnovalidate-2><a href=#attr-fs-formnovalidate>input</a></code>
- <td> Bypass form control validation for <a href=#form-submission-2 id=attributes-3:form-submission-2-8>form submission</a>
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-11>Boolean attribute</a>
- <tr><th> <code>formtarget</code>
- <td> <code id=attributes-3:attr-fs-formtarget><a href=#attr-fs-formtarget>button</a></code>;
- <code id=attributes-3:attr-fs-formtarget-2><a href=#attr-fs-formtarget>input</a></code>
- <td> <a href=#browsing-context id=attributes-3:browsing-context>Browsing context</a> for <a href=#form-submission-2 id=attributes-3:form-submission-2-9>form submission</a>
- <td> <a href=#valid-browsing-context-name-or-keyword id=attributes-3:valid-browsing-context-name-or-keyword>Valid browsing context name or keyword</a>
- <tr><th> <code>headers</code>
- <td> <code id=attributes-3:attr-tdth-headers><a href=#attr-tdth-headers>td</a></code>;
- <code id=attributes-3:attr-tdth-headers-2><a href=#attr-tdth-headers>th</a></code>
- <td> The header cells for this cell
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-3>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive-3>case-sensitive</a>, consisting of IDs*
- <tr><th> <code>height</code>
- <td> <code id=attributes-3:attr-canvas-height><a href=#attr-canvas-height>canvas</a></code>;
- <code id=attributes-3:attr-dim-height><a href=#attr-dim-height>embed</a></code>;
- <code id=attributes-3:attr-dim-height-2><a href=#attr-dim-height>iframe</a></code>;
- <code id=attributes-3:attr-dim-height-3><a href=#attr-dim-height>img</a></code>;
- <code id=attributes-3:attr-dim-height-4><a href=#attr-dim-height>input</a></code>;
- <code id=attributes-3:attr-dim-height-5><a href=#attr-dim-height>object</a></code>;
- <code id=attributes-3:attr-dim-height-6><a href=#attr-dim-height>video</a></code>
- <td> Vertical dimension
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-4>Valid non-negative integer</a>
- <tr><th> <code>hidden</code>
- <td> <a href=#the-hidden-attribute id=attributes-3:the-hidden-attribute>HTML elements</a>
- <td> Whether the element is relevant
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-12>Boolean attribute</a>
- <tr><th> <code>high</code>
- <td> <code id=attributes-3:attr-meter-high><a href=#attr-meter-high>meter</a></code>
- <td> Low limit of high range
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number>Valid floating-point number</a>*
- <tr><th> <code>href</code>
- <td> <code id=attributes-3:attr-hyperlink-href><a href=#attr-hyperlink-href>a</a></code>;
- <code id=attributes-3:attr-hyperlink-href-2><a href=#attr-hyperlink-href>area</a></code>
- <td> Address of the <a href=#hyperlink id=attributes-3:hyperlink>hyperlink</a>
- <td> <a href=#valid-url-potentially-surrounded-by-spaces id=attributes-3:valid-url-potentially-surrounded-by-spaces-2>Valid URL potentially surrounded by spaces</a>
- <tr><th> <code>href</code>
- <td> <code id=attributes-3:attr-link-href><a href=#attr-link-href>link</a></code>
- <td> Address of the <a href=#hyperlink id=attributes-3:hyperlink-2>hyperlink</a>
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-4>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>href</code>
- <td> <code id=attributes-3:attr-base-href><a href=#attr-base-href>base</a></code>
- <td> <a href=#document-base-url id=attributes-3:document-base-url>Document base URL</a>
- <td> <a href=#valid-url-potentially-surrounded-by-spaces id=attributes-3:valid-url-potentially-surrounded-by-spaces-3>Valid URL potentially surrounded by spaces</a>
- <tr><th> <code>hreflang</code>
- <td> <code id=attributes-3:attr-hyperlink-hreflang><a href=#attr-hyperlink-hreflang>a</a></code>;
- <code id=attributes-3:attr-hyperlink-hreflang-2><a href=#attr-hyperlink-hreflang>area</a></code>;
- <code id=attributes-3:attr-link-hreflang><a href=#attr-link-hreflang>link</a></code>
- <td> Language of the linked resource
- <td> Valid BCP 47 language tag
- <tr><th> <code>http-equiv</code>
- <td> <code id=attributes-3:attr-meta-http-equiv><a href=#attr-meta-http-equiv>meta</a></code>
- <td> Pragma directive
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>icon</code>
- <td> <code id=attributes-3:attr-menuitem-icon><a href=#attr-menuitem-icon>menuitem</a></code>
- <td> Icon for the command
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-5>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>id</code>
- <td> <a href=#the-id-attribute id=attributes-3:the-id-attribute>HTML elements</a>
- <td> The element's <a href=#concept-id id=attributes-3:concept-id-5>ID</a>
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>inputmode</code>
- <td> <code id=attributes-3:attr-fe-inputmode><a href=#attr-fe-inputmode>input</a></code>;
- <code id=attributes-3:attr-fe-inputmode-2><a href=#attr-fe-inputmode>textarea</a></code>
- <td> Hint for selecting an input modality
- <td> "<code id=attributes-3:attr-fe-inputmode-keyword-verbatim><a href=#attr-fe-inputmode-keyword-verbatim>verbatim</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-latin><a href=#attr-fe-inputmode-keyword-latin>latin</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-latin-name><a href=#attr-fe-inputmode-keyword-latin-name>latin-name</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-latin-prose><a href=#attr-fe-inputmode-keyword-latin-prose>latin-prose</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-full-width-latin><a href=#attr-fe-inputmode-keyword-full-width-latin>full-width-latin</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-kana><a href=#attr-fe-inputmode-keyword-kana>kana</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-kana-name><a href=#attr-fe-inputmode-keyword-kana-name>kana-name</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-katakana><a href=#attr-fe-inputmode-keyword-katakana>katakana</a></code>";
-
- "<code id=attributes-3:attr-fe-inputmode-keyword-numeric><a href=#attr-fe-inputmode-keyword-numeric>numeric</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-tel><a href=#attr-fe-inputmode-keyword-tel>tel</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-email><a href=#attr-fe-inputmode-keyword-email>email</a></code>";
- "<code id=attributes-3:attr-fe-inputmode-keyword-url><a href=#attr-fe-inputmode-keyword-url>url</a></code>"
- <tr><th> <code>ismap</code>
- <td> <code id=attributes-3:attr-img-ismap><a href=#attr-img-ismap>img</a></code>
- <td> Whether the image is a server-side image map
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-13>Boolean attribute</a>
- <tr><th> <code>itemid</code>
- <td> <a href=#attr-itemid id=attributes-3:attr-itemid>HTML elements</a>
- <td> <a href=#global-identifier id=attributes-3:global-identifier>Global identifier</a> for a microdata item
- <td> <a href=#valid-url-potentially-surrounded-by-spaces id=attributes-3:valid-url-potentially-surrounded-by-spaces-4>Valid URL potentially surrounded by spaces</a>
- <tr><th> <code>itemprop</code>
- <td> <a href=#names:-the-itemprop-attribute id=attributes-3:names:-the-itemprop-attribute>HTML elements</a>
- <td> <a href=#property-names id=attributes-3:property-names>Property names</a> of a microdata item
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-4>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive-4>case-sensitive</a>, consisting of <a href=#absolute-url id=attributes-3:absolute-url>valid absolute URLs</a>, <a href=#defined-property-name id=attributes-3:defined-property-name>defined property names</a>, or text*
- <tr><th> <code>itemref</code>
- <td> <a href=#attr-itemref id=attributes-3:attr-itemref>HTML elements</a>
- <td> Referenced elements
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-5>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive-5>case-sensitive</a>, consisting of IDs*
- <tr><th> <code>itemscope</code>
- <td> <a href=#attr-itemscope id=attributes-3:attr-itemscope>HTML elements</a>
- <td> Introduces a microdata item
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-14>Boolean attribute</a>
- <tr><th> <code>itemtype</code>
- <td> <a href=#attr-itemtype id=attributes-3:attr-itemtype>HTML elements</a>
- <td> <a href=#item-types id=attributes-3:item-types>Item types</a> of a microdata item
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-6>Unordered set of unique space-separated tokens</a>, <a href=#case-sensitive id=attributes-3:case-sensitive-6>case-sensitive</a>, consisting of <a href=#absolute-url id=attributes-3:absolute-url-2>valid absolute URL</a>*
- <tr><th> <code>keytype</code>
- <td> <code id=attributes-3:attr-keygen-keytype><a href=#attr-keygen-keytype>keygen</a></code>
- <td> The type of cryptographic key to generate
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>kind</code>
- <td> <code id=attributes-3:attr-track-kind><a href=#attr-track-kind>track</a></code>
- <td> The type of text track
- <td> "<code id=attributes-3:attr-track-kind-subtitles><a href=#attr-track-kind-subtitles>subtitles</a></code>";
- "<code id=attributes-3:attr-track-kind-captions><a href=#attr-track-kind-captions>captions</a></code>";
- "<code id=attributes-3:attr-track-kind-descriptions><a href=#attr-track-kind-descriptions>descriptions</a></code>";
- "<code id=attributes-3:attr-track-kind-chapters><a href=#attr-track-kind-chapters>chapters</a></code>";
- "<code id=attributes-3:attr-track-kind-metadata><a href=#attr-track-kind-metadata>metadata</a></code>"
- <tr><th> <code>label</code>
- <td> <code id=attributes-3:attr-menuitem-label><a href=#attr-menuitem-label>menuitem</a></code>;
- <code id=attributes-3:attr-menu-label><a href=#attr-menu-label>menu</a></code>;
- <code id=attributes-3:attr-optgroup-label><a href=#attr-optgroup-label>optgroup</a></code>;
- <code id=attributes-3:attr-option-label><a href=#attr-option-label>option</a></code>;
- <code id=attributes-3:attr-track-label><a href=#attr-track-label>track</a></code>
- <td> User-visible label
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>lang</code>
- <td> <a href=#attr-lang id=attributes-3:attr-lang>HTML elements</a>
- <td> <a href=#language id=attributes-3:language>Language</a> of the element
- <td> Valid BCP 47 language tag or the empty string
- <tr><th> <code>list</code>
- <td> <code id=attributes-3:attr-input-list><a href=#attr-input-list>input</a></code>
- <td> List of autocomplete options
- <td> <a href=#concept-id id=attributes-3:concept-id-6>ID</a>*
- <tr><th> <code>loop</code>
- <td> <code id=attributes-3:attr-media-loop><a href=#attr-media-loop>audio</a></code>;
- <code id=attributes-3:attr-media-loop-2><a href=#attr-media-loop>video</a></code>
- <td> Whether to loop the <a href=#media-resource id=attributes-3:media-resource-2>media resource</a>
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-15>Boolean attribute</a>
- <tr><th> <code>low</code>
- <td> <code id=attributes-3:attr-meter-low><a href=#attr-meter-low>meter</a></code>
- <td> High limit of low range
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-2>Valid floating-point number</a>*
- <tr><th> <code>manifest</code>
- <td> <code id=attributes-3:attr-html-manifest><a href=#attr-html-manifest>html</a></code>
- <td> <a href=#concept-appcache-manifest id=attributes-3:concept-appcache-manifest>Application cache manifest</a>
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-6>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>max</code>
- <td> <code id=attributes-3:attr-input-max><a href=#attr-input-max>input</a></code>
- <td> Maximum value
- <td> Varies*
- <tr><th> <code>max</code>
- <td> <code id=attributes-3:attr-meter-max><a href=#attr-meter-max>meter</a></code>;
- <code id=attributes-3:attr-progress-max><a href=#attr-progress-max>progress</a></code>
- <td> Upper bound of range
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-3>Valid floating-point number</a>*
- <tr><th> <code>maxlength</code>
- <td> <code id=attributes-3:attr-input-maxlength><a href=#attr-input-maxlength>input</a></code>;
- <code id=attributes-3:attr-textarea-maxlength><a href=#attr-textarea-maxlength>textarea</a></code>
- <td> Maximum length of value
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-5>Valid non-negative integer</a>
- <tr><th> <code>media</code>
- <td> <code id=attributes-3:attr-link-media><a href=#attr-link-media>link</a></code>;
- <code id=attributes-3:attr-style-media><a href=#attr-style-media>style</a></code>
- <td> Applicable media
- <td> <a href=#valid-media-query-list id=attributes-3:valid-media-query-list>Valid media query list</a>
- <tr><th> <code>mediagroup</code>
- <td> <code id=attributes-3:attr-media-mediagroup><a href=#attr-media-mediagroup>audio</a></code>;
- <code id=attributes-3:attr-media-mediagroup-2><a href=#attr-media-mediagroup>video</a></code>
- <td> Groups <a href=#media-element id=attributes-3:media-element>media elements</a> together with an implicit <code id=attributes-3:mediacontroller><a href=#mediacontroller>MediaController</a></code>
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>menu</code>
- <td> <code id=attributes-3:attr-button-menu><a href=#attr-button-menu>button</a></code>
- <td> Specifies the element's <a href=#designated-pop-up-menu id=attributes-3:designated-pop-up-menu>designated pop-up menu</a>
- <td> <a href=#concept-id id=attributes-3:concept-id-7>ID</a>*
- <tr><th> <code>method</code>
- <td> <code id=attributes-3:attr-fs-method><a href=#attr-fs-method>form</a></code>
- <td> HTTP method to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-10>form submission</a>
- <td> "<code id=attributes-3:attr-fs-method-get-keyword><a href=#attr-fs-method-get-keyword>GET</a></code>";
- "<code id=attributes-3:attr-fs-method-post-keyword><a href=#attr-fs-method-post-keyword>POST</a></code>";
- "<code id=attributes-3:attr-fs-method-dialog-keyword><a href=#attr-fs-method-dialog-keyword>dialog</a></code>"
- <tr><th> <code>min</code>
- <td> <code id=attributes-3:attr-input-min><a href=#attr-input-min>input</a></code>
- <td> Minimum value
- <td> Varies*
- <tr><th> <code>min</code>
- <td> <code id=attributes-3:attr-meter-min><a href=#attr-meter-min>meter</a></code>
- <td> Lower bound of range
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-4>Valid floating-point number</a>*
- <tr><th> <code>minlength</code>
- <td> <code id=attributes-3:attr-input-minlength><a href=#attr-input-minlength>input</a></code>;
- <code id=attributes-3:attr-textarea-minlength><a href=#attr-textarea-minlength>textarea</a></code>
- <td> Minimum length of value
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-6>Valid non-negative integer</a>
- <tr><th> <code>multiple</code>
- <td> <code id=attributes-3:attr-input-multiple><a href=#attr-input-multiple>input</a></code>;
- <code id=attributes-3:attr-select-multiple><a href=#attr-select-multiple>select</a></code>
- <td> Whether to allow multiple values
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-16>Boolean attribute</a>
- <tr><th> <code>muted</code>
- <td> <code id=attributes-3:attr-media-muted><a href=#attr-media-muted>audio</a></code>;
- <code id=attributes-3:attr-media-muted-2><a href=#attr-media-muted>video</a></code>
- <td> Whether to mute the <a href=#media-resource id=attributes-3:media-resource-3>media resource</a> by default
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-17>Boolean attribute</a>
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-fe-name><a href=#attr-fe-name>button</a></code>;
- <code id=attributes-3:attr-fe-name-2><a href=#attr-fe-name>fieldset</a></code>;
- <code id=attributes-3:attr-fe-name-3><a href=#attr-fe-name>input</a></code>;
- <code id=attributes-3:attr-fe-name-4><a href=#attr-fe-name>keygen</a></code>;
- <code id=attributes-3:attr-fe-name-5><a href=#attr-fe-name>output</a></code>;
- <code id=attributes-3:attr-fe-name-6><a href=#attr-fe-name>select</a></code>;
- <code id=attributes-3:attr-fe-name-7><a href=#attr-fe-name>textarea</a></code>
- <td> Name of form control to use for <a href=#form-submission-2 id=attributes-3:form-submission-2-11>form submission</a> and in the <code id=attributes-3:dom-form-elements><a href=#dom-form-elements>form.elements</a></code> API
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-form-name><a href=#attr-form-name>form</a></code>
- <td> Name of form to use in the <code id=attributes-3:dom-document-forms><a href=#dom-document-forms>document.forms</a></code> API
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-iframe-name><a href=#attr-iframe-name>iframe</a></code>;
- <code id=attributes-3:attr-object-name><a href=#attr-object-name>object</a></code>
- <td> Name of <a href=#nested-browsing-context id=attributes-3:nested-browsing-context>nested browsing context</a>
- <td> <a href=#valid-browsing-context-name-or-keyword id=attributes-3:valid-browsing-context-name-or-keyword-2>Valid browsing context name or keyword</a>
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-map-name><a href=#attr-map-name>map</a></code>
- <td> Name of <a href=#image-map id=attributes-3:image-map-2>image map</a> to reference from the <code id=attributes-3:attr-hyperlink-usemap><a href=#attr-hyperlink-usemap>usemap</a></code> attribute
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-meta-name><a href=#attr-meta-name>meta</a></code>
- <td> Metadata name
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>name</code>
- <td> <code id=attributes-3:attr-param-name><a href=#attr-param-name>param</a></code>
- <td> Name of parameter
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>novalidate</code>
- <td> <code id=attributes-3:attr-fs-novalidate><a href=#attr-fs-novalidate>form</a></code>
- <td> Bypass form control validation for <a href=#form-submission-2 id=attributes-3:form-submission-2-12>form submission</a>
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-18>Boolean attribute</a>
- <tr><th> <code>open</code>
- <td> <code id=attributes-3:attr-details-open><a href=#attr-details-open>details</a></code>
- <td> Whether the details are visible
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-19>Boolean attribute</a>
- <tr><th> <code>open</code>
- <td> <code id=attributes-3:attr-dialog-open><a href=#attr-dialog-open>dialog</a></code>
- <td> Whether the dialog box is showing
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-20>Boolean attribute</a>
- <tr><th> <code>optimum</code>
- <td> <code id=attributes-3:attr-meter-optimum><a href=#attr-meter-optimum>meter</a></code>
- <td> Optimum value in gauge
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-5>Valid floating-point number</a>*
- <tr><th> <code>pattern</code>
- <td> <code id=attributes-3:attr-input-pattern><a href=#attr-input-pattern>input</a></code>
- <td> Pattern to be matched by the form control's value
- <td> Regular expression matching the JavaScript <i>Pattern</i> production
- <tr><th> <code>ping</code>
- <td> <code id=attributes-3:ping><a href=#ping>a</a></code>;
- <code id=attributes-3:ping-2><a href=#ping>area</a></code>
- <td> <a href=#url id=attributes-3:url-3>URLs</a> to ping
- <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens-2>Set of space-separated tokens</a> consisting of <a href=#valid-non-empty-url id=attributes-3:valid-non-empty-url>valid non-empty URLs</a>
- <tr><th> <code>placeholder</code>
- <td> <code id=attributes-3:attr-input-placeholder><a href=#attr-input-placeholder>input</a></code>;
- <code id=attributes-3:attr-textarea-placeholder><a href=#attr-textarea-placeholder>textarea</a></code>
- <td> User-visible label to be placed within the form control
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>poster</code>
- <td> <code id=attributes-3:attr-video-poster><a href=#attr-video-poster>video</a></code>
- <td> Poster frame to show prior to video playback
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-7>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>preload</code>
- <td> <code id=attributes-3:attr-media-preload><a href=#attr-media-preload>audio</a></code>;
- <code id=attributes-3:attr-media-preload-2><a href=#attr-media-preload>video</a></code>
- <td> Hints how much buffering the <a href=#media-resource id=attributes-3:media-resource-4>media resource</a> will likely need
- <td> "<code id=attributes-3:attr-media-preload-none><a href=#attr-media-preload-none>none</a></code>";
- "<code id=attributes-3:attr-media-preload-metadata><a href=#attr-media-preload-metadata>metadata</a></code>";
- "<code id=attributes-3:attr-media-preload-auto><a href=#attr-media-preload-auto>auto</a></code>"
- <tr><th> <code>radiogroup</code>
- <td> <code id=attributes-3:attr-menuitem-radiogroup><a href=#attr-menuitem-radiogroup>menuitem</a></code>
- <td> Name of group of commands to treat as a radio button group
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>readonly</code>
- <td> <code id=attributes-3:attr-input-readonly><a href=#attr-input-readonly>input</a></code>;
- <code id=attributes-3:attr-textarea-readonly><a href=#attr-textarea-readonly>textarea</a></code>
- <td> Whether to allow the value to be edited by the user
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-21>Boolean attribute</a>
- <tr><th> <code>rel</code>
- <td> <code id=attributes-3:attr-hyperlink-rel><a href=#attr-hyperlink-rel>a</a></code>;
- <code id=attributes-3:attr-hyperlink-rel-2><a href=#attr-hyperlink-rel>area</a></code>;
- <code id=attributes-3:attr-link-rel><a href=#attr-link-rel>link</a></code>
- <td> Relationship between the document containing the hyperlink and the destination resource
- <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens-3>Set of space-separated tokens</a>*
- <tr><th> <code>required</code>
- <td> <code id=attributes-3:attr-input-required><a href=#attr-input-required>input</a></code>;
- <code id=attributes-3:attr-select-required><a href=#attr-select-required>select</a></code>;
- <code id=attributes-3:attr-textarea-required><a href=#attr-textarea-required>textarea</a></code>
- <td> Whether the control is required for <a href=#form-submission-2 id=attributes-3:form-submission-2-13>form submission</a>
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-22>Boolean attribute</a>
- <tr><th> <code>reversed</code>
- <td> <code id=attributes-3:attr-ol-reversed><a href=#attr-ol-reversed>ol</a></code>
- <td> Number the list backwards
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-23>Boolean attribute</a>
- <tr><th> <code>rows</code>
- <td> <code id=attributes-3:attr-textarea-rows><a href=#attr-textarea-rows>textarea</a></code>
- <td> Number of lines to show
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-7>Valid non-negative integer</a> greater than zero
- <tr><th> <code>rowspan</code>
- <td> <code id=attributes-3:attr-tdth-rowspan><a href=#attr-tdth-rowspan>td</a></code>;
- <code id=attributes-3:attr-tdth-rowspan-2><a href=#attr-tdth-rowspan>th</a></code>
- <td> Number of rows that the cell is to span
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-8>Valid non-negative integer</a>
- <tr><th> <code>sandbox</code>
- <td> <code id=attributes-3:attr-iframe-sandbox><a href=#attr-iframe-sandbox>iframe</a></code>
- <td> Security rules for nested content
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-7>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive id=attributes-3:ascii-case-insensitive-3>ASCII case-insensitive</a>, consisting of
- "<code id=attributes-3:attr-iframe-sandbox-allow-forms><a href=#attr-iframe-sandbox-allow-forms>allow-forms</a></code>",
- "<code id=attributes-3:attr-iframe-sandbox-allow-pointer-lock><a href=#attr-iframe-sandbox-allow-pointer-lock>allow-pointer-lock</a></code>",
- "<code id=attributes-3:attr-iframe-sandbox-allow-popups><a href=#attr-iframe-sandbox-allow-popups>allow-popups</a></code>",
- "<code id=attributes-3:attr-iframe-sandbox-allow-same-origin><a href=#attr-iframe-sandbox-allow-same-origin>allow-same-origin</a></code>",
- "<code id=attributes-3:attr-iframe-sandbox-allow-scripts><a href=#attr-iframe-sandbox-allow-scripts>allow-scripts</a></code> and
- "<code id=attributes-3:attr-iframe-sandbox-allow-top-navigation><a href=#attr-iframe-sandbox-allow-top-navigation>allow-top-navigation</a></code>"
- <tr><th> <code>spellcheck</code>
- <td> <a href=#attr-spellcheck id=attributes-3:attr-spellcheck>HTML elements</a>
- <td> Whether the element is to have its spelling and grammar checked
- <td> "<code>true</code>"; "<code>false</code>"
- <tr><th> <code>scope</code>
- <td> <code id=attributes-3:attr-th-scope><a href=#attr-th-scope>th</a></code>
- <td> Specifies which cells the header cell applies to
- <td> "<code id=attributes-3:attr-th-scope-row><a href=#attr-th-scope-row>row</a></code>";
- "<code id=attributes-3:attr-th-scope-col><a href=#attr-th-scope-col>col</a></code>";
- "<code id=attributes-3:attr-th-scope-rowgroup><a href=#attr-th-scope-rowgroup>rowgroup</a></code>";
- "<code id=attributes-3:attr-th-scope-colgroup><a href=#attr-th-scope-colgroup>colgroup</a></code>"
- <tr><th> <code>scoped</code>
- <td> <code id=attributes-3:attr-style-scoped><a href=#attr-style-scoped>style</a></code>
- <td> Whether the styles apply to the entire document or just the parent subtree
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-24>Boolean attribute</a>
- <tr><th> <code>seamless</code>
- <td> <code id=attributes-3:attr-iframe-seamless><a href=#attr-iframe-seamless>iframe</a></code>
- <td> Whether to apply the document's styles to the nested content
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-25>Boolean attribute</a>
- <tr><th> <code>selected</code>
- <td> <code id=attributes-3:attr-option-selected><a href=#attr-option-selected>option</a></code>
- <td> Whether the option is selected by default
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-26>Boolean attribute</a>
- <tr><th> <code>shape</code>
- <td> <code id=attributes-3:attr-area-shape><a href=#attr-area-shape>area</a></code>
- <td> The kind of shape to be created in an <a href=#image-map id=attributes-3:image-map-3>image map</a>
- <td> "<code id=attributes-3:attr-area-shape-keyword-circle><a href=#attr-area-shape-keyword-circle>circle</a></code>";
- "<code id=attributes-3:attr-area-shape-keyword-default><a href=#attr-area-shape-keyword-default>default</a></code>";
- "<code id=attributes-3:attr-area-shape-keyword-poly><a href=#attr-area-shape-keyword-poly>poly</a></code>";
- "<code id=attributes-3:attr-area-shape-keyword-rect><a href=#attr-area-shape-keyword-rect>rect</a></code>"
- <tr><th> <code>size</code>
- <td> <code id=attributes-3:attr-input-size><a href=#attr-input-size>input</a></code>;
- <code id=attributes-3:attr-select-size><a href=#attr-select-size>select</a></code>
- <td> Size of the control
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-9>Valid non-negative integer</a> greater than zero
- <tr><th> <code>sizes</code>
- <td> <code id=attributes-3:attr-link-sizes><a href=#attr-link-sizes>link</a></code>
- <td> Sizes of the icons (for <code id=attributes-3:attr-link-rel-2><a href=#attr-link-rel>rel</a></code>="<code id=attributes-3:rel-icon><a href=#rel-icon>icon</a></code>")
- <td> <a href=#unordered-set-of-unique-space-separated-tokens id=attributes-3:unordered-set-of-unique-space-separated-tokens-8>Unordered set of unique space-separated tokens</a>, <a href=#ascii-case-insensitive id=attributes-3:ascii-case-insensitive-4>ASCII case-insensitive</a>, consisting of sizes*
- <tr><th> <code>sortable</code>
- <td> <code id=attributes-3:attr-table-sortable><a href=#attr-table-sortable>table</a></code>
- <td> Enables a sorting interface for the table
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-27>Boolean attribute</a>
- <tr><th> <code>sorted</code>
- <td> <code id=attributes-3:attr-th-sorted><a href=#attr-th-sorted>th</a></code>
- <td> <a href=#column-sort-direction id=attributes-3:column-sort-direction>Column sort direction</a> and <a href=#column-key-ordinality id=attributes-3:column-key-ordinality>ordinality</a>
- <td> <a href=#set-of-space-separated-tokens id=attributes-3:set-of-space-separated-tokens-4>Set of space-separated tokens</a>, <a href=#ascii-case-insensitive id=attributes-3:ascii-case-insensitive-5>ASCII case-insensitive</a>, consisting of neither, one, or both of "<code id=attributes-3:attr-th-sorted-reversed><a href=#attr-th-sorted-reversed>reversed</a></code>" and a <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-10>valid non-negative integer</a> greater than zero
- <tr><th> <code>span</code>
- <td> <code id=attributes-3:attr-col-span><a href=#attr-col-span>col</a></code>;
- <code id=attributes-3:attr-colgroup-span><a href=#attr-colgroup-span>colgroup</a></code>
- <td> Number of columns spanned by the element
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-11>Valid non-negative integer</a> greater than zero
- <tr><th> <code>src</code>
- <td> <code id=attributes-3:attr-media-src><a href=#attr-media-src>audio</a></code>;
- <code id=attributes-3:attr-embed-src><a href=#attr-embed-src>embed</a></code>;
- <code id=attributes-3:attr-iframe-src><a href=#attr-iframe-src>iframe</a></code>;
- <code id=attributes-3:attr-img-src><a href=#attr-img-src>img</a></code>;
- <code id=attributes-3:attr-input-src><a href=#attr-input-src>input</a></code>;
- <code id=attributes-3:attr-script-src><a href=#attr-script-src>script</a></code>;
- <code id=attributes-3:attr-source-src><a href=#attr-source-src>source</a></code>;
- <code id=attributes-3:attr-track-src><a href=#attr-track-src>track</a></code>;
- <code id=attributes-3:attr-media-src-2><a href=#attr-media-src>video</a></code>
- <td> Address of the resource
- <td> <a href=#valid-non-empty-url-potentially-surrounded-by-spaces id=attributes-3:valid-non-empty-url-potentially-surrounded-by-spaces-8>Valid non-empty URL potentially surrounded by spaces</a>
- <tr><th> <code>srcdoc</code>
- <td> <code id=attributes-3:attr-iframe-srcdoc><a href=#attr-iframe-srcdoc>iframe</a></code>
- <td> A document to render in the <code id=attributes-3:the-iframe-element-2><a href=#the-iframe-element>iframe</a></code>
- <td> The source of <a href=#an-iframe-srcdoc-document id=attributes-3:an-iframe-srcdoc-document>an <code>iframe</code> <code>srcdoc</code> document</a>*
- <tr><th> <code>srclang</code>
- <td> <code id=attributes-3:attr-track-srclang><a href=#attr-track-srclang>track</a></code>
- <td> Language of the text track
- <td> Valid BCP 47 language tag
- <tr><th> <code>srcset</code>
- <td> <code id=attributes-3:attr-img-srcset><a href=#attr-img-srcset>img</a></code>
- <td> Images to use in different situations (e.g. high-resolution displays, small monitors, etc)
- <td> Comma-separated list of <span>image candidate strings</span>
- <tr><th> <code>start</code>
- <td> <code id=attributes-3:attr-ol-start><a href=#attr-ol-start>ol</a></code>
- <td> <a href=#ordinal-value id=attributes-3:ordinal-value>Ordinal value</a> of the first item
- <td> <a href=#valid-integer id=attributes-3:valid-integer>Valid integer</a>
- <tr><th> <code>step</code>
- <td> <code id=attributes-3:attr-input-step><a href=#attr-input-step>input</a></code>
- <td> Granularity to be matched by the form control's value
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-6>Valid floating-point number</a> greater than zero, or "<code>any</code>"
- <tr><th> <code>style</code>
- <td> <a href=#the-style-attribute id=attributes-3:the-style-attribute>HTML elements</a>
- <td> Presentational and formatting instructions
- <td> CSS declarations*
- <tr><th> <code>tabindex</code>
- <td> <a href=#attr-tabindex id=attributes-3:attr-tabindex>HTML elements</a>
- <td> Whether the element is focusable, and the relative order of the element for the purposes of sequential focus navigation
- <td> <a href=#valid-integer id=attributes-3:valid-integer-2>Valid integer</a>
- <tr><th> <code>target</code>
- <td> <code id=attributes-3:attr-hyperlink-target><a href=#attr-hyperlink-target>a</a></code>;
- <code id=attributes-3:attr-hyperlink-target-2><a href=#attr-hyperlink-target>area</a></code>
- <td> <a href=#browsing-context id=attributes-3:browsing-context-2>Browsing context</a> for <a href=#hyperlink id=attributes-3:hyperlink-3>hyperlink</a> <a href=#navigate id=attributes-3:navigate>navigation</a>
- <td> <a href=#valid-browsing-context-name-or-keyword id=attributes-3:valid-browsing-context-name-or-keyword-3>Valid browsing context name or keyword</a>
- <tr><th> <code>target</code>
- <td> <code id=attributes-3:attr-base-target><a href=#attr-base-target>base</a></code>
- <td> Default <a href=#browsing-context id=attributes-3:browsing-context-3>browsing context</a> for <a href=#hyperlink id=attributes-3:hyperlink-4>hyperlink</a> <a href=#navigate id=attributes-3:navigate-2>navigation</a> and <a href=#form-submission-2 id=attributes-3:form-submission-2-14>form submission</a>
- <td> <a href=#valid-browsing-context-name-or-keyword id=attributes-3:valid-browsing-context-name-or-keyword-4>Valid browsing context name or keyword</a>
- <tr><th> <code>target</code>
- <td> <code id=attributes-3:attr-fs-target><a href=#attr-fs-target>form</a></code>
- <td> <a href=#browsing-context id=attributes-3:browsing-context-4>Browsing context</a> for <a href=#form-submission-2 id=attributes-3:form-submission-2-15>form submission</a>
- <td> <a href=#valid-browsing-context-name-or-keyword id=attributes-3:valid-browsing-context-name-or-keyword-5>Valid browsing context name or keyword</a>
- <tr><th> <code>title</code>
- <td> <a href=#attr-title id=attributes-3:attr-title>HTML elements</a>
- <td> Advisory information for the element
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>title</code>
- <td> <code id=attributes-3:attr-abbr-title><a href=#attr-abbr-title>abbr</a></code>;
- <code id=attributes-3:attr-dfn-title><a href=#attr-dfn-title>dfn</a></code>
- <td> Full term or expansion of abbreviation
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>title</code>
- <td> <code id=attributes-3:attr-input-title><a href=#attr-input-title>input</a></code>
- <td> Description of pattern (when used with <code id=attributes-3:attr-input-pattern-2><a href=#attr-input-pattern>pattern</a></code> attribute)
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>title</code>
- <td> <code id=attributes-3:attr-menuitem-title><a href=#attr-menuitem-title>menuitem</a></code>
- <td> Hint describing the command
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>title</code>
- <td> <code id=attributes-3:attr-link-title><a href=#attr-link-title>link</a></code>
- <td> Title of the link
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>title</code>
- <td> <code id=attributes-3:attr-link-title-2><a href=#attr-link-title>link</a></code>;
- <code id=attributes-3:attr-style-title><a href=#attr-style-title>style</a></code>
- <td> Alternative style sheet set name
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>translate</code>
- <td> <a href=#attr-translate id=attributes-3:attr-translate>HTML elements</a>
- <td> Whether the element is to be translated when the page is localized
- <td> "<code>yes</code>"; "<code>no</code>"
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-hyperlink-type><a href=#attr-hyperlink-type>a</a></code>;
- <code id=attributes-3:attr-hyperlink-type-2><a href=#attr-hyperlink-type>area</a></code>;
- <code id=attributes-3:attr-link-type><a href=#attr-link-type>link</a></code>
- <td> Hint for the type of the referenced resource
- <td> <a href=#valid-mime-type id=attributes-3:valid-mime-type-2>Valid MIME type</a>
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-button-type><a href=#attr-button-type>button</a></code>
- <td> Type of button
- <td> "<code id=attributes-3:attr-button-type-submit><a href=#attr-button-type-submit>submit</a></code>";
- "<code id=attributes-3:attr-button-type-reset><a href=#attr-button-type-reset>reset</a></code>";
- "<code id=attributes-3:attr-button-type-button><a href=#attr-button-type-button>button</a></code>";
- "<code id=attributes-3:attr-button-type-menu><a href=#attr-button-type-menu>menu</a></code>"
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-embed-type><a href=#attr-embed-type>embed</a></code>;
- <code id=attributes-3:attr-object-type><a href=#attr-object-type>object</a></code>;
- <code id=attributes-3:attr-script-type><a href=#attr-script-type>script</a></code>;
- <code id=attributes-3:attr-source-type><a href=#attr-source-type>source</a></code>;
- <code id=attributes-3:attr-style-type><a href=#attr-style-type>style</a></code>
- <td> Type of embedded resource
- <td> <a href=#valid-mime-type id=attributes-3:valid-mime-type-3>Valid MIME type</a>
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-input-type><a href=#attr-input-type>input</a></code>
- <td> Type of form control
- <td> <a href=#attr-input-type id=attributes-3:attr-input-type-2><code>input</code> type keyword</a>
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-menu-type><a href=#attr-menu-type>menu</a></code>
- <td> Type of menu
- <td> "<code id=attributes-3:popup-menu-state><a href=#popup-menu-state>popup</a></code>"; "<code id=attributes-3:toolbar-state><a href=#toolbar-state>toolbar</a></code>"
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-menuitem-type><a href=#attr-menuitem-type>menuitem</a></code>
- <td> Type of command
- <td> "<code id=attributes-3:attr-menuitem-type-keyword-command><a href=#attr-menuitem-type-keyword-command>command</a></code>";
- "<code id=attributes-3:attr-menuitem-type-keyword-checkbox><a href=#attr-menuitem-type-keyword-checkbox>checkbox</a></code>";
- "<code id=attributes-3:attr-menuitem-type-keyword-radio><a href=#attr-menuitem-type-keyword-radio>radio</a></code>"
- <tr><th> <code>type</code>
- <td> <code id=attributes-3:attr-ol-type><a href=#attr-ol-type>ol</a></code>
- <td> Kind of list marker
- <td> "<code id=attributes-3:attr-ol-type-keyword-decimal><a href=#attr-ol-type-keyword-decimal>1</a></code>";
- "<code id=attributes-3:attr-ol-type-keyword-lower-alpha><a href=#attr-ol-type-keyword-lower-alpha>a</a></code>";
- "<code id=attributes-3:attr-ol-type-keyword-upper-alpha><a href=#attr-ol-type-keyword-upper-alpha>A</a></code>";
- "<code id=attributes-3:attr-ol-type-keyword-lower-roman><a href=#attr-ol-type-keyword-lower-roman>i</a></code>";
- "<code id=attributes-3:attr-ol-type-keyword-upper-roman><a href=#attr-ol-type-keyword-upper-roman>I</a></code>"
- <tr><th> <code>typemustmatch</code>
- <td> <code id=attributes-3:attr-object-typemustmatch><a href=#attr-object-typemustmatch>object</a></code>
- <td> Whether the <code id=attributes-3:attr-object-type-2><a href=#attr-object-type>type</a></code> attribute and the <a href=#content-type id=attributes-3:content-type>Content-Type</a> value need to match for the resource to be used
- <td> <a href=#boolean-attribute id=attributes-3:boolean-attribute-28>Boolean attribute</a>
- <tr><th> <code>usemap</code>
- <td> <code id=attributes-3:attr-hyperlink-usemap-2><a href=#attr-hyperlink-usemap>img</a></code>;
- <code id=attributes-3:attr-hyperlink-usemap-3><a href=#attr-hyperlink-usemap>object</a></code>
- <td> Name of <a href=#image-map id=attributes-3:image-map-4>image map</a> to use
- <td> <a href=#valid-hash-name-reference id=attributes-3:valid-hash-name-reference>Valid hash-name reference</a>*
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-button-value><a href=#attr-button-value>button</a></code>;
- <code id=attributes-3:attr-option-value><a href=#attr-option-value>option</a></code>
- <td> Value to be used for <a href=#form-submission-2 id=attributes-3:form-submission-2-16>form submission</a>
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-data-value><a href=#attr-data-value>data</a></code>
- <td> Machine-readable value
- <td> <a href=#attribute-text>Text</a>*
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-input-value><a href=#attr-input-value>input</a></code>
- <td> Value of the form control
- <td> Varies*
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-li-value><a href=#attr-li-value>li</a></code>
- <td> <a href=#ordinal-value id=attributes-3:ordinal-value-2>Ordinal value</a> of the list item
- <td> <a href=#valid-integer id=attributes-3:valid-integer-3>Valid integer</a>
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-meter-value><a href=#attr-meter-value>meter</a></code>;
- <code id=attributes-3:attr-progress-value><a href=#attr-progress-value>progress</a></code>
- <td> Current value of the element
- <td> <a href=#valid-floating-point-number id=attributes-3:valid-floating-point-number-7>Valid floating-point number</a>
- <tr><th> <code>value</code>
- <td> <code id=attributes-3:attr-param-value><a href=#attr-param-value>param</a></code>
- <td> Value of parameter
- <td> <a href=#attribute-text>Text</a>
- <tr><th> <code>width</code>
- <td> <code id=attributes-3:attr-canvas-width><a href=#attr-canvas-width>canvas</a></code>;
- <code id=attributes-3:attr-dim-width><a href=#attr-dim-width>embed</a></code>;
- <code id=attributes-3:attr-dim-width-2><a href=#attr-dim-width>iframe</a></code>;
- <code id=attributes-3:attr-dim-width-3><a href=#attr-dim-width>img</a></code>;
- <code id=attributes-3:attr-dim-width-4><a href=#attr-dim-width>input</a></code>;
- <code id=attributes-3:attr-dim-width-5><a href=#attr-dim-width>object</a></code>;
- <code id=attributes-3:attr-dim-width-6><a href=#attr-dim-width>video</a></code>
- <td> Horizontal dimension
- <td> <a href=#valid-non-negative-integer id=attributes-3:valid-non-negative-integer-12>Valid non-negative integer</a>
- <tr><th> <code>wrap</code>
- <td> <code id=attributes-3:attr-textarea-wrap><a href=#attr-textarea-wrap>textarea</a></code>
- <td> How the value of the form control is to be wrapped for <a href=#form-submission-2 id=attributes-3:form-submission-2-17>form submission</a>
- <td> "<code id=attributes-3:attr-textarea-wrap-soft><a href=#attr-textarea-wrap-soft>soft</a></code>";
- "<code id=attributes-3:attr-textarea-wrap-hard><a href=#attr-textarea-wrap-hard>hard</a></code>"
- </table>
- <p class=tablenote><small>An asterisk (*) in a cell indicates that the actual rules are more
- complicated than indicated in the table above.</small></p>
- <hr>
- <table id=ix-event-handlers><caption>List of event handler content attributes</caption><thead><tr><th> Attribute
- <th> Element(s)
- <th> Description
- <th> Value
- <tbody><tr><th id=ix-handler-onabort> <code>onabort</code>
- <td> <a href=#handler-onabort id=attributes-3:handler-onabort>HTML elements</a>
- <td> <code id=attributes-3:event-abort><a href=#event-abort>abort</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes>Event handler content attribute</a>
- <tr><th id=ix-handler-onautocomplete> <code>onautocomplete</code>
- <td> <a href=#handler-onautocomplete id=attributes-3:handler-onautocomplete>HTML elements</a>
- <td> <code id=attributes-3:event-autocomplete><a href=#event-autocomplete>autocomplete</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-2>Event handler content attribute</a>
- <tr><th id=ix-handler-onautocompleteerror> <code>onautocompleteerror</code>
- <td> <a href=#handler-onautocompleteerror id=attributes-3:handler-onautocompleteerror>HTML elements</a>
- <td> <code id=attributes-3:event-autocompleteerror><a href=#event-autocompleteerror>autocompleteerror</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-3>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onafterprint> <code>onafterprint</code>
- <td> <code id=attributes-3:handler-window-onafterprint><a href=#handler-window-onafterprint>body</a></code>
- <td> <code id=attributes-3:event-afterprint><a href=#event-afterprint>afterprint</a></code> event handler for <code id=attributes-3:window><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-4>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onbeforeprint> <code>onbeforeprint</code>
- <td> <code id=attributes-3:handler-window-onbeforeprint><a href=#handler-window-onbeforeprint>body</a></code>
- <td> <code id=attributes-3:event-beforeprint><a href=#event-beforeprint>beforeprint</a></code> event handler for <code id=attributes-3:window-2><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-5>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onbeforeunload> <code>onbeforeunload</code>
- <td> <code id=attributes-3:handler-window-onbeforeunload><a href=#handler-window-onbeforeunload>body</a></code>
- <td> <code id=attributes-3:event-beforeunload><a href=#event-beforeunload>beforeunload</a></code> event handler for <code id=attributes-3:window-3><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-6>Event handler content attribute</a>
- <tr><th id=ix-handler-onblur> <code>onblur</code>
- <td> <a href=#handler-onblur id=attributes-3:handler-onblur>HTML elements</a>
- <td> <code id=attributes-3:event-blur><a href=#event-blur>blur</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-7>Event handler content attribute</a>
- <tr><th id=ix-handler-oncancel> <code>oncancel</code>
- <td> <a href=#handler-oncancel id=attributes-3:handler-oncancel>HTML elements</a>
- <td> <code id=attributes-3:event-cancel><a href=#event-cancel>cancel</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-8>Event handler content attribute</a>
- <tr><th id=ix-handler-oncanplay> <code>oncanplay</code>
- <td> <a href=#handler-oncanplay id=attributes-3:handler-oncanplay>HTML elements</a>
- <td> <code id=attributes-3:event-media-canplay><a href=#event-media-canplay>canplay</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-9>Event handler content attribute</a>
- <tr><th id=ix-handler-oncanplaythrough> <code>oncanplaythrough</code>
- <td> <a href=#handler-oncanplaythrough id=attributes-3:handler-oncanplaythrough>HTML elements</a>
- <td> <code id=attributes-3:event-media-canplaythrough><a href=#event-media-canplaythrough>canplaythrough</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-10>Event handler content attribute</a>
- <tr><th id=ix-handler-onchange> <code>onchange</code>
- <td> <a href=#handler-onchange id=attributes-3:handler-onchange>HTML elements</a>
- <td> <code id=attributes-3:event-change><a href=#event-change>change</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-11>Event handler content attribute</a>
- <tr><th id=ix-handler-onclick> <code>onclick</code>
- <td> <a href=#handler-onclick id=attributes-3:handler-onclick>HTML elements</a>
- <td> <code id=attributes-3:event-click><a href=#event-click>click</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-12>Event handler content attribute</a>
- <tr><th id=ix-handler-onclose> <code>onclose</code>
- <td> <a href=#handler-onclose id=attributes-3:handler-onclose>HTML elements</a>
- <td> <code id=attributes-3:event-close><a href=#event-close>close</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-13>Event handler content attribute</a>
- <tr><th id=ix-handler-oncontextmenu> <code>oncontextmenu</code>
- <td> <a href=#handler-oncontextmenu id=attributes-3:handler-oncontextmenu>HTML elements</a>
- <td> <code id=attributes-3:event-contextmenu><a href=#event-contextmenu>contextmenu</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-14>Event handler content attribute</a>
- <tr><th id=ix-handler-oncuechange> <code>oncuechange</code>
- <td> <a href=#handler-oncuechange id=attributes-3:handler-oncuechange>HTML elements</a>
- <td> <code id=attributes-3:event-media-cuechange><a href=#event-media-cuechange>cuechange</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-15>Event handler content attribute</a>
- <tr><th id=ix-handler-ondblclick> <code>ondblclick</code>
- <td> <a href=#handler-ondblclick id=attributes-3:handler-ondblclick>HTML elements</a>
- <td> <code id=attributes-3:event-dblclick><a href=#event-dblclick>dblclick</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-16>Event handler content attribute</a>
- <tr><th id=ix-handler-ondrag> <code>ondrag</code>
- <td> <a href=#handler-ondrag id=attributes-3:handler-ondrag>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-drag><a href=#event-dnd-drag>drag</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-17>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragend> <code>ondragend</code>
- <td> <a href=#handler-ondragend id=attributes-3:handler-ondragend>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragend><a href=#event-dnd-dragend>dragend</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-18>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragenter> <code>ondragenter</code>
- <td> <a href=#handler-ondragenter id=attributes-3:handler-ondragenter>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragenter><a href=#event-dnd-dragenter>dragenter</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-19>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragexit> <code>ondragexit</code>
- <td> <a href=#handler-ondragexit id=attributes-3:handler-ondragexit>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragexit><a href=#event-dnd-dragexit>dragexit</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-20>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragleave> <code>ondragleave</code>
- <td> <a href=#handler-ondragleave id=attributes-3:handler-ondragleave>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragleave><a href=#event-dnd-dragleave>dragleave</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-21>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragover> <code>ondragover</code>
- <td> <a href=#handler-ondragover id=attributes-3:handler-ondragover>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragover><a href=#event-dnd-dragover>dragover</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-22>Event handler content attribute</a>
- <tr><th id=ix-handler-ondragstart> <code>ondragstart</code>
- <td> <a href=#handler-ondragstart id=attributes-3:handler-ondragstart>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-dragstart><a href=#event-dnd-dragstart>dragstart</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-23>Event handler content attribute</a>
- <tr><th id=ix-handler-ondrop> <code>ondrop</code>
- <td> <a href=#handler-ondrop id=attributes-3:handler-ondrop>HTML elements</a>
- <td> <code id=attributes-3:event-dnd-drop><a href=#event-dnd-drop>drop</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-24>Event handler content attribute</a>
- <tr><th id=ix-handler-ondurationchange> <code>ondurationchange</code>
- <td> <a href=#handler-ondurationchange id=attributes-3:handler-ondurationchange>HTML elements</a>
- <td> <code id=attributes-3:event-media-durationchange><a href=#event-media-durationchange>durationchange</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-25>Event handler content attribute</a>
- <tr><th id=ix-handler-onemptied> <code>onemptied</code>
- <td> <a href=#handler-onemptied id=attributes-3:handler-onemptied>HTML elements</a>
- <td> <code id=attributes-3:event-media-emptied><a href=#event-media-emptied>emptied</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-26>Event handler content attribute</a>
- <tr><th id=ix-handler-onended> <code>onended</code>
- <td> <a href=#handler-onended id=attributes-3:handler-onended>HTML elements</a>
- <td> <code id=attributes-3:event-media-ended><a href=#event-media-ended>ended</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-27>Event handler content attribute</a>
- <tr><th id=ix-handler-onerror> <code>onerror</code>
- <td> <a href=#handler-onerror id=attributes-3:handler-onerror>HTML elements</a>
- <td> <code id=attributes-3:event-error><a href=#event-error>error</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-28>Event handler content attribute</a>
- <tr><th id=ix-handler-onfocus> <code>onfocus</code>
- <td> <a href=#handler-onfocus id=attributes-3:handler-onfocus>HTML elements</a>
- <td> <code id=attributes-3:event-focus><a href=#event-focus>focus</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-29>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onhashchange> <code>onhashchange</code>
- <td> <code id=attributes-3:handler-window-onhashchange><a href=#handler-window-onhashchange>body</a></code>
- <td> <code id=attributes-3:event-hashchange><a href=#event-hashchange>hashchange</a></code> event handler for <code id=attributes-3:window-4><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-30>Event handler content attribute</a>
- <tr><th id=ix-handler-oninput> <code>oninput</code>
- <td> <a href=#handler-oninput id=attributes-3:handler-oninput>HTML elements</a>
- <td> <code id=attributes-3:event-input><a href=#event-input>input</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-31>Event handler content attribute</a>
- <tr><th id=ix-handler-oninvalid> <code>oninvalid</code>
- <td> <a href=#handler-oninvalid id=attributes-3:handler-oninvalid>HTML elements</a>
- <td> <code id=attributes-3:event-invalid><a href=#event-invalid>invalid</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-32>Event handler content attribute</a>
- <tr><th id=ix-handler-onkeydown> <code>onkeydown</code>
- <td> <a href=#handler-onkeydown id=attributes-3:handler-onkeydown>HTML elements</a>
- <td> <code id=attributes-3:event-keydown><a href=#event-keydown>keydown</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-33>Event handler content attribute</a>
- <tr><th id=ix-handler-onkeypress> <code>onkeypress</code>
- <td> <a href=#handler-onkeypress id=attributes-3:handler-onkeypress>HTML elements</a>
- <td> <code id=attributes-3:event-keypress><a href=#event-keypress>keypress</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-34>Event handler content attribute</a>
- <tr><th id=ix-handler-onkeyup> <code>onkeyup</code>
- <td> <a href=#handler-onkeyup id=attributes-3:handler-onkeyup>HTML elements</a>
- <td> <code id=attributes-3:event-keyup><a href=#event-keyup>keyup</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-35>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onlanguagechange> <code>onlanguagechange</code>
- <td> <code id=attributes-3:handler-window-onlanguagechange><a href=#handler-window-onlanguagechange>body</a></code>
- <td> <code id=attributes-3:event-languagechange><a href=#event-languagechange>languagechange</a></code> event handler for <code id=attributes-3:window-5><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-36>Event handler content attribute</a>
- <tr><th id=ix-handler-onload> <code>onload</code>
- <td> <a href=#handler-onload id=attributes-3:handler-onload>HTML elements</a>
- <td> <code id=attributes-3:event-load><a href=#event-load>load</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-37>Event handler content attribute</a>
- <tr><th id=ix-handler-onloadeddata> <code>onloadeddata</code>
- <td> <a href=#handler-onloadeddata id=attributes-3:handler-onloadeddata>HTML elements</a>
- <td> <code id=attributes-3:event-media-loadeddata><a href=#event-media-loadeddata>loadeddata</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-38>Event handler content attribute</a>
- <tr><th id=ix-handler-onloadedmetadata> <code>onloadedmetadata</code>
- <td> <a href=#handler-onloadedmetadata id=attributes-3:handler-onloadedmetadata>HTML elements</a>
- <td> <code id=attributes-3:event-media-loadedmetadata><a href=#event-media-loadedmetadata>loadedmetadata</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-39>Event handler content attribute</a>
- <tr><th id=ix-handler-onloadstart> <code>onloadstart</code>
- <td> <a href=#handler-onloadstart id=attributes-3:handler-onloadstart>HTML elements</a>
- <td> <code id=attributes-3:event-media-loadstart><a href=#event-media-loadstart>loadstart</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-40>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onmessage> <code>onmessage</code>
- <td> <code id=attributes-3:handler-window-onmessage><a href=#handler-window-onmessage>body</a></code>
- <td> <code id=attributes-3:event-message><a href=#event-message>message</a></code> event handler for <code id=attributes-3:window-6><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-41>Event handler content attribute</a>
- <tr><th id=ix-handler-onmousedown> <code>onmousedown</code>
- <td> <a href=#handler-onmousedown id=attributes-3:handler-onmousedown>HTML elements</a>
- <td> <code id=attributes-3:event-mousedown><a href=#event-mousedown>mousedown</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-42>Event handler content attribute</a>
- <tr><th id=ix-handler-onmouseenter> <code>onmouseenter</code>
- <td> <a href=#handler-onmouseenter id=attributes-3:handler-onmouseenter>HTML elements</a>
- <td> <code id=attributes-3:event-mouseenter><a href=#event-mouseenter>mouseenter</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-43>Event handler content attribute</a>
- <tr><th id=ix-handler-onmouseleave> <code>onmouseleave</code>
- <td> <a href=#handler-onmouseleave id=attributes-3:handler-onmouseleave>HTML elements</a>
- <td> <code id=attributes-3:event-mouseleave><a href=#event-mouseleave>mouseleave</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-44>Event handler content attribute</a>
- <tr><th id=ix-handler-onmousemove> <code>onmousemove</code>
- <td> <a href=#handler-onmousemove id=attributes-3:handler-onmousemove>HTML elements</a>
- <td> <code id=attributes-3:event-mousemove><a href=#event-mousemove>mousemove</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-45>Event handler content attribute</a>
- <tr><th id=ix-handler-onmouseout> <code>onmouseout</code>
- <td> <a href=#handler-onmouseout id=attributes-3:handler-onmouseout>HTML elements</a>
- <td> <code id=attributes-3:event-mouseout><a href=#event-mouseout>mouseout</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-46>Event handler content attribute</a>
- <tr><th id=ix-handler-onmouseover> <code>onmouseover</code>
- <td> <a href=#handler-onmouseover id=attributes-3:handler-onmouseover>HTML elements</a>
- <td> <code id=attributes-3:event-mouseover><a href=#event-mouseover>mouseover</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-47>Event handler content attribute</a>
- <tr><th id=ix-handler-onmouseup> <code>onmouseup</code>
- <td> <a href=#handler-onmouseup id=attributes-3:handler-onmouseup>HTML elements</a>
- <td> <code id=attributes-3:event-mouseup><a href=#event-mouseup>mouseup</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-48>Event handler content attribute</a>
- <tr><th id=ix-handler-onmousewheel> <code>onmousewheel</code>
- <td> <a href=#handler-onmousewheel id=attributes-3:handler-onmousewheel>HTML elements</a>
- <td> <code id=attributes-3:event-mousewheel><a href=#event-mousewheel>mousewheel</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-49>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onoffline> <code>onoffline</code>
- <td> <code id=attributes-3:handler-window-onoffline><a href=#handler-window-onoffline>body</a></code>
- <td> <code id=attributes-3:event-offline><a href=#event-offline>offline</a></code> event handler for <code id=attributes-3:window-7><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-50>Event handler content attribute</a>
- <tr><th id=ix-handler-window-ononline> <code>ononline</code>
- <td> <code id=attributes-3:handler-window-ononline><a href=#handler-window-ononline>body</a></code>
- <td> <code id=attributes-3:event-online><a href=#event-online>online</a></code> event handler for <code id=attributes-3:window-8><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-51>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onpagehide> <code>onpagehide</code>
- <td> <code id=attributes-3:handler-window-onpagehide><a href=#handler-window-onpagehide>body</a></code>
- <td> <code id=attributes-3:event-pagehide><a href=#event-pagehide>pagehide</a></code> event handler for <code id=attributes-3:window-9><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-52>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onpageshow> <code>onpageshow</code>
- <td> <code id=attributes-3:handler-window-onpageshow><a href=#handler-window-onpageshow>body</a></code>
- <td> <code id=attributes-3:event-pageshow><a href=#event-pageshow>pageshow</a></code> event handler for <code id=attributes-3:window-10><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-53>Event handler content attribute</a>
- <tr><th id=ix-handler-onpause> <code>onpause</code>
- <td> <a href=#handler-onpause id=attributes-3:handler-onpause>HTML elements</a>
- <td> <code id=attributes-3:event-media-pause><a href=#event-media-pause>pause</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-54>Event handler content attribute</a>
- <tr><th id=ix-handler-onplay> <code>onplay</code>
- <td> <a href=#handler-onplay id=attributes-3:handler-onplay>HTML elements</a>
- <td> <code id=attributes-3:event-media-play><a href=#event-media-play>play</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-55>Event handler content attribute</a>
- <tr><th id=ix-handler-onplaying> <code>onplaying</code>
- <td> <a href=#handler-onplaying id=attributes-3:handler-onplaying>HTML elements</a>
- <td> <code id=attributes-3:event-media-playing><a href=#event-media-playing>playing</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-56>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onpopstate> <code>onpopstate</code>
- <td> <code id=attributes-3:handler-window-onpopstate><a href=#handler-window-onpopstate>body</a></code>
- <td> <code id=attributes-3:event-popstate><a href=#event-popstate>popstate</a></code> event handler for <code id=attributes-3:window-11><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-57>Event handler content attribute</a>
- <tr><th id=ix-handler-onprogress> <code>onprogress</code>
- <td> <a href=#handler-onprogress id=attributes-3:handler-onprogress>HTML elements</a>
- <td> <code id=attributes-3:event-media-progress><a href=#event-media-progress>progress</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-58>Event handler content attribute</a>
- <tr><th id=ix-handler-onratechange> <code>onratechange</code>
- <td> <a href=#handler-onratechange id=attributes-3:handler-onratechange>HTML elements</a>
- <td> <code id=attributes-3:event-media-ratechange><a href=#event-media-ratechange>ratechange</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-59>Event handler content attribute</a>
- <tr><th id=ix-handler-onreset> <code>onreset</code>
- <td> <a href=#handler-onreset id=attributes-3:handler-onreset>HTML elements</a>
- <td> <code id=attributes-3:event-reset><a href=#event-reset>reset</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-60>Event handler content attribute</a>
- <tr><th id=ix-handler-onresize> <code>onresize</code>
- <td> <a href=#handler-onresize id=attributes-3:handler-onresize>HTML elements</a>
- <td> <code id=attributes-3:event-resize><a href=#event-resize>resize</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-61>Event handler content attribute</a>
- <tr><th id=ix-handler-onscroll> <code>onscroll</code>
- <td> <a href=#handler-onscroll id=attributes-3:handler-onscroll>HTML elements</a>
- <td> <code id=attributes-3:event-scroll><a href=#event-scroll>scroll</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-62>Event handler content attribute</a>
- <tr><th id=ix-handler-onseeked> <code>onseeked</code>
- <td> <a href=#handler-onseeked id=attributes-3:handler-onseeked>HTML elements</a>
- <td> <code id=attributes-3:event-media-seeked><a href=#event-media-seeked>seeked</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-63>Event handler content attribute</a>
- <tr><th id=ix-handler-onseeking> <code>onseeking</code>
- <td> <a href=#handler-onseeking id=attributes-3:handler-onseeking>HTML elements</a>
- <td> <code id=attributes-3:event-media-seeking><a href=#event-media-seeking>seeking</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-64>Event handler content attribute</a>
- <tr><th id=ix-handler-onselect> <code>onselect</code>
- <td> <a href=#handler-onselect id=attributes-3:handler-onselect>HTML elements</a>
- <td> <code id=attributes-3:event-select><a href=#event-select>select</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-65>Event handler content attribute</a>
- <tr><th id=ix-handler-onshow> <code>onshow</code>
- <td> <a href=#handler-onshow id=attributes-3:handler-onshow>HTML elements</a>
- <td> <code id=attributes-3:event-show><a href=#event-show>show</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-66>Event handler content attribute</a>
- <tr><th id=ix-handler-onsort> <code>onsort</code>
- <td> <a href=#handler-onsort id=attributes-3:handler-onsort>HTML elements</a>
- <td> <code id=attributes-3:event-sort><a href=#event-sort>sort</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-67>Event handler content attribute</a>
- <tr><th id=ix-handler-onstalled> <code>onstalled</code>
- <td> <a href=#handler-onstalled id=attributes-3:handler-onstalled>HTML elements</a>
- <td> <code id=attributes-3:event-media-stalled><a href=#event-media-stalled>stalled</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-68>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onstorage> <code>onstorage</code>
- <td> <code id=attributes-3:handler-window-onstorage><a href=#handler-window-onstorage>body</a></code>
- <td> <code id=attributes-3:event-storage><a href=#event-storage>storage</a></code> event handler for <code id=attributes-3:window-12><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-69>Event handler content attribute</a>
- <tr><th id=ix-handler-onsubmit> <code>onsubmit</code>
- <td> <a href=#handler-onsubmit id=attributes-3:handler-onsubmit>HTML elements</a>
- <td> <code id=attributes-3:event-submit><a href=#event-submit>submit</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-70>Event handler content attribute</a>
- <tr><th id=ix-handler-onsuspend> <code>onsuspend</code>
- <td> <a href=#handler-onsuspend id=attributes-3:handler-onsuspend>HTML elements</a>
- <td> <code id=attributes-3:event-media-suspend><a href=#event-media-suspend>suspend</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-71>Event handler content attribute</a>
- <tr><th id=ix-handler-ontimeupdate> <code>ontimeupdate</code>
- <td> <a href=#handler-ontimeupdate id=attributes-3:handler-ontimeupdate>HTML elements</a>
- <td> <code id=attributes-3:event-media-timeupdate><a href=#event-media-timeupdate>timeupdate</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-72>Event handler content attribute</a>
- <tr><th id=ix-handler-ontoggle> <code>ontoggle</code>
- <td> <a href=#handler-ontoggle id=attributes-3:handler-ontoggle>HTML elements</a>
- <td> <code id=attributes-3:event-toggle><a href=#event-toggle>toggle</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-73>Event handler content attribute</a>
- <tr><th id=ix-handler-window-onunload> <code>onunload</code>
- <td> <code id=attributes-3:handler-window-onunload><a href=#handler-window-onunload>body</a></code>
- <td> <code id=attributes-3:event-unload><a href=#event-unload>unload</a></code> event handler for <code id=attributes-3:window-13><a href=#window>Window</a></code> object
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-74>Event handler content attribute</a>
- <tr><th id=ix-handler-onvolumechange> <code>onvolumechange</code>
- <td> <a href=#handler-onvolumechange id=attributes-3:handler-onvolumechange>HTML elements</a>
- <td> <code id=attributes-3:event-media-volumechange><a href=#event-media-volumechange>volumechange</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-75>Event handler content attribute</a>
- <tr><th id=ix-handler-onwaiting> <code>onwaiting</code>
- <td> <a href=#handler-onwaiting id=attributes-3:handler-onwaiting>HTML elements</a>
- <td> <code id=attributes-3:event-media-waiting><a href=#event-media-waiting>waiting</a></code> event handler
- <td> <a href=#event-handler-content-attributes id=attributes-3:event-handler-content-attributes-76>Event handler content attribute</a>
- </table>
- <h3 id=element-interfaces class=no-num>Element Interfaces</h3>
- <p><i>This section is non-normative.</i></p>
- <table><caption>List of interfaces for elements</caption><thead><tr><th> Element(s)
- <th> Interface(s)
- <tbody><tr><td> <code id=element-interfaces:the-a-element><a href=#the-a-element>a</a></code>
- <td> <code id=element-interfaces:htmlanchorelement><a href=#htmlanchorelement>HTMLAnchorElement</a></code> : <code id=element-interfaces:htmlelement><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-abbr-element><a href=#the-abbr-element>abbr</a></code>
- <td> <code id=element-interfaces:htmlelement-2><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-address-element><a href=#the-address-element>address</a></code>
- <td> <code id=element-interfaces:htmlelement-3><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-area-element><a href=#the-area-element>area</a></code>
- <td> <code id=element-interfaces:htmlareaelement><a href=#htmlareaelement>HTMLAreaElement</a></code> : <code id=element-interfaces:htmlelement-4><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-article-element><a href=#the-article-element>article</a></code>
- <td> <code id=element-interfaces:htmlelement-5><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-aside-element><a href=#the-aside-element>aside</a></code>
- <td> <code id=element-interfaces:htmlelement-6><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-audio-element><a href=#the-audio-element>audio</a></code>
- <td> <code id=element-interfaces:htmlaudioelement><a href=#htmlaudioelement>HTMLAudioElement</a></code> : <code id=element-interfaces:htmlmediaelement><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code id=element-interfaces:htmlelement-7><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-b-element><a href=#the-b-element>b</a></code>
- <td> <code id=element-interfaces:htmlelement-8><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-base-element><a href=#the-base-element>base</a></code>
- <td> <code id=element-interfaces:htmlbaseelement><a href=#htmlbaseelement>HTMLBaseElement</a></code> : <code id=element-interfaces:htmlelement-9><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-bdi-element><a href=#the-bdi-element>bdi</a></code>
- <td> <code id=element-interfaces:htmlelement-10><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-bdo-element><a href=#the-bdo-element>bdo</a></code>
- <td> <code id=element-interfaces:htmlelement-11><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-blockquote-element><a href=#the-blockquote-element>blockquote</a></code>
- <td> <code id=element-interfaces:htmlquoteelement><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code id=element-interfaces:htmlelement-12><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-body-element><a href=#the-body-element>body</a></code>
- <td> <code id=element-interfaces:htmlbodyelement><a href=#htmlbodyelement>HTMLBodyElement</a></code> : <code id=element-interfaces:htmlelement-13><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-br-element><a href=#the-br-element>br</a></code>
- <td> <code id=element-interfaces:htmlbrelement><a href=#htmlbrelement>HTMLBRElement</a></code> : <code id=element-interfaces:htmlelement-14><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-button-element><a href=#the-button-element>button</a></code>
- <td> <code id=element-interfaces:htmlbuttonelement><a href=#htmlbuttonelement>HTMLButtonElement</a></code> : <code id=element-interfaces:htmlelement-15><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-canvas-element><a href=#the-canvas-element>canvas</a></code>
- <td> <code id=element-interfaces:htmlcanvaselement><a href=#htmlcanvaselement>HTMLCanvasElement</a></code> : <code id=element-interfaces:htmlelement-16><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-caption-element><a href=#the-caption-element>caption</a></code>
- <td> <code id=element-interfaces:htmltablecaptionelement><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code> : <code id=element-interfaces:htmlelement-17><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-cite-element><a href=#the-cite-element>cite</a></code>
- <td> <code id=element-interfaces:htmlelement-18><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-code-element><a href=#the-code-element>code</a></code>
- <td> <code id=element-interfaces:htmlelement-19><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-col-element><a href=#the-col-element>col</a></code>
- <td> <code id=element-interfaces:htmltablecolelement><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code id=element-interfaces:htmlelement-20><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-colgroup-element><a href=#the-colgroup-element>colgroup</a></code>
- <td> <code id=element-interfaces:htmltablecolelement-2><a href=#htmltablecolelement>HTMLTableColElement</a></code> : <code id=element-interfaces:htmlelement-21><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-menuitem-element><a href=#the-menuitem-element>menuitem</a></code>
- <td> <code id=element-interfaces:htmlmenuitemelement><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code> : <code id=element-interfaces:htmlelement-22><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-data-element><a href=#the-data-element>data</a></code>
- <td> <code id=element-interfaces:htmldataelement><a href=#htmldataelement>HTMLDataElement</a></code> : <code id=element-interfaces:htmlelement-23><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-datalist-element><a href=#the-datalist-element>datalist</a></code>
- <td> <code id=element-interfaces:htmldatalistelement><a href=#htmldatalistelement>HTMLDataListElement</a></code> : <code id=element-interfaces:htmlelement-24><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-dd-element><a href=#the-dd-element>dd</a></code>
- <td> <code id=element-interfaces:htmlelement-25><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-del-element><a href=#the-del-element>del</a></code>
- <td> <code id=element-interfaces:htmlmodelement><a href=#htmlmodelement>HTMLModElement</a></code> : <code id=element-interfaces:htmlelement-26><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-details-element><a href=#the-details-element>details</a></code>
- <td> <code id=element-interfaces:htmldetailselement><a href=#htmldetailselement>HTMLDetailsElement</a></code> : <code id=element-interfaces:htmlelement-27><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-dfn-element><a href=#the-dfn-element>dfn</a></code>
- <td> <code id=element-interfaces:htmlelement-28><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-dialog-element><a href=#the-dialog-element>dialog</a></code>
- <td> <code id=element-interfaces:htmldialogelement><a href=#htmldialogelement>HTMLDialogElement</a></code> : <code id=element-interfaces:htmlelement-29><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-div-element><a href=#the-div-element>div</a></code>
- <td> <code id=element-interfaces:htmldivelement><a href=#htmldivelement>HTMLDivElement</a></code> : <code id=element-interfaces:htmlelement-30><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-dl-element><a href=#the-dl-element>dl</a></code>
- <td> <code id=element-interfaces:htmldlistelement><a href=#htmldlistelement>HTMLDListElement</a></code> : <code id=element-interfaces:htmlelement-31><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-dt-element><a href=#the-dt-element>dt</a></code>
- <td> <code id=element-interfaces:htmlelement-32><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-em-element><a href=#the-em-element>em</a></code>
- <td> <code id=element-interfaces:htmlelement-33><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-embed-element><a href=#the-embed-element>embed</a></code>
- <td> <code id=element-interfaces:htmlembedelement><a href=#htmlembedelement>HTMLEmbedElement</a></code> : <code id=element-interfaces:htmlelement-34><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-fieldset-element><a href=#the-fieldset-element>fieldset</a></code>
- <td> <code id=element-interfaces:htmlfieldsetelement><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code> : <code id=element-interfaces:htmlelement-35><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-figcaption-element><a href=#the-figcaption-element>figcaption</a></code>
- <td> <code id=element-interfaces:htmlelement-36><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-figure-element><a href=#the-figure-element>figure</a></code>
- <td> <code id=element-interfaces:htmlelement-37><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-footer-element><a href=#the-footer-element>footer</a></code>
- <td> <code id=element-interfaces:htmlelement-38><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-form-element><a href=#the-form-element>form</a></code>
- <td> <code id=element-interfaces:htmlformelement><a href=#htmlformelement>HTMLFormElement</a></code> : <code id=element-interfaces:htmlelement-39><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>
- <td> <code id=element-interfaces:htmlheadingelement><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-40><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-2><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h2</a></code>
- <td> <code id=element-interfaces:htmlheadingelement-2><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-41><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-3><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h3</a></code>
- <td> <code id=element-interfaces:htmlheadingelement-3><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-42><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-4><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h4</a></code>
- <td> <code id=element-interfaces:htmlheadingelement-4><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-43><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-5><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h5</a></code>
- <td> <code id=element-interfaces:htmlheadingelement-5><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-44><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-h1,-h2,-h3,-h4,-h5,-and-h6-elements-6><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h6</a></code>
- <td> <code id=element-interfaces:htmlheadingelement-6><a href=#htmlheadingelement>HTMLHeadingElement</a></code> : <code id=element-interfaces:htmlelement-45><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-head-element><a href=#the-head-element>head</a></code>
- <td> <code id=element-interfaces:htmlheadelement><a href=#htmlheadelement>HTMLHeadElement</a></code> : <code id=element-interfaces:htmlelement-46><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-header-element><a href=#the-header-element>header</a></code>
- <td> <code id=element-interfaces:htmlelement-47><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-hgroup-element><a href=#the-hgroup-element>hgroup</a></code>
- <td> <code id=element-interfaces:htmlelement-48><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-hr-element><a href=#the-hr-element>hr</a></code>
- <td> <code id=element-interfaces:htmlhrelement><a href=#htmlhrelement>HTMLHRElement</a></code> : <code id=element-interfaces:htmlelement-49><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-html-element><a href=#the-html-element>html</a></code>
- <td> <code id=element-interfaces:htmlhtmlelement><a href=#htmlhtmlelement>HTMLHtmlElement</a></code> : <code id=element-interfaces:htmlelement-50><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-i-element><a href=#the-i-element>i</a></code>
- <td> <code id=element-interfaces:htmlelement-51><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-iframe-element><a href=#the-iframe-element>iframe</a></code>
- <td> <code id=element-interfaces:htmliframeelement><a href=#htmliframeelement>HTMLIFrameElement</a></code> : <code id=element-interfaces:htmlelement-52><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-img-element><a href=#the-img-element>img</a></code>
- <td> <code id=element-interfaces:htmlimageelement><a href=#htmlimageelement>HTMLImageElement</a></code> : <code id=element-interfaces:htmlelement-53><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-input-element><a href=#the-input-element>input</a></code>
- <td> <code id=element-interfaces:htmlinputelement><a href=#htmlinputelement>HTMLInputElement</a></code> : <code id=element-interfaces:htmlelement-54><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-ins-element><a href=#the-ins-element>ins</a></code>
- <td> <code id=element-interfaces:htmlmodelement-2><a href=#htmlmodelement>HTMLModElement</a></code> : <code id=element-interfaces:htmlelement-55><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-kbd-element><a href=#the-kbd-element>kbd</a></code>
- <td> <code id=element-interfaces:htmlelement-56><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-keygen-element><a href=#the-keygen-element>keygen</a></code>
- <td> <code id=element-interfaces:htmlkeygenelement><a href=#htmlkeygenelement>HTMLKeygenElement</a></code> : <code id=element-interfaces:htmlelement-57><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-label-element><a href=#the-label-element>label</a></code>
- <td> <code id=element-interfaces:htmllabelelement><a href=#htmllabelelement>HTMLLabelElement</a></code> : <code id=element-interfaces:htmlelement-58><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-legend-element><a href=#the-legend-element>legend</a></code>
- <td> <code id=element-interfaces:htmllegendelement><a href=#htmllegendelement>HTMLLegendElement</a></code> : <code id=element-interfaces:htmlelement-59><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-li-element><a href=#the-li-element>li</a></code>
- <td> <code id=element-interfaces:htmllielement><a href=#htmllielement>HTMLLIElement</a></code> : <code id=element-interfaces:htmlelement-60><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-link-element><a href=#the-link-element>link</a></code>
- <td> <code id=element-interfaces:htmllinkelement><a href=#htmllinkelement>HTMLLinkElement</a></code> : <code id=element-interfaces:htmlelement-61><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-main-element><a href=#the-main-element>main</a></code>
- <td> <code id=element-interfaces:htmlelement-62><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-map-element><a href=#the-map-element>map</a></code>
- <td> <code id=element-interfaces:htmlmapelement><a href=#htmlmapelement>HTMLMapElement</a></code> : <code id=element-interfaces:htmlelement-63><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-mark-element><a href=#the-mark-element>mark</a></code>
- <td> <code id=element-interfaces:htmlelement-64><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-menu-element><a href=#the-menu-element>menu</a></code>
- <td> <code id=element-interfaces:htmlmenuelement><a href=#htmlmenuelement>HTMLMenuElement</a></code> : <code id=element-interfaces:htmlelement-65><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-meta-element><a href=#the-meta-element>meta</a></code>
- <td> <code id=element-interfaces:htmlmetaelement><a href=#htmlmetaelement>HTMLMetaElement</a></code> : <code id=element-interfaces:htmlelement-66><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-meter-element><a href=#the-meter-element>meter</a></code>
- <td> <code id=element-interfaces:htmlmeterelement><a href=#htmlmeterelement>HTMLMeterElement</a></code> : <code id=element-interfaces:htmlelement-67><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-nav-element><a href=#the-nav-element>nav</a></code>
- <td> <code id=element-interfaces:htmlelement-68><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-noscript-element><a href=#the-noscript-element>noscript</a></code>
- <td> <code id=element-interfaces:htmlelement-69><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-object-element><a href=#the-object-element>object</a></code>
- <td> <code id=element-interfaces:htmlobjectelement><a href=#htmlobjectelement>HTMLObjectElement</a></code> : <code id=element-interfaces:htmlelement-70><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-ol-element><a href=#the-ol-element>ol</a></code>
- <td> <code id=element-interfaces:htmlolistelement><a href=#htmlolistelement>HTMLOListElement</a></code> : <code id=element-interfaces:htmlelement-71><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-optgroup-element><a href=#the-optgroup-element>optgroup</a></code>
- <td> <code id=element-interfaces:htmloptgroupelement><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code> : <code id=element-interfaces:htmlelement-72><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-option-element><a href=#the-option-element>option</a></code>
- <td> <code id=element-interfaces:htmloptionelement><a href=#htmloptionelement>HTMLOptionElement</a></code> : <code id=element-interfaces:htmlelement-73><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-output-element><a href=#the-output-element>output</a></code>
- <td> <code id=element-interfaces:htmloutputelement><a href=#htmloutputelement>HTMLOutputElement</a></code> : <code id=element-interfaces:htmlelement-74><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-p-element><a href=#the-p-element>p</a></code>
- <td> <code id=element-interfaces:htmlparagraphelement><a href=#htmlparagraphelement>HTMLParagraphElement</a></code> : <code id=element-interfaces:htmlelement-75><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-param-element><a href=#the-param-element>param</a></code>
- <td> <code id=element-interfaces:htmlparamelement><a href=#htmlparamelement>HTMLParamElement</a></code> : <code id=element-interfaces:htmlelement-76><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-pre-element><a href=#the-pre-element>pre</a></code>
- <td> <code id=element-interfaces:htmlpreelement><a href=#htmlpreelement>HTMLPreElement</a></code> : <code id=element-interfaces:htmlelement-77><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-progress-element><a href=#the-progress-element>progress</a></code>
- <td> <code id=element-interfaces:htmlprogresselement><a href=#htmlprogresselement>HTMLProgressElement</a></code> : <code id=element-interfaces:htmlelement-78><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-q-element><a href=#the-q-element>q</a></code>
- <td> <code id=element-interfaces:htmlquoteelement-2><a href=#htmlquoteelement>HTMLQuoteElement</a></code> : <code id=element-interfaces:htmlelement-79><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-rp-element><a href=#the-rp-element>rp</a></code>
- <td> <code id=element-interfaces:htmlelement-80><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-rt-element><a href=#the-rt-element>rt</a></code>
- <td> <code id=element-interfaces:htmlelement-81><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-ruby-element><a href=#the-ruby-element>ruby</a></code>
- <td> <code id=element-interfaces:htmlelement-82><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-s-element><a href=#the-s-element>s</a></code>
- <td> <code id=element-interfaces:htmlelement-83><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-samp-element><a href=#the-samp-element>samp</a></code>
- <td> <code id=element-interfaces:htmlelement-84><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-script-element><a href=#the-script-element>script</a></code>
- <td> <code id=element-interfaces:htmlscriptelement><a href=#htmlscriptelement>HTMLScriptElement</a></code> : <code id=element-interfaces:htmlelement-85><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-section-element><a href=#the-section-element>section</a></code>
- <td> <code id=element-interfaces:htmlelement-86><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-select-element><a href=#the-select-element>select</a></code>
- <td> <code id=element-interfaces:htmlselectelement><a href=#htmlselectelement>HTMLSelectElement</a></code> : <code id=element-interfaces:htmlelement-87><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-small-element><a href=#the-small-element>small</a></code>
- <td> <code id=element-interfaces:htmlelement-88><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-source-element><a href=#the-source-element>source</a></code>
- <td> <code id=element-interfaces:htmlsourceelement><a href=#htmlsourceelement>HTMLSourceElement</a></code> : <code id=element-interfaces:htmlelement-89><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-span-element><a href=#the-span-element>span</a></code>
- <td> <code id=element-interfaces:htmlspanelement><a href=#htmlspanelement>HTMLSpanElement</a></code> : <code id=element-interfaces:htmlelement-90><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-strong-element><a href=#the-strong-element>strong</a></code>
- <td> <code id=element-interfaces:htmlelement-91><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-style-element><a href=#the-style-element>style</a></code>
- <td> <code id=element-interfaces:htmlstyleelement><a href=#htmlstyleelement>HTMLStyleElement</a></code> : <code id=element-interfaces:htmlelement-92><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-sub-and-sup-elements><a href=#the-sub-and-sup-elements>sub</a></code>
- <td> <code id=element-interfaces:htmlelement-93><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-summary-element><a href=#the-summary-element>summary</a></code>
- <td> <code id=element-interfaces:htmlelement-94><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-sub-and-sup-elements-2><a href=#the-sub-and-sup-elements>sup</a></code>
- <td> <code id=element-interfaces:htmlelement-95><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-table-element><a href=#the-table-element>table</a></code>
- <td> <code id=element-interfaces:htmltableelement><a href=#htmltableelement>HTMLTableElement</a></code> : <code id=element-interfaces:htmlelement-96><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-tbody-element><a href=#the-tbody-element>tbody</a></code>
- <td> <code id=element-interfaces:htmltablesectionelement><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code id=element-interfaces:htmlelement-97><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-td-element><a href=#the-td-element>td</a></code>
- <td> <code id=element-interfaces:htmltabledatacellelement><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code> : <code id=element-interfaces:htmltablecellelement><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code id=element-interfaces:htmlelement-98><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-template-element><a href=#the-template-element>template</a></code>
- <td> <code id=element-interfaces:htmltemplateelement><a href=#htmltemplateelement>HTMLTemplateElement</a></code> : <code id=element-interfaces:htmlelement-99><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-textarea-element><a href=#the-textarea-element>textarea</a></code>
- <td> <code id=element-interfaces:htmltextareaelement><a href=#htmltextareaelement>HTMLTextAreaElement</a></code> : <code id=element-interfaces:htmlelement-100><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-tfoot-element><a href=#the-tfoot-element>tfoot</a></code>
- <td> <code id=element-interfaces:htmltablesectionelement-2><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code id=element-interfaces:htmlelement-101><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-th-element><a href=#the-th-element>th</a></code>
- <td> <code id=element-interfaces:htmltableheadercellelement><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code> : <code id=element-interfaces:htmltablecellelement-2><a href=#htmltablecellelement>HTMLTableCellElement</a></code> : <code id=element-interfaces:htmlelement-102><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-thead-element><a href=#the-thead-element>thead</a></code>
- <td> <code id=element-interfaces:htmltablesectionelement-3><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code> : <code id=element-interfaces:htmlelement-103><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-time-element><a href=#the-time-element>time</a></code>
- <td> <code id=element-interfaces:htmltimeelement><a href=#htmltimeelement>HTMLTimeElement</a></code> : <code id=element-interfaces:htmlelement-104><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-title-element><a href=#the-title-element>title</a></code>
- <td> <code id=element-interfaces:htmltitleelement><a href=#htmltitleelement>HTMLTitleElement</a></code> : <code id=element-interfaces:htmlelement-105><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-tr-element><a href=#the-tr-element>tr</a></code>
- <td> <code id=element-interfaces:htmltablerowelement><a href=#htmltablerowelement>HTMLTableRowElement</a></code> : <code id=element-interfaces:htmlelement-106><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-track-element><a href=#the-track-element>track</a></code>
- <td> <code id=element-interfaces:htmltrackelement><a href=#htmltrackelement>HTMLTrackElement</a></code> : <code id=element-interfaces:htmlelement-107><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-u-element><a href=#the-u-element>u</a></code>
- <td> <code id=element-interfaces:htmlelement-108><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-ul-element><a href=#the-ul-element>ul</a></code>
- <td> <code id=element-interfaces:htmlulistelement><a href=#htmlulistelement>HTMLUListElement</a></code> : <code id=element-interfaces:htmlelement-109><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-var-element><a href=#the-var-element>var</a></code>
- <td> <code id=element-interfaces:htmlelement-110><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-video-element><a href=#the-video-element>video</a></code>
- <td> <code id=element-interfaces:htmlvideoelement><a href=#htmlvideoelement>HTMLVideoElement</a></code> : <code id=element-interfaces:htmlmediaelement-2><a href=#htmlmediaelement>HTMLMediaElement</a></code> : <code id=element-interfaces:htmlelement-111><a href=#htmlelement>HTMLElement</a></code>
- <tr><td> <code id=element-interfaces:the-wbr-element><a href=#the-wbr-element>wbr</a></code>
- <td> <code id=element-interfaces:htmlelement-112><a href=#htmlelement>HTMLElement</a></code>
- </table>
- <h3 id=all-interfaces class=no-num>All Interfaces</h3>
- <p><i>This section is non-normative.</i></p>
- <ul class="brief">
- <li><code><a href=#abstractworker>AbstractWorker</a></code>
- <li><code><a href=#applicationcache>ApplicationCache</a></code>
- <li><code><a href=#audiotrack>AudioTrack</a></code>
- <li><code><a href=#audiotracklist>AudioTrackList</a></code>
- <li><code><a href=#autocompleteerrorevent>AutocompleteErrorEvent</a></code>
- <li><code><a href=#barprop>BarProp</a></code>
- <li><code><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
- <li><code><a href=#broadcastchannel>BroadcastChannel</a></code>
- <li><code><a href=#canvasdrawingstyles>CanvasDrawingStyles</a></code>
- <li><code><a href=#canvasgradient>CanvasGradient</a></code>
- <li><code><a href=#canvaspathmethods>CanvasPathMethods</a></code>
- <li><code><a href=#canvaspattern>CanvasPattern</a></code>
- <li><code><a href=#canvasproxy>CanvasProxy</a></code>
- <li><code><a href=#canvasrenderingcontext2d>CanvasRenderingContext2D</a></code>
- <li><code><a href=#closeevent>CloseEvent</a></code>
- <li><code><a href=#domelementmap-2>DOMElementMap</a></code>
- <li><code><a href=#domstringmap-2>DOMStringMap</a></code>
- <li><code><a href=#datatransfer>DataTransfer</a></code>
- <li><code><a href=#datatransferitem>DataTransferItem</a></code>
- <li><code><a href=#datatransferitemlist>DataTransferItemList</a></code>
- <li><code><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>
- <li><code><a href=#document>Document</a></code>, <a href=#Document-partial>partial</a>
- <li><code><a href=#dragevent>DragEvent</a></code>
- <li><code><a href=#drawingstyle>DrawingStyle</a></code>
- <li><code><a href=#errorevent>ErrorEvent</a></code>
- <li><code><a href=#eventsource>EventSource</a></code>
- <li><code><a href=#external>External</a></code>
- <li><code><a href=#globaleventhandlers>GlobalEventHandlers</a></code>
- <li><code><a href=#htmlallcollection-2>HTMLAllCollection</a></code>
- <li><code><a href=#htmlanchorelement>HTMLAnchorElement</a></code>, <a href=#HTMLAnchorElement-partial>partial</a>
- <li><code><a href=#htmlappletelement>HTMLAppletElement</a></code>
- <li><code><a href=#htmlareaelement>HTMLAreaElement</a></code>, <a href=#HTMLAreaElement-partial>partial</a>
- <li><code><a href=#htmlaudioelement>HTMLAudioElement</a></code>
- <li><code><a href=#htmlbrelement>HTMLBRElement</a></code>, <a href=#HTMLBRElement-partial>partial</a>
- <li><code><a href=#htmlbaseelement>HTMLBaseElement</a></code>
- <li><code><a href=#htmlbodyelement>HTMLBodyElement</a></code>, <a href=#HTMLBodyElement-partial>partial</a>
- <li><code><a href=#htmlbuttonelement>HTMLButtonElement</a></code>
- <li><code><a href=#htmlcanvaselement>HTMLCanvasElement</a></code>
- <li><code><a href=#htmldlistelement>HTMLDListElement</a></code>, <a href=#HTMLDListElement-partial>partial</a>
- <li><code><a href=#htmldataelement>HTMLDataElement</a></code>
- <li><code><a href=#htmldatalistelement>HTMLDataListElement</a></code>
- <li><code><a href=#htmldetailselement>HTMLDetailsElement</a></code>
- <li><code><a href=#htmldialogelement>HTMLDialogElement</a></code>
- <li><code><a href=#htmldirectoryelement>HTMLDirectoryElement</a></code>
- <li><code><a href=#htmldivelement>HTMLDivElement</a></code>, <a href=#HTMLDivElement-partial>partial</a>
- <li><code><a href=#htmlelement>HTMLElement</a></code>
- <li><code><a href=#htmlembedelement>HTMLEmbedElement</a></code>, <a href=#HTMLEmbedElement-partial>partial</a>
- <li><code><a href=#htmlfieldsetelement>HTMLFieldSetElement</a></code>
- <li><code><a href=#htmlfontelement>HTMLFontElement</a></code>
- <li><code><a href=#htmlformcontrolscollection-2>HTMLFormControlsCollection</a></code>
- <li><code><a href=#htmlformelement>HTMLFormElement</a></code>
- <li><code><a href=#htmlframeelement>HTMLFrameElement</a></code>
- <li><code><a href=#htmlframesetelement>HTMLFrameSetElement</a></code>
- <li><code><a href=#htmlhrelement>HTMLHRElement</a></code>, <a href=#HTMLHRElement-partial>partial</a>
- <li><code><a href=#htmlheadelement>HTMLHeadElement</a></code>
- <li><code><a href=#htmlheadingelement>HTMLHeadingElement</a></code>, <a href=#HTMLHeadingElement-partial>partial</a>
- <li><code><a href=#htmlhtmlelement>HTMLHtmlElement</a></code>, <a href=#HTMLHtmlElement-partial>partial</a>
- <li><code><a href=#htmliframeelement>HTMLIFrameElement</a></code>, <a href=#HTMLIFrameElement-partial>partial</a>
- <li><code><a href=#htmlimageelement>HTMLImageElement</a></code>, <a href=#HTMLImageElement-partial>partial</a>
- <li><code><a href=#htmlinputelement>HTMLInputElement</a></code>, <a href=#HTMLInputElement-partial>partial</a>
- <li><code><a href=#htmlkeygenelement>HTMLKeygenElement</a></code>
- <li><code><a href=#htmllielement>HTMLLIElement</a></code>, <a href=#HTMLLIElement-partial>partial</a>
- <li><code><a href=#htmllabelelement>HTMLLabelElement</a></code>
- <li><code><a href=#htmllegendelement>HTMLLegendElement</a></code>, <a href=#HTMLLegendElement-partial>partial</a>
- <li><code><a href=#htmllinkelement>HTMLLinkElement</a></code>, <a href=#HTMLLinkElement-partial>partial</a>
- <li><code><a href=#htmlmapelement>HTMLMapElement</a></code>
- <li><code><a href=#htmlmarqueeelement>HTMLMarqueeElement</a></code>
- <li><code><a href=#htmlmediaelement>HTMLMediaElement</a></code>
- <li><code><a href=#htmlmenuelement>HTMLMenuElement</a></code>, <a href=#HTMLMenuElement-partial>partial</a>
- <li><code><a href=#htmlmenuitemelement>HTMLMenuItemElement</a></code>
- <li><code><a href=#htmlmetaelement>HTMLMetaElement</a></code>, <a href=#HTMLMetaElement-partial>partial</a>
- <li><code><a href=#htmlmeterelement>HTMLMeterElement</a></code>
- <li><code><a href=#htmlmodelement>HTMLModElement</a></code>
- <li><code><a href=#htmlolistelement>HTMLOListElement</a></code>, <a href=#HTMLOListElement-partial>partial</a>
- <li><code><a href=#htmlobjectelement>HTMLObjectElement</a></code>, <a href=#HTMLObjectElement-partial>partial</a>
- <li><code><a href=#htmloptgroupelement>HTMLOptGroupElement</a></code>
- <li><code><a href=#htmloptionelement>HTMLOptionElement</a></code>
- <li><code><a href=#htmloptionscollection-2>HTMLOptionsCollection</a></code>
- <li><code><a href=#htmloutputelement>HTMLOutputElement</a></code>
- <li><code><a href=#htmlparagraphelement>HTMLParagraphElement</a></code>, <a href=#HTMLParagraphElement-partial>partial</a>
- <li><code><a href=#htmlparamelement>HTMLParamElement</a></code>, <a href=#HTMLParamElement-partial>partial</a>
- <li><code><a href=#htmlpictureelement>HTMLPictureElement</a></code>
- <li><code><a href=#htmlpreelement>HTMLPreElement</a></code>, <a href=#HTMLPreElement-partial>partial</a>
- <li><code><a href=#htmlprogresselement>HTMLProgressElement</a></code>
- <li><code><a href=#htmlpropertiescollection-2>HTMLPropertiesCollection</a></code>
- <li><code><a href=#htmlquoteelement>HTMLQuoteElement</a></code>
- <li><code><a href=#htmlscriptelement>HTMLScriptElement</a></code>, <a href=#HTMLScriptElement-partial>partial</a>
- <li><code><a href=#htmlselectelement>HTMLSelectElement</a></code>
- <li><code><a href=#htmlsourceelement>HTMLSourceElement</a></code>, <a href=#the-source-element-when-used-with-the-picture-element:htmlsourceelement>partial</a>
- <li><code><a href=#htmlspanelement>HTMLSpanElement</a></code>
- <li><code><a href=#htmlstyleelement>HTMLStyleElement</a></code>
- <li><code><a href=#htmltablecaptionelement>HTMLTableCaptionElement</a></code>, <a href=#HTMLTableCaptionElement-partial>partial</a>
- <li><code><a href=#htmltablecellelement>HTMLTableCellElement</a></code>, <a href=#HTMLTableCellElement-partial>partial</a>
- <li><code><a href=#htmltablecolelement>HTMLTableColElement</a></code>, <a href=#HTMLTableColElement-partial>partial</a>
- <li><code><a href=#htmltabledatacellelement>HTMLTableDataCellElement</a></code>, <a href=#HTMLTableDataCellElement-partial>partial</a>
- <li><code><a href=#htmltableelement>HTMLTableElement</a></code>, <a href=#HTMLTableElement-partial>partial</a>
- <li><code><a href=#htmltableheadercellelement>HTMLTableHeaderCellElement</a></code>
- <li><code><a href=#htmltablerowelement>HTMLTableRowElement</a></code>, <a href=#HTMLTableRowElement-partial>partial</a>
- <li><code><a href=#htmltablesectionelement>HTMLTableSectionElement</a></code>, <a href=#HTMLTableSectionElement-partial>partial</a>
- <li><code><a href=#htmltemplateelement>HTMLTemplateElement</a></code>
- <li><code><a href=#htmltextareaelement>HTMLTextAreaElement</a></code>
- <li><code><a href=#htmltimeelement>HTMLTimeElement</a></code>
- <li><code><a href=#htmltitleelement>HTMLTitleElement</a></code>
- <li><code><a href=#htmltrackelement>HTMLTrackElement</a></code>
- <li><code><a href=#htmlulistelement>HTMLUListElement</a></code>, <a href=#HTMLUListElement-partial>partial</a>
- <li><code><a href=#htmlunknownelement>HTMLUnknownElement</a></code>
- <li><code><a href=#htmlvideoelement>HTMLVideoElement</a></code>
- <li><code><a href=#hashchangeevent>HashChangeEvent</a></code>
- <li><code><a href=#history-3>History</a></code>
- <li><code><a href=#imagebitmap>ImageBitmap</a></code>
- <li><code><a href=#imagebitmapfactories>ImageBitmapFactories</a></code>
- <li><code><a href=#imagedata>ImageData</a></code>
- <li><code><a href=#location>Location</a></code>
- <li><code><a href=#mediacontroller>MediaController</a></code>
- <li><code><a href=#mediaerror>MediaError</a></code>
- <li><code><a href=#messagechannel>MessageChannel</a></code>
- <li><code><a href=#messageevent>MessageEvent</a></code>
- <li><code><a href=#messageport>MessagePort</a></code>
- <li><code><a href=#mimetype>MimeType</a></code>
- <li><code><a href=#mimetypearray>MimeTypeArray</a></code>
- <li><code>MouseEvent</code>, <a href=#MouseEvent-partial>partial</a>
- <li><code><a href=#navigator>Navigator</a></code>
- <li><code><a href=#navigatorcontentutils>NavigatorContentUtils</a></code>
- <li><code><a href=#navigatorid>NavigatorID</a></code>
- <li><code><a href=#navigatorlanguage>NavigatorLanguage</a></code>
- <li><code><a href=#navigatoronline>NavigatorOnLine</a></code>
- <li><code><a href=#navigatorplugins>NavigatorPlugins</a></code>
- <li><code><a href=#navigatorstorageutils>NavigatorStorageUtils</a></code>
- <li><code><a href=#pagetransitionevent>PageTransitionEvent</a></code>
- <li><code><a href=#path2d>Path2D</a></code>
- <li><code><a href=#dom-plugin>Plugin</a></code>
- <li><code><a href=#pluginarray>PluginArray</a></code>
- <li><code><a href=#popstateevent>PopStateEvent</a></code>
- <li><code><a href=#portcollection>PortCollection</a></code>
- <li><code><a href=#propertynodelist>PropertyNodeList</a></code>
- <li><code><a href=#radionodelist>RadioNodeList</a></code>
- <li><code><a href=#relatedevent>RelatedEvent</a></code>
- <li><code><a href=#sharedworker>SharedWorker</a></code>
- <li><code><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
- <li><code><a href=#storage-2>Storage</a></code>
- <li><code><a href=#storageevent>StorageEvent</a></code>
- <li><code><a href=#textmetrics>TextMetrics</a></code>
- <li><code><a href=#texttrack>TextTrack</a></code>
- <li><code><a href=#texttrackcue>TextTrackCue</a></code>
- <li><code><a href=#texttrackcuelist>TextTrackCueList</a></code>
- <li><code><a href=#texttracklist>TextTrackList</a></code>
- <li><code><a href=#timeranges>TimeRanges</a></code>
- <li><code>Touch</code>, <a href=#Touch-partial>partial</a>
- <li><code><a href=#trackevent>TrackEvent</a></code>
- <li><code><a href=#validitystate>ValidityState</a></code>
- <li><code><a href=#videotrack>VideoTrack</a></code>
- <li><code><a href=#videotracklist>VideoTrackList</a></code>
- <li><code><a href=#websocket>WebSocket</a></code>
- <li><code><a href=#window>Window</a></code>, <a href=#Window-partial>partial</a>
- <li><code><a href=#windowbase64>WindowBase64</a></code>
- <li><code><a href=#windoweventhandlers>WindowEventHandlers</a></code>
- <li><code><a href=#windowlocalstorage>WindowLocalStorage</a></code>
- <li><code><a href=#windowmodal>WindowModal</a></code>
- <li><code><a href=#windowsessionstorage>WindowSessionStorage</a></code>
- <li><code><a href=#windowtimers>WindowTimers</a></code>
- <li><code><a href=#worker>Worker</a></code>
- <li><code><a href=#workerglobalscope>WorkerGlobalScope</a></code>, <a href=#WorkerGlobalScope-partial>partial</a>
- <li><code><a href=#workerlocation>WorkerLocation</a></code>
- <li><code><a href=#workernavigator>WorkerNavigator</a></code>
- <li><code>XMLDocument</code>, <a href=#loading-xml-documents:xmldocument>partial</a>
- </ul>
- <h3 id=events-2 class=no-num>Events</h3>
- <p><i>This section is non-normative.</i></p>
- <table><caption>List of events</caption><thead><tr><th> Event
- <th> Interface
- <th> Interesting targets
- <th> Description
- <tbody><tr><td> <dfn id=event-abort><code>abort</code></dfn>
- <td> <code id=events-2:event><a href=#event>Event</a></code>
- <td> <code id=events-2:window><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-2><a href=#window>Window</a></code> when the download was aborted by the user
- <tr><td> <dfn id=event-autocomplete><code>autocomplete</code></dfn>
- <td> <code id=events-2:event-2><a href=#event>Event</a></code>
- <td> <code id=events-2:the-form-element><a href=#the-form-element>form</a></code> elements
- <td> Fired at a <code id=events-2:the-form-element-2><a href=#the-form-element>form</a></code> element when it is <a href=#dom-form-requestautocomplete id=events-2:dom-form-requestautocomplete>autofilled</a>
- <tr><td> <dfn id=event-autocompleteerror><code>autocompleteerror</code></dfn>
- <td> <code id=events-2:event-3><a href=#event>Event</a></code>
- <td> <code id=events-2:the-form-element-3><a href=#the-form-element>form</a></code> elements
- <td> Fired at a <code id=events-2:the-form-element-4><a href=#the-form-element>form</a></code> element when a <a href=#dom-form-requestautocomplete id=events-2:dom-form-requestautocomplete-2>bulk autofill</a> fails
- <tr><td> <dfn id=event-domcontentloaded><code>DOMContentLoaded</code></dfn>
- <td> <code id=events-2:event-4><a href=#event>Event</a></code>
- <td> <code id=events-2:document><a href=#document>Document</a></code>
- <td> Fired at the <code id=events-2:document-2><a href=#document>Document</a></code> once the parser has finished
- <tr><td> <dfn id=event-afterprint><code>afterprint</code></dfn>
- <td> <code id=events-2:event-5><a href=#event>Event</a></code>
- <td> <code id=events-2:window-3><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-4><a href=#window>Window</a></code> after printing
- <tr><td> <dfn id=event-afterscriptexecute><code>afterscriptexecute</code></dfn>
- <td> <code id=events-2:event-6><a href=#event>Event</a></code>
- <td> <code id=events-2:the-script-element><a href=#the-script-element>script</a></code> elements
- <td> Fired at <code id=events-2:the-script-element-2><a href=#the-script-element>script</a></code> elements after the script runs (just before the corresponding <code id=events-2:event-load><a href=#event-load>load</a></code> event)
- <tr><td> <dfn id=event-beforeprint><code>beforeprint</code></dfn>
- <td> <code id=events-2:event-7><a href=#event>Event</a></code>
- <td> <code id=events-2:window-5><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-6><a href=#window>Window</a></code> before printing
- <tr><td> <dfn id=event-beforescriptexecute><code>beforescriptexecute</code></dfn>
- <td> <code id=events-2:event-8><a href=#event>Event</a></code>
- <td> <code id=events-2:the-script-element-3><a href=#the-script-element>script</a></code> elements
- <td> Fired at <code id=events-2:the-script-element-4><a href=#the-script-element>script</a></code> elements just before the script runs; canceling the event cancels the running of the script
- <tr><td> <dfn id=event-beforeunload><code>beforeunload</code></dfn>
- <td> <code id=events-2:beforeunloadevent><a href=#beforeunloadevent>BeforeUnloadEvent</a></code>
- <td> <code id=events-2:window-7><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-8><a href=#window>Window</a></code> when the page is about to be unloaded, in case the page would like to show a warning prompt
- <tr><td> <dfn id=event-blur><code>blur</code></dfn>
- <td> <code id=events-2:event-9><a href=#event>Event</a></code>
- <td> <code id=events-2:window-9><a href=#window>Window</a></code>, elements
- <td> Fired at nodes when they stop being <a href=#focused id=events-2:focused>focused</a>
- <tr><td> <dfn id=event-cancel><code>cancel</code></dfn>
- <td> <code id=events-2:event-10><a href=#event>Event</a></code>
- <td> <code id=events-2:the-dialog-element><a href=#the-dialog-element>dialog</a></code> elements
- <td> Fired at <code id=events-2:the-dialog-element-2><a href=#the-dialog-element>dialog</a></code> elements when they are canceled by the user (e.g. by pressing the Escape key)
- <tr><td> <dfn id=event-change><code>change</code></dfn>
- <td> <code id=events-2:event-11><a href=#event>Event</a></code>
- <td> Form controls
- <td> Fired at controls when the user commits a value change (see also the <code id=events-2:event-input-change><a href=#event-input-change>change</a></code> event of <code id=events-2:the-input-element><a href=#the-input-element>input</a></code> elements)
- <tr><td> <code id=events-2:event-click><a href=#event-click>click</a></code>
- <td> <code id=events-2:mouseevent><a href=#mouseevent>MouseEvent</a></code>
- <td> Elements
- <td> Normally a mouse event; also synthetically fired at an element before its <a href=#activation-behavior id=events-2:activation-behavior>activation behavior</a> is run, when an element is activated from a non-pointer input device (e.g. a keyboard)
- <tr><td> <dfn id=event-close><code>close</code></dfn>
- <td> <code id=events-2:event-12><a href=#event>Event</a></code>
- <td> <code id=events-2:the-dialog-element-3><a href=#the-dialog-element>dialog</a></code> elements, <code id=events-2:websocket><a href=#websocket>WebSocket</a></code>
- <td> Fired at <code id=events-2:the-dialog-element-4><a href=#the-dialog-element>dialog</a></code> elements when they are closed, and at <code id=events-2:websocket-2><a href=#websocket>WebSocket</a></code> elements when the connection is terminated
- <tr><td> <dfn id=event-workerglobalscope-connect><code>connect</code></dfn>
- <td> <code id=events-2:messageevent><a href=#messageevent>MessageEvent</a></code>
- <td> <code id=events-2:sharedworkerglobalscope><a href=#sharedworkerglobalscope>SharedWorkerGlobalScope</a></code>
- <td> Fired at a shared worker's global scope when a new client connects
- <tr><td> <dfn id=event-contextmenu><code>contextmenu</code></dfn>
- <td> <code id=events-2:event-13><a href=#event>Event</a></code>
- <td> Elements
- <td> Fired at elements when the user requests their context menu
- <tr><td> <dfn id=event-error><code>error</code></dfn>
- <td> <code id=events-2:event-14><a href=#event>Event</a></code>
- <td> Global scope objects, <code id=events-2:worker><a href=#worker>Worker</a></code> objects, elements, networking-related objects
- <td> Fired when unexpected errors occur (e.g. networking errors, script errors, decoding errors)
- <tr><td> <dfn id=event-focus><code>focus</code></dfn>
- <td> <code id=events-2:event-15><a href=#event>Event</a></code>
- <td> <code id=events-2:window-10><a href=#window>Window</a></code>, elements
- <td> Fired at nodes <a href=#gains-focus id=events-2:gains-focus>gaining focus</a>
- <tr><td> <dfn id=event-hashchange><code>hashchange</code></dfn>
- <td> <code id=events-2:hashchangeevent><a href=#hashchangeevent>HashChangeEvent</a></code>
- <td> <code id=events-2:window-11><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-12><a href=#window>Window</a></code> when the fragment identifier part of <a id="events-2:the-document's-address" href=http://dom.spec.whatwg.org/#concept-document-url data-x-internal="the-document's-address">the document's address</a> changes
- <tr><td> <dfn id=event-input><code>input</code></dfn>
- <td> <code id=events-2:event-16><a href=#event>Event</a></code>
- <td> Form controls
- <td> Fired at controls when the user changes the value (see also the <code id=events-2:event-input-change-2><a href=#event-input-change>change</a></code> event of <code id=events-2:the-input-element-2><a href=#the-input-element>input</a></code> elements)
- <tr><td> <dfn id=event-invalid><code>invalid</code></dfn>
- <td> <code id=events-2:event-17><a href=#event>Event</a></code>
- <td> Form controls
- <td> Fired at controls during form validation if they do not satisfy their constraints
- <tr><td> <dfn id=event-languagechange><code>languagechange</code></dfn>
- <td> <code id=events-2:event-18><a href=#event>Event</a></code>
- <td> Global scope objects
- <td> Fired at the global scope object when the user's preferred languages change
- <tr><td> <dfn id=event-load><code>load</code></dfn>
- <td> <code id=events-2:event-19><a href=#event>Event</a></code>
- <td> <code id=events-2:window-13><a href=#window>Window</a></code>, elements
- <td> Fired at the <code id=events-2:window-14><a href=#window>Window</a></code> when the document has finished loading; fired at an element containing a resource (e.g. <code id=events-2:the-img-element><a href=#the-img-element>img</a></code>, <code id=events-2:the-embed-element><a href=#the-embed-element>embed</a></code>) when its resource has finished loading
- <tr><td> <dfn id=event-loadend><code>loadend</code></dfn>
- <td> <code id=events-2:event-20><a href=#event>Event</a></code> or <code id=events-2:progressevent><a href=#progressevent>ProgressEvent</a></code>
- <td> <code id=events-2:the-img-element-2><a href=#the-img-element>img</a></code> elements
- <td> Fired at <code id=events-2:the-img-element-3><a href=#the-img-element>img</a></code> elements after a successful load
- <tr><td> <dfn id=event-loadstart><code>loadstart</code></dfn>
- <td> <code id=events-2:progressevent-2><a href=#progressevent>ProgressEvent</a></code>
- <td> <code id=events-2:the-img-element-4><a href=#the-img-element>img</a></code> elements
- <td> Fired at <code id=events-2:the-img-element-5><a href=#the-img-element>img</a></code> elements when a load begins (see also <a href=#event-media-loadstart id=events-2:event-media-loadstart>media element events</a>)
- <tr><td> <dfn id=event-message><code>message</code></dfn>
- <td> <code id=events-2:messageevent-2><a href=#messageevent>MessageEvent</a></code>
- <td> <code id=events-2:window-15><a href=#window>Window</a></code>, <code id=events-2:eventsource><a href=#eventsource>EventSource</a></code>, <code id=events-2:websocket-3><a href=#websocket>WebSocket</a></code>, <code id=events-2:messageport><a href=#messageport>MessagePort</a></code>, <code id=events-2:broadcastchannel><a href=#broadcastchannel>BroadcastChannel</a></code>, <code id=events-2:dedicatedworkerglobalscope><a href=#dedicatedworkerglobalscope>DedicatedWorkerGlobalScope</a></code>, <code id=events-2:worker-2><a href=#worker>Worker</a></code>
- <td> Fired at an object when it receives a message
- <tr><td> <dfn id=event-offline><code>offline</code></dfn>
- <td> <code id=events-2:event-21><a href=#event>Event</a></code>
- <td> Global scope objects
- <td> Fired at the global scope object when the network connections fails
- <tr><td> <dfn id=event-online><code>online</code></dfn>
- <td> <code id=events-2:event-22><a href=#event>Event</a></code>
- <td> Global scope objects
- <td> Fired at the global scope object when the network connections returns
- <tr><td> <dfn id=event-open><code>open</code></dfn>
- <td> <code id=events-2:event-23><a href=#event>Event</a></code>
- <td> <code id=events-2:eventsource-2><a href=#eventsource>EventSource</a></code>, <code id=events-2:websocket-4><a href=#websocket>WebSocket</a></code>
- <td> Fired at networking-related objects when a connection is established
- <tr><td> <dfn id=event-pagehide><code>pagehide</code></dfn>
- <td> <code id=events-2:pagetransitionevent><a href=#pagetransitionevent>PageTransitionEvent</a></code>
- <td> <code id=events-2:window-16><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-17><a href=#window>Window</a></code> when the page's entry in the <a href=#session-history id=events-2:session-history>session history</a> stops being the <a href=#current-entry id=events-2:current-entry>current entry</a>
- <tr><td> <dfn id=event-pageshow><code>pageshow</code></dfn>
- <td> <code id=events-2:pagetransitionevent-2><a href=#pagetransitionevent>PageTransitionEvent</a></code>
- <td> <code id=events-2:window-18><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-19><a href=#window>Window</a></code> when the page's entry in the <a href=#session-history id=events-2:session-history-2>session history</a> becomes the <a href=#current-entry id=events-2:current-entry-2>current entry</a>
- <tr><td> <dfn id=event-popstate><code>popstate</code></dfn>
- <td> <code id=events-2:popstateevent><a href=#popstateevent>PopStateEvent</a></code>
- <td> <code id=events-2:window-20><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-21><a href=#window>Window</a></code> when the user navigates the <a href=#session-history id=events-2:session-history-3>session history</a>
- <tr><td> <dfn id=event-progress><code>progress</code></dfn>
- <td> <code id=events-2:progressevent-3><a href=#progressevent>ProgressEvent</a></code>
- <td> <code id=events-2:the-img-element-6><a href=#the-img-element>img</a></code> elements
- <td> Fired at <code id=events-2:the-img-element-7><a href=#the-img-element>img</a></code> elements during a <a href=#cors-same-origin id=events-2:cors-same-origin>CORS-same-origin</a> image load (see also <a href=#event-media-progress id=events-2:event-media-progress>media element events</a>)
- <tr><td> <dfn id=event-readystatechange><code>readystatechange</code></dfn>
- <td> <code id=events-2:event-24><a href=#event>Event</a></code>
- <td> <code id=events-2:document-3><a href=#document>Document</a></code>
- <td> Fired at the <code id=events-2:document-4><a href=#document>Document</a></code> when it finishes parsing and again when all its subresources have finished loading
- <tr><td> <dfn id=event-reset><code>reset</code></dfn>
- <td> <code id=events-2:event-25><a href=#event>Event</a></code>
- <td> <code id=events-2:the-form-element-5><a href=#the-form-element>form</a></code> elements
- <td> Fired at a <code id=events-2:the-form-element-6><a href=#the-form-element>form</a></code> element when it is <a href=#concept-form-reset id=events-2:concept-form-reset>reset</a>
- <tr><td> <dfn id=event-select><code>select</code></dfn>
- <td> <code id=events-2:event-26><a href=#event>Event</a></code>
- <td> Form controls
- <td> Fired at form controls when their text selection is adjusted (whether by an API or by the user)
- <tr><td> <dfn id=event-show><code>show</code></dfn>
- <td> <code id=events-2:relatedevent><a href=#relatedevent>RelatedEvent</a></code>
- <td> <code id=events-2:the-menu-element><a href=#the-menu-element>menu</a></code> elements
- <td> Fired at a <code id=events-2:the-menu-element-2><a href=#the-menu-element>menu</a></code> element when it is shown as a context menu
- <tr><td> <dfn id=event-sort><code>sort</code></dfn>
- <td> <code id=events-2:event-27><a href=#event>Event</a></code>
- <td> <code id=events-2:the-table-element><a href=#the-table-element>table</a></code> elements
- <td> Fired at <code id=events-2:the-table-element-2><a href=#the-table-element>table</a></code> elements before it is sorted; canceling the event cancels the sorting of the table
- <tr><td> <dfn id=event-storage><code>storage</code></dfn>
- <td> <code id=events-2:storageevent><a href=#storageevent>StorageEvent</a></code>
- <td> <code id=events-2:window-22><a href=#window>Window</a></code>
- <td> Fired at <code id=events-2:window-23><a href=#window>Window</a></code> event when the corresponding <code id=events-2:dom-localstorage><a href=#dom-localstorage>localStorage</a></code> or <code id=events-2:dom-sessionstorage><a href=#dom-sessionstorage>sessionStorage</a></code> storage areas change
- <tr><td> <dfn id=event-submit><code>submit</code></dfn>
- <td> <code id=events-2:event-28><a href=#event>Event</a></code>
- <td> <code id=events-2:the-form-element-7><a href=#the-form-element>form</a></code> elements
- <td> Fired at a <code id=events-2:the-form-element-8><a href=#the-form-element>form</a></code> element when it is <a href=#concept-form-submit id=events-2:concept-form-submit>submitted</a>
- <tr><td> <dfn id=event-toggle><code>toggle</code></dfn>
- <td> <code id=events-2:event-29><a href=#event>Event</a></code>
- <td> <code id=events-2:the-details-element><a href=#the-details-element>details</a></code> element
- <td> Fired at <code id=events-2:the-details-element-2><a href=#the-details-element>details</a></code> elements when they open or close
- <tr><td> <dfn id=event-unload><code>unload</code></dfn>
- <td> <code id=events-2:event-30><a href=#event>Event</a></code>
- <td> <code id=events-2:window-24><a href=#window>Window</a></code>
- <td> Fired at the <code id=events-2:window-25><a href=#window>Window</a></code> object when the page is going away
- </table>
- <p class=note>See also <a href=#mediaevents>media element events</a>, <a href=#appcacheevents>application cache events</a>, and <a href=#dndevents>drag-and-drop
- events</a>.</p>
- <h3 id=mime-types-2 class=no-num>MIME Types</h3>
- <p><i>This section is non-normative.</i></p>
- <p>The following MIME types are mentioned in this specification:</p>
- <dl><dt><dfn id=application/atom+xml><code>application/atom+xml</code></dfn><dd>Atom <a href=#refsATOM>[ATOM]</a><dt><dfn id=application/ecmascript><code>application/ecmascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=application/javascript><code>application/javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=application/json><code>application/json</code></dfn><dd>JSON <a href=#refsJSON>[JSON]</a><dt><dfn id=application/x-ecmascript><code>application/x-ecmascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=application/x-javascript><code>application/x-javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=application/octet-stream><a href=http://tools.ietf.org/html/rfc2046#section-4.5.1><code>application/octet-stream</code></a></dfn><dd>Generic binary data <a href=#refsRFC2046>[RFC2046]</a><dt><code id=mime-types-2:application/microdata+json><a href=#application/microdata+json>application/microdata+json</a></code><dd>Microdata as JSON
- <dt><dfn id=application/rss+xml><code>application/rss+xml</code></dfn><dd>RSS
- <dt><code id=mime-types-2:application/x-www-form-urlencoded><a href=#application/x-www-form-urlencoded>application/x-www-form-urlencoded</a></code><dd>Form submission<dt><code id=mime-types-2:application/xhtml+xml><a href=#application/xhtml+xml>application/xhtml+xml</a></code><dd>HTML<dt><dfn id=application/xml><code>application/xml</code></dfn><dd>XML <a href=#refsXML>[XML]</a> <a href=#refsRFC3023>[RFC3023]</a><dt><dfn id=image/gif><code>image/gif</code></dfn><dd>GIF images <a href=#refsGIF>[GIF]</a><dt><dfn id=image/jpeg><code>image/jpeg</code></dfn><dd>JPEG images <a href=#refsJPEG>[JPEG]</a><dt><dfn id=image/png><code>image/png</code></dfn><dd>PNG images <a href=#refsJPEG>[JPEG]</a><dt><dfn id=image/svg+xml><code>image/svg+xml</code></dfn><dd>SVG images <a href=#refsJPEG>[JPEG]</a><dt><dfn id=multipart/form-data><code>multipart/form-data</code></dfn><dd>Form submission <a href=#refsRFC2388>[RFC2388]</a><dt><dfn id=multipart/mixed><code>multipart/mixed</code></dfn><dd>Generic mixed content <a href=#refsRFC2046>[RFC2046]</a><dt><code id=mime-types-2:multipart/x-mixed-replace><a href=#multipart/x-mixed-replace>multipart/x-mixed-replace</a></code><dd>Streaming server push<dt><code id=mime-types-2:text/cache-manifest><a href=#text/cache-manifest>text/cache-manifest</a></code><dd>Offline application cache manifests<dt><dfn id=text/css><code>text/css</code></dfn><dd>CSS <a href=#refsCSS>[CSS]</a><dt><dfn id=text/ecmascript><code>text/ecmascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><code id=mime-types-2:text/event-stream><a href=#text/event-stream>text/event-stream</a></code><dd>Server-sent event streams<dt><dfn id=text/javascript><code>text/javascript</code></dfn><dd>JavaScript <a href=#refsECMA262>[ECMA262]</a>
-
- <dt><dfn id=text/javascript1.0><code>text/javascript1.0</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/javascript1.1><code>text/javascript1.1</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/javascript1.2><code>text/javascript1.2</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/javascript1.3><code>text/javascript1.3</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/javascript1.4><code>text/javascript1.4</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/javascript1.5><code>text/javascript1.5</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/jscript><code>text/jscript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/livescript><code>text/livescript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/plain><a href=http://tools.ietf.org/html/rfc2046#section-4.1.3><code>text/plain</code></a></dfn><dd>Generic plain text <a href=#refsRFC2046>[RFC2046]</a><dt><code id=mime-types-2:text/html><a href=#text/html>text/html</a></code><dd>HTML<dt><code id=mime-types-2:text/ping><a href=#text/ping>text/ping</a></code><dd>Hyperlink auditing<dt><dfn id=text/uri-list><code>text/uri-list</code></dfn><dd>List of URLs <a href=#refsRFC2483>[RFC2483]</a>
- <dt><dfn id=text/vcard><code>text/vcard</code></dfn><dd>vCard <a href=#refsRFC6350>[RFC6350]</a>
- <dt><dfn id=text/x-ecmascript><code>text/x-ecmascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/x-javascript><code>text/x-javascript</code></dfn><dd>JavaScript (legacy type) <a href=#refsECMA262>[ECMA262]</a>
- <dt><dfn id=text/xml><code>text/xml</code></dfn><dd>XML <a href=#refsXML>[XML]</a> <a href=#refsRFC3023>[RFC3023]</a><dt><dfn id=video/mp4><a href=http://tools.ietf.org/html/rfc4337#section-3><code>video/mp4</code></a></dfn><dd>MPEG-4 video <a href=#refsRFC4337>[RFC4337]</a><dt><dfn id=video/mpeg><code>video/mpeg</code></dfn><dd>MPEG video <a href=#refsRFC2046>[RFC2046]</a></dl>
- <h2 id=references class=no-num>References</h2>
- <p>All references are normative unless marked "Non-normative".</p>
-
- <dl id=ref-list><dt id=refsABNF>[ABNF]<dd><cite><a href=http://www.ietf.org/rfc/std/std68.txt>Augmented BNF for Syntax Specifications: ABNF</a></cite>, D. Crocker, P. Overell. IETF.<dt id=refsABOUT>[ABOUT]<dd><cite><a href=http://tools.ietf.org/html/rfc6694>The 'about' URI scheme</a></cite>, S. Moonesamy. IETF.<dt id=refsAPNG>[APNG]<dd>(Non-normative) <cite><a href=https://wiki.mozilla.org/APNG_Specification>APNG Specification</a></cite>. S. Parmenter, V. Vukicevic, A. Smith. Mozilla.<dt id=refsARIA>[ARIA]<dd><cite><a href=http://www.w3.org/WAI/PF/aria/>Accessible Rich Internet Applications (WAI-ARIA)</a></cite>, J. Craig, M. Cooper, L. Pappas, R. Schwerdtfeger, L. Seeman. W3C.<dt id=refsARIAIMPL>[ARIAIMPL]<dd><cite><a href=http://www.w3.org/WAI/PF/aria-implementation/>WAI-ARIA 1.0 User Agent Implementation Guide</a></cite>, A. Snow-Weaver, M. Cooper. W3C.<dt id=refsATAG>[ATAG]<dd>(Non-normative) <cite><a href=http://www.w3.org/TR/ATAG20/>Authoring Tool Accessibility Guidelines (ATAG) 2.0</a></cite>, J. Richards, J. Spellman, J. Treviranus. W3C.<dt id=refsATOM>[ATOM]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc4287>The Atom Syndication Format</a></cite>, M. Nottingham, R. Sayre. IETF.<dt id=refsBCP47>[BCP47]<dd><cite><a href=http://www.ietf.org/rfc/bcp/bcp47.txt>Tags for Identifying Languages; Matching of Language Tags</a></cite>, A. Phillips, M. Davis. IETF.<dt id=refsBECSS>[BECSS]<dd><cite><a href=http://www.w3.org/TR/becss/>Behavioral Extensions to CSS</a></cite>, I. Hickson. W3C.<dt id=refsBEZIER>[BEZIER]<dd><cite>Courbes à poles</cite>, P. de Casteljau. INPI, 1959.<dt id=refsBIDI>[BIDI]<dd><cite><a href=http://www.unicode.org/reports/tr9/>UAX #9: Unicode Bidirectional Algorithm</a></cite>, M. Davis. Unicode Consortium.<dt id=refsBOCU1>[BOCU1]<dd>(Non-normative) <cite><a href=http://www.unicode.org/notes/tn6/>UTN #6: BOCU-1: MIME-Compatible Unicode Compression</a></cite>, M. Scherer, M. Davis. Unicode Consortium.<dt id=refsCESU8>[CESU8]<dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr26/>UTR #26: Compatibility Encoding Scheme For UTF-16: 8-BIT (CESU-8)</a></cite>, T. Phipps. Unicode Consortium.<dt id=refsCHARMOD>[CHARMOD]<dd>(Non-normative) <cite><a href=http://www.w3.org/TR/charmod/>Character Model for the World Wide Web 1.0: Fundamentals</a></cite>, M. Dürst, F. Yergeau, R. Ishida, M. Wolf, T. Texin. W3C.<dt id=refsCLDR>[CLDR]<dd><cite><a href=http://cldr.unicode.org/>Unicode Common Locale Data Repository</a></cite>. Unicode.<dt id=refsCOMPOSITE>[COMPOSITE]<dd><cite><a href=http://dev.w3.org/fxtf/compositing/>Compositing and Blending</a></cite>. R. Cabanier, N. Andronikos. W3C.<dt id=refsCOMPUTABLE>[COMPUTABLE]<dd>(Non-normative) <cite><a href=http://www.turingarchive.org/browse.php/B/12>On computable numbers, with an application to the Entscheidungsproblem</a></cite>, A. Turing. In <cite>Proceedings of the London Mathematical Society</cite>, series 2, volume 42, pages 230-265. London Mathematical Society, 1937.<dt id=refsCOOKIES>[COOKIES]<dd><cite><a href=http://tools.ietf.org/html/rfc6265>HTTP State Management Mechanism</a></cite>, A. Barth. IETF.<dt id=refsCP50220>[CP50220]<dd>(Non-normative) <cite><a href=http://www.iana.org/assignments/charset-reg/CP50220>CP50220</a></cite>, Y. Naruse. IANA.<dt id=refsCSP>[CSP]<dd>(Non-normative) <cite><a href=http://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html>Content Security Policy</a></cite>, B. Sterne, A. Barth. W3C.<dt id=refsCSS>[CSS]<dd><cite><a href=http://www.w3.org/TR/CSS2/>Cascading Style Sheets Level 2 Revision 1</a></cite>, B. Bos, T. Çelik, I. Hickson, H. Lie. W3C.<dt id=refsCSSANIMATIONS>[CSSANIMATIONS]<dd>(Non-normative) <cite><a href=http://dev.w3.org/csswg/css3-animations/>CSS Animations</a></cite>, D. Jackson, D. Hyatt, C. Marrin, S. Galineau, L. Baron. W3C.<dt id=refsCSSATTR>[CSSATTR]<dd><cite><a href=http://dev.w3.org/csswg/css-style-attr/>CSS Styling Attribute Syntax</a></cite>, T. Çelik, E. Etemad. W3C.<dt id=refsCSSCOLOR>[CSSCOLOR]<dd><cite><a href=http://dev.w3.org/csswg/css3-color/>CSS Color Module Level 3</a></cite>, T. Çelik, C. Lilley, L. Baron. W3C.<dt id=refsCSSFONTLOAD>[CSSFONTLOAD]<dd><cite><a href=http://dev.w3.org/csswg/css-font-loading/>CSS Font Loading</a></cite>, T. Atkins, J. Daggett. W3C.<dt id=refsCSSFONTS>[CSSFONTS]<dd><cite><a href=http://dev.w3.org/csswg/css3-fonts/>CSS Fonts</a></cite>, J. Daggett. W3C.<dt id=refsCSSGC>[CSSGC]<dd><cite><a href=http://dev.w3.org/csswg/css-content>CSS Generated Content</a></cite>, H. Lie, E. Etemad, I. Hickson. W3C.<dt id=refsCSSIMAGES>[CSSIMAGES]<dd><cite><a href=http://dev.w3.org/csswg/css-images/>CSS Image Values and Replaced Content Module</a></cite>, E. Etemad, T. Atkins. W3C.<dt id=refsCSSOM>[CSSOM]<dd><cite><a href=http://dev.w3.org/csswg/cssom/>Cascading Style Sheets Object Model (CSSOM)</a></cite>, S. Pieters, G. Adams. W3C.<dt id=refsCSSOMVIEW>[CSSOMVIEW]<dd><cite><a href=http://dev.w3.org/csswg/cssom-view/>CSSOM View Module</a></cite>, S. Pieters, G. Adams. W3C.<dt id=refsCSSRUBY>[CSSRUBY]<dd><cite><a href=http://dev.w3.org/csswg/css3-ruby/>CSS3 Ruby Module</a></cite>, R. Ishida. W3C.<dt id=refsCSSTRANSITIONS>[CSSTRANSITIONS]<dd>(Non-normative) <cite><a href=http://dev.w3.org/csswg/css3-transitions/>CSS Transitions</a></cite>, D. Jackson, D. Hyatt, C. Marrin, L. Baron. W3C.<dt id=refsCSSUI>[CSSUI]<dd><cite><a href=http://dev.w3.org/csswg/css3-ui/>CSS3 Basic User Interface Module</a></cite>, T. Çelik. W3C.<dt id=refsCSSSCOPED>[CSSSCOPED]<dd><cite><a href=http://dev.w3.org/csswg/css-scoping/>CSS Scoping</a></cite>, T. Atkins, E. Etemad. W3C.<dt id=refsCSSSYNTAX>[CSSSYNTAX]<dd><cite><a href=http://dev.w3.org/csswg/css-syntax/>CSS Syntax</a></cite>, T. Atkins, S. Sapin. W3C.<dt id=refsCSSVALUES>[CSSVALUES]<dd><cite><a href=http://dev.w3.org/csswg/css3-values/>CSS3 Values and Units</a></cite>, H. Lie, T. Atkins, E. Etemad. W3C.<dt id=refsCSSWM>[CSSWM]<dd><cite><a href=http://dev.w3.org/csswg/css-writing-modes>CSS Writing Modes</a></cite>, E. Etemad, K. Ishii. W3C.<dt id=refsDASH>[DASH]<dd><cite><a href="http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=57623">Dynamic adaptive streaming over HTTP (DASH)</a></cite>. ISO.<dt id=refsDOM>[DOM]<dd><cite><a href=http://dom.spec.whatwg.org/>DOM</a></cite>, A. van Kesteren, A. Gregor, Ms2ger. WHATWG.<dt id=refsDOMEVENTS>[DOMEVENTS]<dd><cite><a href=https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html>Document Object Model (DOM) Level 3 Events Specification</a></cite>, G. Kacmarcik, T. Leithead, J. Rossi, D. Schepers, B. Höhrmann, P. Le Hégaret, T. Pixley. W3C.<dt id=refsDOMPARSING>[DOMPARSING]<dd><cite><a href=http://domparsing.spec.whatwg.org/ lang=en-US>DOM Parsing and Serialization</a></cite>, Ms2ger. WHATWG.<dt id=refsDOT>[DOT]<dd>(Non-normative) <cite><a href=http://www.graphviz.org/content/dot-language>The DOT Language</a></cite>. Graphviz.<dt id=refsE163>[E163]<dd><cite>Recommendation E.163 — Numbering Plan for The International Telephone Service</cite>, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.<dt id=refsECMA262>[ECMA262]<dd><cite><a href=http://people.mozilla.org/~jorendorff/es6-draft.html>ECMAScript Language Specification</a></cite>. ECMA.<dt id=refsEDITING>[EDITING]<dd><cite><a href=http://dvcs.w3.org/hg/editing/raw-file/tip/editing.html>HTML Editing APIs</a></cite>, A. Gregor. W3C Editing APIs CG.<dt id=refsENCODING>[ENCODING]<dd><cite><a href=http://encoding.spec.whatwg.org/>Encoding</a></cite>, A. van Kesteren, J. Bell. WHATWG.<dt id=refsFETCH>[FETCH]<dd><cite><a href=http://fetch.spec.whatwg.org/>Fetch</a></cite>, A. van Kesteren. WHATWG.<dt id=refsFILEAPI>[FILEAPI]<dd><cite><a href=http://dev.w3.org/2006/webapi/FileAPI/>File API</a></cite>, A. Ranganathan. W3C.<dt id=refsFULLSCREEN>[FULLSCREEN]<dd><cite><a href=http://fullscreen.spec.whatwg.org/>Fullscreen</a></cite>, A. van Kesteren, T. Çelik. WHATWG.<dt id=refsGIF>[GIF]<dd>(Non-normative) <cite><a href=http://www.w3.org/Graphics/GIF/spec-gif89a.txt>Graphics Interchange Format</a></cite>. CompuServe.<dt id=refsGRAPHICS>[GRAPHICS]<dd>(Non-normative) <cite>Computer Graphics: Principles and Practice in C</cite>, Second Edition, J. Foley, A. van Dam, S. Feiner, J. Hughes. Addison-Wesley. ISBN 0-201-84840-6.<dt id=refsGREGORIAN>[GREGORIAN]<dd>(Non-normative) <cite>Inter Gravissimas</cite>, A. Lilius, C. Clavius. Gregory XIII Papal Bull, February 1582.<dt id=refsHTTP>[HTTP]<dd><cite><a href=http://tools.ietf.org/html/rfc7230>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</a></cite>, R. Fielding, J. Reschke. IETF.<dd><cite><a href=http://tools.ietf.org/html/rfc7231>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</a></cite>, R. Fielding, J. Reschke. IETF.<dd><cite><a href=http://tools.ietf.org/html/rfc7232>Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests</a></cite>, R. Fielding, J. Reschke. IETF.<dd><cite><a href=http://tools.ietf.org/html/rfc7233>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</a></cite>, R. Fielding, Y. Lafon, J. Reschke. IETF.<dd><cite><a href=http://tools.ietf.org/html/rfc7234>Hypertext Transfer Protocol (HTTP/1.1): Caching</a></cite>, R. Fielding, M. Nottingham, J. Reschke. IETF.<dd><cite><a href=http://tools.ietf.org/html/rfc7235>Hypertext Transfer Protocol (HTTP/1.1): Authentication</a></cite>, R. Fielding, J. Reschke. IETF.<dt id=refsHTTPS>[HTTPS]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2818>HTTP Over TLS</a></cite>, E. Rescorla. IETF.<dt id=refsIANAPERMHEADERS>[IANAPERMHEADERS]<dd><cite><a href=http://www.iana.org/assignments/message-headers/perm-headers.html>Permanent Message Header Field Names</a></cite>. IANA.<dt id=refsINBAND>[INBAND]<dd><cite><a href=http://dev.w3.org/html5/html-sourcing-inband-tracks/>Sourcing In-band Media Resource Tracks from Media Containers into HTML</a></cite>, S. Pfeiffer, B. Lund. W3C.<dt id=refsISO3166>[ISO3166]<dd><cite><a href=http://www.iso.org/iso/home/standards/country_codes.htm>ISO 3166: Codes for the representation of names of countries and their subdivisions</a></cite>. ISO.<dt id=refsISO8601>[ISO8601]<dd>(Non-normative) <cite><a href="http://isotc.iso.org/livelink/livelink/4021199/ISO_8601_2004_E.zip?func=doc.Fetch&nodeid=4021199">ISO8601: Data elements and interchange formats — Information interchange — Representation of dates and times</a></cite>. ISO.<dt id=refsJLREQ>[JLREQ]<dd><cite><a href=http://www.w3.org/TR/jlreq/>Requirements for Japanese Text Layout</a></cite>. W3C.<dt id=refsJPEG>[JPEG]<dd><cite><a href=http://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format</a></cite>, E. Hamilton.<dt id=refsJSON>[JSON]<dd><cite><a href=http://tools.ietf.org/html/rfc4627>The application/json Media Type for JavaScript Object Notation (JSON)</a></cite>, D. Crockford. IETF.<dt id=refsMAILTO>[MAILTO]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc6068>The 'mailto' URI scheme</a></cite>, M. Duerst, L. Masinter, J. Zawinski. IETF.<dt id=refsMATHML>[MATHML]<dd><cite><a href=http://www.w3.org/TR/MathML/>Mathematical Markup Language (MathML)</a></cite>, D. Carlisle, P. Ion, R. Miner, N. Poppelier. W3C.<dt id=refsMEDIAFRAG>[MEDIAFRAG]<dd><cite><a href=http://www.w3.org/2008/WebVideo/Fragments/WD-media-fragments-spec/>Media Fragments URI</a></cite>, R. Troncy, E. Mannens, S. Pfeiffer, D. Van Deursen. W3C.<dt id=refsMEDIASOURCE>[MEDIASOURCE]<dd><cite><a href=https://dvcs.w3.org/hg/html-media/raw-file/tip/media-source/media-source.html>Media Source Extensions</a></cite>, A. Colwell, A. Bateman, M. Watson. W3C.<dt id=refsMEDIASTREAM>[MEDIASTREAM]<dd><cite><a href=http://dev.w3.org/2011/webrtc/editor/getusermedia.html>Media Capture and Streams</a></cite>, D. Burnett, A. Bergkvist, C. Jennings, A. Narayanan. W3C.<dt id=refsMFREL>[MFREL]<dd><cite><a href=http://microformats.org/wiki/existing-rel-values#HTML5_link_type_extensions>Microformats Wiki: existing rel values</a></cite>. Microformats.<dt id=refsMIMESNIFF>[MIMESNIFF]<dd><cite><a href=http://mimesniff.spec.whatwg.org/>MIME Sniffing</a></cite>, G. Hemsley. WHATWG.<dt id=refsMNG>[MNG]<dd><cite><a href=http://www.libpng.org/pub/mng/spec/>MNG (Multiple-image Network Graphics) Format</a></cite>. G. Randers-Pehrson.<dt id=refsMPEG2>[MPEG2]<dd><cite>ISO/IEC 13818-1: Information technology — Generic coding of moving pictures and associated audio information: Systems</cite>. ISO/IEC.<dt id=refsMPEG4>[MPEG4]<dd><cite>ISO/IEC 14496-12: ISO base media file format</cite>. ISO/IEC.<dt id=refsMQ>[MQ]<dd><cite><a href=http://drafts.csswg.org/mediaqueries/>Media Queries</a></cite>, H. Lie, T. Çelik, D. Glazman, A. van Kesteren. W3C.<dt id=refsNPAPI>[NPAPI]<dd>(Non-normative) <cite><a href=https://developer.mozilla.org/en/Gecko_Plugin_API_Reference>Gecko Plugin API Reference</a></cite>. Mozilla.<dt id=refsOGGSKELETONHEADERS>[OGGSKELETONHEADERS]<dd><cite><a href=http://wiki.xiph.org/SkeletonHeaders>SkeletonHeaders</a></cite>. Xiph.Org.<dt id=refsOPENSEARCH>[OPENSEARCH]<dd><cite><a href=http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML>Autodiscovery in HTML/XHTML</a></cite>. In <cite>OpenSearch 1.1 Draft 4</cite>, Section 4.6.2. OpenSearch.org.<dt id=refsORIGIN>[ORIGIN]<dd><cite><a href=http://tools.ietf.org/html/rfc6454>The Web Origin Concept</a></cite>, A. Barth. IETF.<dt id=refsPAGEVIS>[PAGEVIS]<dd>(Non-normative) <cite><a href=https://w3c.github.io/web-performance/specs/PageVisibility/Overview.html>Page Visibility</a></cite>, J. Mann, A. Jain. W3C.<dt id=refsPDF>[PDF]<dd>(Non-normative) <cite><a href=http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf>Document management — Portable document format — Part 1: PDF</a></cite>. ISO.<dt id=refsPINGBACK>[PINGBACK]<dd><cite><a href=http://www.hixie.ch/specs/pingback/pingback>Pingback 1.0</a></cite>, S. Langridge, I. Hickson.<dt id=refsPNG>[PNG]<dd><cite><a href=http://www.w3.org/TR/PNG/>Portable Network Graphics (PNG) Specification</a></cite>, D. Duce. W3C.<dt id=refsPOINTERLOCK>[POINTERLOCK]<dd><cite><a href=http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html>Pointer Lock</a></cite>, V. Scheib. W3C.<dt id=refsPPUTF8>[PPUTF8]<dd>(Non-normative) <cite><a href=http://www.sw.it.aoyama.ac.jp/2012/pub/IUC11-UTF-8.pdf>The Properties and Promises of UTF-8</a></cite>, M. Dürst. University of Zürich. In <cite>Proceedings of the 11th International Unicode Conference</cite>.<dt id=refsPSL>[PSL]<dd><cite><a href=http://publicsuffix.org/>Public Suffix List</a></cite>.
- Mozilla Foundation.<dt id=refsRFC1034>[RFC1034]<dd><cite><a href=http://tools.ietf.org/html/rfc1034>Domain Names - Concepts and Facilities</a></cite>, P. Mockapetris. IETF, November 1987.<dt id=refsRFC1123>[RFC1123]<dd><cite><a href=http://tools.ietf.org/html/rfc1123>Requirements for Internet Hosts -- Application and Support</a></cite>, R. Braden. IETF, October 1989.<dt id=refsRFC1345>[RFC1345]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1345>Character Mnemonics and Character Sets</a></cite>, K. Simonsen. IETF.<dt id=refsRFC1468>[RFC1468]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1468>Japanese Character Encoding for Internet Messages</a></cite>, J. Murai, M. Crispin, E. van der Poel. IETF.<dt id=refsRFC1554>[RFC1554]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1554>ISO-2022-JP-2: Multilingual Extension of ISO-2022-JP</a></cite>, M. Ohta, K. Handa. IETF.<dt id=refsRFC1557>[RFC1557]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1557>Korean Character Encoding for Internet Messages</a></cite>, U. Choi, K. Chon, H. Park. IETF.<dt id=refsRFC1842>[RFC1842]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1842>ASCII Printable Characters-Based Chinese Character Encoding for Internet Messages</a></cite>, Y. Wei, Y. Zhang, J. Li, J. Ding, Y. Jiang. IETF.<dt id=refsRFC1922>[RFC1922]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc1922>Chinese Character Encoding for Internet Messages</a></cite>, HF. Zhu, DY. Hu, ZG. Wang, TC. Kao, WCH. Chang, M. Crispin. IETF.<dt id=refsRFC2046>[RFC2046]<dd><cite><a href=http://tools.ietf.org/html/rfc2046>Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types</a></cite>, N. Freed, N. Borenstein. IETF.<dt id=refsRFC2119>[RFC2119]<dd><cite><a href=http://tools.ietf.org/html/rfc2119>Key words for use in RFCs to Indicate Requirement Levels</a></cite>, S. Bradner. IETF.<dt id=refsRFC2237>[RFC2237]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2237>Japanese Character Encoding for Internet Messages</a></cite>, K. Tamaru. IETF.<dt id=refsRFC2313>[RFC2313]<dd><cite><a href=http://tools.ietf.org/html/rfc2313>PKCS #1: RSA Encryption</a></cite>, B. Kaliski. IETF.<dt id=refsRFC2318>[RFC2318]<dd><cite><a href=http://tools.ietf.org/html/rfc2318>The text/css Media Type</a></cite>, H. Lie, B. Bos, C. Lilley. IETF.<dt id=refsRFC2388>[RFC2388]<dd><cite><a href=http://tools.ietf.org/html/rfc2388>Returning Values from Forms: multipart/form-data</a></cite>, L. Masinter. IETF.<dt id=refsRFC2397>[RFC2397]<dd><cite><a href=http://tools.ietf.org/html/rfc2397>The "data" URL scheme</a></cite>, L. Masinter. IETF.<dt id=refsRFC2445>[RFC2445]<dd><cite><a href=http://tools.ietf.org/html/rfc2445>Internet Calendaring and Scheduling Core Object Specification (iCalendar)</a></cite>, F. Dawson, D. Stenerson. IETF.<dt id=refsRFC2483>[RFC2483]<dd><cite><a href=http://tools.ietf.org/html/rfc2483>URI Resolution Services Necessary for URN Resolution</a></cite>, M. Mealling, R. Daniel. IETF.<dt id=refsRFC3676>[RFC3676]<dd><cite><a href=http://tools.ietf.org/html/rfc3676>The Text/Plain Format and DelSp Parameters</a></cite>, R. Gellens. IETF.<dt id=refsRFC3023>[RFC3023]<dd><cite><a href=http://tools.ietf.org/html/rfc3023>XML Media Types</a></cite>, M. Murata, S. St. Laurent, D. Kohn. IETF.<dt id=refsRFC3279>[RFC3279]<dd><cite><a href=http://tools.ietf.org/html/rfc3279>Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</a></cite>, W. Polk, R. Housley, L. Bassham. IETF.<dt id=refsRFC3490>[RFC3490]<dd><cite><a href=http://tools.ietf.org/html/rfc3490>Internationalizing Domain Names in Applications (IDNA)</a></cite>, P. Faltstrom, P. Hoffman, A. Costello. IETF.<dt id=refsRFC3864>[RFC3864]<dd><cite><a href=http://tools.ietf.org/html/rfc3864>Registration Procedures for Message Header Fields</a></cite>, G. Klyne, M. Nottingham, J. Mogul. IETF.<dt id=refsRFC4281>[RFC4281]<dd><cite><a href=http://tools.ietf.org/html/rfc4281>The Codecs Parameter for "Bucket" Media Types</a></cite>, R. Gellens, D. Singer, P. Frojdh. IETF.<dt id=refsRFC4329>[RFC4329]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc4329>Scripting Media Types</a></cite>, B. Höhrmann. IETF.<dt id=refsRFC4337>[RFC4337]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc4337>MIME Type Registration for MPEG-4</a></cite>, Y. Lim, D. Singer. IETF.<dt id=refsRFC4395>[RFC4395]<dd><cite><a href=http://tools.ietf.org/html/rfc4395>Guidelines and Registration Procedures for New URI Schemes</a></cite>, T. Hansen, T. Hardie, L. Masinter. IETF.<dt id=refsRFC4648>[RFC4648]<dd><cite><a href=http://tools.ietf.org/html/rfc4648>The Base16, Base32, and Base64 Data Encodings</a></cite>, S. Josefsson. IETF.<dt id=refsRFC5280>[RFC5280]<dd><cite><a href=http://tools.ietf.org/html/rfc5280>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</a></cite>, D. Cooper, S. Santesson, S. Farrell, S. Boeyen, R. Housley, W. Polk. IETF.<dt id=refsRFC5322>[RFC5322]<dd><cite><a href=http://tools.ietf.org/html/rfc5322>Internet Message Format</a></cite>, P. Resnick. IETF.<dt id=refsSMS>[SMS]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc5724>URI Scheme for Global System for Mobile Communications (GSM) Short Message Service (SMS)</a></cite>, E. Wilde, A. Vaha-Sipila. IETF.<dt id=refsRFC6266>[RFC6266]<dd><cite><a href=http://tools.ietf.org/html/rfc6266>Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)</a></cite>, J. Reschke. IETF.<dt id=refsRFC6350>[RFC6350]<dd><cite><a href=http://tools.ietf.org/html/rfc6350>vCard Format Specification</a></cite>, S. Perreault. IETF.<dt id=refsSCSU>[SCSU]<dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr6/>UTR #6: A Standard Compression Scheme For Unicode</a></cite>, M. Wolf, K. Whistler, C. Wicksteed, M. Davis, A. Freytag, M. Scherer. Unicode Consortium.<dt id=refsSELECTORS>[SELECTORS]<dd><cite><a href=http://dev.w3.org/csswg/selectors/>Selectors</a></cite>, E. Etemad, T. Çelik, D. Glazman, I. Hickson, P. Linss, J. Williams. W3C.<dt id=refsSRGB>[SRGB]<dd><cite lang=en-GB><a href="http://webstore.iec.ch/webstore/webstore.nsf/artnum/025408!OpenDocument&Click=">IEC 61966-2-1: Multimedia systems and equipment — Colour measurement and management — Part 2-1: Colour management — Default RGB colour space — sRGB</a></cite>. IEC.<dt id=refsSVG>[SVG]<dd><cite><a href=http://www.w3.org/TR/SVGTiny12/>Scalable Vector Graphics (SVG) Tiny 1.2 Specification</a></cite>, O. Andersson, R. Berjon, E. Dahlström, A. Emmons, J. Ferraiolo, A. Grasso, V. Hardy, S. Hayman, D. Jackson, C. Lilley, C. McCormack, A. Neumann, C. Northway, A. Quint, N. Ramani, D. Schepers, A. Shellshear. W3C.<dt id=refsTOR>[TOR]<dd>(Non-normative) <cite><a href=https://www.torproject.org/>Tor</a></cite>.<dt id=refsTOUCH>[TOUCH]<dd><cite><a href=https://dvcs.w3.org/hg/webevents/raw-file/v1/touchevents.html>Touch Events</a></cite>, D. Schepers, S. Moon, M. Brubeck, A. Barstow. W3C.<dt id=refsTZDATABASE>[TZDATABASE]<dd>(Non-normative) <cite><a href=http://www.iana.org/time-zones>Time Zone Database</a></cite>. IANA.<dt id=refsUAAG>[UAAG]<dd>(Non-normative) <cite><a href=http://www.w3.org/TR/UAAG20/>User Agent Accessibility Guidelines (UAAG) 2.0</a></cite>, J. Allan, K. Ford, J. Richards, J. Spellman. W3C.<dt id=refsUCA>[UCA]<dd><cite><a href=http://www.unicode.org/reports/tr10/>UTR #10: Unicode Collation Algorithm</a></cite>, M. Davis, K. Whistler. Unicode Consortium.<dt id=refsUNICODE>[UNICODE]<dd><cite><a href=http://www.unicode.org/versions/>The Unicode Standard</a></cite>. Unicode Consortium.<dt id=refsUNIVCHARDET>[UNIVCHARDET]<dd>(Non-normative) <cite><a href=http://www.mozilla.org/projects/intl/UniversalCharsetDetection.html>A composite approach to language/encoding detection</a></cite>, S. Li, K. Momoi. Netscape. In <cite>Proceedings of the 19th International Unicode Conference</cite>.<dt id=refsURL>[URL]<dd><cite><a href=http://url.spec.whatwg.org/>URL</a></cite>, A. van Kesteren. WHATWG.<dt id=refsURN>[URN]<dd><cite><a href=http://tools.ietf.org/html/rfc2141>URN Syntax</a></cite>, R. Moats. IETF.<dt id=refsUTF7>[UTF7]<dd>(Non-normative) <cite><a href=http://tools.ietf.org/html/rfc2152>UTF-7: A Mail-Safe Transformation Format of Unicode</a></cite>, D. Goldsmith, M. Davis. IETF.<dt id=refsUTF8DET>[UTF8DET]<dd>(Non-normative) <cite><a href=http://www.w3.org/International/questions/qa-forms-utf-8>Multilingual form encoding</a></cite>, M. Dürst. W3C.<dt id=refsUTR36>[UTR36]<dd>(Non-normative) <cite><a href=http://www.unicode.org/reports/tr36/>UTR #36: Unicode Security Considerations</a></cite>, M. Davis, M. Suignard. Unicode Consortium.<dt id=refsWCAG>[WCAG]<dd>(Non-normative) <cite><a href=http://www.w3.org/TR/WCAG20/>Web Content Accessibility Guidelines (WCAG) 2.0</a></cite>, B. Caldwell, M. Cooper, L. Reid, G. Vanderheiden. W3C.<dt id=refsWEBGL>[WEBGL]<dd><cite><a href=http://www.khronos.org/registry/webgl/specs/latest/>WebGL Specification</a></cite>, D. Jackson. Khronos Group.<dt id=refsWEBIDL>[WEBIDL]<dd><cite><a href=http://dev.w3.org/2006/webapi/WebIDL/>Web IDL</a></cite>, C. McCormack. W3C.<dt id=refsWEBLINK>[WEBLINK]<dd><cite><a href=http://tools.ietf.org/html/rfc5988>Web Linking</a></cite>, M. Nottingham. IETF.<dt id=refsWEBMCG>[WEBMCG]<dd><cite><a href=http://www.webmproject.org/code/specs/container/>WebM Container Guidelines</a></cite>. The WebM Project.<dt id=refsWEBVTT>[WEBVTT]<dd><cite><a href=http://dev.w3.org/html5/webvtt/>WebVTT</a></cite>, I. Hickson. W3C.<dt id=refsWHATWGWIKI>[WHATWGWIKI]<dd><cite><a href=http://wiki.whatwg.org/>The WHATWG Wiki</a></cite>. WHATWG.<dt id=refsWSP>[WSP]<dd><cite><a href=http://tools.ietf.org/html/rfc6455>The WebSocket protocol</a></cite>, I. Fette, A. Melnikov. IETF.<dt id=refsX121>[X121]<dd><cite>Recommendation X.121 — International Numbering Plan for Public Data Networks</cite>, CCITT Blue Book, Fascicle VIII.3, pp. 317-332.<dt id=refsX690>[X690]<dd><cite><a href=http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf>Recommendation X.690 — Information Technology — ASN.1 Encoding Rules — Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER), and Distinguished Encoding Rules (DER)</a></cite>. International Telecommunication Union.<dt id=refsXFN>[XFN]<dd><cite><a href=http://gmpg.org/xfn/11>XFN 1.1 profile</a></cite>, T. Çelik, M. Mullenweg, E. Meyer. GMPG.<dt id=refsXHR>[XHR]<dd><cite><a href=http://xhr.spec.whatwg.org/><code>XMLHttpRequest</code></a></cite>, A. van Kesteren. WHATWG.<dt id=refsXML>[XML]<dd><cite><a href=http://www.w3.org/TR/xml/>Extensible Markup Language</a></cite>, T. Bray, J. Paoli, C. Sperberg-McQueen, E. Maler, F. Yergeau. W3C.<dt id=refsXMLBASE>[XMLBASE]<dd><cite><a href=http://www.w3.org/TR/xmlbase/>XML Base</a></cite>, J. Marsh, R. Tobin. W3C.<dt id=refsXMLNS>[XMLNS]<dd><cite><a href=http://www.w3.org/TR/xml-names/>Namespaces in XML</a></cite>, T. Bray, D. Hollander, A. Layman, R. Tobin. W3C.<dt id=refsXMLSSPI>[XMLSSPI]<dd><cite><a href=http://www.w3.org/TR/xml-stylesheet/>Associating Style Sheets with XML documents</a></cite>, J. Clark, S. Pieters, H. Thompson. W3C.<dt id=refsXPATH10>[XPATH10]<dd><cite><a href=http://www.w3.org/TR/1999/REC-xpath-19991116>XML Path Language (XPath) Version 1.0</a></cite>, J. Clark, S. DeRose. W3C.<dt id=refsXSLT10>[XSLT10]<dd>(Non-normative) <cite><a href=http://www.w3.org/TR/1999/REC-xslt-19991116>XSL Transformations (XSLT) Version 1.0</a></cite>, J. Clark. W3C.</dl>
- <h2 id=acknowledgements class=no-num>Acknowledgements</h2>
- <p>Thanks to Tim Berners-Lee for inventing HTML, without which none of this would exist.</p>
- <p>Thanks to
- Aankhen,
- Aaron Boodman,
- Aaron Leventhal,
- Adam Barth,
- Adam de Boor,
- Adam Hepton,
- Adam Klein,
- Adam Roben,
- Addison Phillips,
- Adele Peterson,
- Adrian Bateman,
- Adrian Sutton,
- Agustín Fernández,
- Aharon (Vladimir) Lanin,
- Ajai Tirumali,
- Akatsuki Kitamura,
- Alan Plum,
- Alastair Campbell,
- Alejandro G. Castro,
- Alex Bishop,
- Alex Nicolaou,
- Alex Rousskov,
- Alexander Farkas,
- Alexander J. Vincent,
- Alexandre Morgaut,
- Alexey Feldgendler,
- Алексей Проскуряков (Alexey Proskuryakov),
- Alexis Deveria,
- Allan Clements,
- Ami Fischman,
- Amos Jeffries,
- Anders Carlsson,
- André E. Veltstra,
- Andrea Rendine,
- Andreas,
- Andreas Kling,
- Andrei Popescu,
- Andres Gomez,
- Andrew Barfield,
- Andrew Clover,
- Andrew Gove,
- Andrew Grieve,
- Andrew Oakley,
- Andrew Sidwell,
- Andrew Simons,
- Andrew Smith,
- Andrew W. Hagen,
- Andrey V. Lukyanov,
- Andry Rendy,
- Andy Earnshaw,
- Andy Heydon,
- Andy Palay,
- Anne van Kesteren,
- Anthony Boyd,
- Anthony Bryan,
- Anthony Hickson,
- Anthony Ricaud,
- Antti Koivisto,
- Arkadiusz Michalski,
- Arne Thomassen,
- Aron Spohr,
- Arphen Lin,
- Arthur Stolyar,
- Arun Patole,
- Aryeh Gregor,
- Asbjørn Ulsberg,
- Ashley Gullen,
- Ashley Sheridan,
- Atsushi Takayama,
- Aurelien Levy,
- Ave Wrigley,
- Axel Dahmen,
- Ben Boyle,
- Ben Godfrey,
- Ben Lerner,
- Ben Leslie,
- Ben Meadowcroft,
- Ben Millard,
- Benjamin Carl Wiley Sittler,
- Benjamin Hawkes-Lewis,
- Benoit Ren,
- Bert Bos,
- Bijan Parsia,
- Bil Corry,
- Bill Mason,
- Bill McCoy,
- Billy Wong,
- Bjartur Thorlacius,
- Björn Höhrmann,
- Blake Frantz,
- Bob Lund,
- Bob Owen,
- Boris Zbarsky,
- Brad Fults,
- Brad Neuberg,
- Brad Spencer,
- Brady Eidson,
- Brendan Eich,
- Brenton Simpson,
- Brett Wilson,
- Brett Zamir,
- Brian Blakely,
- Brian Campbell,
- Brian Korver,
- Brian Kuhn,
- Brian M. Dube,
- Brian Ryner,
- Brian Smith,
- Brian Wilson,
- Bryan Sullivan,
- Bruce Bailey,
- Bruce D'Arcus,
- Bruce Lawson,
- Bruce Miller,
- C. Williams,
- Cameron McCormack,
- Cameron Zemek,
- Cao Yipeng,
- Carlos Amengual,
- Carlos Gabriel Cardona,
- Carlos Perelló Marín,
- Chao Cai,
- 윤석찬 (Channy Yun),
- Charl van Niekerk,
- Charles Iliya Krempeaux,
- Charles McCathieNevile,
- Chris Apers,
- Chris Cressman,
- Chris Evans,
- Chris Morris,
- Chris Pearce,
- Chris Peterson,
- Chris Weber,
- Christian Biesinger,
- Christian Johansen,
- Christian Schmidt,
- Christoph Päper,
- Christophe Dumez,
- Christopher Aillon,
- Christopher Ferris,
- Chriswa,
- Clark Buehler,
- Cole Robison,
- Colin Fine,
- Collin Jackson,
- Corprew Reed,
- Craig Cockburn,
- Csaba Gabor,
- Csaba Marton,
- Cynthia Shelly,
- Dan Yoder,
- Daniel Barclay,
- Daniel Bratell,
- Daniel Brooks,
- Daniel Brumbaugh Keeney,
- Daniel Cheng,
- Daniel Davis,
- Daniel Glazman,
- Daniel Peng,
- Daniel Schattenkirchner,
- Daniel Spång,
- Daniel Steinberg,
- Daniel Trebbien,
- Danny Sullivan,
- Darin Adler,
- Darin Fisher,
- Darxus,
- Dave Camp,
- Dave Hodder,
- Dave Lampton,
- Dave Singer,
- Dave Townsend,
- David Baron,
- David Bloom,
- David Bruant,
- David Carlisle,
- David E. Cleary,
- David Egan Evans,
- David Fink,
- David Flanagan,
- David Gerard,
- David Håsäther,
- David Hyatt,
- David I. Lehn,
- David John Burrowes,
- David Kendal,
- David Matja,
- David Remahl,
- David Smith,
- David Woolley,
- DeWitt Clinton,
- Dean Edridge,
- Dean Edwards,
- Debi Orton,
- Derek Featherstone,
- Devarshi Pant,
- Devdatta,
- Dimitri Glazkov,
- Dimitry Golubovsky,
- Dirk Pranke,
- Dirk Schulze,
- Dirkjan Ochtman,
- Divya Manian,
- Dmitry Titov,
- dolphinling,
- Domenic Denicola,
- Dominique Hazaël-Massieux,
- Don Brutzman,
- Doron Rosenberg,
- Doug Kramer,
- Doug Simpkinson,
- Drew Wilson,
- Edmund Lai,
- Eduard Pascual,
- Eduardo Vela,
- Edward O'Connor,
- Edward Welbourne,
- Edward Z. Yang,
- Ehsan Akhgari,
- Eira Monstad,
- Eitan Adler,
- Eliot Graff,
- Elisabeth Robson,
- Elizabeth Castro,
- Elliott Sprehn,
- Elliotte Harold,
- Eric Carlson,
- Eric Casler,
- Eric Lawrence,
- Eric Rescorla,
- Eric Semling,
- Erik Arvidsson,
- Erik Rose,
- Evan Martin,
- Evan Prodromou,
- Evan Stade,
- Evert,
- fantasai,
- Felix Sasaki,
- Francesco Schwarz,
- Francis Brosnan Blazquez,
- Franck 'Shift' Quélain,
- Frank Barchard,
- Fredrik Söderquist,
- 鵜飼文敏 (Fumitoshi Ukai),
- Futomi Hatano,
- Gavin Carothers,
- Gavin Kistner,
- Gareth Rees,
- Garrett Smith,
- Geoff Richards,
- Geoffrey Garen,
- Geoffrey Sneddon,
- George Lund,
- Gianmarco Armellin,
- Giovanni Campagna,
- Giuseppe Pascale,
- Glenn Adams,
- Glenn Maynard,
- Graham Klyne,
- Greg Botten,
- Greg Houston,
- Greg Wilkins,
- Gregg Tavares,
- Gregory J. Rosmaita,
- Grey,
- Guilherme Johansson Tramontina,
- Gytis Jakutonis,
- Håkon Wium Lie,
- Habib Virji,
- Hallvord Reiar Michaelsen Steen,
- Hans S. Tømmerhalt,
- Hans Stimer,
- Harald Alvestrand,
- Henri Sivonen,
- Henrik Lied,
- Henry Mason,
- Henry Story,
- Hugh Guiney,
- Hugh Winkler,
- Ian Bicking,
- Ian Clelland,
- Ian Davis,
- Ian Fette,
- Ido Green,
- Ignacio Javier,
- Ivan Enderlin,
- Ivo Emanuel Gonçalves,
- J. King,
- Jacob Davies,
- Jacques Distler,
- Jake Verbaten,
- Jakub Łopuszański,
- James Craig,
- James Graham,
- James Greene,
- James Justin Harrell,
- James Kozianski,
- James M Snell,
- James Perrett,
- James Robinson,
- Jamie Lokier,
- Janusz Majnert,
- Jan-Klaas Kollhof,
- Jared Jacobs,
- Jason Duell,
- Jason Kersey,
- Jason Lustig,
- Jason White,
- Jasper Bryant-Greene,
- Jasper St. Pierre,
- Jatinder Mann,
- Jed Hartman,
- Jeff Balogh,
- Jeff Cutsinger,
- Jeff Schiller,
- Jeff Walden,
- Jeffrey Zeldman,
- 胡慧鋒 (Jennifer Braithwaite),
- Jens Bannmann,
- Jens Fendler,
- Jens Lindström,
- Jens Meiert,
- Jeremey Hustman,
- Jeremy Keith,
- Jeremy Orlow,
- Jeroen van der Meer,
- Jian Li,
- Jim Jewett,
- Jim Ley,
- Jim Meehan,
- Jim Michaels,
- Jirka Kosek,
- Jjgod Jiang,
- João Eiras,
- Joe Clark,
- Joe Gregorio,
- Joel Spolsky,
- Joel Verhagen,
- Johan Herland,
- John Boyer,
- John Bussjaeger,
- John Carpenter,
- John Daggett,
- John Fallows,
- John Foliot,
- John Harding,
- John Keiser,
- John Snyders,
- John Stockton,
- John-Mark Bell,
- Johnny Stenback,
- Jon Ferraiolo,
- Jon Gibbins,
- Jon Perlow,
- Jonas Sicking,
- Jonathan Cook,
- Jonathan Rees,
- Jonathan Watt,
- Jonathan Worent,
- Jonny Axelsson,
- Jordan Tucker,
- Jorgen Horstink,
- Jorunn Danielsen Newth,
- Joseph Kesselman,
- Joseph Mansfield,
- Joseph Pecoraro,
- Josh Aas,
- Josh Hart,
- Josh Levenberg,
- Joshua Bell,
- Joshua Randall,
- Jukka K. Korpela,
- Jules Clément-Ripoche,
- Julian Reschke,
- Jürgen Jeka,
- Justin Lebar,
- Justin Novosad,
- Justin Schuh,
- Justin Sinclair,
- Ka-Sing Chou,
- Kai Hendry,
- 呂康豪 (KangHao Lu),
- Kartikaya Gupta,
- Kathy Walton,
- Kelly Ford,
- Kelly Norton,
- Kevin Benson,
- Kevin Gadd,
- Kevin Cole,
- Kornél Pál,
- Kornel Lesinski,
- Kris Northfield,
- Kristof Zelechovski,
- Krzysztof Maczyński,
- 黒澤剛志 (Kurosawa Takeshi),
- Kyle Barnhart,
- Kyle Hofmann,
- Kyle Huey,
- Léonard Bouchet,
- Léonie Watson,
- Lachlan Hunt,
- Larry Masinter,
- Larry Page,
- Lars Gunther,
- Lars Solberg,
- Laura Carlson,
- Laura Granka,
- Laura L. Carlson,
- Laura Wisewell,
- Laurens Holst,
- Lawrence Forooghian,
- Lee Kowalkowski,
- Leif Halvard Silli,
- Leif Kornstaedt,
- Lenny Domnitser,
- Leonard Rosenthol,
- Leons Petrazickis,
- Lobotom Dysmon,
- Logan,
- Loune,
- Łukasz Pilorz,
- Luke Kenneth Casson Leighton,
- Maciej Stachowiak,
- Magnus Kristiansen,
- Maik Merten,
- Malcolm Rowe,
- Manish Tripathi,
- Marc Hoyois,
- Marcus Bointon,
- Mark Birbeck,
- Mark Davis,
- Mark Miller,
- Mark Nottingham,
- Mark Pilgrim,
- Mark Rowe,
- Mark Schenk,
- Mark Vickers,
- Mark Wilton-Jones,
- Martijn Wargers,
- Martin Atkins,
- Martin Dürst,
- Martin Honnen,
- Martin Janecke,
- Martin Kutschker,
- Martin Nilsson,
- Martin Thomson,
- Masataka Yakura,
- Masatoshi Kimura,
- Mason Mize,
- Mathias Bynens,
- Mathieu Henri,
- Matias Larsson,
- Matt Falkenhagen,
- Matt Schmidt,
- Matt Wright,
- Matthew Gregan,
- Matthew Mastracci,
- Matthew Noorenberghe,
- Matthew Raymond,
- Matthew Thomas,
- Mattias Waldau,
- Max Romantschuk,
- Menachem Salomon,
- Menno van Slooten,
- Micah Dubinko,
- Michael 'Ratt' Iannarelli,
- Michael A. Nachbaur,
- Michael A. Puls II,
- Michael Carter,
- Michael Daskalov,
- Michael Day,
- Michael Dyck,
- Michael Enright,
- Michael Gratton,
- Michael Nordman,
- Michael Powers,
- Michael Rakowski,
- Michael(tm) Smith,
- Michael Walmsley,
- Michal Zalewski,
- Michel Fortin,
- Michelangelo De Simone,
- Michiel van der Blonk,
- Mihai Şucan,
- Mihai Parparita,
- Mike Brown,
- Mike Dierken,
- Mike Dixon,
- Mike Hearn,
- Mike Schinkel,
- Mike Shaver,
- Mikko Rantalainen,
- Mohamed Zergaoui,
- Mohammad Al Houssami,
- Mounir Lamouri,
- Ms2ger,
- Nadia Heninger,
- NARUSE Yui,
- Neil Deakin,
- Neil Rashbrook,
- Neil Soiffer,
- Nicholas Shanks,
- Nicholas Stimpson,
- Nicholas Zakas,
- Nickolay Ponomarev,
- Nicolas Gallagher,
- Noah Mendelsohn,
- Noah Slater,
- Noel Gordon,
- Nolan Waite,
- NoozNooz42,
- Norbert Lindenberg,
- Ojan Vafai,
- Olaf Hoffmann,
- Olav Junker Kjær,
- Oldřich Vetešník,
- Oli Studholme,
- Oliver Hunt,
- Oliver Rigby,
- Olivier Gendrin,
- Olli Pettay,
- oSand,
- Pablo Flouret,
- Patrick Garies,
- Patrick H. Lauke,
- Patrik Persson,
- Paul Adenot,
- Paul Norman,
- Per-Erik Brodin,
- Perry Smith,
- Peter Beverloo,
- Peter Karlsson,
- Peter Kasting,
- Peter Moulder,
- Peter Occil,
- Peter Stark,
- Peter Van der Beken,
- Peter-Paul Koch,
- Phil Pickering,
- Philip Jägenstedt,
- Philip Taylor,
- Philip TAYLOR,
- Philippe De Ryck,
- Prateek Rungta,
- Pravir Gupta,
- 李普君 (Pujun Li),
- Rachid Finge,
- Rafael Weinstein,
- Rafał Miłecki,
- Raj Doshi,
- Rajas Moonka,
- Ralf Stoltze,
- Ralph Giles,
- Raphael Champeimont,
- Remci Mizkur,
- Remco,
- Remy Sharp,
- Rene Saarsoo,
- Rene Stach,
- Ric Hardacre,
- Rich Clark,
- Rich Doughty,
- Richard Ishida,
- Rigo Wenning,
- Rikkert Koppes,
- Rimantas Liubertas,
- Riona Macnamara,
- Rob Ennals,
- Rob Jellinghaus,
- Rob S,
- Robert Blaut,
- Robert Collins,
- Robert Kieffer,
- Robert Millan,
- Robert O'Callahan,
- Robert Sayre,
- Robin Berjon,
- Robin Schaufler,
- Rodger Combs,
- Roland Steiner,
- Roma Matusevich,
- Roman Ivanov,
- Roy Fielding,
- Ruud Steltenpool,
- Ryan King,
- Ryosuke Niwa,
- S. Mike Dierken,
- Salvatore Loreto,
- Sam Dutton,
- Sam Kuper,
- Sam Ruby,
- Sam Weinig,
- Samuel Bronson,
- Samy Kamkar,
- Sander van Lambalgen,
- Sanjoy Pal,
- Sarven Capadisli,
- Scott González,
- Scott Hess,
- Sean Fraser,
- Sean Hayes,
- Sean Hogan,
- Sean Knapp,
- Sebastian Markbåge,
- Sebastian Schnitzenbaumer,
- Seth Call,
- Seth Dillingham,
- Shannon Moeller,
- Shanti Rao,
- Shaun Inman,
- Shiki Okasaka,
- Sierk Bornemann,
- Sigbjørn Finne,
- Sigbjørn Vik,
- Silver Ghost,
- Silvia Pfeiffer,
- Šime Vidas,
- Simon Montagu,
- Simon Pieters,
- Simon Spiegel,
- skeww,
- Smylers,
- Stanton McCandlish,
- Stefan Håkansson,
- Stefan Haustein,
- Stefan Santesson,
- Stefan Weiss,
- Steffen Meschkat,
- Stephen Ma,
- Stephen White,
- Steve Comstock,
- Steve Faulkner,
- Steve Runyon,
- Steven Bennett,
- Steven Garrity,
- Steven Tate,
- Stewart Brodie,
- Stuart Ballard,
- Stuart Langridge,
- Stuart Parmenter,
- Subramanian Peruvemba,
- Sunava Dutta,
- Susan Borgrink,
- Susan Lesch,
- Sylvain Pasche,
- T. J. Crowder,
- Tab Atkins,
- Takeshi Yoshino,
- <span lang=tr>Tantek Çelik</span>,
- 田村健人 (TAMURA Kent),
- Ted Mielczarek,
- Terrence Wood,
- Thijs van der Vossen,
- Thomas Broyer,
- Thomas Koetter,
- Thomas O'Connor,
- Tim Altman,
- Tim Johansson,
- TJ VanToll,
- Toby Inkster,
- Todd Moody,
- Tom Baker,
- Tom Pike,
- Tommy Thorsen,
- Tony Ross,
- Travis Leithead,
- Trevor Saunders,
- Tyler Close,
- Victor Carbune,
- Vipul Snehadeep Chawathe,
- Vitya Muhachev,
- Vladimir Katardjiev,
- Vladimir Vukićević,
- voracity,
- Wakaba,
- Wayne Carr,
- Wayne Pollock,
- Wellington Fernando de Macedo,
- Weston Ruter,
- Wilhelm Joys Andersen,
- Will Levine,
- William Chen,
- William Swanson,
- Wladimir Palant,
- Wojciech Mach,
- Wolfram Kriesing,
- Xan Gregg,
- Yang Chen,
- Ye-Kui Wang,
- Yehuda Katz,
- Yi-An Huang,
- Yngve Nysaeter Pettersen,
- Yonathan Randolph,
- Yuzo Fujishima,
- Zhenbin Xu,
- Zoltan Herczeg,
- and
- Øistein E. Andersen,
- for their useful comments, both large and small, that have led to changes to this specification
- over the years.</p>
- <p>Thanks also to everyone who has ever posted about HTML to their blogs, public mailing lists, or
- forums, including all the contributors to the <a href=http://www.w3.org/html/wg/lists/>various
- W3C HTML WG lists</a> and the <a href=//www.whatwg.org/mailing-list>various WHATWG
- lists</a>.
- <p>Special thanks to Richard Williamson for creating the first implementation of
- <code id=acknowledgements:the-canvas-element><a href=#the-canvas-element>canvas</a></code> in Safari, from which the canvas feature was designed.</p>
- <p>Special thanks also to the Microsoft employees who first implemented the event-based
- drag-and-drop mechanism, <code id=acknowledgements:attr-contenteditable><a href=#attr-contenteditable>contenteditable</a></code>, and other
- features first widely deployed by the Windows Internet Explorer browser.</p>
- <p>Special thanks and $10,000 to David Hyatt who came up with a broken implementation
- of the <a href=#adoptionAgency>adoption agency algorithm</a> that the editor had to reverse
- engineer and fix before using it in the parsing section.</p>
- <p>Thanks to the participants of the microdata usability study for allowing us to use their
- mistakes as a guide for designing the microdata feature.</p>
- <p>Thanks to the many sources that provided inspiration for the examples used in the
- specification.</p>
- <p>Thanks also to the Microsoft blogging community for some ideas, to the attendees of the W3C
- Workshop on Web Applications and Compound Documents for inspiration, to the #mrt crew, the #mrt.no
- crew, and the #whatwg crew, and to Pillar and Hedral for their ideas and support.</p>
- <p>Thanks to Igor Zhbanov for generating PDF versions of the specification.</p>
- <p>This specification is written by Ian Hickson (Google, ian@hixie.ch), with contributions from
- Simon Pieters (Opera, simonp@opera.com) in the <code id=acknowledgements:the-img-element><a href=#the-img-element>img</a></code> section.</p>
-
- <div itemtype=http://n.whatwg.org/work itemscope="">
- <p>The image in the introduction is based on <a itemprop=work href=http://www.flickr.com/photos/wonderlane/2986252088/>a photo</a>
- by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/wonderlane/>Wonderlane</a>.
- (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
- </div>
-
- <div itemtype=http://n.whatwg.org/work itemscope="">
- <p>The image of two cute kittens in a basket used in the context menu example is based on
- <a itemprop=work href=http://www.flickr.com/photos/digidreamgrafix/8370087640/>a photo</a>
- by <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/digidreamgrafix/>Alex G</a>.
- (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)
- </div>
- <div itemtype=http://n.whatwg.org/work itemscope="">
- <p>The Blue Robot Player sprite used in the canvas demo is based on
- <a itemprop=work href=http://johncolburn.deviantart.com/art/Blue-Robot-Player-Sprite-323813997>a work</a> by
- <a itemprop=http://creativecommons.org/ns#attributionURL href=http://johncolburn.deviantart.com/>JohnColburn</a>.
- (<a itemprop=license href=http://creativecommons.org/licenses/by-sa/3.0/>CC BY-SA 3.0</a>)</p>
- </div>
- <div itemtype=http://n.whatwg.org/work itemscope="">
- <p>The photograph of robot 148 climbing the tower at the FIRST Robotics Competition 2013 Silicon Valley Regional is based on
- <a itemprop=work href=http://www.flickr.com/photos/lenore-m/8631391979/>a work</a> by
- <a itemprop=http://creativecommons.org/ns#attributionURL href=http://www.flickr.com/photos/lenore-m/>Lenore Edman</a>.
- (<a itemprop=license href=http://creativecommons.org/licenses/by/2.0/>CC BY 2.0</a>)</p>
- </div>
- <p>Parts of this specification are © Copyright 2004-2014 Apple Inc., Mozilla Foundation, and
- Opera Software ASA. You are granted a license to use, reproduce and create derivative works of
- this document.</p>
-
-
|